Skip to content

Feature/botmessage#53

Open
ilikecubesnstuff wants to merge 13 commits intorewritefrom
feature/botmessage
Open

Feature/botmessage#53
ilikecubesnstuff wants to merge 13 commits intorewritefrom
feature/botmessage

Conversation

@ilikecubesnstuff
Copy link
Copy Markdown
Collaborator

Addresses #9, along with other changes. Notable changes include:

  • Updated test suite following the move to tortoise ORM v1.0.
  • Updated workflows for pushes and pull requests, including running tests.
  • Renamed cog from "Embeds" to "BotMessage", with the following interface:
    • &send for sending arbitrary messages, including those with embeds.
    • &edit for editing an existing bot message, including those with embeds.
    • &embedraw legacy command, which sends warnings and updated JSON syntax when invoked.
    • 3 context menu commands for retrieving JSON, adding embeds, and editing messages.

Modify checks to allow for interoperability with application commands.
Lumped everything under the cog's class with more sensible ordering.
Update test suite to work with latest version of tortoise ORM. Notable changes include refreshing cached methods in tests, and adding tzdata to the dev dependencies.
Tests are now run on pull requests, while codestyle checks are only run on pushes.
@ilikecubesnstuff ilikecubesnstuff linked an issue Feb 17, 2026 that may be closed by this pull request
@ilikecubesnstuff
Copy link
Copy Markdown
Collaborator Author

Note for future: how to run tests is not documented anywhere at the moment?
uv run pytest will only work once the docker-compose.test.yml file is run and the test database is active to interact with.

Copy link
Copy Markdown
Contributor

@archivehaze archivehaze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this PR, thank you for adding the workflows and changing the tests so they run under tortoise orm. Just one question, did you add the changes that we discussed about the error message when attempting to edit a message that the bot didn't send? Also, is the check to see if they manage the guild necessary? As far as I'm aware, that checks if the user is an admin, but won't the admins also have the moderator role?

Add bot self-message checks inside context menu callbacks.
Remove unnecessary tests, and add new tests for ensuring non-bot messages are met with the correct response.
@ilikecubesnstuff
Copy link
Copy Markdown
Collaborator Author

Thanks for the comments! Addressing each point:

Just one question, did you add the changes that we discussed about the error message when attempting to edit a message that the bot didn't send?

Turns out I managed to delete the code that actually registers the context menu commands to the command tree. That's added back in now, but there were hiccups in the checks I had implemented for this. I've now shifted this validation logic inside the callback, and it should work as you described above.

Also, is the check to see if they manage the guild necessary? As far as I'm aware, that checks if the user is an admin, but won't the admins also have the moderator role?

From my understanding, this ensures that the command works when invoked by an admin, even if they happen to be missing the moderator role. This reflects the logic in src/ib_py/utils/checks.py:

def staff_command():
    return commands.check_any(commands.check(is_moderator), admin_command())

Unless there is a need to change this, I think that this fallback behavior is what is preferred/expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed/Embedraw

2 participants