Skip to content

a #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 18, 2024
Merged

a #449

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
baf6ddd
chore(deps-dev): Bump @tsconfig/docusaurus from 1.0.7 to 2.0.0
dependabot[bot] Jul 24, 2023
ee6715a
chore(deps): Bump webpack from 5.88.1 to 5.88.2
dependabot[bot] Jul 24, 2023
4657d15
chore(deps): Bump docusaurus-plugin-sass from 0.2.4 to 0.2.5
dependabot[bot] Jul 24, 2023
d019e05
chore(deps): Bump clsx from 1.2.1 to 2.0.0
dependabot[bot] Jul 24, 2023
0668414
Create version-updates.yml
Lulalaby Jul 27, 2023
f6c23fb
Merge pull request #354 from Pycord-Development/dependabot/npm_and_ya…
Lulalaby Jul 27, 2023
cf703f7
Merge pull request #352 from Pycord-Development/dependabot/npm_and_ya…
Lulalaby Jul 27, 2023
5e57ceb
Merge pull request #353 from Pycord-Development/dependabot/npm_and_ya…
Lulalaby Jul 27, 2023
1d0fca7
Merge pull request #355 from Pycord-Development/dependabot/npm_and_ya…
Lulalaby Jul 27, 2023
4bb8a6d
Fix type
ChunkLightTuna Jul 31, 2023
f9c6815
Merge pull request #356 from ChunkLightTuna/patch-1
Lulalaby Jul 31, 2023
f3499fd
chore(deps): Bump sass from 1.64.1 to 1.64.2 (#358)
dependabot[bot] Aug 7, 2023
1d1b87a
chore(deps): Bump sass from 1.64.2 to 1.65.1 (#359)
dependabot[bot] Aug 14, 2023
9448598
chore(deps): Bump sass from 1.65.1 to 1.66.1 (#360)
dependabot[bot] Aug 21, 2023
749dc9f
chore(deps-dev): Bump typescript from 5.1.6 to 5.2.2 (#361)
dependabot[bot] Aug 28, 2023
360e28a
chore(deps): Bump actions/checkout from 3 to 4 (#362)
dependabot[bot] Sep 4, 2023
933101b
chore(deps-dev): Bump remark-frontmatter from 4.0.1 to 5.0.0 (#363)
dependabot[bot] Sep 18, 2023
45a9229
chore(deps): Bump sass from 1.66.1 to 1.67.0 (#365)
dependabot[bot] Sep 18, 2023
541786e
chore(deps-dev): Bump @tsconfig/docusaurus from 2.0.0 to 2.0.1 (#366)
dependabot[bot] Sep 18, 2023
81c2b33
fix guide
Lulalaby Apr 18, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jobs:
if: github.event.pull_request.user.type != 'Bot' && !contains(github.event.pull_request.labels.*.name, 'skip-ci')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install codespell
- run: codespell --ignore-words-list="groupt,nd,ot,claus" --skip="./yarn.lock"
- run: codespell --ignore-words-list="groupt,nd,ot,claus,everytime" --skip="./yarn.lock"
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/devskim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ on:
jobs:
lint:
name: DevSkim
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run DevSkim scanner
uses: microsoft/DevSkim-Action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/njsscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: njsscan code scanning
steps:
- name: Checkout the code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: nodejsscan scan
id: njsscan
uses: ajinabraham/njsscan-action@d58d8b2f26322cd35a9efb8003baac517f226d81
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:

strategy:
matrix:
node-version: [16.14]
node-version: [18]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/version-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Version Update Auto Merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion docs/interactions/ui-components/buttons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ if you are trying to create a self-role system with buttons, for example. This i

Persistent views work forever. When the bot goes offline, the buttons will stop working. When the bot comes back online, however, the buttons will start working again.

In a Persistent View, the timeout must be set to `None` and all the children in the view much have a `custom_id` attribute set.
In a Persistent View, the timeout must be set to `None` and all the children in the view must have a `custom_id` attribute set.

```python
@bot.event
Expand Down
2 changes: 1 addition & 1 deletion docs/interactions/ui-components/dropdowns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MyView(discord.ui.View):

@bot.command()
async def flavor(ctx):
await ctx.send("Choose a flavor!", view=MyView())
await ctx.respond("Choose a flavor!", view=MyView())

bot.run("TOKEN")
```
Expand Down
1 change: 1 addition & 0 deletions docs/more/community-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This page showcases the amazing things created by the Pycord community, includin

| Name | Type | Link |
| ------------------------ | ------------ | ----------------------------------------------------------------------------------- |
| CookieBot | Multipurpose | [website](https://cookie-bot.xyz) |
| Discord-Multipurpose-Bot | Multipurpose | [github](https://github.com/pogrammar/Discord-multipurpose-bot/tree/master/Python) |
| _GZ_ Global | Chatting | [website](https://www.gzglobal.eu/) |
| inconnu | Fun & QOL | [github](https://github.com/tiltowait/inconnu) |
Expand Down
64 changes: 41 additions & 23 deletions docs/voice/playing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ async def connect_nodes():
"""Connect to our Lavalink nodes."""
await bot.wait_until_ready() # wait until the bot is ready

await wavelink.NodePool.create_node(
bot=bot,
host='0.0.0.0',
port=2333,
password='youshallnotpass'
) # create a node
nodes = [
wavelink.Node(
identifier="Node1", # This identifier must be unique for all the nodes you are going to use
uri="http://0.0.0.0:443", # Protocol (http/s) is required, port must be 443 as it is the one lavalink uses
password="youshallnotpass"
)
]

await wavelink.Pool.connect(nodes=nodes, client=bot) # Connect our nodes
```

<br />
Expand All @@ -67,23 +70,35 @@ Now you are finished making your node! Next, you will want to:
To make a play command, you will need to make a function to connect and play audio in a voice channel.

```py title="Play Command Example"
import typing

@bot.slash_command(name="play")
async def play(ctx, search: str):
vc = ctx.voice_client # define our voice client

if not vc: # check if the bot is not in a voice channel
vc = await ctx.author.voice.channel.connect(cls=wavelink.Player) # connect to the voice channel

if ctx.author.voice.channel.id != vc.channel.id: # check if the bot is not in the voice channel
return await ctx.respond("You must be in the same voice channel as the bot.") # return an error message

song = await wavelink.YouTubeTrack.search(query=search, return_first=True) # search for the song

if not song: # check if the song is not found
return await ctx.respond("No song found.") # return an error message

await vc.play(song) # play the song
await ctx.respond(f"Now playing: `{vc.source.title}`") # return a message
# First we may define our voice client,
# for this, we are going to use typing.cast()
# function just for the type checker know that
# `ctx.voice_client` is going to be from type
# `wavelink.Player`
vc = typing.cast(wavelink.Player, ctx.voice_client)

if not vc: # We firstly check if there is a voice client
vc = await ctx.author.voice.channel.connect(cls=wavelink.Player) # If there isn't, we connect it to the channel

# Now we are going to check if the invoker of the command
# is in the same voice channel than the voice client, when defined.
# If not, we return an error message.
if ctx.author.voice.channel.id != vc.channel.id:
return await ctx.respond("You must be in the same voice channel as the bot.")

# Now we search for the song. You can optionally
# pass the "source" keyword, of type "wavelink.TrackSource"
song = await wavelink.Playable.search(search)

if not song: # In case the song is not found
return await ctx.respond("No song found.") # we return an error message

await vc.play(song) # Else, we play it
await ctx.respond(f"Now playing: `{song.title}`") # and return a success message
```

<DiscordComponent>
Expand Down Expand Up @@ -113,8 +128,11 @@ async def on_ready():
await connect_nodes() # connect to the server

@bot.event
async def on_wavelink_node_ready(node: wavelink.Node):
print(f"{node.identifier} is ready.") # print a message
async def on_wavelink_node_ready(payload: wavelink.NodeReadyEventPayload):
# Everytime a node is successfully connected, we
# will print a message letting it know.
print(f"Node with ID {payload.session_id} has connected")
print(f"Resumed session: {payload.resumed}")

bot.run("token")
```
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@
"@matteusan/sentro": "0.1.25",
"@mdx-js/react": "1.6.22",
"@types/react": "17.0.2",
"clsx": "1.2.1",
"discord-message-components": "https://gitpkg.now.sh/Pycord-Development/discord-message-components?aa468ada9b2b52986ae0aee4051660713c1e9095&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20node%20node_modules%2Fesbuild%2Finstall.js%20%26%26yarn%20build%3Amarkdown%20%26%26%20yarn%20build%3Acore%20%26%26%20yarn%20build%3Areact",
"docusaurus-plugin-sass": "0.2.4",
"clsx": "2.0.0",
"discord-message-components": "https://gitpkg.now.sh/Pycord-Development/discord-message-components?aa468ada9b2b52986ae0aee4051660713c1e9095&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20node%20node_modules%2Fesbuild%2Finstall.js%20%26%26yarn%20build%3Amarkdown%20%26%26%20yarn%20build%3Acore%20%26%26%20yarn%20build%3Areact%20%26%26",
"docusaurus-plugin-sass": "0.2.5",
"prism-react-renderer": "1.3.5",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-twemoji": "^0.5.0",
"sass": "1.64.1",
"webpack": "^5.88.1",
"sass": "1.67.0",
"webpack": "^5.88.2",
"yarn": "^1.22.19"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.1",
"@tsconfig/docusaurus": "1.0.7",
"@tsconfig/docusaurus": "2.0.1",
"micromark-extension-mdx-md": "^2.0.0",
"remark-cli": "^11.0.0",
"remark-comment": "^1.0.0",
"remark-frontmatter": "^4.0.1",
"remark-frontmatter": "^5.0.0",
"remark-gfm": "^3.0.1",
"remark-mdx": "^2.3.0",
"remark-preset-lint-consistent": "^5.1.2",
"remark-preset-lint-recommended": "^6.1.3",
"typescript": "5.1.6"
"typescript": "5.2.2"
},
"resolutions": {
"@types/react": "17.0.2"
Expand Down
Loading