52 |
return; |
return; |
53 |
} |
} |
54 |
|
|
55 |
const warnings = await Punishment.findAll({ |
const warnings = await Punishment.find({ |
56 |
where: { |
guild_id: msg.guild!.id, |
57 |
guild_id: msg.guild!.id, |
user_id: user.id, |
58 |
user_id: user.id, |
type: PunishmentType.WARNING |
59 |
type: PunishmentType.WARNING |
}).sort({ createdAt: -1 }); |
|
}, |
|
|
}); |
|
60 |
|
|
61 |
if (warnings.length < 1) { |
if (warnings.length < 1) { |
62 |
await msg.reply({ |
await msg.reply({ |
73 |
let str = ''; |
let str = ''; |
74 |
|
|
75 |
for await (const warning of warnings) { |
for await (const warning of warnings) { |
76 |
str += `ID: ${warning.get().id}\n`; |
str += `ID: ${warning.id}\n`; |
77 |
str += `Reason: ${warning.get().reason ?? '*No reason provided*'}\n`; |
str += `Reason: ${warning.reason ?? '*No reason provided*'}\n`; |
78 |
|
|
79 |
try { |
try { |
80 |
str += `Warned by: ${(await client.users.fetch(warning.get().mod_id)).tag}\n`; |
str += `Warned by: ${(await client.users.fetch(warning.mod_id)).tag}\n`; |
81 |
} |
} |
82 |
catch (e) { |
catch (e) { |
83 |
str += `Warned by: ${warning.get().mod_id}\n`; |
str += `Warned by: ${warning.mod_id}\n`; |
84 |
} |
} |
85 |
|
|
86 |
str += `Date: ${warning.get().createdAt}\n\n`; |
str += `Date: ${warning.createdAt}\n\n`; |
87 |
} |
} |
88 |
|
|
89 |
await msg.reply({ |
await msg.reply({ |
131 |
return; |
return; |
132 |
} |
} |
133 |
|
|
134 |
const warning = await Punishment.destroy({ |
const warning = await Punishment.deleteOne({ |
135 |
where: { |
guild_id: msg.guild!.id, |
136 |
guild_id: msg.guild!.id, |
user_id: user.id, |
137 |
user_id: user.id, |
type: PunishmentType.WARNING |
|
type: PunishmentType.WARNING |
|
|
}, |
|
138 |
}); |
}); |
139 |
|
|
140 |
if (warning < 1) { |
if (warning.deletedCount < 1) { |
141 |
await msg.reply({ |
await msg.reply({ |
142 |
embeds: [ |
embeds: [ |
143 |
new MessageEmbed() |
new MessageEmbed() |
171 |
return; |
return; |
172 |
} |
} |
173 |
|
|
174 |
const id = options.isInteraction ? options.options.getNumber('id') : parseInt(options.args[0]); |
const id = options.isInteraction ? options.options.getString('id') : parseInt(options.args[0]); |
175 |
|
|
176 |
const warning = await Punishment.findOne({ |
const warning = await Punishment.findOne({ |
177 |
where: { |
id, |
178 |
id, |
guild_id: msg.guild!.id, |
179 |
guild_id: msg.guild!.id, |
type: PunishmentType.WARNING |
|
type: PunishmentType.WARNING |
|
|
}, |
|
|
order: [ |
|
|
['id', 'DESC'] |
|
|
], |
|
180 |
}); |
}); |
181 |
|
|
182 |
if (!warning) { |
if (!warning) { |
191 |
return; |
return; |
192 |
} |
} |
193 |
|
|
194 |
await warning.destroy(); |
await warning.delete(); |
195 |
|
|
196 |
await msg.reply({ |
await msg.reply({ |
197 |
embeds: [ |
embeds: [ |
215 |
return; |
return; |
216 |
} |
} |
217 |
|
|
218 |
const id = options.isInteraction ? options.options.getNumber('id') : parseInt(options.args[0]); |
const id = options.isInteraction ? options.options.getString('id') : parseInt(options.args[0]); |
219 |
|
|
220 |
const warning = await Punishment.findOne({ |
const warning = await Punishment.findOne({ |
221 |
where: { |
id, |
222 |
id, |
guild_id: msg.guild!.id, |
223 |
guild_id: msg.guild!.id, |
type: PunishmentType.WARNING |
|
type: PunishmentType.WARNING |
|
|
}, |
|
|
order: [ |
|
|
['id', 'DESC'] |
|
|
], |
|
224 |
}); |
}); |
225 |
|
|
226 |
if (!warning) { |
if (!warning) { |