mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
test
This commit is contained in:
parent
8dcc2276e1
commit
6f5bc93f0e
@ -17,7 +17,9 @@ class BotServer():
|
||||
}
|
||||
self.isupport = {
|
||||
"TARGMAX": {
|
||||
"KICK": 1,
|
||||
"KICK": botconfig.SpiceBot_Kick.kick,
|
||||
'NOTICE': botconfig.SpiceBot_OSD.notice,
|
||||
'PRIVMSG': botconfig.SpiceBot_OSD.privmsg,
|
||||
},
|
||||
}
|
||||
|
||||
@ -47,39 +49,30 @@ class BotServer():
|
||||
if '=' not in param:
|
||||
self.isupport[param] = None
|
||||
else:
|
||||
key, raw_value = param.split('=')
|
||||
|
||||
key, raw_value = param.split('=')
|
||||
if ',' not in raw_value:
|
||||
self.isupport[key] = raw_value
|
||||
else:
|
||||
|
||||
if key not in list(self.isupport.keys()):
|
||||
self.isupport[key] = {}
|
||||
|
||||
if not isinstance(self.isupport[key], dict):
|
||||
self.isupport[key] = {}
|
||||
|
||||
settings = str(raw_value).split(',')
|
||||
for setting in settings:
|
||||
settingname, setting_value = setting.split(',')
|
||||
|
||||
if key.upper() == "TARGMAX":
|
||||
if ":" not in setting:
|
||||
self.isupport[key][setting] = None
|
||||
else:
|
||||
|
||||
# split the settings by comma seperation
|
||||
settings = str(raw_value).split(',')
|
||||
for setting in settings:
|
||||
settingname = str(setting).split(':')[0]
|
||||
if settingname.upper() in ['NOTICE', 'PRIVMSG']:
|
||||
try:
|
||||
value = str(setting).split(':')[1] or None
|
||||
except IndexError:
|
||||
value = None
|
||||
if value:
|
||||
if settingname.upper() == 'NOTICE':
|
||||
botconfig.SpiceBot_OSD.notice = int(value)
|
||||
elif settingname.upper() == 'PRIVMSG':
|
||||
botconfig.SpiceBot_OSD.privmsg = int(value)
|
||||
if settingname.upper() in ['KICK']:
|
||||
try:
|
||||
value = str(setting).split(':')[1] or None
|
||||
except IndexError:
|
||||
value = None
|
||||
if value:
|
||||
botconfig.SpiceBot_Kick.kick = int(value)
|
||||
setting_name, setting_value = setting.split(":")
|
||||
if str(setting_value).isdigit():
|
||||
setting_value = int(setting_value)
|
||||
|
||||
self.isupport[key][setting_name] = setting_value
|
||||
|
||||
|
||||
server = BotServer()
|
||||
|
||||
@ -12,6 +12,8 @@ import time
|
||||
from collections import abc
|
||||
import sys
|
||||
|
||||
from .Server import config as botserver
|
||||
|
||||
|
||||
class SpiceBot_OSD(StaticSection):
|
||||
|
||||
@ -62,9 +64,9 @@ class ToolsOSD:
|
||||
raise ValueError("Recipients list empty.")
|
||||
|
||||
if text_method == 'NOTICE':
|
||||
maxtargets = bot.config.SpiceBot_OSD.notice
|
||||
maxtargets = botserver.isupport["TARGMAX"]["NOTICE"]
|
||||
elif text_method in ['PRIVMSG', 'ACTION']:
|
||||
maxtargets = bot.config.SpiceBot_OSD.privmsg
|
||||
maxtargets = botserver.isupport["TARGMAX"]["PRIVMSG"]
|
||||
maxtargets = int(maxtargets)
|
||||
|
||||
recipientgroups = []
|
||||
|
||||
@ -17,20 +17,5 @@ def server_name(bot, trigger):
|
||||
@sopel.module.event(SpiceBot.events.RPL_ISUPPORT)
|
||||
@sopel.module.rule('.*')
|
||||
def parse_event_005(bot, trigger):
|
||||
# SpiceBot.server.parse_reply_isupport(trigger)
|
||||
if trigger.args[-1] != 'are supported by this server':
|
||||
return
|
||||
SpiceBot.server.linenumber += 1
|
||||
parameters = trigger.args[1:-1]
|
||||
for param in parameters:
|
||||
if '=' in param:
|
||||
key, raw_value = param.split('=')
|
||||
if ',' not in raw_value:
|
||||
if not raw_value:
|
||||
raw_value = None
|
||||
bot.osd([str(key), "=", str(raw_value)], "#deathbybandaid")
|
||||
else:
|
||||
settings = str(raw_value).split(',')
|
||||
for setting in settings:
|
||||
settingname, setting_value = setting.split(',')
|
||||
bot.osd([str(key), str(settingname), "=", str(setting)], "#deathbybandaid")
|
||||
SpiceBot.server.parse_reply_isupport(trigger)
|
||||
bot.osd(str(SpiceBot.server.isupport))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user