discordaio.client

Classes

  • DiscordBot: This class represents a discord bot object, it has many utility methods for making a bot.
class discordaio.client.DiscordBot(token: str)[source]

This class represents a discord bot object, it has many utility methods for making a bot.

New in version 0.2.0.

token

str – The discord token used for authentication

http

HTTPHandler – Used for making http requests and websocket creation.

guilds

list of Guild – The list of guilds the bot is in.

user

User – The user object of the bot.

ws

DiscordWebsocket – The websocket used for communication

Inheritance

Inheritance diagram of DiscordBot
await delete_channel(channel_id: int) → discordaio.channel.Channel[source]

Deletes a channel.

Note

Delete a channel, or close a private message. Requires the ‘MANAGE_CHANNELS’ permission for the guild. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update Gateway event will fire for each of them. Returns a channel object on success. Fires a Channel Delete Gateway event.

New in version 0.2.0.

Parameters:channel_id (int) – The channel id
Returns:The deleted channel
Return type:Channel
event(name: str = None)[source]

DiscordBot event decorator, uses the function’s name or the ‘name’ parameter to subscribe to a event

New in version 0.2.0.

await exit()[source]

Disconnects the bot

New in version 0.2.0.

await get_channel(channel_id: int) → discordaio.channel.Channel[source]

Gets a channel from it’s id

New in version 0.2.0.

Parameters:channel_id (int) – The channel id
Returns:The channel
Return type:Channel
await get_dms() → list[source]

Gets a list of dms.

New in version 0.2.0.

Returns:The DMs channels
Return type:list of Channel
await get_guild(guild_id: int) → discordaio.guild.Guild[source]

Returns a Guild object from a guild id.

New in version 0.2.0.

Parameters:guild_id (int) – The guild id
Returns:The requested guild
Return type:Guild
await get_guild_member(guild: discordaio.guild.Guild, member_id: int) → discordaio.guild.GuildMember[source]

Gets a guild member info for the guild and the member id.

New in version 0.2.0.

Parameters:
  • guild (Guild) – The guild
  • member_id (int) – The member id
Returns:

The guild member

Return type:

GuildMember

await get_guild_members(guild: discordaio.guild.Guild)[source]

Gets and fills the guild with the members info.

New in version 0.2.0.

Parameters:guild (Guild) – The guild to fill the members.
await get_guilds() → list[source]

Returns a list of guilds where the bot is in.

New in version 0.2.0.

await get_self_user() → discordaio.user.User[source]

Returns the bot user object. (it’s like get_user(‘@me’))

New in version 0.2.0.

await get_user(id: int) → discordaio.user.User[source]

Gets the user object from the given user id.

New in version 0.2.0.

Parameters:id (int) – The user id
Returns:The requested user
Return type:User
await leave_guild(guild_id: int)[source]

Leaves a guild.

New in version 0.2.0.

Parameters:guild_id (int) – The guild id
run() → None[source]

Starts the bot, making it connect to discord.

New in version 0.2.0.