def main(): # pragma: no cover args = sys.argv[1:] host = '127.0.0.1' port = 6667 if args: hp = args.pop(0) if ':' in hp: host, port = hp.split(':') else: port = hp user = getpass.getuser() config = dict( servername='test_server', host=host, port=int(port), raw=True, opers={user: user}, includes=['irc3d.plugins.core'], ) print( ('Starting irc3d test server on {0}:{1} with {2}/{2} as IrcOp').format( host, port, user)) server = IrcServer.from_config(config) try: server.run() except KeyboardInterrupt: pass
def main(): loop = asyncio.get_event_loop() # run a test server server = IrcServer.from_config( dict( loop=loop, servername='test', includes=['irc3d.plugins.core'], )) server.run(forever=False) end_chat = asyncio.Future() cfg = dict( host='localhost', port=6667, nick='sender', includes=['irc3.plugins.dcc', __name__], loop=loop, end_chat=end_chat, ) # this bot will send the file sender = irc3.IrcBot.from_config(cfg) sender.run(forever=False) def f(): # this bot will receive the file receiver.run(forever=False) # assume receiver is created *after* sender receiver = irc3.IrcBot.from_config(cfg, nick='receiver') loop.call_later(.2, receiver.run, False) loop.run_until_complete(end_chat)
def main(): loop = asyncio.get_event_loop() # run a test server server = IrcServer.from_config(dict( loop=loop, servername='test', includes=['irc3d.plugins.core'], )) server.run(forever=False) cfg = dict( host='localhost', port=6667, nick='sender', includes=[__name__], loop=loop, ) # this bot will send the file sender = irc3.IrcBot.from_config(cfg) sender.run(forever=False) file_received = asyncio.Future() def f(): # this bot will receive the file receiver.run(forever=False) # assume receiver is created *after* sender receiver = irc3.IrcBot.from_config(cfg, nick='receiver', file_received=file_received) loop.call_later(.2, receiver.run, False) loop.run_until_complete(file_received)
def main(): # pragma: no cover args = sys.argv[1:] host = '127.0.0.1' port = 6667 if args: hp = args.pop(0) if ':' in hp: host, port = hp.split(':') else: port = hp user = getpass.getuser() config = dict( servername='test_server', host=host, port=int(port), raw=True, opers={user: user}, includes=['irc3d.plugins.core'], ) print(( 'Starting irc3d test server on {0}:{1} with {2}/{2} as IrcOp' ).format(host, port, user)) server = IrcServer.from_config(config) try: server.run() except KeyboardInterrupt: pass
def main(): # logging configuration logging.config.dictConfig(irc3.config.LOGGING) loop = asyncio.get_event_loop() server = IrcServer.from_argv(loop=loop) bot = irc3.IrcBot.from_argv(loop=loop).run() loop.run_forever()
def main(): loop = asyncio.get_event_loop() server = IrcServer.from_argv(loop=loop) bot = irc3.IrcBot.from_argv(loop=loop) def factory(i): irc3.IrcBot.from_argv( loop=loop, i=i, nick=bot.nick + str(i), realname=bot.config.realname + str(i), ) for i in range(1, server.config.client_amount): loop.call_later(.1 * i, factory, i) loop.run_forever()