Accept guild ids from the horn object passed by rabbitmq.
authorjweigele <jweigele@local>
Wed, 9 Sep 2020 01:53:19 +0000 (18:53 -0700)
committerjweigele <jweigele@local>
Wed, 9 Sep 2020 01:53:19 +0000 (18:53 -0700)
grahbot.py

index e02188c2620946b2973907e237da98dc9b4b6a5d..340d1de4c0277eedcb53e8aa9f420eff8c4cd77a 100755 (executable)
@@ -138,7 +138,7 @@ class GrahDiscordBot(discord.Client, HornClient):
 
         if 'output_type' in obj and obj['output_type'] == 'discord':
             print('Received a horn for us! {}'.format(msg.body))
-            asyncio.ensure_future(self.horn(dict(sample_name=obj['sample_name']), properties=None))
+            asyncio.ensure_future(self.horn(obj, properties=None))
         else:
             print('Received a horn not for us: {}'.format(msg.body))
 
@@ -189,7 +189,7 @@ class GrahDiscordBot(discord.Client, HornClient):
             if obj['sample_name'] == 'random':
                 sample_name = self.get_sample_name()
             elif obj['sample_name'] == 'terminate':
-                self.terminate_all()
+                self.terminate_all(guild=discord.utils.get(self.guilds, id=obj['guild']))
                 return None
             else:
                 sample_name = '{}/{}'.format(self.config['airhorn_directory'], obj['sample_name'])
@@ -197,7 +197,7 @@ class GrahDiscordBot(discord.Client, HornClient):
             traceback.print_exc()
             print('Error object was: {}'.format(obj))
         else:
-            await self.msg_play_filename(sample_name, guild_id=336396117791211522, exclusive=exclusive)
+            await self.msg_play_filename(sample_name, guild_id=obj['guild'], exclusive=exclusive)