Fixed prefix with "mention" being weird

This commit is contained in:
2021-09-19 03:36:55 -07:00
parent e2f3e816a8
commit 2fad7347d2
+19 -1
View File
@@ -116,13 +116,31 @@ class Discord {
'!','@','#','$','%','^','&','*','(',')','-','=','_','+','\\','/','<','>','[',']','{','}','`','"',"'",',','.','~','|',';',':','?','、','。' '!','@','#','$','%','^','&','*','(',')','-','=','_','+','\\','/','<','>','[',']','{','}','`','"',"'",',','.','~','|',';',':','?','、','。'
]; ];
const isTag = (prefix: string) => {
return prefix.startsWith('<@!') && prefix.endsWith('>') ||
prefix.startsWith('<:') && prefix.endsWith('>') ||
prefix.startsWith('<a:') && prefix.endsWith('>') ||
prefix.startsWith('<#') && prefix.endsWith('>');
}
if((GuildCache.prefix.indexOf(' ') >= 0)) { if((GuildCache.prefix.indexOf(' ') >= 0)) {
if(noPrefixMessage.charAt(0) !== ' ') return; if(noPrefixMessage.charAt(0) !== ' ') return;
} }
else { else {
if(symbols.includes(GuildCache.prefix.charAt(GuildCache.prefix.length - 1))) { if(symbols.includes(GuildCache.prefix.charAt(GuildCache.prefix.length - 1))) {
if(noPrefixMessage.charAt(0) === ' ') return;
if(noPrefixMessage.charAt(0) === ' ') {
//Handle for "@Bot <command>"
if(isTag(GuildCache.prefix)) {}
else
return;
} }
else {
//Handle for "@Bot<command>"
if(isTag(GuildCache.prefix)) return;
}
}
else { else {
if(noPrefixMessage.charAt(0) !== ' ') return; if(noPrefixMessage.charAt(0) !== ' ') return;
} }