Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vocadb] fix for dpy2 #255

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
07d1a8b
[meta] update pre-commit (#224)
pre-commit-ci[bot] Jul 12, 2023
c2f482b
[meta]: Bump crowdin/github-action from 1.8.1 to 1.11.0 (#222)
dependabot[bot] Jul 12, 2023
c977b1d
[meta]: Bump crowdin/github-action from 1.11.0 to 1.12.0 (#226)
dependabot[bot] Aug 3, 2023
3bb3aca
[meta]: Bump actions/checkout from 3 to 4 (#227)
dependabot[bot] Sep 4, 2023
98ab3ac
[meta] update pre-commit (#228)
pre-commit-ci[bot] Sep 19, 2023
0affbbc
[meta]: Bump crowdin/github-action from 1.12.0 to 1.13.1 (#229)
dependabot[bot] Sep 19, 2023
46873fb
[meta] update pre-commit (#231)
pre-commit-ci[bot] Oct 24, 2023
b6357a8
[meta]: Bump crowdin/github-action from 1.13.1 to 1.14.1 (#233)
dependabot[bot] Nov 8, 2023
efe2e36
[meta] update pre-commit (#234)
pre-commit-ci[bot] Nov 18, 2023
630dc44
[meta]: Bump crowdin/github-action from 1.14.1 to 1.15.2 (#235)
dependabot[bot] Nov 30, 2023
b73f33c
[meta]: Bump github/codeql-action from 2 to 3 (#238)
dependabot[bot] Dec 25, 2023
c9b12ba
[meta] update pre-commit (#237)
pre-commit-ci[bot] Dec 30, 2023
a85230a
[meta]: Bump actions/setup-python from 4 to 5 (#236)
dependabot[bot] Dec 30, 2023
351c26c
[meta]: Bump crowdin/github-action from 1.15.2 to 1.16.0 (#239)
dependabot[bot] Jan 21, 2024
d7d4a04
[meta]: Bump crowdin/github-action from 1.16.0 to 1.17.0 (#243)
dependabot[bot] Feb 11, 2024
443315a
[meta]: Bump hmarr/auto-approve-action from 3 to 4 (#244)
dependabot[bot] Feb 11, 2024
2fbebf6
[meta] update pre-commit (#242)
pre-commit-ci[bot] Feb 11, 2024
31cd32a
[meta]: Bump crowdin/github-action from 1.17.0 to 1.19.0 (#248)
dependabot[bot] Mar 19, 2024
4ed0f0a
[meta] update pre-commit (#247)
pre-commit-ci[bot] Mar 19, 2024
0cdfd1c
[meta]: Bump actions/dependency-review-action from 3 to 4 (#240)
dependabot[bot] Mar 22, 2024
ff50018
[meta]: Bump TimonVS/pr-labeler-action from 4 to 5 (#246)
dependabot[bot] Mar 22, 2024
2fd4c0b
[meta]: Bump crowdin/github-action from 1.19.0 to 1.20.1 (#251)
dependabot[bot] Apr 6, 2024
c5a471a
[meta]: Bump crowdin/github-action from 1.20.1 to 1.20.2 (#252)
dependabot[bot] Apr 17, 2024
5f2ccb4
[meta] update pre-commit (#253)
pre-commit-ci[bot] Apr 17, 2024
f3223db
Update vocadb.py
DJTOMATO Apr 17, 2024
e8bb555
[meta] pre-commit styling fix
pre-commit-ci[bot] Apr 17, 2024
9b1c2c1
Update vocadb.py
DJTOMATO Apr 18, 2024
8ea4803
Merge branch 'V3_dpy2' into patch-1
fixator10 Apr 18, 2024
9d1cdc3
[meta] pre-commit styling fix
pre-commit-ci[bot] Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
auto-approve:
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v3
- uses: hmarr/auto-approve-action@v4
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'github-actions[bot]' }}
with:
github-token: "${{ secrets.REVIEW_TOKEN }}"
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
setup-python-dependencies: false
languages: ${{ matrix.language }}
Expand All @@ -45,7 +45,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -59,4 +59,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
with:
# Possible values: "critical", "high", "moderate", "low"
# fail-on-severity: critical
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v4
- uses: TimonVS/pr-labeler-action@v5
with:
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
env:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
ci:
Expand Down
24 changes: 15 additions & 9 deletions adminutils/adminutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,11 @@ async def emoji_add(self, ctx, name: str, url: str, *roles: discord.Role):
roles=roles,
reason=get_audit_reason(
ctx.author,
_("Restricted to roles: {}").format(", ".join(role.name for role in roles))
if roles
else None,
(
_("Restricted to roles: {}").format(", ".join(role.name for role in roles))
if roles
else None
),
),
)
except discord.HTTPException as e:
Expand Down Expand Up @@ -259,9 +261,11 @@ async def emote_steal(
roles=roles,
reason=get_audit_reason(
ctx.author,
_("Restricted to roles: {}").format(", ".join(role.name for role in roles))
if roles
else None,
(
_("Restricted to roles: {}").format(", ".join(role.name for role in roles))
if roles
else None
),
),
)
await ctx.tick()
Expand Down Expand Up @@ -290,9 +294,11 @@ async def emoji_rename(
roles=roles,
reason=get_audit_reason(
ctx.author,
_("Restricted to roles: ").format(", ".join(role.name for role in roles))
if roles
else None,
(
_("Restricted to roles: ").format(", ".join(role.name for role in roles))
if roles
else None
),
),
)
except discord.Forbidden:
Expand Down
88 changes: 56 additions & 32 deletions datautils/datautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,35 +263,55 @@ async def sinfo(self, ctx, *, server: commands.GuildConverter = None):
)
em.add_field(
name=_("Verification level"),
value=_("None")
if server.verification_level == discord.VerificationLevel.none
else _("Low")
if server.verification_level == discord.VerificationLevel.low
else _("Medium")
if server.verification_level == discord.VerificationLevel.medium
else _("High")
if server.verification_level == discord.VerificationLevel.high
else _("Highest")
if server.verification_level == discord.VerificationLevel.extreme
else _("Unknown"),
value=(
_("None")
if server.verification_level == discord.VerificationLevel.none
else (
_("Low")
if server.verification_level == discord.VerificationLevel.low
else (
_("Medium")
if server.verification_level == discord.VerificationLevel.medium
else (
_("High")
if server.verification_level == discord.VerificationLevel.high
else (
_("Highest")
if server.verification_level == discord.VerificationLevel.extreme
else _("Unknown")
)
)
)
)
),
)
em.add_field(
name=_("Explicit content filter"),
value=_("Don't scan any messages.")
if server.explicit_content_filter == discord.ContentFilter.disabled
else _("Scan messages from members without a role.")
if server.explicit_content_filter == discord.ContentFilter.no_role
else _("Scan messages sent by all members.")
if server.explicit_content_filter == discord.ContentFilter.all_members
else _("Unknown"),
value=(
_("Don't scan any messages.")
if server.explicit_content_filter == discord.ContentFilter.disabled
else (
_("Scan messages from members without a role.")
if server.explicit_content_filter == discord.ContentFilter.no_role
else (
_("Scan messages sent by all members.")
if server.explicit_content_filter == discord.ContentFilter.all_members
else _("Unknown")
)
)
),
)
em.add_field(
name=_("Default notifications"),
value=_("All messages")
if server.default_notifications == discord.NotificationLevel.all_messages
else _("Only @mentions")
if server.default_notifications == discord.NotificationLevel.only_mentions
else _("Unknown"),
value=(
_("All messages")
if server.default_notifications == discord.NotificationLevel.all_messages
else (
_("Only @mentions")
if server.default_notifications == discord.NotificationLevel.only_mentions
else _("Unknown")
)
),
)
em.add_field(name=_("2FA admins"), value=bool_emojify(server.mfa_level))
if server.rules_channel:
Expand Down Expand Up @@ -432,15 +452,19 @@ async def cinfo(
changed_roles = sorted(channel.changed_roles, key=lambda r: r.position, reverse=True)
em = discord.Embed(
title=chat.escape(str(channel.name), formatting=True),
description=topic
if (topic := getattr(channel, "topic", None))
else "\N{SPEECH BALLOON}: {} | \N{SPEAKER}: {} | \N{SATELLITE ANTENNA}: {}".format(
len(channel.text_channels),
len(channel.voice_channels),
len(channel.stage_channels),
)
if isinstance(channel, discord.CategoryChannel)
else discord.Embed.Empty,
description=(
topic
if (topic := getattr(channel, "topic", None))
else (
"\N{SPEECH BALLOON}: {} | \N{SPEAKER}: {} | \N{SATELLITE ANTENNA}: {}".format(
len(channel.text_channels),
len(channel.voice_channels),
len(channel.stage_channels),
)
if isinstance(channel, discord.CategoryChannel)
else discord.Embed.Empty
)
),
color=await ctx.embed_color(),
)
em.add_field(name=_("ID"), value=channel.id)
Expand Down
6 changes: 3 additions & 3 deletions datautils/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def __init__(self, entries):
async def format_page(self, menu: ChannelsMenu, entries):
e = discord.Embed(
title="{}:".format(_(KNOWN_CHANNEL_TYPES[menu.channel_type][1])),
description=chat.box("\n".join(c.name for c in entries))
if entries
else _("No channels"),
description=(
chat.box("\n".join(c.name for c in entries)) if entries else _("No channels")
),
)
e.set_footer(
text=_("Page {}/{} • {}: {} • Total channels: {}").format(
Expand Down
16 changes: 10 additions & 6 deletions godvilledata/godvilledata.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ async def godville(self, ctx, *, god: GodConverter):
text_header = "{} и его {}\n{}\n".format(
chat.bold(profile.god),
chat.bold(profile.name),
chat.italics(chat.escape(profile.motto.strip(), formatting=True))
if profile.motto
else chat.inline("Здесь ничего нет"),
(
chat.italics(chat.escape(profile.motto.strip(), formatting=True))
if profile.motto
else chat.inline("Здесь ничего нет")
),
)
if profile.arena_is_in_fight:
text_header += "В сражении: {}\n".format(profile.fight_type_rus)
Expand Down Expand Up @@ -207,9 +209,11 @@ async def godvillegame(self, ctx, *, godname: str):
text_header = "{} and his {}\n{}\n".format(
chat.bold(profile.god),
chat.bold(profile.name),
chat.italics(chat.escape(profile.motto.strip(), formatting=True))
if profile.motto
else chat.inline("Nothing here"),
(
chat.italics(chat.escape(profile.motto.strip(), formatting=True))
if profile.motto
else chat.inline("Nothing here")
),
)
if profile.arena_is_in_fight:
text_header += "In fight: {}\n".format(profile.fight_type_rus)
Expand Down
8 changes: 5 additions & 3 deletions leveler/commands/lvladmin/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ async def debug_info(self, ctx):
("DB lock locked", self._db_lock.locked()),
(
"DB lock queue",
"N/A"
if self._db_lock._waiters is None
else len(self._db_lock._waiters),
(
"N/A"
if self._db_lock._waiters is None
else len(self._db_lock._waiters)
),
),
("pymongo version", pymongoversion),
("motor version", motorversion),
Expand Down
25 changes: 16 additions & 9 deletions leveler/commands/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ async def top(
elif options.global_top and owner:
is_level = True if await self.config.global_levels() else False
title = "Global Exp Leaderboard for {}\n".format(self.bot.user.name)
async for userinfo in self.db.users.find({}).allow_disk_use(True).sort(
"total_exp", -1
async for userinfo in (
self.db.users.find({}).allow_disk_use(True).sort("total_exp", -1)
):
pos += 1
if is_level:
Expand Down Expand Up @@ -109,9 +109,11 @@ async def top(
icon_url = self.bot.user.display_avatar
elif options.rep:
title = "Rep Leaderboard for {}\n".format(server.name)
async for userinfo in self.db.users.find(
{f"servers.{server.id}": {"$exists": True}}
).allow_disk_use(True).sort("rep", -1):
async for userinfo in (
self.db.users.find({f"servers.{server.id}": {"$exists": True}})
.allow_disk_use(True)
.sort("rep", -1)
):
pos += 1
users.append(
(
Expand All @@ -137,10 +139,15 @@ async def top(
else:
is_level = True
title = "Exp Leaderboard for {}\n".format(server.name)
async for userinfo in self.db.users.find(
{f"servers.{server.id}": {"$exists": True}}
).allow_disk_use(True).sort(
[(f"servers.{server.id}.level", -1), (f"servers.{server.id}.current_exp", -1)]
async for userinfo in (
self.db.users.find({f"servers.{server.id}": {"$exists": True}})
.allow_disk_use(True)
.sort(
[
(f"servers.{server.id}.level", -1),
(f"servers.{server.id}.current_exp", -1),
]
)
):
pos += 1
if str(user.id) == userinfo["user_id"]:
Expand Down
16 changes: 9 additions & 7 deletions leveler/exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,22 @@ async def _handle_levelup(self, user, userinfo, server, channel):

async def _find_server_rank(self, user, server):
rank = 1
async for userinfo in self.db.users.find(
{f"servers.{server.id}": {"$exists": True}}
).allow_disk_use(True).sort(
[(f"servers.{server.id}.level", -1), (f"servers.{server.id}.current_exp", -1)]
async for userinfo in (
self.db.users.find({f"servers.{server.id}": {"$exists": True}})
.allow_disk_use(True)
.sort([(f"servers.{server.id}.level", -1), (f"servers.{server.id}.current_exp", -1)])
):
if userinfo["user_id"] == str(user.id):
return rank
rank += 1

async def _find_server_rep_rank(self, user, server):
rank = 1
async for userinfo in self.db.users.find(
{f"servers.{server.id}": {"$exists": True}}
).allow_disk_use(True).sort("rep", -1):
async for userinfo in (
self.db.users.find({f"servers.{server.id}": {"$exists": True}})
.allow_disk_use(True)
.sort("rep", -1)
):
if userinfo.get("user_id") == str(user.id):
return rank
rank += 1
Expand Down
8 changes: 5 additions & 3 deletions leveler/menus/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ def __init__(
async def format_page(self, menu: TopMenu, entries):
table = tabulate(
entries,
headers=["#", self.board_type, "Level", "Username"]
if self.is_level
else ["#", self.board_type, "Username"],
headers=(
["#", self.board_type, "Level", "Username"]
if self.is_level
else ["#", self.board_type, "Username"]
),
tablefmt="rst",
)
table_width = len(table.splitlines()[0])
Expand Down
26 changes: 14 additions & 12 deletions minecraftdata/minecraftdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,20 @@ async def java(self, ctx, query_data: Optional[bool], server_ip: str):
name=_("Players"),
value="{0.players.online}/{0.players.max}\n{1}".format(
status,
chat.box(
list(
chat.pagify(
await self.clear_mcformatting(
"\n".join([p.name for p in status.players.sample])
),
page_length=992,
)
)[0]
)
if status.players.sample
else "",
(
chat.box(
list(
chat.pagify(
await self.clear_mcformatting(
"\n".join([p.name for p in status.players.sample])
),
page_length=992,
)
)[0]
)
if status.players.sample
else ""
),
),
)
embed.add_field(
Expand Down
Loading
Loading