James
Active Coder
Hello again! It has been a while since I have made one of these and I see questions a lot about discord bots so I thought why not make a tutorial!
To get started you're gonna need python, to install python go to https://www.python.org/downloads/
I am using 3.7.0 at the time of writing this but any 3.7 version should work the same.
Now you need to install the discord module.
To do this you need to open your command prompt and type "pip install discord.py"
Wait for it all to download.
Now go to https://discordapp.com/developers/applications/
Click on new application and give your bot a name!
Now go to "Bot"
Click "Add Bot"
Now you've added the bot keep your bots token for later (DO NOT SHOW ANYONE)
Now, you need to import the discord module
Great!
Now you should actually load up the bot
Great! Your bot is online, but what next? You can't run any commands?
Well, this is where the main part comes in.
And there is a bot. No commands but it works and gives you some info when you type.
If this gets some views and replies I will make another tutorial showing you how to add commands and embeds, until then, goodbye!
To get started you're gonna need python, to install python go to https://www.python.org/downloads/
I am using 3.7.0 at the time of writing this but any 3.7 version should work the same.
Now you need to install the discord module.
To do this you need to open your command prompt and type "pip install discord.py"
Wait for it all to download.
Now go to https://discordapp.com/developers/applications/
Click on new application and give your bot a name!
Now go to "Bot"
Click "Add Bot"
Now you've added the bot keep your bots token for later (DO NOT SHOW ANYONE)
Now, you need to import the discord module
import discord
Great!
Now you should actually load up the bot
Python:
import discord
token = '' # Your bots special token (look above at where we create the bot app)
client = discord.Client()
client.run(token)
Great! Your bot is online, but what next? You can't run any commands?
Well, this is where the main part comes in.
Python:
import discord
token = ''
client = discord.Client()
@client.event
async def on_message(message):
author = message.author
channel = message.channel
guild = channel.guild
if message.type != discord.MessageType.default: # Checks to make sure it is send by a user
return None
if author == client.user: # Checks to make sure whoever is sending the message isn't the actual bot itsself
return None
await channel.send('Hello, '+author.name+' you said, '+message.content+', in, '+channel.name+' on the server, '+guild.name+'.')
client.run(token)
And there is a bot. No commands but it works and gives you some info when you type.
If this gets some views and replies I will make another tutorial showing you how to add commands and embeds, until then, goodbye!