mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Remove invites in phone messages
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "114.7.0",
|
"version": "114.7.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { shorten, verify } = require('../../util/Util');
|
const { shorten, verify } = require('../../util/Util');
|
||||||
|
const inviteRegex = /discord(\.gg|app\.com\/invite|\.me)\//gi;
|
||||||
|
|
||||||
module.exports = class PhoneCall {
|
module.exports = class PhoneCall {
|
||||||
constructor(client, origin, recipient) {
|
constructor(client, origin, recipient) {
|
||||||
@@ -54,7 +55,9 @@ module.exports = class PhoneCall {
|
|||||||
send(channel, msg) {
|
send(channel, msg) {
|
||||||
if (msg.content.toLowerCase() === 'hang up') return this.hangup(channel);
|
if (msg.content.toLowerCase() === 'hang up') return this.hangup(channel);
|
||||||
this.setTimeout();
|
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() {
|
setTimeout() {
|
||||||
|
|||||||
Reference in New Issue
Block a user