fix(DataResolver): fix circular dependency error with GuildTemplate (#5622)

This commit is contained in:
cherryblossom000
2021-05-23 05:40:44 +10:00
committed by GitHub
parent 14c6802438
commit b376f31af9
4 changed files with 41 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
'use strict';
const { token } = require('./auth');
const { Client } = require('../src');
const client = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES'] });
client
.on('ready', () => console.log('ready'))
.on('message', async message => {
try {
const templates = await message.guild.fetchTemplates();
if (!templates.size) {
console.log('no templates');
} else {
const guild = await templates.first().createGuild('guild name');
console.log(`created guild with ID ${guild.id}`);
await guild.delete();
console.log('deleted guild');
}
} catch (error) {
console.error(error);
} finally {
client.destroy();
}
})
.login(token)
.catch(console.error);