repl.py 文件源码

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

项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码
def wait_for_reaction_remove(bot, emoji=None, *, user=None,
                                   timeout=None, message=None, check=None):
    """Waits for a reaction to be removed by a user from a message within a time period.
    Made to act like other discord.py wait_for_* functions but is not fully implemented.

    Because of that, wait_for_reaction_remove(self, emoji: list, user, message, timeout=None)
    is a better representation of this function's def

    returns the actual event or None if timeout
    """
    if not (emoji and message) or isinstance(emoji, str):
        raise NotImplementedError("wait_for_reaction_remove(self, emoji, "
                                  "message, user=None, timeout=None, "
                                  "check=None) is a better representation "
                                  "of this function definition")
    remove_event = ReactionRemoveEvent(emoji, user, check=check)
    _reaction_remove_events[message.id] = remove_event
    done, pending = await asyncio.wait([remove_event.wait()],
                                       timeout=timeout)
    res = _reaction_remove_events.pop(message.id)
    try:
        return done.pop().result() and res
    except:
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号