mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(bot-discord): fix timeout and undefined var
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
},
|
||||
{
|
||||
"name": "🔸 How to ask",
|
||||
"value": "Include the following information:\n* Version of ReVanced Manager\n*Name of the app you are patching\n*Version of the app you are patching"
|
||||
"value": "Include the following information:\n* Version of ReVanced Manager\n* Name of the app you are patching\n* Version of the app you are patching"
|
||||
}
|
||||
],
|
||||
"footer": {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
const mutes = await client.db.collection('muted').find().toArray();
|
||||
|
||||
for (const mute of mutes) {
|
||||
await setMuteTimeout(mute, client.mutes);
|
||||
await setMuteTimeout(mute, client.mutes, client);
|
||||
}
|
||||
|
||||
console.log(`Loaded ${mutes.length} mutes.`);
|
||||
|
||||
@@ -74,7 +74,7 @@ export default async function muteMember(config, member, { duration, reason, sup
|
||||
taken_roles: takenRoles,
|
||||
expires,
|
||||
support_mute: supportMute
|
||||
}, member.client.mutes);
|
||||
}, member.client.mutes, member.client);
|
||||
|
||||
// Return parsed time for the mute command to resolve.
|
||||
return expires;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export default async function setMuteTimeout(mute, mutes) {
|
||||
const duration = Date.now() - mute.expires;
|
||||
export default async function setMuteTimeout(mute, mutes, client) {
|
||||
const duration = (mute.expires - Math.floor(new Date() / 1000)) * 1000;
|
||||
mutes.set(mute.user_id, setTimeout(async() => {
|
||||
const guild = await client.guilds.fetch(mute.guild_id);
|
||||
let member;
|
||||
@@ -15,5 +15,10 @@ export default async function setMuteTimeout(mute, mutes) {
|
||||
config.discord.mute.supportGiveRoles :
|
||||
config.discord.mute.giveRoles
|
||||
);
|
||||
|
||||
client.db.collection('muted').deleteOne({
|
||||
user_id: mute.user_id,
|
||||
guild_id: mute.guild_id
|
||||
});
|
||||
}, duration));
|
||||
}
|
||||
Reference in New Issue
Block a user