Answer the question
In order to leave comments, you need to log in
How to make the bot with buttons react to past messages on reload?
I have a code for a bot:
@bot.command()
async def tesss(ctx):
emb = discord.Embed(title = ':pencil: Роли Discord', description = "**Автоматическое выдача роли - <@&792385427679477790>**", colour = 0xFF005C)
emb.set_image(url = 'https://media.discordapp.net/attachments/716571065270140938/880854910005047366/-7.png?width=701&height=701')
emb.set_footer(text = 'Monro FamQ', icon_url = 'https://media.discordapp.net/attachments/716571065270140938/880854176735854622/-6.png?width=701&height=701')
await ctx.send(
embed = emb,
components = [
Button(style = ButtonStyle.green, label = "Стать другом Monro!", emoji = '❤️'),
Button(style = ButtonStyle.blue, label = "Получить дополнительные роли!", emoji = '❤️'),
Button(style = ButtonStyle.red, label = "Перестать быть другом Monro!")
]
)
Answer the question
In order to leave comments, you need to log in
I agree with the speakers who recommend changing the hosting, but you can fasten the database (well, or just a file) and save the context to it (using, for example, pickle) and, when loading, accordingly check for the presence of the saved context. With bot apis, I have never had such a need, to be honest, - maybe some specifics will come out, but when finalized with a file, it definitely has to take off.
The answer is to change the hosting that does not restart the bot. Or not at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question