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 |
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
# command's function | |
def hello_function(message,client,args): | |
try: | |
return 'Hello {}, Argument One: {}'.format(message.author, args[0]) | |
except Exception as e: | |
return e | |
# hello command dictionary | |
hello_command = { | |
# if the string starts with this the function will be called |
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
# command handler class | |
class CommandHandler: | |
# on object creation take in the client variable | |
def __init__(self, client): | |
self.client = client | |
# create an array to store commands | |
self.commands = [] |
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 | |
# command handler class | |
class CommandHandler: | |
# constructor | |
def __init__(self, client): |
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 | |
import requests | |
import json | |
# command handler class | |
class CommandHandler: | |
# constructor |