Added invite functionality and changed the EJS

This commit is contained in:
ION606
2023-04-01 21:49:27 -04:00
parent e0ffe24eec
commit f1415a9840
25 changed files with 589 additions and 201 deletions
+2 -6
View File
@@ -1,4 +1,4 @@
class msgAuthor {
export default class msgAuthor {
/** @type {String} */
id;
@@ -30,8 +30,4 @@ class msgAuthor {
}
}
}
}
module.exports = msgAuthor;
}
+3 -5
View File
@@ -1,6 +1,6 @@
const colConvert = require('../../utils/color_functions.js');
import colConvert from '../../utils/color_functions.js';
class Embed {
export class Embed {
/** @type {Number} */
color;
@@ -122,6 +122,4 @@ class Embed {
return retObj;
}
//#endregion
}
module.exports = Embed;
}
+65 -13
View File
@@ -1,19 +1,68 @@
const messageChannelTypes = require('./messageChannelTypes.js');
const author = require('./author.js');
const axios = require('axios');
const Embed = require('./embed');
import author from './author.js';
import axios from 'axios';
class Channel {
export class Channel {
/** @type {String} */
id;
/** @type {String} */
name;
/** @type {String} */
last_message_id;
/** @type {Number} */
type;
/** @type {Number} */
position;
/** @type {Number} */
flags;
/** @type {String} */
parent_id;
/** @type {import('../guilds/Guild.js').def} */
guild;
/** @type {[{id: String, type: String, allow: Number, deny: Number, allow_new: String, deny_nwe: String}]} */
permission_overwrites;
/** @type {Number} */
rate_limit_per_user;
/** @type {Boolean} */
nsfw;
/** @type {String} */
#token;
constructor(token, id) {
async getChannelData() {
const headers = {
Authorization: this.#token
}
const response = await axios.get(`https://discord.com/api/channels/${this.id}`, { headers });
const channelData = response.data;
for (const k in this) {
if (channelData[k]) {
this[k] = channelData[k];
}
}
}
constructor(token, channel, guild) {
this.#token = token;
this.id = id;
for (const k in this) {
if (channel[k]) this[k] = channel[k];
}
this.guild = guild;
}
/**
@@ -49,11 +98,11 @@ class Channel {
}
class message {
export class message {
/** @type {author} */
author;
/** @type {Object} */
/** @type {String} */
channel_id;
/** @type {Object[]} */
@@ -89,6 +138,9 @@ class message {
/** @type {Object[]} */
embeds;
/** @type {Guild} */
guild;
/** @type {String} */
guild_id;
@@ -96,7 +148,7 @@ class message {
type;
/** @type {Channel} */
channel
channel;
/** @type {String} */
#token;
@@ -167,7 +219,7 @@ class message {
/**
* @param {Object} msgRaw
*/
constructor(msgRaw, token) {
constructor(msgRaw, token, guild) {
this.#token = token;
for (const k in this) {
@@ -180,7 +232,7 @@ class message {
}
else {
if (k == 'channel_id') {
this.channel = new Channel(this.#token, msgRaw[k]);
this.channel = new Channel(this.#token, {id: msgRaw[k]}, null);
}
this[k] = msgRaw[k];
@@ -191,4 +243,4 @@ class message {
}
module.exports = { message, messageChannelTypes, Channel };
export {messageChannelTypes} from './messageChannelTypes.js';
+1 -1
View File
@@ -1,7 +1,7 @@
//Blatantly stolen from https://github.com/discordjs/discord-api-types/blob/main/gateway/v10.ts
module.exports = Object.freeze({
export const messageChannelTypes = Object.freeze({
/**
* A text channel within a guild
*/