async def main( hostname: str, nickname: str, sasl_user: str, sasl_pass: str, acc_grace: bool, chans: List[str], admins: List[str], bad: List[str], act_soft: List[str], act_hard: List[str]): global ACC, CHANS, BAD, ACT_SOFT, ACT_HARD ACC = acc_grace CHANS = chans ADMINS = [glob_compile(a) for a in admins] ACT_SOFT = act_soft ACT_HARD = act_hard for bad_item in bad: BAD[bad_item.lower()] = bad_item bot = Bot() params = ConnectionParams(nickname, hostname, 6697, True) params.sasl = SASLUserPass(sasl_user, sasl_pass) await bot.add_server("server", params) await bot.run()
async def main(config_path: str): global CONFIG, CONFIG_PATH CONFIG_PATH = config_path config = load_config(config_path) CONFIG = config bot = Bot() params = ConnectionParams(config.nickname, config.hostname, 6697, True) sasl_user, sasl_pass = config.sasl params.sasl = SASLUserPass(sasl_user, sasl_pass) await bot.add_server("server", params) await bot.run()
async def main(database: str, nickname: str, sasl: Optional[str], log_chan: str, watch_chan: str): db_dir = os.path.dirname(os.path.abspath(database)) if not os.path.isdir(db_dir): os.makedirs(db_dir) bot = Bot(database, log_chan, watch_chan) params = ConnectionParams(nickname, "chat.freenode.net", 6697, True) if sasl: account, _, password = sasl.partition(":") params.sasl = SASLUserPass(account, password) await bot.add_server("freenode", params) await bot.run()
async def main(): bot = Bot() for name, host in SERVERS: params = ConnectionParams("BitBotNewTest", host, 6697, True) await bot.add_server(name, params) await bot.run()
async def main(hostname: str, channel: str, nickname: str): bot = Bot(channel) params = ConnectionParams( nickname, hostname, 6697, tls=True) await bot.add_server("freenode", params) await bot.run()
async def main( nick: str, sasl: Optional[str]=None): bot = Bot() params = ConnectionParams( nick, username=nick, realname="irctoolkit cantjoin v1", host ="chat.freenode.net", port =6697, tls =True) if sasl: account, _, password = sasl.partition(":") params.sasl = SASLUserPass(account, password) await bot.add_server("freenode", params) await bot.run()
async def main(): bot = Bot() sasl_params = SASLUserPass(username, password) params = ConnectionParams("balun", host="irc.tilde.chat", port=6697, tls=True, sasl=sasl_params) await bot.add_server("tilde", params) await bot.run()
async def main(): bot = Bot() sasl_params = SASLUserPass(username, password) params = ConnectionParams( "min", host="irc.libera.chat", port=6697, tls=True, sasl=sasl_params, autojoin=channel, ) await bot.add_server("libera", params) params = ConnectionParams( "min", host="manonet.lumey.dev", port=6697, tls=True, autojoin=["#manonet"] ) await bot.add_server("manonet", params) await bot.run()
async def main(): bot = Bot() for name, host in SERVERS: sasl_params = SASLUserPass("Sifakis", auth.password) params = ConnectionParams("Sifakis", host, 6697, True, sasl=sasl_params) await bot.add_server(name, params) await bot.run()
async def main(hostname: str, nickname: str, sasl_user: str, sasl_pass: str, acc_grace: bool, chans: List[str], admins: List[str], bad: List[str], ports: List[str], act_soft: List[str], act_hard: List[str]): global ACC, CHANS, BAD, PORTS, ACT_SOFT, ACT_HARD ACC = acc_grace CHANS = chans ADMINS = [glob_compile(a) for a in admins] ACT_SOFT = act_soft ACT_HARD = act_hard PORTS = [int(p) for p in ports] for bad_item in bad: BAD.append((re.compile(bad_item, re.I), bad_item)) bot = Bot() params = ConnectionParams(nickname, hostname, 6697, True) params.sasl = SASLUserPass(sasl_user, sasl_pass) await bot.add_server("server", params) await bot.run()
async def main(): bot = Bot() sasl_params = SASLUserPass("myusername", "invalidpassword") params = ConnectionParams( "MyNickname", host = "chat.freenode.invalid", port = 6697, tls = True, sasl = sasl_params) await bot.add_server("freenode", params) await bot.run()
async def main(): parser = ArgumentParser( description="announce tor hidden service up/down status on IRC") parser.add_argument("config") args = parser.parse_args() config = load_config(args.config) host, port, tls = config.server params = ConnectionParams(config.nickname, host, port, tls) params.autojoin = [config.channel] if config.password: params.password = config.password if config.sasl: username, password = config.sasl params.sasl = SASLUserPass(username, password) successes: Dict[str, float] = {n: 0.0 for n in config.services.keys()} fails: Dict[str, int] = {n: 0 for n in config.services.keys()} bot = Bot(successes, fails) await bot.add_server("server", params) await asyncio.wait([loop(bot, config, successes, fails), bot.run()])
async def main(nick: str, chan: str, file: str, nonexistent_only: bool): global NICK NICK = nick global CHAN CHAN = chan global FILE FILE = file global NONEXISTENT_ONLY NONEXISTENT_ONLY = nonexistent_only bot = Bot() params = ConnectionParams(NICK, "chat.freenode.net", 6697, True) server = await bot.add_server("freenode", params) await bot.run()
async def main(config: Config): bot = Bot(config) host, port, tls = config.server sasl_user, sasl_pass = config.sasl params = ConnectionParams( config.nickname, host, port, tls, username=config.username, realname=config.realname, password=config.password, sasl=SASLUserPass(sasl_user, sasl_pass) ) await bot.add_server(host, params) await bot.run()