Command prefix is now set globally and set in the config.

pocketjawa 5 years ago
parent 8283500514
commit 9d33574064

@ -13,6 +13,9 @@ public_channel_id:
#User and Group IDs
#Command Prefix
#Reddit Stuff

@ -23,6 +23,7 @@ token = config.get("configuration", "token")
bot_channel_id = discord.Object(id=config.get("configuration", "bot_channel_id"))
public_channel_id = discord.Object(id=config.get("configuration", "public_channel_id"))
owner_id = discord.User(id=config.get("configuration", "owner_id"))
command_prefix = config.get("configuration", "command_prefix")
#Reddit Setup
reddit_client_id = config.get("configuration", "reddit_client_id")
@ -96,11 +97,11 @@ def on_message(message):
#Maki Monday praise command
if (message.content.lower().startswith('!maki')) or (message.content.lower().startswith('!monday')):
if (message.content.lower().startswith(command_prefix + 'maki')) or (message.content.lower().startswith(command_prefix + 'monday')):
yield from client.send_message(, '')
#Posts help info
elif message.content.lower().startswith('!help'):
elif message.content.lower().startswith(command_prefix + 'help'):
args = message.content.partition(' ')[2]
command = args.partition(' ')[0]
if (command is '' ):
@ -113,7 +114,7 @@ def on_message(message):
yield from client.send_message(, 'Either that command does not exist, or it is too simple to deserve extra context <:tohrusmug:292110413129318401>')
#Sleeps for 5 seconds. Don't know why I still have this tbh
elif message.content.lower().startswith('!sleep'):
elif message.content.lower().startswith(command_prefix + 'sleep'):
output = "Aren't you tired?\nLet's call it a day\nand get some sleep."
sleepemb = discord.Embed(description=output)
@ -123,21 +124,21 @@ def on_message(message):
yield from client.send_message(, 'Ok, done sleeping')
#Posts link to my mix archive
elif message.content.lower().startswith('!mixes'):
elif message.content.lower().startswith(command_prefix + 'mixes'):
yield from client.send_message(, 'You can download mp3s of any of my mixes at')
#Pokes the person who said the command
elif message.content.lower().startswith('!pokeme'):
elif message.content.lower().startswith(command_prefix + 'pokeme'):
yield from client.send_message(, "_pokes <@"">_")
#Dump the navy seal copypasta
elif message.content.lower().startswith('!wtf'):
elif message.content.lower().startswith(command_prefix + 'wtf'):
yield from client.send_typing(
yield from asyncio.sleep(3)
yield from client.send_message(, 'What the fuck did you just fucking say about me, you little bitch? Ill have you know I graduated top of my class in the Navy Seals, and Ive been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and Im the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. Youre fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and thats just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldnt, you didnt, and now youre paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. Youre fucking dead, kiddo.')
#Countdown until the Switch comes out!
elif message.content.lower().startswith('!switch'):
elif message.content.lower().startswith(command_prefix + 'switch'):
now =
switchdate = datetime.datetime(2017, 3, 3)
switchdelta = switchdate - now
@ -148,7 +149,7 @@ def on_message(message):
yield from client.send_message(, switchmsg)
#Countdown until Smash comes out!
elif message.content.lower().startswith('!smash'):
elif message.content.lower().startswith(command_prefix + 'smash'):
now =
smashdate = datetime.datetime(2018, 12, 7)
smashdelta = smashdate - now
@ -159,18 +160,18 @@ def on_message(message):
yield from client.send_message(, smashmsg)
#Posts status of the UPS
elif message.content.lower().startswith('!ups'):
elif message.content.lower().startswith(command_prefix + 'ups'):
ups_status = open("/tmp/ups_status.txt","r")
yield from client.send_message(,
#Posts random picture of Tohru
elif message.content.lower().startswith('!tohru'):
elif message.content.lower().startswith(command_prefix + 'tohru'):
tohru_list_file = open(cwd + "/lists/tohru_images.txt", "r")
tohru_pics =
yield from client.send_message(, random.choice(tohru_pics))
#Sets the bot's Now Playing status
elif message.content.lower().startswith('!setplaying'):
elif message.content.lower().startswith(command_prefix + 'setplaying'):
args = message.content.partition(' ')[2]
yield from client.change_presence(game=discord.Game(name=args))
conf_file = open(cwd + "/tmp/status.txt", "w")
@ -178,13 +179,13 @@ def on_message(message):
#Reset bot's Now Playing status
elif message.content.lower().startswith('!resetplaying'):
elif message.content.lower().startswith(command_prefix + 'resetplaying'):
if os.path.isfile(cwd + "/tmp/status.txt"):
os.remove(cwd + "/tmp/status.txt")
yield from client.change_presence(game=discord.Game(name='with some droids'))
#xkcd comic fetcher
elif message.content.lower().startswith('!xkcd'):
elif message.content.lower().startswith(command_prefix + 'xkcd'):
args = message.content.partition(' ')[2]
if (args is ''):
comic = xkcd.getRandomComic()
@ -209,13 +210,13 @@ def on_message(message):
yield from client.send_message(, '`'+args+'`' + 'is not a valid option. Please leave blank for a random comic, say "latest" for the latest comic or put the number of the comic you want.' )
#Post random submisison from /r/EarthPorn's top this week
elif (message.content.lower().startswith('!earth')) or (message.content.lower().startswith('!earthporn')):
elif (message.content.lower().startswith(command_prefix + 'earth')) or (message.content.lower().startswith(command_prefix + 'earthporn')):
earthporn = reddit.subreddit('earthporn').top('week')
earthpornr = list(earthporn)
yield from client.send_message(, random.choice(earthpornr).url)
#Link some porn! (actually SFW)
elif message.content.lower().startswith('!porn') or message.content.lower().startswith('!pron'):
elif message.content.lower().startswith(command_prefix + 'porn') or message.content.lower().startswith(command_prefix + 'pron'):
earthporn = reddit.subreddit('earthporn').hot(limit=10)
serverporn = reddit.subreddit('ServerPorn').hot(limit=10)
cableporn = reddit.subreddit('cableporn').hot(limit=10)
@ -225,7 +226,7 @@ def on_message(message):
yield from client.send_message(, random.choice(porn_multi_r).url)
#Kill the bot so it can be reloaded
elif (message.content.lower().startswith('!kill')) or (message.content.lower().startswith('!restart')):
elif (message.content.lower().startswith(command_prefix + 'kill')) or (message.content.lower().startswith(command_prefix + 'restart')):
author_id =
if author_id == owner_id:
yield from client.send_message(, 'Goodbye Onii-chan!!!')
@ -234,14 +235,14 @@ def on_message(message):
yield from client.send_message(, 'Booooo you\'re not Onii-chan. You\'re not allowed to use this command!')
#Random jokes from /r/jokes
elif message.content.lower().startswith('!joke'):
elif message.content.lower().startswith(command_prefix + 'joke'):
jokes = reddit.subreddit('jokes').top('month')
jokesr = random.choice(list(jokes))
jokemsg = jokesr.title + '\n\n' + jokesr.selftext
yield from client.send_message(, jokemsg)
#Magic 8-ball simulator 2017
elif message.content.lower().startswith('!8ball'):
elif message.content.lower().startswith(command_prefix + '8ball'):
ball_response_file = open(cwd + "/lists/8ball_responses.txt", "r")
ball_responses ='\n')
args = message.content.partition(' ')[2]
@ -251,7 +252,7 @@ def on_message(message):
yield from client.send_message(, 'The Magic 8-ball says... ' + random.choice(ball_responses))
#Magic Conch Shell simulator 2002 (way cooler than that lame "Magic" 8-ball)
elif message.content.lower().startswith('!conch') or message.content.lower().startswith('!magicconch'):
elif message.content.lower().startswith(command_prefix + 'conch') or message.content.lower().startswith(command_prefix + 'magicconch'):
ball_response_file = open(cwd + "/lists/8ball_responses.txt", "r")
ball_responses ='\n')
args = message.content.partition(' ')[2]
@ -261,7 +262,7 @@ def on_message(message):
yield from client.send_message(, 'The Magic Conch Shell says... ' + random.choice(ball_responses))
#Create a message that will send the person who reacts correctly the contents of message. Use in either DMs or a channel the public cannot see.
elif message.content.lower().startswith('!giveaway'):
elif message.content.lower().startswith(command_prefix + 'giveaway'):
#Split off the text to send to the winner
args = message.content.partition(' ')[2]
@ -283,7 +284,7 @@ def on_message(message):
yield from client.send_message(public_channel_id, 'Congrats to {0.user}!'.format(res))
yield from client.send_message(res.user, args)
#Get currently playing stats from
elif message.content.lower().startswith('!np'):
elif message.content.lower().startswith(command_prefix + 'np'):
#Load JSON from stream APIs
nprequest = requests.get(metadataurl)
@ -316,12 +317,12 @@ def on_message(message):
yield from client.send_message(, embed=npem)
#Post a random mix
elif message.content.lower().startswith('!rmix'):
elif message.content.lower().startswith(command_prefix + 'rmix'):
mixes = json.loads(requests.get("").text)
yield from client.send_message(, "" + random.choice(mixes)['name'])
#Dice Roller (support rolling multiple dice at once)
elif message.content.lower().startswith('!roll'):
elif message.content.lower().startswith(command_prefix + 'roll'):
#Set starting Variables
args = message.content.partition(' ')[2].upper()
argsplit = args.split()
@ -367,7 +368,7 @@ def on_message(message):
yield from client.send_message(, output)
#Skip tracks/mixes on JawaFM
elif message.content.lower().startswith('!fmskip'):
elif message.content.lower().startswith(command_prefix + 'fmskip'):
args = message.content.partition(' ')[2]
station = args.partition(' ')[0]
if (station is ''):