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

More fixes, change rest of stripObjectToScalars to configAccessibleObj

This commit is contained in:
Dark 2021-07-21 22:14:09 +02:00
parent 4ad99975de
commit acb4913495
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
66 changed files with 623 additions and 192 deletions

View file

@ -1,6 +1,7 @@
import { Message, Snowflake, TextChannel, User } from "discord.js";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { channelToConfigAccessibleChannel, userToConfigAccessibleUser } from "src/utils/configAccessibleObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { LogType } from "../../../data/LogType";
@ -41,8 +42,8 @@ async function cleanMessages(
const archiveUrl = pluginData.state.archives.getUrl(baseUrl, archiveId);
pluginData.state.logs.log(LogType.CLEAN, {
mod: stripObjectToScalars(mod),
channel: stripObjectToScalars(channel),
mod: userToConfigAccessibleUser(mod),
channel: channelToConfigAccessibleChannel(channel),
count: savedMessages.length,
archiveUrl,
});
@ -172,7 +173,7 @@ export const CleanCmd = utilityCmd({
let responseText = `Cleaned ${messagesToClean.length} ${messagesToClean.length === 1 ? "message" : "messages"}`;
if (targetChannel.id !== msg.channel.id) {
responseText += ` in <#${targetChannel.id}>\n${cleanResult.archiveUrl}`;
responseText += ` in <#${targetChannel.id}>: ${cleanResult.archiveUrl}`;
}
if (args.update) {

View file

@ -1,4 +1,9 @@
import { VoiceChannel } from "discord.js";
import {
channelToConfigAccessibleChannel,
memberToConfigAccessibleMember,
userToConfigAccessibleUser,
} from "src/utils/configAccessibleObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -35,9 +40,9 @@ export const VcdisconnectCmd = utilityCmd({
}
pluginData.state.logs.log(LogType.VOICE_CHANNEL_FORCE_DISCONNECT, {
mod: stripObjectToScalars(msg.author),
member: stripObjectToScalars(args.member, ["user", "roles"]),
oldChannel: stripObjectToScalars(channel),
mod: userToConfigAccessibleUser(msg.author),
member: memberToConfigAccessibleMember(args.member),
oldChannel: channelToConfigAccessibleChannel(channel),
});
sendSuccessMessage(

View file

@ -1,4 +1,9 @@
import { Snowflake, VoiceChannel } from "discord.js";
import {
channelToConfigAccessibleChannel,
memberToConfigAccessibleMember,
userToConfigAccessibleUser,
} from "src/utils/configAccessibleObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -74,10 +79,10 @@ export const VcmoveCmd = utilityCmd({
}
pluginData.state.logs.log(LogType.VOICE_CHANNEL_FORCE_MOVE, {
mod: stripObjectToScalars(msg.author),
member: stripObjectToScalars(args.member, ["user", "roles"]),
oldChannel: stripObjectToScalars(oldVoiceChannel),
newChannel: stripObjectToScalars(channel),
mod: userToConfigAccessibleUser(msg.author),
member: memberToConfigAccessibleMember(args.member),
oldChannel: channelToConfigAccessibleChannel(oldVoiceChannel!),
newChannel: channelToConfigAccessibleChannel(channel),
});
sendSuccessMessage(
@ -182,10 +187,10 @@ export const VcmoveAllCmd = utilityCmd({
}
pluginData.state.logs.log(LogType.VOICE_CHANNEL_FORCE_MOVE, {
mod: stripObjectToScalars(msg.author),
member: stripObjectToScalars(currMember, ["user", "roles"]),
oldChannel: stripObjectToScalars(args.oldChannel),
newChannel: stripObjectToScalars(channel),
mod: userToConfigAccessibleUser(msg.author),
member: memberToConfigAccessibleMember(currMember),
oldChannel: channelToConfigAccessibleChannel(args.oldChannel),
newChannel: channelToConfigAccessibleChannel(channel),
});
}