From 1ad6cb5ebe4a710c14bf5bb82e6acde1196b6926 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sat, 14 May 2022 12:40:48 -0400 Subject: [PATCH] Remove /config set-role --- CHANGELOG.md | 2 ++ .../migration.sql | 21 +++++++++++++++++++ schema.prisma | 1 - src/commands/config.ts | 8 ------- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 migrations/20220514164137_remove_role_id/migration.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 52b611c..93e285e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Fully remove `/config set-role` ## [2.0.1] - 2022-05-13 ### Changed diff --git a/migrations/20220514164137_remove_role_id/migration.sql b/migrations/20220514164137_remove_role_id/migration.sql new file mode 100644 index 0000000..681059c --- /dev/null +++ b/migrations/20220514164137_remove_role_id/migration.sql @@ -0,0 +1,21 @@ +/* + Warnings: + + - You are about to drop the column `roleId` on the `Setting` table. All the data in the column will be lost. + +*/ +-- RedefineTables +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_Setting" ( + "guildId" TEXT NOT NULL PRIMARY KEY, + "playlistLimit" INTEGER NOT NULL DEFAULT 50, + "secondsToWaitAfterQueueEmpties" INTEGER NOT NULL DEFAULT 30, + "leaveIfNoListeners" BOOLEAN NOT NULL DEFAULT true, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL +); +INSERT INTO "new_Setting" ("createdAt", "guildId", "leaveIfNoListeners", "playlistLimit", "secondsToWaitAfterQueueEmpties", "updatedAt") SELECT "createdAt", "guildId", "leaveIfNoListeners", "playlistLimit", "secondsToWaitAfterQueueEmpties", "updatedAt" FROM "Setting"; +DROP TABLE "Setting"; +ALTER TABLE "new_Setting" RENAME TO "Setting"; +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON; diff --git a/schema.prisma b/schema.prisma index 5b4e898..556cd6b 100644 --- a/schema.prisma +++ b/schema.prisma @@ -28,7 +28,6 @@ model Setting { playlistLimit Int @default(50) secondsToWaitAfterQueueEmpties Int @default(30) leaveIfNoListeners Boolean @default(true) - roleId String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } diff --git a/src/commands/config.ts b/src/commands/config.ts index 55dab71..cc3fd3e 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -17,13 +17,6 @@ export default class implements Command { .setName('limit') .setDescription('maximum number of tracks') .setRequired(true))) - .addSubcommand(subcommand => subcommand - .setName('set-role') - .setDescription('set the role that is allowed to use the bot') - .addRoleOption(option => option - .setName('role') - .setDescription('allowed role') - .setRequired(true))) .addSubcommand(subcommand => subcommand .setName('set-wait-after-queue-empties') .setDescription('set the time to wait before leaving the voice channel when queue empties') @@ -111,7 +104,6 @@ export default class implements Command { const settingsToShow = { 'Playlist Limit': config.playlistLimit, - Role: config.roleId ? `<@&${config.roleId}>` : 'not set', 'Wait before leaving after queue empty': config.secondsToWaitAfterQueueEmpties === 0 ? 'never leave' : `${config.secondsToWaitAfterQueueEmpties}s`,