format strings and server:port connections

This commit is contained in:
Ben Harris committed 2018-10-09 02:50:11 -04:00
1 parent 58753c7234
commit 99cf1c5822
15 files changed
+241 -511

No files matched your search

+2 -19
View File
@@ -41,7 +41,7 @@ parser.add_option(
"-s",
"--server",
dest="server",
default="127.0.0.1",
default="127.0.0.1:6667",
help="the server to connect to",
metavar="SERVER",
)
@@ -223,14 +223,6 @@ def finish_story(channel):
# System things
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan, msg):
ircsock.send("PRIVMSG {} :{}\n".format(chan, msg))
def joinchan(chan):
global state
state[chan] = State.idle
@@ -258,15 +250,6 @@ def rollcall(channel, botnick):
)
def connect(server, channel, botnick):
ircsock.connect((server, 6667))
ircsock.send(
"USER {} {} {} :krowbar\n".format(botnick, botnick, botnick)
) # user authentication
ircsock.send("NICK {}\n".format(botnick))
joinchan(channel)
def listen(botnick):
botmsgre = re.compile(
"^{}\:?\s*(.*)$".format(botnick)
@@ -304,5 +287,5 @@ def listen(botnick):
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect(options.server, options.channel, options.nick)
util.connect(ircsock, options)
listen(options.nick)