mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 09:52:30 -05:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec0c71d5c2 | ||
|
|
3eb4017263 | ||
|
|
6b5bcdfe74 | ||
|
|
2bd082e8f2 | ||
|
|
7d36cc8366 | ||
|
|
9fc0e627ee | ||
|
|
989e16b20b | ||
|
|
1c648abea2 | ||
|
|
11d87067aa | ||
|
|
6c9c57c14d | ||
|
|
404c5f6dc0 | ||
|
|
f0f274e1e1 | ||
|
|
e9f014df07 | ||
|
|
778eadd418 | ||
|
|
3de9d15410 |
@@ -2,7 +2,7 @@ api_key_env: CROWDIN_API_KEY
|
|||||||
project_identifier_env: CROWDIN_PROJECT_ID
|
project_identifier_env: CROWDIN_PROJECT_ID
|
||||||
base_path: ./redbot/
|
base_path: ./redbot/
|
||||||
files:
|
files:
|
||||||
- source: cogs/**/locales/messages.pot
|
- source: cogs/**/messages.pot
|
||||||
translation: /%original_path%/%locale%.po
|
translation: /%original_path%/%locale%.po
|
||||||
- source: core/**/locales/messages.pot
|
- source: core/**/messages.pot
|
||||||
translation: /%original_path%/%locale%.po
|
translation: /%original_path%/%locale%.po
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import sys as _sys
|
|||||||
import warnings as _warnings
|
import warnings as _warnings
|
||||||
from math import inf as _inf
|
from math import inf as _inf
|
||||||
from typing import (
|
from typing import (
|
||||||
Any as _Any,
|
|
||||||
ClassVar as _ClassVar,
|
ClassVar as _ClassVar,
|
||||||
Dict as _Dict,
|
Dict as _Dict,
|
||||||
List as _List,
|
List as _List,
|
||||||
@@ -174,7 +173,7 @@ class VersionInfo:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
__version__ = "3.1.3"
|
__version__ = "3.1.9"
|
||||||
version_info = VersionInfo.from_str(__version__)
|
version_info = VersionInfo.from_str(__version__)
|
||||||
|
|
||||||
# Filter fuzzywuzzy slow sequence matcher warning
|
# Filter fuzzywuzzy slow sequence matcher warning
|
||||||
|
|||||||
@@ -1737,6 +1737,9 @@ class Audio(commands.Cog):
|
|||||||
# YouTube or Soundcloud playlist
|
# YouTube or Soundcloud playlist
|
||||||
track_len = 0
|
track_len = 0
|
||||||
for track in tracks:
|
for track in tracks:
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
await ctx.send("I can't add anything else to the queue.")
|
||||||
|
break
|
||||||
if guild_data["maxlength"] > 0:
|
if guild_data["maxlength"] > 0:
|
||||||
if self._track_limit(ctx, track, guild_data["maxlength"]):
|
if self._track_limit(ctx, track, guild_data["maxlength"]):
|
||||||
track_len += 1
|
track_len += 1
|
||||||
@@ -1774,11 +1777,15 @@ class Audio(commands.Cog):
|
|||||||
single_track = tracks[0]
|
single_track = tracks[0]
|
||||||
if guild_data["maxlength"] > 0:
|
if guild_data["maxlength"] > 0:
|
||||||
if self._track_limit(ctx, single_track, guild_data["maxlength"]):
|
if self._track_limit(ctx, single_track, guild_data["maxlength"]):
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
return await ctx.send("I can't add anything else to the queue.")
|
||||||
player.add(ctx.author, single_track)
|
player.add(ctx.author, single_track)
|
||||||
else:
|
else:
|
||||||
return await self._embed_msg(ctx, _("Track exceeds maximum length."))
|
return await self._embed_msg(ctx, _("Track exceeds maximum length."))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
return await ctx.send("I can't add anything else to the queue.")
|
||||||
player.add(ctx.author, single_track)
|
player.add(ctx.author, single_track)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return await self._embed_msg(
|
return await self._embed_msg(
|
||||||
@@ -1939,6 +1946,7 @@ class Audio(commands.Cog):
|
|||||||
"""Playlist configuration options."""
|
"""Playlist configuration options."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@playlist.command(name="append")
|
@playlist.command(name="append")
|
||||||
async def _playlist_append(self, ctx, playlist_name, *, url):
|
async def _playlist_append(self, ctx, playlist_name, *, url):
|
||||||
"""Add a track URL, playlist link, or quick search to a playlist.
|
"""Add a track URL, playlist link, or quick search to a playlist.
|
||||||
@@ -2066,6 +2074,7 @@ class Audio(commands.Cog):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@playlist.command(name="create")
|
@playlist.command(name="create")
|
||||||
async def _playlist_create(self, ctx, playlist_name):
|
async def _playlist_create(self, ctx, playlist_name):
|
||||||
"""Create an empty playlist."""
|
"""Create an empty playlist."""
|
||||||
@@ -2139,6 +2148,7 @@ class Audio(commands.Cog):
|
|||||||
await ctx.send(file=discord.File(to_write, filename=f"{playlist_name}.txt"))
|
await ctx.send(file=discord.File(to_write, filename=f"{playlist_name}.txt"))
|
||||||
to_write.close()
|
to_write.close()
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@playlist.command(name="info")
|
@playlist.command(name="info")
|
||||||
async def _playlist_info(self, ctx, playlist_name):
|
async def _playlist_info(self, ctx, playlist_name):
|
||||||
"""Retrieve information from a saved playlist."""
|
"""Retrieve information from a saved playlist."""
|
||||||
@@ -2241,7 +2251,7 @@ class Audio(commands.Cog):
|
|||||||
)
|
)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
@commands.cooldown(1, 15, discord.ext.commands.BucketType.guild)
|
@checks.is_owner()
|
||||||
@playlist.command(name="queue")
|
@playlist.command(name="queue")
|
||||||
async def _playlist_queue(self, ctx, playlist_name=None):
|
async def _playlist_queue(self, ctx, playlist_name=None):
|
||||||
"""Save the queue to a playlist."""
|
"""Save the queue to a playlist."""
|
||||||
@@ -2297,6 +2307,7 @@ class Audio(commands.Cog):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@playlist.command(name="remove")
|
@playlist.command(name="remove")
|
||||||
async def _playlist_remove(self, ctx, playlist_name, url):
|
async def _playlist_remove(self, ctx, playlist_name, url):
|
||||||
"""Remove a track from a playlist by url."""
|
"""Remove a track from a playlist by url."""
|
||||||
@@ -2336,6 +2347,7 @@ class Audio(commands.Cog):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@checks.is_owner()
|
||||||
@playlist.command(name="save")
|
@playlist.command(name="save")
|
||||||
async def _playlist_save(self, ctx, playlist_name, playlist_url):
|
async def _playlist_save(self, ctx, playlist_name, playlist_url):
|
||||||
"""Save a playlist from a url."""
|
"""Save a playlist from a url."""
|
||||||
@@ -2367,6 +2379,9 @@ class Audio(commands.Cog):
|
|||||||
try:
|
try:
|
||||||
player = lavalink.get_player(ctx.guild.id)
|
player = lavalink.get_player(ctx.guild.id)
|
||||||
for track in playlists[playlist_name]["tracks"]:
|
for track in playlists[playlist_name]["tracks"]:
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
await ctx.send("I can't add anything else to the queue.")
|
||||||
|
break
|
||||||
if track["info"]["uri"].startswith("localtracks/"):
|
if track["info"]["uri"].startswith("localtracks/"):
|
||||||
if not await self._localtracks_check(ctx):
|
if not await self._localtracks_check(ctx):
|
||||||
pass
|
pass
|
||||||
@@ -2376,6 +2391,7 @@ class Audio(commands.Cog):
|
|||||||
if not self._track_limit(ctx, track["info"]["length"], maxlength):
|
if not self._track_limit(ctx, track["info"]["length"], maxlength):
|
||||||
continue
|
continue
|
||||||
player.add(author_obj, lavalink.rest_api.Track(data=track))
|
player.add(author_obj, lavalink.rest_api.Track(data=track))
|
||||||
|
await asyncio.sleep(0)
|
||||||
track_len += 1
|
track_len += 1
|
||||||
if len(playlists[playlist_name]["tracks"]) > track_len:
|
if len(playlists[playlist_name]["tracks"]) > track_len:
|
||||||
maxlength_msg = " {bad_tracks} tracks cannot be queued.".format(
|
maxlength_msg = " {bad_tracks} tracks cannot be queued.".format(
|
||||||
@@ -3046,6 +3062,9 @@ class Audio(commands.Cog):
|
|||||||
|
|
||||||
track_len = 0
|
track_len = 0
|
||||||
for track in tracks:
|
for track in tracks:
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
await ctx.send("I can't add anything else to the queue.")
|
||||||
|
break
|
||||||
if guild_data["maxlength"] > 0:
|
if guild_data["maxlength"] > 0:
|
||||||
if self._track_limit(ctx, track, guild_data["maxlength"]):
|
if self._track_limit(ctx, track, guild_data["maxlength"]):
|
||||||
track_len += 1
|
track_len += 1
|
||||||
@@ -3053,6 +3072,7 @@ class Audio(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
track_len += 1
|
track_len += 1
|
||||||
player.add(ctx.author, track)
|
player.add(ctx.author, track)
|
||||||
|
await asyncio.sleep(0)
|
||||||
if not player.current:
|
if not player.current:
|
||||||
await player.play()
|
await player.play()
|
||||||
if len(tracks) > track_len:
|
if len(tracks) > track_len:
|
||||||
@@ -3189,10 +3209,14 @@ class Audio(commands.Cog):
|
|||||||
|
|
||||||
if guild_data["maxlength"] > 0:
|
if guild_data["maxlength"] > 0:
|
||||||
if self._track_limit(ctx, search_choice.length, guild_data["maxlength"]):
|
if self._track_limit(ctx, search_choice.length, guild_data["maxlength"]):
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
return await ctx.send("I can't add anything else to the queue.")
|
||||||
player.add(ctx.author, search_choice)
|
player.add(ctx.author, search_choice)
|
||||||
else:
|
else:
|
||||||
return await self._embed_msg(ctx, _("Track exceeds maximum length."))
|
return await self._embed_msg(ctx, _("Track exceeds maximum length."))
|
||||||
else:
|
else:
|
||||||
|
if len(player.queue) >= 10000:
|
||||||
|
return await ctx.send("I can't add anything else to the queue.")
|
||||||
player.add(ctx.author, search_choice)
|
player.add(ctx.author, search_choice)
|
||||||
if not player.current:
|
if not player.current:
|
||||||
await player.play()
|
await player.play()
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ from tqdm import tqdm
|
|||||||
from redbot.core import data_manager
|
from redbot.core import data_manager
|
||||||
from .errors import LavalinkDownloadFailed
|
from .errors import LavalinkDownloadFailed
|
||||||
|
|
||||||
JAR_VERSION = "3.2.0.3"
|
JAR_VERSION = "3.2.1"
|
||||||
JAR_BUILD = 796
|
JAR_BUILD = 846
|
||||||
LAVALINK_DOWNLOAD_URL = (
|
LAVALINK_DOWNLOAD_URL = (
|
||||||
f"https://github.com/Cog-Creators/Lavalink-Jars/releases/download/{JAR_VERSION}_{JAR_BUILD}/"
|
f"https://github.com/Cog-Creators/Lavalink-Jars/releases/download/{JAR_VERSION}_{JAR_BUILD}/"
|
||||||
f"Lavalink.jar"
|
f"Lavalink.jar"
|
||||||
|
|||||||
@@ -470,6 +470,7 @@ class CustomCommands(commands.Cog):
|
|||||||
# wrap the command here so it won't register with the bot
|
# wrap the command here so it won't register with the bot
|
||||||
fake_cc = commands.command(name=ctx.invoked_with)(self.cc_callback)
|
fake_cc = commands.command(name=ctx.invoked_with)(self.cc_callback)
|
||||||
fake_cc.params = self.prepare_args(raw_response)
|
fake_cc.params = self.prepare_args(raw_response)
|
||||||
|
fake_cc.requires.ready_event.set()
|
||||||
ctx.command = fake_cc
|
ctx.command = fake_cc
|
||||||
|
|
||||||
await self.bot.invoke(ctx)
|
await self.bot.invoke(ctx)
|
||||||
|
|||||||
@@ -48,24 +48,8 @@ async def _init():
|
|||||||
_conf.register_guild(mod_log=None, casetypes={})
|
_conf.register_guild(mod_log=None, casetypes={})
|
||||||
_conf.init_custom(_CASETYPES, 1)
|
_conf.init_custom(_CASETYPES, 1)
|
||||||
_conf.init_custom(_CASES, 2)
|
_conf.init_custom(_CASES, 2)
|
||||||
_conf.register_custom(
|
_conf.register_custom(_CASETYPES)
|
||||||
_CASETYPES, default_setting=None, image=None, case_str=None, audit_type=None
|
_conf.register_custom(_CASES)
|
||||||
)
|
|
||||||
_conf.register_custom(
|
|
||||||
_CASES,
|
|
||||||
case_number=None,
|
|
||||||
action_type=None,
|
|
||||||
guild=None,
|
|
||||||
created_at=None,
|
|
||||||
user=None,
|
|
||||||
moderator=None,
|
|
||||||
reason=None,
|
|
||||||
until=None,
|
|
||||||
channel=None,
|
|
||||||
amended_by=None,
|
|
||||||
modified_at=None,
|
|
||||||
message=None,
|
|
||||||
)
|
|
||||||
await _migrate_config(from_version=await _conf.schema_version(), to_version=_SCHEMA_VERSION)
|
await _migrate_config(from_version=await _conf.schema_version(), to_version=_SCHEMA_VERSION)
|
||||||
|
|
||||||
|
|
||||||
@@ -139,6 +123,9 @@ class Case:
|
|||||||
The attributes to change
|
The attributes to change
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# We don't want case_number to be changed
|
||||||
|
data.pop("case_number", None)
|
||||||
|
|
||||||
for item in list(data.keys()):
|
for item in list(data.keys()):
|
||||||
setattr(self, item, data[item])
|
setattr(self, item, data[item])
|
||||||
|
|
||||||
@@ -267,6 +254,7 @@ class Case:
|
|||||||
else:
|
else:
|
||||||
user_id = self.user.id
|
user_id = self.user.id
|
||||||
data = {
|
data = {
|
||||||
|
"case_number": self.case_number,
|
||||||
"action_type": self.action_type,
|
"action_type": self.action_type,
|
||||||
"guild": self.guild.id,
|
"guild": self.guild.id,
|
||||||
"created_at": self.created_at,
|
"created_at": self.created_at,
|
||||||
@@ -516,7 +504,7 @@ async def get_case(case_number: int, guild: discord.Guild, bot: Red) -> Case:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
case = await _conf.custom(_CASES, str(guild.id), str(case_number)).all()
|
case = await _conf.custom(_CASES, str(guild.id), str(case_number)).all()
|
||||||
if not case["case_number"]:
|
if not case:
|
||||||
raise RuntimeError("That case does not exist for guild {}".format(guild.name))
|
raise RuntimeError("That case does not exist for guild {}".format(guild.name))
|
||||||
mod_channel = await get_modlog_channel(guild)
|
mod_channel = await get_modlog_channel(guild)
|
||||||
return await Case.from_json(mod_channel, bot, case_number, case)
|
return await Case.from_json(mod_channel, bot, case_number, case)
|
||||||
@@ -693,11 +681,9 @@ async def get_casetype(name: str, guild: Optional[discord.Guild] = None) -> Opti
|
|||||||
-------
|
-------
|
||||||
Optional[CaseType]
|
Optional[CaseType]
|
||||||
"""
|
"""
|
||||||
try:
|
|
||||||
data = await _conf.custom(_CASETYPES, name).all()
|
data = await _conf.custom(_CASETYPES, name).all()
|
||||||
except KeyError:
|
if not data:
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
casetype = CaseType.from_json(name, data)
|
casetype = CaseType.from_json(name, data)
|
||||||
casetype.guild = guild
|
casetype.guild = guild
|
||||||
return casetype
|
return casetype
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ install_requires =
|
|||||||
Click==7.0
|
Click==7.0
|
||||||
colorama==0.4.1
|
colorama==0.4.1
|
||||||
contextlib2==0.5.5
|
contextlib2==0.5.5
|
||||||
discord.py==1.2.3
|
discord.py==1.2.5
|
||||||
distro==1.4.0; sys_platform == "linux"
|
distro==1.4.0; sys_platform == "linux"
|
||||||
fuzzywuzzy==0.17.0
|
fuzzywuzzy==0.17.0
|
||||||
idna==2.8
|
idna==2.8
|
||||||
@@ -45,7 +45,7 @@ install_requires =
|
|||||||
Red-Lavalink==0.3.0
|
Red-Lavalink==0.3.0
|
||||||
schema==0.7.0
|
schema==0.7.0
|
||||||
tqdm==4.32.2
|
tqdm==4.32.2
|
||||||
uvloop==0.12.2; sys_platform != "win32" and platform_python_implementation == "CPython"
|
uvloop==0.14.0; sys_platform != "win32" and platform_python_implementation == "CPython"
|
||||||
websockets==6.0
|
websockets==6.0
|
||||||
yarl==1.3.0
|
yarl==1.3.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user