mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
fix ping, systemd example
This commit is contained in:
1 parent
9247e2f2e2
commit
464299a6af
2 files changed
+21
-6
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=tildebot daemon
|
||||||
|
After=tildebot.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/home/krowbar/Code/irc/tildebot.py -s 127.0.0.1 -n tildebot -c \#tildetown
|
||||||
|
WorkingDirectory=/home/krowbar/Code/irc/
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
StartLimitInterval=60s
|
||||||
|
StartLimitBurst=3
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
@@ -36,8 +36,8 @@ JACKPOT_FILE = "tildejackpot.txt"
|
|||||||
JACKPOT_MIN = 3
|
JACKPOT_MIN = 3
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
||||||
@@ -181,8 +181,8 @@ def listen():
|
|||||||
for msg in ircmsg.split('\n'):
|
for msg in ircmsg.split('\n'):
|
||||||
msg = msg.strip('\n\r')
|
msg = msg.strip('\n\r')
|
||||||
|
|
||||||
if msg.find("PING :") != -1:
|
if msg[:4] == "PING":
|
||||||
ping()
|
ping(msg.split(" ")[1])
|
||||||
|
|
||||||
formatted = formatter.format_message(msg)
|
formatted = formatter.format_message(msg)
|
||||||
|
|
||||||
@@ -213,8 +213,8 @@ def listen():
|
|||||||
if msg.find(":!rollcall") != -1:
|
if msg.find(":!rollcall") != -1:
|
||||||
rollcall(channel)
|
rollcall(channel)
|
||||||
|
|
||||||
if msg.find("PING :") != -1:
|
if msg[:4] == "PING":
|
||||||
ping()
|
ping(msg.split(" ")[1])
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|||||||
Reference in new issue
Block a user