Discord Classes Reference

Here are some of the classes used when dealing with the service type ServiceType.DISCORD.

Channels

class pykemo.discord.channels.DiscordChannel(*, id, channel_name, owner)

A channel that belongs to a Discord server/guild.

Parameters:
  • id (str) – The ID of the channel. The same the Discord API uses.

  • channel_name (str) – The display name of the channel.

  • owner (Creator) – The creator that owns this server. Its ID is the same as the creator’s.

messages(*, max_msg=None, before=None, since=None, asynchronous=False)

Retrieve the messages of this channel.

Parameters:
  • max_msg (Optional[int]) – The max number of posts to look through. This is NOT necessarily the number of posts to enter the lists.

  • before (Optional[datetime.datetime]) – Include only posts before this date.

  • since (Optional[datetime.datetime]) – Include only posts after and including this date.

  • asynchronous (bool) – Wether to use asynchronous requests to maybe boost performance. It’s really only recommended with queries of no more than 350 posts. Too many queries overwhelms the server and it actually slows the request down.

Returns:

A list of the messages of the channel that fit the filters.

Return type:

list[DiscordMessage]

property server_id: str

The ID of the server this channel lives in. By definition, it’s the same as the creator’s ID.

Returns:

The server’s (the creator’s, really) ID.

Return type:

str

property url: UrlLike

Retrieves the URL of the channel.

Returns:

The full URL of the channel.

Return type:

urlLike

Messages

class pykemo.discord.messages.DiscordMessage(*, id, author=None, server_id, channel, content, added=None, published, edited=None, embeds=<factory>, mentions=<factory>, attachments=<factory>)

A discord message inside a channel.

Parameters:
  • id (str) – The ID of the message itself.

  • author (Optional[DiscordUser]) – The user that authored the message

  • server_id (str) – The ID of the server this messages lives in.

  • channel (DiscordChannel) – The channel where this message is within the server.

  • content (str) – The actual text contents of the message.

  • added (Optional[datetime.datetime]) – When was the message added to the database that this API refers to.

  • published (datetime.datetime) – When was the message originally published.

  • edited (Optional[datetime.datetime]) – When was this message edited, if it ever was.

  • embeds (list) – List of embeds of the message.

  • mentions (list) – List of potential mentions the message makes.

  • attachments (list[File]) – The files this message has.

before(date)

Verifies if the message was published before a certain date.

Parameters:

date (datetime.datetime) – The date to evaluate.

Returns:

The result of DiscordMessage.published < date

Return type:

bool

since(date)

Verifies if the message was published after a certain date.

Parameters:

date (datetime.datetime) – The date to evaluate.

Returns:

The result of DiscordMessage.published < date

Return type:

bool

Users

class pykemo.discord.users.DiscordUser(*, id, username, global_name, discriminator, avatar, avatar_decoration_data=None, clan=None, accent_color=None, banner=None, banner_color=None, flags=0, public_flags=0)

A discord user. Not to be confused with Creator, as they have different properties.

Parameters:
  • id (str) – The ID of the Discord user. The same the Discord API uses.

  • username (str) – The specific username that the user utilizes in this guild.

  • global_name (str) – The global name the Discord user has.

  • discriminator (str) – The discriminator of the Discord user, if any (they are not really used anymore).

  • avatar (File) – The avatar file.

  • avatar_decoration_data (Optional[Any]) – Aditional avatar info.

  • clan (Optional[Any]) – I guess this refers to the HypeSquad clans.

  • accent_color (Optional[str]) – The accent color that the user chooses.

  • banner (Optional[Any]) – The banner of the user profile.

  • banner_color (Optional[str]) – The accent color for the banner itself.

  • flags (int) – The flags in this guild.

  • public_flags (int) – The flags globally.