16 |
await History.create(user.id, user.guild!, 'unmute', d.id, null); |
await History.create(user.id, user.guild!, 'unmute', d.id, null); |
17 |
|
|
18 |
const role = await user.guild!.roles.fetch(client.config.props[user.guild.id].mute_role); |
const role = await user.guild!.roles.fetch(client.config.props[user.guild.id].mute_role); |
19 |
await user.roles.remove(role!, 'Unmuting user'); |
try { |
20 |
|
await user.roles.remove(role!, 'Unmuting user'); |
21 |
|
} |
22 |
|
catch (e) { |
23 |
|
console.log(e); |
24 |
|
} |
25 |
|
|
26 |
const { default: Punishment } = await import('../../models/Punishment'); |
const { default: Punishment } = await import('../../models/Punishment'); |
27 |
|
|
31 |
const { default: MuteRecord } = await import("../../models/MuteRecord"); |
const { default: MuteRecord } = await import("../../models/MuteRecord"); |
32 |
|
|
33 |
const hardmute = await Hardmute.findOne({ |
const hardmute = await Hardmute.findOne({ |
34 |
where: { |
user_id: user.id, |
35 |
user_id: user.id, |
guild_id: user.guild.id |
|
guild_id: user.guild.id, |
|
|
}, |
|
|
order: [ |
|
|
['id', 'DESC'] |
|
|
] |
|
36 |
}); |
}); |
37 |
|
|
38 |
if (hardmute) { |
if (hardmute) { |
39 |
for await (const roleID of hardmute.get().roles) { |
for await (const roleID of hardmute.roles) { |
40 |
try { |
try { |
41 |
const role = await user.guild.roles.fetch(roleID); |
const role = await user.guild.roles.fetch(roleID); |
42 |
|
|
49 |
} |
} |
50 |
} |
} |
51 |
|
|
52 |
await hardmute.destroy(); |
await hardmute.delete(); |
53 |
} |
} |
54 |
|
|
55 |
const timeouts = getTimeouts(); |
const timeouts = getTimeouts(); |
77 |
guild_id: user.guild!.id, |
guild_id: user.guild!.id, |
78 |
mod_id: d.id, |
mod_id: d.id, |
79 |
mod_tag: d.tag, |
mod_tag: d.tag, |
80 |
|
createdAt: new Date() |
81 |
}); |
}); |
82 |
|
|
83 |
const muteRecord = await MuteRecord.findOne({ |
const muteRecord = await MuteRecord.findOne({ |
84 |
where: { |
user_id: user.user.id, |
85 |
user_id: user.user.id, |
guild_id: user.guild.id |
|
guild_id: user.guild.id |
|
|
} |
|
86 |
}); |
}); |
87 |
|
|
88 |
if (muteRecord) { |
if (muteRecord) { |
89 |
await muteRecord.destroy(); |
await muteRecord.delete(); |
90 |
} |
} |
91 |
|
|
92 |
try { |
try { |