diff --git a/.gitignore b/.gitignore index 01e0903..97889a0 100644 --- a/.gitignore +++ b/.gitignore @@ -133,4 +133,4 @@ dmypy.json # CloudKid config.json -Pipfile.lock \ No newline at end of file +Pipfile.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..76a1554 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +default_language_version: + python: python3.8 +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-ast + - id: check-case-conflict + - id: check-json + - id: check-merge-conflict + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/asottile/reorder_python_imports + rev: v2.6.0 + hooks: + - id: reorder-python-imports diff --git a/.vscode/settings.json b/.vscode/settings.json index de288e1..163c984 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { "python.formatting.provider": "black" -} \ No newline at end of file +} diff --git a/README.md b/README.md index 883d978..8750a25 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# ChristmasBot -Christmas Music Bot +# TuneBot +A very configurable Discord radio diff --git a/bot.py b/bot.py index d1fb23f..85b7cd9 100644 --- a/bot.py +++ b/bot.py @@ -1,28 +1,29 @@ -import asyncio -from aioredis.client import Redis -import discord -from discord import ActivityType -from discord.colour import Color -from discord.ext import commands, tasks -import sys -from signal import SIGINT, SIGTERM import json -from typing import Any, Dict, List, Sequence -from discord import Message -from discord.ext.commands.errors import ( - ExtensionAlreadyLoaded, - ExtensionFailed, - ExtensionNotFound, - NoEntryPointError, -) -import lavalink +import sys +from typing import Any +from typing import Dict +from typing import List +from typing import Sequence + import aioredis +import discord +import lavalink from aioredis import Redis +from aioredis.client import Redis +from discord import ActivityType +from discord import Message +from discord.colour import Color +from discord.ext import commands +from discord.ext import tasks +from discord.ext.commands.errors import ExtensionAlreadyLoaded +from discord.ext.commands.errors import ExtensionFailed +from discord.ext.commands.errors import ExtensionNotFound +from discord.ext.commands.errors import NoEntryPointError from context import CustomContext -class ChristmasBot(commands.Bot): +class TuneBot(commands.Bot): lavalink: lavalink.Client invite_link: str @@ -38,7 +39,6 @@ class ChristmasBot(commands.Bot): self.initial_cog_names: List[str] = self.config.get("cogs", []) self.colors: Dict[str, Color] = self.process_colours(config.get("colors", [])) - self._redis_client: Redis = aioredis.from_url( self.config["redis_url"], encoding="utf-8", decode_responses=True ) @@ -110,6 +110,13 @@ class ChristmasBot(commands.Bot): await self.change_presence(activity=activity) +config_path = "config.json" +if len(sys.argv) > 1: + config_path = sys.argv[1] + +config = json.load(open(config_path, "r", encoding="utf-8")) +redis_prefix = config["redis_prefix"] + if __name__ == "__main__": try: import uvloop @@ -119,6 +126,5 @@ if __name__ == "__main__": except ModuleNotFoundError: pass - config = json.load(open("config.json", "r", encoding="utf-8")) token = config.pop("token") - ChristmasBot(config).run(token, reconnect=True) + TuneBot(config).run(token, reconnect=True) diff --git a/cogs/information.py b/cogs/information.py index 061af1a..e81e36a 100644 --- a/cogs/information.py +++ b/cogs/information.py @@ -1,24 +1,25 @@ +import datetime +import time from typing import Optional import discord -from discord.ext import tasks, commands - -import time -from discord.ext.commands import Context import humanize -import datetime import lavalink -from bot import ChristmasBot +from discord.ext import commands +from discord.ext import tasks +from discord.ext.commands import Context + +from bot import TuneBot +from context import CustomContext +from utils.database import AutoJoin from utils.EmbedGenerator import EmbedGenerator +from utils.classes import BaseCog from utils.paginator import HelpPaginator -class InformationCog(commands.Cog, name="Information"): - def __init__(self, bot: ChristmasBot): - self.bot = bot - +class InformationCog(BaseCog, name="Information"): + @commands.command(name="ping", aliases=["pong"]) @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) - @commands.command(description="PONG!", aliases=["pong"]) async def ping(self, ctx: Context): """Test the latency""" avatar = ctx.author.avatar.with_static_format("jpeg") @@ -39,24 +40,18 @@ class InformationCog(commands.Cog, name="Information"): embed.set_footer(text=f"Requested by: {ctx.author}", icon_url=f"{avatar}") await msg.edit(embed=embed) - @commands.command( - name="invite", description="Gets the invite link!", slash_commands=True - ) + @commands.command(name="invite") @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) async def invite(self, ctx: Context): - """Gets the invite link!""" + """Gets the invite link""" await EmbedGenerator.Message( ctx, "Add our bot to your server:", self.bot.invite_link ) - @commands.command( - name="wlinfo", - description="Retrieve various Node/Server/Player information.", - slash_commands=True, - ) + @commands.command(name="wlinfo") @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) - async def wlinfo(self, ctx: Context): - """Retrieve various Node/Server/Player information.""" + async def wlinfo(self, ctx: CustomContext): + """Retrieve various node/server/player information""" player = self.bot.lavalink.player_manager.get(ctx.guild.id) nodes = self.bot.lavalink.node_manager.available_nodes @@ -77,8 +72,9 @@ class InformationCog(commands.Cog, name="Information"): #f"Server Uptime: `{datetime.timedelta(milliseconds=node.stats.uptime)}`" ) await ctx.send(fmt) + AutoJoin.get_channels() - @commands.command(name="help", aliases=["about", "info"], slash_command=True) + @commands.command(name="help", aliases=["about", "info"]) @commands.cooldown(1, 1, commands.BucketType.user) async def about( self, @@ -87,7 +83,7 @@ class InformationCog(commands.Cog, name="Information"): description="Show help for a command or category" ), ): - """ChristmasBot command list""" + """Retrieve a list of possible commands""" if command: entity = self.bot.get_cog(command) or self.bot.get_command(command) @@ -127,6 +123,6 @@ class InformationCog(commands.Cog, name="Information"): await ctx.send(embed=embed) -def setup(bot: ChristmasBot): +def setup(bot: TuneBot): bot.remove_command("help") bot.add_cog(InformationCog(bot)) diff --git a/cogs/music.py b/cogs/music.py index 5a824d6..02cb4ee 100644 --- a/cogs/music.py +++ b/cogs/music.py @@ -1,21 +1,27 @@ import asyncio +import datetime import re from typing import Optional -from aioredis.client import Redis - import discord from discord.channel import TextChannel from discord.ext.commands.context import Context +from discord.ext.commands.errors import CommandError import lavalink -from discord.ext import commands -from lavalink.models import AudioTrack, DefaultPlayer - -from bot import ChristmasBot -from utils.EmbedGenerator import EmbedGenerator -from utils.database import AutoJoin -from context import CustomContext from discord import Embed +from discord.channel import TextChannel +from discord.ext import commands +from discord.ext.commands.context import Context +from lavalink.models import AudioTrack +from lavalink.models import DefaultPlayer + +from bot import TuneBot +from utils.classes import BaseCog +from context import CustomContext +from utils.database import AutoJoin +from utils.database import Playlist +from utils.exceptions import EmbeddedCommandException +from utils.EmbedGenerator import EmbedGenerator url_rx = re.compile(r"https?://(?:www\.)?.+") @@ -69,10 +75,7 @@ class LavalinkVoiceClient(discord.VoiceClient): self.cleanup() -class Music(commands.Cog): - def __init__(self, bot: ChristmasBot): - self.bot = bot - +class Music(BaseCog): @commands.Cog.listener() async def on_ready(self): if not hasattr( @@ -96,7 +99,7 @@ class Music(commands.Cog): for guild_id, (voicechannel_id, textchannel_id) in redis_result.items(): player = self.bot.lavalink.player_manager.create(guild_id) - player.store('channel', textchannel_id) + player.store("channel", textchannel_id) voice_channel = await self.bot.fetch_channel(voicechannel_id) await voice_channel.connect(cls=LavalinkVoiceClient) if not player.is_playing: @@ -109,16 +112,10 @@ class Music(commands.Cog): await textchannel.send("Automatically joined the voice channel") async def fill_player_queue(self, player: DefaultPlayer, buffer: Optional[int] = 1): - pipeline = self.bot._redis_client.pipeline() - for _ in range(buffer): - pipeline.randomkey() - - queries = await pipeline.execute() - print(queries) + queries = await Playlist.random(self.bot._redis_client, buffer) # Get the results for the query from Lavalink. for query in queries: result = await player.node.get_tracks(query) - print(result) if not result or not result["tracks"]: continue @@ -127,6 +124,26 @@ class Music(commands.Cog): ) player.add(requester=self.bot.user.id, track=track) + async def create_track_embed(self, track: AudioTrack) -> Embed: + embed_color = self.bot.colors["embed"] + embed = discord.Embed( + title=f"Now playing...", + colour=embed_color, + ) + embed.description = f"[{track.title}]({track.uri})" + embed.set_thumbnail( + url=f"https://i3.ytimg.com/vi/{track.identifier}/mqdefault.jpg" + ) + + try: + duration = str(datetime.timedelta(milliseconds=int(track.duration))) + except OverflowError: + duration = "🔴 LIVE" + + embed.add_field(name="Duration", value=duration) + embed.add_field(name="Author", value=track.author) + return embed + def cog_unload(self): """Cog unload handler. This removes any event hooks that were registered.""" self.bot.lavalink._event_hooks.clear() @@ -147,13 +164,15 @@ class Music(commands.Cog): return guild_check - async def cog_command_error(self, ctx, error): + async def cog_command_error(self, ctx: CustomContext, error: CommandError): if isinstance(error, commands.CommandInvokeError): await ctx.send(error.original) # The above handles errors thrown in this cog and shows them to the user. # This shouldn't be a problem as the only errors thrown in this cog are from `ensure_voice` # which contain a reason string, such as "Join a voicechannel" etc. You can modify the above # if you want to do things differently. + elif isinstance(error, EmbeddedCommandException): + await error.send(ctx) async def ensure_voice(self, ctx): """This check ensures that the bot and command author are in the same voicechannel.""" @@ -178,7 +197,14 @@ class Music(commands.Cog): if not player.is_connected: if not should_connect: - raise commands.CommandInvokeError("Not connected.") + bot_name = self.bot.config["info"]["name"] + embed = await EmbedGenerator.Message( + ctx, + f"{bot_name} is not connected", + "However you can start playing music using `/connect`", + no_send=True, + ) + raise EmbeddedCommandException(embed) permissions = ctx.author.voice.channel.permissions_for(ctx.me) @@ -206,68 +232,78 @@ class Music(commands.Cog): elif isinstance(event, lavalink.events.TrackStartEvent): channel_id = int(event.player.fetch("channel")) channel: TextChannel = self.bot.get_channel(channel_id) - - color = self.bot.colors["embed"] - current_track: AudioTrack = event.player.current - embed = Embed( - title="Now playing:", - description=f"[{current_track.title}]({current_track.uri})", - color=color, - ) + embed = await self.create_track_embed(event.player.current) await channel.send(embed=embed) elif isinstance(event, lavalink.events.TrackEndEvent): await self.fill_player_queue(event.player, 1) @commands.command(name="connect", aliases=["p", "play", "join"]) async def play(self, ctx: CustomContext): - """Starts playing Christmas bangers""" + """Start the radio""" # Get the player for this guild from cache. - player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id) - await self.fill_player_queue(player, self.bot.config["queue_buffer_size"]) + if ctx.player.is_connected: + await ctx.send("Already connected") + return - if not player.is_playing: - await player.play() + await self.fill_player_queue( + ctx.player, self.bot.config["queue_buffer_size"] + 1 + ) - await ctx.send("Started playing") + if not ctx.player.is_playing: + await ctx.player.play() + + await EmbedGenerator.Title(ctx, "*⃣ | Connected.") + return @commands.command(name="skip", aliases=["next"]) - async def skip(self, ctx: Context): - """I heard this song way too often""" - player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id) - await player.skip() + async def skip(self, ctx: CustomContext): + """Skip the current song""" + await ctx.player.skip() await ctx.send("Skipped current song") @commands.command(name="queue") - async def queue(self, ctx: Context): - """Ghetto queue""" - player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id) - await EmbedGenerator.Message(ctx, "Queue:", player.queue) + async def queue(self, ctx: CustomContext): + """Display the current radio queue""" + embed_color = self.bot.colors["embed"] + embed = Embed(title="Coming Up...", colour=embed_color) + + if len(ctx.player.queue) > 0: + embed.description = "\n".join( + f"{index}. [{track.title}]({track.uri})" + for index, track in enumerate(ctx.player.queue, 1) + ) + else: + embed.description = "We are still determining a playlist" + + await ctx.send(embed=embed) @commands.command(name="disconnect", aliases=["dc", "stop"]) - async def disconnect(self, ctx: Context): - """Disconnects ChristmasBot""" - player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id) - - if not player.is_connected: - return await EmbedGenerator.Title(ctx, "Not connected.") - + async def disconnect(self, ctx: CustomContext): + """Disconnects the radio from the channel""" if not ctx.author.voice or ( - player.is_connected - and ctx.author.voice.channel.id != int(player.channel_id) + ctx.player.is_connected + and ctx.author.voice.channel.id != int(ctx.player.channel_id) ): # Abuse prevention. Users not in voice channels, or not in the same voice channel as the bot # may not disconnect the bot. - return await EmbedGenerator.Title(ctx, "You're not in my voicechannel!") + await EmbedGenerator.Title(ctx, "You're not in my voicechannel!") + return # Clear the queue to ensure old tracks don't start playing # when someone else queues something. - player.queue.clear() + ctx.player.queue.clear() # Stop the current track so Lavalink consumes less resources. - await player.stop() + await ctx.player.stop() # Disconnect from the voice channel. await ctx.voice_client.disconnect(force=True) await EmbedGenerator.Title(ctx, "*⃣ | Disconnected.") + @commands.command(name="now") + async def now_playing(self, ctx: CustomContext): + """Displays information about the currently played track""" + embed = await self.create_track_embed(ctx.player.current) + await ctx.send(embed=embed) -def setup(bot: ChristmasBot): + +def setup(bot: TuneBot): bot.add_cog(Music(bot)) diff --git a/cogs/owner.py b/cogs/owner.py index 19742d7..65fc4c8 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -1,24 +1,24 @@ -import discord -from discord.ext import commands - -import textwrap -import io -import traceback import asyncio +import io +import textwrap import time +import traceback from asyncio.subprocess import PIPE +from contextlib import redirect_stdout from io import BytesIO from platform import python_version -from contextlib import redirect_stdout +import discord +from discord.ext import commands from discord.ext.commands.context import Context -from bot import ChristmasBot +from bot import TuneBot +from utils.classes import BaseCog -class OwnerCog(commands.Cog): - def __init__(self, bot: ChristmasBot): - self.bot = bot +class OwnerCog(BaseCog): + def __init__(self, bot: TuneBot): + super().__init__(bot) self._last_result = None @staticmethod @@ -209,5 +209,5 @@ class OwnerCog(commands.Cog): await message.edit(content=f"```fix\n{content}\n```") -def setup(bot: ChristmasBot): +def setup(bot: TuneBot): bot.add_cog(OwnerCog(bot)) diff --git a/cogs/settings.py b/cogs/settings.py index 29f3285..fee02a4 100644 --- a/cogs/settings.py +++ b/cogs/settings.py @@ -1,18 +1,21 @@ -from context import CustomContext from discord.ext import commands from utils.EmbedGenerator import EmbedGenerator +from utils.classes import BaseCog from utils.database import AutoJoin -from bot import ChristmasBot +from bot import TuneBot from discord.ext.commands import Context +from bot import TuneBot +from context import CustomContext +from utils.database import AutoJoin +from utils.EmbedGenerator import EmbedGenerator -class SettingsCog(commands.Cog, name="Settings"): - def __init__(self, bot: ChristmasBot): - self.bot = bot +class SettingsCog(BaseCog, name="Settings"): @commands.group(aliases=["aj"], invoke_without_command=True) @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) async def autojoin(self, ctx: CustomContext): + """Enable/Disable the bot automatically joining""" await EmbedGenerator.Message( ctx, "Autojoin", @@ -23,19 +26,22 @@ class SettingsCog(commands.Cog, name="Settings"): @commands.has_permissions(manage_channels=True) @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) async def autojoin_set(self, ctx: CustomContext): + """Enable the bot automatically joining""" voicechannel_id = ctx.author.voice.channel.id textchannel_id = ctx.message.channel.id - await AutoJoin.update_channel(ctx.get_redis(), ctx.guild.id, voicechannel_id, textchannel_id) + await AutoJoin.update_channel( + ctx.redis, ctx.guild.id, voicechannel_id, textchannel_id + ) await EmbedGenerator.Message(ctx, "Autojoin", "`enabled`") @autojoin.command(name="disable") @commands.has_permissions(manage_channels=True) @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) async def autojoin_del(self, ctx: CustomContext): - vc = ctx.author.voice.channel - await AutoJoin.del_channel(ctx.get_redis(), ctx.guild.id) + """Disable the bot automatically joining""" + await AutoJoin.del_channel(ctx.redis, ctx.guild.id) await EmbedGenerator.Message(ctx, "Autojoin", "`disabled`") -def setup(bot: ChristmasBot): +def setup(bot: TuneBot): bot.add_cog(SettingsCog(bot)) diff --git a/config.json.sample b/config.json.sample index 022f86f..34e2c81 100644 --- a/config.json.sample +++ b/config.json.sample @@ -3,6 +3,7 @@ "owner_ids": [194545408960102400, 190875175460405249], "prefixes": ["ck!"], "redis_url": "", + "redis_prefix": "", "lavalink": { "host": "", "port": 2333, @@ -19,5 +20,6 @@ }, "cogs": ["cogs.owner", "cogs.settings", "cogs.information", "cogs.music"], "slash_command_guilds": [], - "queue_buffer_size": 5 + "queue_buffer_size": 5, + "slash_descriptions": {} } diff --git a/context.py b/context.py index c518260..3f41dc7 100644 --- a/context.py +++ b/context.py @@ -1,7 +1,17 @@ from aioredis.client import Redis from discord.ext import commands +from discord.ext.commands.errors import CommandInvokeError +from lavalink.models import DefaultPlayer class CustomContext(commands.Context): - def get_redis(self) -> Redis: + @property + def redis(self) -> Redis: return self.bot._redis_client + + @property + def player(self) -> DefaultPlayer: + if hasattr(self.bot, "lavalink"): + return self.bot.lavalink.player_manager.get(self.guild.id) + + raise CommandInvokeError("Lavalink is still starting up.") diff --git a/poetry.lock b/poetry.lock index 65e1d52..fa3984f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -65,9 +65,21 @@ docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] +[[package]] +name = "backports.entry-points-selectable" +version = "1.1.0" +description = "Compatibility shim providing selectable entry points for older implementations" +category = "dev" +optional = false +python-versions = ">=2.7" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=4.6)", "pytest-flake8", "pytest-cov", "pytest-black (>=0.3.7)", "pytest-mypy", "pytest-checkdocs (>=2.4)", "pytest-enabler (>=1.0.1)"] + [[package]] name = "black" -version = "21.9b0" +version = "21.10b0" description = "The uncompromising code formatter." category = "dev" optional = false @@ -87,9 +99,9 @@ typing-extensions = [ [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.6.0)", "aiohttp-cors (>=0.4.0)"] +d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -python2 = ["typed-ast (>=1.4.2)"] +python2 = ["typed-ast (>=1.4.3)"] uvloop = ["uvloop (>=0.15.2)"] [[package]] @@ -111,6 +123,14 @@ python-versions = "*" [package.dependencies] pycparser = "*" +[[package]] +name = "cfgv" +version = "3.3.1" +description = "Validate configuration and produce human readable error messages." +category = "dev" +optional = false +python-versions = ">=3.6.1" + [[package]] name = "chardet" version = "3.0.4" @@ -174,6 +194,26 @@ url = "https://github.com/iDevision/enhanced-discord.py" reference = "2.0" resolved_reference = "d2adc6c05fafa761f7b8005ba8469ef4b78c188a" +[[package]] +name = "distlib" +version = "0.3.3" +description = "Distribution utilities" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "filelock" +version = "3.3.2" +description = "A platform independent file lock." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.extras] +docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"] +testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"] + [[package]] name = "humanize" version = "3.12.0" @@ -185,6 +225,17 @@ python-versions = ">=3.6" [package.extras] tests = ["freezegun", "pytest", "pytest-cov"] +[[package]] +name = "identify" +version = "2.3.4" +description = "File identification library for Python" +category = "dev" +optional = false +python-versions = ">=3.6.1" + +[package.extras] +license = ["editdistance-s"] + [[package]] name = "idna" version = "3.3" @@ -232,6 +283,14 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "nodeenv" +version = "1.6.0" +description = "Node.js virtual environment builder" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "orjson" version = "3.6.4" @@ -260,9 +319,25 @@ python-versions = ">=3.6" docs = ["Sphinx (>=4)", "furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)"] test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"] +[[package]] +name = "pre-commit" +version = "2.15.0" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +category = "dev" +optional = false +python-versions = ">=3.6.1" + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +toml = "*" +virtualenv = ">=20.0.8" + [[package]] name = "pycparser" -version = "2.20" +version = "2.21" description = "C parser in Python" category = "main" optional = false @@ -300,6 +375,14 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "pyyaml" +version = "6.0" +description = "YAML parser and emitter for Python" +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "redis" version = "3.5.3" @@ -313,7 +396,7 @@ hiredis = ["hiredis (>=0.1.3)"] [[package]] name = "regex" -version = "2021.10.23" +version = "2021.11.2" description = "Alternative regular expression module, to replace re." category = "dev" optional = false @@ -345,6 +428,14 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + [[package]] name = "tomli" version = "1.2.2" @@ -395,6 +486,25 @@ category = "dev" optional = false python-versions = ">=3.7" +[[package]] +name = "virtualenv" +version = "20.10.0" +description = "Virtual Python Environment builder" +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[package.dependencies] +"backports.entry-points-selectable" = ">=1.0.4" +distlib = ">=0.3.1,<1" +filelock = ">=3.2,<4" +platformdirs = ">=2,<3" +six = ">=1.9.0,<2" + +[package.extras] +docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] +testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)"] + [[package]] name = "yarl" version = "1.5.1" @@ -423,7 +533,7 @@ websockets = "*" [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "0e78d19b9875bec8a31462511de0c039309fd8962347bee2da9c79c565dbe39c" +content-hash = "87b61ad577bb9413177b2749b0c4b30026aa512bf3a6eb62e74c0ef7e2470ed4" [metadata.files] aiohttp = [ @@ -457,9 +567,13 @@ attrs = [ {file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"}, {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, ] +"backports.entry-points-selectable" = [ + {file = "backports.entry_points_selectable-1.1.0-py2.py3-none-any.whl", hash = "sha256:a6d9a871cde5e15b4c4a53e3d43ba890cc6861ec1332c9c2428c92f977192acc"}, + {file = "backports.entry_points_selectable-1.1.0.tar.gz", hash = "sha256:988468260ec1c196dab6ae1149260e2f5472c9110334e5d51adcb77867361f6a"}, +] black = [ - {file = "black-21.9b0-py3-none-any.whl", hash = "sha256:380f1b5da05e5a1429225676655dddb96f5ae8c75bdf91e53d798871b902a115"}, - {file = "black-21.9b0.tar.gz", hash = "sha256:7de4cfc7eb6b710de325712d40125689101d21d25283eed7e9998722cf10eb91"}, + {file = "black-21.10b0-py3-none-any.whl", hash = "sha256:6eb7448da9143ee65b856a5f3676b7dda98ad9abe0f87fce8c59291f15e82a5b"}, + {file = "black-21.10b0.tar.gz", hash = "sha256:a9952229092e325fe5f3dae56d81f639b23f7131eb840781947e4b2886030f33"}, ] certifi = [ {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, @@ -517,6 +631,10 @@ cffi = [ {file = "cffi-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:3773c4d81e6e818df2efbc7dd77325ca0dcb688116050fb2b3011218eda36139"}, {file = "cffi-1.15.0.tar.gz", hash = "sha256:920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954"}, ] +cfgv = [ + {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, + {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, +] chardet = [ {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, @@ -534,10 +652,22 @@ colorama = [ {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, ] "discord.py" = [] +distlib = [ + {file = "distlib-0.3.3-py2.py3-none-any.whl", hash = "sha256:c8b54e8454e5bf6237cc84c20e8264c3e991e824ef27e8f1e81049867d861e31"}, + {file = "distlib-0.3.3.zip", hash = "sha256:d982d0751ff6eaaab5e2ec8e691d949ee80eddf01a62eaa96ddb11531fe16b05"}, +] +filelock = [ + {file = "filelock-3.3.2-py3-none-any.whl", hash = "sha256:bb2a1c717df74c48a2d00ed625e5a66f8572a3a30baacb7657add1d7bac4097b"}, + {file = "filelock-3.3.2.tar.gz", hash = "sha256:7afc856f74fa7006a289fd10fa840e1eebd8bbff6bffb69c26c54a0512ea8cf8"}, +] humanize = [ {file = "humanize-3.12.0-py3-none-any.whl", hash = "sha256:4c71c4381f0209715cd993058e717c1b74d58ae2f8c6da7bdb59ab66473b9ab0"}, {file = "humanize-3.12.0.tar.gz", hash = "sha256:5ec1a66e230a3e31fb3f184aab9436ea13d4e37c168e0ffc345ae5bb57e58be6"}, ] +identify = [ + {file = "identify-2.3.4-py2.py3-none-any.whl", hash = "sha256:4de55a93e0ba72bf917c840b3794eb1055a67272a1732351c557c88ec42011b1"}, + {file = "identify-2.3.4.tar.gz", hash = "sha256:595283a1c3a078ac5774ad4dc4d1bdd0c1602f60bcf11ae673b64cb2b1945762"}, +] idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, @@ -572,6 +702,10 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] +nodeenv = [ + {file = "nodeenv-1.6.0-py2.py3-none-any.whl", hash = "sha256:621e6b7076565ddcacd2db0294c0381e01fd28945ab36bcf00f41c5daf63bef7"}, + {file = "nodeenv-1.6.0.tar.gz", hash = "sha256:3ef13ff90291ba2a4a7a4ff9a979b63ffdd00a464dbe04acf0ea6471517a4c2b"}, +] orjson = [ {file = "orjson-3.6.4-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:fc01a15f3101628fd619158daec79b30d7461149735e73542ca8c13be6b835be"}, {file = "orjson-3.6.4-cp310-cp310-manylinux_2_24_aarch64.whl", hash = "sha256:48a69fed90f551bf9e9bb7a63e363fed4f67fc7c6e6bfb057054dc78f6721e9e"}, @@ -605,9 +739,13 @@ platformdirs = [ {file = "platformdirs-2.4.0-py3-none-any.whl", hash = "sha256:8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d"}, {file = "platformdirs-2.4.0.tar.gz", hash = "sha256:367a5e80b3d04d2428ffa76d33f124cf11e8fff2acdaa9b43d545f5c7d661ef2"}, ] +pre-commit = [ + {file = "pre_commit-2.15.0-py2.py3-none-any.whl", hash = "sha256:a4ed01000afcb484d9eb8d504272e642c4c4099bbad3a6b27e519bd6a3e928a6"}, + {file = "pre_commit-2.15.0.tar.gz", hash = "sha256:3c25add78dbdfb6a28a651780d5c311ac40dd17f160eb3954a0c59da40a505a7"}, +] pycparser = [ - {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"}, - {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"}, + {file = "pycparser-2.21-py2.py3-none-any.whl", hash = "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9"}, + {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, ] pycryptodomex = [ {file = "pycryptodomex-3.11.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:7abfd84a362e4411f7c5f5758c18cbf377a2a2be64b9232e78544d75640c677e"}, @@ -665,47 +803,95 @@ pytube = [ {file = "pytube-11.0.1-py3-none-any.whl", hash = "sha256:d4dfea7394d7662edac3831432b349b2afac984e0d0bc4bdb611ec1f3fc16318"}, {file = "pytube-11.0.1.tar.gz", hash = "sha256:47643a6ff553cbc4d6be748ff14c9c45f79984e15005adff25d62b18110abe43"}, ] +pyyaml = [ + {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, + {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, + {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, + {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, + {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"}, + {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"}, + {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"}, + {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"}, + {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"}, + {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"}, + {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"}, + {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"}, + {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"}, + {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"}, + {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, + {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, +] redis = [ {file = "redis-3.5.3-py2.py3-none-any.whl", hash = "sha256:432b788c4530cfe16d8d943a09d40ca6c16149727e4afe8c2c9d5580c59d9f24"}, {file = "redis-3.5.3.tar.gz", hash = "sha256:0e7e0cfca8660dea8b7d5cd8c4f6c5e29e11f31158c0b0ae91a397f00e5a05a2"}, ] regex = [ - {file = "regex-2021.10.23-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:45b65d6a275a478ac2cbd7fdbf7cc93c1982d613de4574b56fd6972ceadb8395"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:74d071dbe4b53c602edd87a7476ab23015a991374ddb228d941929ad7c8c922e"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:34d870f9f27f2161709054d73646fc9aca49480617a65533fc2b4611c518e455"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fb698037c35109d3c2e30f2beb499e5ebae6e4bb8ff2e60c50b9a805a716f79"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cb46b542133999580ffb691baf67410306833ee1e4f58ed06b6a7aaf4e046952"}, - {file = "regex-2021.10.23-cp310-cp310-win32.whl", hash = "sha256:5e9c9e0ce92f27cef79e28e877c6b6988c48b16942258f3bc55d39b5f911df4f"}, - {file = "regex-2021.10.23-cp310-cp310-win_amd64.whl", hash = "sha256:ab7c5684ff3538b67df3f93d66bd3369b749087871ae3786e70ef39e601345b0"}, - {file = "regex-2021.10.23-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:de557502c3bec8e634246588a94e82f1ee1b9dfcfdc453267c4fb652ff531570"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee684f139c91e69fe09b8e83d18b4d63bf87d9440c1eb2eeb52ee851883b1b29"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5095a411c8479e715784a0c9236568ae72509450ee2226b649083730f3fadfc6"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b568809dca44cb75c8ebb260844ea98252c8c88396f9d203f5094e50a70355f"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:eb672217f7bd640411cfc69756ce721d00ae600814708d35c930930f18e8029f"}, - {file = "regex-2021.10.23-cp36-cp36m-win32.whl", hash = "sha256:a7a986c45d1099a5de766a15de7bee3840b1e0e1a344430926af08e5297cf666"}, - {file = "regex-2021.10.23-cp36-cp36m-win_amd64.whl", hash = "sha256:6d7722136c6ed75caf84e1788df36397efdc5dbadab95e59c2bba82d4d808a4c"}, - {file = "regex-2021.10.23-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:9f665677e46c5a4d288ece12fdedf4f4204a422bb28ff05f0e6b08b7447796d1"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:450dc27483548214314640c89a0f275dbc557968ed088da40bde7ef8fb52829e"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:129472cd06062fb13e7b4670a102951a3e655e9b91634432cfbdb7810af9d710"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a940ca7e7189d23da2bfbb38973832813eab6bd83f3bf89a977668c2f813deae"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:530fc2bbb3dc1ebb17f70f7b234f90a1dd43b1b489ea38cea7be95fb21cdb5c7"}, - {file = "regex-2021.10.23-cp37-cp37m-win32.whl", hash = "sha256:ded0c4a3eee56b57fcb2315e40812b173cafe79d2f992d50015f4387445737fa"}, - {file = "regex-2021.10.23-cp37-cp37m-win_amd64.whl", hash = "sha256:391703a2abf8013d95bae39145d26b4e21531ab82e22f26cd3a181ee2644c234"}, - {file = "regex-2021.10.23-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be04739a27be55631069b348dda0c81d8ea9822b5da10b8019b789e42d1fe452"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13ec99df95003f56edcd307db44f06fbeb708c4ccdcf940478067dd62353181e"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:8d1cdcda6bd16268316d5db1038965acf948f2a6f43acc2e0b1641ceab443623"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c186691a7995ef1db61205e00545bf161fb7b59cdb8c1201c89b333141c438a"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:2b20f544cbbeffe171911f6ce90388ad36fe3fad26b7c7a35d4762817e9ea69c"}, - {file = "regex-2021.10.23-cp38-cp38-win32.whl", hash = "sha256:c0938ddd60cc04e8f1faf7a14a166ac939aac703745bfcd8e8f20322a7373019"}, - {file = "regex-2021.10.23-cp38-cp38-win_amd64.whl", hash = "sha256:56f0c81c44638dfd0e2367df1a331b4ddf2e771366c4b9c5d9a473de75e3e1c7"}, - {file = "regex-2021.10.23-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:80bb5d2e92b2258188e7dcae5b188c7bf868eafdf800ea6edd0fbfc029984a88"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1dae12321b31059a1a72aaa0e6ba30156fe7e633355e445451e4021b8e122b6"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1f2b59c28afc53973d22e7bc18428721ee8ca6079becf1b36571c42627321c65"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d134757a37d8640f3c0abb41f5e68b7cf66c644f54ef1cb0573b7ea1c63e1509"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:0dcc0e71118be8c69252c207630faf13ca5e1b8583d57012aae191e7d6d28b84"}, - {file = "regex-2021.10.23-cp39-cp39-win32.whl", hash = "sha256:a30513828180264294953cecd942202dfda64e85195ae36c265daf4052af0464"}, - {file = "regex-2021.10.23-cp39-cp39-win_amd64.whl", hash = "sha256:0f7552429dd39f70057ac5d0e897e5bfe211629652399a21671e53f2a9693a4e"}, - {file = "regex-2021.10.23.tar.gz", hash = "sha256:f3f9a91d3cc5e5b0ddf1043c0ae5fa4852f18a1c0050318baf5fc7930ecc1f9c"}, + {file = "regex-2021.11.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:897c539f0f3b2c3a715be651322bef2167de1cdc276b3f370ae81a3bda62df71"}, + {file = "regex-2021.11.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:886f459db10c0f9d17c87d6594e77be915f18d343ee138e68d259eb385f044a8"}, + {file = "regex-2021.11.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:075b0fdbaea81afcac5a39a0d1bb91de887dd0d93bf692a5dd69c430e7fc58cb"}, + {file = "regex-2021.11.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c6238d30dcff141de076344cf7f52468de61729c2f70d776fce12f55fe8df790"}, + {file = "regex-2021.11.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7fab29411d75c2eb48070020a40f80255936d7c31357b086e5931c107d48306e"}, + {file = "regex-2021.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0148988af0182a0a4e5020e7c168014f2c55a16d11179610f7883dd48ac0ebe"}, + {file = "regex-2021.11.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be30cd315db0168063a1755fa20a31119da91afa51da2907553493516e165640"}, + {file = "regex-2021.11.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:e9cec3a62d146e8e122d159ab93ac32c988e2ec0dcb1e18e9e53ff2da4fbd30c"}, + {file = "regex-2021.11.2-cp310-cp310-win32.whl", hash = "sha256:41c66bd6750237a8ed23028a6c9173dc0c92dc24c473e771d3bfb9ee817700c3"}, + {file = "regex-2021.11.2-cp310-cp310-win_amd64.whl", hash = "sha256:0075fe4e2c2720a685fef0f863edd67740ff78c342cf20b2a79bc19388edf5db"}, + {file = "regex-2021.11.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:0ed3465acf8c7c10aa2e0f3d9671da410ead63b38a77283ef464cbb64275df58"}, + {file = "regex-2021.11.2-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ab1fea8832976ad0bebb11f652b692c328043057d35e9ebc78ab0a7a30cf9a70"}, + {file = "regex-2021.11.2-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cb1e44d860345ab5d4f533b6c37565a22f403277f44c4d2d5e06c325da959883"}, + {file = "regex-2021.11.2-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9486ebda015913909bc28763c6b92fcc3b5e5a67dee4674bceed112109f5dfb8"}, + {file = "regex-2021.11.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20605bfad484e1341b2cbfea0708e4b211d233716604846baa54b94821f487cb"}, + {file = "regex-2021.11.2-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f20f9f430c33597887ba9bd76635476928e76cad2981643ca8be277b8e97aa96"}, + {file = "regex-2021.11.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1d85ca137756d62c8138c971453cafe64741adad1f6a7e63a22a5a8abdbd19fa"}, + {file = "regex-2021.11.2-cp36-cp36m-win32.whl", hash = "sha256:af23b9ca9a874ef0ec20e44467b8edd556c37b0f46f93abfa93752ea7c0e8d1e"}, + {file = "regex-2021.11.2-cp36-cp36m-win_amd64.whl", hash = "sha256:070336382ca92c16c45b4066c4ba9fa83fb0bd13d5553a82e07d344df8d58a84"}, + {file = "regex-2021.11.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:ef4e53e2fdc997d91f5b682f81f7dc9661db9a437acce28745d765d251902d85"}, + {file = "regex-2021.11.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:35ed5714467fc606551db26f80ee5d6aa1f01185586a7bccd96f179c4b974a11"}, + {file = "regex-2021.11.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7ee36d5113b6506b97f45f2e8447cb9af146e60e3f527d93013d19f6d0405f3b"}, + {file = "regex-2021.11.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4fba661a4966adbd2c3c08d3caad6822ecb6878f5456588e2475ae23a6e47929"}, + {file = "regex-2021.11.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77f9d16f7970791f17ecce7e7f101548314ed1ee2583d4268601f30af3170856"}, + {file = "regex-2021.11.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f6a28e87ba69f3a4f30d775b179aac55be1ce59f55799328a0d9b6df8f16b39d"}, + {file = "regex-2021.11.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:9267e4fba27e6dd1008c4f2983cc548c98b4be4444e3e342db11296c0f45512f"}, + {file = "regex-2021.11.2-cp37-cp37m-win32.whl", hash = "sha256:d4bfe3bc3976ccaeb4ae32f51e631964e2f0e85b2b752721b7a02de5ce3b7f27"}, + {file = "regex-2021.11.2-cp37-cp37m-win_amd64.whl", hash = "sha256:2bb7cae741de1aa03e3dd3a7d98c304871eb155921ca1f0d7cc11f5aade913fd"}, + {file = "regex-2021.11.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:23f93e74409c210de4de270d4bf88fb8ab736a7400f74210df63a93728cf70d6"}, + {file = "regex-2021.11.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d8ee91e1c295beb5c132ebd78616814de26fedba6aa8687ea460c7f5eb289b72"}, + {file = "regex-2021.11.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e3ff69ab203b54ce5c480c3ccbe959394ea5beef6bd5ad1785457df7acea92e"}, + {file = "regex-2021.11.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e3c00cb5c71da655e1e5161481455479b613d500dd1bd252aa01df4f037c641f"}, + {file = "regex-2021.11.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4abf35e16f4b639daaf05a2602c1b1d47370e01babf9821306aa138924e3fe92"}, + {file = "regex-2021.11.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb11c982a849dc22782210b01d0c1b98eb3696ce655d58a54180774e4880ac66"}, + {file = "regex-2021.11.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07e3755e0f070bc31567dfe447a02011bfa8444239b3e9e5cca6773a22133839"}, + {file = "regex-2021.11.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:0621c90f28d17260b41838b22c81a79ff436141b322960eb49c7b3f91d1cbab6"}, + {file = "regex-2021.11.2-cp38-cp38-win32.whl", hash = "sha256:8fbe1768feafd3d0156556677b8ff234c7bf94a8110e906b2d73506f577a3269"}, + {file = "regex-2021.11.2-cp38-cp38-win_amd64.whl", hash = "sha256:f9ee98d658a146cb6507be720a0ce1b44f2abef8fb43c2859791d91aace17cd5"}, + {file = "regex-2021.11.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b3794cea825f101fe0df9af8a00f9fad8e119c91e39a28636b95ee2b45b6c2e5"}, + {file = "regex-2021.11.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3576e173e7b4f88f683b4de7db0c2af1b209bb48b2bf1c827a6f3564fad59a97"}, + {file = "regex-2021.11.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48b4f4810117a9072a5aa70f7fea5f86fa9efbe9a798312e0a05044bd707cc33"}, + {file = "regex-2021.11.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f5930d334c2f607711d54761956aedf8137f83f1b764b9640be21d25a976f3a4"}, + {file = "regex-2021.11.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:956187ff49db7014ceb31e88fcacf4cf63371e6e44d209cf8816cd4a2d61e11a"}, + {file = "regex-2021.11.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17e095f7f96a4b9f24b93c2c915f31a5201a6316618d919b0593afb070a5270e"}, + {file = "regex-2021.11.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a56735c35a3704603d9d7b243ee06139f0837bcac2171d9ba1d638ce1df0742a"}, + {file = "regex-2021.11.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:adf35d88d9cffc202e6046e4c32e1e11a1d0238b2fcf095c94f109e510ececea"}, + {file = "regex-2021.11.2-cp39-cp39-win32.whl", hash = "sha256:30fe317332de0e50195665bc61a27d46e903d682f94042c36b3f88cb84bd7958"}, + {file = "regex-2021.11.2-cp39-cp39-win_amd64.whl", hash = "sha256:85289c25f658e3260b00178757c87f033f3d4b3e40aa4abdd4dc875ff11a94fb"}, + {file = "regex-2021.11.2.tar.gz", hash = "sha256:5e85dcfc5d0f374955015ae12c08365b565c6f1eaf36dd182476a4d8e5a1cdb7"}, ] requests = [ {file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"}, @@ -715,6 +901,10 @@ six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] tomli = [ {file = "tomli-1.2.2-py3-none-any.whl", hash = "sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade"}, {file = "tomli-1.2.2.tar.gz", hash = "sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee"}, @@ -773,6 +963,10 @@ websockets = [ {file = "websockets-10.0-cp39-cp39-win_amd64.whl", hash = "sha256:c5880442f5fc268f1ef6d37b2c152c114deccca73f48e3a8c48004d2f16f4567"}, {file = "websockets-10.0.tar.gz", hash = "sha256:c4fc9a1d242317892590abe5b61a9127f1a61740477bfb121743f290b8054002"}, ] +virtualenv = [ + {file = "virtualenv-20.10.0-py2.py3-none-any.whl", hash = "sha256:4b02e52a624336eece99c96e3ab7111f469c24ba226a53ec474e8e787b365814"}, + {file = "virtualenv-20.10.0.tar.gz", hash = "sha256:576d05b46eace16a9c348085f7d0dc8ef28713a2cabaa1cf0aea41e8f12c9218"}, +] yarl = [ {file = "yarl-1.5.1-cp35-cp35m-macosx_10_14_x86_64.whl", hash = "sha256:db6db0f45d2c63ddb1a9d18d1b9b22f308e52c83638c26b422d520a815c4b3fb"}, {file = "yarl-1.5.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:17668ec6722b1b7a3a05cc0167659f6c95b436d25a36c2d52db0eca7d3f72593"}, diff --git a/pyproject.toml b/pyproject.toml index a74ff36..d4638cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] -name = "christmasbot" -version = "0.1.0" -description = "" -authors = ["Your Name "] +name = "tunebot" +version = "1.0.0" +description = "A very configurable Discord radio" +authors = ["StrNophix ", "Matthww "] license = "GPL-v3.0" [tool.poetry.dependencies] @@ -19,6 +19,7 @@ redis = "^3.5.3" aiotube = "^1.3.5" requests = "^2.26.0" yt-dlp = "^2021.10.22" +pre-commit = "^2.15.0" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/utils/EmbedGenerator.py b/utils/EmbedGenerator.py index aebf5cd..95cf8c0 100644 --- a/utils/EmbedGenerator.py +++ b/utils/EmbedGenerator.py @@ -1,8 +1,8 @@ -from typing import Optional +from typing import Optional, Union import discord -from discord import Embed from discord.ext.commands import Context +from discord import Embed class EmbedGenerator: @@ -13,7 +13,9 @@ class EmbedGenerator: return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs) @staticmethod - async def Message(ctx: Context, title: str, message: Optional[str] = "", **kwargs): + async def Message( + ctx: Context, title: str, message: Optional[str] = "", **kwargs + ) -> Embed: color = ctx.bot.colors["embed"] em = Embed(title=title, description=message, color=color) return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs) @@ -21,22 +23,24 @@ class EmbedGenerator: @staticmethod async def Image( ctx: Context, title: str, url: str, message: Optional[str] = "", **kwargs - ): + ) -> Embed: color = ctx.bot.colors["embed"] em = Embed(title=title, description=message, url=url, color=color) em.set_image(url=url) return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs) @staticmethod - async def Title(ctx: Context, title: str, **kwargs): + async def Title(ctx: Context, title: str, **kwargs) -> Embed: color = ctx.bot.colors["embed"] em = Embed(title=title, color=color) return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs) @staticmethod - async def SendWithFooter(ctx: Context, em: Embed, **kwargs) -> discord.Message: + async def SendWithFooter( + ctx: Context, em: Embed, **kwargs + ) -> Union[discord.Message, Embed]: avatar = ctx.author.avatar.with_static_format("jpeg") em.set_footer(text=f"Requested by: {ctx.author}", icon_url=avatar) if kwargs.get("no_send", False): return em - return await ctx.send(embed=em, **kwargs) \ No newline at end of file + return await ctx.send(embed=em, **kwargs) diff --git a/utils/classes.py b/utils/classes.py new file mode 100644 index 0000000..5c90b02 --- /dev/null +++ b/utils/classes.py @@ -0,0 +1,13 @@ +from typing import Dict +from discord.ext.commands import Cog +from bot import TuneBot + + +class BaseCog(Cog): + def __init__(self, bot: TuneBot) -> None: + self.bot = bot + + slash_descriptions: Dict[str, str] = self.bot.config["slash_descriptions"] + for command in self.walk_commands(): + if brief := slash_descriptions.get(command.qualified_name): + command.brief = brief diff --git a/utils/database.py b/utils/database.py index 824020a..0d48ec6 100644 --- a/utils/database.py +++ b/utils/database.py @@ -1,20 +1,35 @@ +from typing import Dict +from typing import List +from typing import Optional + from aioredis import Redis -from typing import Sequence + +from bot import redis_prefix class AutoJoin: @staticmethod - async def get_channels(redis: Redis) -> Sequence[tuple]: + async def get_channels(redis: Redis) -> Dict[str, str]: # return all channels - channels = await redis.hgetall(name="autojoin") + channels = await redis.hgetall(f"{redis_prefix}:autojoin") return {key: value.split("-") for key, value in channels.items()} @staticmethod - async def update_channel(redis: Redis, guild_id, voicechannel_id, textchannel_id): + async def update_channel( + redis: Redis, guild_id: int, voice_channel_id: int, text_channel_id: int + ): await redis.hset( - name="autojoin", key=guild_id, value=f"{voicechannel_id}-{textchannel_id}" + f"{redis_prefix}:autojoin", + guild_id, + f"{voice_channel_id}-{text_channel_id}", ) @staticmethod - async def del_channel(redis: Redis, guild_id): - await redis.hdel("autojoin", guild_id) + async def del_channel(redis: Redis, guild_id: int): + await redis.hdel(f"{redis_prefix}:autojoin", guild_id) + + +class Playlist: + @staticmethod + async def random(redis: Redis, amount: Optional[int] = 1) -> List[str]: + return await redis.srandmember(f"{redis_prefix}:playlist", amount) diff --git a/utils/exceptions.py b/utils/exceptions.py new file mode 100644 index 0000000..d807e17 --- /dev/null +++ b/utils/exceptions.py @@ -0,0 +1,11 @@ +from discord.embeds import Embed +from context import CustomContext +from discord.ext.commands import CommandError + + +class EmbeddedCommandException(CommandError): + def __init__(self, embed: Embed) -> None: + self.embed = embed + + async def send(self, ctx: CustomContext): + await ctx.send(embed=self.embed) diff --git a/utils/paginator.py b/utils/paginator.py index 55067eb..e574a93 100644 --- a/utils/paginator.py +++ b/utils/paginator.py @@ -2,7 +2,6 @@ # Modified work Copyright (c) 2017 Perry Fraser # # Licensed under the MIT License. https://opensource.org/licenses/MIT - # Stolen line for line from paginator.py in R. Danny's code # Added formatting and lots of blocking of inspections import asyncio