mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 18:59:09 +00:00
Add support for <:name:id> format for adding reactions
Adjust FAQ to match.
This commit is contained in:
parent
b1fae0861a
commit
f38b199d6a
@ -764,7 +764,9 @@ class Message:
|
|||||||
if isinstance(emoji, PartialEmoji):
|
if isinstance(emoji, PartialEmoji):
|
||||||
return emoji._as_reaction()
|
return emoji._as_reaction()
|
||||||
if isinstance(emoji, str):
|
if isinstance(emoji, str):
|
||||||
return emoji # this is okay
|
# Reactions can be in :name:id format, but not <:name:id>.
|
||||||
|
# No existing emojis have <> in them, so this should be okay.
|
||||||
|
return emoji.strip('<>')
|
||||||
|
|
||||||
raise InvalidArgument('emoji argument must be str, Emoji, or Reaction not {.__class__.__name__}.'.format(emoji))
|
raise InvalidArgument('emoji argument must be str, Emoji, or Reaction not {.__class__.__name__}.'.format(emoji))
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ Quick example: ::
|
|||||||
In case you want to use emoji that come from a message, you already get their code points in the content without needing
|
In case you want to use emoji that come from a message, you already get their code points in the content without needing
|
||||||
to do anything special. You **cannot** send ``':thumbsup:'`` style shorthands.
|
to do anything special. You **cannot** send ``':thumbsup:'`` style shorthands.
|
||||||
|
|
||||||
For custom emoji, you should pass an instance of :class:`Emoji`. You can also pass a ``'name:id'`` string, but if you
|
For custom emoji, you should pass an instance of :class:`Emoji`. You can also pass a ``'<:name:id>'`` string, but if you
|
||||||
can use said emoji, you should be able to use :meth:`Client.get_emoji` to get an emoji via ID or use :func:`utils.find`/
|
can use said emoji, you should be able to use :meth:`Client.get_emoji` to get an emoji via ID or use :func:`utils.find`/
|
||||||
:func:`utils.get` on :attr:`Client.emojis` or :attr:`Guild.emojis` collections.
|
:func:`utils.get` on :attr:`Client.emojis` or :attr:`Guild.emojis` collections.
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ Quick example: ::
|
|||||||
await message.add_reaction(emoji)
|
await message.add_reaction(emoji)
|
||||||
|
|
||||||
# if you have the name and ID of a custom emoji:
|
# if you have the name and ID of a custom emoji:
|
||||||
emoji = 'python3:232720527448342530'
|
emoji = '<:python3:232720527448342530>'
|
||||||
await message.add_reaction(emoji)
|
await message.add_reaction(emoji)
|
||||||
|
|
||||||
How do I pass a coroutine to the player's "after" function?
|
How do I pass a coroutine to the player's "after" function?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user