Skip to content

Commit

Permalink
Don't need to pass client in run_client().
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachaa-Thanasius committed Dec 4, 2023
1 parent 2937f68 commit 9544001
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 3 additions & 5 deletions musicbot/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,16 @@ def run_client() -> None:

discord.utils.setup_logging()

async def bot_runner(client: MusicBot) -> None:
async with client:
async def bot_runner() -> None:
async with MusicBot(lavalink_creds) as client:
await client.start(token, reconnect=True)

token = _get_token()
lavalink_creds = _get_lavalink_creds()

client = MusicBot(lavalink_creds)

loop = uvloop.new_event_loop if (uvloop is not None) else None # type: ignore

Check warning on line 98 in musicbot/_main.py

View workflow job for this annotation

GitHub Actions / Type Coverage and Linting @ 3.11

Unnecessary "# type: ignore" comment
with asyncio.Runner(loop_factory=loop) as runner: # type: ignore

Check warning on line 99 in musicbot/_main.py

View workflow job for this annotation

GitHub Actions / Type Coverage and Linting @ 3.11

Unnecessary "# type: ignore" comment
runner.run(bot_runner(client))
runner.run(bot_runner())


def main() -> None:
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "discord-musicbot"
version = "0.1.1"
description = "A relatively minimal configuration Discord bot for playing music."
description = "A minimal configuration Discord bot for playing music."
readme = "README.md"
license = "MIT"
requires-python = ">=3.11"
Expand All @@ -12,7 +12,6 @@ Homepage = "https://github.com/Sachaa-Thanasius/discord-musicbot"
"Bug Tracker" = "https://github.com/Sachaa-Thanasius/discord-musicbot/issues"

[tool.ruff]
# Credit to @mikeshardmind for most of this setup.
line-length = 120
target-version = "py311"
select = [
Expand Down Expand Up @@ -79,5 +78,4 @@ combine-as-imports = true
include = ["musicbot"]
typeCheckingMode = "strict"
pythonVersion = "3.11"
reportPropertyTypeMismatch = "warning"
reportUnnecessaryTypeIgnoreComment = "warning"

0 comments on commit 9544001

Please sign in to comment.