• 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.


The discord token used for authentication


Used for making http requests and websocket creation.


The list of guilds the bot is in.

Type:list of Guild

The user object of the bot.


The websocket used for communication



Inheritance diagram of DiscordBot
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 – The channel id
await get_dms() → List[discordaio.channel.Channel][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_guilds() → List[discordaio.guild.Guild][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) → 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 move_channels(guild_id: int, array: List[Tuple[int, int]])[source]

Modify the positions of a set of channel objects for the guild.


Requires ‘MANAGE_CHANNELS’ permission. Fires multiple Channel Update events. Only channels to be modified are required, with the minimum being a swap between at least two channels.

  • guild_id – The id of the guild.
  • array – A list of tuples containing (channel_id, position)
run() → None[source]

Starts the bot, making it connect to discord.

New in version 0.2.0.