code discord bot code example
Example 1: Discord.py bot example
#Anything commented out is optional
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='prefix here')
@bot.event
async def on_ready():
# await bot.change_presence(activity=discord.Game(name="Rich Presence Here"))
print('Logged in as: ' + bot.user.name)
print('Ready!\n')
@bot.command()
async def commandname(ctx, *, somevariable)
#If you don't need a variable, then you only need (ctx)
# """Command description"""
Code goes here
await ctx.send('Message')
bot.run('yourtoken')
Example 2: how to make a discord bot
//discord.js is probably the easiest to learn. To install do this
//in command prompt (Windows, Linux) or terminal (Mac)
npm init
//and then
npm i discord.js
//after that just read the discord.js.org documentation
//and follow a couple yt guides, maybe join some servers.