log host name

This commit is contained in:
deathbybandaid 2019-07-04 08:26:35 -04:00
parent dfb3216cd1
commit c133dadd91
2 changed files with 16 additions and 2 deletions

View File

@ -4,11 +4,24 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
This is the SpiceBot Server system.
"""
from .Config import config as botconfig
class BotServer():
"""This Logs all server values of relevance'"""
def __init__(self):
self.dict = {}
self.dict = {
"host_connect": botconfig.core.host,
"host": botconfig.core.host,
}
def __getattr__(self, name):
''' will only get called for undefined attributes '''
"""We will try to find a dict value, or return None"""
if name.lower() in list(self.dict.keys()):
return self.dict[str(name).lower()]
else:
raise Exception('Server dict does not contain a function or key ' + str(name.lower()))
server = BotServer()

View File

@ -11,4 +11,5 @@ import sopel_modules.SpiceBot as SpiceBot
@sopel.module.event(SpiceBot.events.RPL_WELCOME)
@sopel.module.rule('.*')
def server_name(bot, trigger):
bot.say(str(trigger.sender), "deathbybandaid")
SpiceBot.server.dict["host"] = str(trigger.sender).lower()
bot.say(str(SpiceBot.server.host), "deathbybandaid")