dicord bots code example

Example 1: discord bot

use Discord4J

Example 2: 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