Update code.py

This commit is contained in:
Paillat
2022-12-06 21:51:40 +01:00
parent f8f19a03fb
commit bc1cf95ca6

View File

@@ -435,6 +435,7 @@ async def transcript(ctx, channel: discord.TextChannel = None):
messages.reverse() messages.reverse()
transcript = "" transcript = ""
#defer the response #defer the response
await ctx.defer() #defer the response so that the bot doesn't say that it's thinking
for msg in messages: for msg in messages:
if msg.author.bot: if msg.author.bot:
transcript += f"Botator: {msg.content}\n" transcript += f"Botator: {msg.content}\n"
@@ -464,6 +465,7 @@ async def transcript(ctx, channel: discord.TextChannel = None):
await ctx.author.send(file=discord.File("transcript.txt")) await ctx.author.send(file=discord.File("transcript.txt"))
#delete the file #delete the file
os.remove("transcript.txt") os.remove("transcript.txt")
return await ctx.channel.purge()
#these are debug commands and should not be used in production #these are debug commands and should not be used in production
@bot.command(name="say", description="Say a message") @bot.command(name="say", description="Say a message")
async def say(ctx, message: str): async def say(ctx, message: str):