Token now read from token.dat
parent
e14a7ddb70
commit
4042052498
24
MCInfoBot.py
24
MCInfoBot.py
|
@ -1,8 +1,7 @@
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
TOKEN = 'MTgzMDMyMDE5MTk2ODM3ODg4.DeRsbQ.UmFJ_7bjmIuIp8jIk6AkUnQ49a0'
|
TOKEN = ''
|
||||||
|
|
||||||
command_prefix = '?'
|
command_prefix = '?'
|
||||||
description = '''Geoffrey is an inside joke none of you will understand, at
|
description = '''Geoffrey is an inside joke none of you will understand, at
|
||||||
least he knows where your bases are.'''
|
least he knows where your bases are.'''
|
||||||
|
@ -24,9 +23,7 @@ class Location:
|
||||||
def posToStr(self) :
|
def posToStr(self) :
|
||||||
return '(x=' + str(self.x) + ', y=' + str(self.y) + ', z=' + str(self.z) + ')'
|
return '(x=' + str(self.x) + ', y=' + str(self.y) + ', z=' + str(self.z) + ')'
|
||||||
|
|
||||||
|
#Bot Commands ******************************************************************
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print('GeoffreyBot')
|
print('GeoffreyBot')
|
||||||
|
@ -43,11 +40,24 @@ async def addBase(ctx, * args):
|
||||||
if (len(args) == 4) :
|
if (len(args) == 4) :
|
||||||
try:
|
try:
|
||||||
base = Location(args)
|
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:
|
except ValueError:
|
||||||
await bot.say('Invalid syntax, try again (?addbase [name] [x coord] [z coord])')
|
await bot.say('Invalid syntax, try again (?addbase [name] [x coord] [z coord])')
|
||||||
|
|
||||||
else :
|
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 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)
|
bot.run(TOKEN)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue