Created
May 30, 2017 16:26
-
-
Save aeshthetic/b61cbcd9443924e894bc86caa3220006 to your computer and use it in GitHub Desktop.
A simple bot that gets a pokemon's analysis from smogon
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
import discord | |
import asyncio | |
client = discord.Client() #Creating the bot object | |
@client.event #This is a convenient check that shows us some information about our bot when we start it up. | |
async def on_ready(): | |
print('Logged in as') | |
print(client.user.name) | |
print(client.user.id) | |
print('------') | |
# This is the code I actually wrote, the rest is just something I include in every bot | |
@client.event | |
async def on_message(msg): | |
if msg.content.startswith("!analysis"): | |
pokemon = msg.content.split()[1] | |
await client.send_message(msg.channel, f"http://www.smogon.com/dex/bw/pokemon/{pokemon}/") | |
# My unique code ends here | |
client.run('bot-token') #A bot's token is like it's username and password combined! Don't release it publicly. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment