plug.discord

exception immp.plug.discord.DiscordAPIError

Bases: immp.core.error.PlugError

Generic error from the Discord API.

class immp.plug.discord.DiscordClient(plug, **kwargs)

Bases: discord.client.Client

Subclass of the underlying client to bind events.

class immp.plug.discord.DiscordMessage(*, text=None, user=None, edited=False, action=False, reply_to=None, joined=None, left=None, title=None, attachments=None, raw=None)

Bases: immp.core.message.Message

Message originating from Discord.

classmethod from_message(discord, message, edited=False, deleted=False)

Convert a discord.Message into a Message.

Parameters
  • discord (DiscordPlug) – Related plug instance that provides the event.
  • message (discord.Message) – Discord message object received from a channel.
  • edited (bool) – Whether this message comes from an edit event.
  • deleted (bool) – Whether this message comes from a delete event.
Returns

Parsed message object.

Return type

DiscordMessage

classmethod to_embed(discord_, msg, reply=False)

Convert a Message to a message embed structure, suitable for embedding within an outgoing message.

Parameters
  • discord (DiscordPlug) – Target plug instance for this attachment.
  • msg (Message) – Original message from another plug or hook.
  • reply (bool) – Whether to show a reply icon instead of a quote icon.
Returns.
discord.Embed:
Discord API embed object.
class immp.plug.discord.DiscordPlug(name, config, host)

Bases: immp.core.util.HTTPOpenable, immp.core.plug.Plug

Plug for a Discord server.

class immp.plug.discord.DiscordUser(id_=None, plug=None, *, username=None, real_name=None, avatar=None, link=None, suggested=False, raw=None)

Bases: immp.core.message.User

User present in Discord.

classmethod from_user(discord, user)

Convert a discord.User into a User.

Parameters
  • discord (DiscordPlug) – Related plug instance that provides the user.
  • user (discord.User) – Hangups user object retrieved from the user list.
Returns

Parsed user object.

Return type

DiscordUser