aboutsummaryrefslogtreecommitdiff
path: root/src/commands/utilities/activity.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/utilities/activity.ts')
-rw-r--r--src/commands/utilities/activity.ts127
1 files changed, 75 insertions, 52 deletions
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index 3fca2b6..6829757 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -2,29 +2,62 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { DiscordAPIError, Message, VoiceChannel } from 'discord.js';
const activityMap = {
- 'Poker Night': '755827207812677713',
- 'Betrayal.io': '773336526917861400',
- 'Fishington.io': '814288819477020702',
- 'YouTube Together': '755600276941176913',
- 'Chess in the Park': '832012774040141894',
- 'Watch Together': '880218394199220334',
- 'Doodle Crew': '878067389634314250',
- 'Wood Snacks': '879863976006127627',
- 'Letter Tile': '879863686565621790'
+ 'Poker Night': {
+ id: '755827207812677713',
+ aliases: ['poker']
+ },
+ 'Betrayal.io': {
+ id: '773336526917861400',
+ aliases: ['betrayal']
+ },
+ 'Fishington.io': {
+ id: '814288819477020702',
+ aliases: ['fish', 'fishing', 'fishington']
+ },
+ 'YouTube Together': {
+ id: '755600276941176913',
+ aliases: ['youtube-together']
+ },
+ 'Chess In The Park': {
+ id: '832012774040141894',
+ aliases: ['chess']
+ },
+ 'Watch Together': {
+ id: '880218394199220334',
+ aliases: ['watch-together', 'yt', 'youtube']
+ },
+ 'Doodle Crew': {
+ id: '878067389634314250',
+ aliases: ['doodle-crew', 'doodle']
+ },
+ 'Wood Snacks': {
+ id: '879863976006127627',
+ aliases: ['wood-snacks', 'wood']
+ },
+ 'Letter Tile': {
+ id: '879863686565621790',
+ aliases: ['letter-tile', 'letter']
+ },
+ 'Spell Cast': {
+ id: '852509694341283871',
+ aliases: ['spell-cast', 'spell', 'cast']
+ },
+ 'Checkers In The Park': {
+ id: '832013003968348200',
+ aliases: ['checkers']
+ }
};
function map(phase: string) {
if (client.consts.regex.snowflake.test(phase)) return phase;
- else if (Reflect.has(activityMap, phase)) return activityMap[phase as keyof typeof activityMap];
- else if (['yt', 'youtube'].includes(phase)) return activityMap['Watch Together'];
- else if (['chess', 'park'].includes(phase)) return activityMap['Chess in the Park'];
- else if (['poker'].includes(phase)) return activityMap['Poker Night'];
- else if (['fish', 'fishing', 'fishington'].includes(phase)) return activityMap['Fishington.io'];
- else if (['betrayal'].includes(phase)) return activityMap['Betrayal.io'];
- else if (['doodle-crew', 'doodle'].includes(phase)) return activityMap['Doodle Crew'];
- else if (['wood-snacks', 'wood'].includes(phase)) return activityMap['Wood Snacks'];
- else if (['letter-tile', 'letter'].includes(phase)) return activityMap['Letter Tile'];
- else return null;
+ else if (phase in activityMap) return activityMap[phase as keyof typeof activityMap];
+
+ for (const activity in activityMap) {
+ if (activityMap[activity as keyof typeof activityMap].aliases.includes(phase.toLowerCase()))
+ return activityMap[activity as keyof typeof activityMap].id;
+ }
+
+ return null;
}
const activityTypeCaster = (_message: Message | BushMessage | BushSlashMessage, phrase: string) => {
@@ -56,53 +89,43 @@ export default class YouTubeCommand extends BushCommand {
'letter'
],
category: 'utilities',
- description: {
- content: 'Allows you to play discord activities in voice channels.',
- usage: [
- 'activity <channel> <`yt`|`youtube`|`chess`|`park`|`poker`|`fish`|`fishing`|`fishington`|`betrayal`>',
- 'yt <channel>' // you do not need to specify the activity if you use its alias.
- ],
- examples: ['yt 785281831788216364', 'activity 785281831788216364 yt']
- },
+ description: 'Allows you to play discord activities in voice channels.',
+ usage: [
+ `activity <channel> <${Object.values(activityMap)
+ .flatMap((a) => a.aliases)
+ .map((a) => `'${a}'`)
+ .join('|')}>`,
+ 'yt <channel>' // you do not need to specify the activity if you use its alias.
+ ],
+ examples: ['yt 785281831788216364', 'activity 785281831788216364 yt'],
args: [
{
id: 'channel',
+ description: 'The channel to create the activity in.',
type: 'voiceChannel',
- prompt: {
- start: 'What channel would you like to use?',
- retry: '{error} Choose a valid voice channel'
- }
+ prompt: 'What channel would you like to use?',
+ retry: '{error} Choose a valid voice channel',
+ slashType: 'CHANNEL',
+ channelTypes: ['GUILD_VOICE']
},
{
id: 'activity',
+ description: 'The activity to create an invite for.',
match: 'rest',
customType: activityTypeCaster,
- prompt: {
- start: 'What activity would you like to play?',
- retry:
- '{error} You must choose one of the following options: `yt`, `youtube`, `chess`, `park`, `poker`, `fish`, `fishing`, `fishington`, or `betrayal`.'
- }
- }
- ],
- slash: true,
- slashOptions: [
- {
- name: 'channel',
- description: 'What channel would you like to use?',
- type: 'CHANNEL',
- required: true
- },
- {
- name: 'activity',
- description: 'What activity would you like to play?',
- type: 'STRING',
- required: true,
+ prompt: 'What activity would you like to play?',
+ retry: `{error} You must choose one of the following options: ${Object.values(activityMap)
+ .flatMap((a) => a.aliases)
+ .map((a) => `\`${a}\``)
+ .join(', ')}.`,
+ slashType: 'STRING',
choices: Object.keys(activityMap).map((key) => ({
name: key,
- value: activityMap[key as keyof typeof activityMap]
+ value: activityMap[key as keyof typeof activityMap].id
}))
}
],
+ slash: true,
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: []
});