Initial code commit

This commit is contained in:
ION606
2023-03-18 18:02:17 -04:00
parent 24316888ec
commit 35b993b3fe
12 changed files with 718 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
const messageChannelTypes = require('./messageChannelTypes.js');
class message {
/** @type {Object} */
author;
/** @type {Object} */
channel_id;
/** @type {Object[]} */
mentions;
/** @type {Object} */
member;
/** @type {String} */
id;
/** @type {Object} */
content;
/** @type {Object[]} */
attachments;
/** @type {String} */
guild_id;
/** @type {Object} */
type;
/**
* @param {Object} msgRaw
*/
constructor(msgRaw) {
for (const k in this) {
if (msgRaw[k] != undefined) {
if (k == 'type') {
this.type = (msgRaw['guild_id']) ? msgRaw[k] : 1;
} else {
this[k] = msgRaw[k];
}
}
}
}
}
module.exports = { message, messageChannelTypes };
@@ -0,0 +1,81 @@
//Blatantly stolen from https://github.com/discordjs/discord-api-types/blob/main/gateway/v10.ts
module.exports = Object.freeze({
/**
* A text channel within a guild
*/
GuildText: 0,
/**
* A direct message between users
*/
DM: 1,
/**
* A voice channel within a guild
*/
GuildVoice: 2,
/**
* A direct message between multiple users
*/
GroupDM: 3,
/**
* An organizational category that contains up to 50 channels
*
* See https://support.discord.com/hc/articles/115001580171
*/
GuildCategory: 4,
/**
* A channel that users can follow and crosspost into their own guild
*
* See https://support.discord.com/hc/articles/360032008192
*/
GuildAnnouncement: 5,
/**
* A temporary sub-channel within a Guild Announcement channel
*/
AnnouncementThread: 10,
/**
* A temporary sub-channel within a Guild Text or Guild Forum channel
*/
PublicThread: 11,
/**
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
*/
PrivateThread: 12,
/**
* A voice channel for hosting events with an audience
*
* See https://support.discord.com/hc/articles/1500005513722
*/
GuildStageVoice: 13,
/**
* The channel in a Student Hub containing the listed servers
*
* See https://support.discord.com/hc/articles/4406046651927
*/
GuildDirectory: 14,
/**
* A channel that can only contain threads
*/
GuildForum: 15,
/**
* A channel that users can follow and crosspost into their own guild
*
* @deprecated This is the old name for {@apilink ChannelType#GuildAnnouncement}
*
* See https://support.discord.com/hc/articles/360032008192
*/
GuildNews: 5,
/**
* A temporary sub-channel within a Guild Announcement channel
*
* @deprecated This is the old name for {@apilink ChannelType#AnnouncementThread}
*/
GuildNewsThread: 10,
/**
* A temporary sub-channel within a Guild Text channel
*
* @deprecated This is the old name for {@apilink ChannelType#PublicThread}
*/
GuildPublicThread: 11,
});