Есть проблема - не работают команды. Причем в консоли, данный код, бот успешно загружает. Но при вводе команд, прописанных в коде - ответа нет. Прошу помочь мне с данным недоразумением.
Заранее спасибо!
Команд loader:
if __name__ == "__main__":
for file in os.listdir("cogs"):
if file.endswith(".py"):
extension = file[:-3]
try:
bot.load_extension(f"cogs.{extension}")
print(f"Loaded extension '{extension}'")
except Exception as e:
exception = f"{type(e).__name__}: {e}"
print(f"Failed to load extension {extension}\n{exception}")
Сам код с командой
import json
import os
import sys
import pymysql.cursors
import discord
from discord.ext import commands
db = pymysql.connect(host='',
port=25060,
user='bot',
password='',
database='bot',
cursorclass=pymysql.cursors.DictCursor)
with db.cursor() as cursor:
# Read a single record
sql = ("select `id` from `owners`")
cursor.execute(sql)
result = cursor.fetchall()
with db.cursor() as cursor:
# Read a single record
sql = "SELECT `id` FROM `blacklisted`"
cursor.execute(sql)
bl = cursor.fetchall()
class owner(commands.Cog, name="owner"):
def __init__(self, bot):
self.bot = bot
@commands.command(name="shutdown")
async def shutdown(self, context, message):
if context.message.author.id:
embed = discord.Embed(
description="сдох. покеда :wave:",
color=0x42F56C
)
await context.send(embed=embed)
await self.bot.close()
await message.channel.send('ок')
else:
embed = discord.Embed(
title="Ошибка!",
description="У вас недостаточно прав для выполнения данной команды",
color=0xE02B2B
)
await context.send(embed=embed)
await message.channel.send('ok')
def setup(bot):
bot.add_cog(owner(bot))