mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 02:16:09 -05:00
[CI] Improve automated checks (#2702)
* same stuff, but with some more spurious error supression * fix issue in permissions found in this * fix a few more spurious errors * fix another issue * semi-spurious error fixes * . * formatting * move this to properly log * distutils import + virtualenv * more fixes
This commit is contained in:
@@ -3,7 +3,7 @@ import pathlib
|
||||
import platform
|
||||
import shutil
|
||||
import asyncio
|
||||
import asyncio.subprocess
|
||||
import asyncio.subprocess # disables for # https://github.com/PyCQA/pylint/issues/1469
|
||||
import logging
|
||||
import re
|
||||
import tempfile
|
||||
@@ -42,7 +42,7 @@ class ServerManager:
|
||||
def __init__(self) -> None:
|
||||
self.ready = asyncio.Event()
|
||||
|
||||
self._proc: Optional[asyncio.subprocess.Process] = None
|
||||
self._proc: Optional[asyncio.subprocess.Process] = None # pylint:disable=no-member
|
||||
self._monitor_task: Optional[asyncio.Task] = None
|
||||
self._shutdown: bool = False
|
||||
|
||||
@@ -67,7 +67,7 @@ class ServerManager:
|
||||
shutil.copyfile(BUNDLED_APP_YML, LAVALINK_APP_YML)
|
||||
|
||||
args = await self._get_jar_args()
|
||||
self._proc = await asyncio.subprocess.create_subprocess_exec(
|
||||
self._proc = await asyncio.subprocess.create_subprocess_exec( # pylint:disable=no-member
|
||||
*args,
|
||||
cwd=str(LAVALINK_DOWNLOAD_DIR),
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
@@ -117,7 +117,7 @@ class ServerManager:
|
||||
"""
|
||||
This assumes we've already checked that java exists.
|
||||
"""
|
||||
_proc: asyncio.subprocess.Process = await asyncio.create_subprocess_exec(
|
||||
_proc: asyncio.subprocess.Process = await asyncio.create_subprocess_exec( # pylint:disable=no-member
|
||||
"java", "-version", stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
# java -version outputs to stderr
|
||||
@@ -173,7 +173,7 @@ class ServerManager:
|
||||
await self.start()
|
||||
else:
|
||||
log.critical(
|
||||
"Your Java is borked. Please find the hs_err_pid{}.log file"
|
||||
"Your Java is borked. Please find the hs_err_pid%d.log file"
|
||||
" in the Audio data folder and report this issue.",
|
||||
self._proc.pid,
|
||||
)
|
||||
@@ -222,7 +222,7 @@ class ServerManager:
|
||||
return True
|
||||
args = await cls._get_jar_args()
|
||||
args.append("--version")
|
||||
_proc = await asyncio.subprocess.create_subprocess_exec(
|
||||
_proc = await asyncio.subprocess.create_subprocess_exec( # pylint:disable=no-member
|
||||
*args,
|
||||
cwd=str(LAVALINK_DOWNLOAD_DIR),
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Union, List, Callable, Set
|
||||
@@ -8,12 +9,13 @@ from redbot.core import checks, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils.mod import slow_deletion, mass_purge
|
||||
from redbot.cogs.mod.log import log
|
||||
from redbot.core.utils.predicates import MessagePredicate
|
||||
from .converters import RawMessageIds
|
||||
|
||||
_ = Translator("Cleanup", __file__)
|
||||
|
||||
log = logging.getLogger("red.cleanup")
|
||||
|
||||
|
||||
@cog_i18n(_)
|
||||
class Cleanup(commands.Cog):
|
||||
@@ -302,13 +304,13 @@ class Cleanup(commands.Cog):
|
||||
author = ctx.author
|
||||
try:
|
||||
mone = await channel.fetch_message(one)
|
||||
except discord.errors.Notfound:
|
||||
except discord.errors.NotFound:
|
||||
return await ctx.send(
|
||||
_("Could not find a message with the ID of {id}.".format(id=one))
|
||||
)
|
||||
try:
|
||||
mtwo = await channel.fetch_message(two)
|
||||
except discord.errors.Notfound:
|
||||
except discord.errors.NotFound:
|
||||
return await ctx.send(
|
||||
_("Could not find a message with the ID of {id}.".format(id=two))
|
||||
)
|
||||
|
||||
@@ -467,7 +467,9 @@ class Economy(commands.Cog):
|
||||
sign = " "
|
||||
if i == 1:
|
||||
sign = ">"
|
||||
slot += "{}{} {} {}\n".format(sign, *[c.value for c in row])
|
||||
slot += "{}{} {} {}\n".format(
|
||||
sign, *[c.value for c in row] # pylint: disable=no-member
|
||||
)
|
||||
|
||||
payout = PAYOUTS.get(rows[1])
|
||||
if not payout:
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from collections import defaultdict, deque
|
||||
|
||||
import discord
|
||||
from redbot.core import i18n, modlog, commands
|
||||
from redbot.core.utils.mod import is_mod_or_superior
|
||||
from . import log
|
||||
from .abc import MixinMeta
|
||||
|
||||
_ = i18n.Translator("Mod", __file__)
|
||||
log = logging.getLogger("red.mod")
|
||||
|
||||
|
||||
class Events(MixinMeta):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
from datetime import datetime, timedelta
|
||||
from typing import cast, Optional, Union
|
||||
@@ -10,8 +11,8 @@ from redbot.core.utils.chat_formatting import pagify
|
||||
from redbot.core.utils.mod import is_allowed_by_hierarchy, get_audit_reason
|
||||
from .abc import MixinMeta
|
||||
from .converters import RawUserIds
|
||||
from .log import log
|
||||
|
||||
log = logging.getLogger("red.mod")
|
||||
_ = i18n.Translator("Mod", __file__)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import logging
|
||||
|
||||
|
||||
log = logging.getLogger("red.mod")
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import asyncio
|
||||
import contextlib
|
||||
|
||||
@@ -5,8 +6,8 @@ import discord
|
||||
from redbot.core import commands, checks, i18n
|
||||
from redbot.core.utils.chat_formatting import box
|
||||
from .abc import MixinMeta
|
||||
from .log import log
|
||||
|
||||
log = logging.getLogger("red.mod")
|
||||
_ = i18n.Translator("Mod", __file__)
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ COG = "COG"
|
||||
COMMAND = "COMMAND"
|
||||
GLOBAL = 0
|
||||
|
||||
_OldConfigSchema = Dict[int, Dict[str, Dict[str, Dict[str, Dict[str, List[int]]]]]]
|
||||
_NewConfigSchema = Dict[str, Dict[int, Dict[str, Dict[int, bool]]]]
|
||||
|
||||
# The strings in the schema are constants and should get extracted, but not translated until
|
||||
# runtime.
|
||||
translate = _
|
||||
@@ -625,9 +628,6 @@ class Permissions(commands.Cog):
|
||||
await self.config.custom(COMMAND).set(new_cmd_rules)
|
||||
await self.config.version.set(__version__)
|
||||
|
||||
_OldConfigSchema = Dict[int, Dict[str, Dict[str, Dict[str, Dict[str, List[int]]]]]]
|
||||
_NewConfigSchema = Dict[str, Dict[int, Dict[str, Dict[int, bool]]]]
|
||||
|
||||
@staticmethod
|
||||
def _get_updated_schema(
|
||||
old_config: _OldConfigSchema
|
||||
|
||||
@@ -215,7 +215,7 @@ class TwitchStream(Stream):
|
||||
status = "Untitled broadcast"
|
||||
if is_rerun:
|
||||
status += " - Rerun"
|
||||
embed = discord.Embed(title=status, url=url)
|
||||
embed = discord.Embed(title=status, url=url, color=0x6441A4)
|
||||
embed.set_author(name=channel["display_name"])
|
||||
embed.add_field(name="Followers", value=channel["followers"])
|
||||
embed.add_field(name="Total views", value=channel["views"])
|
||||
@@ -224,7 +224,6 @@ class TwitchStream(Stream):
|
||||
embed.set_image(url=rnd(data["stream"]["preview"]["medium"]))
|
||||
if channel["game"]:
|
||||
embed.set_footer(text="Playing: " + channel["game"])
|
||||
embed.color = 0x6441A4
|
||||
|
||||
return embed
|
||||
|
||||
@@ -260,14 +259,13 @@ class HitboxStream(Stream):
|
||||
livestream = data["livestream"][0]
|
||||
channel = livestream["channel"]
|
||||
url = channel["channel_link"]
|
||||
embed = discord.Embed(title=livestream["media_status"], url=url)
|
||||
embed = discord.Embed(title=livestream["media_status"], url=url, color=0x98CB00)
|
||||
embed.set_author(name=livestream["media_name"])
|
||||
embed.add_field(name="Followers", value=channel["followers"])
|
||||
embed.set_thumbnail(url=base_url + channel["user_logo"])
|
||||
if livestream["media_thumbnail"]:
|
||||
embed.set_image(url=rnd(base_url + livestream["media_thumbnail"]))
|
||||
embed.set_footer(text="Playing: " + livestream["category_name"])
|
||||
embed.color = 0x98CB00
|
||||
|
||||
return embed
|
||||
|
||||
@@ -310,7 +308,7 @@ class MixerStream(Stream):
|
||||
embed.set_thumbnail(url=default_avatar)
|
||||
if data["thumbnail"]:
|
||||
embed.set_image(url=rnd(data["thumbnail"]["url"]))
|
||||
embed.color = 0x4C90F3
|
||||
embed.color = 0x4C90F3 # pylint: disable=assigning-non-slot
|
||||
if data["type"] is not None:
|
||||
embed.set_footer(text="Playing: " + data["type"]["name"])
|
||||
return embed
|
||||
@@ -345,13 +343,12 @@ class PicartoStream(Stream):
|
||||
)
|
||||
url = "https://picarto.tv/" + data["name"]
|
||||
thumbnail = data["thumbnails"]["web"]
|
||||
embed = discord.Embed(title=data["title"], url=url)
|
||||
embed = discord.Embed(title=data["title"], url=url, color=0x4C90F3)
|
||||
embed.set_author(name=data["name"])
|
||||
embed.set_image(url=rnd(thumbnail))
|
||||
embed.add_field(name="Followers", value=data["followers"])
|
||||
embed.add_field(name="Total views", value=data["viewers_total"])
|
||||
embed.set_thumbnail(url=avatar)
|
||||
embed.color = 0x132332
|
||||
data["tags"] = ", ".join(data["tags"])
|
||||
|
||||
if not data["tags"]:
|
||||
@@ -362,6 +359,5 @@ class PicartoStream(Stream):
|
||||
else:
|
||||
data["adult"] = ""
|
||||
|
||||
embed.color = 0x4C90F3
|
||||
embed.set_footer(text="{adult}Category: {category} | Tags: {tags}".format(**data))
|
||||
return embed
|
||||
|
||||
Reference in New Issue
Block a user