Tunnel names can now be configured in the .ini file
parent
0e8101d64c
commit
50974eeefe
|
@ -18,10 +18,14 @@ def create_config(config):
|
||||||
'Database': ''
|
'Database': ''
|
||||||
}
|
}
|
||||||
config['Minecraft'] = {'Dynmap_Url': '',
|
config['Minecraft'] = {'Dynmap_Url': '',
|
||||||
'World_Name': ''
|
'World_Name': '',
|
||||||
|
'North_Tunnel': 'North',
|
||||||
|
"East_Tunnel": 'South',
|
||||||
|
"South_Tunnel": 'East',
|
||||||
|
"West_Tunnel": 'West'
|
||||||
}
|
}
|
||||||
config['Logging'] = {'Count': '',
|
config['Logging'] = {'Count': '7',
|
||||||
'Rotation_Duration': ''
|
'Rotation_Duration': '1'
|
||||||
}
|
}
|
||||||
config['Special Names'] = {}
|
config['Special Names'] = {}
|
||||||
|
|
||||||
|
@ -48,13 +52,21 @@ class Config:
|
||||||
try:
|
try:
|
||||||
self.config = read_config()
|
self.config = read_config()
|
||||||
self.engine_args = self.read_engine_arg()
|
self.engine_args = self.read_engine_arg()
|
||||||
|
|
||||||
self.token = self.config['Discord']['Token']
|
self.token = self.config['Discord']['Token']
|
||||||
self.world_name = self.config['Minecraft']['World_Name']
|
self.world_name = self.config['Minecraft']['World_Name']
|
||||||
self.status = self.config['Discord']['Status']
|
self.status = self.config['Discord']['Status']
|
||||||
self.prefix = self.config['Discord']['Prefix']
|
self.prefix = self.config['Discord']['Prefix']
|
||||||
self.dynmap_url = self.config['Minecraft']['Dynmap_Url']
|
|
||||||
self.bot_mod = self.config['Discord']['Bot_Mod'].split(',')
|
self.bot_mod = self.config['Discord']['Bot_Mod'].split(',')
|
||||||
self.error_users = self.config['Discord']['Error_Users'].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.count = int(self.config['Logging']['Count'])
|
||||||
self.rotation_duration = int(self.config['Logging']['Rotation_Duration'])
|
self.rotation_duration = int(self.config['Logging']['Rotation_Duration'])
|
||||||
self.special_name_list = dict(self.config.items('Special Names'))
|
self.special_name_list = dict(self.config.items('Special Names'))
|
||||||
|
|
|
@ -83,10 +83,10 @@ class GeoffreyDatabase:
|
||||||
|
|
||||||
|
|
||||||
class TunnelDirection(enum.Enum):
|
class TunnelDirection(enum.Enum):
|
||||||
North = 'green'
|
North = bot_config.north_tunnel
|
||||||
East = 'blue'
|
East = bot_config.east_tunnel
|
||||||
South = 'red'
|
South = bot_config.south_tunnel
|
||||||
West = 'yellow'
|
West = bot_config.west_tunnel
|
||||||
|
|
||||||
def str_to_tunnel_dir(arg):
|
def str_to_tunnel_dir(arg):
|
||||||
arg = arg.lower()
|
arg = arg.lower()
|
||||||
|
@ -210,7 +210,7 @@ class Location(SQL_Base):
|
||||||
format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z)
|
format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z)
|
||||||
|
|
||||||
def pos_to_str(self):
|
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:
|
if self.tunnel is not None:
|
||||||
return pos_str + ', **{}**'.format(self.tunnel)
|
return pos_str + ', **{}**'.format(self.tunnel)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -18,7 +18,7 @@ def setup_logging():
|
||||||
discord_logger.setLevel(logging.INFO)
|
discord_logger.setLevel(logging.INFO)
|
||||||
sql_logger = logging.getLogger('sqlalchemy.engine')
|
sql_logger = logging.getLogger('sqlalchemy.engine')
|
||||||
sql_logger.setLevel(logging.INFO)
|
sql_logger.setLevel(logging.INFO)
|
||||||
bot_info_logger = logging.getLogger('bot')
|
bot_info_logger = logging.getLogger('geoffrey.bot')
|
||||||
bot_info_logger.setLevel(logging.INFO)
|
bot_info_logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
handler = handlers.TimedRotatingFileHandler(filename='Geoffrey.log', when='D',
|
handler = handlers.TimedRotatingFileHandler(filename='Geoffrey.log', when='D',
|
||||||
|
|
Loading…
Reference in New Issue