feat: add admin /logs command to view bot log lines#39
Merged
Conversation
✅ Coverage Report
New Files
Changed Files
|
There was a problem hiding this comment.
Pull request overview
Adds an admin-only /logs slash command to view the tail of the bot’s logs/combined.log from within Discord, along with registration and help text updates and a new test suite.
Changes:
- Introduce
/logscommand with an optionallinesparameter, embed output, and truncation to Discord limits. - Register the new command in the bot’s command list.
- Add
/logsto the help embed and add a dedicated test file for the command.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/bot/commands/logs.ts | Implements the new /logs command, file tail reading, and embed formatting/truncation. |
| src/bot/commands/logs.test.ts | Adds unit tests covering permissions, missing file, tail selection, truncation, and errors. |
| src/bot/commands/help.ts | Adds a help entry documenting /logs. |
| src/bot/bot.ts | Imports and registers logsCommand for slash command deployment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6da1ccf to
48b47b8
Compare
Signed-off-by: Michael Cramer <michael@bigmichi1.de>
48b47b8 to
66767e6
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a new admin-only
/logsslash command that displays the last N lines of the bot'scombined.logfile directly in Discord.Changes
src/bot/commands/logs.ts— New/logscommandManageMessagespermission, same gate as/backfill)linesinteger parameter (1–100, defaults to 20)logs/combined.logand returns it in a code-block embed (ephemeral)src/bot/bot.ts— Import and registerlogsCommandsrc/bot/commands/help.ts— Add/logsentry to the help embedTests
src/bot/commands/logs.test.ts— 10 new tests (292 total, up from 282)readFileSyncthrowsCoverage for
logs.ts: 100% functions / 98.61% lines. No existing file coverage decreased.