what are discord bots
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = '!')
@client.event
async def on_ready():
print('Bot is Connected!')
@client.command() # An example message command
async def ping(ctx):
await ctx.send('Pong!')
@client.command() # An example timer
async def timer(ctx, timeSecond):
try:
timeSeconds = int(timeSecond)
timer_msg = await ctx.send(f'**{timeSeconds}** seconds remaining!')
while timeSecond != 0:
timeSeconds -= 1
timer_msg.edit(content=f'**{timeSeconds}** seconds remaining!')
await ctx.send(f'{ctx.author.mention} **TIMER ENDED!!!**')
except ValueError:
await ctx.send('Sorry, it must be a number!')
client.run('TOKEN') # <--------- Your Discord bot Token Here