Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Complete configuration reference for all KoolBot settings.
- [Achievements System](#-achievements-system)
- [Reaction Roles](#-reaction-roles)
- [Leaderboard Role Rewards](#-leaderboard-role-rewards)
- [Discord Logging](#-discord-logging)
- [Rate Limiting](#-rate-limiting)
- [Permissions & Access Control](#-permissions--access-control)
- [Configuration Management](#-configuration-management) — Using the Web UI
Expand Down Expand Up @@ -570,50 +569,6 @@ calculations:

---

## 📝 Discord Logging

Send bot events and logs to Discord channels.

### Startup / shutdown logging

| Setting | Default | Description |
| --- | --- | --- |
| `core.startup.enabled` | `false` | Enable startup/shutdown event logging |
| `core.startup.channel_id` | `""` | Channel ID for startup/shutdown logs |

### Error logging

| Setting | Default | Description |
| --- | --- | --- |
| `core.errors.enabled` | `false` | Enable error logging |
| `core.errors.channel_id` | `""` | Channel ID for error logs |

### Cleanup logging

| Setting | Default | Description |
| --- | --- | --- |
| `core.cleanup.enabled` | `false` | Enable cleanup operation logging |
| `core.cleanup.channel_id` | `""` | Channel ID for cleanup logs |

### Configuration logging

| Setting | Default | Description |
| --- | --- | --- |
| `core.config.enabled` | `false` | Enable configuration change logging |
| `core.config.channel_id` | `""` | Channel ID for config logs |

### Cron job logging

| Setting | Default | Description |
| --- | --- | --- |
| `core.cron.enabled` | `false` | Enable scheduled task logging |
| `core.cron.channel_id` | `""` | Channel ID for cron logs |

You can point every category at the same channel for a consolidated log,
or split them across `#bot-status`, `#admin-alerts`, `#bot-logs`, etc.

---

## 🔒 Rate Limiting

Protect your bot from command spam with global rate limiting.
Expand Down Expand Up @@ -820,19 +775,6 @@ above).
- `voicetracking.cleanup.retention.monthly_summaries_months` (number, default: 6)
- `voicetracking.cleanup.retention.yearly_summaries_years` (number, default: 1)

#### Discord Logging

- `core.startup.enabled` (bool, default: false)
- `core.startup.channel_id` (string, default: "")
- `core.errors.enabled` (bool, default: false)
- `core.errors.channel_id` (string, default: "")
- `core.cleanup.enabled` (bool, default: false)
- `core.cleanup.channel_id` (string, default: "")
- `core.config.enabled` (bool, default: false)
- `core.config.channel_id` (string, default: "")
- `core.cron.enabled` (bool, default: false)
- `core.cron.channel_id` (string, default: "")

#### Rate Limiting

- `ratelimit.enabled` (bool, default: false)
Expand Down
6 changes: 0 additions & 6 deletions __tests__/services/config-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ describe('Config Schema', () => {
expect(defaultConfig['quotes.enabled']).toBe(false);
});

it('should have core.cleanup.channel_id empty by default', () => {
// Other core.* keys were declared but never read and have been removed.
expect(defaultConfig['core.cleanup.channel_id']).toBe('');
});

it('should have reasonable default values for voice channel settings', () => {
expect(defaultConfig['voicechannels.category.name']).toBe('Voice Channels');
expect(defaultConfig['voicechannels.lobby.name']).toBe('Lobby');
Expand All @@ -43,7 +38,6 @@ describe('Config Schema', () => {
});

it('should have channel_id fields as strings', () => {
expect(typeof defaultConfig['core.cleanup.channel_id']).toBe('string');
expect(typeof defaultConfig['quotes.channel_id']).toBe('string');
expect(typeof defaultConfig['reactionroles.message_channel_id']).toBe('string');
});
Expand Down
2 changes: 0 additions & 2 deletions __tests__/web/admin-views.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,6 @@ describe("renderDatabasePage", () => {
isScheduled: false,
isRunning: false,
lastRun: "—",
notificationChannel: null,
detailedDays: 30,
monthlyMonths: 6,
yearlyYears: 1,
Expand Down Expand Up @@ -874,7 +873,6 @@ describe("renderDatabasePage", () => {
isScheduled: true,
isRunning: false,
lastRun: "—",
notificationChannel: null,
detailedDays: 30,
monthlyMonths: 6,
yearlyYears: 1,
Expand Down
20 changes: 0 additions & 20 deletions src/services/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export interface ConfigSchema {
"quotes.header_message_id": string; // Message ID of the header post
"quotes.header_pin_enabled": boolean; // Pin the header post

// Core Bot Logging (Discord) - only cleanup is wired up; other core.* keys
// were declared but never read and have been removed. See issues #440/#443.
"core.cleanup.channel_id": string;

// Rate Limiting
"ratelimit.enabled": boolean;
"ratelimit.max_commands": number; // Maximum commands per time window
Expand Down Expand Up @@ -126,9 +122,6 @@ export const defaultConfig: ConfigSchema = {
"quotes.header_message_id": "", // Stores header message ID
"quotes.header_pin_enabled": true, // Pin header for easy access

// Core Bot Logging (Discord) - only cleanup is wired up.
"core.cleanup.channel_id": "",

// Rate Limiting defaults
"ratelimit.enabled": false,
"ratelimit.max_commands": 5, // 5 commands
Expand Down Expand Up @@ -238,11 +231,6 @@ export const categoryMetadata: Record<string, CategoryMetadata> = {
title: "Quotes",
description: "Collect and curate memorable quotes in a dedicated channel.",
},
core: {
title: "Core Logging",
description:
"Discord-channel notifications for selected bot events. Most of this namespace was retired in #440 / #443; only the cleanup-job notification channel remains.",
},
ratelimit: {
title: "Rate Limiting",
description:
Expand Down Expand Up @@ -500,14 +488,6 @@ export const settingsMetadata: Record<keyof ConfigSchema, SettingMetadata> = {
type: "boolean",
},

// Core Bot Logging (Discord)
"core.cleanup.channel_id": {
label: "Cleanup-job notifications channel",
description: "Channel ID for cleanup-job notifications.",
category: "core",
type: "channel",
},

// Rate Limiting
"ratelimit.enabled": {
label: "Rate limiting enabled",
Expand Down
15 changes: 0 additions & 15 deletions src/services/voice-channel-truncation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,6 @@ export class VoiceChannelTruncationService {
};
}

/**
* Get the notification channel ID
*/
public async getNotificationChannel(): Promise<string | null> {
try {
return await this.configService.getString("core.cleanup.channel_id", "");
} catch (error) {
logger.debug(
"Failed to get notification channel, defaulting to null:",
error,
);
return null;
}
}

/**
* Get the cleanup schedule
*/
Expand Down
2 changes: 0 additions & 2 deletions src/web/admin-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,6 @@ export interface DatabaseProps extends CommonProps {
isScheduled: boolean;
isRunning: boolean;
lastRun: string;
notificationChannel: { name: string; id: string } | null;
detailedDays: number;
monthlyMonths: number;
yearlyYears: number;
Expand Down Expand Up @@ -1476,7 +1475,6 @@ ${renderFlash(props.flash)}
<dt>Scheduled</dt><dd>${props.trunk.isScheduled ? '<span class="tag tag-on">yes</span>' : '<span class="tag tag-off">no</span>'}</dd>
<dt>Currently running</dt><dd>${props.trunk.isRunning ? '<span class="tag tag-warn">yes</span>' : '<span class="tag tag-on">idle</span>'}</dd>
<dt>Last run</dt><dd class="muted">${escapeHtml(props.trunk.lastRun)}</dd>
<dt>Notification channel</dt><dd>${props.trunk.notificationChannel ? `#${escapeHtml(props.trunk.notificationChannel.name)} <span class="muted mono">${escapeHtml(props.trunk.notificationChannel.id)}</span>` : '<span class="muted">unset</span>'}</dd>
<dt>Detailed sessions retention</dt><dd>${props.trunk.detailedDays} days</dd>
<dt>Monthly summaries retention</dt><dd>${props.trunk.monthlyMonths} months</dd>
<dt>Yearly summaries retention</dt><dd>${props.trunk.yearlyYears} years</dd>
Expand Down
52 changes: 17 additions & 35 deletions src/web/read-only-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,33 +703,23 @@ export function createReadOnlyRouter(
const config = ConfigService.getInstance();
const status = truncation.getStatus();

const [
enabled,
schedule,
notificationChannelId,
detailedDays,
monthlyMonths,
yearlyYears,
channelData,
] = await Promise.all([
truncation.isEnabled(),
truncation.getSchedule(),
truncation.getNotificationChannel(),
config.getNumber(
"voicetracking.cleanup.retention.detailed_sessions_days",
30,
),
config.getNumber(
"voicetracking.cleanup.retention.monthly_summaries_months",
6,
),
config.getNumber(
"voicetracking.cleanup.retention.yearly_summaries_years",
1,
),
fetchChannelData(client, common.guildId),
]);
const channelNames = channelData.names;
const [enabled, schedule, detailedDays, monthlyMonths, yearlyYears] =
await Promise.all([
truncation.isEnabled(),
truncation.getSchedule(),
config.getNumber(
"voicetracking.cleanup.retention.detailed_sessions_days",
30,
),
config.getNumber(
"voicetracking.cleanup.retention.monthly_summaries_months",
6,
),
config.getNumber(
"voicetracking.cleanup.retention.yearly_summaries_years",
1,
),
]);

const collections: Array<{ name: string; count: number }> = [];
if (mongoose.connection.readyState === 1 && mongoose.connection.db) {
Expand Down Expand Up @@ -802,14 +792,6 @@ export function createReadOnlyRouter(
lastRun: status.lastCleanupDate
? status.lastCleanupDate.toISOString()
: "—",
notificationChannel: notificationChannelId
? {
name:
channelNames.get(notificationChannelId) ??
notificationChannelId,
id: notificationChannelId,
}
: null,
detailedDays,
monthlyMonths,
yearlyYears,
Expand Down
Loading