Compare commits

..

1 Commits

Author SHA1 Message Date
ErrorNoInternet f65b5fd5b3 refactor(nix): move attributes around 2026-05-09 15:01:46 -04:00
10 changed files with 87 additions and 90 deletions
+4 -5
View File
@@ -1,6 +1,5 @@
.direnv /.direnv
.env /.env
.mypy_cache /.venv
.venv /result*
__pycache__ __pycache__
result*
+8 -8
View File
@@ -4,7 +4,7 @@ import disnake
import disnake_paginator import disnake_paginator
from ... import arguments, audio, commands, utils from ... import arguments, audio, commands, utils
from ...constants import EMBED_COLOR, USER_QUEUE_MAX from ...constants import EMBED_COLOR
from ...state import client, players, trusted_users from ...state import client, players, trusted_users
from .playback import resume from .playback import resume
from .utils import command_allowed, ensure_joined, play_next from .utils import command_allowed, ensure_joined, play_next
@@ -142,13 +142,13 @@ async def queue_or_play(message, edited=False):
), ),
), ),
) )
>= USER_QUEUE_MAX >= 5
and not len(message.guild.voice_client.channel.members) == 2 and not len(message.guild.voice_client.channel.members) == 2
and message.author.id not in trusted_users and message.author.id not in trusted_users
): ):
await utils.reply( await utils.reply(
message, message,
f"you can only queue **{USER_QUEUE_MAX} items** without the manage channels permission!", "you can only queue **5 items** without the manage channels permission!",
) )
return return
@@ -203,21 +203,21 @@ async def queue_or_play(message, edited=False):
natural=True, natural=True,
) )
def create_embed(description): def embed(description):
embed = disnake.Embed( e = disnake.Embed(
description=description, description=description,
color=EMBED_COLOR, color=EMBED_COLOR,
) )
if formatted_duration and len(players[message.guild.id].queue) > 1: if formatted_duration and len(players[message.guild.id].queue) > 1:
embed.set_footer(text=f"{formatted_duration} in total") e.set_footer(text=f"{formatted_duration} in total")
return embed return e
await disnake_paginator.ButtonPaginator( await disnake_paginator.ButtonPaginator(
invalid_user_function=utils.invalid_user_handler, invalid_user_function=utils.invalid_user_handler,
color=EMBED_COLOR, color=EMBED_COLOR,
segments=list( segments=list(
map( map(
create_embed, embed,
[ [
"\n\n".join( "\n\n".join(
[ [
+64 -63
View File
@@ -1,52 +1,28 @@
import os import os
APPLICATION_FLAGS = { YTDL_OPTIONS = {
1 << 12: "Presence Intent", "color": "never",
1 << 13: "Presence Intent (unverified)", "default_search": "auto",
1 << 14: "Guild Members Intent", "format": "bestaudio/best",
1 << 15: "Guild Members Intent (unverified)", "ignoreerrors": False,
1 << 16: "Unusual Growth (verification suspended)", "logtostderr": False,
1 << 18: "Message Content Intent", "no_warnings": True,
1 << 19: "Message Content Intent (unverified)", "noplaylist": True,
1 << 23: "Suports Application Commands", "outtmpl": "%(extractor)s-%(id)s-%(title)s.%(ext)s",
} "quiet": True,
BADGE_EMOJIS = { "restrictfilenames": True,
"Discord Employee": "<:DiscordStaff:879666899980546068>", "socket_timeout": 15,
"Discord Partner": "<:DiscordPartner:879668340434534400>", "source_address": "0.0.0.0",
"HypeSquad Events": "<:HypeSquadEvents:879666970310606848>",
"Bug Hunter Level 1": "<:BugHunter1:879666851448234014>",
"HypeSquad Bravery": "<:HypeSquadBravery:879666945153175612>",
"HypeSquad Brilliance": "<:HypeSquadBrilliance:879666956884643861>",
"HypeSquad Balance": "<:HypeSquadBalance:879666934717771786>",
"Early Supporter": "<:EarlySupporter:879666916493496400>",
"Team User": "<:TeamUser:890866907996127305>",
"Bug Hunter Level 2": "<:BugHunter2:879666866971357224>",
"Verified Bot": "<:VerifiedBot:879670687554498591>",
"Verified Bot Developer": "<:VerifiedBotDeveloper:879669786550890507>",
"Discord Certified Moderator": "<:DiscordModerator:879666882976837654>",
"HTTP Interactions Only": "<:HTTPInteractionsOnly:1047141867806015559>",
"Active Developer": "<:ActiveDeveloper:1047141451244523592>",
} }
BAR_LENGTH = 35 BAR_LENGTH = 35
EMBED_COLOR = 0x00B6FF EMBED_COLOR = 0xFF6600
OWNERS = [531392146767347712] OWNERS = [531392146767347712]
PREFIX = "%" PREFIX = "%"
PUBLIC_FLAGS = { SPONSORBLOCK_CATEGORY_NAMES = {
1 << 0: "Discord Employee", "music_offtopic": "non-music",
1 << 1: "Discord Partner", "selfpromo": "self promotion",
1 << 2: "HypeSquad Events", "sponsor": "sponsored",
1 << 3: "Bug Hunter Level 1",
1 << 6: "HypeSquad Bravery",
1 << 7: "HypeSquad Brilliance",
1 << 8: "HypeSquad Balance",
1 << 9: "Early Supporter",
1 << 10: "Team User",
1 << 14: "Bug Hunter Level 2",
1 << 16: "Verified Bot",
1 << 17: "Verified Bot Developer",
1 << 18: "Discord Certified Moderator",
1 << 19: "HTTP Interactions Only",
1 << 22: "Active Developer",
} }
REACTIONS = { REACTIONS = {
"cat": ["🐈"], "cat": ["🐈"],
@@ -86,26 +62,51 @@ RELOADABLE_MODULES = [
"yt_dlp", "yt_dlp",
"yt_dlp.version", "yt_dlp.version",
] ]
PUBLIC_FLAGS = {
1 << 0: "Discord Employee",
1 << 1: "Discord Partner",
1 << 2: "HypeSquad Events",
1 << 3: "Bug Hunter Level 1",
1 << 6: "HypeSquad Bravery",
1 << 7: "HypeSquad Brilliance",
1 << 8: "HypeSquad Balance",
1 << 9: "Early Supporter",
1 << 10: "Team User",
1 << 14: "Bug Hunter Level 2",
1 << 16: "Verified Bot",
1 << 17: "Verified Bot Developer",
1 << 18: "Discord Certified Moderator",
1 << 19: "HTTP Interactions Only",
1 << 22: "Active Developer",
}
BADGE_EMOJIS = {
"Discord Employee": "<:DiscordStaff:879666899980546068>",
"Discord Partner": "<:DiscordPartner:879668340434534400>",
"HypeSquad Events": "<:HypeSquadEvents:879666970310606848>",
"Bug Hunter Level 1": "<:BugHunter1:879666851448234014>",
"HypeSquad Bravery": "<:HypeSquadBravery:879666945153175612>",
"HypeSquad Brilliance": "<:HypeSquadBrilliance:879666956884643861>",
"HypeSquad Balance": "<:HypeSquadBalance:879666934717771786>",
"Early Supporter": "<:EarlySupporter:879666916493496400>",
"Team User": "<:TeamUser:890866907996127305>",
"Bug Hunter Level 2": "<:BugHunter2:879666866971357224>",
"Verified Bot": "<:VerifiedBot:879670687554498591>",
"Verified Bot Developer": "<:VerifiedBotDeveloper:879669786550890507>",
"Discord Certified Moderator": "<:DiscordModerator:879666882976837654>",
"HTTP Interactions Only": "<:HTTPInteractionsOnly:1047141867806015559>",
"Active Developer": "<:ActiveDeveloper:1047141451244523592>",
}
APPLICATION_FLAGS = {
1 << 12: "Presence Intent",
1 << 13: "Presence Intent (unverified)",
1 << 14: "Guild Members Intent",
1 << 15: "Guild Members Intent (unverified)",
1 << 16: "Unusual Growth (verification suspended)",
1 << 18: "Message Content Intent",
1 << 19: "Message Content Intent (unverified)",
1 << 23: "Suports Application Commands",
}
SECRETS = { SECRETS = {
"TOKEN": os.getenv("BOT_TOKEN"), "TOKEN": os.getenv("BOT_TOKEN"),
} }
SPONSORBLOCK_CATEGORY_NAMES = {
"music_offtopic": "non-music",
"selfpromo": "self promotion",
"sponsor": "sponsored",
}
USER_QUEUE_MAX = 5
YTDL_OPTIONS = {
"color": "never",
"default_search": "auto",
"format": "bestaudio/best",
"ignoreerrors": False,
"logtostderr": False,
"no_warnings": True,
"noplaylist": True,
"outtmpl": "%(extractor)s-%(id)s-%(title)s.%(ext)s",
"quiet": True,
"restrictfilenames": True,
"socket_timeout": 15,
"source_address": "0.0.0.0",
}
+1 -4
View File
@@ -50,10 +50,7 @@ async def transcript(
except Exception: except Exception:
pass pass
if ( if (message.guild.voice_client.source.id != initial_id) or kill["transcript"]:
message.guild.voice_client.source
and (message.guild.voice_client.source.id != initial_id)
) or kill["transcript"]:
kill["transcript"] = False kill["transcript"] = False
break break
+1 -1
View File
@@ -1,6 +1,6 @@
import unittest import unittest
from errornocord import utils import utils
class TestFilterSecrets(unittest.TestCase): class TestFilterSecrets(unittest.TestCase):
+2 -1
View File
@@ -1,6 +1,7 @@
import unittest import unittest
from errornocord import audio, utils import audio
import utils
class TestFormatDuration(unittest.TestCase): class TestFormatDuration(unittest.TestCase):
+1 -1
View File
@@ -3,7 +3,7 @@ from collections import OrderedDict
from ..constants import SECRETS from ..constants import SECRETS
def surround(inner: str | int, outer="```") -> str: def surround(inner: str, outer="```") -> str:
return outer + str(inner) + outer return outer + str(inner) + outer
+2 -3
View File
@@ -1,16 +1,15 @@
import ctypes.util import ctypes
import time import time
from logging import debug, error from logging import debug, error
import disnake import disnake
from .. import commands
from ..constants import OWNERS from ..constants import OWNERS
from ..state import command_cooldowns, message_responses from ..state import command_cooldowns, message_responses
def cooldown(message, cooldown_time: int): def cooldown(message, cooldown_time: int):
from .. import commands
if message.author.id in OWNERS: if message.author.id in OWNERS:
return return
+2 -2
View File
@@ -18,13 +18,13 @@
{ {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "errornocord"; name = "errornocord";
inputsFrom = [ self'.packages.default ];
buildInputs = [ self'.packages.default ]; buildInputs = [ self'.packages.default ];
inputsFrom = [ self'.packages.default ];
}; };
packages = rec { packages = rec {
default = errornocord;
errornocord = pkgs.callPackage ./nix/package.nix { inherit self; }; errornocord = pkgs.callPackage ./nix/package.nix { inherit self; };
default = errornocord;
}; };
}; };
+2 -2
View File
@@ -44,9 +44,9 @@ let
}; };
}; };
in in
python3Packages.buildPythonPackage rec { python3Packages.buildPythonPackage {
pname = "dave.py"; pname = "dave.py";
version = src.revision; version = self.pins."dave.py".revision;
pyproject = true; pyproject = true;
src = self.pins."dave.py"; src = self.pins."dave.py";