discordapi.slash.client

Module Contents

Classes

DiscordInteractionClient

Class which handles sending events to Discord.

InteractionEventParser

InteractionEventHandler

Handler to handle methods with defined methods.

class discordapi.slash.client.DiscordInteractionClient(token, command_manager=None, handler=None, event_parser=None, intents=32509, name='main')

Bases: discordapi.client.DiscordClient

Inheritance diagram of discordapi.slash.client.DiscordInteractionClient

Class which handles sending events to Discord.

headers

Headers to be used when sending HTTP request.

_activities

Activity objects used when sending UPDATE_PRESENCE event- This attribute is required as changing status resets the activities.

ratelimit_handler

handler used to handle rate limit accordingly.

Parameters
  • url – same as .url attribute

  • dispatcher – same as .dispatcher attribute

  • name – same as name argument in threading.Thread

_set_command_manager(self, manager)
__send_request(self, method, route, data=None, expected_code=None, raise_at_exc=True, baseurl=None, headers=None)
get_global_commands(self)
create_global_command(self, command)
get_global_command(self, id_)
edit_global_command(self, id_, command)
delete_global_command(self, id_)
bulk_global_commands(self, commands)
get_guild_commands(self, guild)
create_guild_command(self, guild, command)
get_guild_command(self, guild, id_)
edit_guild_command(self, guild, id_, command)
delete_guild_command(self, guild, id_)
bulk_guild_commands(self, guild, commands)
get_guild_permissions(self, guild)
get_command_permissions(self, guild, id_)
edit_command_permissions(self, guild, id_, permissions)
batch_command_permissions(self, guild, permissions)
class discordapi.slash.client.InteractionEventParser(client=None)

Bases: discordapi.gateway.GatewayEventParser

Inheritance diagram of discordapi.slash.client.InteractionEventParser
on_interaction_create(self, payload)
class discordapi.slash.client.InteractionEventHandler(client=None)

Bases: discordapi.handler.MethodEventHandler

Inheritance diagram of discordapi.slash.client.InteractionEventHandler

Handler to handle methods with defined methods.

This handler calls .on_{lowercased event type} method when event issues. e.g. self.on_message_create method gets called when MESSAGE_CREATE fires. If the corresponding method has not defined, It does nothing.

The arguments handlers will receive is the same as .handle method.

Since this runs on a main client thread, running a time-consuming job will block other events from reaching the client, stopping the bot from functioning. Please start another thread for those jobs.

No method other than .handle comes predefined, You have to either inherit this method or assign functions as attributes to use this.

on_interaction_create(self, obj)