Add Icons

This commit is contained in:
ui_creeperlv 2024-03-06 19:30:48 +05:30
parent a2000f8a19
commit 9a4c530c28
3 changed files with 11 additions and 2 deletions

View File

@ -3,16 +3,20 @@ class Message {
* @typedef {Object} MessageFields * @typedef {Object} MessageFields
* @property {import('discord.js').Snowflake} serverId * @property {import('discord.js').Snowflake} serverId
* @property {string|null} serverName * @property {string|null} serverName
* @property {import('url').Url|null} serverIcon
* @property {import('discord.js').Snowflake} authorId * @property {import('discord.js').Snowflake} authorId
* @property {string|null} authorName * @property {string|null} authorName
* @property {import('url').Url|null} authorIcon
* @property {string|null} message * @property {string|null} message
*/ */
constructor(){ constructor(){
this.serverId = 1; this.serverId = 1;
this.serverName = "[No Server]"; this.serverName = "[No Server]";
this.serverIcon = null;
this.authorId = 1; this.authorId = 1;
this.authorName = "[No Author]"; this.authorName = "[No Author]";
this.authorIcon = null;
this.message = "[No Message]"; this.message = "[No Message]";
} }
@ -36,7 +40,9 @@ class Message {
return { return {
serverId : this.serverId, serverId : this.serverId,
serverName : this.serverName, serverName : this.serverName,
serverIcon : this.serverIcon,
authorId : this.authorId, authorId : this.authorId,
authorIcon: this.authorIcon,
authorName: this.authorName, authorName: this.authorName,
message: this.message message: this.message
}; };

View File

@ -13,12 +13,13 @@ const send = (message, database, channelId , uuid , discord) => {
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.authorName, name: message.authorName,
iconURL: discord.user.displayAvatarURL() iconURL: message.authorIcon || discord.user.displayAvatarURL()
}) })
.setDescription(message.message) .setDescription(message.message)
.setTimestamp()
.setFooter({ .setFooter({
text: message.serverName, text: message.serverName,
iconURL: discord.user.displayAvatarURL() iconURL: message.serverIcon || discord.user.displayAvatarURL()
}) })
] ]
}).catch((error) => { }).catch((error) => {

View File

@ -32,8 +32,10 @@ const initMessageManager = async (
var _message = new Message(); var _message = new Message();
_message.authorId = message.author.id; _message.authorId = message.author.id;
_message.authorName = message.author.username; _message.authorName = message.author.username;
_message.authorIcon = message.author.displayAvatarURL();
_message.serverId = message.guild.id; _message.serverId = message.guild.id;
_message.serverName = message.guild.name, _message.serverName = message.guild.name,
_message.serverIcon = message.guild.iconURL();
_message.message = message.content; _message.message = message.content;
database.insert("xan.messages" , _message.toArray() , (uuid) => { database.insert("xan.messages" , _message.toArray() , (uuid) => {