diff options
Diffstat (limited to 'code/cogs')
-rw-r--r-- | code/cogs/autoplay.py | 2 | ||||
-rw-r--r-- | code/cogs/bug.py | 2 | ||||
-rw-r--r-- | code/cogs/clear.py | 2 | ||||
-rw-r--r-- | code/cogs/feedback.py | 2 | ||||
-rw-r--r-- | code/cogs/help.py | 2 | ||||
-rw-r--r-- | code/cogs/music.py | 21 | ||||
-rw-r--r-- | code/cogs/nowplaying.py | 2 | ||||
-rw-r--r-- | code/cogs/owner/stats.py | 2 | ||||
-rw-r--r-- | code/cogs/pause.py | 2 | ||||
-rw-r--r-- | code/cogs/play.py | 2 | ||||
-rw-r--r-- | code/cogs/queue.py | 2 | ||||
-rw-r--r-- | code/cogs/remove.py | 2 | ||||
-rw-r--r-- | code/cogs/repeat.py | 2 | ||||
-rw-r--r-- | code/cogs/resume.py | 2 | ||||
-rw-r--r-- | code/cogs/shuffle.py | 2 | ||||
-rw-r--r-- | code/cogs/skip.py | 2 | ||||
-rw-r--r-- | code/cogs/slash_handlers.py | 4 | ||||
-rw-r--r-- | code/cogs/stop.py | 2 |
18 files changed, 33 insertions, 24 deletions
diff --git a/code/cogs/autoplay.py b/code/cogs/autoplay.py index cc5de91..4f5dc7a 100644 --- a/code/cogs/autoplay.py +++ b/code/cogs/autoplay.py @@ -6,7 +6,7 @@ from cogs.music import Music from typing import Literal from ai_recommendations import add_song_recommendations -from global_variables import BOT_COLOR +from config import BOT_COLOR class Autoplay(commands.Cog): diff --git a/code/cogs/bug.py b/code/cogs/bug.py index 67ae258..4f8606d 100644 --- a/code/cogs/bug.py +++ b/code/cogs/bug.py @@ -2,7 +2,7 @@ import discord from discord import app_commands from discord.ext import commands -from global_variables import BOT_COLOR, BUG_CHANNEL_ID +from config import BOT_COLOR, BUG_CHANNEL_ID class BugReport(discord.ui.Modal, title="Report a bug"): diff --git a/code/cogs/clear.py b/code/cogs/clear.py index 8711701..79b2f0f 100644 --- a/code/cogs/clear.py +++ b/code/cogs/clear.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Clear(commands.Cog): diff --git a/code/cogs/feedback.py b/code/cogs/feedback.py index e04eecf..149b112 100644 --- a/code/cogs/feedback.py +++ b/code/cogs/feedback.py @@ -2,7 +2,7 @@ import discord from discord import app_commands from discord.ext import commands -from global_variables import BOT_COLOR, FEEDBACK_CHANNEL_ID +from config import BOT_COLOR, FEEDBACK_CHANNEL_ID class FeedbackForm(discord.ui.Modal, title="Give feedback about the bot"): diff --git a/code/cogs/help.py b/code/cogs/help.py index ee1ad19..2cf0f54 100644 --- a/code/cogs/help.py +++ b/code/cogs/help.py @@ -2,7 +2,7 @@ import discord from discord.ext import commands from discord import app_commands -from global_variables import BOT_COLOR, BOT_INVITE_LINK +from config import BOT_COLOR, BOT_INVITE_LINK commands_and_descriptions = { "play": { diff --git a/code/cogs/music.py b/code/cogs/music.py index e62c9e0..68870e1 100644 --- a/code/cogs/music.py +++ b/code/cogs/music.py @@ -3,16 +3,21 @@ from discord.ext import commands import lavalink from lavalink import errors -from global_variables import ( +from config import ( LAVALINK_HOST, LAVALINK_PASSWORD, LAVALINK_PORT, LOG, - CheckPlayerError, ) from ai_recommendations import add_song_recommendations +class CheckPlayerError(discord.app_commands.AppCommandError): + def __init__(self, info) -> None: + self.info = info + super().__init__() + + class LavalinkVoiceClient(discord.VoiceProtocol): """ This is the preferred way to handle external voice sending @@ -104,13 +109,15 @@ class Music(commands.Cog): host=LAVALINK_HOST, port=LAVALINK_PORT, password=LAVALINK_PASSWORD, - region='us-central', - connect=False + region="us-central", + connect=False, ) # Host, Port, Password, Region, Connect try: await node.get_version() except lavalink.errors.ClientError: - LOG.error("Authentication to lavalink node failed. Check your login credentials.") + LOG.error( + "Authentication to lavalink node failed. Check your login credentials." + ) else: await node.connect() LOG.info(f"Connected to lavalink node {node.name}") @@ -125,7 +132,9 @@ class Music(commands.Cog): async def create_player(interaction: discord.Interaction): """Create a player for the guild associated with the interaction, or raise an error""" try: - player = interaction.client.lavalink.player_manager.create(interaction.guild.id) + player = interaction.client.lavalink.player_manager.create( + interaction.guild.id + ) except errors.ClientError: raise CheckPlayerError( { diff --git a/code/cogs/nowplaying.py b/code/cogs/nowplaying.py index 84898cd..928ac51 100644 --- a/code/cogs/nowplaying.py +++ b/code/cogs/nowplaying.py @@ -5,7 +5,7 @@ from discord.ext import commands from cogs.music import Music import lavalink -from global_variables import BOT_COLOR +from config import BOT_COLOR class NowPlaying(commands.Cog): diff --git a/code/cogs/owner/stats.py b/code/cogs/owner/stats.py index d81ec13..ab0f0ad 100644 --- a/code/cogs/owner/stats.py +++ b/code/cogs/owner/stats.py @@ -3,7 +3,7 @@ from discord import app_commands import sqlite3 import discord -from global_variables import BOT_COLOR +from config import BOT_COLOR class Stats(commands.Cog): diff --git a/code/cogs/pause.py b/code/cogs/pause.py index 522a376..656075c 100644 --- a/code/cogs/pause.py +++ b/code/cogs/pause.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Pause(commands.Cog): diff --git a/code/cogs/play.py b/code/cogs/play.py index 855d645..67c3e04 100644 --- a/code/cogs/play.py +++ b/code/cogs/play.py @@ -8,7 +8,7 @@ import re from cogs.music import LavalinkVoiceClient import requests -from global_variables import BOT_COLOR +from config import BOT_COLOR from custom_source import CustomSource diff --git a/code/cogs/queue.py b/code/cogs/queue.py index 1b26991..d356b54 100644 --- a/code/cogs/queue.py +++ b/code/cogs/queue.py @@ -6,7 +6,7 @@ from cogs.music import Music import math import lavalink -from global_variables import BOT_COLOR +from config import BOT_COLOR class Queue(commands.Cog): diff --git a/code/cogs/remove.py b/code/cogs/remove.py index 6234d67..2188331 100644 --- a/code/cogs/remove.py +++ b/code/cogs/remove.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Remove(commands.Cog): diff --git a/code/cogs/repeat.py b/code/cogs/repeat.py index 95f430b..4424b72 100644 --- a/code/cogs/repeat.py +++ b/code/cogs/repeat.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Repeat(commands.GroupCog, name="repeat"): diff --git a/code/cogs/resume.py b/code/cogs/resume.py index 51d3348..4d95682 100644 --- a/code/cogs/resume.py +++ b/code/cogs/resume.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Resume(commands.Cog): diff --git a/code/cogs/shuffle.py b/code/cogs/shuffle.py index ba78957..7ba9cf9 100644 --- a/code/cogs/shuffle.py +++ b/code/cogs/shuffle.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Shuffle(commands.GroupCog, name="shuffle"): diff --git a/code/cogs/skip.py b/code/cogs/skip.py index 26c6639..c1692c7 100644 --- a/code/cogs/skip.py +++ b/code/cogs/skip.py @@ -5,7 +5,7 @@ from discord.ext import commands from cogs.music import Music import asyncio -from global_variables import BOT_COLOR +from config import BOT_COLOR from custom_source import LoadError diff --git a/code/cogs/slash_handlers.py b/code/cogs/slash_handlers.py index ebe4a81..019ee45 100644 --- a/code/cogs/slash_handlers.py +++ b/code/cogs/slash_handlers.py @@ -3,9 +3,9 @@ from discord.ext import commands from discord import app_commands from discord.ext.commands.errors import * import datetime -from lavalink import errors -from global_variables import BOT_COLOR, CheckPlayerError +from cogs.music import CheckPlayerError +from config import BOT_COLOR from custom_source import LoadError diff --git a/code/cogs/stop.py b/code/cogs/stop.py index f0641d1..fd7bb5d 100644 --- a/code/cogs/stop.py +++ b/code/cogs/stop.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from global_variables import BOT_COLOR +from config import BOT_COLOR class Stop(commands.Cog): |