general.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:endrebot0 作者: endreman0 项目源码 文件源码
def afk_send(ctx, message_key, *args, **kwargs):
    global afk_targets
    if afk_targets is None:
        afk_targets = {channel.id: channel for channel in ctx.bot.get_all_channels() if isinstance(channel, discord.TextChannel)}
        afk_targets.update({mem.id: mem for mem in ctx.bot.get_all_members() if mem.bot})

    for info in ctx.bot.config['afk_messages']:
        if message_key in info:
            trigger = await afk_targets[info['dest']].send(info[message_key].format(*args, **kwargs))
            try:
                response = await ctx.bot.wait_for('message', check=lambda m: m.channel == trigger.channel, timeout=10)
                await response.ack()
            except asyncio.TimeoutError:
                pass

    await ctx.message.delete()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号