discordapi.slash
Submodules
Package Contents
Classes
Class which handles sending events to Discord. |
|
Handler to handle methods with defined methods. |
|
Object which automatically sets the attribute based on a dict object. |
|
- class discordapi.slash.DiscordInteractionClient(token, command_manager=None, handler=None, event_parser=None, intents=32509, name='main')
Bases:
discordapi.client.DiscordClient
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.InteractionEventHandler(client=None)
Bases:
discordapi.handler.MethodEventHandler
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)
- class discordapi.slash.InteractionEventParser(client=None)
Bases:
discordapi.gateway.GatewayEventParser
- on_interaction_create(self, payload)
- class discordapi.slash.Context(client, data)
Bases:
discordapi.dictobject.DictObjectObject which automatically sets the attribute based on a dict object.
- _json
The original dict object in which the class was constructed from.
Constructs the class from the data.
This automatically sets the attributes from the dict. additionally, keys in keylist will be set as an attribute with the value of None when the attribute doesn’t exist- this is to ensure that it won’t overwrite the existing keys when running __init__ in already initialized instance.
- __str__(self)
Return str(self).
- __repr__(self)
Return repr(self).
- class discordapi.slash.Option(type_, name, desc, choices, required, opts=None)
- _json(self)
- classmethod from_command(cls, cmd)
- class discordapi.slash.SubCommand(name, desc, *commands, default_permission=True)
Bases:
SlashCommand
- run(self, ctx, **kwargs)
- class discordapi.slash.SubCommandGroup(name, desc, *commands, default_permission=True)
Bases:
SubCommand
- class discordapi.slash.SlashCommand(func, name, desc, options=[], default_permission=True, argcheck=True)
- classmethod create(cls, desc, options=[], default_permission=True, cmdname=None)
- execute(self, ctx, options, manager)
- _json(self)
- class discordapi.slash.SlashCommandManager(client=None)
- _set_client(self, client)
- register(self, command)
- update(self)
- execute(self, ctx)
- respond(self, ctx, type_, message=None)
- edit(self, ctx, content=EMPTY, file=None, embeds=EMPTY, allowed_mentions=EMPTY, components=EMPTY)
- delete(self, ctx)







