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()
评论列表
文章目录