breadbot/breadbot/__main__.py

33 lines
698 B
Python

#!/usr/bin/env python3
import argparse
import yaml
from pinhook import plugin, bot
class BreadBot(bot.Bot):
def on_welcome(self, c, e):
super().on_welcome(c, e)
c.mode(self.bot_nick, '+B')
for channel in self.chanlist:
self.process_output(c, channel, plugin.message('bread'))
def main():
parser = argparse.ArgumentParser(
description='Breadpunk Bread Bot',
)
parser.add_argument(
'config',
type=argparse.FileType('r'),
help='Configuration file',
)
args = parser.parse_args()
config = yaml.safe_load(args.config)
bot = BreadBot(**config)
bot.start()
if __name__ == '__main__':
main()