Tunnel names can now be configured in the .ini file

doc_update
Joey Hines 2018-08-25 12:30:53 -05:00
parent 0e8101d64c
commit 50974eeefe
3 changed files with 22 additions and 10 deletions

View File

@ -18,10 +18,14 @@ def create_config(config):
'Database': ''
}
config['Minecraft'] = {'Dynmap_Url': '',
'World_Name': ''
'World_Name': '',
'North_Tunnel': 'North',
"East_Tunnel": 'South',
"South_Tunnel": 'East',
"West_Tunnel": 'West'
}
config['Logging'] = {'Count': '',
'Rotation_Duration': ''
config['Logging'] = {'Count': '7',
'Rotation_Duration': '1'
}
config['Special Names'] = {}
@ -48,13 +52,21 @@ class Config:
try:
self.config = read_config()
self.engine_args = self.read_engine_arg()
self.token = self.config['Discord']['Token']
self.world_name = self.config['Minecraft']['World_Name']
self.status = self.config['Discord']['Status']
self.prefix = self.config['Discord']['Prefix']
self.dynmap_url = self.config['Minecraft']['Dynmap_Url']
self.bot_mod = self.config['Discord']['Bot_Mod'].split(',')
self.error_users = self.config['Discord']['Error_Users'].split(',')
self.dynmap_url = self.config['Minecraft']['Dynmap_Url']
self.north_tunnel = self.config['Minecraft']['North_Tunnel']
self.east_tunnel = self.config['Minecraft']['East_Tunnel']
self.south_tunnel = self.config['Minecraft']['South_Tunnel']
self.west_tunnel = self.config['Minecraft']['West_Tunnel']
self.count = int(self.config['Logging']['Count'])
self.rotation_duration = int(self.config['Logging']['Rotation_Duration'])
self.special_name_list = dict(self.config.items('Special Names'))

View File

@ -83,10 +83,10 @@ class GeoffreyDatabase:
class TunnelDirection(enum.Enum):
North = 'green'
East = 'blue'
South = 'red'
West = 'yellow'
North = bot_config.north_tunnel
East = bot_config.east_tunnel
South = bot_config.south_tunnel
West = bot_config.west_tunnel
def str_to_tunnel_dir(arg):
arg = arg.lower()
@ -210,7 +210,7 @@ class Location(SQL_Base):
format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z)
def pos_to_str(self):
pos_str = '**(x= {}, z= {})** **{}**'.format(self.x, self.z, self.dimension.value.title())
pos_str = '**(x= {}, z= {})** {}'.format(self.x, self.z, self.dimension.value.title())
if self.tunnel is not None:
return pos_str + ', **{}**'.format(self.tunnel)
else:

View File

@ -18,7 +18,7 @@ def setup_logging():
discord_logger.setLevel(logging.INFO)
sql_logger = logging.getLogger('sqlalchemy.engine')
sql_logger.setLevel(logging.INFO)
bot_info_logger = logging.getLogger('bot')
bot_info_logger = logging.getLogger('geoffrey.bot')
bot_info_logger.setLevel(logging.INFO)
handler = handlers.TimedRotatingFileHandler(filename='Geoffrey.log', when='D',