Esempio n. 1
0
 async def on_get_guild(self, key, params):
     guild = self.bot.get_guild(int(params["guild_id"]))
     if not guild:
         return
     if guild.me and guild.me.guild_permissions.manage_webhooks:
         try:
             server_webhooks = await guild.webhooks()
         except:
             server_webhooks = []
     else:
         server_webhooks = []
     guild_fmtted = get_formatted_guild(guild, server_webhooks)
     await self.connection.set(key, json.dumps(guild_fmtted, separators=(',', ':')))
     await self.enforce_expiring_key(key)
Esempio n. 2
0
 async def on_guild_update(self, guild):
     guildobj = get_formatted_guild(guild)
     await self.io.emit('GUILD_UPDATE',
                        data=guildobj,
                        room=str("GUILD_" + str(guild.id)),
                        namespace='/gateway')