Last active
March 25, 2018 19:17
-
-
Save Bert-Macklin/b09384beedabf76c1276c39f327b2a95 to your computer and use it in GitHub Desktop.
Making a Discord Bot in Python 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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