diff --git a/DockerFile b/DockerFile index 264978a..c4b47a9 100644 --- a/DockerFile +++ b/DockerFile @@ -1,11 +1,12 @@ -FROM python:3-alpine +FROM python:3.11.4-alpine COPY requirements.txt /bot/ WORKDIR /bot RUN apk add --no-cache --virtual deps gcc musl-dev libffi-dev g++ git && \ - pip3 install pip --no-cache-dir --upgrade && pip3 install setuptools wheel --no-cache-dir --upgrade && \ - pip3 install -r requirements.txt --upgrade + pip install pip --no-cache-dir --upgrade && \ + pip install setuptools wheel --no-cache-dir --upgrade && \ + MAKEFLAGS="-j $(nproc)" pip install -r requirements.txt --upgrade COPY *.py /bot/ COPY *.env /bot/ @@ -13,4 +14,4 @@ COPY *.env /bot/ ADD data /bot/data ADD cogs /bot/cogs -ENTRYPOINT ["/usr/local/bin/python3", "bot.py"] \ No newline at end of file +ENTRYPOINT ["python", "bot.py"] \ No newline at end of file diff --git a/bot.py b/bot.py index 7b98ca2..dc7f3f5 100644 --- a/bot.py +++ b/bot.py @@ -9,7 +9,16 @@ from asyncio import new_event_loop from datetime import date from itertools import chain -from logging import basicConfig, DEBUG, error, info, INFO +from logging import ( + Formatter, + StreamHandler, + basicConfig, + DEBUG, + error, + getLogger, + info, + INFO, +) from multiprocessing import Process from os import getenv, listdir, makedirs, name, path, system, remove from subprocess import PIPE, call @@ -27,7 +36,7 @@ Message, OptionType, ) -from disnake.ext.commands import Bot, Context +from disnake.ext.commands import Bot, CommandSyncFlags, Context from disnake.ext.commands.errors import ( BotMissingPermissions, BadArgument, @@ -68,13 +77,18 @@ class Omnitron(Bot): def __init__(self, **kwargs): """Initialize the bot""" super().__init__( - command_prefix=Utils.get_guild_pre or BOT_PREFIX, + command_prefix="b!", intents=self.get_intents(), help_command=None, case_insensitive=True, strip_after_prefix=True, - self_bot=False, - sync_commands_debug=True, + command_sync_flags=CommandSyncFlags( + sync_commands=True, + sync_commands_debug=getenv("ENV") == "DEVELOPMENT", + sync_global_commands=True, + sync_guild_commands=True, + sync_on_cog_actions=getenv("ENV") == "DEVELOPMENT", + ), asyncio_debug=True, test_guilds=[872500404540280893, 874311358018105385] if getenv("ENV") == "DEVELOPMENT" @@ -401,12 +415,25 @@ async def setup(self, **kwargs): basicConfig( filename=f"logs/{date.today().strftime('%d-%m-%Y_')}app.log", - filemode="w" if getenv("ENV") == "DEVELOPMENT" else "a", + filemode="w" + if getenv("ENV") == "DEVELOPMENT" + or not path.exists(f"logs/{date.today().strftime('%d-%m-%Y_')}app.log") + else "a", format="%(asctime)s - %(levelname)s - %(message)s", - datefmt="%d-%m-%y %H:%M:%S", + datefmt="%d/%m/%Y %H:%M:%S", level=DEBUG if getenv("ENV") == "DEVELOPMENT" else INFO, ) # Configure the logging + # set up logging to console + console = StreamHandler() + console.setLevel(INFO) + # set a format which is simpler for console use + formatter = Formatter( + "%(asctime)s - %(levelname)s - %(message)s", datefmt="%d/%m/%Y %H:%M:%S" + ) + console.setFormatter(formatter) + getLogger("").addHandler(console) + # system("cls" if name == "nt" else "clear") print("Omnitron is starting...") loop = new_event_loop() diff --git a/cogs/dj/play.py b/cogs/dj/play.py index 5e599a2..f2b0d94 100644 --- a/cogs/dj/play.py +++ b/cogs/dj/play.py @@ -1,4 +1,3 @@ -from asyncio import sleep from functools import wraps from inspect import Parameter from os import getenv @@ -34,7 +33,6 @@ from disnake.ext.commands.errors import MissingRequiredArgument from lavalink import add_event_hook, Client from lavalink.events import NodeConnectedEvent, QueueEndEvent, TrackEndEvent -from lavalink.exceptions import NodeException from lavalink.models import AudioTrack from bot import Omnitron @@ -250,7 +248,7 @@ async def check( player = self.bot.lavalink.player_manager.create( source.guild.id, endpoint=source.author.voice.channel.rtc_region ) - except NodeException: + except: if isinstance(source, Context): return await source.reply( f"⚠️ - {source.author.mention} - The player is not ready yet, please try again in a few seconds!", @@ -388,10 +386,7 @@ async def add_song_to_queue( yt_infos = self.ytdl.extract_info(track["info"]["uri"], download=False) except Exception as e: if not f"{e}".endswith("This video may be inappropriate for some users."): - return await source.followup.send( - f"⚠️ - {source.author.mention} - An error occurred while retrieving the video information ({track['info']['uri']}), please try again in a few moments!", - ephemeral=True, - ) + pass else: return await source.followup.send( f"⚠️ - {source.author.mention} - This video is not suitable for some users ({track['info']['uri']})! (I can't play some age restricted videos)", @@ -423,7 +418,7 @@ async def add_song_to_queue( if query and not query.startswith("ytsearch") else track["info"]["uri"] ) - duration = self.bot.utils_class.duration(track["info"]["length"] / 1000) + duration = self.bot.utils_class.duration(track["info"]["duration"] / 1000) author = track["info"]["author"] self.bot.playlists[source.guild.id].append( @@ -521,7 +516,6 @@ async def handle_play( param=Parameter(name="query", kind=Parameter.KEYWORD_ONLY) ) elif query and audio_file is None: - # Remove leading and trailing <>. <> may be used to suppress embedding links in Discord. query = query.strip("<>") @@ -624,12 +618,7 @@ async def handle_play( if ( not audio_file - and ( - not results - or results - and "exception" in results - or not results["tracks"] - ) + and (not results or not results["tracks"]) and query and query.startswith("ytsearch:") ): @@ -644,18 +633,7 @@ async def handle_play( # Results could be None if Lavalink returns an invalid response (non-JSON/non-200 (OK)). # ALternatively, results['tracks'] could be an empty array if the query yielded no tracks. - if results and "exception" in results: - if isinstance(source, Context): - return await source.reply( - f"⚠️ - {source.author.mention} - {results['exception']['message']}", - delete_after=20, - ) - else: - return await source.followup.send( - f"⚠️ - {source.author.mention} - {results['exception']['message']}", - ephemeral=True, - ) - elif not results or not results["tracks"]: + if not results or not results["tracks"]: if isinstance(source, Context): return await source.reply( f"⚠️ - {source.author.mention} - The video or playlist you are looking for does not exist!", @@ -712,8 +690,8 @@ async def handle_play( if not player.is_playing: await player.play() - if yt_infos: - colour = Colour(0xFF0000) if not spotify_track else Colour(0x1DB954) + colour = Colour(0xFF0000) if not spotify_track else Colour(0x1DB954) + if yt_infos and isinstance(yt_infos, dict): title = yt_infos["title"] url = ( yt_infos["webpage_url"] @@ -723,7 +701,6 @@ async def handle_play( duration = self.bot.utils_class.duration(yt_infos["duration"]) author = f"Channel: {yt_infos['channel']}" else: - colour = self.bot.color title = ( track["info"]["title"] if track["info"]["title"] != "Unknown title" or audio_file is None @@ -734,7 +711,7 @@ async def handle_play( if query and not query.startswith("ytsearch") else track["info"]["uri"] ) - duration = self.bot.utils_class.duration(track["info"]["length"] / 1000) + duration = self.bot.utils_class.duration(track["info"]["duration"] / 1000) author = track["info"]["author"] em = Embed( @@ -743,7 +720,7 @@ async def handle_play( url=url, ) - if yt_infos is not None: + if yt_infos and isinstance(yt_infos, dict): em.set_thumbnail(url=yt_infos["thumbnail"]) em.set_author(name=author) diff --git a/cogs/dj/playlist.py b/cogs/dj/playlist.py index 8b0abe2..1213e45 100644 --- a/cogs/dj/playlist.py +++ b/cogs/dj/playlist.py @@ -159,8 +159,6 @@ async def handle_playlist( if not isinstance(source, Context): await source.response.defer() - print(self.bot.playlists.get(source.guild.id)) - em = Embed(colour=Colour(0xFF0000)) # YTB color if position is not None: diff --git a/cogs/misc/activity.py b/cogs/misc/activity.py deleted file mode 100644 index d05fcd1..0000000 --- a/cogs/misc/activity.py +++ /dev/null @@ -1,491 +0,0 @@ -from typing import Union, Optional - -from disnake import ( - Embed, - GuildCommandInteraction, - HTTPException, - PartyType, - VoiceChannel, -) -from disnake.ext.commands import ( - bot_has_guild_permissions, - bot_has_permissions, - Cog, - Context, - group, - guild_only, - slash_command, -) -from disnake.http import Route - -from bot import Omnitron -from data import Utils - - -class Miscellaneous(Cog, name="misc.activity"): - def __init__(self, bot: Omnitron): - self.bot = bot - - """ GROUP """ - - @group( - pass_context=True, - name="activity", - aliases=["activities"], - usage="(sub-command)", - description="This command manage the server's activities", - ) - @Utils.check_bot_starting() - @bot_has_permissions(send_messages=True) - async def activity_group(self, ctx: Context): - if ctx.invoked_subcommand is None: - await ctx.send( - embed=self.bot.utils_class.get_embed_from_ctx( - ctx, title="Server's activity feature" - ) - ) - - """ SLASH COMMAND """ - - @slash_command( - name="activity", - description="Manages the server's activities", - ) - @guild_only() - @Utils.check_bot_starting() - async def activity_slash_command( - self, - inter: GuildCommandInteraction, - channel: VoiceChannel, - activity: PartyType = None, - custom_activity: int = None, - ): - """ - This slash command manages the server's activities - - Parameters - ---------- - inter: :class:`disnake.ext.commands.GuildCommandInteraction` - The application command interaction - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - activity: :class:`disnake.PartyType` optional - Choose one of the default activities available - custom_activity: :class:`int` optional - If you know an activity that is not shown in the activity section then enter it's ID here! - """ - if not isinstance(channel, VoiceChannel): - return await inter.response.send_message( - "The channel precised must be a valid VoiceChannel!", ephemeral=True - ) - elif not activity and custom_activity: - activity = custom_activity - elif not activity: - return await inter.response.send_message( - "Select at least an activity or enter a custom one!", ephemeral=True - ) - - await inter.response.send_message( - embed=await self.create_activity(inter, channel, activity) - ) - - """ COMMAND(S) """ - - @activity_group.command( - name="awkword", - aliases=["awkw"], - brief="📝", - usage="#voice_channel", - description="Creates an instant invite link into the activity awkword in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_awkword_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity awkword in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 879863881349087252) - ) - - @activity_group.command( - name="betrayal_io", - aliases=["b_io"], - brief="🔫️", - usage="#voice_channel", - description="Creates an instant invite link into the activity Betrayal.io in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_betrayal_io_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Betrayal.io in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 773336526917861400) - ) - - @activity_group.command( - name="checkers", - aliases=["chkrs"], - brief="♚", - usage="#voice_channel", - description="Creates an instant invite link into the activity Checkers In The Park in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_checkers_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Checkers In The Park in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 832013003968348200) - ) - - @activity_group.command( - name="chess", - aliases=["chess_in_the_park"], - brief="♟️", - usage="#voice_channel", - description="Creates an instant invite link into the activity Chess In The Park in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_chess_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Chess In The Park in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 832012774040141894) - ) - - @activity_group.command( - name="doodle_crew", - aliases=["d_crew"], - brief="🖌️", - usage="#voice_channel", - description="Creates an instant invite link into the activity Doodle Crew in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_doodle_crew_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Doodle Crew in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 878067389634314250) - ) - - @activity_group.command( - name="fishington_io", - aliases=["f_io"], - brief="🎣", - usage="#voice_channel", - description="Creates an instant invite link into the activity Fishington.io in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_fishington_io_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Fishington.io in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 814288819477020702) - ) - - @activity_group.command( - name="letter_tile", - aliases=["l_tile"], - brief="🇱", - usage="#voice_channel", - description="Creates an instant invite link into the activity Letter Tile in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_letter_tile_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Letter Tile in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 879863686565621790) - ) - - @activity_group.command( - name="poker_night", - aliases=["p_n"], - brief="♣️", - usage="#voice_channel", - description="Creates an instant invite link into the activity Poker Night in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_poker_night_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Poker Night in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 755827207812677713) - ) - - @activity_group.command( - name="sketchy_artist", - aliases=["s_a"], - brief="✍️️", - usage="#voice_channel", - description="Creates an instant invite link into the activity Sketchy Artist in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_sketchy_artist_command( - self, ctx: Context, channel: VoiceChannel - ): - """ - This command creates an instant invite link into the activity Sketchy Artist in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 879864070101172255) - ) - - @activity_group.command( - name="spellcast", - aliases=["spell"], - brief="🪄", - usage="#voice_channel", - description="Creates an instant invite link into the activity Spellcast in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_spellcast_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Spellcast in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 852509694341283871) - ) - - @activity_group.command( - name="watch_together", - aliases=["w_t"], - brief="📺", - usage="#voice_channel", - description="Creates an instant invite link into the activity WatchTogether in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_watch_together_command( - self, ctx: Context, channel: VoiceChannel - ): - """ - This command creates an instant invite link into the activity WatchTogether in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 880218394199220334) - ) - - @activity_group.command( - name="word_snack", - aliases=["w_snack"], - brief="💬", - usage="#voice_channel", - description="Creates an instant invite link into the activity Word Snack in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_word_snack_command(self, ctx: Context, channel: VoiceChannel): - """ - This command creates an instant invite link into the activity Word Snack in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 879863976006127627) - ) - - @activity_group.command( - name="youtube_together", - aliases=["yt_together", "ytt"], - brief="⏯️", - usage="#voice_channel", - description="Creates an instant invite link into the activity YouTube Together in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_youtube_together_command( - self, ctx: Context, channel: VoiceChannel - ): - """ - This command creates an instant invite link into the activity Youtube Together in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send( - embed=await self.create_activity(ctx, channel, 755600276941176913) - ) - - @activity_group.command( - name="custom", - aliases=["cstm"], - brief="❓", - usage="#voice_channel ", - description="Creates an instant invite link into a custom activity in the specified channel", - ) - @bot_has_guild_permissions(create_instant_invite=True) - async def activity_custom_command( - self, ctx: Context, channel: VoiceChannel, activity: int - ): - """ - This command creates an instant invite link into a custom activity in the specified channel - - Parameters - ---------- - ctx: :class:`disnake.ext.commands.Context` - The command context - channel: :class:`disnake.VoiceChannel` - The voice channel where the activity will take place - """ - await ctx.send(embed=await self.create_activity(ctx, channel, activity)) - - """ METHOD(S) """ - - async def create_activity( - self, - source: Union[Context, GuildCommandInteraction], - channel: VoiceChannel, - activity: int, - ) -> Optional[Embed]: - data = { - "max_age": 0, - "max_uses": 0, - "target_application_id": activity, - "target_type": 2, - "temporary": False, - } - - try: - resp = await self.bot.http.request( - Route("POST", f"/channels/{channel.id}/invites"), json=data - ) - except HTTPException as e: - if e.code == 50035: - if isinstance(source, Context): - return await source.reply( - f"⚠️ - {source.author.mention} - The application ID you gave is not an available one!", - delete_after=20, - ) - else: - return await source.response.send_message( - f"⚠️ - {source.author.mention} - The application ID you gave is not an available one!", - ephemeral=True, - ) - else: - if isinstance(source, Context): - return await source.reply( - f"⚠️ - {source.author.mention} - An error happened, please try again in a few seconds!", - delete_after=20, - ) - else: - return await source.response.send_message( - f"⚠️ - {source.author.mention} - An error happened, please try again in a few seconds!", - ephemeral=True, - ) - - em = Embed( - colour=self.bot.color, - title="The channel is ready!", - description=f"Added **{resp['target_application']['name']}** to {channel.mention}\n> Click on the hyperlink to join.", - url=f"https://discord.gg/{resp['code']}", - ) - em.set_thumbnail( - url=f"https://cdn.discordapp.com/app-icons/{resp['target_application']['id']}/{resp['target_application']['icon']}.png" - ) - em.set_author( - name=f"{source.author}", - icon_url=source.author.avatar.url if source.author.avatar else None, - ) - - if self.bot.user.avatar: - em.set_footer( - text=f"Requested by {source.author}", icon_url=self.bot.user.avatar.url - ) - else: - em.set_footer(text=f"Requested by {source.author}") - - return em - - -def setup(bot): - bot.add_cog(Miscellaneous(bot)) diff --git a/cogs/moderation/clear.py b/cogs/moderation/clear.py index 4c3e0d3..48bb5f0 100644 --- a/cogs/moderation/clear.py +++ b/cogs/moderation/clear.py @@ -58,7 +58,7 @@ def __init__(self, bot: Omnitron): ) @max_concurrency(1, per=BucketType.channel) async def clear_command( - self, ctx: Context, number_messages: Range[1, ...] = 10, member: Member = None + self, ctx: Context, number_messages: Range[int, 1, ...] = 10, member: Member = None ): """ This command deletes a given number of messages in the channel from everyone or a certain member! (default: 10) @@ -84,7 +84,7 @@ async def clear_command( async def clear_command( self, inter: GuildCommandInteraction, - number_messages: Range[1, ...] = 10, + number_messages: Range[int, 1, ...] = 10, member: Member = None, ): """ diff --git a/cogs/moderation/config.py b/cogs/moderation/config.py index 7b28ff1..a653aee 100644 --- a/cogs/moderation/config.py +++ b/cogs/moderation/config.py @@ -2601,7 +2601,7 @@ async def config_security_mute_on_join_command( self, ctx: Context, option: Utils.to_lower = None, - duration: Range[1, ...] = None, + duration: Range[int, 1, ...] = None, duration_type: str = None, notify_channel: TextChannel = None, ): @@ -2668,7 +2668,7 @@ async def config_security_mute_on_join_display_slash_command( async def config_security_mute_on_join_on_slash_command( self, inter: GuildCommandInteraction, - duration: Range[1, ...] = 10, + duration: Range[int, 1, ...] = 10, duration_type: DurationType = "m", notify_channel: TextChannel = None, ): @@ -2697,7 +2697,7 @@ async def config_security_mute_on_join_on_slash_command( async def config_security_mute_on_join_update_slash_command( self, inter: GuildCommandInteraction, - duration: Range[1, ...] = None, + duration: Range[int, 1, ...] = None, duration_type: DurationType = None, notify_channel: TextChannel = None, ): diff --git a/cogs/moderation/poll.py b/cogs/moderation/poll.py index a5c71d6..8261d76 100644 --- a/cogs/moderation/poll.py +++ b/cogs/moderation/poll.py @@ -90,7 +90,7 @@ async def poll_create_command( self, ctx: Context, title: str, - duration: Range[1, ...], + duration: Range[int, 1, ...], type_duration: Utils.to_lower, *choices: str, ): @@ -122,7 +122,7 @@ async def poll_create_slash_command( inter: GuildCommandInteraction, title: str, choices: str, - duration: Range[1, ...] = 10, + duration: Range[int, 1, ...] = 10, type_duration: DurationType = "m", ): """ diff --git a/cogs/moderation/sanction.py b/cogs/moderation/sanction.py index 8b8ef89..99a04fc 100644 --- a/cogs/moderation/sanction.py +++ b/cogs/moderation/sanction.py @@ -684,7 +684,7 @@ async def sanction_mute_add_slash_command( inter: GuildCommandInteraction, member: Member, reason: str = None, - duration: Range[1, ...] = 10, + duration: Range[int, 1, ...] = 10, type_duration: DurationType = "m", ): """ @@ -1055,7 +1055,7 @@ async def sanction_ban_add_slash_command( inter: GuildCommandInteraction, member: Member, reason: str = None, - duration: Range[1, ...] = 1, + duration: Range[int, 1, ...] = 1, type_duration: DurationType = "d", ): """ diff --git a/docker-compose.yml b/docker-compose.yml index 9f3fd83..fc3f647 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,12 +11,14 @@ services: - ./temp:/bot/temp environment: - PYTHONUNBUFFERED=1 + - ENV=DEVELOPMENT + restart: always depends_on: - lavalink lavalink: - build: lavalink + image: fredboat/lavalink:64d4f12-alpine container_name: lavalink + restart: always volumes: - - ./lavalink/logs:/opt/Lavalink/logs - - ./lavalink/logs/hs_err_pid1.log:/opt/Lavalink/hs_err_pid1.log + - ./lavalink:/opt/Lavalink diff --git a/lavalink/Dockerfile b/lavalink/Dockerfile deleted file mode 100644 index a050612..0000000 --- a/lavalink/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM azul/zulu-openjdk:13 - -# Run as non-root user -RUN groupadd -g 322 lavalink && \ - useradd -r -u 322 -g lavalink lavalink -USER lavalink - -WORKDIR /opt/Lavalink - -COPY Lavalink.jar /opt/Lavalink/Lavalink.jar -COPY application.yml /opt/Lavalink/application.yml - -ENTRYPOINT ["java", "-Djdk.tls.client.protocols=TLSv1.1,TLSv1.2", "-Xmx6G", "-jar", "Lavalink.jar"] diff --git a/lavalink/Lavalink.jar b/lavalink/Lavalink.jar index 184b13c..7a50c94 100644 Binary files a/lavalink/Lavalink.jar and b/lavalink/Lavalink.jar differ diff --git a/requirements.txt b/requirements.txt index 1b68a7e..db8a78d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -disnake @ git+https://github.com/DisnakeDev/disnake.git@72d8e478cc16a89f40a6ee1bdfe72ae36ec4faf1 -python-dotenv==0.20.0 -firebase_admin==5.2.0 -pandas==1.4.2 -lavalink @ git+https://github.com/Devoxin/Lavalink.py.git@685cca2972a7df8e7a89b8ad1075dc6457961ca6 +disnake==2.9.0 +python-dotenv==1.0.0 +firebase_admin==6.2.0 +pandas==2.0.3 +lavalink==4.0.6 youtube_dl==2021.12.17 -spotipy==2.20.0 +spotipy==2.23.0 PyNaCl==1.5.0