mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-11 06:00:59 -05:00
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
# coding=utf8
|
|
from __future__ import unicode_literals, absolute_import, division, print_function
|
|
"""
|
|
This is the SpiceBot OSD system.
|
|
"""
|
|
import sopel
|
|
|
|
|
|
@sopel.module.event('005')
|
|
@sopel.module.rule('.*')
|
|
def parse_event_005(bot, trigger):
|
|
if trigger.args[-1] != 'are supported by this server':
|
|
return
|
|
parameters = trigger.args[1:-1]
|
|
for param in parameters:
|
|
if '=' in param:
|
|
if param.startswith("TARGMAX"):
|
|
param = str(param).split('=')[1]
|
|
settings = str(param).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':
|
|
bot.config.SpiceBot_OSD.notice = int(value)
|
|
elif settingname.upper() == 'PRIVMSG':
|
|
bot.config.SpiceBot_OSD.privmsg = int(value)
|