|
|
@@ -144,6 +144,33 @@ async def channel_listen(host, port, nick, chan):
|
|
|
await writer.drain()
|
|
|
continue
|
|
|
|
|
|
+ if msg_title == "!deltopic":
|
|
|
+ logging.info("%s: Got !deltopic", chan)
|
|
|
+ topics = CHANS[chan]["topics"]
|
|
|
+ if len(topics) == 0:
|
|
|
+ reply = f"PRIVMSG {chan} :No topics"
|
|
|
+ logging.info("%s: Send: %s", chan reply)
|
|
|
+ writer.write((reply + "\r\n").encode("utf-8"))
|
|
|
+ await writer.drain()
|
|
|
+ continue
|
|
|
+
|
|
|
+ try:
|
|
|
+ topic = msg.split(" ", 4)
|
|
|
+ topic = int(topic[4].rstrip())
|
|
|
+ del topics[topic-1]
|
|
|
+ CHANS[chan]["topics"] = topics
|
|
|
+ reply = f"PRIVMSG {chan} :Removed topic {topic}"
|
|
|
+ logging.info("%s: Send: %s", chan reply)
|
|
|
+ writer.write((reply + "\r\n").encode("utf-8"))
|
|
|
+ await writer.drain()
|
|
|
+ except:
|
|
|
+ reply = f"PRIVMSG {chan} :Topic not found"
|
|
|
+ logging.info("%s: Send: %s", chan reply)
|
|
|
+ writer.write((reply + "\r\n").encode("utf-8"))
|
|
|
+ await writer.drain()
|
|
|
+
|
|
|
+ continue
|
|
|
+
|
|
|
if msg_title == "!list":
|
|
|
logging.info("%s: Got !list", chan)
|
|
|
topics = CHANS[chan]["topics"]
|