-
Notifications
You must be signed in to change notification settings - Fork 0
/
AuditLog.js
88 lines (82 loc) · 3.7 KB
/
AuditLog.js
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const Discord = module.require("discord.js");
module.exports.run = async (bot, message, msg, args) => {
function run() {
if (!message.member.hasPermission("ADMINISTRATOR") || args[0] == null) return;
var options = global.options
if (!global.options[message.guild.id]) {
global.options[message.guild.id] = {};
options = global.options[message.guild.id];
}
console.log(global.options[message.guild.id])
var logs = ["movement", "auditlog", "userlog", "auditmsg", "voice"]
if (args[0] == 'help') {
message.channel.send("Command usage: `nazi logchan <logtype> <channel>` (`Remove` instead of the channel name removes logs for the channel)`\n--Available log types--\nmovement - join/leave/ban/unban\nauditlog - nickname change\nuserlog - user account changes username/discriminator/profile pic\nauditmsg - delete/change\nvoice - join/leave/move (doesn't detect who moved the person)")
}
if (typeof options[message.guild.id].auditlog == 'undefined') options.auditlog = `audit-log`;
if (typeof options[message.guild.id].auditmsg == 'undefined') options.auditmsg = false;
if (typeof options[message.guild.id].movement == 'undefined') options.movement = `in-out`;
if (typeof options[message.guild.id].voice == 'undefined') options.voice = false;
if (typeof options[message.guild.id].userlog == 'undefined') options.userlog = false;
global.options[message.guild.id] = {
userlog: options.userlog,
auditmsg: options.auditmsg,
movement: options.movement,
voice: options.voice,
userlog: options.userlog
}
if (!logs.includes(args[0])) return;
if (typeof args[1] === 'undefined') {
if (args[0] == 'movement') {
message.channel.send(options[message.guild.id].movement)
}
if (args[0] == 'auditlog') {
message.channel.send(options[message.guild.id].auditlog)
}
if (args[0] == 'userlog') {
message.channel.send(options[message.guild.id].userlog)
}
if (args[0] == 'auditmsg') {
message.channel.send(options[message.guild.id].auditmsg)
}
if (args[0] == 'voice') {
message.channel.send(options[message.guild.id].voice)
}
} else if (args[1] == 'Remove') {
if (args[0] == 'movement') {
global.options[message.guild.id].movement = false;
}
if (args[0] == 'auditlog') {
global.options[message.guild.id].auditlog = false;
}
if (args[0] == 'userlog') {
global.options[message.guild.id].userlog = false;
}
if (args[0] == 'auditmsg') {
global.options[message.guild.id].auditmsg = false;
}
if (args[0] == 'voice') {
global.options[message.guild.id].voice = false;
}
} else {
if (args[0] == 'movement') {
global.options[message.guild.id].movement = args[1];
}
if (args[0] == 'auditlog') {
global.options[message.guild.id].auditlog = args[1];
}
if (args[0] == 'userlog') {
global.options[message.guild.id].userlog = args[1];
}
if (args[0] == 'auditmsg') {
global.options[message.guild.id].auditmsg = args[1];
}
if (args[0] == 'voice') {
global.options[message.guild.id].voice = args[1];
}
}
}
run();
}
module.exports.help = {
name: "logchan"
}