mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 12:18:54 -05:00
[Context] Adds react_quietly method to context (#2834)
* [Context] Adds react_quietly method to context This allows developers to emojis to command messages This is a modified version of tick() It accepts True/False for Tick/Cross emoji and in addition to that any other emoji the bot can see * Removed True/False support from react quietly * Stopped catching InvalidArgument on react_quietly so that is propagated to devs
This commit is contained in:
parent
0eb22c84ff
commit
a89a156f8e
@ -1,6 +1,6 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
from typing import Iterable, List
|
||||
from typing import Iterable, List, Union
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
@ -86,6 +86,22 @@ class Context(commands.Context):
|
||||
else:
|
||||
return True
|
||||
|
||||
async def react_quietly(
|
||||
self, reaction: Union[discord.Emoji, discord.Reaction, discord.PartialEmoji, str]
|
||||
) -> bool:
|
||||
"""Adds a reaction to to the command message.
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
:code:`True` if adding the reaction succeeded.
|
||||
"""
|
||||
try:
|
||||
await self.message.add_reaction(reaction)
|
||||
except discord.HTTPException:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
async def send_interactive(
|
||||
self, messages: Iterable[str], box_lang: str = None, timeout: int = 15
|
||||
) -> List[discord.Message]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user