From b126486a0ab9c383c3629b07f4d770dfa5217e8a Mon Sep 17 00:00:00 2001 From: Bsian Date: Fri, 17 Apr 2020 03:27:46 +0000 Subject: [PATCH] Add activity type enum (cherry picked from commit c72d5c1f1b1ed66fde8233b445957d4b3ac22909) --- src/commands/game.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/commands/game.ts b/src/commands/game.ts index f1d18d2..f7bd914 100644 --- a/src/commands/game.ts +++ b/src/commands/game.ts @@ -1,7 +1,15 @@ /* eslint-disable prefer-destructuring */ -import { Activity, Member, Message, PrivateChannel, GroupChannel } from 'eris'; +import { Activity, Member, Message } from 'eris'; import { Client, Command, RichEmbed } from '../class'; +enum ActivityType { + PLAYING = 0, + STREAMING = 1, + LISTENING = 2, + WATCHING = 3, + CUSTOM_STATUS = 4 +} + export default class Game extends Command { constructor(client: Client) { super(client); @@ -27,14 +35,14 @@ export default class Game extends Command { if (member.activities.length <= 0) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Cannot find a game for this member.***`); const embed = new RichEmbed(); let mainStatus: Activity; - if (member.activities[0].type === 4) { + if (member.activities[0].type === ActivityType.CUSTOM_STATUS) { mainStatus = member.activities[1]; embed.setDescription(`*${member.activities[0].state}*`); } else { mainStatus = member.activities[0]; } embed.setAuthor(member.user.username, member.user.avatarURL); - if (mainStatus.type === 4) { + if (mainStatus.type === ActivityType.LISTENING) { embed.setTitle('Spotify'); embed.setColor('#1ed760'); embed.addField('Song', mainStatus.details, true);