mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
refactor(*): use async functions (#6210)
This commit is contained in:
@@ -92,17 +92,13 @@ class Application extends Base {
|
||||
* Gets the application's rich presence assets.
|
||||
* @returns {Promise<Array<ApplicationAsset>>}
|
||||
*/
|
||||
fetchAssets() {
|
||||
return this.client.api.oauth2
|
||||
.applications(this.id)
|
||||
.assets.get()
|
||||
.then(assets =>
|
||||
assets.map(a => ({
|
||||
id: a.id,
|
||||
name: a.name,
|
||||
type: AssetTypes[a.type - 1],
|
||||
})),
|
||||
);
|
||||
async fetchAssets() {
|
||||
const assets = await this.client.api.oauth2.applications(this.id).assets.get();
|
||||
return assets.map(a => ({
|
||||
id: a.id,
|
||||
name: a.name,
|
||||
type: AssetTypes[a.type - 1],
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -155,7 +155,8 @@ class TextBasedChannel {
|
||||
const GuildMember = require('../GuildMember');
|
||||
|
||||
if (this instanceof User || this instanceof GuildMember) {
|
||||
return this.createDM().then(dm => dm.send(options));
|
||||
const dm = await this.createDM();
|
||||
return dm.send(options);
|
||||
}
|
||||
|
||||
let messagePayload;
|
||||
|
||||
Reference in New Issue
Block a user