Proxy Objects

class discord.ext.reactioncommands.ProxyPayload(**kwargs)

Class to mimic discord.RawReactionActionEvent. Should have all the same attributes. Useful for ReactionBot.get_command_emoji() from a message.

Use from_message() to create an instance of this class.

Some attributes will be None since discord.Message doesn’t have those attributes. You can pass them yourself as kwargs if you use from_message().

user_id

user id to represent who this payload comes from

Type

int

channel_id

channel id to represent where this payload comes from

Type

int

guild_id

guild id to represent where this payload comes from or None for dms

Type

Optional[int]

member

From discord.Message.author

Type

Union[discord.Member, discord.User]

emoji

None unless manually passed in

Type

Any

event_type

None unless manually passed in

Type

Any

classmethod from_message(message, *, author=None, emoji=None, event_type=None)

Classmethod to create a ProxyPayload from a message.

Parameters
  • message (discord.Message) – Message to get “payload” from

  • author (Union[discord.User, discord.Member]) – If you want to overwrite message.author with a different user.

  • emoji (Any) – Defaults to None

  • event_type (Any) – Defaults to None

classmethod from_reaction_user(reaction, user, *, event_type=None)

Classmethod to create a ProxyPayload from a reaction and user.

For use with on_reacton_add() and on_reaction_remove().

Parameters
class discord.ext.reactioncommands.ProxyMessage(id, author, channel, guild)

Class to mimic discord.Message. Not usable like discord.PartialMessage and only has attributes set.

Note

Any of these attributes could be a ProxyBase if they cannot be resolved to an object.

id

payload.message_id

Type

int

author

payload.member or guild.get_member/bot.get_user on payload.user_id.

Type

Union[discord.User, discord.Member]

channel

bot.get_channel on payload.channel_id.

Type

Union[discord.TextChannel, discord.DMChannel]

guild

bot.get_guild on payload.guild_id

Type

Optional[discord.Guild]

classmethod from_payload(bot, payload)

Classmethod to create a ProyMessage from a payload. For use with raw reaction methods

Parameters
classmethod from_reaction_user(reaction, user)

Classmethod to create a ProxyMessage from a reaction and user. For use with on reaction methods

Parameters

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

Parameters
  • bot (Bot) – Your bot instance

  • id (int) – the id for the object this is proxying

id

the id for object this is proxying

Type

int

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.User

Proxy for discord.User

class discord.ext.reactioncommands.reactionproxy.ProxyMember(bot, id, guild)

Bases: discord.ext.reactioncommands.reactionproxy.ProxyBase, discord.member.Member

Proxy 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.TextChannel

Proxy 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.DMChannel

Proxy 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.Guild

Proxy class for discord.Guild