mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-22 17:25:01 +00:00
Port Mutes plugin
This commit is contained in:
parent
dda3537353
commit
c12ea9f627
11 changed files with 797 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
import { eventListener } from "knub";
|
||||
import { MutesPluginType } from "../types";
|
||||
import { memberHasMutedRole } from "../functions/memberHasMutedRole";
|
||||
|
||||
/**
|
||||
* Clear active mute if the mute role is removed manually
|
||||
*/
|
||||
export const ClearActiveMuteOnRoleRemovalEvt = eventListener<MutesPluginType>()(
|
||||
"guildMemberUpdate",
|
||||
async ({ pluginData, args: { member } }) => {
|
||||
const muteRole = pluginData.config.get().mute_role;
|
||||
if (!muteRole) return;
|
||||
|
||||
const mute = await pluginData.state.mutes.findExistingMuteForUserId(member.id);
|
||||
if (!mute) return;
|
||||
|
||||
if (!memberHasMutedRole(pluginData, member)) {
|
||||
await pluginData.state.mutes.clear(muteRole);
|
||||
}
|
||||
},
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue