This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/plugins/status.py

21 lines
511 B
Python

from util import hook
import re
@hook.event("TOPIC")
def topic_update(info, conn=None, chan=None):
"""topic_update -- adds status to topic"""
# retrieve current status
status = 'Offen'
topic = info[1]
if 'Status' in topic:
new_topic = re.sub('Status: \w*', 'Status: {}'.format(status), topic)
else:
new_topic = topic.rstrip(' |') + ' | Status: {}'.format(status)
if new_topic != topic:
out = "TOPIC {} :{}".format(chan, new_topic)
conn.send(out)