responses.py 文件源码

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

项目:Excalibot 作者: endreman0 项目源码 文件源码
def dad_jokes(message, match):
    name = ' '.join(match.group(5).replace('@everyone', '@\N{ZERO WIDTH SPACE}everyone').replace('@here', '@\N{ZERO WIDTH SPACE}here').split()[0:4])
    if name.startswith((',', '.', '!')):
        name = name[1:].lstrip()
    for mem in message.mentions:
        name = name.replace(mem.mention, [sub for sub in [mem.display_name, mem.name, '<\\@%s>' % mem.id] if '<@' not in sub][0])
    for role in message.role_mentions:
        name = name.replace(role.mention, role.name if '<@' not in role.name else '<\\@&%s>' % role.id)
    response = await message.channel.send('Hello **%s**, I\'m %s!' % (name, message.guild.me.display_name if isinstance(message.channel, discord.TextChannel) else message.channel.me.display_name))
    try:
        await bot.wait_for('message_delete', check=lambda m: m == message, timeout=60)
    except asyncio.TimeoutError:
        pass
    else:
        await response.delete()

### LONGCAT
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号