Answer the question
In order to leave comments, you need to log in
Error await ctx.command.invoke(ctx) how to fix?
Good day, help, 2 days I've been racking my brain here is the code:
import discord
from discord.ext import commands
import asyncio
DISCORD_BOT_TOKEN = 'SECRET'
bot = commands.Bot(command_prefix= '~')
@bot.event
async def on_ready():
print ("Good")
@bot.command()
async def clean(args, message, client, invoke,):
try:
ammount = int(args[0]) + 1 if len(args) > 0 else 2
except:
await client.send_message(message.channel, embed=discord.Embed(color=discord.Color.red(), description="write amount"))
return
cleared = 0
failed = 0
async for m in client.logs_from(message.channel, limit=amount):
try:
await client.delete_message(m)
cleared += 1
except:
failed += 1
pass
failed_str = "\n\n Failed %s djjnv" % failed if failed > 0 else "fenfek"
returnmg = await client.send_message(messag.channel, embed=discord.Embed(color=discord.Color.blue(), description="fjweijiwji %s" %s(cleared, failed_msg)))
await asyncio.sleep (3)
await client.delete_message(returnmsg)
bot.run(DISCORD_BOT_TOKEN, bot=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question