From 4042052498938758c3fb913b9f034cac2790c95d Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 21 May 2018 11:57:20 -0500 Subject: [PATCH] Token now read from token.dat --- MCInfoBot.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/MCInfoBot.py b/MCInfoBot.py index 32e48b2..cd70fe4 100644 --- a/MCInfoBot.py +++ b/MCInfoBot.py @@ -1,8 +1,7 @@ import discord from discord.ext import commands -TOKEN = 'MTgzMDMyMDE5MTk2ODM3ODg4.DeRsbQ.UmFJ_7bjmIuIp8jIk6AkUnQ49a0' - +TOKEN = '' command_prefix = '?' description = '''Geoffrey is an inside joke none of you will understand, at least he knows where your bases are.''' @@ -24,9 +23,7 @@ class Location: def posToStr(self) : return '(x=' + str(self.x) + ', y=' + str(self.y) + ', z=' + str(self.z) + ')' - - - +#Bot Commands ****************************************************************** @bot.event async def on_ready(): print('GeoffreyBot') @@ -43,11 +40,24 @@ async def addBase(ctx, * args): if (len(args) == 4) : try: base = Location(args) - await bot.say('{}, your base named {} located at {} has been added to the database.'.format(ctx.message.author.mention, base.name, base.posToStr())) + await bot.say('{}, your base named {} located at {} has been added' + 'to the database.'.format(ctx.message.author.mention, base.name, base.posToStr())) except ValueError: await bot.say('Invalid syntax, try again (?addbase [name] [x coord] [z coord])') else : - await bot.say('Allows you to add your base location to the database. Syntax: ?addbase [Base Name] [X Cordinate] [Z Cordinate]') + await bot.say('Allows you to add your base location to the database. ' + 'Syntax: ?addbase [Base Name] [X Coordinate] [Z Coordinate]') -bot.run(TOKEN) \ No newline at end of file +#Bot Startup ****************************************************************** +try : + file = open('token.dat','r') + TOKEN = file.read() +except FileNotFoundError: + print('token.dat not found.') +except IOError: + print('Error reading token.dat') + +bot.run(TOKEN) + + \ No newline at end of file