rashi-discord-bot-lib
Version:
🚀 Powerful Discord bot framework with built-in database, event handling, and utilities
179 lines • 4.91 kB
TypeScript
import { Client, Message, AutocompleteInteraction, ChatInputCommandInteraction, PermissionResolvable } from "discord.js";
import { BotStatistics } from "../utils/BotStatistics";
export interface LoggerOptions {
name: string;
color?: string;
debug?: boolean;
}
export type MusicSearchPlatform = "youtube" | "youtubemusic" | "soundcloud" | "spotify" | "ytsearch";
interface MusicNodeConfig {
name: string;
host: string;
port: number;
password: string;
secure?: boolean;
}
export interface MusicConfig {
/** czy włączyć system muzyki */
enable: boolean;
/** platforma domyślna */
defaultSearchEngine?: MusicSearchPlatform;
/** lista node'ów lavalink */
nodes: MusicNodeConfig[];
}
export interface BotStarterOptions {
bot: {
token: string;
logs?: LogsConfig;
avatar?: string;
BotInfo?: BotInfoConfig;
Database: DatabaseConfig;
};
AI?: AIConfig;
Music?: Partial<MusicConfig>;
events: EventsConfig;
commands?: CommandsConfig;
anticrash?: AntiCrashConfig;
}
export interface AIConfig {
openaiKey?: string;
googleKey?: string;
stabilityKey?: string;
}
export interface LogsConfig {
devLogs?: {
enable: boolean;
pathToWatch: string;
webhookURL: string;
mention?: string;
};
terminal?: boolean;
updates?: {
webhookURL?: string;
mentionId?: string;
};
}
export interface BotInfoConfig {
perms?: string[];
serverId?: string;
botInvite?: string;
serverInvite?: string;
ownerId?: string;
avatar?: string;
}
export interface DatabaseConfig {
verse?: VerseConfig;
mongo?: MongoConfig;
}
export interface VerseConfig {
adapterType: "json" | "yaml" | "sql" | "mongo" | "sqlite";
path?: string;
mongoURI?: string;
dbName?: string;
collection?: string;
documentId?: string;
dev?: {
enable: boolean;
logsPath?: string;
};
secure?: {
enable: boolean;
secret: string;
};
}
export interface MongoConfig {
mongoURI?: string;
}
export interface DatabaseAdapter {
read(): Promise<any>;
write(data: any): Promise<void>;
exists(): boolean;
backup(path: string): Promise<void>;
restore(path: string): Promise<void>;
connect?(): Promise<void>;
disconnect?(): Promise<void>;
}
export interface VerseDatabase {
get(key: string): any;
set(key: string, value: any): Promise<void>;
delete(key: string): Promise<void>;
has(key: string): boolean;
all(): any[];
clear(): Promise<void>;
backup(path?: string): Promise<void>;
restore(path: string): Promise<void>;
getStats(): Promise<{
adapter: string;
keys: number;
size: number;
}>;
}
export interface EventsConfig {
path: string;
recursive?: boolean;
eventBlacklist?: string[];
}
export interface CommandsConfig {
slashPath?: string;
prefixPath?: string;
prefix?: string;
}
export interface AntiCrashConfig {
enable: boolean;
webhookURL: string;
mention?: string;
}
export interface CommandOptions {
cooldown?: number;
fastUse?: boolean;
permissions?: PermissionResolvable[];
ownerOnly?: boolean;
devOnly?: boolean;
guildOnly?: boolean;
dmOnly?: boolean;
cooldownKey?: (ctx: {
userId: string;
guildId?: string;
command: string;
}) => string;
onError?: (error: unknown) => void | Promise<void>;
}
export type AnySlashBuilder = import("discord.js").SlashCommandBuilder | import("discord.js").SlashCommandSubcommandsOnlyBuilder | import("discord.js").SlashCommandOptionsOnlyBuilder;
export interface SlashCommand extends CommandOptions {
data: AnySlashBuilder;
execute: (interaction: ChatInputCommandInteraction, client: Client, language: string) => Promise<void>;
autocomplete?: (interaction: AutocompleteInteraction) => Promise<any>;
}
export interface PrefixCommand extends CommandOptions {
name: string;
description: string;
aliases?: string[];
usage?: string;
execute: (message: Message, args: string[], client: Client, language: string) => Promise<void>;
}
export interface Event {
name: string;
once?: boolean;
execute: (...args: any[]) => Promise<void>;
}
export interface BotStartResult {
client: Client;
versedb?: any;
mongodb?: any;
slashSize: number;
prefixSize: number;
eventSize: number;
getDb?: () => any;
db?: any;
statistics: BotStatistics;
ai?: AIComponents;
}
export interface AIComponents {
chat?: import("../ai/AIChat").AIChat;
tts?: import("../ai/TTSService").TTSService;
stt?: import("../ai/STTService").STTService;
image?: import("../ai/ImageGenerator").ImageGenerator;
memory?: import("../ai/ChatMemory").ChatMemory;
}
export {};
//# sourceMappingURL=index.d.ts.map