W
W
WhatTheCucumber2020-11-11 06:31:48
Python
WhatTheCucumber, 2020-11-11 06:31:48

How can I prevent a bot from deleting the last messages in 24 hours when a user is banned?

Here's the ban code just in case:

@bot.command()
@commands.has_any_role(00000000000000000000000)
async def ban( ctx, member: discord.Member, *, reason = None):
        await member.ban( reason = reason )
        await ctx.send ( f'{member.mention} был забанен на сервере. Причина: {reason}.')


Discord's default is to delete user messages 24 hours in advance. How to make the bot not delete anything? I didn't find anything in the api reference.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-11-11
@WhatTheCucumber

Let's look at the documentation for Member.ban again:
q4YM1yd.png
We see that Member.ban is equal to Guild.ban , and go to the documentation for Guild.ban, and notice that there is a kwarg delete_message_days, just equal to 1 by default:
5kmDKru.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question