Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/2022.33.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
TurnrDev committed Aug 15, 2022
2 parents 760c5d0 + 1334094 commit 8486734
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 152 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [2021.30.1] - 2022-07-30
## [2021.33.0] - 2022-08-15
### Added
- Added Weekly Gains leaderboard
- Trial a 26-hour window system with achievements

## [2021.30.2] - 2022-07-30
### Changed
- We have OCR again! `/update image:` to use it

Expand Down Expand Up @@ -182,7 +187,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- `[p]progress (mention)`
- Settings commands

[Unreleased]: https://github.com/TrainerDex/ DiscordBot/compare/v2022.30.2...develop
[Unreleased]: https://github.com/TrainerDex/DiscordBot/compare/v2022.33.0...develop
[2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2022.30.2...v2022.33.0
[2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2022.30.1...v2022.30.2
[2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2022.30.0...v2022.30.1
[2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2021.43.0...v2022.30.0
Expand Down
2 changes: 1 addition & 1 deletion trainerdex_discord_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"""

VERSION = (2022, 30, 2, "final", 0)
VERSION = (2022, 33, 0, "final", 0)

__version__ = f"{VERSION[0]}.{VERSION[1]}.{VERSION[2]}-{VERSION[3]}.{VERSION[4]}"
8 changes: 6 additions & 2 deletions trainerdex_discord_bot/cogs/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,17 @@ async def _post_weekly_leaderboard(self, guild: Guild, config: GuildConfig):
Stats.GYM_GOLD,
)
}
combo_post = GainsLeaderboardView.format_combo_embed(leaderboard_data, minuend_datetime)
combo_post = GainsLeaderboardView.format_combo_embed(
leaderboard_data, minuend_datetime
)

message: Message = await leaderboard_channel.send(
f"It's {format_time(local_time)}, time to post the weekly leaderboard! The next leaderboard will be posted at {format_time(deadline)}.",
embed=combo_post,
)
thread: Thread = await message.create_thread(name=f"{minuend_datetime.date().isoformat()} Weekly Leaderboards")
thread: Thread = await message.create_thread(
name=f"{minuend_datetime.date().isoformat()} Weekly Leaderboards"
)

for gains_data in leaderboard_data.values():
embeds = GainsLeaderboardView.get_pages(gains_data)
Expand Down
4 changes: 3 additions & 1 deletion trainerdex_discord_bot/cogs/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ async def update_via_slash_command(
if image is not None:
await send(ctx, "Analyzing image...", delete_after=30)
try:
data_from_ocr: Dict[str, float] = await NewOCRClient.request_activity_view_scan(image)
data_from_ocr: Dict[str, float] = await NewOCRClient.request_activity_view_scan(
image
)
except Exception:
if not kwargs:
await send(
Expand Down
2 changes: 1 addition & 1 deletion trainerdex_discord_bot/cogs/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def user__profile(
user: User,
) -> None:
await ctx.defer()

trainer = await get_trainer_from_user(self.client, user)

if trainer is None or not trainer.is_visible:
Expand Down
29 changes: 16 additions & 13 deletions trainerdex_discord_bot/cogs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,16 @@ async def guild_config__tl40_role(self, ctx: ApplicationContext, value: Role) ->
async def guild_config__timezone(self, ctx: ApplicationContext, value: str) -> None:
"""Set the timezone for the server. This is used for the weekly leaderboard."""
guild_config: GuildConfig = await self.config.get_guild(ctx.guild)

try:
ZoneInfo(value.strip())
except ZoneInfoNotFoundError:
await send(
ctx,
f"Cannot set `timezone` to `{value}`. For a list of valid timezones, please check this table: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List ",
ephemeral=True,
)
ctx,
f"Cannot set `timezone` to `{value}`. For a list of valid timezones, please check this table: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List ",
ephemeral=True,
)

guild_config.timezone = value.strip()
await self.config.set_guild(guild_config)

Expand All @@ -312,19 +312,23 @@ async def guild_config__timezone(self, ctx: ApplicationContext, value: str) -> N
)

@guild_config.command(name="leaderboard-channel", checks=[check_member_privilage])
async def guild_config__leaderboard_channel(self, ctx: ApplicationContext, value: TextChannel) -> None:
"""Set a channel for the bot to post weekly leaderboard messages to."""
async def guild_config__leaderboard_channel(
self, ctx: ApplicationContext, value: TextChannel
) -> None:
"""Set a channel for the bot to post weekly leaderboard messages to."""
perms = value.permissions_for(ctx.me)

if not (perms.send_messages and perms.create_public_threads and perms.send_messages_in_threads):

if not (
perms.send_messages and perms.create_public_threads and perms.send_messages_in_threads
):
await send(
ctx,
"The channel must be able to be messaged and be able to create public threads. Leaderboard may not post.",
ephemeral=True,
)

guild_config: GuildConfig = await self.config.get_guild(ctx.guild)

guild_config.leaderboard_channel_id = value.id
await self.config.set_guild(guild_config)

Expand All @@ -348,7 +352,6 @@ async def guild_config__post_weekly_leaderboards(
f"Set `post_weekly_leaderboards` to `{value}`.",
ephemeral=True,
)


# @guild_config.command(name="introduction-note", checks=[check_member_privilage])
# async def guild_config__introduction_note(self, ctx: ApplicationContext, value: str) -> None:
Expand Down
Loading

0 comments on commit 8486734

Please sign in to comment.