У меня почему-то возникает ошибка:
Ignoring exception in command gif:
Traceback (most recent call last):
File "C:\Users\diman\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\PIVNUSHKA\cogs\gif.py", line 28, in gif
await ctx.send(emb=emb)
AttributeError: 'gif' object has no attribute 'send'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\diman\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\diman\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\diman\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'gif' object has no attribute 'send'
Мой код:
import random
from turtle import color, title
import discord
from discord.ext import commands
gifs = [
"url", "url", "url",
"url", "url", "url",
"url", "url", "url"
]
class gif(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print(1)
@commands.command()
async def gif(ctx, self):
emb = discord.Embed(colour = discord.Color.red() )
emb.add_field(name = 'name1', value = 'value1')
emb.set_image(url = random.choice(gifs))
await ctx.send(emb=emb)
def setup(client):
client.add_cog(gif(client))