mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-13 21:35:02 +00:00
Typed log functions + more
This commit is contained in:
parent
d2ac700143
commit
bed6589d48
166 changed files with 4021 additions and 869 deletions
backend/src/plugins/Logs/logFunctions
|
@ -0,0 +1,39 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType } from "../types";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { log } from "../util/log";
|
||||
import { createTypedTemplateSafeValueContainer } from "../../../templateFormatter";
|
||||
import { BaseGuildVoiceChannel, GuildMember, User } from "discord.js";
|
||||
import {
|
||||
channelToTemplateSafeChannel,
|
||||
memberToTemplateSafeMember,
|
||||
userToTemplateSafeUser,
|
||||
} from "../../../utils/templateSafeObjects";
|
||||
|
||||
interface LogVoiceChannelForceDisconnectData {
|
||||
mod: User;
|
||||
member: GuildMember;
|
||||
oldChannel: BaseGuildVoiceChannel;
|
||||
}
|
||||
|
||||
export function logVoiceChannelForceDisconnect(
|
||||
pluginData: GuildPluginData<LogsPluginType>,
|
||||
data: LogVoiceChannelForceDisconnectData,
|
||||
) {
|
||||
return log(
|
||||
pluginData,
|
||||
LogType.VOICE_CHANNEL_FORCE_DISCONNECT,
|
||||
createTypedTemplateSafeValueContainer({
|
||||
mod: userToTemplateSafeUser(data.mod),
|
||||
member: memberToTemplateSafeMember(data.member),
|
||||
oldChannel: channelToTemplateSafeChannel(data.oldChannel),
|
||||
}),
|
||||
{
|
||||
userId: data.member.id,
|
||||
roles: Array.from(data.member.roles.cache.keys()),
|
||||
channel: data.oldChannel.id,
|
||||
category: data.oldChannel.parentId,
|
||||
bot: data.member.user.bot,
|
||||
},
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue