feat: initial Papo bot scaffold
This commit is contained in:
15
src/config/context.ts
Normal file
15
src/config/context.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { CommandHandler } from '../services/commandHandler.js';
|
||||
import { AutoModService } from '../services/automodService.js';
|
||||
import { LoggingService } from '../services/loggingService.js';
|
||||
import { MusicService } from '../services/musicService.js';
|
||||
import { TicketService } from '../services/ticketService.js';
|
||||
import { LevelService } from '../services/levelService.js';
|
||||
|
||||
export const context = {
|
||||
commandHandler: null as CommandHandler | null,
|
||||
automod: new AutoModService(true, true),
|
||||
logging: new LoggingService(),
|
||||
music: new MusicService(),
|
||||
tickets: new TicketService(),
|
||||
leveling: new LevelService()
|
||||
};
|
||||
25
src/config/env.ts
Normal file
25
src/config/env.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
dotenv.config({ path: path.resolve(process.cwd(), '.env') });
|
||||
|
||||
const required = ['DISCORD_TOKEN', 'DISCORD_CLIENT_ID', 'DISCORD_GUILD_ID', 'DATABASE_URL'] as const;
|
||||
|
||||
required.forEach((key) => {
|
||||
if (!process.env[key]) {
|
||||
console.warn(`[config] Missing environment variable ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
export const env = {
|
||||
token: process.env.DISCORD_TOKEN ?? '',
|
||||
clientId: process.env.DISCORD_CLIENT_ID ?? '',
|
||||
guildId: process.env.DISCORD_GUILD_ID ?? '',
|
||||
guildIds: (process.env.DISCORD_GUILD_IDS ?? process.env.DISCORD_GUILD_ID ?? '')
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean),
|
||||
databaseUrl: process.env.DATABASE_URL ?? '',
|
||||
port: Number(process.env.PORT ?? 3000),
|
||||
sessionSecret: process.env.SESSION_SECRET ?? 'papo_dev_secret'
|
||||
};
|
||||
8
src/config/state.ts
Normal file
8
src/config/state.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface GuildSettings {
|
||||
welcomeChannelId?: string;
|
||||
logChannelId?: string;
|
||||
automodEnabled?: boolean;
|
||||
levelingEnabled?: boolean;
|
||||
}
|
||||
|
||||
export const settings = new Map<string, GuildSettings>();
|
||||
Reference in New Issue
Block a user