mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Docs update and updateServer option processing
This commit is contained in:
@@ -415,11 +415,36 @@ export default class InternalClient {
|
||||
return Promise.reject(new Error("server did not resolve"));
|
||||
}
|
||||
|
||||
if (!options.name) {
|
||||
options.name = server.name;
|
||||
var newOptions = {
|
||||
name: options.name || server.name,
|
||||
region: options.region || server.region
|
||||
};
|
||||
|
||||
if (options.icon) {
|
||||
newOptions.icon = this.resolver.resolveToBase64(options.icon);
|
||||
}
|
||||
if (!options.region) {
|
||||
options.region = server.region;
|
||||
if (options.splash) {
|
||||
newOptions.splash = this.resolver.resolveToBase64(options.splash);
|
||||
}
|
||||
if (options.owner) {
|
||||
var user = this.resolver.resolveUser(options.owner);
|
||||
if (!user) {
|
||||
return Promise.reject(new Error("owner could not be resolved"));
|
||||
}
|
||||
options.owner_id = user.id;
|
||||
}
|
||||
if (options.verificationLevel) {
|
||||
options.verification_level = user.verificationLevel;
|
||||
}
|
||||
if (options.afkChannel) {
|
||||
var channel = this.resolver.resolveUser(options.afkChannel);
|
||||
if (!channel) {
|
||||
return Promise.reject(new Error("afkChannel could not be resolved"));
|
||||
}
|
||||
options.afk_channel_id = channel.id;
|
||||
}
|
||||
if (options.afkTimeout) {
|
||||
options.afk_timeout = user.afkTimeout;
|
||||
}
|
||||
|
||||
return this.apiRequest("patch", Endpoints.SERVER(server.id), true, options)
|
||||
|
||||
Reference in New Issue
Block a user