1import discord
2from discord.ext import commands
3client = commands.Bot(command_prefix='!!') # This sets the prefix change if you want
4
5TOKEN = 'insert token here' # tutorial at the bottom
6
7@client.event
8def on_ready():
9 print('Ready. Logged in as: {0.user}'.format(client)) # lets you know the bot is online and ready
10
11
12# Now to see how to send a message to discord itself
13@client.command(brief='Echoes back what user says.')
14async def echo(ctx, *, user_message):
15 # The ctx is so that we can send the message on discord
16 # The astrix is so we can take multiple strings for the user message
17 # The string is the users message
18 await ctx.send('User said --> ' + user_message)
19
20client.run(TOKEN)
21
22# Now you can do any command you would like
23# Using the ctx argument.
24
25# HOW TO GET BOT TOKEN
26# To get your bot's token simply go to:
27# https://discord.com/developers/applications
28# Login, and press new application (If you already have a bot skip this part)
29# Press bot, and press yes you want to make it a bot
30# Under token you will see copy, or regenerate
31# Press copy and give the TOKEN variable the value of your token
32