mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
test
This commit is contained in:
parent
8dcc2276e1
commit
6f5bc93f0e
@ -17,7 +17,9 @@ class BotServer():
|
|||||||
}
|
}
|
||||||
self.isupport = {
|
self.isupport = {
|
||||||
"TARGMAX": {
|
"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:
|
if '=' not in param:
|
||||||
self.isupport[param] = None
|
self.isupport[param] = None
|
||||||
else:
|
else:
|
||||||
key, raw_value = param.split('=')
|
|
||||||
|
|
||||||
|
key, raw_value = param.split('=')
|
||||||
if ',' not in raw_value:
|
if ',' not in raw_value:
|
||||||
self.isupport[key] = raw_value
|
self.isupport[key] = raw_value
|
||||||
else:
|
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(',')
|
settings = str(raw_value).split(',')
|
||||||
for setting in settings:
|
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
|
setting_name, setting_value = setting.split(":")
|
||||||
settings = str(raw_value).split(',')
|
if str(setting_value).isdigit():
|
||||||
for setting in settings:
|
setting_value = int(setting_value)
|
||||||
settingname = str(setting).split(':')[0]
|
|
||||||
if settingname.upper() in ['NOTICE', 'PRIVMSG']:
|
self.isupport[key][setting_name] = setting_value
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
server = BotServer()
|
server = BotServer()
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import time
|
|||||||
from collections import abc
|
from collections import abc
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from .Server import config as botserver
|
||||||
|
|
||||||
|
|
||||||
class SpiceBot_OSD(StaticSection):
|
class SpiceBot_OSD(StaticSection):
|
||||||
|
|
||||||
@ -62,9 +64,9 @@ class ToolsOSD:
|
|||||||
raise ValueError("Recipients list empty.")
|
raise ValueError("Recipients list empty.")
|
||||||
|
|
||||||
if text_method == 'NOTICE':
|
if text_method == 'NOTICE':
|
||||||
maxtargets = bot.config.SpiceBot_OSD.notice
|
maxtargets = botserver.isupport["TARGMAX"]["NOTICE"]
|
||||||
elif text_method in ['PRIVMSG', 'ACTION']:
|
elif text_method in ['PRIVMSG', 'ACTION']:
|
||||||
maxtargets = bot.config.SpiceBot_OSD.privmsg
|
maxtargets = botserver.isupport["TARGMAX"]["PRIVMSG"]
|
||||||
maxtargets = int(maxtargets)
|
maxtargets = int(maxtargets)
|
||||||
|
|
||||||
recipientgroups = []
|
recipientgroups = []
|
||||||
|
|||||||
@ -17,20 +17,5 @@ def server_name(bot, trigger):
|
|||||||
@sopel.module.event(SpiceBot.events.RPL_ISUPPORT)
|
@sopel.module.event(SpiceBot.events.RPL_ISUPPORT)
|
||||||
@sopel.module.rule('.*')
|
@sopel.module.rule('.*')
|
||||||
def parse_event_005(bot, trigger):
|
def parse_event_005(bot, trigger):
|
||||||
# SpiceBot.server.parse_reply_isupport(trigger)
|
SpiceBot.server.parse_reply_isupport(trigger)
|
||||||
if trigger.args[-1] != 'are supported by this server':
|
bot.osd(str(SpiceBot.server.isupport))
|
||||||
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")
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user