Proxy Objects¶
-
class
discord.ext.reactioncommands.ProxyPayload(**kwargs)¶ Class to mimic
discord.RawReactionActionEvent. Should have all the same attributes. Useful forReactionBot.get_command_emoji()from a message.Use
from_message()to create an instance of this class.Some attributes will be
Nonesincediscord.Messagedoesn’t have those attributes. You can pass them yourself askwargsif you usefrom_message().-
member¶ -
- Type
Union[
discord.Member,discord.User]
-
emoji¶ Noneunless manually passed in- Type
Any
-
event_type¶ Noneunless manually passed in- Type
Any
-
classmethod
from_message(message, *, author=None, emoji=None, event_type=None)¶ Classmethod to create a
ProxyPayloadfrom a message.- Parameters
message (
discord.Message) – Message to get “payload” fromauthor (Union[
discord.User,discord.Member]) – If you want to overwritemessage.authorwith a different user.emoji (Any) – Defaults to
Noneevent_type (Any) – Defaults to
None
-
classmethod
from_reaction_user(reaction, user, *, event_type=None)¶ Classmethod to create a
ProxyPayloadfrom a reaction and user.For use with
on_reacton_add()andon_reaction_remove().- Parameters
reaction (
discord.Reaction) – Reaction from eventuser (Union[
discord.User,discord.Member]) – The user or member from eventevent_type (Any) – Defaults to
None
-
-
class
discord.ext.reactioncommands.ProxyMessage(id, author, channel, guild)¶ Class to mimic
discord.Message. Not usable likediscord.PartialMessageand only has attributes set.Note
Any of these attributes could be a
ProxyBaseif they cannot be resolved to an object.-
id¶ -
- Type
payload.memberorguild.get_member/bot.get_useronpayload.user_id.- Type
Union[
discord.User,discord.Member]
-
channel¶ bot.get_channelonpayload.channel_id.- Type
Union[
discord.TextChannel,discord.DMChannel]
-
guild¶ bot.get_guildonpayload.guild_id- Type
Optional[
discord.Guild]
-
classmethod
from_payload(bot, payload)¶ Classmethod to create a
ProyMessagefrom a payload. For use with raw reaction methods- Parameters
bot (
Bot) – requires your bot instance for variousget_xmethods.payload (
discord.RawReactionActionEvent) – payload from a raw reaction event
-
classmethod
from_reaction_user(reaction, user)¶ Classmethod to create a
ProxyMessagefrom a reaction and user. For use with on reaction methods- Parameters
reaction (
discord.Reaction) – reactionuser (Union[
discord.Member,discord.User]) – user
-
Proxy Bases¶
Just has ProxyBase.id and _state set.
Warning
You can make these yourself if you want, but you probably should avoid.
These are pretty crap and literally just set ProxyBase.id and _state,
and maybe some other attributes like ProxyMember.guild but those
could also be ProxyBase.
These exist to try and fill in any gaps between
discord.RawReactionActionEvent and discord.Message.
Methods such as ProxyUser.send() should work, but attributes such as
ProxyUser.name will error.
-
class
discord.ext.reactioncommands.reactionproxy.ProxyBase(bot, id)¶ Base class for Proxy objects
Subclassed proxies¶
All of these should behave similar to discord.PartialMessage except
attributes aren’t filled out. Only methods should really work.
-
class
discord.ext.reactioncommands.reactionproxy.ProxyUser(bot, id)¶ Bases:
discord.ext.reactioncommands.reactionproxy.ProxyBase,discord.user.UserProxy for
discord.User
-
class
discord.ext.reactioncommands.reactionproxy.ProxyMember(bot, id, guild)¶ Bases:
discord.ext.reactioncommands.reactionproxy.ProxyBase,discord.member.MemberProxy for
discord.Member-
guild¶ Guild this proxy member belongs to
- Type
Union[
discord.Guild,ProxyGuild]
-
-
class
discord.ext.reactioncommands.reactionproxy.ProxyTextChannel(bot, id, guild)¶ Bases:
discord.ext.reactioncommands.reactionproxy.ProxyBase,discord.channel.TextChannelProxy for
discord.TextChannel-
guild¶ Guild this proxy channel belongs to
- Type
Union[
discord.Guild,ProxyGuild]
-
-
class
discord.ext.reactioncommands.reactionproxy.ProxyDMChannel(bot, id, user)¶ Bases:
discord.ext.reactioncommands.reactionproxy.ProxyBase,discord.channel.DMChannelProxy for
discord.DMChannel-
recepient¶ User this is a DM with
- Type
Union[
discord.User,ProxyUser]
-
-
class
discord.ext.reactioncommands.reactionproxy.ProxyGuild(bot, id)¶ Bases:
discord.ext.reactioncommands.reactionproxy.ProxyBase,discord.guild.GuildProxy class for
discord.Guild