Skip to content

Instantly share code, notes, and snippets.

@researcx
Last active August 29, 2022 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save researcx/d384a1384690aa96485d11490a33a2f6 to your computer and use it in GitHub Desktop.
Save researcx/d384a1384690aa96485d11490a33a2f6 to your computer and use it in GitHub Desktop.
video game style chat donate message bot, set it to automatically run on a cron
#!/usr/bin/python
from twisted.words.protocols import irc
from twisted.internet import reactor, protocol
from re import search, IGNORECASE
from random import randint
import time
import os, signal
serv_ip = "10.3.0.50"
serv_port = 6667
with open('/root/DonateBot/donate.txt') as f:
message = f.read()
class DonateBot(irc.IRCClient):
nickname = "DonateBot"
chatroom = "#xch"
def signedOn(self):
self.join(self.chatroom)
time.sleep(2)
self.msg(self.chatroom, message)
self.part(self.chatroom)
time.sleep(2)
self.quit()
def quit(self, message=""):
self.sendLine("QUIT :%s" % message)
def main():
f = protocol.ReconnectingClientFactory()
f.protocol = DonateBot
reactor.connectTCP(serv_ip, serv_port, f)
reactor.run()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment