diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index abb0489c..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "weekly" - labels: - - "dependencies" - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - labels: - - "ci/cd" - - "dependencies" \ No newline at end of file diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml index 695fdfe5..f5c6a07a 100644 --- a/.github/workflows/codacy.yml +++ b/.github/workflows/codacy.yml @@ -55,6 +55,6 @@ jobs: # Upload the SARIF file generated in the previous step - name: Upload SARIF results file - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: results.sarif diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c9478521..dd6a360a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 1a34d1df..f138abd4 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - run: pip install codespell diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cb979213..f79bddd9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,7 +26,7 @@ jobs: # Popular action to deploy to GitHub Pages: # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} # Build output to publish to the `gh-pages` branch: diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml index b95b5854..df2487ad 100644 --- a/.github/workflows/devskim.yml +++ b/.github/workflows/devskim.yml @@ -29,6 +29,6 @@ jobs: uses: microsoft/DevSkim-Action@v1 - name: Upload DevSkim scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: devskim-results.sarif diff --git a/.github/workflows/njsscan.yml b/.github/workflows/njsscan.yml index 27cbd684..072ef7a7 100644 --- a/.github/workflows/njsscan.yml +++ b/.github/workflows/njsscan.yml @@ -36,6 +36,6 @@ jobs: with: args: '. --sarif --output results.sarif || true' - name: Upload njsscan report - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: results.sarif diff --git a/docs/extensions/pages/paginator-basics.mdx b/docs/extensions/pages/paginator-basics.mdx index 97f0e611..9dcce025 100644 --- a/docs/extensions/pages/paginator-basics.mdx +++ b/docs/extensions/pages/paginator-basics.mdx @@ -156,4 +156,4 @@ For a comprehensive list of examples showing all `Paginator` functionality, plea ## Support and Feedback If you have any questions, suggestions, or feedback for `ext.pages`, please join the -[discord server](https://discord.gg/pycord) and check out the #ext-pages channel. +[Discord server](https://discord.gg/pycord). diff --git a/docs/extensions/tasks/tasks.mdx b/docs/extensions/tasks/tasks.mdx index c98aa485..fea4db3e 100644 --- a/docs/extensions/tasks/tasks.mdx +++ b/docs/extensions/tasks/tasks.mdx @@ -35,7 +35,7 @@ doing very useful stuff. doing very useful stuff. ``` -For a more useful example here's a task in a cog context ripped straight from the [docs](https://docs.pycord.dev/en/stable/ext/tasks/index.html#recepies): +For a more useful example here's a task in a cog context ripped straight from the [docs](https://docs.pycord.dev/en/stable/ext/tasks/index.html#recipes): ```py from discord.ext import tasks, commands diff --git a/docs/interactions/application-commands/slash-commands.mdx b/docs/interactions/application-commands/slash-commands.mdx index 00438192..1aff47b1 100644 --- a/docs/interactions/application-commands/slash-commands.mdx +++ b/docs/interactions/application-commands/slash-commands.mdx @@ -119,6 +119,14 @@ Here's what the registered subcommands will look like in the Slash Command Menu: You'll notice that there's the name of the Slash Command Group and then the name of the subcommand separated by a space. +::: + +:::info Cogs + +If you are looking to add Slash Command Groups to cogs, please look at our [Cogs page](../../popular-topics/cogs)! + +::: + ## Sub-groups We've made a subcommand group, but did you know that you could create a group inside another? @@ -143,12 +151,14 @@ The command created above can be invoked by typing `/math advanced square_root`. Whenever you're using Slash Commands, you might notice that you can specify parameters that the user has to set or can optionally set. These are called Options. -Since you want different inputs from Options, you'll have to specify the type for that Option. There are a few ways of doing this. +Options can also include a description to provide more information. [You can learn more about Options in our documentation!](https://docs.pycord.dev/en/stable/api/application_commands.html#discord.Option) + +Since you want different inputs from Options, you'll have to specify the type for that Option; there are a few ways of doing this. -You could use Type Annotations and let Pycord figure out the option type, like shown below. +You could use Type Annotations and let Pycord figure out the option type or explicitly specified using the [`SlashCommandOptionType`](https://docs.pycord.dev/en/stable/api/enums.html#discord.SlashCommandOptionType) enum. ```python import discord @@ -162,6 +172,16 @@ async def add(ctx, first: discord.Option(int), second: discord.Option(int)): sum = first + second await ctx.respond(f"The sum of {first} and {second} is {sum}.") +@bot.command() +# this explicitly tells pycord what types the options are instead +async def join( + ctx, + first: discord.Option(discord.SlashCommandOptionType.string), + second: discord.Option(discord.SlashCommandOptionType.string) +): + joined = first + second + await ctx.respond(f"When you join \"{first}\" and \"{second}\", you get: \"{joined}\".") + bot.run("TOKEN") ``` @@ -174,12 +194,20 @@ bot.run("TOKEN") The sum of 1 and 1 is 2. + +
+ + join + +
+ When you join "Py" and "cord", you get: "Pycord". +
- + -You could also explicitly declare the type using the [`SlashCommandOptionType`](https://docs.pycord.dev/en/stable/api/enums.html#discord.SlashCommandOptionType) enum. +Instead of Type Annotations, you can also use the option decorator. This is usually done to have type-hinting. ```python title="Slash Command Type" import discord @@ -187,11 +215,12 @@ import discord bot = discord.Bot() @bot.command() -# this explicitly tells pycord what types the options are instead of it figuring it out by itself +@discord.option("first", type=discord.SlashCommandOptionType.string) # type = str also works +@discord.option("second", type=discord.SlashCommandOptionType.string) # type = str also works async def join( ctx, - first: discord.Option(discord.SlashCommandOptionType.string), - second: discord.Option(discord.SlashCommandOptionType.string) + first: str, + second: str, ): joined = first + second await ctx.respond(f"When you join \"{first}\" and \"{second}\", you get: \"{joined}\".") @@ -206,7 +235,7 @@ bot.run("TOKEN") join - When you join "Hello" and "World!", you get: "Hello World!" + When you join "Py" and "cord", you get: "Pycord". diff --git a/docs/popular-topics/cogs.mdx b/docs/popular-topics/cogs.mdx index 62e38dc9..28b34933 100644 --- a/docs/popular-topics/cogs.mdx +++ b/docs/popular-topics/cogs.mdx @@ -8,9 +8,9 @@ to avoid making your bot's files messy and cluttered. ## Getting Started -First, you'll need to create a folder to store your cogs, eg. `cogs/`. +First, you'll need to create a folder to store your cogs, e.g. `cogs/`. -Then, create a file inside the folder, eg. `cogs/greetings.py`. By convention, the file name should +Then, create a file inside the folder, e.g. `cogs/greetings.py`. By convention, the file name should be the same as the name of the cog or module. We can then create the cog. @@ -37,6 +37,23 @@ class Greetings(commands.Cog): # create a class for our cog that inherits from c async def greet(self, ctx, member: discord.Member): await ctx.respond(f'{ctx.author.mention} says hello to {member.mention}!') + math = discord.SlashCommandGroup("math", "Spooky math stuff") # create a Slash Command Group called "math" + advanced_math = math.create_subgroup( + "advanced", + "super hard math commands!" + ) + + @math.command() + async def add(self, a: int, b: int): + c = a + b + await ctx.respond(f"{a} + {b} is {c}.") + + @advanced_math.command() + async def midpoint(self, x1: float, y1: float, x2: float, y2: float): + mid_x = (x1 + x2)/2 + mid_y = (y1 + y2)/2 + await ctx.respond(f"The midpoint between those coordinates is ({mid_x}, {mid_y}).") + @commands.Cog.listener() # we can add event listeners to our cog async def on_member_join(self, member): # this is called when a member joins the server # you must enable the proper intents @@ -56,7 +73,7 @@ bot.load_extension('cogs.greetings') ``` This loads the file `cogs/greetings.py` and adds it to the bot. -The argument of `load_extension` should be your cog's path (eg. cogs/greetings.py) without the file +The argument of `load_extension` should be your cog's path (e.g. cogs/greetings.py) without the file extension and with the `/` replaced with `.` If you have multiple cogs, you can add them all at once by adding the following code: diff --git a/src/layouts/DefaultLayout.tsx b/src/layouts/DefaultLayout.tsx index 676872f8..615bb0da 100644 --- a/src/layouts/DefaultLayout.tsx +++ b/src/layouts/DefaultLayout.tsx @@ -16,9 +16,24 @@ const DefaultLayout: React.FC = ({ title, description, child { title } - { site.tagline } + + + + + + + + + + + + + + +