mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-12 21:05:29 +01:00
Add aliases
This commit is contained in:
parent
8340f9b95a
commit
de1e761623
|
@ -28,7 +28,9 @@ export default class {
|
|||
public async listen(): Promise<string> {
|
||||
// Load in commands
|
||||
container.getAll<Command>(TYPES.Command).forEach(command => {
|
||||
this.commands.set(command.name, command);
|
||||
const commandNames = [command.name, ...command.aliases];
|
||||
|
||||
commandNames.forEach(commandName => this.commands.set(commandName, command));
|
||||
});
|
||||
|
||||
this.client.on('message', async (msg: Message) => {
|
||||
|
|
|
@ -7,6 +7,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'clear';
|
||||
public aliases = ['c'];
|
||||
public examples = [
|
||||
['clear', 'clears all songs in queue except currently playing']
|
||||
];
|
||||
|
|
|
@ -7,6 +7,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'config';
|
||||
public aliases = [];
|
||||
public examples = [
|
||||
['config prefix !', 'set the prefix to !'],
|
||||
['config channel music-commands', 'bind the bot to the music-commands channel']
|
||||
|
|
|
@ -2,11 +2,13 @@ import {Message} from 'discord.js';
|
|||
import {TYPES} from '../types';
|
||||
import {inject, injectable} from 'inversify';
|
||||
import PlayerManager from '../managers/player';
|
||||
import errorMsg from '../utils/error-msg';
|
||||
import Command from '.';
|
||||
|
||||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'disconnect';
|
||||
public aliases = ['dc'];
|
||||
public examples = [
|
||||
['disconnect', 'pauses and disconnects player']
|
||||
];
|
||||
|
@ -20,6 +22,11 @@ export default class implements Command {
|
|||
public async execute(msg: Message, _: string []): Promise<void> {
|
||||
const player = this.playerManager.get(msg.guild!.id);
|
||||
|
||||
if (!player.voiceConnection) {
|
||||
await msg.channel.send(errorMsg('not connected'));
|
||||
return;
|
||||
}
|
||||
|
||||
player.disconnect();
|
||||
|
||||
await msg.channel.send('u betcha');
|
||||
|
|
|
@ -10,6 +10,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'fseek';
|
||||
public aliases = [];
|
||||
public examples = [
|
||||
['fseek 10', 'skips forward in current song by 10 seconds']
|
||||
];
|
||||
|
|
|
@ -8,6 +8,7 @@ import container from '../inversify.config';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'help';
|
||||
public aliases = ['h'];
|
||||
public examples = [
|
||||
['help', 'you don\'t need a description']
|
||||
];
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Message} from 'discord.js';
|
|||
|
||||
export default interface Command {
|
||||
name: string;
|
||||
aliases: string[];
|
||||
examples: string[][];
|
||||
execute: (msg: Message, args: string[]) => Promise<void>;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'pause';
|
||||
public aliases = [];
|
||||
public examples = [
|
||||
['pause', 'pauses currently playing song']
|
||||
];
|
||||
|
|
|
@ -15,6 +15,7 @@ import GetSongs from '../services/get-songs';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'play';
|
||||
public aliases = ['p'];
|
||||
public examples = [
|
||||
['play', 'resume paused playback'],
|
||||
['play https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'plays a YouTube video'],
|
||||
|
|
|
@ -7,6 +7,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'queue';
|
||||
public aliases = ['q'];
|
||||
public examples = [
|
||||
['queue', 'shows current queue']
|
||||
];
|
||||
|
|
|
@ -10,6 +10,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'seek';
|
||||
public aliases = [];
|
||||
public examples = [
|
||||
['seek 10', 'seeks to 10 seconds from beginning of song'],
|
||||
['seek 1:30', 'seeks to 1 minute and 30 seconds from beginning of song'],
|
||||
|
|
|
@ -7,6 +7,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'shortcuts';
|
||||
public aliases = [];
|
||||
public examples = [
|
||||
['shortcuts', 'show all shortcuts'],
|
||||
['shortcuts set s skip', 'aliases `s` to `skip`'],
|
||||
|
|
|
@ -8,6 +8,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'shuffle';
|
||||
public aliases = [];
|
||||
public examples = [
|
||||
['shuffle', 'shuffles the current queue']
|
||||
];
|
||||
|
|
|
@ -8,6 +8,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'skip';
|
||||
public aliases = ['s'];
|
||||
public examples = [
|
||||
['skip', 'skips the current song']
|
||||
];
|
||||
|
|
|
@ -9,6 +9,7 @@ import Command from '.';
|
|||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'unskip';
|
||||
public aliases = ['back'];
|
||||
public examples = [
|
||||
['unskip', 'goes back in the queue by one song']
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue