ircbot: check always topic
This commit is contained in:
parent
a9818ab440
commit
f5b3660181
2 changed files with 16 additions and 17 deletions
|
@ -5,7 +5,7 @@ use_ssl = true
|
||||||
verify_ssl = false
|
verify_ssl = false
|
||||||
port = 6697
|
port = 6697
|
||||||
owner = ccchb-schalter
|
owner = ccchb-schalter
|
||||||
channels = #ccchb
|
channels = #ccchb,#ccchb-dev
|
||||||
extra = /home/pi/Eingangsschalter/ircbot/
|
enable = spaceapi,admin
|
||||||
enable = spaceapi
|
admins = genofire,paradx,pyropeter
|
||||||
|
auth_method = server
|
||||||
|
|
|
@ -27,18 +27,6 @@ def change_status(bot, status):
|
||||||
for ch in bot.channels:
|
for ch in bot.channels:
|
||||||
bot.notice('{} changed to {}'.format(PLACE, status_text), ch)
|
bot.notice('{} changed to {}'.format(PLACE, status_text), ch)
|
||||||
|
|
||||||
topic = status_msg(status)
|
|
||||||
|
|
||||||
for ch in bot.channels:
|
|
||||||
channel = bot.channels[ch]
|
|
||||||
topic_new = topic
|
|
||||||
topic_cur = status_msg(not status)
|
|
||||||
if channel.topic != None:
|
|
||||||
topic_new = channel.topic.replace(topic_cur, topic_new)
|
|
||||||
topic_cur = channel.topic
|
|
||||||
if topic_new != topic_cur:
|
|
||||||
bot.write(('TOPIC', ch), topic_new)
|
|
||||||
|
|
||||||
def check_status(bot, human=False):
|
def check_status(bot, human=False):
|
||||||
data = get_spaceapi()
|
data = get_spaceapi()
|
||||||
status = data["state"]["open"]
|
status = data["state"]["open"]
|
||||||
|
@ -47,8 +35,19 @@ def check_status(bot, human=False):
|
||||||
cache["open"] = status
|
cache["open"] = status
|
||||||
change_status(bot, status)
|
change_status(bot, status)
|
||||||
|
|
||||||
|
status_text = status_msg(status)
|
||||||
|
for ch in bot.channels:
|
||||||
|
channel = bot.channels[ch]
|
||||||
|
topic_new = status_text
|
||||||
|
topic_cur = status_msg(not status)
|
||||||
|
if channel.topic != None:
|
||||||
|
topic_new = channel.topic.replace(topic_cur, topic_new)
|
||||||
|
topic_cur = channel.topic
|
||||||
|
if topic_new != topic_cur:
|
||||||
|
bot.write(('TOPIC', ch), topic_new)
|
||||||
|
|
||||||
if human:
|
if human:
|
||||||
bot.reply(status_msg(status))
|
bot.reply(status_text)
|
||||||
|
|
||||||
@sopel.module.interval(5)
|
@sopel.module.interval(5)
|
||||||
def interval_check_status(bot):
|
def interval_check_status(bot):
|
||||||
|
|
Loading…
Reference in a new issue