Client¶
- def add_button
- def add_listener
- def add_modal
- def add_slash_command
- def remove_slash_command
- def run
- def run_autoshard
- def run_with_shards
- async set_activity
- 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:
objectA main bot class for interacting with Discord
Parameters¶
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
- buttons:
- 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
- modals:
- 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
- commands:
- 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
- commands:
- run_autoshard(loop: AbstractEventLoop | None = None) None¶
Run autosharded bot
Parameters¶
- loop:
asyncio.AbstractEventLoop Your loop if needed
- loop:
- 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
- shard_count:
- async set_activity(activity: ActivityData)¶
This is a coroutine function
Sets an activity for all shards
Parameters¶
- activity:
ActivityData Activity which will be set
- activity:
- me: