Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/getting-started/creating-your-first-bot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ import os # default module
from dotenv import load_dotenv

load_dotenv() # load all the variables from the env file
bot = discord.Bot(debug_guilds=[...])
bot = discord.Bot()

@bot.event
async def on_ready():
Expand Down Expand Up @@ -166,14 +166,13 @@ is a module that we will use to load the env file. You installed this with `pip
Next, we load the env file with `load_dotenv()`.

```py
bot = discord.Bot(debug_guilds=[...])
bot = discord.Bot()
```

In this line, we create a new instance of [`discord.Bot`](https://docs.pycord.dev/en/master/api.html#discord.Bot).
In this object, we pass a `debug_guilds` argument, which is a list of guild IDs that the bot's application
commands will appear in. This is beneficial for testing purposes when we are testing a new command
or two and don't want everyone to be able to use it. If debug guilds are not specified, all of the
servers the bot is in will have access to your slash commands.
In this object, we can pass various parameters for configuration purposes, such as `owner_ids`
and [`intents`](https://docs.pycord.dev/en/stable/api.html?highlight=get_message#discord.Intents).



```py
Expand Down
6 changes: 3 additions & 3 deletions docs/interactions/application-commands/slash-commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Let's create a simple Slash Command.
```py
import discord

bot = discord.Bot(debug_guilds=[...]) # specify the guild IDs in debug_guilds
bot = discord.Bot()

# we need to limit the guilds for testing purposes
# so other users wouldn't see the command that we're testing
Expand Down Expand Up @@ -62,7 +62,7 @@ Let's go through the code.

First, we import Pycord's `discord` package.

Next, we create a [`discord.Bot`](https://docs.pycord.dev/en/master/api.html#discord.Bot) object and assign it to a variable `bot`. Notice how we pass the parameter [`debug_guilds`](https://docs.pycord.dev/en/master/api.html#discord.Bot.debug_guilds). Global Slash Commands take up to an hour to register, however, if we limit our bot commands to a few specific guilds, we can use them instantly on those guilds. This is useful for testing purposes. Once you have polished up your command and made it all shiny, you can share its shininess with all of the bot's servers by removing this parameter.
Next, we create a [`discord.Bot`](https://docs.pycord.dev/en/master/api.html#discord.Bot) object and assign it to a variable `bot`.

We then go ahead and use the [`@bot.command`](https://docs.pycord.dev/en/master/api.html#discord.Bot.command) decorator, which registers a new Slash Command. We pass a `description` parameter to give a description to the Slash Command. We can also pass a `name` parameter to change the Slash Command's name. By default, the name of the Slash Command will be the name of the function, in this case, `/ping`.

Expand All @@ -77,7 +77,7 @@ In order to make a Slash Command group, you can use the `bot.create_group` funct
```python
import discord

bot = discord.Bot(debug_guilds=[...]) # specify the guild IDs in debug_guilds
bot = discord.Bot()

# create Slash Command group with bot.create_group
greetings = bot.create_group("greetings", "Greet people")
Expand Down
6 changes: 3 additions & 3 deletions docs/popular-topics/error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import discord
intents = discord.Intents.default()
intents.message_content = True

bot = discord.Bot(debug_guilds=[...], intents=intents)
bot = discord.Bot(intents=intents)


@bot.slash_command(description="Gets some feedback.")
Expand Down Expand Up @@ -114,7 +114,7 @@ until [the feature](https://github.com/Pycord-Development/pycord/issues/1388) is
import discord
from discord.ext import commands

bot = discord.Bot(debug_guilds=[...], owner_id=...) # Your Discord user ID goes in owner_id
bot = discord.Bot(owner_id=...) # Your Discord user ID goes in owner_id


@bot.slash_command(description="A private command...")
Expand Down Expand Up @@ -273,7 +273,7 @@ A non-subclassed bot would implement this like so:
import discord
from discord.ext import commands

bot = discord.Bot(debug_guilds=[...])
bot = discord.Bot()


@bot.slash_command(description="Get the bot's current latency!")
Expand Down
2 changes: 1 addition & 1 deletion docs/voice/playing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You will now want to connect to your server via a node.
import discord
import wavelink

bot = discord.Bot(debug_guilds=[...])
bot = discord.Bot()

async def connect_nodes():
"""Connect to our Lavalink nodes."""
Expand Down
2 changes: 1 addition & 1 deletion docs/voice/receiving.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You will now want to create your command for recording.
```py title="Record Command Example"
import discord

bot = discord.Bot(debug_guilds=[...])
bot = discord.Bot()
connections = {}

@bot.command()
Expand Down