fixed guild channels and interactions

This commit is contained in:
ION606
2023-04-02 09:49:47 -04:00
parent f1415a9840
commit 658b45feee
10 changed files with 445 additions and 22 deletions
+10 -6
View File
@@ -1,4 +1,4 @@
import author from '../messages/author.js';
import author from '../messages/User.js';
import Guild from './Guild.js'
import { Channel } from '../messages/message.js';
import axios from 'axios';
@@ -38,9 +38,13 @@ export default class invite {
async delete() {
return new Promise(async (resolve) => {
// const headers = { Authorization: this.#token }
// const response = await axios.delete(`https://discord.com/api/guilds/${this.guild.id}/roles`, role.toObj(), { headers });
// resolve(response.data);
try {
const headers = { Authorization: this.#token }
const response = await axios.delete(`https://discord.com/api/invites/${this.code}`, { headers });
resolve(response.data);
} catch (err) {
throw err.data;
}
});
}
@@ -49,8 +53,8 @@ export default class invite {
for (const k in this) {
if (o[k]) {
if (k == 'guild') { this.guild = guild }
else if (k == 'channel') { this.channel = this.guild.channels.get(o[k]['id']); }
else if (k == 'inviter') { this.inviter = new author(o[k], null); }
// else if (k == 'channel') { this.channel = this.guild.channels.cache?.get(o[k]['id']); }
else if (k == 'inviter') { this.inviter = new author(o[k]); }
else { this[k] = o[k]; }
} else { this[k] = 0; }
}