Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 1 | // @ts-expect-error |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 2 | import { HaikuClient } from "jshaiku"; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 3 | import { |
| 4 | LinkCheck, |
| 5 | MalwareCheck, |
| 6 | NSFWCheck, |
| 7 | SizeCheck, |
| 8 | TestString, |
| 9 | TestImage |
| 10 | } from "../reflex/scanners.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 11 | import logAttachment from "../premium/attachmentLogs.js"; |
| 12 | import createLogException from "../utils/createLogException.js"; |
| 13 | import getEmojiByName from "../utils/getEmojiByName.js"; |
| 14 | import client from "../utils/client.js"; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 15 | import { callback as a } from "../reflex/statsChannelUpdate.js"; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame^] | 16 | import { Message, ThreadChannel } from "discord.js"; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 17 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 18 | export const event = "messageCreate"; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 19 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 20 | export async function callback(_client: HaikuClient, message: Message) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 21 | if (!message.guild) return; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 22 | if (message.author.bot) return; |
| 23 | if (message.channel.type === "DM") return; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 24 | try { |
| 25 | await a(client, await message.guild.members.fetch(message.author.id)); |
| 26 | } catch (e) { |
| 27 | console.log(e); |
| 28 | } |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 29 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 30 | const { |
| 31 | log, |
| 32 | NucleusColors, |
| 33 | entry, |
| 34 | renderUser, |
| 35 | renderDelta, |
| 36 | renderChannel |
| 37 | } = client.logger; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 38 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 39 | const fileNames = await logAttachment(message); |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 40 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 41 | const content = message.content.toLowerCase() || ""; |
| 42 | const config = await client.memory.readGuildInfo(message.guild.id); |
| 43 | const filter = getEmojiByName("ICONS.FILTER"); |
| 44 | let attachmentJump = ""; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 45 | if (config.logging.attachments.saved[message.channel.id + message.id]) { |
| 46 | attachmentJump = ` [[View attachments]](${ |
| 47 | config.logging.attachments.saved[message.channel.id + message.id] |
| 48 | })`; |
| 49 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 50 | const list = { |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 51 | messageId: entry(message.id, `\`${message.id}\``), |
| 52 | sentBy: entry(message.author.id, renderUser(message.author)), |
| 53 | sentIn: entry(message.channel.id, renderChannel(message.channel)), |
| 54 | deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())), |
| 55 | mentions: message.mentions.users.size, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 56 | attachments: entry( |
| 57 | message.attachments.size, |
| 58 | message.attachments.size + attachmentJump |
| 59 | ), |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 60 | repliedTo: entry( |
| 61 | message.reference ? message.reference.messageId : null, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 62 | message.reference |
| 63 | ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` |
| 64 | : "None" |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 65 | ) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 66 | }; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 67 | |
| 68 | if (config.filters.invite.enabled) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 69 | if ( |
| 70 | !config.filters.invite.allowed.channels.includes(message.channel.id) |
| 71 | ) { |
| 72 | if ( |
| 73 | /(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test( |
| 74 | content |
| 75 | ) |
| 76 | ) { |
| 77 | createLogException( |
| 78 | message.guild.id, |
| 79 | message.channel.id, |
| 80 | message.id |
| 81 | ); |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 82 | message.delete(); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 83 | const data = { |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 84 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 85 | type: "messageDelete", |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 86 | displayName: |
| 87 | "Message Deleted (Automated, Contained Invite)", |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 88 | calculateType: "autoModeratorDeleted", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 89 | color: NucleusColors.red, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 90 | emoji: "MESSAGE.DELETE", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 91 | timestamp: new Date().getTime() |
| 92 | }, |
| 93 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 94 | start: |
| 95 | filter + |
| 96 | " Contained invite\n\n" + |
| 97 | (content |
| 98 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 99 | : "**Message:** *Message had no content*") |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 100 | }, |
| 101 | list: list, |
| 102 | hidden: { |
| 103 | guild: message.channel.guild.id |
| 104 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 105 | }; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 106 | return log(data); |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | if (fileNames.files.length > 0) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 112 | for (const element of fileNames.files) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 113 | const url = element.url ? element.url : element.local; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame^] | 114 | if ( |
| 115 | /\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url) |
| 116 | ) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 117 | if ( |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame^] | 118 | config.filters.images.NSFW && |
| 119 | !(message.channel instanceof ThreadChannel |
| 120 | ? message.channel.parent?.nsfw |
| 121 | : message.channel.nsfw) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 122 | ) { |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame^] | 123 | if (await NSFWCheck(url)) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 124 | createLogException( |
| 125 | message.guild.id, |
| 126 | message.channel.id, |
| 127 | message.id |
| 128 | ); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 129 | await message.delete(); |
| 130 | const data = { |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 131 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 132 | type: "messageDelete", |
| 133 | displayName: "Message Deleted", |
| 134 | calculateType: "autoModeratorDeleted", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 135 | color: NucleusColors.red, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 136 | emoji: "MESSAGE.DELETE", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 137 | timestamp: new Date().getTime() |
| 138 | }, |
| 139 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 140 | start: |
| 141 | filter + |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame^] | 142 | " Image detected as NSFW\n\n" + |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 143 | (content |
| 144 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 145 | : "**Message:** *Message had no content*") |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 146 | }, |
| 147 | list: list, |
| 148 | hidden: { |
| 149 | guild: message.channel.guild.id |
| 150 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 151 | }; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 152 | return log(data); |
| 153 | } |
| 154 | } |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame^] | 155 | if (config.filters.wordFilter.enabled) { |
| 156 | const text = await TestImage(url); |
| 157 | const check = TestString( |
| 158 | text ?? "", |
| 159 | config.filters.wordFilter.words.loose, |
| 160 | config.filters.wordFilter.words.strict |
| 161 | ); |
| 162 | if (check !== null) { |
| 163 | createLogException( |
| 164 | message.guild.id, |
| 165 | message.channel.id, |
| 166 | message.id |
| 167 | ); |
| 168 | await message.delete(); |
| 169 | const data = { |
| 170 | meta: { |
| 171 | type: "messageDelete", |
| 172 | displayName: "Message Deleted", |
| 173 | calculateType: "autoModeratorDeleted", |
| 174 | color: NucleusColors.red, |
| 175 | emoji: "MESSAGE.DELETE", |
| 176 | timestamp: new Date().getTime() |
| 177 | }, |
| 178 | separate: { |
| 179 | start: |
| 180 | filter + |
| 181 | " Image contained filtered word\n\n" + |
| 182 | (content |
| 183 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 184 | : "**Message:** *Message had no content*") |
| 185 | }, |
| 186 | list: list, |
| 187 | hidden: { |
| 188 | guild: message.channel.guild.id |
| 189 | } |
| 190 | }; |
| 191 | return log(data); |
| 192 | } |
| 193 | } |
| 194 | if (config.filters.images.size) { |
| 195 | if (url.match(/\.+(webp|png|jpg)$/gi)) { |
| 196 | if (!(await SizeCheck(element))) { |
| 197 | createLogException( |
| 198 | message.guild.id, |
| 199 | message.channel.id, |
| 200 | message.id |
| 201 | ); |
| 202 | await message.delete(); |
| 203 | const data = { |
| 204 | meta: { |
| 205 | type: "messageDelete", |
| 206 | displayName: "Message Deleted", |
| 207 | calculateType: "autoModeratorDeleted", |
| 208 | color: NucleusColors.red, |
| 209 | emoji: "MESSAGE.DELETE", |
| 210 | timestamp: new Date().getTime() |
| 211 | }, |
| 212 | separate: { |
| 213 | start: |
| 214 | filter + |
| 215 | " Image was too small\n\n" + |
| 216 | (content |
| 217 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 218 | : "**Message:** *Message had no content*") |
| 219 | }, |
| 220 | list: list, |
| 221 | hidden: { |
| 222 | guild: message.channel.guild.id |
| 223 | } |
| 224 | }; |
| 225 | return log(data); |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | if (config.filters.malware) { |
| 231 | if (!(await MalwareCheck(url))) { |
| 232 | createLogException( |
| 233 | message.guild.id, |
| 234 | message.channel.id, |
| 235 | message.id |
| 236 | ); |
| 237 | await message.delete(); |
| 238 | const data = { |
| 239 | meta: { |
| 240 | type: "messageDelete", |
| 241 | displayName: "Message Deleted", |
| 242 | calculateType: "autoModeratorDeleted", |
| 243 | color: NucleusColors.red, |
| 244 | emoji: "MESSAGE.DELETE", |
| 245 | timestamp: new Date().getTime() |
| 246 | }, |
| 247 | separate: { |
| 248 | start: |
| 249 | filter + |
| 250 | " File detected as malware\n\n" + |
| 251 | (content |
| 252 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 253 | : "**Message:** *Message had no content*") |
| 254 | }, |
| 255 | list: list, |
| 256 | hidden: { |
| 257 | guild: message.channel.guild.id |
| 258 | } |
| 259 | }; |
| 260 | return log(data); |
| 261 | } |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 262 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 263 | } |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 264 | } |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 265 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 266 | const linkDetectionTypes = await LinkCheck(message); |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 267 | if (linkDetectionTypes.length > 0) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 268 | createLogException(message.guild.id, message.channel.id, message.id); |
| 269 | await message.delete(); |
| 270 | const data = { |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 271 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 272 | type: "messageDelete", |
| 273 | displayName: "Message Deleted", |
| 274 | calculateType: "autoModeratorDeleted", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 275 | color: NucleusColors.red, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 276 | emoji: "MESSAGE.DELETE", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 277 | timestamp: new Date().getTime() |
| 278 | }, |
| 279 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 280 | start: |
| 281 | filter + |
| 282 | ` Link filtered as ${linkDetectionTypes[0]?.toLowerCase()}\n\n` + |
| 283 | (content |
| 284 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 285 | : "**Message:** *Message had no content*") |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 286 | }, |
| 287 | list: list, |
| 288 | hidden: { |
| 289 | guild: message.channel.guild.id |
| 290 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 291 | }; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 292 | return log(data); |
| 293 | } |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 294 | |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 295 | if (config.filters.wordFilter.enabled) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 296 | const check = TestString( |
| 297 | content, |
| 298 | config.filters.wordFilter.words.loose, |
| 299 | config.filters.wordFilter.words.strict |
| 300 | ); |
| 301 | if (check !== null) { |
| 302 | createLogException( |
| 303 | message.guild.id, |
| 304 | message.channel.id, |
| 305 | message.id |
| 306 | ); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 307 | await message.delete(); |
| 308 | const data = { |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 309 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 310 | type: "messageDelete", |
| 311 | displayName: "Message Deleted", |
| 312 | calculateType: "autoModeratorDeleted", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 313 | color: NucleusColors.red, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 314 | emoji: "MESSAGE.DELETE", |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 315 | timestamp: new Date().getTime() |
| 316 | }, |
| 317 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 318 | start: |
| 319 | filter + |
| 320 | " Message contained filtered word\n\n" + |
| 321 | (content |
| 322 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 323 | : "**Message:** *Message had no content*") |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 324 | }, |
| 325 | list: list, |
| 326 | hidden: { |
| 327 | guild: message.channel.guild.id |
| 328 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 329 | }; |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 330 | return log(data); |
| 331 | } |
| 332 | } |
| 333 | |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 334 | if (config.filters.pings.everyone && message.mentions.everyone) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 335 | const data = { |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 336 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 337 | type: "everyonePing", |
| 338 | displayName: "Everyone Pinged", |
| 339 | calculateType: "messageMassPing", |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 340 | color: NucleusColors.yellow, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 341 | emoji: "MESSAGE.PING.EVERYONE", |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 342 | timestamp: new Date().getTime() |
| 343 | }, |
| 344 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 345 | start: content |
| 346 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 347 | : "**Message:** *Message had no content*" |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 348 | }, |
| 349 | list: list, |
| 350 | hidden: { |
| 351 | guild: message.channel.guild.id |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 352 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 353 | }; |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 354 | return log(data); |
| 355 | } |
| 356 | if (config.filters.pings.roles) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 357 | for (const roleId in message.mentions.roles) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 358 | if (!config.filters.pings.allowed.roles.includes(roleId)) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 359 | createLogException( |
| 360 | message.guild.id, |
| 361 | message.channel.id, |
| 362 | message.id |
| 363 | ); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 364 | await message.delete(); |
| 365 | const data = { |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 366 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 367 | type: "rolePing", |
| 368 | displayName: "Role Pinged", |
| 369 | calculateType: "messageMassPing", |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 370 | color: NucleusColors.yellow, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 371 | emoji: "MESSAGE.PING.ROLE", |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 372 | timestamp: new Date().getTime() |
| 373 | }, |
| 374 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 375 | start: content |
| 376 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 377 | : "**Message:** *Message had no content*" |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 378 | }, |
| 379 | list: list, |
| 380 | hidden: { |
| 381 | guild: message.channel.guild.id |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 382 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 383 | }; |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 384 | return log(data); |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 385 | } |
| 386 | } |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 387 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 388 | if ( |
| 389 | message.mentions.users.size >= config.filters.pings.mass && |
| 390 | config.filters.pings.mass |
| 391 | ) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 392 | createLogException(message.guild.id, message.channel.id, message.id); |
| 393 | await message.delete(); |
| 394 | const data = { |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 395 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 396 | type: "massPing", |
| 397 | displayName: "Mass Ping", |
| 398 | calculateType: "messageMassPing", |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 399 | color: NucleusColors.yellow, |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 400 | emoji: "MESSAGE.PING.MASS", |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 401 | timestamp: new Date().getTime() |
| 402 | }, |
| 403 | separate: { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 404 | start: content |
| 405 | ? `**Message:**\n\`\`\`${content}\`\`\`` |
| 406 | : "**Message:** *Message had no content*" |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 407 | }, |
| 408 | list: list, |
| 409 | hidden: { |
| 410 | guild: message.channel.guild.id |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 411 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 412 | }; |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 413 | return log(data); |
pineafan | 813bdf4 | 2022-07-24 10:39:10 +0100 | [diff] [blame] | 414 | } |
| 415 | } |