Remove invites in phone messages

This commit is contained in:
Dragon Fire
2020-05-06 20:44:15 -04:00
parent 5f7b06bd37
commit 1305603c9f
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.7.0",
"version": "114.7.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+4 -1
View File
@@ -1,4 +1,5 @@
const { shorten, verify } = require('../../util/Util');
const inviteRegex = /discord(\.gg|app\.com\/invite|\.me)\//gi;
module.exports = class PhoneCall {
constructor(client, origin, recipient) {
@@ -54,7 +55,9 @@ module.exports = class PhoneCall {
send(channel, msg) {
if (msg.content.toLowerCase() === 'hang up') return this.hangup(channel);
this.setTimeout();
return channel.send(`☎️ **${msg.author.tag}:** ${shorten(msg.content, 1500)}`);
let content = msg.content.replace(inviteRegex, '[redacted invite]');
content = content.length > 1000 ? `${shorten(content, 1000)} (Message too long)` : content;
return channel.send(`☎️ **${msg.author.tag}:** ${content}`);
}
setTimeout() {