Browse Source

refactor rules

main
Chris Mahoney 1 year ago
parent
commit
179dcb5740
  1. 0
      database.sqlite
  2. BIN
      database.sqlite3
  3. 5
      src/main.ts
  4. 24
      src/rules.ts

0
database.sqlite

BIN
database.sqlite3

5
src/main.ts

@ -1,11 +1,8 @@
require('dotenv').config();
import Discord = require('discord.js');
var handle_rules = require('./rules');
import handle_rules from './rules';
var [letters_messages, letters_reactions] = require('./letters');
import User = require('./db');
const bot = new Discord.Client();

24
src/rules.ts

@ -10,26 +10,24 @@ function handle_rules(msg: Discord.Message | Discord.PartialMessage) {
}
// # avoid-5
rules.set("826868893905322024", function(msg) {
if (!msg.content) {
return;
const banned = [ 'ℇ', 'e', 'E', '℈', '℮', 'ℯ', 'ℰ', 'ⅇ', '🇪', 'Ə' ]
function bold(msg: string) {
for (let i = 0; i < banned.length; i++) {
let str = banned[i];
msg = msg.replace(str, "**" + str + "**");
}
const banned = [ 'ℇ', 'e', 'E', '℈', '℮', 'ℯ', 'ℰ', 'ⅇ', '🇪', 'Ə' ]
function bold(msg: string) {
for (let i = 0; i < banned.length; i++) {
let str = banned[i];
msg = msg.replace(str, "**" + str + "**");
}
return msg;
}
return msg;
rules.set("826868893905322024", function(msg) {
if (!msg.content) {
return;
}
for (let i = 0; i < banned.length; i++) {
let str = banned[i];
console.log(str, msg.content.includes(str));
if (msg.content.includes(str)) {
msg.author?.send("Your message was cringe and included a banned character:\n> " + bold(msg.content));
msg.delete();
@ -98,4 +96,4 @@ rules.set("834816520856666172", function(msg) {
}
});
module.exports = handle_rules;
export default handle_rules;
Loading…
Cancel
Save