-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Make bookmark a context menu command #1176
Make bookmark a context menu command #1176
Conversation
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.
Hello, thanks for the PR!
Just a few issues 🙂
bot/exts/utilities/bookmark.py
Outdated
"""Sends the bookmark embed to the user with the newly chosen title.""" | ||
title = self.bookmark_title.value or self.bookmark_title.default | ||
await self.action_bookmark(interaction.channel, interaction.user, self.message, title) | ||
view = SendBookmark(self.action_bookmark, interaction.user, interaction.channel, self.message, title) |
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.
Since this message is ephemeral, I don't think there's a need for the button that says "Click this to get your very own bookmark" or whatever it was. The whole point of the button was that multiple people wouldn't be running the .bookmark command in succession to the same message and flooding the channel - but with ephemeral messages, that's not an issue. So I think this button would just lead to more confusion and is unnecessary.
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.
This one has also been resolved in cf49035
I just happened to make a new static method that builds an embed that's only used when the context menu command is invoked
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.
Alright, comments have been addressed and it's ready for review again
bot/exts/utilities/bookmark.py
Outdated
"""Sends the bookmark embed to the user with the newly chosen title.""" | ||
title = self.bookmark_title.value or self.bookmark_title.default | ||
await self.action_bookmark(interaction.channel, interaction.user, self.message, title) | ||
view = SendBookmark(self.action_bookmark, interaction.user, interaction.channel, self.message, title) |
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.
This one has also been resolved in cf49035
I just happened to make a new static method that builds an embed that's only used when the context menu command is invoked
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.
Played around with the command and noticed a few things:
- The command didn't seem to sync automatically, I had to run
.int eval `await bot.tree.sync()`
for it to appear. - The first time I use the command, this seems to stay there forever:
For bookmarks run after that it disappears normally, although after refreshing the client the same thing happens again. - Running the command in DMs with the bot gives a message saying you don't have permission to view that channel
It's pretty minor, and there's no point in allowing using the command in DMs, but the error message could be better.
Not sure if any of these are discord bugs rather than issues with the code, although worth looking into.
I think you might have missed the description, this relies on the newest release of pydis_core, where the tree is synced upon loading extensions. So that might be the reason. This has also happened to me, but since it threw no errors, i thought it could be a discord bug or something. Well, we could check if the interaction channel is part of a guild or not, if not then it's a DM --> we change the message So I think it's just better to agree on not allowing the usage of such command in DMs, and if that's the case, we send a message saying so. |
I noticed that but since the PR was merged I assumed Indeed, I'll send a PR to bump it. |
Looks like there are some commits from other PRs that shouldn't be here |
I think those are the results of the rebase ? |
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.
Also seems like the hanging command problem isn't there for me either any more👍
This removes the need of the `user_is_permitted_to_bookmark` func, and keeps the code cleaner & more coherent It always relis on using interaction.response to reply instead of context, which might result in a failed interaction
This bus was introduced upon refactoring the perms check, and it calls channel from within a channel.
This bus was introduced upon refactoring the perms check. It tries to access an author property from within a user, which doesn't exist.
This prompts the user for a custom title for their input. This has been added to not lose the functionality of adding a custom title for a bookmark for those who need it.
This will be sent along the ephemeral message
f262d72
to
0dae917
Compare
""" | ||
|
||
bookmark_title = discord.ui.TextInput( | ||
label="Choose a title for you bookmark (optional)", |
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.
label="Choose a title for you bookmark (optional)", | |
label="Choose a title for your bookmark (optional)", |
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.
NOTE
This needs to wait for this PR before it can be merged, since it will be the one syncing the command tree.
Once that has been completed & merged, bot-core version needs to be bumped and then merged into main, then this branch will be updated
Closes #1089
This adds the support of bookmarking a message from a context menu, but preserves the old behavior as well.
To not lose the functionality of choosing a custom title, a modal has been added where a user is prompted for a title, which they can freely skip.
Workflow
As usual, a user needs to identify a message to bookmark
A user hovers on the message, then clicks on the ellipsis (three dots) -> Apps -> Bookmark
A user will be asked to choose a custom title for their bookmark, but they can freely ignore that step by clicking on
Submit
and the default titleBookmark
will be chosenOnce submitted, the bookmark is sent as usual as a DM to the user, the only difference is that the bookmark embed in the invoked channel is now ephemeral