mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
Update code.py
This commit is contained in:
10
code/code.py
10
code/code.py
@@ -427,7 +427,8 @@ async def disable_tts(ctx):
|
|||||||
#send a message
|
#send a message
|
||||||
await ctx.respond("TTS has been disabled", ephemeral=True)
|
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")
|
@bot.command(name="transcript", description="Get a transcript of the messages that have been sent in this channel intoa text file")
|
||||||
async def transcript(ctx):
|
@discord.commands.options(name="channel", description="The channel to send the transcript to", type=3, required=False)
|
||||||
|
async def transcript(ctx, channel: 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}")
|
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
|
#save all the messages in the channel in a txt file and send it
|
||||||
messages = await ctx.channel.history(limit=None).flatten()
|
messages = await ctx.channel.history(limit=None).flatten()
|
||||||
@@ -457,8 +458,13 @@ async def transcript(ctx):
|
|||||||
f.write(transcript)
|
f.write(transcript)
|
||||||
f.close()
|
f.close()
|
||||||
#send the file in a private message to the user who ran the command
|
#send the file in a private message to the user who ran the command
|
||||||
|
if channel is None:
|
||||||
|
await ctx.respond(file=discord.File("transcript.txt"))
|
||||||
|
else:
|
||||||
|
await channel.send(file=discord.File("transcript.txt"))
|
||||||
await ctx.author.send(file=discord.File("transcript.txt"))
|
await ctx.author.send(file=discord.File("transcript.txt"))
|
||||||
await ctx.respond(file=discord.File("transcript.txt"))
|
#delete the file
|
||||||
|
os.remove("transcript.txt")
|
||||||
#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):
|
||||||
|
|||||||
Reference in New Issue
Block a user