mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Merged master into indev-prism
This commit is contained in:
@@ -315,6 +315,14 @@ class Client extends EventEmitter {
|
||||
return this.rest.methods.getWebhook(id, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch available voice regions
|
||||
* @returns {Collection<string, VoiceRegion>}
|
||||
*/
|
||||
fetchVoiceRegions() {
|
||||
return this.rest.methods.fetchVoiceRegions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sweeps all channels' messages and removes the ones older than the max message lifetime.
|
||||
* If the message has been edited, the time of the edit is used rather than the time of the original message.
|
||||
|
||||
@@ -17,6 +17,7 @@ const UserProfile = require('../../structures/UserProfile');
|
||||
const ClientOAuth2Application = require('../../structures/ClientOAuth2Application');
|
||||
const Channel = require('../../structures/Channel');
|
||||
const Guild = require('../../structures/Guild');
|
||||
const VoiceRegion = require('../../structures/VoiceRegion');
|
||||
|
||||
class RESTMethods {
|
||||
constructor(restManager) {
|
||||
@@ -47,6 +48,15 @@ class RESTMethods {
|
||||
return this.rest.makeRequest('get', Constants.Endpoints.botGateway, true);
|
||||
}
|
||||
|
||||
fetchVoiceRegions(guildID) {
|
||||
const endpoint = Constants.Endpoints[guildID ? 'guildVoiceRegions' : 'voiceRegions'];
|
||||
return this.rest.makeRequest('get', guildID ? endpoint(guildID) : endpoint, true).then(res => {
|
||||
const regions = new Collection();
|
||||
for (const region of res) regions.set(region.id, new VoiceRegion(region));
|
||||
return regions;
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage(channel, content, { tts, nonce, embed, disableEveryone, split, code, reply } = {}, file = null) {
|
||||
return new Promise((resolve, reject) => { // eslint-disable-line complexity
|
||||
if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);
|
||||
|
||||
Reference in New Issue
Block a user