wrapper

Submodules

wrapper.bot module

class wrapper.bot.Bot(token: str, public_key: str, *, intents: int = 0)

Bases: object

A class for discord bots.

Parameters

tokenstr

The token for the bot.

intentsint

The priveliged intents.

public_keystr

The public key of the bot.

async close()
Function

The function to close the websocket connection.

create_slash(name: str, description: str = 'A command', callback={'content': 'hi', 'tts': False})

A function to create a slash command.

namestr

The name of the slash cmd.

descriptionstr

The description of the slash cmd.

callback

The callback of the slash command when its called.

db_insert(name: str, callback, public_key: str)
async fetch_channel(id: int)
function

A function to fetch a channel.

Note

This is an API call, not from the bots cache.

async get_guild_data()
function

A function to get the bot’s guild data.

async get_user_data()
function

A function to get the bot’s user data.

init()
Function

This function initializes the bot to have its attributes.

run()
Function

A function to run the bot.

Warning

This is a blocking function, so if you try to run any code after this function, it won’t run.

class wrapper.bot.Document(connection, document_name)

Bases: object

async delete(id)
async delete_by_id(id)
async find(id)
async find_by_id(id)
property get_all
async get_by_id(id)
async increment(id, amount, field)
async insert(dict)
async unset(dict)
async update(dict)
async update_by_id(dict)
async upsert(dict)

wrapper.channel module

class wrapper.channel.Channel(data={'id': '444', 'last_message_id': '444', 'name': 'null', 'nsfw': False, 'topic': 'null'})

Bases: object

snowflake_time()datetime.datetime

wrapper.content module

class wrapper.content.Content

Bases: object

A class that formats content.

add_content(content, tts: bool = False)
to_dict()

wrapper.embed module

class wrapper.embed.Embed(**kwargs)

Bases: object

add_field(name: str, value: str, inline: bool = True)
author
color
colour
description
fields
set_author(name: str)
title
to_dict(to_json=True)

Turns the object into a dictionary

wrapper.gateway module

class wrapper.gateway.Gateway(bot)

Bases: object

async close()

The |async| function to close the connection.

connect(token: str, intents: int)

The actual function to connect the bot to discord.

tokenstr

The token of the bot.

intentsint

The intents for the bot.

async get_data()
identify_json(token: str, intents: int)

The identify payload to authorize the bot.

tokenstr

The token of the bot.

intentsint

The intents for the bot.

async start(_token: str, _intents: int)

Function to connect the bot to discord.

_tokenstr

The token of the bot.

_intentsint

The intents for the bot.

exception wrapper.gateway.InvokeError(message)

Bases: Exception

wrapper.guild module

class wrapper.guild.Guild(data={'approximate_member_count': 0, 'features': ['null'], 'id': '444', 'name': 'null', 'owner_id': '888', 'roles': [{'id': '2909267986263572999', 'name': '@everyone', 'permissions': '49794752', 'position': '100', 'color': '0', 'hoist': False, 'managed': False, 'mentionable': False}]})

Bases: object

snowflake_time(id: int)datetime.datetime

wrapper.http_client module

class wrapper.http_client.HTTPClient(token: str)

Bases: object

Represents an http client sending requests to discord.

async delete(endpoint, **kwargs)
async fetch_message(channel_id: int, message_id: int)

Fetches a channel from discord.

channel_idint

The channel id to fetch.

message_idint

The message id to fetch.

async get(endpoint, **kwargs)
async patch(endpoint, **kwargs)
async post(endpoint, **kwargs)
async put(endpoint, **kwargs)
async send_message(channel_id=None, content=None)

Sends a message to discord.

wrapper.intents module

class wrapper.intents.Intents

Bases: object

Discord priveliged intents.

classmethod all()
classmethod members()
classmethod presences()

wrapper.user module

class wrapper.user.ClientUser(data={'avatar': 'null', 'bot': True, 'discriminator': '0000', 'id': '444', 'mfa_enabled': 'null', 'username': 'null'})

Bases: object

snowflake_time(id: int)datetime.datetime
class wrapper.user.User(data={'avatar': 'null', 'bot': True, 'discriminator': '0000', 'id': '444', 'mfa_enabled': 'null', 'username': 'null'})

Bases: object

snowflake_time(id: int)datetime.datetime