3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Finish preliminary rework, ready to test

This commit is contained in:
Dark 2021-06-02 04:07:50 +02:00
parent 57893e7f76
commit d0a1beb809
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
177 changed files with 854 additions and 707 deletions

View file

@ -4,6 +4,7 @@ import { rolesCmd } from "../types";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars, verboseUserMention, resolveRoleId } from "../../../utils";
import { GuildChannel } from "discord.js";
export const RemoveRoleCmd = rolesCmd({
trigger: "removerole",
@ -34,7 +35,7 @@ export const RemoveRoleCmd = rolesCmd({
}
// Sanity check: make sure the role is configured properly
const role = (msg.channel as GuildChannel).guild.roles.get(roleId);
const role = (msg.channel as GuildChannel).guild.roles.cache.get(roleId);
if (!role) {
pluginData.state.logs.log(LogType.BOT_ALERT, {
body: `Unknown role configured for 'roles' plugin: ${roleId}`,
@ -43,14 +44,14 @@ export const RemoveRoleCmd = rolesCmd({
return;
}
if (!args.member.roles.includes(roleId)) {
if (!args.member.roles.cache.has(roleId)) {
sendErrorMessage(pluginData, msg.channel, "Member doesn't have that role");
return;
}
pluginData.state.logs.ignoreLog(LogType.MEMBER_ROLE_REMOVE, args.member.id);
await args.member.removeRole(roleId);
await args.member.roles.remove(roleId);
pluginData.state.logs.log(LogType.MEMBER_ROLE_REMOVE, {
member: stripObjectToScalars(args.member, ["user", "roles"]),