From: CMDR furrycat Date: Fri, 30 Sep 2016 11:09:57 +0000 (+0100) Subject: Per-bot configuration. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=4342e2209bdfbb0cc59a19db1d2a21f17c9979a8;p=furrycat%2Fcatbot.git Per-bot configuration. --- diff --git a/bot.py b/bot.py index 89dca1d..fdc84df 100755 --- a/bot.py +++ b/bot.py @@ -45,17 +45,32 @@ log = logging.getLogger('discord') idletime = multiprocessing.Value('i', 900) rsstime = multiprocessing.Value('i', 600) playing = multiprocessing.Value('b', False) -feeds = [ - { 'channel': 230340587474255872, 'description': 'GalNet', 'url': 'http://proxy.gonegeeky.com/edproxy/', 'date': False }, - { 'channel': 230340639458459649, 'description': 'Dev tracker', 'url': 'https://miggy.org/games/elite-dangerous/devtracker/ed-dev-posts.rss', 'summary': True }, - { 'channel': 229924021079113729, 'description': 'Patch notes', 'url': 'https://forums.frontier.co.uk/external.php?type=RSS2&forumids=74', 'summary': True }, - { 'channel': 229924189669163008, 'description': 'Newsletters', 'url': 'https://forums.frontier.co.uk/external.php?type=RSS2&forumids=73' } -] - -greetings = [ - { 'channel': 222685317885329408, 'message': 'Welcome to Catbot' }, - { 'channel': 225217541922881538, 'message': 'Welcome to Delta Squadron, take a look at #delta_rules and make yourself at home in the public lobby. If interested in joining please PM a member of the High Command or Council for assistance', 'voice': 222103336483028993, 'sound': 'meow.wav' } -] + +bots = { + # catbot + '225207358450696192': { + 'feeds': [ + { 'channel': 230340587474255872, 'description': 'GalNet', 'url': 'http://proxy.gonegeeky.com/edproxy/', 'date': False }, + { 'channel': 230340639458459649, 'description': 'Dev tracker', 'url': 'https://miggy.org/games/elite-dangerous/devtracker/ed-dev-posts.rss', 'summary': True } + ], + 'greetings': [ + { 'channel': 222685317885329408, 'message': 'Welcome to Delta Squadron, take a look at #delta_rules and make yourself at home in the public lobby. If interested in joining please PM a member of the High Command or Council for assistance', 'voice': 222103336483028993, 'sound': 'meow.wav' } + ] + }, + # catbot beta + '229879865686360064': { + 'feeds': [ + { 'channel': 229924021079113729, 'description': 'Patch notes', 'url': 'https://forums.frontier.co.uk/external.php?type=RSS2&forumids=74', 'summary': True }, + { 'channel': 229924189669163008, 'description': 'Newsletters', 'url': 'https://forums.frontier.co.uk/external.php?type=RSS2&forumids=73' } + ], + 'greetings': [ + { 'channel': 225217541922881538, 'message': 'Welcome to Catbot', 'voice': 231296897938227201, 'sound': 'meow.wav' } + ], + } +} + +feeds = [] +greetings = [] def open_url(url): if sys.version_info >= (3, 0): @@ -661,6 +676,10 @@ def play_greeting(greeting): @asyncio.coroutine def on_ready(): print('Logged in as {}#{}'.format(client.user.name, client.user.id)) + bot = bots.get(str(client.user.id), []) + if bot is not None: + feeds = bot.get('feeds', []) + greetings = bot.get('greetings', []) print('Admins are: {}'.format(admins)) yield from wake_up(True) channels = yield from channels_to_greet()