-
-
Notifications
You must be signed in to change notification settings - Fork 41
REFACTOR: bookmark service #918
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b9c797a
wip changes
meatsnails 89691c3
Merge branch 'main' of https://github.com/cherryl1k/tux
meatsnails 38c22a5
Merge branch 'allthingslinux:main' into main
meatsnails 56bebaf
Added removing bookmarks from the bot's DMs
meatsnails 217c364
fix(bookmarks): improve emoji validation and error handling for user …
electron271 b8a4072
added eletrons changes and fixed a warning
meatsnails f16d0f9
Merge branch 'main' of https://github.com/cherryl1k/tux
meatsnails 34798e9
i think i fixed whatever the hell git just did
meatsnails e9119ab
Merge branch 'allthingslinux:main' into main
meatsnails 72d3054
Merge branch 'allthingslinux:main' into main
meatsnails b547dd4
Merge branch 'main' of https://github.com/cherryl1k/tux
meatsnails 0b4d6d9
Merge branch 'allthingslinux:main' into main
meatsnails ba2c381
chore(wip): still working on debugging
meatsnails 1c5f20e
wip changes
meatsnails bdb6103
Added removing bookmarks from the bot's DMs
meatsnails 66f4df9
added eletrons changes and fixed a warning
meatsnails b5dcbb7
fix(bookmarks): improve emoji validation and error handling for user …
electron271 2ce131a
chore(wip): still working on debugging
meatsnails 5d36f15
Merge branch 'main' of https://github.com/cherryl1k/tux
meatsnails e0148cd
Merge branch 'main' of https://github.com/allthingslinux/tux
meatsnails 61d1a22
feat:(bookmarks) cleaned up removing bookmarks
meatsnails 67b53e2
Merge branch 'main' into main
kzndotsh e1d0024
feat(bookmarks): enhance bookmark functionality with improved error h…
kzndotsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| from typing import cast | ||
|
|
||
| import discord | ||
| from discord import app_commands | ||
| from discord.ext import commands | ||
|
|
@@ -74,13 +76,15 @@ | |
| # get reaction from payload.message_id, payload.channel_id, payload.guild_id, payload.emoji | ||
| channel = self.bot.get_channel(payload.channel_id) | ||
| if channel is None: | ||
| logger.error(f"Channel with ID {payload.channel_id} not found.") | ||
| return | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Type check for channel is removed, which may allow unsupported channel types. Without the type check, casting to TextChannel or Thread may be unsafe and could result in runtime errors if the channel is not of the expected type. |
||
| if isinstance(channel, discord.ForumChannel | discord.CategoryChannel | discord.abc.PrivateChannel): | ||
| logger.error( | ||
| f"Channel with ID {payload.channel_id} is not a compatible channel type. How the fuck did you get here?", | ||
| ) | ||
| return | ||
| try: | ||
| channel = await self.bot.fetch_channel(payload.channel_id) | ||
| except discord.NotFound: | ||
| logger.error(f"Channel not found for ID: {payload.channel_id}") | ||
| return | ||
| except (discord.Forbidden, discord.HTTPException) as fetch_error: | ||
| logger.error(f"Failed to fetch channel: {fetch_error}") | ||
| return | ||
| channel = cast(discord.TextChannel | discord.Thread, channel) | ||
|
|
||
| message = await channel.fetch_message(payload.message_id) | ||
| # Lookup the reaction object for this event | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Instantiating aiohttp.ClientSession in init may cause warnings.
Move ClientSession creation to an async initialization method to prevent deprecation warnings and ensure compatibility with future aiohttp versions.
Suggested implementation: