-
Notifications
You must be signed in to change notification settings - Fork 7
/
EventLog.js
80 lines (78 loc) · 2.34 KB
/
EventLog.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
module.exports = {
log: function(time, logNumber, type, executor, target, reason){
if(typeof(time) == undefined || typeof(logNumber) == undefined || typeof(executor) == undefined || typeof(type) == undefined || typeof(target) == undefined || typeof(reason) == undefined) return;
try{
let emoji = "";
let message = "";
let typeCase = type;
if(type == "ban"){
emoji = ":hammer:";
typeCase = "banned";
}
else if(type == "mute"){
emoji = ":mute:";
typeCase = "muted";
}
else if(type == "kick"){
emoji = ":boot:";
typeCase = "kicked";
}
else if(type == "report"){
emoji = ":round_pushpin:";
typeCase = "reported";
}
else if(type == "unban"){
emoji = ":flag_white:";
typeCase = "unbanned";
}
else if(type == "unmute"){
emoji = ":loud_sound:";
typeCase = "unmuted";
}
else if(type == "warn"){
emoji = ":warning:";
typeCase = "warned";
}
if(logNumber!= 0){
message = `\`${time}\` \`[${logNumber}]\` ${emoji} **${executor}** ${typeCase} **${target.tag}** (ID: ${target.id})`;
}
else{
message = `\`${time}\` ${emoji} **${executor}** ${typeCase} **${target.tag}** (ID: ${target.id})`;
}
if(reason){
message = message+`\n\`[ Reason ]\` ${reason}`;
}
return message;
}catch(e){
return;
}
}
}
/* Using Audit Log
GUILD_UPDATE
CHANNEL_CREATE
CHANNEL_UPDATE
CHANNEL_DELETE
CHANNEL_OVERWRITE_CREATE
CHANNEL_OVERWRITE_UPDATE
CHANNEL_OVERWRITE_DELETE
MEMBER_KICK
MEMBER_PRUNE
MEMBER_BAN_ADD
MEMBER_BAN_REMOVE
MEMBER_UPDATE
MEMBER_ROLE_UPDATE
ROLE_CREATE
ROLE_UPDATE
ROLE_DELETE
INVITE_CREATE
INVITE_UPDATE
INVITE_DELETE
WEBHOOK_CREATE
WEBHOOK_UPDATE
WEBHOOK_DELETE
EMOJI_CREATE
EMOJI_UPDATE
EMOJI_DELETE
MESSAGE_DELETE
*/