Suppor string game updates and better setStatus logic

This commit is contained in:
abalabahaha
2015-12-24 02:07:05 -08:00
committed by Amish Shah
parent 830ba058d9
commit beb91913bb
4 changed files with 20 additions and 5721 deletions

View File

@@ -12,28 +12,12 @@ import PMChannel from "../../Structures/PMChannel";
import Server from "../../Structures/Server";
import Message from "../../Structures/Message";
import Invite from "../../Structures/Invite";
import Games from "../../../ref/gameMap";
export default class Resolver {
constructor(internal) {
this.internal = internal;
}
resolveGameID(resource) {
if (!isNaN(resource) && parseInt(resource) % 1 === 0) {
return resource;
}
if (typeof resource === "string" || resource instanceof String) {
var gameName = resource.toLowerCase();
var found = Games.find(game => game.name.toLowerCase() === gameName);
if(found) {
return found.id;
}
}
return null;
}
resolveToBase64(resource) {
if (resource instanceof Buffer) {
resource = resource.toString("base64");