Skip to content

Instantly share code, notes, and snippets.

@davidbegin
Created March 13, 2020 15:33
Show Gist options
  • Save davidbegin/ed1e1f3202b89ab5953a8da13b9f2649 to your computer and use it in GitHub Desktop.
Save davidbegin/ed1e1f3202b89ab5953a8da13b9f2649 to your computer and use it in GitHub Desktop.
import socket
import sys
from bot import irc_handshake, send_msg, CONNECTION_DATA
# We add ! to these commands
NIGHTBOT_COMMANDS = [
"discord",
"github",
"links",
"linux",
"marker",
"schedule",
"so",
"topic",
]
if __name__ == "__main__":
with socket.socket() as server:
server.connect(CONNECTION_DATA)
irc_handshake(server)
cmd, *args = sys.argv[1:]
if cmd in NIGHTBOT_COMMANDS:
cmd = f"!{cmd}"
send_msg(server, f"{cmd} {' '.join(args)}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment