API Reference#
- class nextcord.Client(token, intents, *, type_sheet=None, shard_count=None)#
A wrapper against the Bot connection on discord.
- Parameters:
token (
str
) – The bot token to connect with. This can be found at the developer portalintents (
Intents
) – The intents to connect with.type_sheet (
TypeSheet
) – What components to use for the different internalsshard_count (
Optional[int]
) –How many shards to connect with. If it is None it will be automatically fetched and kept up to date from discord
Note
This will be locked in if you set it. If your bot ever outgrows your shardcount, you will get a error
- async close(error=None)#
Close the client.
- Parameters:
error (Optional[NextcordException]) –
- Return type:
None
- async connect()#
Connect to discord.
Note
This will run until the bot shuts down.
- Return type:
None
- run()#
Connect to discord
Note
This is the sync version of
Client.connect()
. If you need to run multiple bots at the same time or similar, you should use that instead.Note
This will run until the bot shuts down.
- Return type:
None
- class nextcord.type_sheet.TypeSheet(http_client, http_bucket, gateway, shard)#
A place for the library to store which component types we use when creating things.
- Parameters:
http_client (Type[HTTPClientProtocol]) – The HTTP Client
http_bucket (Type[BucketProtocol]) – The bucket used when creating new HTTP buckets. Used for HTTP ratelimiting
gateway (Type[GatewayProtocol]) – The shard manager
shard (Type[ShardProtocol]) – The connections to discord spawned by
GatewayProtocol
- class nextcord.flags.Intents(**kwargs)#
The intents you can connect to the gateway with.
Note
See the documentation
- Parameters:
kwargs (bool) –
- property DIRECT_MESSAGES: bool#
- property DIRECT_MESSAGE_REACTIONS: bool#
- property DIRECT_MESSAGE_TYPING: bool#
- property GUILDS: bool#
- property GUILD_BANS: bool#
- property GUILD_EMOJIS_AND_STICKERS: bool#
- property GUILD_INTEGRATIONS: bool#
- property GUILD_INVITES: bool#
- property GUILD_MEMBERS: bool#
- property GUILD_MESSAGES: bool#
- property GUILD_MESSAGE_REACTIONS: bool#
- property GUILD_MESSAGE_TYPING: bool#
- property GUILD_PRESENCES: bool#
- property GUILD_SCHEDULED_EVENTS: bool#
- property GUILD_VOICE_STATES: bool#
- property GUILD_WEBHOOKS: bool#