Client

class quant.Client(token: str, intents: Intents = Intents.ALL_UNPRIVILEGED, mobile: bool = False, asyncio_debug: bool = False, sync_commands: bool = True, cacheable: CacheableType = CacheableType.ALL)

Bases: object

A main bot class for interacting with Discord

Parameters

token: str

The authentication token required for the bot to connect to Discord.

intents: Intents

The intents to be used by the bot

mobile: bool

Specifies whether the bot is running in a mobile environment

Attributes

me: User | None

The user object representing the bot itself.

shards: List[Shard]

The list of shards the bot is connected to.

token: str

The authentication token provided during initialization.

intents: Intents

The intents used by the bot.

loop: asyncio.AbstractEventLoop

The event loop used by the bot.

cache: CacheManager

The cache manager used for caching Discord objects.

event_factory: EventFactory

The event factory used for creating events.

event_controller: EventController

The event controller used for managing events.

rest: RESTImpl

The REST implementation used for interacting with the Discord REST API.

client_id: int

The ID of the bot client.

gateway: Gateway | None

The gateway used for communicating with Discord.

mobile: bool

Specifies whether the bot is running in a mobile environment.

asyncio_debug: bool

Enable asyncio debug or no

sync_commands: bool

Sync application commands or no. If False, syncing will be disabled

add_button(*buttons: Button) None

Adds your buttons

Parameters

buttons: Button

Your button/s which will be added

add_listener(event: T, coro: CoroutineT) None
add_listener(coro: CoroutineT) None

Adds listener to bot

Examples

With two arguments:

async def my_message_handler(event):
    print(event.message.content)

client.add_listener(MessageCreateEvent, my_message_handler)

With one argument:

async def my_message_handler(event: MessageCreateEvent):
    print(event.message.content)

client.add_listener(my_message_handler)
add_modal(*modals: Modal) None

Adds your modals

Parameters

modals: Modal

Your modal/s which will be added

add_slash_command(commands: List[SlashCommand] | SlashCommand, app_id: Snowflake | int | None = None) None

Adds your slash commands

Parameters

commands: SlashCommand

Your command/s which will be added

app_id: Snowflake | int

Custom application ID or bot client ID

remove_slash_command(*commands, app_id: Snowflake | int | None = None) None

Removes slash commands

Parameters

commands: SlashCommand

Your command/s which will be added

app_id: Snowflake | int

Custom application ID

run(loop: AbstractEventLoop | None = None) None

Run bot

It will run one shard with ID 0

run_autoshard(loop: AbstractEventLoop | None = None) None

Run autosharded bot

Parameters

loop: asyncio.AbstractEventLoop

Your loop if needed

run_with_shards(shard_count: int, loop: AbstractEventLoop | None = None) None

Run bot with custom shard_count.

Parameters

shard_count: int

Shard count with you want start bot

loop: asyncio.AbstractEventLoop

Your loop if needed

async set_activity(activity: ActivityData)

This is a coroutine function

Sets an activity for all shards

Parameters

activity: ActivityData

Activity which will be set