discordSplash package

Submodules

discordSplash.audit_log module

class discordSplash.audit_log.Account(jsondata)

Bases: object

Discord Account Object

property id

id of the account. :rtype: int

property name

Name of the account. :rtype: str

class discordSplash.audit_log.AuditLog(jsondata)

Bases: object

property integrations

Returns a list of all integrations found in the Audit Log.

Warning

May change from PartialIntegration to Integration. See TODO in class discordSplash.audit_log.PartialIntegration.

Returns

list of discordSplash.audit_log.PartialIntegration objects.

Return type

list

property users

Returns a list of all users found in the Audit log :return: list of discordSplash.member.Member objects :rtype: list

property webhooks

List of Webhooks found in the Audit Log :rtype: list :return: list of Webhook objects

Warning

You will receive a list of JSON data currently.

class discordSplash.audit_log.Entry(jsondata)

Bases: object

class discordSplash.audit_log.PartialIntegration(jsondata)

Bases: object

property account

integration account :return: Account of the integration :rtype: discordSplash.audit_log.Account

property id

id of the integration :rtype: int

property name

Name of the integration :rtype: str

property type

Type of the integration. :rtype: str

discordSplash.channel module

class discordSplash.channel.Channel(json)

Bases: object

Represents a Discord Channel Object.

property id

x :return: :rtype:

discordSplash.emoji module

discordSplash.guild module

class discordSplash.guild.Guild(jsondata)

Bases: object

Class for a Discord Guild

property afk_channel

id of the guild’s AFK channel

Returns

AFK channel id

Return type

int

property afk_timeout

Time that it takes to be moved into an AFK channel

Returns

Time, in seconds, of the AFK timeout

Return type

int

async create_channel(name: str, type: int, topic: Optional[str] = None, bitrate: Optional[int] = None, user_limit: Optional[int] = None, rate_limit_per_user: int = 0, position: Optional[int] = None, permission_overwrites=None, parent_id: Optional[int] = None, nsfw: Optional[bool] = None)

Creates a channel in the guild.

Tip

Some parameters here are only for voice/text channels.

Only Text:

  • topic

  • rate_limit_per_user

Only Voice:

  • bitrate

  • user_limit

Parameters
  • name (str) – name of the channel

  • type (int) – type of the channel

  • topic (str) – Channel topic/description

  • bitrate (int) – bitrate (in bits) of the channel

  • user_limit (int) – limit for number of users that can join the voice channel

  • rate_limit_per_user (str) – cooldown (slowmode) between sending messages

  • permission_overwrites – permission overwrites for the channel TODO: Implement permission overwrites - implement the permission overwrites for creating channels | this will be a bit more complicated than some other feaatures | find out how this works

  • position (int) – channel order position number

  • parent_id (int) – id of the parent channel category

  • nsfw (bool) – whether the channel is nsfw or not

property default_message_notifications

Default message notification level

Important

TODO: make default_message_notifications an enum - make default_message_notifications an enum | eg. ...notifications.all instead of 0

  • Make it an ENUM

Returns

Default message notification level for the guild

Return type

int

async delete()

deletes the guild

bot must be guild owner

property discovery_splash

Discovery Splash hash

Returns

hash of the Discovery Splash image

Return type

str

property explicit_content_filter

Level of content scanning in the guild

Returns

Level of content scanning and auto-deletion in the guild

Return type

int

property features

All features found in the guild

Returns

a list of guild feature strings

Return type

list

async get_all_channels()

gets all channels in a guild

Returns

list of guild channel objects

Return type

[discordSplash.channel.Channel]

async get_member(id_, g_id)

gets a Member from their id

See also

discordSplash.member.Member

discordSplash.guild.get_all_members()

Parameters
  • id (int) – ID of the member you want to fetch

  • g_id (int) – id of the guild

Returns

Guild member of the id

Return type

discordSplash.member.Member

async get_members()

gets all members in a guild

Warning

This may be part of privileged intents in the future.

Returns

list of all members found in the guild

Return type

[discordSplash.member.Member]

async get_preview()

Gets a Guild Preview Object for the guild.

Returns

guild preview object for the guild

Return type

discordSplash.guild.GuildPreview

property icon

Icon hash for the guild

Important

TODO: Make an icon_url property - this icon_url property will have the actual icon for the guild instead of just the hash.

Returns

Icon hash for the guild

Return type

str

property icon_hash

Icon hash for the guild if the guild is in a template object

Warning

I dont quite understand this. Please open a PR on this

Returns

icon hash of the guild

Return type

str

property id

Returns the Guild’s id

Returns

id of the guild represented in this object

Return type

int

property invite_splash

Splash background image for the guild Appears when joining a guild from a web browser.

Returns

Image hash for the background image

Return type

str

property is_owner

Is the bot the Guild owner?

Returns

whether or not the bot is the guild owner

Return type

bool

property mfa_level

Required MFA level for the guild

Returns

MFA level for the guild

Return type

int

async modify_channel_positions(data_list: list)

Adjusts Channel Positions for a guild

Important

TODO: improve the guild.modify_channel_positions parameter - make the data_list parameter better | make it a python object

Hint

the data_list objects should look something like this:

[
    {
        "id": 2349892848243,
        "position": 1
    },
    {
        "id": 7182933290482,
        "position": 0
    }
]
Parameters

data_list (list) – list of json objects for adjusting channel positions. Must be longer than 2.

Raises

discordSplash.guild.ListLengthError if the data_list parameter is too short.

async modify_member(id_, nick: Optional[str] = None, roles: Optional[list] = None, mute: Optional[bool] = None, deaf: Optional[bool] = None, channel_id: Optional[int] = None)

modifies a member of the guild

Hint

All of these fields require permission.

Warning

If channel_id is not set, the user will be disconnected from voice.

Parameters
  • id (int) – id of the member to modify

  • nick (str) – new nickname of the member

  • roles ([list]) – list of roles the member has

  • mute (bool) – whether or not the user is muted

  • deaf (bool) – whether or not the user is deafened

  • channel_id (str) – id of the voice channel to move the member.

Returns

updated Member object

Return type

discordSplash.member.Member

async modify_non_vc_member(id_, nick: Optional[str] = None, roles: Optional[list] = None)

modifies a member of the guild (not in vc)

Hint

All of these fields require permission.

Warning

If channel_id is not set, the user will be disconnected from voice.

Parameters
  • id (int) – id of the member to modify

  • nick (str) – new nickname of the member

  • roles ([list]) – list of roles the member has

Returns

updated Member object

Return type

discordSplash.member.Member

async modify_vc_member(id_, nick: Optional[str] = None, roles: Optional[list] = None)

modifies a member of the guild (in vc)

Hint

All of these fields require permission.

Warning

If channel_id is not set, the user will be disconnected from voice.

Parameters
  • id (int) – id of the member to modify

  • nick (str) – new nickname of the member

  • roles ([list]) – list of roles the member has

Returns

updated Member object

Return type

discordSplash.member.Member

property name

Returns the name of the guild

Returns

name of guild, without leading or trailing whitespace

Return type

str

property owner_app_id

If the guild creator is a bot, this returns the bot’s application ID.

Returns

Guild owner’s app id

Return type

int

property owner_id

id of the guild owner

Returns

guild owner’s id

Return type

int

property permissions

Permissions for the bot in the guild

Important

TODO: make bot guild permissions an ENUM - having this as an enum will make it easier to understand permissions. | eg. guild.permissions.BAN_MEMBERS instead of something like 0x39408

Returns

Total permissions for the current bot in the guild

Return type

str

property region

Voice Region id for the guild

Returns

Region id for the guild

Return type

str

property roles

List of roles found in the guild

Important

TODO: add discordSplash.guild.role object - add discordSplash.guild.role object | this would turn the json of the roles into an object.

Danger

This does not work.

Returns

list of discordSplash.guild.Role objects

Return type

list

property rules_channel

Channel where community servers post rules

Returns

Channel id of the rules channel

Return type

int

property system_channel_flags

Flags for the System Channel

Returns

System channel’s flags

Return type

int

property system_channel_id

The Channel ID for system messages (member join, boosts).

Returns

System messages channel id

Return type

int

async update(name: Optional[str] = None, region: Optional[str] = None, verification_level: Optional[int] = None, default_message_notifications: Optional[int] = None, explicit_content_filter: Optional[int] = None, afk_channel_id: Optional[int] = None, afk_timeout: Optional[int] = None, icon=None, owner_id: Optional[str] = None, splash=None, banner=None, system_channel_id: Optional[int] = None, rules_channel_id: Optional[int] = None, public_updates_channel_id: Optional[int] = None, preferred_locale: Optional[str] = None)

Edits the guild.

Warning

Some fields here will not work, depending on the guild. For example:

  • owner_id only works if the bot is the guild owner

  • splash and banner only work if the guild has a level 3 boost or is verified/partnered

  • system_channel can be disabled

Parameters
  • name (str) – new name of the guild

  • region (str) – new voice region of the guild

  • verification_level (int) – required verification level for the guild

  • default_message_notifications (int) – new message notifications level for the guild

  • explicit_content_filter (int) – new explicit content filter for the guild.

  • afk_channel_id (int) – new channel ID for the AFK channel

  • afk_timeout (int) – new number of seconds a member can be AFK before being moved into an AFK channel

  • icon – new icon of the guild

  • owner_id (str) – id of the new guild owner (bot must be guild owner for this to work.)

  • splash – new splash image of the guild

  • banner – new guild banner

  • system_channel_id (int) – Channel ID for the system messages channel ID.

  • rules_channel_id (int) – channel ids for rules.

  • public_updates_channel_id (int) – new channel for moderator info (Discord community updates.)

  • preferred_locale (str) – Where the guild is hosted.

Returns

Updated Guild Object

Return type

discordSplash.guild.Guild

property verification_level

Verification level required for the guild

Important

TODO: Make guild verification_level an ENUM - make the guild verification level an enum | eg. guilds.verification_level.phone instead of 4

Returns

Verification level required to talk in the guild

Return type

int

property widget_channel_id

Channel ID that the widget invites to. Returns None if invite is off

Returns

Channel ID of the widget invite

Return type

int

property widget_enabled

Whether or not the server widget is enabled

Returns

True if the widget is enabled

Return type

bool

class discordSplash.guild.GuildPreview(json)

Bases: object

Guild Preview Object

property approximate_member_count

Amount of members in the guild.

Returns

Approximate number of members found in the guild

Return type

int

property approximate_presence_count

Amount of online members in the guild.

Returns

Approximate number of online users in the guild

Return type

int

property description

Guild description

Returns

description of the guild

Return type

str

property discovery_splash

discovery splash image of the guild

Returns

discovery splash hash

Return type

str

property emojis

Emojis found in the Guild

Important

TODO: Implement the discordSplash.emoji.Emoji object - add an object to represent discord Emojis. | stop sending json for emojis.

Returns

list of discordSplash.emoji.Emoji objects

Return type

[discordSplash.emoji.Emoji]

property features

Guild Features

Returns

list of guild feature strings

Return type

[str]

property icon

Icon hash of the guild.

Returns

guild icon hash

Return type

str

property id

ID of the guild

Returns

guild id

Return type

int

property name

Guild Name.

Returns

Name of the Guild

Return type

str

property splash

Splash of the guild

Returns

guild splash hash

Return type

str

exception discordSplash.guild.ListLengthError

Bases: Exception

async discordSplash.guild.create(name: str, region=None, icon=None, verification_level: Optional[int] = None, default_message_notifications: Optional[int] = None, explicit_content_filter: Optional[int] = None, roles=None, channels=None, afk_channel_id: Optional[int] = None, afk_timeout: Optional[int] = None, system_channel_id=None)

Creates a guild from the given parameters.

See also

many parameters here are also explained in the discordSplash.guild.Guild

Important

TODO: make some guild creation fields enumerators - make these fields Enums: | verification_level | default_message_notifications | explicit_content_filter TODO: add some more guild objects - add the channel and role objects TODO: create_guild exception - add an exception if bot is in over 10 guilds

Warning

this can only be used by bots in less than 10 guilds.

Parameters
  • name (str) – name of the guild

  • region (str) – guild region

  • icon (str) – icon of the guild

  • verification_level (int) – verification level required to participate in the guild

  • default_message_notifications (int) – when should users be pinged in the server

  • explicit_content_filter (int) – adult content filter for the guild

  • roles (json) – role objects for the server

  • channels (json) – channel objects for the server

  • afk_channel_id (int) – afk channel for the guild

  • afk_timeout (int) – seconds until an AFK user is moved to the AFK channel.

  • system_channel_id (int) – system channel id for messages such as boosting and users joining

async discordSplash.guild.get(g_id: int, with_counts: bool = False)

Get a guild from the Guild’s id.

Important

TODO: add support for with_counts in the discordSplash.guild.Guild object - allow users to choose an amount of stuff to get

Tip

See also

discordSplash.guild.get_preview()

If you dont need the discordSplash.guild.Guild object, use the coroutine discordSplash.guild.get_preview.

Parameters
  • g_id (int) – ID of the guild you want to fetch

  • with_counts (bool) – If True, approximate_presence_count and approximate_member_count will also be returned

Returns

guild object

Return type

discordSplash.guild.Guild

async discordSplash.guild.get_guild_preview(g_id: int)

Gets a Guild Preview Object.

Parameters

g_id (int) – id of the guild

Returns

guild preview object for the guild

Return type

discordSplash.guild.GuildPreview

discordSplash.invite module

discordSplash.member module

class discordSplash.member.Member(json)

Bases: object

Discord Guild Member Object.

Contains the discordSplash.member.User object but this class has additional support for roles and other guild specific data.

See also

  • Also known as a Guild Member

  • discordSplash.member.User

property deaf

Whether or not the user is deafened in the guild

Returns

True if the user is deafened

Return type

bool

property guild_id

ID of the Guild the member is in :return: Guild ID :rtype: int

property joined_at

When the member joined the guild

Returns

ISO8601 Timestamp

Return type

str

property mute

Whether or not the user is muted in the guild

Returns

True if the user is muted

Return type

bool

property nickname

Nickname of the user

Returns

Member’s nickname

Return type

str

property pending

Whether or not the member has passed the membership screening

Returns

False if the member has passed the screening

Return type

bool

property permissions

Total permissions of the member in the channel

Tip

This includes channel overrides

Note

This only is used during the INTERACTION_CREATE Gateway event.

Returns

Return type

property premium_since

When the member began boosting the guild

Returns

ISO8601 Timestamp

Return type

str

property roles

The Member’s Roles

Important

TODO:

  • add the Role object

Returns

a list of all of the member’s role ids

Return type

[int]

async update(guild_id, nick: Optional[str] = None, roles: Optional[list] = None, mute: Optional[bool] = None, deaf: Optional[bool] = None, channel_id: Optional[int] = None)

modifies the guild member object

Hint

All of these fields require permission.

All of these fields are optional

Warning

If channel_id is not set, the user will be disconnected from voice.

See also

coroutine discordSplash.guild.Guild.modify_member()

Parameters
  • nick (str) – new nickname of the member

  • roles ([list]) – list of roles the member has

  • mute (bool) – whether or not the user is muted

  • deaf (bool) – whether or not the user is deafened

  • channel_id (str) – id of the voice channel to move the member.

  • guild_id (int) – id of the guild to update the member in

Returns

updated Member object

Return type

discordSplash.member.Member

property user

Discord user that is in the guild

Returns

discordSplash.member.User object

Return type

discordSplash.member.User

class discordSplash.member.User(memberJson)

Bases: object

Represents a discord member. Used internally to parse interaction/member JSON data.

Parameters

memberJson (json) – JSON to parse into this class.

Important

TODO: support sernding dms to user - add a method to send a DM to the user on the user object

TODO: Support avatar urls for Users - add an avatar_url property in the User class

property avatar
Returns

the member’s avatar hash

Return type

str

Important

TODO:

  • make it an avatar_url or make that a separate property

property discriminator
Returns

the user’s discriminator

Return type

int

property id
Returns

the user’s id

Return type

int

property username
Returns

the user’s username

Return type

str

discordSplash.opcodes module

discordSplash.template module

discordSplash.webhook module

Module contents

class discordSplash.main.InteractionOption(json_)

Bases: object

Represents the options (‘parameters’) sent for the command

Tip

You should check if this is a parameter using InteractionOptions.is_not_subcommand

property is_not_subcommand

Is the option a parameter (not a subcommand)?

Returns

True if this is a parameter, false if this is a subcommand or subcommand group.

Return type

bool

property name

Name of the interaction option

Returns

name of the interaction parameter or subcommand

Return type

str

property options

list of options if this option is a subcommand or subcommand group.

Returns

array of discordSplash.main.InteractionOption (this class)

Return type

[discordSplash.main.InteractionOption]

property value

Value of the parameter

Returns

None if it is a subcommand group, or the value of the parameter

Return type

Union[int,str,None]

exception discordSplash.main.InvalidTypeException

Bases: Exception

Called when your response is an invalid type.

class discordSplash.main.Presence(text: str, presenceType: discordSplash.main.PresenceType = PresenceType.Game)

Bases: object

Presence data used when connecting to Gateway

Parameters
  • presenceType (PresenceType) – type of presence to use.

  • text (str) – Text of status to use.

Hint

x = Presence('a game', discordSplash.PresenceType.Game)

Warning

Streaming URL’s currently do not work

Custom emojis have not been implemented in this API wrapper

property text

Activity Text. Used Internally.

Returns

The text used in the presence.

Return type

str

property type

Returns the type of the activity. Used internally

Returns

Integer from 1-5. See class discordSplash.Presence** for more info

Return type

int

class discordSplash.main.PresenceType(value)

Bases: enum.Enum

Enumerator for discord PresenceTypes

Used in the presenceType parameter for discordSplash.Presence

Competing = 5
Custom = 4
Game = 0
Listening = 2
Streaming = 1
class discordSplash.main.ReactionData(jsonData)

Bases: object

Data passed into all command functions

Important

TODO: improve ReactionData - make the choices/parameters better.

async delete_original_response()

delete the original reaction

async edit(content: discordSplash.main.ReactionResponse)

Edits the original reaction response sent. :param discordSplash.ReactionResponse content: New content of the reaction response.

property guild_id
Returns

the guild id

Return type

str

Warning

Guilds are not implemented yet.

property id
Returns

the reaction id

Return type

str

json()
Returns

the JSON. Can be used for a custom parser.

Return type

json

property member
Returns

a discordSplash.member.Member** object.

Return type

discordSplash.member.Member

property options
Returns

the choices/parameters for the SlashCommands.

Return type

list

Caution

Currently returns a list of options. Is not parsed yet

async respond(data: discordSplash.main.ReactionResponse)

Responds to the interaction.

Parameters

data (discordSplash.ReactionResponse) – Reaction Response Data

Tip

This must be called within 3 seconds of receiving the response.

Tip

If you do not want to immediately send a message, call this with reactionResponse ResponseType 1

async send_followup_message(data: discordSplash.main.ReactionResponse)

send a followup message for that interaction

Parameters

data (discordSplash.ReactionResponse) – Content of the followup message.

Important

this needs testing.

  • To Test:
    • Ephemeral Messages

property token
Returns

the reaction token

Return type

str

Caution

  • Be sure not to send this in chat. Anyone with the token can send messages as your bot

  • Expires after 15 minutes

property type
Returns

the reaction type

Return type

int

Note

Used for future proofing

class discordSplash.main.ReactionResponse(content: str, isEphemeral: bool = False, responseType: int = 4)

Bases: object

Base class for responding to an interaction.

Parameters
  • content (str) – Content of the message. Must not be more than 2000 characters.

  • isEphemeral (bool) – Whether or not the message should be ephemeral (only seen by the user who created the interaction)

  • responseType (int) – discord InteractionResponseType (1-5), 2 and 3 are depreciated.

Note

[Discord InteractionResponseType](https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionresponsetype)

1 ACK a Ping

[ss]2 ACK a command without sending a message, eating the user’s input[se] DEPRECIATED

[ss]3 respond with a message, eating the user’s input[se] DEPRECIATED

4 respond to an interaction with a message

5 ACK a command without sending a message, showing the user’s input

The user’s input will be shown on all of the above types unless you set isEphemeral to True.

Important

TODO: add an enumerator to ReactionResponse - Make responseType an Enumerator

property json

Mainly used internally :return: JSON content for the reaction :rtype: json

class discordSplash.main.Run(token: str, presence: Optional[discordSplash.main.Presence] = None)

Bases: object

Runs the bot using the token

Parameters
  • token (str) – token of the bot to run

  • presence (splash.Presence) – Presence of the bot, activated upon connection to gateway

Raises

discordSplash.UnregisteredCommandException

Hint

Run('TOKEN', Presence(text='testing', presenceType=discordSplash.PresenceType.Game))

Caution

Most of the methods here are only used internally.

Danger

Do not share your token with anyone. If you want to collaborate on a discord bot, use a development team.

async create_resume_packet()
async heartbeat()
async hello()
async main(resume=False)
opcode(opcode: int, payload) str
async receive()
async resume()
async send(opcode, payload)
exception discordSplash.main.UnregisteredCommandException

Bases: Exception

Raised when a command is registered on the Discord API but not on discordSplash.

Important

TODO:

  • make it a warning

discordSplash.main.command(name: str)

A decorator that is used to register a command.

Parameters

name (str) – name of the command

See also

See examples directory on GitHub for info on usage

Hint

Example Code:

@discordSplash.command(name="say-hello")
async def say_hello(data):
    await data.respond('hi')