From 0e16fcb8a89650ead9fd07ad4d4f4a05f7025331 Mon Sep 17 00:00:00 2001 From: Paillat Date: Tue, 6 Dec 2022 21:58:59 +0100 Subject: [PATCH] Update code.py --- code/code.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/code.py b/code/code.py index 6a1605c..4a24ad2 100644 --- a/code/code.py +++ b/code/code.py @@ -427,8 +427,8 @@ async def disable_tts(ctx): #send a message await ctx.respond("TTS has been disabled", ephemeral=True) @bot.command(name="transcript", description="Get a transcript of the messages that have been sent in this channel intoa text file") -@discord.commands.option(name="channel", description="The channel to send the transcript to", required=False) -async def transcript(ctx, channel: discord.TextChannel = None): +@discord.commands.option(name="channel_send", description="The channel to send the transcript to", required=False) +async def transcript(ctx, channel_send: discord.TextChannel = None): debug(f"The user {ctx.author.display_name} ran the transcript command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") #save all the messages in the channel in a txt file and send it messages = await ctx.channel.history(limit=None).flatten() @@ -458,14 +458,14 @@ async def transcript(ctx, channel: discord.TextChannel = None): f.write(transcript) f.close() #send the file in a private message to the user who ran the command - if channel is None: + if channel_send is None: await ctx.respond(file=discord.File("transcript.txt")) else: - await channel.send(file=discord.File("transcript.txt")) + await channel_send.send(file=discord.File("transcript.txt")) + await ctx.respond("Transcript sent!", ephemeral=True) await ctx.author.send(file=discord.File("transcript.txt")) #delete the file os.remove("transcript.txt") - return await ctx.channel.purge() #these are debug commands and should not be used in production @bot.command(name="say", description="Say a message") async def say(ctx, message: str):