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
8 changes: 0 additions & 8 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,10 @@ export const config = {
channelId: optionalEnv('ONBOARDING_CHANNEL_ID'),
roleId: optionalEnv('ONBOARDING_ROLE_ID'),
},
// Add more config sections as needed:
// database: {
// url: requireEnv('DATABASE_URL'),
// },
// api: {
// openaiKey: optionalEnv('OPENAI_API_KEY'),
// },
};

export type Config = typeof config;

// Log loaded configuration (without sensitive values)
console.log('✅ Configuration loaded successfully');
console.log(
`📋 Client ID: ${config.discord.clientId ? config.discord.clientId : '❌ missing'}`
Expand Down
6 changes: 2 additions & 4 deletions src/features/docs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ export type ProviderConfig<Item = unknown> = {

createActionBuilders: (data: Collection<string, Item>) => ActionBuilders;

// Create result embeds to show after selection
createResultEmbeds: (
data: Collection<string, Item>
) => EmbedBuilder | EmbedBuilder[];

// Get display title for an item
getDisplayTitle: (item: Item) => string;

// Get selection content message
// e.g. "Select a result for **{query}**"
getSelectionMessage: (query: string) => string;

// Get display message after selection
// e.g. "Showing results for **{selected}**"
getDisplayMessage: (selectedTitles: string[]) => string;
};
1 change: 0 additions & 1 deletion src/features/docs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type { ProviderConfig } from './types.js';
export const SEARCH_TERM = '%SEARCH%';
export const TERM = '%TERM%';

// Utility functions
export const getSearchUrl = (url: string, search: string) => {
return url.replace(SEARCH_TERM, encodeURIComponent(search));
};
Expand Down
1 change: 0 additions & 1 deletion src/features/guides/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { createSlashCommand } from '../../common/commands/create-commands.js';
import { logToChannel } from '../../util/channel-logging.js';
import { loadMarkdownOptions } from '../../util/markdown.js';

// const subjectsDir = new URL('assets/guides', import.meta.url);
const subjectsDir = path.join(process.cwd(), 'assets/guides');

const subjectChoices = new Map<string, string>();
Expand Down
1 change: 0 additions & 1 deletion src/features/guild-create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const guildCreateEvent = createEvent(
name: Events.GuildCreate,
},
async (guild) => {
// Leave the server if it's not the allowed one
await leaveIfNotAllowedServer(guild);
}
);
1 change: 0 additions & 1 deletion src/features/just-ask/just-ask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const askToAskPattern = new RegExp(
export const isAskingToAsk = (text: string) => askToAskPattern.test(text);

const [response] = await loadMarkdownOptions<{ name: string }>(
// new URL('../tips/subjects/', import.meta.url),
path.join(process.cwd(), 'assets/tips/'),
'justask.md'
);
Expand Down
1 change: 0 additions & 1 deletion src/features/onboarding/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
type MessageActionRowComponentBuilder,
} from 'discord.js';

// Exported at the bottom after all child components are added
const containerComponent = new ContainerBuilder();

const actionRowComponent =
Expand Down
1 change: 0 additions & 1 deletion src/features/tips/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import { logToChannel } from '@/util/channel-logging.js';
import { loadMarkdownOptions } from '@/util/markdown.js';

// const subjectsDir = new URL('assets/tips', import.meta.url);
const subjectsDir = path.join(process.cwd(), 'assets/tips');

const subjectChoices = new Map<string, string>();
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ActivityType, Client, GatewayIntentBits } from 'discord.js';
import { loadEvents } from './common/events/load-events.js';
import { config } from './env.js';

// Create a new client instance
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
Expand Down
2 changes: 0 additions & 2 deletions src/loadEnvFile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';

// Simple .env loader without external dependencies
function loadEnvFile(filePath: string) {
if (!existsSync(filePath)) {
console.warn(`Warning: File ${filePath} not found`);
Expand Down Expand Up @@ -32,7 +31,6 @@ function loadEnvFile(filePath: string) {
}
}

// Determine environment (defaults to development)
const nodeEnv = process.env.NODE_ENV || 'development';
console.log(`🌍 Environment: ${nodeEnv}`);

Expand Down
2 changes: 0 additions & 2 deletions src/util/advent-scheduler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { promises as fs } from 'node:fs';
import test from 'node:test';
import { config } from '@/env.js';

// Import after setting env var
const { loadTracker, saveTracker } = await import('./advent-scheduler.js');

async function cleanupTestTracker() {
Expand Down Expand Up @@ -45,6 +44,5 @@ void test('advent scheduler: tracker file operations', async (t) => {
assert.ok(loaded['2025'].includes(25));
});

// Cleanup
await cleanupTestTracker();
});
1 change: 0 additions & 1 deletion src/util/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export const loadMarkdownOptions = async <T extends Record<string, unknown>>(
const results: Array<{ frontmatter: Partial<T>; content: string }> = [];

for (const file of markdownFiles) {
// const filePath = new URL(`${path}/${file}`, import.meta.url);
const filePath = path.join(sourcePath.toString(), file);

const fileContent = await readFile(filePath, 'utf-8');
Expand Down
7 changes: 2 additions & 5 deletions src/util/post-guides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ export type GuideTracker = {
};
};

// const GUIDES_DIR = fileURLToPath(new URL('../features/guides/subjects/', import.meta.url));
const GUIDES_DIR = path.join(process.cwd(), 'assets/guides');

// const TRACKER_FILE = config.guidesTrackerPath ?? 'guides-tracker.json';
const TRACKER_FILE =
config.guidesTrackerPath ?? path.join(process.cwd(), 'guides-tracker.json');

Expand Down Expand Up @@ -162,14 +160,13 @@ export const syncGuidesToChannel = async (
const tracker = await loadTracker();
const currentGuides = await scanGuideFiles();

// Create maps for easier lookup
const currentGuideMap = new Map(
currentGuides.map((guide) => [guide.filename, guide])
);
const trackedFiles = new Set(Object.keys(tracker));
const currentFiles = new Set(currentGuides.map((guide) => guide.filename));

// Find changes
// Check for changes
const newFiles = [...currentFiles].filter(
(file) => !trackedFiles.has(file)
);
Expand Down Expand Up @@ -246,7 +243,7 @@ export const initializeGuidesChannel = async (
): Promise<void> => {
console.log('🚀 Initializing guides channel...');

// Clear existing tracker for fresh start
// Clear existing tracker
await saveTracker({});

await syncGuidesToChannel(client, channelId);
Expand Down
Loading