Skip to content
Live countdown bot for Discord
Profile icon

I'm trying to develope a bot that can live countdown in the channel.

If a user type '!t', then the bot will send a message with 'Timer is running - 5 seconds' and it keeps mentioning exactly the time remaining in the same message every time the time passes by 1 second such "Timer is running - 3 seconds, Timer is running - 1 seconds"....
And when it reaches 0 seconds then the message will be 'Timer ends - 0'

I just google it and found some code to apply this function, but have no idea if it's correct. Could anyone help one this?

import discord
import random
import os
import time

client = discord.Client()

async def on_ready():
print('We have logged in as {0.user}'.format(client))

async def on_message(message):
if == client.user:

if message.content.startswith('!t'): Text = "" learn = message.content.split(" ") vrsize = len(learn) vrsize = int(vrsize) for i in range(1, vrsize): Text = Text + " " + learn[i] secint = int(Text) sec = secint for i in range(sec, 0, -1): print(i) await client.send_message(, embed=discord.Embed(description='Timer is running : '+str(i)+'second')) time.sleep(1) else: print("GO") await client.send_message(, embed=discord.Embed(description='Timer ends'))'TOKEN'))

You are viewing a single comment. View All
Profile icon