64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import chalk from 'chalk';
|
|
import { Interaction } from 'discord.js';
|
|
|
|
import { MusicSubscription } from './subscription';
|
|
import { help } from "./commands/help.ts";
|
|
import { invalidCommand } from "./commands/invalid_command.ts";
|
|
import { leave } from "./commands/leave.ts";
|
|
import { loop } from "./commands/loop.ts"
|
|
import { np } from "./commands/np.ts";
|
|
import { pause } from "./commands/pause.ts";
|
|
import { play } from "./commands/play.ts";
|
|
import { skip } from "./commands/skip.ts";
|
|
import { unloop } from "./commands/unloop.ts";
|
|
|
|
export async function parseCommand(interaction: Interaction, subscription: MusicSubscription) {
|
|
if(!interaction) {
|
|
console.log(chalk.red("invalid interaction data was passed through somehow:"));
|
|
console.log(interaction);
|
|
return;
|
|
}
|
|
switch(interaction.commandName) {
|
|
case "help": {
|
|
await help(interaction);
|
|
break;
|
|
}
|
|
case "leave": {
|
|
await leave(interaction, subscription);
|
|
break;
|
|
}
|
|
case "loop": {
|
|
await loop(interaction, subscription);
|
|
break;
|
|
}
|
|
case "np": {
|
|
await np(interaction, subscription);
|
|
break;
|
|
}
|
|
case "pause": {
|
|
await pause(interaction, subscription);
|
|
break;
|
|
}
|
|
case "play": {
|
|
await play(interaction, subscription);
|
|
break;
|
|
}
|
|
case "skip": {
|
|
await skip(interaction, subscription);
|
|
break;
|
|
}
|
|
case "stop": {
|
|
await pause(interaction, subscription);
|
|
break;
|
|
}
|
|
case "unloop": {
|
|
await unloop(interaction, subscription);
|
|
break;
|
|
}
|
|
default: {
|
|
await invalidCommand(interaction, subscription);
|
|
break;
|
|
}
|
|
}
|
|
}
|