Add activity type enum

merge-requests/9/merge
Bsian 2020-04-17 04:27:46 +01:00
parent 99ef533121
commit c72d5c1f1b
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 11 additions and 3 deletions

View File

@ -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);