Skip to content

Instantly share code, notes, and snippets.

@Bert-Macklin
Last active March 25, 2018 19:17
Show Gist options
  • Save Bert-Macklin/b09384beedabf76c1276c39f327b2a95 to your computer and use it in GitHub Desktop.
Save Bert-Macklin/b09384beedabf76c1276c39f327b2a95 to your computer and use it in GitHub Desktop.
Making a Discord Bot in Python 3
# bot.py
import discord
# create discord client
client = discord.Client()
# token from https://discordapp.com/developers
token = 'NDI3MjIyOTExMjg0NDEyNDQ2.DZhfMA.h3sx9iq6vO_ROYtlxHHTSZJz0xs'
# bot is ready
@client.event
async def on_ready():
try:
# print bot information
print(client.user.name)
print(client.user.id)
print('Discord.py Version: {}'.format(discord.__version__))
except Exception as e:
print(e)
# on new message
@client.event
async def on_message(message):
# print message content
await message.content
# start bot
client.run(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment