aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThongrapee Panyapatiphan <[email protected]>2021-10-01 22:33:39 +0700
committerThongrapee Panyapatiphan <[email protected]>2021-10-01 22:33:39 +0700
commit4364f459bed721bb2676bd7b5f6b9f2a99b33a2c (patch)
treed5c81f1c750997af0789c4122747262f6dfa979f
parent11eba5746dd8ba3497073c6e7855a43233ca896d (diff)
downloadmuse-4364f459bed721bb2676bd7b5f6b9f2a99b33a2c.tar.xz
muse-4364f459bed721bb2676bd7b5f6b9f2a99b33a2c.zip
Add playlist-limit in config command
-rw-r--r--src/commands/config.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/commands/config.ts b/src/commands/config.ts
index 0e5728a..13186fc 100644
--- a/src/commands/config.ts
+++ b/src/commands/config.ts
@@ -11,6 +11,7 @@ export default class implements Command {
public examples = [
['config prefix !', 'set the prefix to !'],
['config channel music-commands', 'bind the bot to the music-commands channel'],
+ ['config playlist-limit 30', 'set the playlist song limit to 30'],
];
public async execute(msg: Message, args: string []): Promise<void> {
@@ -20,7 +21,8 @@ export default class implements Command {
if (settings) {
let response = `prefix: \`${settings.prefix}\`\n`;
- response += `channel: ${msg.guild!.channels.cache.get(settings.channel)!.toString()}`;
+ response += `channel: ${msg.guild!.channels.cache.get(settings.channel)!.toString()}\n`;
+ response += `playlist-limit: ${settings.playlistLimit}`;
await msg.channel.send(response);
}
@@ -73,6 +75,18 @@ export default class implements Command {
break;
}
+ case 'playlist-limit': {
+ const playlistLimit = Number(args[1]);
+ if (!playlistLimit || playlistLimit <= 0) {
+ await msg.channel.send(errorMsg('please enter a valid number'));
+ return;
+ }
+
+ await Settings.update({playlistLimit}, {where: {guildId: msg.guild!.id}});
+ await msg.channel.send(`👍 playlist-limit updated to ${playlistLimit}`);
+ break;
+ }
+
default:
await msg.channel.send(errorMsg('I\'ve never met this setting in my life'));
}