You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
833 B

#!/usr/bin/env python3
from _common import get_args
from contextlib import closing
from msgbus.client import MsgbusSubClient
from json import dumps, loads
def main():
args = get_args()
with closing(MsgbusSubClient(, args.port)) as client:
client.sub("pyircbot_command_ping") # subscribe to .ping commnad
while True:
channel, msg = client.recv()
_, rest = msg.split(" ", 1)
channel, sender, trailing, extras = loads(rest)
channel = channel[0]
if not channel[0] == "#":
# ignore PMs
print("Pong: {} in {}".format(sender, channel))"pyircbot_send", "default privmsg {}".format(dumps([channel, "{}: pong".format(sender)])))
if __name__ == '__main__':