feat(*): use enums for consistency and speed (#5843)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Shubham Parihar
2021-06-15 17:03:31 +05:30
committed by GitHub
parent 671436cbb8
commit f7eeccba4b
9 changed files with 100 additions and 69 deletions

View File

@@ -41,7 +41,7 @@ class ClientPresence extends Presence {
if (!activity.type) activity.type = 0;
data.activities.push({
type: typeof activity.type === 'number' ? activity.type : ActivityTypes.indexOf(activity.type),
type: typeof activity.type === 'number' ? activity.type : ActivityTypes[activity.type],
name: activity.name,
url: activity.url,
});
@@ -50,7 +50,7 @@ class ClientPresence extends Presence {
data.activities.push(
...this.activities.map(a => ({
name: a.name,
type: ActivityTypes.indexOf(a.type),
type: ActivityTypes[a.type],
url: a.url ?? undefined,
})),
);