コード例 #1
0
ファイル: redisqueue.py プロジェクト: kordeviant/Titan
 async def on_get_guild_member(self, key, params):
     member = self.bot.get_guild(int(params["guild_id"])).get_member(int(params["user_id"]))
     if not member:
         await self.connection.set(key, "")
         await self.enforce_expiring_key(key)
         return
     user = get_formatted_user(member)
     await self.connection.set(key, json.dumps(user, separators=(',', ':')))
     await self.enforce_expiring_key(key)
コード例 #2
0
 async def on_get_guild_member(self, key, params):
     guild = self.bot.get_guild(int(params["guild_id"]))
     if not guild:
         return
     member = guild.get_member(int(params["user_id"]))
     if not member:
         members = await guild.query_members(user_ids=[int(params["user_id"])], cache=True)
         if not len(members):
             await self.connection.set(key, "")
             await self.enforce_expiring_key(key)
             return
         else:
             member = members[0]
     user = get_formatted_user(member)
     await self.connection.set(key, json.dumps(user, separators=(',', ':')))
     await self.enforce_expiring_key(key)
コード例 #3
0
 async def on_guild_member_update(self, member):
     user = get_formatted_user(member)
     await self.io.emit('GUILD_MEMBER_UPDATE',
                        data=user,
                        room=str("GUILD_" + str(member.guild.id)),
                        namespace='/gateway')