diff --git a/.env.example b/.env.example index fecbad606..c17b35fc2 100644 --- a/.env.example +++ b/.env.example @@ -14,9 +14,6 @@ DEBUG_TEXT_CHANNEL_ID= BOT_PREFIX=, ALERT_WEBHOOK_URL= AUDIO_SONGS_PER_ARTIST= -PREMIUM_AUDIO_SONGS_PER_ARTIST= -PATREON_CREATOR_ACCESS_TOKEN= -PATREON_CAMPAIGN_ID= SPOTIFY_CLIENT_ID= SPOTIFY_CLIENT_SECRET= DAISUKI_SEED_CRON_JOB= diff --git a/.github/workflows/gci-e2e.yml b/.github/workflows/gci-e2e.yml index d300dce80..3b9d97261 100644 --- a/.github/workflows/gci-e2e.yml +++ b/.github/workflows/gci-e2e.yml @@ -30,7 +30,6 @@ jobs: DB_USER_CI: root DB_PORT: 3306 AUDIO_SONGS_PER_ARTIST: 10 - PREMIUM_AUDIO_SONGS_PER_ARTIST: 50 steps: - name: Checkout KMQ_Discord uses: actions/checkout@v2 @@ -45,7 +44,6 @@ jobs: echo "BOT_TOKEN=$BOT_TOKEN" >> .env echo "WEB_SERVER_PORT=5858" >> .env echo "SONG_DOWNLOAD_DIR=/songs" >> .env - echo "PREMIUM_AUDIO_SONGS_PER_ARTIST=$PREMIUM_AUDIO_SONGS_PER_ARTIST" >> .env echo "AUDIO_SONGS_PER_ARTIST=$AUDIO_SONGS_PER_ARTIST" >> .env echo "BOT_CLIENT_ID=123" >> .env echo "BOT_PREFIX=." >> .env @@ -92,7 +90,7 @@ jobs: - name: Parse pre-upgrade container ID id: old-container-id run: | - docker ps + docker ps echo OLD_CONTAINER_ID=$(sudo docker ps -aqf "name=kmq-gci") > $GITHUB_OUTPUT - name: Begin upgrade run: npx ts-node src/scripts/announce-restart.ts --docker-image=ghcr.io/brainicism/kmq_discord:gci --timer=0 diff --git a/.github/workflows/gci-tests.yml b/.github/workflows/gci-tests.yml index e98973560..1bdb5e46d 100644 --- a/.github/workflows/gci-tests.yml +++ b/.github/workflows/gci-tests.yml @@ -23,7 +23,6 @@ jobs: DB_USER_CI: root DB_PORT: 3306 AUDIO_SONGS_PER_ARTIST: 10 - PREMIUM_AUDIO_SONGS_PER_ARTIST: 50 steps: - name: Checkout KMQ_Discord uses: actions/checkout@v2 diff --git a/i18n/en.json b/i18n/en.json index 4dbc04340..5254408d0 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -726,7 +726,6 @@ "title": "Song Not Found" }, "notInKMQ": "This song has an entry on [Daisuki]({{link}}), but it isn't included in KMQ.", - "premiumSong": "KMQ Premium Only?", "songNameSearchResult": { "notFoundDescription": "Could not find any songs by that name", "successDescription": "The following songs are available in KMQ:", @@ -802,7 +801,6 @@ "notSet": "Not set", "overview": "Now playing the top {{limit}} out of {{totalSongs}} available songs from the following options:", "perCommandHelp": "Looking for information on how to use a command? Check out {{helpCommand}} action:[command] to learn more.", - "premiumOptionsNonPremiumGame": "Note: active game is not premium", "preset": "Preset", "reset": "{{presetOrOption}} Reset", "spotify": "Now playing {{songCount}} songs from Spotify with the following options:", @@ -882,43 +880,6 @@ "typeGuess": "Listen to the song and type your guess!", "voteReminder": "Psst. Earn more EXP by voting (see {{vote}})" }, - "premium": { - "help": { - "description": "Find out more about KMQ Premium including whether you're currently a member.", - "example": "Shows your premium status.", - "name": "premium" - }, - "option": { - "description": "This option can only be used by premium KMQ supporters.", - "description_kmq_server": "This option can only be used by premium KMQ supporters, or in the official KMQ server.", - "title": "Premium Option" - }, - "status": { - "description": { - "connectionReminder": "Make sure to connect your Discord account [here](https://www.patreon.com/settings/apps) to receive your perks.", - "nonPremium": "Subscribe to [KMQ Premium](https://www.patreon.com/kmq) here.", - "premium": "You have [KMQ Premium](https://www.patreon.com/kmq)." - }, - "perks": { - "badge": { - "description": "Show off your dedication to KMQ with an exclusive badge on your profile", - "title": "Premium Supporter Badge!" - }, - "moreSongs": { - "description": "Gain access to the top 50 b-sides for every artist (up from 10)", - "title": "More songs!" - }, - "special": { - "description": "Change song playback speed anywhere you play!", - "title": "`/special` in every server!" - } - }, - "title": { - "nonPremium": "Subscribe to KMQ Premium!", - "premium": "Thanks for supporting KMQ!" - } - } - }, "preset": { "deleted": { "description": "Preset {{presetName}} successfully deleted.", @@ -1634,9 +1595,7 @@ "notGameSession": "You can't do that while in a game session.", "notHidden": "You can't do that during a hidden game.", "notListeningSession": "You can't do that while in a listening session.", - "notPremium": "You need KMQ Premium to use this command (see {{premium}}).", "notSpotify": "You can't change that option when playing from Spotify. Use {{spotifyResetCommand}} before changing this option.", - "premiumOrDebugServer": "This command only works in the official KMQ server or for KMQ Premium members (see {{premium}}).", "title": "Wait..." }, "releaseDate": "Release Date", diff --git a/i18n/es-ES.json b/i18n/es-ES.json index 11d598970..e4d81be5f 100644 --- a/i18n/es-ES.json +++ b/i18n/es-ES.json @@ -726,7 +726,6 @@ "title": "Canción no encontrada" }, "notInKMQ": "Esta canción tiene una entrada en [Daisuki]({{link}}), pero no está incluida en KMQ.", - "premiumSong": "¿Solo para KMQ Premium?", "songNameSearchResult": { "notFoundDescription": "No se encontraron canciones con ese nombre", "successDescription": "Las siguientes canciones están disponibles en KMQ:", @@ -802,7 +801,6 @@ "notSet": "No establecido", "overview": "Reproduciendo las mejores {{limit}} de {{totalSongs}} canciones disponibles de las siguientes opciones:", "perCommandHelp": "¿Buscas información sobre cómo usar un comando? Echa un vistazo a {{helpCommand}} action:[comando] para obtener más información.", - "premiumOptionsNonPremiumGame": "Nota: el juego activo no es premium", "preset": "Preestablecido", "reset": "{{presetOrOption}} Restablecer", "spotify": "Reproduciendo {{songCount}} canciones de Spotify con las siguientes opciones:", @@ -882,43 +880,6 @@ "typeGuess": "¡Escucha la canción y escribe tu respuesta!", "voteReminder": "Psst. Gana más EXP votando (ver {{vote}})" }, - "premium": { - "help": { - "description": "Obtén más información sobre KMQ Premium, incluyendo si actualmente eres miembro.", - "example": "Muestra tu estado premium.", - "name": "premium" - }, - "option": { - "description": "Esta opción solo puede ser utilizada por los seguidores premium de KMQ.", - "description_kmq_server": "Esta opción solo puede ser utilizada por los seguidores premium de KMQ o en el servidor oficial de KMQ.", - "title": "Opción Premium" - }, - "status": { - "description": { - "connectionReminder": "Asegúrate de conectar tu cuenta de Discord [aquí](https://www.patreon.com/settings/apps) para recibir tus beneficios.", - "nonPremium": "Suscríbete a [KMQ Premium](https://www.patreon.com/kmq) aquí.", - "premium": "Ya tienes [KMQ Premium](https://www.patreon.com/kmq)." - }, - "perks": { - "badge": { - "description": "Muestra tu dedicación a KMQ con una insignia exclusiva en tu perfil", - "title": "¡Insignia de Seguidor Premium!" - }, - "moreSongs": { - "description": "Obtén acceso a los 50 mejores lados B de cada artista (en lugar de 10)", - "title": "¡Más canciones!" - }, - "special": { - "description": "Cambia la velocidad de reproducción de la canción en cualquier lugar donde la reproduzcas!", - "title": "`/special` en cada servidor!" - } - }, - "title": { - "nonPremium": "¡Suscríbete a KMQ Premium!", - "premium": "¡Gracias por apoyar a KMQ!" - } - } - }, "preset": { "deleted": { "description": "Preestablecido {{presetName}} eliminado exitosamente.", @@ -1634,9 +1595,7 @@ "notGameSession": "No puedes hacer eso mientras estás en una sesión de juego.", "notHidden": "No puedes hacer eso durante un juego oculto.", "notListeningSession": "No puedes hacer eso mientras estás en una sesión de escucha.", - "notPremium": "Necesitas KMQ Premium para usar este comando (ver {{premium}}).", "notSpotify": "No puedes cambiar esa opción cuando estás reproduciendo desde Spotify. Usa {{spotifyResetCommand}} antes de cambiar esta opción.", - "premiumOrDebugServer": "Este comando solo funciona en el servidor oficial de KMQ o para miembros de KMQ Premium (ver {{premium}}).", "title": "Espera..." }, "releaseDate": "Fecha de lanzamiento", diff --git a/i18n/fr.json b/i18n/fr.json index aeeec2652..6ebd629f2 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -726,7 +726,6 @@ "title": "Chanson non trouvée" }, "notInKMQ": "Cette chanson a une entrée sur [Daisuki]({{link}}), mais elle n'est pas incluse dans KMQ.", - "premiumSong": "KMQ Premium seulement ?", "songNameSearchResult": { "notFoundDescription": "Impossible de trouver des chansons portant ce nom.", "successDescription": "Les chansons suivantes sont disponibles dans KMQ :", @@ -802,7 +801,6 @@ "notSet": "Non défini", "overview": "En train de jouer les {{limit}} premières chansons parmi un total de {{totalSongs}} chansons disponibles à partir des options suivantes :", "perCommandHelp": "Vous cherchez des informations sur l'utilisation d'une commande ? Consultez {{helpCommand}} action:[commande] pour en savoir plus.", - "premiumOptionsNonPremiumGame": "Note : le jeu actif n'est pas premium", "preset": "Préréglage", "reset": "{{presetOrOption}} Réinitialiser", "spotify": "En train de jouer {{songCount}} chansons de Spotify avec les options suivantes :", @@ -882,43 +880,6 @@ "typeGuess": "Écoutez la chanson et tapez votre réponse !", "voteReminder": "Psst. Gagnez plus d'EXP en votant (voir {{vote}})." }, - "premium": { - "help": { - "description": "En savoir plus sur KMQ Premium, y compris si vous êtes actuellement membre.", - "example": "Affiche votre statut premium.", - "name": "premium" - }, - "option": { - "description": "Cette option ne peut être utilisée que par les supporters premium de KMQ.", - "description_kmq_server": "Cette option ne peut être utilisée que par les supporters premium de KMQ ou dans le serveur KMQ officiel.", - "title": "Option Premium" - }, - "status": { - "description": { - "connectionReminder": "Assurez-vous de connecter votre compte Discord [ici](https://www.patreon.com/settings/apps) pour recevoir vos avantages.", - "nonPremium": "Abonnez-vous à [KMQ Premium](https://www.patreon.com/kmq) ici.", - "premium": "Vous avez [KMQ Premium](https://www.patreon.com/kmq)." - }, - "perks": { - "badge": { - "description": "Montrez votre dévouement envers KMQ avec un badge exclusif sur votre profil.", - "title": "Badge de Supporter Premium!" - }, - "moreSongs": { - "description": "Accédez aux 50 meilleurs b-sides de chaque artiste (au lieu de 10).", - "title": "Plus de chansons!" - }, - "special": { - "description": "Modifiez la vitesse de lecture des chansons où que vous soyez!", - "title": "`/special` dans chaque serveur !" - } - }, - "title": { - "nonPremium": "Abonnez-vous à KMQ Premium !", - "premium": "Merci de soutenir KMQ !" - } - } - }, "preset": { "deleted": { "description": "Préréglage {{presetName}} supprimé avec succès.", @@ -1634,9 +1595,7 @@ "notGameSession": "Vous ne pouvez pas faire cela pendant une session de jeu.", "notHidden": "Vous ne pouvez pas faire cela pendant une partie cachée.", "notListeningSession": "Vous ne pouvez pas faire cela pendant une session d'écoute.", - "notPremium": "Vous avez besoin de KMQ Premium pour utiliser cette commande (voir {{premium}}).", "notSpotify": "Vous ne pouvez pas changer cette option lorsque vous jouez depuis Spotify. Utilisez {{spotifyResetCommand}} avant de changer cette option.", - "premiumOrDebugServer": "Cette commande ne fonctionne que dans le serveur officiel de KMQ ou pour les membres KMQ Premium (voir {{premium}}).", "title": "Attendez..." }, "releaseDate": "Date de sortie", diff --git a/i18n/ja.json b/i18n/ja.json index aee11ad9b..6791a80e8 100644 --- a/i18n/ja.json +++ b/i18n/ja.json @@ -726,7 +726,6 @@ "title": "曲が見つかりませんでした。" }, "notInKMQ": "この曲は[Daisuki]({{link}})にエントリーされていますが、KMQには含まれていません。", - "premiumSong": "KMQプレミアムのみ?", "songNameSearchResult": { "notFoundDescription": "その名前の曲は見つかりませんでした。", "successDescription": "以下の曲がKMQで利用可能です。", @@ -802,7 +801,6 @@ "notSet": "未設定", "overview": "現在、以下のオプションから利用可能な{{totalSongs}}曲のうち、トップ{{limit}}曲を再生しています。", "perCommandHelp": "コマンドの使用方法についての情報をお探しですか?{{helpCommand}} action:[コマンド]をチェックして、詳細を学びましょう。", - "premiumOptionsNonPremiumGame": "注:アクティブなゲームはプレミアムではありません。", "preset": "プリセット", "reset": "{{presetOrOption}}をリセット", "spotify": "現在、以下のオプションでSpotifyから{{songCount}}曲を再生しています。", @@ -882,43 +880,6 @@ "typeGuess": "曲を聴いて、答えを入力してください!", "voteReminder": "Psst. 投票してEXPをもっと稼ぎましょう({{vote}}を参照)" }, - "premium": { - "help": { - "description": "現在のメンバーシップ状況を含め、KMQプレミアムについて詳しく調べる。", - "example": "あなたのプレミアムステータスを表示します。", - "name": "プレミアム" - }, - "option": { - "description": "このオプションは、プレミアムKMQサポーターによってのみ使用できます。", - "description_kmq_server": "このオプションは、プレミアムKMQサポーターまたは公式KMQサーバーでのみ使用できます。", - "title": "プレミアムオプション" - }, - "status": { - "description": { - "connectionReminder": "特典を受け取るために、[ここ](https://www.patreon.com/settings/apps)でDiscordアカウントに接続することを確認してください。", - "nonPremium": "[KMQプレミアム](https://www.patreon.com/kmq)に登録してください。", - "premium": "[KMQプレミアム](https://www.patreon.com/kmq)に登録済みです。" - }, - "perks": { - "badge": { - "description": "独占バッジでKMQへの献身をアピールしましょう。", - "title": "プレミアムサポーターバッジ!" - }, - "moreSongs": { - "description": "すべてのアーティストのトップ50のB面にアクセスできます(10からアップ)", - "title": "もっと多くの曲!" - }, - "special": { - "description": "再生速度をどこでも変更できます!", - "title": "全てのサーバーで`/special`が利用可能です!" - } - }, - "title": { - "nonPremium": "KMQプレミアムに登録しましょう!", - "premium": "KMQをサポートしてくれてありがとう!" - } - } - }, "preset": { "deleted": { "description": "プリセット{{presetName}}を正常に削除しました。", @@ -1634,9 +1595,7 @@ "notGameSession": "ゲームセッション中にはそれはできません。", "notHidden": "非公開ゲーム中はその操作はできません。", "notListeningSession": "リスニングセッション中にはそれはできません。", - "notPremium": "このコマンドを使用するには、KMQプレミアムが必要です({{premium}}を参照)。", "notSpotify": "Spotifyから再生している場合は、このオプションを変更できません。このオプションを変更する前に、{{spotifyResetCommand}}を使用してください。", - "premiumOrDebugServer": "このコマンドは、公式KMQサーバーまたはKMQプレミアムメンバーのみで動作します({{premium}}を参照)。", "title": "お待ちください..." }, "releaseDate": "リリース日", diff --git a/i18n/ko.json b/i18n/ko.json index 2ab13e2e5..993c82a5c 100644 --- a/i18n/ko.json +++ b/i18n/ko.json @@ -726,7 +726,6 @@ "title": "노래를 찾을 수 없음" }, "notInKMQ": "이 노래는 [Daisuki]({{link}})에 항목이 있지만 KMQ에는 포함되어 있지 않습니다.", - "premiumSong": "KMQ 프리미엄만?", "songNameSearchResult": { "notFoundDescription": "해당 이름의 노래를 찾을 수 없습니다.", "successDescription": "KMQ에서 사용할 수 있는 노래는 다음과 같습니다.:", @@ -802,7 +801,6 @@ "notSet": "설정되지 않음", "overview": "이제 다음 옵션에서 사용 가능한 {{totalSongs}}곡 중 상위 {{limit}}곡을 재생합니다.", "perCommandHelp": "명령어 사용 방법에 대한 정보를 찾고 계십니까? 자세한 내용은 {{helpCommand}} action:[명령어]을(를) 확인하세요.", - "premiumOptionsNonPremiumGame": "참고: 액티브 게임은 프리미엄이 아닙니다.", "preset": "사전 설정", "reset": "{{presetOrOption}}으(로) 재설정합니다", "spotify": "이제 다음 옵션으로 스포티파이의 {{songCount}}곡을 재생합니다.:", @@ -882,43 +880,6 @@ "typeGuess": "노래를 듣고 추측을 입력하십시오!", "voteReminder": "쯧쯧... 투표를 통해 더 많은 경험치를 획득하세요. ({{vote}} 참조.)" }, - "premium": { - "help": { - "description": "현재 회원인지 여부를 포함하여 KMQ 프리미엄에 대해 자세히 알아보십시오.", - "example": "프리미엄 상태를 보여줍니다.", - "name": "프리미엄" - }, - "option": { - "description": "이 옵션은 프리미엄 KMQ 서포터만 사용할 수 있습니다.", - "description_kmq_server": "이 옵션은 프리미엄 KMQ 서포터 또는 공식 KMQ 서버에서만 사용할 수 있습니다.", - "title": "프리미엄 옵션" - }, - "status": { - "description": { - "connectionReminder": "디스코드 계정을 [여기](https://www.patreon.com/settings/apps)에 연결하여 혜택을 받으십시오.", - "nonPremium": "[KMQ 프리미엄](https://www.patreon.com/kmq)을(를) 구독하십시오.", - "premium": "[KMQ 프리미엄](https://www.patreon.com/kmq)이 있습니다." - }, - "perks": { - "badge": { - "description": "프로필의 독점 배지로 KMQ에 대한 사랑을 보여주세요.", - "title": "프리미엄 서포터 뱃지!" - }, - "moreSongs": { - "description": "모든 아티스트에 대해 상위 50개의 b-side에 액세스할 수 있습니다. (10개에서 증가)", - "title": "더 많은 노래!" - }, - "special": { - "description": "어디서나 노래 재생 속도를 변경할 수 있습니다!", - "title": "모든 서버에서 `/special`을(를) 입력하세요!" - } - }, - "title": { - "nonPremium": "KMQ 프리미엄을 구독하십시오!", - "premium": "KMQ를 지원해 주셔서 감사합니다!" - } - } - }, "preset": { "deleted": { "description": "사전 설정 {{presetName}}이 성공적으로 삭제되었습니다.", @@ -1634,9 +1595,7 @@ "notGameSession": "게임 세션 중에는 이 작업을 수행할 수 없습니다.", "notHidden": "히든 게임 중에는 이 작업을 수행할 수 없습니다.", "notListeningSession": "청취 세션 중에는 이 작업을 수행할 수 없습니다.", - "notPremium": "이 명령어를 사용하려면 KMQ 프리미엄이 필요합니다. ({{premium}} 참조.)", "notSpotify": "Spotify에서 재생할 때는 이 옵션을 변경할 수 없습니다. 이 옵션을 변경하기 전에 {{spotifyResetCommand}}을(를) 사용하세요.", - "premiumOrDebugServer": "이 명령어는 공식 KMQ 서버 또는 KMQ 프리미엄 회원에게만 작동합니다. ({{premium}} 참조.)", "title": "잠시만 기다려주십시오..." }, "releaseDate": "발매 날짜", diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index 03be0b00b..7d62291fc 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -726,7 +726,6 @@ "title": "未找到歌曲。" }, "notInKMQ": "这首歌在[Daisuki]({{link}})上有条目,但未包含在KMQ中。", - "premiumSong": "仅限KMQ高级会员?", "songNameSearchResult": { "notFoundDescription": "找不到任何名为该名称的歌曲。", "successDescription": "以下歌曲可在KMQ中使用:", @@ -802,7 +801,6 @@ "notSet": "未设置", "overview": "现在播放以下选项中可用的前{{limit}}首歌曲中的前{{totalSongs}}首:", "perCommandHelp": "需要了解如何使用命令吗?查看{{helpCommand}} action:[命令]以了解更多信息。", - "premiumOptionsNonPremiumGame": "注意:活动游戏不是高级版", "preset": "预设", "reset": "{{presetOrOption}} 重置", "spotify": "现在使用以下选项从Spotify播放{{songCount}}首歌曲:", @@ -882,43 +880,6 @@ "typeGuess": "听歌并输入您的猜测!", "voteReminder": "嘘,通过投票赚取更多经验值(请参见 {{vote}})。" }, - "premium": { - "help": { - "description": "了解更多关于 KMQ Premium 的信息,包括您当前是否是会员。", - "example": "显示您的高级会员状态。", - "name": "高级会员" - }, - "option": { - "description": "此选项仅可由 KMQ 高级支持者使用。", - "description_kmq_server": "此选项仅适用于高级KMQ支持者或官方KMQ服务器。", - "title": "高级选项" - }, - "status": { - "description": { - "connectionReminder": "请确保在此处连接您的Discord帐户[这里](https://www.patreon.com/settings/apps),以获得您的特权。", - "nonPremium": "在此处订阅[KMQ Premium](https://www.patreon.com/kmq)。", - "premium": "您已经拥有[KMQ Premium](https://www.patreon.com/kmq)。" - }, - "perks": { - "badge": { - "description": "通过在您的个人资料上展示独家徽章来展示您对KMQ的奉献精神。", - "title": "高级支持者徽章!" - }, - "moreSongs": { - "description": "获得每位艺术家的前50首B面歌曲(从10首升级)", - "title": "更多歌曲!" - }, - "special": { - "description": "在任何地方播放时更改歌曲播放速度!", - "title": "每个服务器都有 `/special`!" - } - }, - "title": { - "nonPremium": "订阅 KMQ 高级版!", - "premium": "感谢您支持 KMQ!" - } - } - }, "preset": { "deleted": { "description": "预设 {{presetName}} 已成功删除。", @@ -1634,9 +1595,7 @@ "notGameSession": "您不能在游戏会话中进行此操作。", "notHidden": "在隐藏游戏期间无法进行该操作。", "notListeningSession": "您不能在听歌会话中进行此操作。", - "notPremium": "您需要 KMQ Premium 才能使用此命令(请参见{{premium}})。", "notSpotify": "您不能在从 Spotify 播放时更改该选项。请在更改此选项之前使用 {{spotifyResetCommand}}。", - "premiumOrDebugServer": "此命令仅适用于官方 KMQ 服务器或 KMQ Premium 成员(请参见{{premium}})。", "title": "请稍等..." }, "releaseDate": "发布日期", diff --git a/src/ci_checks/check_help.sh b/src/ci_checks/check_help.sh index 635f20958..f4f0fcfd2 100755 --- a/src/ci_checks/check_help.sh +++ b/src/ci_checks/check_help.sh @@ -3,7 +3,7 @@ filenames[0]='./src/commands/game_commands/*.ts' filenames[1]='./src/commands/game_options/*.ts' filenames[2]='./src/commands/misc_commands/*.ts' -exceptions=("debug", "join", "begin", "premium", "shuffle", "listen", "add", "remove") +exceptions=("debug", "join", "begin", "shuffle", "listen", "add", "remove") for command_path in ${filenames[@]} do diff --git a/src/command_prechecks.ts b/src/command_prechecks.ts index 6ad385039..a09592c53 100644 --- a/src/command_prechecks.ts +++ b/src/command_prechecks.ts @@ -9,7 +9,6 @@ import { } from "./helpers/discord_utils"; import { clickableSlashCommand } from "./helpers/utils"; import { getTimeUntilRestart } from "./helpers/management_utils"; -import { isUserPremium } from "./helpers/game_utils"; import AnswerType from "./enums/option_types/answer_type"; import GameType from "./enums/game_type"; import GuildPreference from "./structures/guild_preference"; @@ -310,65 +309,6 @@ export default class CommandPrechecks { return true; } - static async premiumPrecheck(precheckArgs: PrecheckArgs): Promise { - const { messageContext, interaction } = precheckArgs; - const premium = await isUserPremium(messageContext.author.id); - if (premium) { - return true; - } - - const embedPayload: EmbedPayload = { - title: i18n.translate( - messageContext.guildID, - "misc.preCheck.title", - ), - description: i18n.translate( - messageContext.guildID, - "misc.preCheck.notPremium", - { premium: clickableSlashCommand("premium") }, - ), - }; - - await sendErrorMessage(messageContext, embedPayload, interaction); - - return false; - } - - static async premiumOrDebugServerPrecheck( - precheckArgs: PrecheckArgs, - ): Promise { - const { messageContext, interaction } = precheckArgs; - const premium = await isUserPremium(messageContext.author.id); - const isDebugServer = - process.env.DEBUG_SERVER_ID === messageContext.guildID; - - if (premium || isDebugServer) { - return true; - } - - logger.warn( - `${getDebugLogHeader( - messageContext, - )} | User attempted to use a command only usable in the debug server/for premium users`, - ); - - const embedPayload: EmbedPayload = { - title: i18n.translate( - messageContext.guildID, - "misc.preCheck.title", - ), - description: i18n.translate( - messageContext.guildID, - "misc.preCheck.premiumOrDebugServer", - { premium: clickableSlashCommand("premium") }, - ), - }; - - sendErrorMessage(messageContext, embedPayload, interaction); - - return false; - } - static async notSpotifyPrecheck( precheckArgs: PrecheckArgs, ): Promise { diff --git a/src/commands/admin/debug.ts b/src/commands/admin/debug.ts index 796380904..967fb5976 100644 --- a/src/commands/admin/debug.ts +++ b/src/commands/admin/debug.ts @@ -1,10 +1,7 @@ import * as uuid from "uuid"; import { IPCLogger } from "../../logger"; import { KmqImages } from "../../constants"; -import { - getAvailableSongCount, - isPremiumRequest, -} from "../../helpers/game_utils"; +import { getAvailableSongCount } from "../../helpers/game_utils"; import { getDebugChannel, getDebugLogHeader, @@ -13,7 +10,6 @@ import { } from "../../helpers/discord_utils"; import GuildPreference from "../../structures/guild_preference"; import MessageContext from "../../structures/message_context"; -import Session from "../../structures/session"; import State from "../../state"; import i18n from "../../helpers/localization_manager"; import type BaseCommand from "../interfaces/base_command"; @@ -35,10 +31,8 @@ export default class DebugCommand implements BaseCommand { ); const messageContext = MessageContext.fromMessage(message); - const session = Session.getSession(message.guildID); const { count, countBeforeLimit } = await getAvailableSongCount( guildPreference, - await isPremiumRequest(session, message.author.id), messageContext, ); diff --git a/src/commands/game_commands/exp.ts b/src/commands/game_commands/exp.ts index 236367c16..ba8187afe 100644 --- a/src/commands/game_commands/exp.ts +++ b/src/commands/game_commands/exp.ts @@ -11,7 +11,6 @@ import { getAvailableSongCount, isFirstGameOfDay, isPowerHour, - isPremiumRequest, userBonusIsActive, } from "../../helpers/game_utils"; import { @@ -25,7 +24,6 @@ import ExpBonusModifier from "../../enums/exp_bonus_modifier"; import GuessModeType from "../../enums/option_types/guess_mode_type"; import GuildPreference from "../../structures/guild_preference"; import MessageContext from "../../structures/message_context"; -import Session from "../../structures/session"; import ShuffleType from "../../enums/option_types/shuffle_type"; import State from "../../state"; import i18n from "../../helpers/localization_manager"; @@ -172,10 +170,8 @@ export async function calculateOptionsExpMultiplierInternal( }); } - const session = Session.getSession(guildPreference.guildID); const { count, countBeforeLimit } = await getAvailableSongCount( guildPreference, - await isPremiumRequest(session, playerID), messageContext, ); diff --git a/src/commands/game_commands/listen.ts b/src/commands/game_commands/listen.ts index d87170728..9e7370336 100644 --- a/src/commands/game_commands/listen.ts +++ b/src/commands/game_commands/listen.ts @@ -1,10 +1,8 @@ import { EMBED_SUCCESS_BONUS_COLOR, KmqImages } from "../../constants"; import { IPCLogger } from "../../logger"; -import { areUsersPremium } from "../../helpers/game_utils"; import { clickableSlashCommand } from "../../helpers/utils"; import { generateOptionsMessage, - getCurrentVoiceMembers, getDebugLogHeader, getGameInfoMessage, getUserVoiceChannel, @@ -183,37 +181,16 @@ export default class ListenCommand implements BaseCommand { return; } - const isPremium = await areUsersPremium( - getCurrentVoiceMembers(voiceChannel.id).map((x) => x.id), - ); - const listeningSession = new ListeningSession( guildPreference, textChannel.id, voiceChannel.id, guildID, gameOwner, - isPremium, ); State.listeningSessions[guildID] = listeningSession; - if (!isPremium) { - for (const [commandName, command] of Object.entries( - State.client.commands, - )) { - if (command.isUsingPremiumOption) { - if (command.isUsingPremiumOption(guildPreference)) { - logger.info( - `Session started by non-premium request, clearing premium option: ${commandName}`, - ); - // eslint-disable-next-line no-await-in-loop - await command.resetPremium!(guildPreference); - } - } - } - } - await sendBeginListeningSessionMessage( textChannel.name, voiceChannel.name, diff --git a/src/commands/game_commands/lookup.ts b/src/commands/game_commands/lookup.ts index 7e035631e..68615dfdc 100644 --- a/src/commands/game_commands/lookup.ts +++ b/src/commands/game_commands/lookup.ts @@ -22,7 +22,6 @@ import { import { getLocalizedArtistName, getLocalizedSongName, - isPremiumRequest, } from "../../helpers/game_utils"; import { getVideoID, validateID } from "@distube/ytdl-core"; import { normalizePunctuationInName } from "../../structures/game_round"; @@ -32,7 +31,6 @@ import GuildPreference from "../../structures/guild_preference"; import KmqMember from "../../structures/kmq_member"; import LocaleType from "../../enums/locale_type"; import MessageContext from "../../structures/message_context"; -import Session from "../../structures/session"; import SongSelector from "../../structures/song_selector"; import State from "../../state"; import _ from "lodash"; @@ -120,7 +118,6 @@ async function lookupByYoutubeID( let songDuration: string | null = null; let includedInOptions = false; const isKorean = locale === LocaleType.KO; - let premiumSong = false; if (kmqSongEntry) { description = i18n.translate(guildID, "command.lookup.inKMQ", { @@ -164,15 +161,10 @@ async function lookupByYoutubeID( songDuration = `${minutes}:${seconds < 10 ? "0" : ""}${seconds}`; } - const session = Session.getSession(guildID); includedInOptions = [ ...( await SongSelector.getFilteredSongList( await GuildPreference.getGuildPreference(guildID), - await isPremiumRequest( - session, - messageOrInteraction.member!.id, - ), SHADOW_BANNED_ARTIST_IDS, ) ).songs, @@ -180,9 +172,6 @@ async function lookupByYoutubeID( .map((x) => x.youtubeLink) .includes(videoID); - premiumSong = - kmqSongEntry.rank > Number(process.env.AUDIO_SONGS_PER_ARTIST); - logger.info( `${getDebugLogHeader( messageOrInteraction, @@ -288,13 +277,6 @@ async function lookupByYoutubeID( includedInOptions ? "misc.yes" : "misc.no", ), }, - { - name: i18n.translate(guildID, "command.lookup.premiumSong"), - value: i18n.translate( - guildID, - premiumSong ? "misc.yes" : "misc.no", - ), - }, ); } diff --git a/src/commands/game_commands/play.ts b/src/commands/game_commands/play.ts index b0e8cde42..9295c0486 100644 --- a/src/commands/game_commands/play.ts +++ b/src/commands/game_commands/play.ts @@ -11,10 +11,8 @@ import { import { IPCLogger } from "../../logger"; import { activeBonusUsers, - areUsersPremium, isFirstGameOfDay, isPowerHour, - isUserPremium, } from "../../helpers/game_utils"; import { bold, @@ -869,7 +867,6 @@ export default class PlayCommand implements BaseCommand { messageContext.guildID, 0, await isFirstGameOfDay(messageContext.author.id), - await isUserPremium(messageContext.author.id), ), messageContext.guildID, ); @@ -964,7 +961,6 @@ export default class PlayCommand implements BaseCommand { messageContext.guildID, 0, await isFirstGameOfDay(messageContext.author.id), - await isUserPremium(messageContext.author.id), ), ); @@ -1107,9 +1103,6 @@ export default class PlayCommand implements BaseCommand { const gameOwner = new KmqMember(messageContext.author.id); let gameSession: GameSession; - const isPremium = await areUsersPremium( - getCurrentVoiceMembers(voiceChannel.id).map((x) => x.id), - ); if (gameType === GameType.TEAMS) { // (1) TEAMS game creation @@ -1144,7 +1137,6 @@ export default class PlayCommand implements BaseCommand { textChannel.guild.id, gameOwner, gameType, - isPremium, ); logger.info( @@ -1274,7 +1266,6 @@ export default class PlayCommand implements BaseCommand { textChannel.guild.id, gameOwner, gameType, - isPremium, lives, ); } @@ -1298,22 +1289,6 @@ export default class PlayCommand implements BaseCommand { } } - if (!isPremium) { - for (const [commandName, command] of Object.entries( - State.client.commands, - )) { - if (command.isUsingPremiumOption) { - if (command.isUsingPremiumOption(guildPreference)) { - logger.info( - `Session started by non-premium request, clearing premium option: ${commandName}`, - ); - // eslint-disable-next-line no-await-in-loop - await command.resetPremium!(guildPreference); - } - } - } - } - if (gameType !== GameType.TEAMS) { await sendBeginGameSessionMessage( textChannel.name, diff --git a/src/commands/game_options/shuffle.ts b/src/commands/game_options/shuffle.ts index e6658f7c8..6053e46c1 100644 --- a/src/commands/game_options/shuffle.ts +++ b/src/commands/game_options/shuffle.ts @@ -1,6 +1,5 @@ import { DEFAULT_SHUFFLE, - EMBED_ERROR_COLOR, ExpBonusModifierValues, OptionAction, } from "../../constants"; @@ -9,10 +8,8 @@ import { clickableSlashCommand } from "../../helpers/utils"; import { getDebugLogHeader, getInteractionValue, - sendErrorMessage, sendOptionsMessage, } from "../../helpers/discord_utils"; -import { isUserPremium } from "../../helpers/game_utils"; import CommandPrechecks from "../../command_prechecks"; import Eris from "eris"; import ExpBonusModifier from "../../enums/exp_bonus_modifier"; @@ -26,17 +23,11 @@ import i18n from "../../helpers/localization_manager"; import type { DefaultSlashCommand } from "../interfaces/base_command"; import type BaseCommand from "../interfaces/base_command"; import type CommandArgs from "../../interfaces/command_args"; -import type EmbedPayload from "../../interfaces/embed_payload"; import type HelpDocumentation from "../../interfaces/help"; const COMMAND_NAME = "shuffle"; const logger = new IPCLogger(COMMAND_NAME); -const PREMIUM_SHUFFLE_TYPES = [ - ShuffleType.WEIGHTED_EASY, - ShuffleType.WEIGHTED_HARD, -]; - export default class ShuffleCommand implements BaseCommand { preRunChecks = [{ checkFn: CommandPrechecks.competitionPrecheck }]; @@ -234,36 +225,6 @@ export default class ShuffleCommand implements BaseCommand { messageContext.guildID, ); - if (shuffleType && PREMIUM_SHUFFLE_TYPES.includes(shuffleType)) { - if (!(await isUserPremium(messageContext.author.id))) { - logger.info( - `${getDebugLogHeader( - messageContext, - )} | Non-premium user attempted to use shuffle option = ${shuffleType}`, - ); - - const embedPayload: EmbedPayload = { - description: i18n.translate( - messageContext.guildID, - "command.premium.option.description", - ), - title: i18n.translate( - messageContext.guildID, - "command.premium.option.title", - ), - color: EMBED_ERROR_COLOR, - }; - - await sendErrorMessage( - messageContext, - embedPayload, - interaction, - ); - - return; - } - } - const reset = shuffleType == null; if (reset) { await guildPreference.reset(GameOption.SHUFFLE_TYPE); @@ -320,11 +281,4 @@ export default class ShuffleCommand implements BaseCommand { interaction, ); } - - resetPremium = async (guildPreference: GuildPreference): Promise => { - await guildPreference.reset(GameOption.SHUFFLE_TYPE); - }; - - isUsingPremiumOption = (guildPreference: GuildPreference): boolean => - PREMIUM_SHUFFLE_TYPES.includes(guildPreference.gameOptions.shuffleType); } diff --git a/src/commands/game_options/special.ts b/src/commands/game_options/special.ts index da8b800c6..620888a34 100644 --- a/src/commands/game_options/special.ts +++ b/src/commands/game_options/special.ts @@ -1,13 +1,11 @@ -import { EMBED_ERROR_COLOR, OptionAction } from "../../constants"; import { IPCLogger } from "../../logger"; +import { OptionAction } from "../../constants"; import { clickableSlashCommand } from "../../helpers/utils"; import { getDebugLogHeader, getInteractionValue, - sendErrorMessage, sendOptionsMessage, } from "../../helpers/discord_utils"; -import { isUserPremium } from "../../helpers/game_utils"; import CommandPrechecks from "../../command_prechecks"; import Eris from "eris"; import GameOption from "../../enums/game_option_name"; @@ -20,7 +18,6 @@ import i18n from "../../helpers/localization_manager"; import type { DefaultSlashCommand } from "../interfaces/base_command"; import type BaseCommand from "../interfaces/base_command"; import type CommandArgs from "../../interfaces/command_args"; -import type EmbedPayload from "../../interfaces/embed_payload"; import type HelpDocumentation from "../../interfaces/help"; const COMMAND_NAME = "special"; @@ -30,7 +27,6 @@ export default class SpecialCommand implements BaseCommand { preRunChecks = [ { checkFn: CommandPrechecks.competitionPrecheck }, { checkFn: CommandPrechecks.notListeningPrecheck }, - { checkFn: CommandPrechecks.premiumOrDebugServerPrecheck }, ]; validations = { @@ -248,33 +244,6 @@ export default class SpecialCommand implements BaseCommand { messageContext.guildID, ); - if ( - process.env.DEBUG_SERVER_ID !== messageContext.guildID && - !(await isUserPremium(messageContext.author.id)) - ) { - logger.info( - `${getDebugLogHeader( - messageContext, - )} | Non-premium user attempted to use premium special option`, - ); - - const embedPayload: EmbedPayload = { - description: i18n.translate( - messageContext.guildID, - "command.premium.option.description_kmq_server", - ), - title: i18n.translate( - messageContext.guildID, - "command.premium.option.title", - ), - color: EMBED_ERROR_COLOR, - }; - - await sendErrorMessage(messageContext, embedPayload, interaction); - - return; - } - const reset = specialType == null; if (reset) { await guildPreference.reset(GameOption.SPECIAL_TYPE); @@ -331,14 +300,4 @@ export default class SpecialCommand implements BaseCommand { interaction, ); } - - resetPremium = async (guildPreference: GuildPreference): Promise => { - if (guildPreference.guildID !== process.env.DEBUG_SERVER_ID) { - await guildPreference.reset(GameOption.SPECIAL_TYPE); - } - }; - - isUsingPremiumOption = (guildPreference: GuildPreference): boolean => - guildPreference.guildID !== process.env.DEBUG_SERVER_ID && - guildPreference.gameOptions.specialType !== null; } diff --git a/src/commands/game_options/spotify.ts b/src/commands/game_options/spotify.ts index 32e1d4454..9ba1ffcee 100644 --- a/src/commands/game_options/spotify.ts +++ b/src/commands/game_options/spotify.ts @@ -21,7 +21,6 @@ import { import { getLocalizedArtistName, getLocalizedSongName, - isPremiumRequest, } from "../../helpers/game_utils"; import CommandPrechecks from "../../command_prechecks"; import Eris from "eris"; @@ -375,16 +374,10 @@ export default class SpotifyCommand implements BaseCommand { return; } - const premiumRequest = await isPremiumRequest( - session, - messageContext.author.id, - ); - let matchedPlaylist: MatchedPlaylist; if (session) { matchedPlaylist = (await session.songSelector.reloadSongs( guildPreference, - premiumRequest, playlistID, true, messageContext, @@ -393,7 +386,6 @@ export default class SpotifyCommand implements BaseCommand { } else { matchedPlaylist = (await new SongSelector().reloadSongs( guildPreference, - premiumRequest, playlistID, true, messageContext, @@ -542,15 +534,9 @@ export default class SpotifyCommand implements BaseCommand { } const playlistID = guildPreference.getSpotifyPlaylistID(); - const premiumRequest = await isPremiumRequest( - Session.getSession(guildID), - messageContext.author.id, - ); - const playlist = await State.spotifyManager.getMatchedSpotifySongs( guildID, playlistID!, - premiumRequest, false, messageContext, interaction, diff --git a/src/commands/interfaces/base_command.ts b/src/commands/interfaces/base_command.ts index 538fbab1b..a922d6d36 100644 --- a/src/commands/interfaces/base_command.ts +++ b/src/commands/interfaces/base_command.ts @@ -1,7 +1,6 @@ import type CallFunc from "../../interfaces/call_func"; import type CommandValidations from "../../interfaces/command_validations"; import type Eris from "eris"; -import type GuildPreference from "../../structures/guild_preference"; import type HelpDocumentation from "../../interfaces/help"; import type MessageContext from "../../structures/message_context"; import type PrecheckArgs from "../../interfaces/precheck_args"; @@ -20,8 +19,6 @@ export default interface BaseCommand { checkFn: (precheckArgs: PrecheckArgs) => boolean | Promise; errorMessage?: string; }>; - resetPremium?: (guildPreference: GuildPreference) => Promise; - isUsingPremiumOption?: (guildPreference: GuildPreference) => boolean; slashCommands?: () => Array< DefaultSlashCommand | Eris.ChatInputApplicationCommandStructure >; diff --git a/src/commands/misc_commands/premium.ts b/src/commands/misc_commands/premium.ts deleted file mode 100644 index a14a1e67d..000000000 --- a/src/commands/misc_commands/premium.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { EMBED_SUCCESS_BONUS_COLOR, KmqImages } from "../../constants"; -import { clickableSlashCommand } from "../../helpers/utils"; -import { isUserPremium } from "../../helpers/game_utils"; -import { sendInfoMessage } from "../../helpers/discord_utils"; -import Eris from "eris"; -import KmqConfiguration from "../../kmq_configuration"; -import MessageContext from "../../structures/message_context"; -import i18n from "../../helpers/localization_manager"; -import type { DefaultSlashCommand } from "../interfaces/base_command"; -import type BaseCommand from "../interfaces/base_command"; -import type CommandArgs from "../../interfaces/command_args"; -import type HelpDocumentation from "../../interfaces/help"; - -const COMMAND_NAME = "premium"; - -export default class PremiumCommand implements BaseCommand { - validations = { - arguments: [], - maxArgCount: 0, - minArgCount: 0, - }; - - help = (guildID: string): HelpDocumentation => ({ - name: COMMAND_NAME, - description: i18n.translate( - guildID, - "command.premium.help.description", - ), - examples: [ - { - example: clickableSlashCommand(COMMAND_NAME), - explanation: i18n.translate( - guildID, - "command.premium.help.example", - ), - }, - ], - priority: 50, - }); - - slashCommands = (): Array< - DefaultSlashCommand | Eris.ChatInputApplicationCommandStructure - > => [ - { - type: Eris.Constants.ApplicationCommandTypes.CHAT_INPUT, - }, - ]; - - call = async ({ message }: CommandArgs): Promise => { - await PremiumCommand.sendPremiumMessage( - MessageContext.fromMessage(message), - ); - }; - - static sendPremiumMessage = async ( - messageContext: MessageContext, - interaction?: Eris.CommandInteraction, - ): Promise => { - if (!KmqConfiguration.Instance.premiumCommandEnabled()) return; - const premiumMember = await isUserPremium(messageContext.author.id); - sendInfoMessage( - messageContext, - { - color: premiumMember ? EMBED_SUCCESS_BONUS_COLOR : undefined, - description: `${i18n.translate( - messageContext.guildID, - premiumMember - ? "command.premium.status.description.premium" - : "command.premium.status.description.nonPremium", - )}\n\n${i18n.translate( - messageContext.guildID, - "command.premium.status.description.connectionReminder", - )}`, - fields: [ - { - name: i18n.translate( - messageContext.guildID, - "command.premium.status.perks.moreSongs.title", - ), - value: i18n.translate( - messageContext.guildID, - "command.premium.status.perks.moreSongs.description", - ), - }, - { - name: i18n.translate( - messageContext.guildID, - "command.premium.status.perks.special.title", - ), - value: i18n.translate( - messageContext.guildID, - "command.premium.status.perks.special.description", - ), - }, - { - name: i18n.translate( - messageContext.guildID, - "command.premium.status.perks.badge.title", - ), - value: i18n.translate( - messageContext.guildID, - "command.premium.status.perks.badge.description", - ), - }, - ], - thumbnailUrl: KmqImages.HAPPY, - title: i18n.translate( - messageContext.guildID, - premiumMember - ? "command.premium.status.title.premium" - : "command.premium.status.title.nonPremium", - ), - }, - false, - undefined, - [], - interaction, - ); - }; - - /** - * @param interaction - The interaction - * @param messageContext - The message context - */ - async processChatInputInteraction( - interaction: Eris.CommandInteraction, - messageContext: MessageContext, - ): Promise { - await PremiumCommand.sendPremiumMessage(messageContext, interaction); - } -} diff --git a/src/constants.ts b/src/constants.ts index 3c7855d3e..a3a21017c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -151,8 +151,6 @@ export const EMBED_ERROR_COLOR = 0xed4245; // Red export const EMBED_SUCCESS_COLOR = 0x57f287; // Green export const EMBED_SUCCESS_BONUS_COLOR = 0xfee75c; // Gold -export const PATREON_SUPPORTER_BADGE_ID = 23; - export const DATABASE_DOWNLOAD_DIR = path.join( __dirname, "../sql_dumps/daisuki", diff --git a/src/environment.d.ts b/src/environment.d.ts index e55f22619..b8fc3b1be 100644 --- a/src/environment.d.ts +++ b/src/environment.d.ts @@ -19,12 +19,9 @@ declare namespace NodeJS { WEB_SERVER_PORT: string | undefined; ALERT_WEBHOOK_URL?: string | undefined; AUDIO_SONGS_PER_ARTIST: string | undefined; - PREMIUM_AUDIO_SONGS_PER_ARTIST: string | undefined; DEBUG_LOGGING?: string | undefined; POWER_HOUR_NOTIFICATION_CHANNEL_ID?: string | undefined; POWER_HOUR_NOTIFICATION_ROLE_ID?: string | undefined; - PATREON_CREATOR_ACCESS_TOKEN?: string | undefined; - PATREON_CAMPAIGN_ID?: string | undefined; SPOTIFY_CLIENT_ID?: string | undefined; SPOTIFY_CLIENT_SECRET?: string | undefined; DAISUKI_SEED_CRON_JOB?: string | undefined; diff --git a/src/events/client/voiceChannelJoin.ts b/src/events/client/voiceChannelJoin.ts index e50e20213..82dfa5857 100644 --- a/src/events/client/voiceChannelJoin.ts +++ b/src/events/client/voiceChannelJoin.ts @@ -30,9 +30,4 @@ export default async function voiceChannelJoinHandler( ); await session.setPlayerInVC(member.id, true); } - - logger.info( - `gid: ${newChannel.guild.id}, uid: ${member.id} | Updating premium status`, - ); - session.updatePremiumStatus(); } diff --git a/src/events/client/voiceChannelLeave.ts b/src/events/client/voiceChannelLeave.ts index 148ce045c..f033a4727 100644 --- a/src/events/client/voiceChannelLeave.ts +++ b/src/events/client/voiceChannelLeave.ts @@ -48,8 +48,7 @@ export default async function voiceChannelLeaveHandler( } logger.info( - `gid: ${oldChannel.guild.id}, uid: ${member.id} | Updating premium status and owner`, + `gid: ${oldChannel.guild.id}, uid: ${member.id} | Updating owner`, ); - await session.updatePremiumStatus(); session.updateOwner(); } diff --git a/src/events/client/voiceChannelSwitch.ts b/src/events/client/voiceChannelSwitch.ts index 654970fb0..ba9903015 100644 --- a/src/events/client/voiceChannelSwitch.ts +++ b/src/events/client/voiceChannelSwitch.ts @@ -64,8 +64,7 @@ export default async function voiceChannelSwitchHandler( } logger.info( - `gid: ${newChannel.guild.id}, uid: ${member.id} | Updating premium status and owner`, + `gid: ${newChannel.guild.id}, uid: ${member.id} | Updating owner`, ); - await session.updatePremiumStatus(); session.updateOwner(); } diff --git a/src/helpers/discord_utils.ts b/src/helpers/discord_utils.ts index 5fad505ca..731f5996c 100644 --- a/src/helpers/discord_utils.ts +++ b/src/helpers/discord_utils.ts @@ -37,7 +37,6 @@ import { getAvailableSongCount, getLocalizedArtistName, getLocalizedSongName, - isPremiumRequest, userBonusIsActive, } from "./game_utils"; import { normalizePunctuationInName } from "../structures/game_round"; @@ -769,10 +768,6 @@ export async function generateOptionsMessage( } const guildID = messageContext.guildID; - const premiumRequest = await isPremiumRequest( - session, - messageContext.author.id, - ); // Store the VALUE of ,[option]: [VALUE] into optionStrings // Null optionStrings values are set to "Not set" below @@ -787,7 +782,6 @@ export async function generateOptionsMessage( await State.spotifyManager.getMatchedSpotifySongs( guildID, spotifyPlaylistID, - premiumRequest, false, messageContext, interaction, @@ -804,7 +798,6 @@ export async function generateOptionsMessage( const totalSongs = await getAvailableSongCount( guildPreference, - premiumRequest, messageContext, interaction, ); @@ -1019,16 +1012,6 @@ export async function generateOptionsMessage( ) .join("\n"); - let nonPremiumGameWarning = ""; - if (premiumRequest && session?.isGameSession() && !session?.isPremium) { - nonPremiumGameWarning = italicize( - i18n.translate( - messageContext.guildID, - "command.options.premiumOptionsNonPremiumGame", - ), - ); - } - const fieldOptions = Object.keys(GameOptionCommand) .filter((option) => optionStrings[option as GameOption]) .filter((option) => !PriorityGameOption.includes(option as GameOption)); @@ -1152,16 +1135,12 @@ export async function generateOptionsMessage( } let description = ""; - if (nonPremiumGameWarning) { - description = `${nonPremiumGameWarning}\n\n`; - } description += optionsOverview; description += "\n\n"; description += priorityOptions; return { - color: premiumRequest ? EMBED_SUCCESS_BONUS_COLOR : undefined, title, description, fields, diff --git a/src/helpers/game_utils.ts b/src/helpers/game_utils.ts index f96801243..3ee66070f 100644 --- a/src/helpers/game_utils.ts +++ b/src/helpers/game_utils.ts @@ -1,8 +1,5 @@ import { IPCLogger } from "../logger"; -import { - PATREON_SUPPORTER_BADGE_ID, - SHADOW_BANNED_ARTIST_IDS, -} from "../constants"; +import { SHADOW_BANNED_ARTIST_IDS } from "../constants"; import { cleanArtistName, normalizePunctuationInName, @@ -24,7 +21,6 @@ import type GameRound from "../structures/game_round"; import type GuildPreference from "../structures/guild_preference"; import type MatchedArtist from "../interfaces/matched_artist"; import type MessageContext from "../structures/message_context"; -import type Patron from "../interfaces/patron"; import type QueriedSong from "../interfaces/queried_song"; import type Session from "../structures/session"; @@ -53,14 +49,12 @@ export async function ensureVoiceConnection(session: Session): Promise { /** * @param guildPreference - The GuildPreference - * @param isPremium - Whether to include premium songs * @param messageContext - The message which triggered the song count check * @param interaction - The interaction that triggered the song count check * @returns an object containing the total number of available songs before and after limit based on the GameOptions */ export async function getAvailableSongCount( guildPreference: GuildPreference, - isPremium: boolean, messageContext?: MessageContext, interaction?: Eris.CommandInteraction, ): Promise<{ @@ -78,7 +72,6 @@ export async function getAvailableSongCount( if (session) { matchedPlaylist = (await session.songSelector.reloadSongs( guildPreference, - isPremium, playlistID, !session.sessionInitialized, messageContext, @@ -87,7 +80,6 @@ export async function getAvailableSongCount( } else { matchedPlaylist = (await new SongSelector().reloadSongs( guildPreference, - isPremium, playlistID, false, messageContext, @@ -104,7 +96,6 @@ export async function getAvailableSongCount( const { songs, countBeforeLimit } = await SongSelector.getFilteredSongList( guildPreference, - isPremium, SHADOW_BANNED_ARTIST_IDS, ); @@ -522,93 +513,6 @@ export async function getMultipleChoiceOptions( return result; } -/** - * @param _userIDs - A list of user IDs to check - * @returns whether at least one player has premium status - */ -export async function areUsersPremium( - _userIDs: Array, -): Promise { - return Promise.resolve(true); - // return !!(await dbContext.kmq - // .selectFrom("premium_users") - // .selectAll() - // .where("active", "=", 1) - // .where("user_id", "in", userIDs) - // .executeTakeFirst()); -} - -/** - * @param userID - The user ID - * @returns whether the player has premium status - */ -export async function isUserPremium(userID: string): Promise { - return areUsersPremium([userID]); -} - -/** - * @param activePatrons - The users to grant premium membership - * @param inactiveUserIDs - The users to revoke premium membership from - */ -export async function updatePremium( - activePatrons: Array, - inactiveUserIDs: string[], -): Promise { - // Grant premium - const activePatronsPayload = activePatrons.map((x) => ({ - active: x.activePatron ? 1 : 0, - first_subscribed: x.firstSubscribed, - user_id: x.discordID, - source: "patreon" as const, - })); - - await Promise.all( - activePatronsPayload.map(async (activePatronPayload) => { - await dbContext.kmq - .insertInto("premium_users") - .values(activePatronPayload) - .onDuplicateKeyUpdate(activePatronPayload) - .execute(); - }), - ); - - const payload = activePatrons.map((x) => ({ - user_id: x.discordID, - badge_id: PATREON_SUPPORTER_BADGE_ID, - })); - - await dbContext.kmq - .insertInto("badges_players") - .values(payload) - .ignore() - .execute(); - - // Revoke premium - await dbContext.kmq - .updateTable("premium_users") - .where("user_id", "in", inactiveUserIDs) - .set({ active: 0 }) - .execute(); - - await dbContext.kmq - .deleteFrom("badges_players") - .where("user_id", "in", inactiveUserIDs) - .where("badge_id", "=", PATREON_SUPPORTER_BADGE_ID) - .execute(); -} - -/** - * @param session - The session - * @param playerID - The player ID - * @returns whether the current game is a premium game/listening session, or the player is premium - */ -export async function isPremiumRequest( - session: Session, - playerID: string, -): Promise { - return session?.isPremium || (await isUserPremium(playerID)); -} - /** * @param userID - The user's ID * @returns whether this is the user's first game played today diff --git a/src/helpers/management_utils.ts b/src/helpers/management_utils.ts index 78b94bcab..7037a8e42 100644 --- a/src/helpers/management_utils.ts +++ b/src/helpers/management_utils.ts @@ -20,7 +20,6 @@ import _ from "lodash"; import dbContext from "../database_context"; import i18n from "./localization_manager"; import schedule from "node-schedule"; -import updatePremiumUsers from "./patreon_manager"; import type LocaleType from "../enums/locale_type"; import type MatchedArtist from "../interfaces/matched_artist"; import type NewsSubscription from "../interfaces/news_subscription"; @@ -562,11 +561,6 @@ export function registerIntervals(clusterID: number): void { updateBotStatus(); await warnServersImpendingRestart(timeUntilRestart); } - - // Sync state with Patreon subscribers - if (await isPrimaryInstance()) { - updatePremiumUsers(); - } }); } diff --git a/src/helpers/patreon_manager.ts b/src/helpers/patreon_manager.ts deleted file mode 100644 index 7b1404f5e..000000000 --- a/src/helpers/patreon_manager.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { IPCLogger } from "../logger"; -import { updatePremium } from "./game_utils"; -import Axios from "axios"; -import KmqConfiguration from "../kmq_configuration"; -import dbContext from "../database_context"; -import type Patron from "../interfaces/patron"; - -const logger = new IPCLogger("patreon_manager"); - -interface PatreonResponse { - data: Array<{ - attributes: { - patron_status: string; - pledge_relationship_start?: string; - social_connections: { - discord: string; - }; - user: { - data: { - id: string; - }; - }; - }; - relationships: { - user: { - data: { - id: string; - }; - }; - }; - type: string; - }>; - - included: Array<{ - attributes: { - social_connections: { - discord?: { - user_id: string; - }; - }; - }; - id: string; - type: string; - }>; -} - -enum PatronState { - ACTIVE = "active_patron", - DECLINED = "declined_patron", - FORMER = "former_patron", -} - -function parsePatreonResponse(patreonResponse: PatreonResponse): Array { - const patrons: Array = []; - for (const userData of patreonResponse.data) { - if (userData.type !== "member") continue; - - const patreonMemberID = userData.relationships.user.data.id; - const matchedPatreonUser = patreonResponse.included.find( - (x) => x.type === "user" && x.id === patreonMemberID, - ); - - if (!matchedPatreonUser) { - logger.error( - `Couldn't find corresponding Patreon user for ${patreonMemberID}`, - ); - continue; - } - - patrons.push({ - discordID: matchedPatreonUser.attributes.social_connections?.discord - ?.user_id as string, - activePatron: - userData.attributes.patron_status === PatronState.ACTIVE, - firstSubscribed: new Date( - userData.attributes.pledge_relationship_start as string, - ), - }); - } - - return patrons; -} - -/** - * Fetch up-to-date Patreon members and update Premium members accordingly - */ -export default async function updatePremiumUsers(): Promise { - if (!KmqConfiguration.Instance.patreonFetchingEnabled()) { - return; - } - - if ( - !process.env.PATREON_CREATOR_ACCESS_TOKEN || - !process.env.PATREON_CAMPAIGN_ID - ) { - return; - } - - let fetchedPatrons: Array; - try { - const response: PatreonResponse = ( - await Axios.get( - `https://www.patreon.com/api/oauth2/v2/campaigns/${ - process.env.PATREON_CAMPAIGN_ID - }/members${encodeURI( - "?include=user,currently_entitled_tiers&fields[member]=patron_status,pledge_relationship_start&fields[user]=social_connections", - )}`, - { - headers: { - Authorization: `Bearer ${process.env.PATREON_CREATOR_ACCESS_TOKEN}`, - }, - }, - ) - ).data; - - fetchedPatrons = parsePatreonResponse(response); - } catch (err) { - logger.error(`Failed fetching patrons. err = ${err}`); - return; - } - - const patrons: Array = fetchedPatrons.filter((x) => !!x.discordID); - - const activePatronIDs: string[] = patrons - .filter((x) => x.activePatron) - .map((x) => x.discordID); - - await updatePremium( - patrons, - ( - await dbContext.kmq - .selectFrom("premium_users") - .select("user_id") - .where("user_id", "not in", activePatronIDs) - .where("source", "!=", "loyalty") - .execute() - ).map((x) => x.user_id), - ); -} diff --git a/src/helpers/spotify_manager.ts b/src/helpers/spotify_manager.ts index 5e57c32e3..75db3eace 100644 --- a/src/helpers/spotify_manager.ts +++ b/src/helpers/spotify_manager.ts @@ -64,7 +64,6 @@ export default class SpotifyManager { /** * @param guildID - The guild to retrieve songs for * @param playlistID - The playlist to retrieve songs from - * @param isPremium - Whether the user is premium or not * @param forceRefreshMetadata - Whether to request new metadata * @param messageContext - The message context * @param interaction - The interaction @@ -72,7 +71,6 @@ export default class SpotifyManager { getMatchedSpotifySongs = async ( guildID: string, playlistID: string, - isPremium: boolean, forceRefreshMetadata: boolean, messageContext?: MessageContext, interaction?: Eris.CommandInteraction, @@ -262,7 +260,7 @@ export default class SpotifyManager { 4, spotifySongs, (x: SpotifyTrack) => - this.generateSongMatchingPromise(x, isPremium, guildID), + this.generateSongMatchingPromise(x, guildID), )) { if (typeof queryOutput === "string") { unmatchedSongs.push(queryOutput); @@ -482,7 +480,6 @@ export default class SpotifyManager { private generateSongMatchingPromise( song: SpotifyTrack, - isPremium: boolean, guildID: string, ): Promise { return new Promise(async (resolve, reject) => { @@ -586,16 +583,7 @@ export default class SpotifyManager { .where( "rank", "<=", - isPremium - ? parseInt( - process.env - .PREMIUM_AUDIO_SONGS_PER_ARTIST as string, - 10, - ) - : parseInt( - process.env.AUDIO_SONGS_PER_ARTIST as string, - 10, - ), + parseInt(process.env.AUDIO_SONGS_PER_ARTIST as string, 10), ) .orderBy((eb) => eb.fn("CHAR_LENGTH", ["tags"]), "asc") .orderBy("views", "desc"); diff --git a/src/interfaces/patron.ts b/src/interfaces/patron.ts deleted file mode 100644 index 89be2e074..000000000 --- a/src/interfaces/patron.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default interface Patron { - discordID: string; - activePatron: boolean; - firstSubscribed: Date; -} diff --git a/src/kmq_configuration.ts b/src/kmq_configuration.ts index cdd486548..50cc45ad3 100644 --- a/src/kmq_configuration.ts +++ b/src/kmq_configuration.ts @@ -52,10 +52,6 @@ export default class KmqConfiguration { } } - premiumCommandEnabled(): boolean { - return this.config["premiumCommandEnabled"] ?? false; - } - maintenanceModeEnabled(): boolean { return this.config["maintenanceModeEnabled"] ?? false; } @@ -68,10 +64,6 @@ export default class KmqConfiguration { return this.config["persistMatchedSpotifySongs"] ?? false; } - patreonFetchingEnabled(): boolean { - return this.config["patreonFetchingEnabled"] ?? false; - } - newsSubscriptionsEnabled(): boolean { return this.config["newsSubscriptionEnabled"] ?? false; } diff --git a/src/scripts/download-new-songs.ts b/src/scripts/download-new-songs.ts index a698ebf94..9fac728a4 100644 --- a/src/scripts/download-new-songs.ts +++ b/src/scripts/download-new-songs.ts @@ -277,11 +277,7 @@ async function getSongsFromDb(databaseContext: DatabaseContext): Promise { return avBuilder .selectFrom("rankedAudioSongs") .select(["songName", "artistName", "youtubeLink", "views"]) - .where( - "rank", - "<=", - process.env.PREMIUM_AUDIO_SONGS_PER_ARTIST as string, - ) + .where("rank", "<=", process.env.AUDIO_SONGS_PER_ARTIST as string) .unionAll(mvBuilder) .orderBy("views", "desc") .execute(); diff --git a/src/seed/bootstrap.ts b/src/seed/bootstrap.ts index d49a87061..41b90adf9 100644 --- a/src/seed/bootstrap.ts +++ b/src/seed/bootstrap.ts @@ -41,7 +41,6 @@ function hasRequiredEnvironmentVariables(): boolean { "SONG_DOWNLOAD_DIR", "BOT_PREFIX", "NODE_ENV", - "PREMIUM_AUDIO_SONGS_PER_ARTIST", "AUDIO_SONGS_PER_ARTIST", "APP_NAME", "DAISUKI_DB_PASSWORD", diff --git a/src/seed/seed_db.ts b/src/seed/seed_db.ts index c554cfde0..8af65fb63 100644 --- a/src/seed/seed_db.ts +++ b/src/seed/seed_db.ts @@ -173,7 +173,7 @@ export async function generateKmqDataTables( db: DatabaseContext, ): Promise { logger.info("Re-creating KMQ data tables view..."); - await sql`CALL CreateKmqDataTables(${process.env.PREMIUM_AUDIO_SONGS_PER_ARTIST});`.execute( + await sql`CALL CreateKmqDataTables(${process.env.AUDIO_SONGS_PER_ARTIST});`.execute( db.kmq, ); } @@ -436,7 +436,7 @@ async function validateSqlDump( await sql .raw( - `CALL CreateKmqDataTables(${process.env.PREMIUM_AUDIO_SONGS_PER_ARTIST});`, + `CALL CreateKmqDataTables(${process.env.AUDIO_SONGS_PER_ARTIST});`, ) .execute(db.kpopVideosValidation); } diff --git a/src/structures/elimination_player.ts b/src/structures/elimination_player.ts index 7963e2b33..2fc4fb0d0 100644 --- a/src/structures/elimination_player.ts +++ b/src/structures/elimination_player.ts @@ -8,7 +8,6 @@ export default class EliminationPlayer extends Player { guildID: string, score = ELIMINATION_DEFAULT_LIVES, firstGameOfDay = false, - premium = false, ): EliminationPlayer { return new EliminationPlayer( user.id, @@ -17,7 +16,6 @@ export default class EliminationPlayer extends Player { score, user.username, firstGameOfDay, - premium, ); } diff --git a/src/structures/game_session.ts b/src/structures/game_session.ts index 9351e82bc..66a846097 100644 --- a/src/structures/game_session.ts +++ b/src/structures/game_session.ts @@ -30,7 +30,6 @@ import { getMultipleChoiceOptions, getTimeToGuessMs, isFirstGameOfDay, - isUserPremium, userBonusIsActive, } from "../helpers/game_utils"; import State from "../state"; @@ -129,7 +128,6 @@ export default class GameSession extends Session { guildID: string, gameSessionCreator: KmqMember, gameType: GameType, - isPremium: boolean, eliminationLives?: number, ) { super( @@ -138,7 +136,6 @@ export default class GameSession extends Session { voiceChannelID, guildID, gameSessionCreator, - isPremium, ); this.gameType = gameType; this.sessionInitialized = false; @@ -866,14 +863,12 @@ export default class GameSession extends Session { this.scoreboard as EliminationScoreboard ).getLivesOfWeakestPlayer(), await isFirstGameOfDay(userID), - await isUserPremium(userID), ) : Player.fromUser( user as Eris.User, this.guildID, 0, await isFirstGameOfDay(userID), - await isUserPremium(userID), ), ); } @@ -908,7 +903,6 @@ export default class GameSession extends Session { .filter((x) => x !== process.env.BOT_CLIENT_ID) .map(async (playerId) => { const firstGameOfDay = await isFirstGameOfDay(playerId); - const premium = await isUserPremium(playerId); const player = (await fetchUser(playerId)) as Eris.User; this.scoreboard.addPlayer( this.gameType === GameType.ELIMINATION @@ -918,14 +912,12 @@ export default class GameSession extends Session { (this.scoreboard as EliminationScoreboard) .startingLives, firstGameOfDay, - premium, ) : Player.fromUser( player, this.guildID, 0, firstGameOfDay, - premium, ), ); }), diff --git a/src/structures/listening_session.ts b/src/structures/listening_session.ts index b437d8cc7..7676c4121 100644 --- a/src/structures/listening_session.ts +++ b/src/structures/listening_session.ts @@ -31,7 +31,6 @@ export default class ListeningSession extends Session { voiceChannelID: string, guildID: string, gameSessionCreator: KmqMember, - isPremium: boolean, ) { super( guildPreference, @@ -39,7 +38,6 @@ export default class ListeningSession extends Session { voiceChannelID, guildID, gameSessionCreator, - isPremium, ); this.round = null; } diff --git a/src/structures/player.ts b/src/structures/player.ts index b46acaef0..7459231c5 100644 --- a/src/structures/player.ts +++ b/src/structures/player.ts @@ -11,9 +11,6 @@ export default class Player { /** The Discord username of the player */ public readonly username: string; - /** Whether the player has premium features */ - public readonly premium: boolean; - /** The ID of the guild where the player is playing */ public readonly guildID: string; @@ -45,7 +42,6 @@ export default class Player { points: number, username: string, firstGameOfTheDay = false, - premium = false, ) { this.id = id; this.guildID = guildID; @@ -54,7 +50,6 @@ export default class Player { this.correctGuessCount = 0; this.username = username; this.firstGameOfTheDay = firstGameOfTheDay; - this.premium = premium; this.inVC = true; this.expGain = 0; this.previousRoundRanking = null; @@ -65,7 +60,6 @@ export default class Player { guildID: string, score = 0, firstGameOfDay = false, - premium = false, ): Player { return new Player( user.id, @@ -74,7 +68,6 @@ export default class Player { score, user.username, firstGameOfDay, - premium, ); } diff --git a/src/structures/session.ts b/src/structures/session.ts index ca3db97c4..79d3248c6 100644 --- a/src/structures/session.ts +++ b/src/structures/session.ts @@ -1,12 +1,6 @@ import * as uuid from "uuid"; import { IPCLogger } from "../logger"; import { KmqImages, specialFfmpegArgs } from "../constants"; -import { - areUsersPremium, - ensureVoiceConnection, - getLocalizedArtistName, - getLocalizedSongName, -} from "../helpers/game_utils"; import { clickableSlashCommand, friendlyFormattedNumber, @@ -14,6 +8,11 @@ import { truncatedString, underline, } from "../helpers/utils"; +import { + ensureVoiceConnection, + getLocalizedArtistName, + getLocalizedSongName, +} from "../helpers/game_utils"; import { generateEmbed, getCurrentVoiceMembers, @@ -86,9 +85,6 @@ export default abstract class Session { public songSelector: SongSelector; - /** Whether the session has premium members */ - public isPremium: boolean; - /** The guild preference */ protected guildPreference: GuildPreference; @@ -112,7 +108,6 @@ export default abstract class Session { voiceChannelID: string, guildID: string, gameSessionCreator: KmqMember, - isPremium: boolean, ) { this.guildPreference = guildPreference; this.textChannelID = textChannelID; @@ -128,7 +123,6 @@ export default abstract class Session { this.songMessageIDs = []; this.bookmarkedSongs = {}; this.songSelector = new SongSelector(); - this.isPremium = isPremium; this.guildPreference.reloadSongCallback = async () => { logger.info( @@ -137,7 +131,6 @@ export default abstract class Session { await this.songSelector.reloadSongs( this.guildPreference, - this.isPremium, this.guildPreference.getSpotifyPlaylistID() ?? undefined, ); }; @@ -194,7 +187,6 @@ export default abstract class Session { try { await this.songSelector.reloadSongs( this.guildPreference, - this.isPremium, this.guildPreference.getSpotifyPlaylistID() ?? undefined, !this.sessionInitialized, ); @@ -629,44 +621,6 @@ export default abstract class Session { return this.roundsPlayed; } - /** - * The game has changed its premium state, so update filtered songs and reset premium options if non-premium - */ - async updatePremiumStatus(): Promise { - const oldPremiumStatus = this.isPremium; - - const isPremium = await areUsersPremium( - getCurrentVoiceMembers(this.voiceChannelID).map((x) => x.id), - ); - - if (oldPremiumStatus === isPremium) { - return; - } - - this.isPremium = isPremium; - - await this.songSelector.reloadSongs( - this.guildPreference, - isPremium, - this.guildPreference.getSpotifyPlaylistID() ?? undefined, - ); - - if (!isPremium) { - await Promise.allSettled( - Object.entries(State.client.commands).map( - async ([commandName, command]) => { - if (command.resetPremium) { - logger.info( - `gid: ${this.guildID} | Resetting premium for game option: ${commandName}`, - ); - await command.resetPremium(this.guildPreference); - } - }, - ), - ); - } - } - abstract handleComponentInteraction( _interaction: Eris.ComponentInteraction, _messageContext: MessageContext, diff --git a/src/structures/song_selector.ts b/src/structures/song_selector.ts index f291f5a39..c9bb5888e 100644 --- a/src/structures/song_selector.ts +++ b/src/structures/song_selector.ts @@ -241,7 +241,6 @@ export default class SongSelector { async reloadSongs( guildPreference: GuildPreference, - isPremium: boolean, playlistID?: string, forceRefreshMetadata?: boolean, messageContext?: MessageContext, @@ -250,7 +249,6 @@ export default class SongSelector { if (!playlistID) { this.filteredSongs = await SongSelector.getFilteredSongList( guildPreference, - isPremium, SHADOW_BANNED_ARTIST_IDS, ); @@ -259,7 +257,6 @@ export default class SongSelector { const playlist = await SongSelector.getSpotifySongList( guildPreference.guildID, - isPremium, playlistID, forceRefreshMetadata || false, messageContext, @@ -273,13 +270,11 @@ export default class SongSelector { /** * Returns a list of songs from the data store, narrowed down by the specified game options * @param guildPreference - The GuildPreference - * @param premium - Whether the game is premium * @param shadowBannedArtistIds - artist IDs that shouldn't be populated by subunit inclusion * @returns a list of songs, as well as the number of songs before the filter option was applied */ static async getFilteredSongList( guildPreference: GuildPreference, - premium: boolean = false, shadowBannedArtistIds: Array = [], ): Promise<{ songs: Set; countBeforeLimit: number }> { const gameOptions = guildPreference.gameOptions; @@ -512,12 +507,7 @@ export default class SongSelector { queryBuilder = queryBuilder.where( "rank", "<=", - premium - ? parseInt( - process.env.PREMIUM_AUDIO_SONGS_PER_ARTIST as string, - 10, - ) - : parseInt(process.env.AUDIO_SONGS_PER_ARTIST as string, 10), + parseInt(process.env.AUDIO_SONGS_PER_ARTIST as string, 10), ); result = await queryBuilder.execute(); @@ -556,7 +546,6 @@ export default class SongSelector { static async getSpotifySongList( guildID: string, - isPremium: boolean, playlistID: string, forceRefreshMetadata: boolean, messageContext?: MessageContext, @@ -566,23 +555,12 @@ export default class SongSelector { await State.spotifyManager.getMatchedSpotifySongs( guildID, playlistID, - isPremium, forceRefreshMetadata, messageContext, interaction, ); - const result = new Set( - matchedSongs.filter( - (x) => - x.rank <= - Number( - isPremium - ? process.env.PREMIUM_AUDIO_SONGS_PER_ARTIST - : process.env.AUDIO_SONGS_PER_ARTIST, - ), - ), - ); + const result = new Set(matchedSongs); return { songs: result, diff --git a/src/test/ci/begin.test.ts b/src/test/ci/begin.test.ts index 067fd1fc0..fa24f8f36 100644 --- a/src/test/ci/begin.test.ts +++ b/src/test/ci/begin.test.ts @@ -51,7 +51,6 @@ describe("begin command", () => { "dummy", gameStarter, GameType.CLASSIC, - false, ); sandbox.restore(); @@ -86,7 +85,6 @@ describe("begin command", () => { "dummy", gameStarter, GameType.TEAMS, - true, ); sandbox.restore(); @@ -103,7 +101,7 @@ describe("begin command", () => { }); }); - describe("atleast 1 team has been added", () => { + describe("at least 1 team has been added", () => { it("should return false", () => { const scoreboard = gameSession.scoreboard as TeamScoreboard; scoreboard.addTeam( diff --git a/src/test/ci/command_prechecks.test.ts b/src/test/ci/command_prechecks.test.ts index 0079eb96d..bfd4ebad9 100644 --- a/src/test/ci/command_prechecks.test.ts +++ b/src/test/ci/command_prechecks.test.ts @@ -1,5 +1,4 @@ import * as discord_utils from "../../helpers/discord_utils"; -import * as game_utils from "../../helpers/game_utils"; import * as management_utils from "../../helpers/management_utils"; import CommandPrechecks from "../../command_prechecks"; import GameSession from "../../structures/game_session"; @@ -37,7 +36,6 @@ describe("command prechecks", () => { "dummy", new KmqMember("dummy"), GameType.CLASSIC, - false, ); describe("inSessionCommandPrecheck", () => { @@ -60,7 +58,6 @@ describe("command prechecks", () => { "1234", "12345", mockKmqMember, - true, ); describe("user and bot are in the same vc", () => { @@ -104,7 +101,6 @@ describe("command prechecks", () => { "1234", mockKmqMember, GameType.ELIMINATION, - true, ); const teamGameSession = new GameSession( @@ -114,7 +110,6 @@ describe("command prechecks", () => { "1234", mockKmqMember, GameType.TEAMS, - false, ); const classicGameSession = new GameSession( @@ -124,7 +119,6 @@ describe("command prechecks", () => { "1234", mockKmqMember, GameType.CLASSIC, - true, ); describe("in the same voice channel", () => { @@ -223,7 +217,6 @@ describe("command prechecks", () => { "1234", "1235", mockKmqMember, - false, ); const gameSession = new GameSession( @@ -233,7 +226,6 @@ describe("command prechecks", () => { "1235", mockKmqMember, GameType.CLASSIC, - true, ); describe("session is null", () => { @@ -282,7 +274,6 @@ describe("command prechecks", () => { debugServerId, mockKmqMember, GameType.CLASSIC, - false, ); afterEach(() => { @@ -375,7 +366,6 @@ describe("command prechecks", () => { "12345", mockKmqMember, GameType.CLASSIC, - true, ); afterEach(() => { @@ -422,7 +412,6 @@ describe("command prechecks", () => { "12345", mockKmqMember, GameType.CLASSIC, - true, ); describe("restart is scheduled", () => { @@ -458,117 +447,6 @@ describe("command prechecks", () => { }); }); - describe("premiumPrecheck", () => { - const gameSession = new GameSession( - new GuildPreference("12"), - "123", - "1234", - "12345", - mockKmqMember, - GameType.CLASSIC, - false, - ); - - describe("user is premium", () => { - it("should return true", async () => { - sandbox - .stub(game_utils, "isUserPremium") - .callsFake(() => Promise.resolve(true)); - - assert.strictEqual( - await CommandPrechecks.premiumPrecheck({ - messageContext, - session: gameSession, - }), - true, - ); - }); - }); - - describe("user is not premium", () => { - it("should return false", async () => { - sandbox - .stub(game_utils, "isUserPremium") - .callsFake(() => Promise.resolve(false)); - - assert.strictEqual( - await CommandPrechecks.premiumPrecheck({ - messageContext, - session: gameSession, - }), - false, - ); - }); - }); - }); - - describe("premiumOrDebugServerPrecheck", () => { - const debugServerId = "123456789"; - const gameSession = new GameSession( - new GuildPreference("12"), - "123", - "1234", - "12345", - mockKmqMember, - GameType.CLASSIC, - false, - ); - - afterEach(() => { - delete process.env.DEBUG_SERVER_ID; - }); - - describe("user is premium", () => { - it("should return true", async () => { - sandbox - .stub(game_utils, "isUserPremium") - .callsFake(() => Promise.resolve(true)); - - assert.strictEqual( - await CommandPrechecks.premiumOrDebugServerPrecheck({ - messageContext, - session: gameSession, - }), - true, - ); - }); - }); - - describe("message originates in debug server", () => { - it("should return true", async () => { - process.env.DEBUG_SERVER_ID = debugServerId; - - assert.strictEqual( - await CommandPrechecks.premiumOrDebugServerPrecheck({ - session: gameSession, - messageContext: { - ...messageContext, - guildID: debugServerId, - }, - }), - true, - ); - }); - }); - - describe("user is not premium, nor does message originate in debug server", () => { - it("should return false", async () => { - process.env.DEBUG_SERVER_ID = "abc"; - sandbox - .stub(game_utils, "isUserPremium") - .callsFake(() => Promise.resolve(false)); - - assert.strictEqual( - await CommandPrechecks.premiumOrDebugServerPrecheck({ - session: gameSession, - messageContext, - }), - false, - ); - }); - }); - }); - describe("notSpotifyPrecheck", () => { const GUILD_ID = "123"; @@ -585,7 +463,6 @@ describe("command prechecks", () => { GUILD_ID, mockKmqMember, GameType.CLASSIC, - false, ); describe("spotify playlist set", () => { @@ -628,7 +505,6 @@ describe("command prechecks", () => { GUILD_ID, mockKmqMember, GameType.HIDDEN, - false, ); describe("change to multiple choice during hidden game via default reset", () => { @@ -712,7 +588,6 @@ describe("command prechecks", () => { GUILD_ID, mockKmqMember, GameType.CLASSIC, - false, ); describe("change to multiple choice via default reset", () => { @@ -800,7 +675,6 @@ describe("command prechecks", () => { GUILD_ID, mockKmqMember, GameType.HIDDEN, - false, ); describe("change timer to another value", () => { @@ -866,7 +740,6 @@ describe("command prechecks", () => { GUILD_ID, mockKmqMember, GameType.TEAMS, - false, ); describe("change timer to another value", () => { diff --git a/src/test/ci/game_session.test.ts b/src/test/ci/game_session.test.ts index dbfd5e931..ddc0abac5 100644 --- a/src/test/ci/game_session.test.ts +++ b/src/test/ci/game_session.test.ts @@ -65,7 +65,6 @@ describe("game session", () => { "123", new KmqMember("123"), GameType.CLASSIC, - true, ); sandbox.stub(Session, "getSession").callsFake(() => gameSession); diff --git a/src/test/ci/game_utils.test.ts b/src/test/ci/game_utils.test.ts index 450577594..f4414f9f8 100644 --- a/src/test/ci/game_utils.test.ts +++ b/src/test/ci/game_utils.test.ts @@ -299,10 +299,7 @@ describe("game utils", () => { it("should return the expected song count", async () => { const limit = 50; await guildPreference.setLimit(0, limit); - const songCount = await getAvailableSongCount( - guildPreference, - true, - ); + const songCount = await getAvailableSongCount(guildPreference); assert(songCount.count); assert(songCount.countBeforeLimit); @@ -324,7 +321,6 @@ describe("game utils", () => { guildId, new KmqMember("id"), GameType.CLASSIC, - false, ); sandbox.restore(); diff --git a/src/test/ci/leaderboard.test.ts b/src/test/ci/leaderboard.test.ts index 296b8c27d..12b9c3cd3 100644 --- a/src/test/ci/leaderboard.test.ts +++ b/src/test/ci/leaderboard.test.ts @@ -343,7 +343,6 @@ describe("leaderboard command", () => { SERVER_ID, gameStarter, GameType.CLASSIC, - false, ); sandbox.restore(); @@ -731,7 +730,6 @@ describe("leaderboard command", () => { SERVER_ID, gameStarter, GameType.CLASSIC, - true, ); sandbox.restore(); diff --git a/src/test/ci/listening_session.test.ts b/src/test/ci/listening_session.test.ts index e0d251ce0..c942c600e 100644 --- a/src/test/ci/listening_session.test.ts +++ b/src/test/ci/listening_session.test.ts @@ -56,7 +56,6 @@ describe("listening session", () => { "123", "123", new KmqMember("123"), - true, ); sandbox diff --git a/src/test/ci/song_selector.test.ts b/src/test/ci/song_selector.test.ts index b42e1822b..515854a1d 100644 --- a/src/test/ci/song_selector.test.ts +++ b/src/test/ci/song_selector.test.ts @@ -49,7 +49,6 @@ describe("song selector", () => { const { songs } = await SongSelector.getFilteredSongList( guildPreference, - true, ); assert.strict(songs.size > 0); @@ -72,10 +71,8 @@ describe("song selector", () => { ] as Array; await guildPreference.setGender(genderSetting); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -97,10 +94,8 @@ describe("song selector", () => { it("should only return the songs matching the specified group", async () => { const selectedArtist = { id: 208, name: "Twice" }; await guildPreference.setGroups([selectedArtist]); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -121,10 +116,8 @@ describe("song selector", () => { ]; await guildPreference.setGroups(selectedArtists); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -150,10 +143,8 @@ describe("song selector", () => { it("should only return the songs matching the specified gender, and the explicitly included artists", async () => { await guildPreference.setGender(["female"]); await guildPreference.setIncludes(includedArtists); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -180,10 +171,8 @@ describe("song selector", () => { it("should only return the songs matching the specified gender, explicitly excluding excluded artists ", async () => { await guildPreference.setGender(["female"]); await guildPreference.setExcludes(excludeArtists); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -204,10 +193,8 @@ describe("song selector", () => { describe("soloists", () => { it("should only return the songs by soloists", async () => { await guildPreference.setArtistType(ArtistType.SOLOIST); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -220,10 +207,8 @@ describe("song selector", () => { describe("groups", () => { it("should only return the songs by groups", async () => { await guildPreference.setArtistType(ArtistType.GROUP); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -238,10 +223,8 @@ describe("song selector", () => { describe("songs in or after 2016", () => { it("should only return the songs published in or after 2016", async () => { await guildPreference.setBeginningCutoffYear(2016); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -257,10 +240,8 @@ describe("song selector", () => { describe("songs in or before 2015", () => { it("should only return the songs published in or before 2015", async () => { await guildPreference.setEndCutoffYear(2015); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -276,10 +257,8 @@ describe("song selector", () => { it("should only return the songs published between 2008 and 2018", async () => { await guildPreference.setBeginningCutoffYear(2008); await guildPreference.setEndCutoffYear(2018); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -297,10 +276,8 @@ describe("song selector", () => { it("should only return the songs published in 2017", async () => { await guildPreference.setBeginningCutoffYear(2017); await guildPreference.setEndCutoffYear(2017); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -322,10 +299,8 @@ describe("song selector", () => { describe("random shuffle mode", () => { it("should have all songs with equal weight", async () => { - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.ok( @@ -345,7 +320,6 @@ describe("song selector", () => { const { songs } = await SongSelector.getFilteredSongList( guildPreference, - true, ); const songsArray = Array.from(songs); @@ -372,7 +346,6 @@ describe("song selector", () => { const { songs } = await SongSelector.getFilteredSongList( guildPreference, - true, ); const songsArray = Array.from(songs); @@ -400,10 +373,8 @@ describe("song selector", () => { await guildPreference.setShuffleType( ShuffleType.CHRONOLOGICAL, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); @@ -441,10 +412,8 @@ describe("song selector", () => { await guildPreference.setShuffleType( ShuffleType.REVERSE_CHRONOLOGICAL, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); @@ -486,10 +455,8 @@ describe("song selector", () => { await guildPreference.setSubunitPreference( SubunitsPreference.EXCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -508,10 +475,8 @@ describe("song selector", () => { SubunitsPreference.INCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); const expectedSubunitIds = [17, 43, 105, 248, 4531]; @@ -548,10 +513,8 @@ describe("song selector", () => { SubunitsPreference.INCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); @@ -579,7 +542,6 @@ describe("song selector", () => { const { songs } = await SongSelector.getFilteredSongList( guildPreference, - true, shadowbannedArtists, ); @@ -631,10 +593,8 @@ describe("song selector", () => { SubunitsPreference.INCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual(unmatchedGroups.length, 0); @@ -657,10 +617,8 @@ describe("song selector", () => { await guildPreference.setOstPreference( OstPreference.EXCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -677,10 +635,8 @@ describe("song selector", () => { await guildPreference.setOstPreference( OstPreference.INCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); // should have both non osts and osts assert.strictEqual( @@ -700,10 +656,8 @@ describe("song selector", () => { await guildPreference.setOstPreference( OstPreference.EXCLUSIVE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -722,10 +676,8 @@ describe("song selector", () => { await guildPreference.setRemixPreference( RemixPreference.EXCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -742,10 +694,8 @@ describe("song selector", () => { await guildPreference.setRemixPreference( RemixPreference.INCLUDE, ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); // should have both non remixes and remixes assert.strictEqual( @@ -771,10 +721,8 @@ describe("song selector", () => { it("should only return the top [x] number of songs", async () => { const expectedSongCount = limit; await guildPreference.setLimit(0, limit); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strictEqual(songs.size, expectedSongCount); }); @@ -785,10 +733,8 @@ describe("song selector", () => { describe("language is set to korean only", () => { it("should only return the korean songs", async () => { await guildPreference.setLanguageType(LanguageType.KOREAN); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); @@ -809,10 +755,8 @@ describe("song selector", () => { describe("language is set to all", () => { it("should return all songs regardless of language", async () => { await guildPreference.setLanguageType(LanguageType.ALL); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); // there is at least one song of each language @@ -832,10 +776,8 @@ describe("song selector", () => { describe("release type is set to official only", () => { it("should return main music videos only", async () => { await guildPreference.setReleaseType(ReleaseType.OFFICIAL); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strict(songs.size > 0); assert.strictEqual( @@ -850,10 +792,8 @@ describe("song selector", () => { describe("release type is set to all", () => { it("should return music videos and audio-only", async () => { await guildPreference.setReleaseType(ReleaseType.ALL); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strictEqual( Array.from(songs).filter( @@ -873,10 +813,8 @@ describe("song selector", () => { it("should match that exact one song", async () => { const songLink = "9bZkp7q19f0"; await guildPreference.setForcePlaySong(songLink); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strictEqual(songs.size, 1); assert.strictEqual([...songs][0].youtubeLink, songLink); @@ -888,59 +826,13 @@ describe("song selector", () => { await guildPreference.setForcePlaySong( "oppa gangnam style", ); - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - true, - ); + const { songs } = + await SongSelector.getFilteredSongList(guildPreference); assert.strictEqual(songs.size, 0); }); }); }); - - describe("premium", () => { - describe("non-premium songs", () => { - it("should only return non-premium songs", async () => { - const isPremium = false; - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - isPremium, - ); - - assert.strict(songs.size > 0); - assert.strictEqual( - Array.from(songs).every( - (song) => - song.rank <= - Number(process.env.AUDIO_SONGS_PER_ARTIST), - ), - true, - ); - }); - }); - - describe("premium songs", () => { - it("should return premium and non-premium songs", async () => { - const isPremium = true; - const { songs } = await SongSelector.getFilteredSongList( - guildPreference, - isPremium, - ); - - assert.strict(songs.size > 0); - assert.strictEqual( - Array.from(songs).every( - (song) => - song.rank <= - Number( - process.env.PREMIUM_AUDIO_SONGS_PER_ARTIST, - ), - ), - true, - ); - }); - }); - }); }); describe("selectRandomSong", () => { @@ -953,10 +845,7 @@ describe("song selector", () => { it("should only return female/coed songs", async () => { const femaleOrCoedSongs: Array = []; const filteredSongs = ( - await SongSelector.getFilteredSongList( - guildPreference, - true, - ) + await SongSelector.getFilteredSongList(guildPreference) ).songs; assert.strict(filteredSongs.size > 0); @@ -984,10 +873,7 @@ describe("song selector", () => { it("should only return male/coed songs", async () => { const maleOrCoedSongs: Array = []; const filteredSongs = ( - await SongSelector.getFilteredSongList( - guildPreference, - true, - ) + await SongSelector.getFilteredSongList(guildPreference) ).songs; assert.strict(filteredSongs.size > 0); @@ -1018,10 +904,7 @@ describe("song selector", () => { const numIgnored = 10; await guildPreference.setLimit(0, 100); const filteredSongs = ( - await SongSelector.getFilteredSongList( - guildPreference, - true, - ) + await SongSelector.getFilteredSongList(guildPreference) ).songs; assert.strict(filteredSongs.size > 0); @@ -1066,7 +949,7 @@ describe("song selector", () => { describe("normal case", () => { it("should return the random song", async () => { - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); const song = songSelector.queryRandomSong(guildPreference); assert(song); }); @@ -1075,7 +958,7 @@ describe("song selector", () => { describe("selected song set smaller than last played history threshold", () => { it("should return null", async () => { await guildPreference.setLimit(0, 0); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); const song = songSelector.queryRandomSong(guildPreference); assert.strictEqual(song, null); }); @@ -1084,7 +967,7 @@ describe("song selector", () => { describe("unique shuffle mode", () => { it("should return the random song, and add it to the unique song history", async () => { await guildPreference.setShuffleType(ShuffleType.RANDOM); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); const song = songSelector.queryRandomSong(guildPreference); assert(song); @@ -1101,7 +984,7 @@ describe("song selector", () => { const limit = 100; await guildPreference.setShuffleType(ShuffleType.POPULARITY); await guildPreference.setLimit(0, limit); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); const songs: Array = []; for (let i = 0; i < limit; i++) { @@ -1142,7 +1025,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); // play all songs but one for (let i = 0; i < numberSongs - 1; i++) { @@ -1168,10 +1051,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs( - guildPreference, - true, - ); + await songSelector.reloadSongs(guildPreference); // play all songs for (let i = 0; i < numberSongs; i++) { @@ -1204,10 +1084,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs( - guildPreference, - true, - ); + await songSelector.reloadSongs(guildPreference); // play all songs but one for (let i = 0; i < numberSongs - 1; i++) { @@ -1246,7 +1123,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); // play all songs but one for (let i = 0; i < numberSongs * numberOfResets; i++) { @@ -1280,7 +1157,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); // play more than enough songs for the new selected song set, but not enough for current const songs = [...songSelector.getSongs().songs] @@ -1296,7 +1173,7 @@ describe("song selector", () => { // reload for new selected song set await guildPreference.setLimit(0, newNumberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); // expect unique song queue to have been reset assert.strictEqual( @@ -1315,7 +1192,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); let songs = [...songSelector.getSongs().songs].map( (x) => x.youtubeLink, ); @@ -1332,7 +1209,7 @@ describe("song selector", () => { // update to superset song set await guildPreference.setLimit(0, newNumberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); assert.strictEqual( songSelector.checkUniqueSongQueue(), false, @@ -1361,7 +1238,7 @@ describe("song selector", () => { ShuffleType.RANDOM, ); await guildPreference.setLimit(0, numberSongs); - await songSelector.reloadSongs(guildPreference, true); + await songSelector.reloadSongs(guildPreference); const songs = [...songSelector.getSongs().songs].map( (x) => x.youtubeLink, );