meeting_bot.py 451 B

123456789101112131415161718192021222324
  1. import socket
  2. import time
  3. def main():
  4. stream = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  5. host = "127.0.0.1"
  6. port = 11066
  7. stream.connect((host, port))
  8. nick_msg = b"NICK MEETING \r\n"
  9. stream.send(nick_msg)
  10. join_msg = b"JOIN #dev \r\n"
  11. stream.send(join_msg)
  12. while True:
  13. time.sleep(6)
  14. msg = b"PRIVMSG #dev :hello\r\n"
  15. stream.send(msg)
  16. if __name__ == "__main__":
  17. main()