forked from funnbot/Nitro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilterconf.js
More file actions
66 lines (53 loc) · 2.76 KB
/
Copy pathfilterconf.js
File metadata and controls
66 lines (53 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
exports.run = (message, bot, send) => {
if (!message.args[0]) return send("**The available subcommands are:**\n**info** - Get info about the current keyword config\n**exception** - Add/Remove exceptions from filtering\n**notify** - Toggles notification when a message is filtered\n**msg** - Change the message DM'd to the user when the message is filtered\n**strikes** - Enable or Disable strikes from using restricted keywords, see `" + message.guild.prefix + "pconf` for more info")
let filters = message.guild.filter
let sub = message.args[0]
if (sub === "info") {
let num = (!filters.keywords ? "None" : (Object.keys(filters.keywords).length > 0 ? Object.keys(filters.keywords).length : "None"))
let ex
if (filters.ex) {
let channel = (!filters.ex.channel ? "0 Channels" : (Object.keys(filters.ex.channel).length > 1 ? Object.keys(filters.ex.channel).length + " Channels" : "1 Channel"))
let role = (!filters.ex.role ? "0 Roles" : (Object.keys(filters.ex.role).length > 1 ? Object.keys(filters.ex.role).length + " Roles" : "1 Role"))
let user = (!filters.ex.user ? "0 Users" : (Object.keys(filters.ex.user).length > 1 ? Object.keys(filters.ex.user).length + " Users" : "1 Users"))
ex = `${channel}, ${role}, ${user}`
} else ex = "0 Channels, 0 Roles, 0 Users"
let embed = new bot.embed()
embed.setColor(0x9E1D42)
embed.setTitle("Filter Info")
embed.addField("# Of Filters", num, true)
embed.addField("Notify", filters.notify ? "true" : "false", true)
embed.addField("Strikes", filters.strikes ? "true" : "false", true)
embed.addField("Exceptions", ex)
embed.addField("Message", filters.msg ? filters.msg : "**Your message was deleted because it contained a restricted word**")
return send("", {
embed
})
} else if (sub === "exception") {
return send("Coming Soon!")
} else if (sub === "strikes") {
let strikes = message.guild.strikes
if (filters.strikes) {
message.send("**Disabling keyword strikes**")
delete filters.strikes
} else {
message.send("**Enabling keyword strikes**")
filters.strikes = true
}
} else if (sub === "notify") {
return send("Coming Soon!")
} else if (sub === "msg") {
return send("Coming Soon!")
} else {
send("**The available subcommands are:**\n**info** - Get info about the current keyword config\n**exception** - Add/Remove exceptions from filtering\n**notify** - Toggles notification when a message is filtered\n**msg** - Change the message sent when a message is filtered")
}
bot.config.setFilter(message.guild.id, filters)
}
exports.conf = {
userPerm: ["MANAGE_GUILD"],
botPerm: ["SEND_MESSAGES"],
coolDown: 0,
dm: false,
category: "Filter",
help: "Change keyword filter configuration",
args: "",
}