6 |
} |
} |
7 |
|
|
8 |
channel(callback, msg) { |
channel(callback, msg) { |
9 |
let channelID = app.config.get('logging_channel'); |
let channelID = app.config.props[msg.guild.id].logging_channel; |
10 |
let channel = msg.guild.channels.cache.find(c => c.id === channelID); |
let channel = msg.guild.channels.cache.find(c => c.id === channelID); |
11 |
|
|
12 |
if (channel) { |
if (channel) { |
21 |
new MessageEmbed() |
new MessageEmbed() |
22 |
.setColor('#007bff') |
.setColor('#007bff') |
23 |
.setTitle('Message Edited in #' + newMsg.channel.name + " (" + newMsg.channel.id + ")") |
.setTitle('Message Edited in #' + newMsg.channel.name + " (" + newMsg.channel.id + ")") |
24 |
.setDescription('**Before**\n' + oldMsg.content + '\n\**nAfter**\n', newMsg.content) |
.setDescription('**-+-+Before**\n' + oldMsg.content + '\n\n**-+-+After**\n' + newMsg.content) |
25 |
.addField('ID', newMsg.id) |
.addField('ID', newMsg.id) |
26 |
.setAuthor({ |
.setAuthor({ |
27 |
name: newMsg.author.tag, |
name: newMsg.author.tag, |
38 |
|
|
39 |
logDelete(msg) { |
logDelete(msg) { |
40 |
this.channel(async (channel) => { |
this.channel(async (channel) => { |
41 |
|
const embed = new MessageEmbed() |
42 |
|
.setColor('#f14a60') |
43 |
|
.setTitle('Message Deleted in #' + msg.channel.name + " (" + msg.channel.id + ")") |
44 |
|
.setDescription(msg.content) |
45 |
|
.setAuthor({ |
46 |
|
name: msg.author.tag, |
47 |
|
iconURL: msg.author.displayAvatarURL(), |
48 |
|
}) |
49 |
|
.addField('ID', msg.id) |
50 |
|
.setFooter({ |
51 |
|
text: "Deleted", |
52 |
|
}) |
53 |
|
.setTimestamp(); |
54 |
|
|
55 |
|
if (msg.attachments.size > 0) { |
56 |
|
let str = ''; |
57 |
|
|
58 |
|
msg.attachments.forEach(a => { |
59 |
|
str += `**${a.name}** ${a.proxyURL}\n`; |
60 |
|
}); |
61 |
|
|
62 |
|
embed.addField('Attachments', str); |
63 |
|
} |
64 |
|
|
65 |
|
await channel.send({ |
66 |
|
embeds: [ |
67 |
|
embed |
68 |
|
] |
69 |
|
}); |
70 |
|
}, msg); |
71 |
|
} |
72 |
|
|
73 |
|
logBanned(ban) { |
74 |
|
this.channel(async (channel) => { |
75 |
|
let r = '*No reason provided*'; |
76 |
|
|
77 |
|
if (ban.reason) { |
78 |
|
r = ban.reason; |
79 |
|
} |
80 |
|
|
81 |
|
await channel.send({ |
82 |
|
embeds: [ |
83 |
|
new MessageEmbed() |
84 |
|
.setColor('#f14a60') |
85 |
|
.setTitle("A user was banned") |
86 |
|
.setAuthor({ |
87 |
|
name: ban.user.tag, |
88 |
|
iconURL: ban.user.displayAvatarURL(), |
89 |
|
}) |
90 |
|
.addField('Reason', r) |
91 |
|
.addField('User ID', ban.user.id) |
92 |
|
.setFooter({ |
93 |
|
text: "Banned", |
94 |
|
}) |
95 |
|
.setTimestamp() |
96 |
|
] |
97 |
|
}); |
98 |
|
}, ban); |
99 |
|
} |
100 |
|
|
101 |
|
logUnbanned(ban) { |
102 |
|
this.channel(async (channel) => { |
103 |
|
await channel.send({ |
104 |
|
embeds: [ |
105 |
|
new MessageEmbed() |
106 |
|
.setColor('#f14a60') |
107 |
|
.setTitle("A user was unbanned") |
108 |
|
.setAuthor({ |
109 |
|
name: ban.user.tag, |
110 |
|
iconURL: ban.user.displayAvatarURL(), |
111 |
|
}) |
112 |
|
.addField('User ID', ban.user.id) |
113 |
|
.setFooter({ |
114 |
|
text: "Unbanned", |
115 |
|
}) |
116 |
|
.setTimestamp() |
117 |
|
] |
118 |
|
}); |
119 |
|
}, ban); |
120 |
|
} |
121 |
|
|
122 |
|
logJoined(member) { |
123 |
|
this.channel(async (channel) => { |
124 |
|
await channel.send({ |
125 |
|
embeds: [ |
126 |
|
new MessageEmbed() |
127 |
|
.setColor('#007bff') |
128 |
|
.setTitle("New member joined") |
129 |
|
.setAuthor({ |
130 |
|
name: member.user.tag, |
131 |
|
iconURL: member.user.displayAvatarURL(), |
132 |
|
}) |
133 |
|
.setDescription(`<@${member.user.id}> just joined the server!`) |
134 |
|
.addField('Account Created', member.user.createdAt.toLocaleString()) |
135 |
|
.addField('New Account?', (new Date().getTime() - member.user.createdAt.getTime()) <= 24 * 60 * 60 * 1000 ? ":warning: Yes :warning:" : "No") |
136 |
|
.addField('User ID', member.user.id) |
137 |
|
.setFooter({ |
138 |
|
text: "Joined", |
139 |
|
}) |
140 |
|
.setTimestamp() |
141 |
|
] |
142 |
|
}); |
143 |
|
}, member); |
144 |
|
} |
145 |
|
|
146 |
|
logLeft(member) { |
147 |
|
this.channel(async (channel) => { |
148 |
|
await channel.send({ |
149 |
|
embeds: [ |
150 |
|
new MessageEmbed() |
151 |
|
.setColor('#f14a60') |
152 |
|
.setTitle("Member left") |
153 |
|
.setAuthor({ |
154 |
|
name: member.user.tag, |
155 |
|
iconURL: member.user.displayAvatarURL(), |
156 |
|
}) |
157 |
|
.addField('Joined at', member.joinedAt.toLocaleString()) |
158 |
|
.addField('User ID', member.user.id) |
159 |
|
.setFooter({ |
160 |
|
text: "Left", |
161 |
|
}) |
162 |
|
.setTimestamp() |
163 |
|
] |
164 |
|
}); |
165 |
|
}, member); |
166 |
|
} |
167 |
|
|
168 |
|
logBeaned(member, r, d) { |
169 |
|
this.channel(async (channel) => { |
170 |
|
await channel.send({ |
171 |
|
embeds: [ |
172 |
|
new MessageEmbed() |
173 |
|
.setColor('#007bff') |
174 |
|
.setTitle("Member beaned") |
175 |
|
.setAuthor({ |
176 |
|
name: member.user.tag, |
177 |
|
iconURL: member.user.displayAvatarURL(), |
178 |
|
}) |
179 |
|
.addField('Reason', r) |
180 |
|
.addField('Beaned by', d.tag) |
181 |
|
.addField('User ID', member.user.id) |
182 |
|
.setFooter({ |
183 |
|
text: "Beaned", |
184 |
|
}) |
185 |
|
.setTimestamp() |
186 |
|
] |
187 |
|
}); |
188 |
|
}, member); |
189 |
|
} |
190 |
|
|
191 |
|
logMute(member, reason, timeMs, d) { |
192 |
|
this.channel(async (channel) => { |
193 |
await channel.send({ |
await channel.send({ |
194 |
embeds: [ |
embeds: [ |
195 |
new MessageEmbed() |
new MessageEmbed() |
196 |
.setColor('#f14a60') |
.setColor('#f14a60') |
197 |
.setTitle('Message Deleted in #' + msg.channel.name + " (" + msg.channel.id + ")") |
.setTitle("Member muted") |
198 |
.setDescription(msg.content) |
.setAuthor({ |
199 |
|
name: member.user.tag, |
200 |
|
iconURL: member.user.displayAvatarURL(), |
201 |
|
}) |
202 |
|
.addField('Reason', reason) |
203 |
|
.addField('Muted by', d.tag) |
204 |
|
.addField('Duration Until', typeof timeMs === 'number' ? new Date((timeMs / 1000) + Date.now()).toLocaleString() : "*No duration set*") |
205 |
|
.addField('User ID', member.user.id) |
206 |
|
.setFooter({ |
207 |
|
text: "Muted", |
208 |
|
}) |
209 |
|
.setTimestamp() |
210 |
|
] |
211 |
|
}); |
212 |
|
}, member); |
213 |
|
} |
214 |
|
|
215 |
|
logUnmute(member, d) { |
216 |
|
this.channel(async (channel) => { |
217 |
|
await channel.send({ |
218 |
|
embeds: [ |
219 |
|
new MessageEmbed() |
220 |
|
.setColor('#007bff') |
221 |
|
.setTitle("Member unmuted") |
222 |
|
.setAuthor({ |
223 |
|
name: member.user.tag, |
224 |
|
iconURL: member.user.displayAvatarURL(), |
225 |
|
}) |
226 |
|
.addField('Unmuted by', d.tag) |
227 |
|
.addField('User ID', member.user.id) |
228 |
|
.setFooter({ |
229 |
|
text: "Unmuted", |
230 |
|
}) |
231 |
|
.setTimestamp() |
232 |
|
] |
233 |
|
}); |
234 |
|
}, member); |
235 |
|
} |
236 |
|
|
237 |
|
logWarn(msg, member, d, reason) { |
238 |
|
if (member.user) |
239 |
|
member = member.user; |
240 |
|
|
241 |
|
this.channel(async (channel) => { |
242 |
|
await channel.send({ |
243 |
|
embeds: [ |
244 |
|
new MessageEmbed() |
245 |
|
.setColor('GOLD') |
246 |
|
.setTitle("Member warned") |
247 |
|
.setAuthor({ |
248 |
|
name: member.tag, |
249 |
|
iconURL: member.displayAvatarURL(), |
250 |
|
}) |
251 |
|
.addField('Reason', reason) |
252 |
|
.addField('Warned by', d.tag) |
253 |
|
.addField('User ID', member.id) |
254 |
|
.setFooter({ |
255 |
|
text: "Warned", |
256 |
|
}) |
257 |
|
.setTimestamp() |
258 |
|
] |
259 |
|
}); |
260 |
|
}, msg); |
261 |
|
} |
262 |
|
|
263 |
|
logWarndel(msg, member, warn, d) { |
264 |
|
this.channel(async (channel) => { |
265 |
|
await channel.send({ |
266 |
|
embeds: [ |
267 |
|
new MessageEmbed() |
268 |
|
.setColor('GOLD') |
269 |
|
.setTitle("Warning deleted") |
270 |
.setAuthor({ |
.setAuthor({ |
271 |
name: msg.author.tag, |
name: member.user.tag, |
272 |
iconURL: msg.author.displayAvatarURL(), |
iconURL: member.user.displayAvatarURL(), |
273 |
}) |
}) |
274 |
.addField('ID', msg.id) |
.addField('Warned by', d.tag + '') |
275 |
|
.addField('Warning ID', warn.id + '') |
276 |
|
.addField('User ID', member.user.id) |
277 |
.setFooter({ |
.setFooter({ |
278 |
text: "Deleted", |
text: "Warning Deleted", |
279 |
}) |
}) |
280 |
.setTimestamp() |
.setTimestamp() |
281 |
] |
] |