countdown-bot

A Discord bot that runs countdown games and generates analytics
git clone https://git.ashermorgan.net/countdown-bot/
Log | Files | Refs | README

commit debacc3ebef22714fc0249c58ddf2ca6c2710214
parent c74f20f5cb61b6c1d5cc08c4117c7e1a95c9d55d
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date:   Sat, 23 Jan 2021 14:08:38 -0800

Implement refresh command.

Diffstat:
Mbot.py | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/bot.py b/bot.py @@ -361,6 +361,33 @@ async def progress(ctx): +@bot.command() +async def refresh(ctx): + """ + Refreshes the countdown. + """ + + if (ctx.channel.id in channels): + # Get messages + rawMessages = await bot.get_channel(ctx.channel.id).history(limit=10100).flatten() + rawMessages.reverse() + + # Create countdown + countdowns[str(ctx.channel.id)] = Countdown([]) + + # Load messages + for rawMessage in rawMessages: + await countdowns[str(ctx.channel.id)].parseMessage(rawMessage) + + # Print status + print(f"Reloaded messages from {bot.get_channel(ctx.channel.id)}") + await ctx.channel.send("Done!") + + else: + await ctx.channel.send("This command must be used in the countdown channel") + + + # Command aliases @bot.command() async def c(ctx):