mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-05-14 22:26:54 +00:00
fixed guild channels and interactions
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user