added argparse
This commit is contained in:
parent
24123e84c9
commit
0df5cce6af
14
tbot.py
14
tbot.py
@ -1,3 +1,5 @@
|
|||||||
|
import argparse
|
||||||
|
|
||||||
from twisted.words.protocols import irc
|
from twisted.words.protocols import irc
|
||||||
from twisted.internet import protocol, reactor
|
from twisted.internet import protocol, reactor
|
||||||
|
|
||||||
@ -39,5 +41,15 @@ class IDRTBotFactory(protocol.ClientFactory):
|
|||||||
print('could not connect: {}'.format(reason))
|
print('could not connect: {}'.format(reason))
|
||||||
|
|
||||||
|
|
||||||
reactor.connectTCP('localhost', 6667, IDRTBotFactory(['#smb', '#linux']))
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('-H', '--host', type=str, default='localhost')
|
||||||
|
parser.add_argument('-p', '--port', type=int, default=6667)
|
||||||
|
parser.add_argument('channels', nargs='+')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
reactor.connectTCP(
|
||||||
|
args.host, int(args.port),
|
||||||
|
IDRTBotFactory('#{}'.format(c) for c in args.channels)
|
||||||
|
)
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
Loading…
Reference in New Issue
Block a user