Skip to content

Commit

Permalink
fix - warnings where not being posted
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-flip authored Apr 3, 2023
1 parent 49d49d9 commit c7d14ab
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions commands/warn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { MessageEmbed } = require('discord.js');

const Warn = require('../database/models/Warn');

// TODO: recreate richmessage embed sender to it can be sent to other servers
Expand All @@ -9,30 +11,30 @@ function getServerEntry(serverID) {

// warns other servers
async function messageWarnedUserInGuild(channelID, userTag, userID, warnMessage, serverName) {
const embed = new MessageEmbed();
embed.setColor(16755456);
embed.setFooter({ text: `For more information about this user, use '/lookup ${userID}'` });
embed.setTitle(`A user on your server has been warned on '${serverName}'!`);
embed.setDescription(`Tag: \`${userTag}\`
ID: \`${userID}\`
Reason: \`\`\`${warnMessage || 'none'}\`\`\``);
const channel = await client.channels.cache.get(channelID);
client.functions.get('richEmbedMessage')
.run(client.user, channel,
`Tag: \`${userTag}\`
ID: \`${userID}\`
Reason: \`\`\`${warnMessage || 'none'}\`\`\``,
`A user on your server has been warned on '${serverName}'!`,
16755456,
`For more information about this user, use '/lookup ${userID}'`);
channel.send({ embeds: [embed] });
}

// warns other servers for aliases
async function messageWarnedAliasUserInGuild(channelID, userTag, userID, warnMessage, serverName, orgUserTag) {
const channel = await client.channels.cache.get(channelID);
client.functions.get('richEmbedMessage')
.run(client.user, channel,
`**The user \`${userTag}\` is an alias of a user that has been warned!**
const embed = new MessageEmbed();
embed.setColor(16755456);
embed.setFooter({ text: `For more information about this user, use '/lookup ${orgUserTag}'` });
embed.setTitle(`An alias of a user on your server has been warned on '${serverName}'!`);
embed.setDescription(`**The user \`${userTag}\` is an alias of a user that has been warned!**
Tag: \`${orgUserTag}\`
ID: \`${userID}\`
Reason: \`\`\`${warnMessage || 'none'}\`\`\``,
`An alias of a user on your server has been warned on '${serverName}'!`,
16755456,
`For more information about this user, use '/lookup ${orgUserTag}'`);
Tag: \`${orgUserTag}\`
ID: \`${userID}\`
Reason: \`\`\`${warnMessage || 'none'}\`\`\``);
const channel = await client.channels.cache.get(channelID);
channel.send({ embeds: [embed] });
}

async function checkforInfectedGuilds(guild, orgUserID, warnMessage) {
Expand Down

0 comments on commit c7d14ab

Please sign in to comment.