forked from ben/tooter
update irctokens to v1.0.0
This commit is contained in:
parent
a1ae3eb42a
commit
6cf2196551
|
@ -1,3 +1,3 @@
|
|||
Mastodon.py==1.5.0
|
||||
emoji==0.5.4
|
||||
irctokens==0.7.0
|
||||
irctokens==1.0.0
|
||||
|
|
16
tooter.py
16
tooter.py
|
@ -28,7 +28,7 @@ def _send(line):
|
|||
|
||||
|
||||
def send(chan, msg):
|
||||
_send(irctokens.format("PRIVMSG", [chan, msg]))
|
||||
_send(irctokens.build("PRIVMSG", [chan, msg]))
|
||||
|
||||
|
||||
def think(line):
|
||||
|
@ -81,8 +81,8 @@ if __name__ == "__main__":
|
|||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((config["address"], config["port"]))
|
||||
|
||||
_send(irctokens.format("USER", [config["botnick"], "0", "*", "mastodon tooter"]))
|
||||
_send(irctokens.format("NICK", [config["botnick"]]))
|
||||
_send(irctokens.build("USER", [config["botnick"], "0", "*", "mastodon tooter"]))
|
||||
_send(irctokens.build("NICK", [config["botnick"]]))
|
||||
|
||||
while True:
|
||||
lines = d.push(s.recv(1024))
|
||||
|
@ -95,13 +95,13 @@ if __name__ == "__main__":
|
|||
print(f"< {line.format()}")
|
||||
|
||||
if line.command == "PING":
|
||||
_send(irctokens.format("PONG", line.params))
|
||||
_send(irctokens.build("PONG", line.params))
|
||||
|
||||
elif line.command == "001":
|
||||
_send(irctokens.format("MODE", [config["botnick"], "+B"]))
|
||||
_send(irctokens.build("MODE", [config["botnick"], "+B"]))
|
||||
if account is not None:
|
||||
_send(
|
||||
irctokens.format(
|
||||
irctokens.build(
|
||||
"SQUERY",
|
||||
[
|
||||
"NickServ",
|
||||
|
@ -111,10 +111,10 @@ if __name__ == "__main__":
|
|||
],
|
||||
)
|
||||
)
|
||||
_send(irctokens.format("JOIN", [",".join(channels)]))
|
||||
_send(irctokens.build("JOIN", [",".join(channels)]))
|
||||
|
||||
elif line.command == "INVITE":
|
||||
_send(irctokens.format("JOIN", line.params))
|
||||
_send(irctokens.build("JOIN", line.params))
|
||||
|
||||
elif line.command == "PRIVMSG":
|
||||
think(line)
|
||||
|
|
|
@ -5,7 +5,7 @@ After=tooter.service
|
|||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/home/ben/workspace/tooter
|
||||
ExecStart=/home/ben/workspace/tooter/venv/bin/python3 tooter.py
|
||||
ExecStart=/usr/bin/python3 tooter.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitInterval=60s
|
||||
|
|
Loading…
Reference in New Issue