Skip to content

Commit 001b801

Browse files
authored
Merge pull request #57 from cloudwithax/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents 7829086 + db1c66d commit 001b801

File tree

3 files changed

+56
-50
lines changed

3 files changed

+56
-50
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v4.5.0
66
hooks:
77
- id: check-ast
88
- id: check-builtin-literals
@@ -11,29 +11,29 @@ repos:
1111
- id: requirements-txt-fixer
1212
- id: trailing-whitespace
1313
- repo: https://github.com/psf/black
14-
rev: 23.7.0
14+
rev: 23.10.1
1515
hooks:
1616
- id: black
1717
language_version: python3.11
1818
- repo: https://github.com/asottile/blacken-docs
19-
rev: 1.15.0
19+
rev: 1.16.0
2020
hooks:
2121
- id: blacken-docs
2222
- repo: https://github.com/asottile/pyupgrade
23-
rev: v3.10.1
23+
rev: v3.15.0
2424
hooks:
2525
- id: pyupgrade
2626
args: [--py37-plus, --keep-runtime-typing]
2727
- repo: https://github.com/asottile/reorder-python-imports
28-
rev: v3.10.0
28+
rev: v3.12.0
2929
hooks:
3030
- id: reorder-python-imports
3131
- repo: https://github.com/asottile/add-trailing-comma
32-
rev: v3.0.1
32+
rev: v3.1.0
3333
hooks:
3434
- id: add-trailing-comma
3535
- repo: https://github.com/hadialqattan/pycln
36-
rev: v2.2.2
36+
rev: v2.3.0
3737
hooks:
3838
- id: pycln
3939

docs/hdi/events.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ The classes listed here are as they appear in Pomice. When you use them within y
1313
the way you use them will be different. Here's an example on how you would use the `TrackStartEvent` within an event listener in a cog:
1414

1515
```py
16-
1716
@commands.Cog.listener
1817
async def on_pomice_track_start(self, player: Player, track: Track):
1918
...
20-
2119
```
2220

2321
## Event definitions

docs/quickstart.md

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,63 +10,71 @@ import re
1010

1111
from discord.ext import commands
1212

13-
URL_REG = re.compile(r'https?://(?:www\.)?.+')
13+
URL_REG = re.compile(r"https?://(?:www\.)?.+")
1414

15-
class MyBot(commands.Bot):
1615

17-
def __init__(self) -> None:
18-
super().__init__(command_prefix='!', activity=discord.Activity(type=discord.ActivityType.listening, name='to music!'))
16+
class MyBot(commands.Bot):
17+
def __init__(self) -> None:
18+
super().__init__(
19+
command_prefix="!",
20+
activity=discord.Activity(
21+
type=discord.ActivityType.listening, name="to music!"
22+
),
23+
)
1924

20-
self.add_cog(Music(self))
25+
self.add_cog(Music(self))
2126

22-
async def on_ready(self) -> None:
23-
print("I'm online!")
24-
await self.cogs["Music"].start_nodes()
27+
async def on_ready(self) -> None:
28+
print("I'm online!")
29+
await self.cogs["Music"].start_nodes()
2530

2631

2732
class Music(commands.Cog):
28-
29-
def __init__(self, bot) -> None:
30-
self.bot = bot
31-
32-
self.pomice = pomice.NodePool()
33-
34-
async def start_nodes(self):
35-
await self.pomice.create_node(bot=self.bot, host='127.0.0.1', port='3030',
36-
password='youshallnotpass', identifier='MAIN')
37-
print(f"Node is ready!")
38-
39-
40-
41-
@commands.command(name='join', aliases=['connect'])
42-
async def join(self, ctx: commands.Context, *, channel: discord.TextChannel = None) -> None:
43-
44-
if not channel:
45-
channel = getattr(ctx.author.voice, 'channel', None)
33+
def __init__(self, bot) -> None:
34+
self.bot = bot
35+
36+
self.pomice = pomice.NodePool()
37+
38+
async def start_nodes(self):
39+
await self.pomice.create_node(
40+
bot=self.bot,
41+
host="127.0.0.1",
42+
port="3030",
43+
password="youshallnotpass",
44+
identifier="MAIN",
45+
)
46+
print(f"Node is ready!")
47+
48+
@commands.command(name="join", aliases=["connect"])
49+
async def join(
50+
self, ctx: commands.Context, *, channel: discord.TextChannel = None
51+
) -> None:
52+
if not channel:
53+
channel = getattr(ctx.author.voice, "channel", None)
4654
if not channel:
47-
raise commands.CheckFailure('You must be in a voice channel to use this command'
48-
'without specifying the channel argument.')
49-
50-
51-
await ctx.author.voice.channel.connect(cls=pomice.Player)
52-
await ctx.send(f'Joined the voice channel `{channel}`')
55+
raise commands.CheckFailure(
56+
"You must be in a voice channel to use this command"
57+
"without specifying the channel argument."
58+
)
5359

54-
@commands.command(name='play')
55-
async def play(self, ctx, *, search: str) -> None:
60+
await ctx.author.voice.channel.connect(cls=pomice.Player)
61+
await ctx.send(f"Joined the voice channel `{channel}`")
5662

57-
if not ctx.voice_client:
63+
@commands.command(name="play")
64+
async def play(self, ctx, *, search: str) -> None:
65+
if not ctx.voice_client:
5866
await ctx.invoke(self.join)
5967

60-
player = ctx.voice_client
68+
player = ctx.voice_client
6169

62-
results = await player.get_tracks(query=f'{search}')
70+
results = await player.get_tracks(query=f"{search}")
6371

64-
if not results:
65-
raise commands.CommandError('No results were found for that search term.')
72+
if not results:
73+
raise commands.CommandError("No results were found for that search term.")
6674

67-
if isinstance(results, pomice.Playlist):
75+
if isinstance(results, pomice.Playlist):
6876
await player.play(track=results.tracks[0])
69-
else:
77+
else:
7078
await player.play(track=results[0])
7179

7280

0 commit comments

Comments
 (0)