def on_guild_emojis_update(self, guild, before, after):
# we only care when an emoji is added
lookup = { e.id for e in before }
added = [e for e in after if e.id not in lookup and len(e.roles) == 0]
if len(added) == 0:
return
log.info('Server %s has added %s emojis.', guild, len(added))
if guild.id != BLOB_GUILD_ID:
return # not the guild we care about
# this is the backup channel
channel = self.bot.get_channel(305841865293430795)
if channel is None:
return
for emoji in added:
async with self.bot.session.get(emoji.url) as resp:
if resp.status != 200:
continue
data = io.BytesIO(await resp.read())
await channel.send(emoji.name, file=discord.File(data, f'{emoji.name}.png'))
await asyncio.sleep(1)
评论列表
文章目录