mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Resolve role IDs
This commit is contained in:
@@ -9,6 +9,7 @@ import TextChannel from "../../Structures/TextChannel";
|
||||
import VoiceChannel from "../../Structures/VoiceChannel";
|
||||
import ServerChannel from "../../Structures/ServerChannel";
|
||||
import PMChannel from "../../Structures/PMChannel";
|
||||
import Role from "../../Structures/Role";
|
||||
import Server from "../../Structures/Server";
|
||||
import Message from "../../Structures/Message";
|
||||
import Invite from "../../Structures/Invite";
|
||||
@@ -58,6 +59,21 @@ export default class Resolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
resolveRole(resource) {
|
||||
if (resource instanceof Role) {
|
||||
return resource;
|
||||
}
|
||||
if (resource instanceof String || typeof resource === "string") {
|
||||
var role = null;
|
||||
for (var server of this.internal.servers) {
|
||||
if (role = server.roles.find(r => r.id == resource)) {
|
||||
return role;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
resolveFile(resource) {
|
||||
if (typeof resource === "string" || resource instanceof String) {
|
||||
return fs.createReadStream(resource);
|
||||
|
||||
Reference in New Issue
Block a user