mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 13:51:51 +00:00
eris leftovers
This commit is contained in:
parent
bb27680a96
commit
dcbe8c9eb2
4 changed files with 9 additions and 67 deletions
|
@ -20,7 +20,7 @@ import { AntiraidClearCmd } from "./commands/AntiraidClearCmd";
|
|||
import { SetAntiraidCmd } from "./commands/SetAntiraidCmd";
|
||||
import { ViewAntiraidCmd } from "./commands/ViewAntiraidCmd";
|
||||
import { runAutomodOnCounterTrigger } from "./events/runAutomodOnCounterTrigger";
|
||||
import { RunAutomodOnJoinEvt, RunAutomodOnLeaveEvt } from "./events/RunAutomodOnJoinLeaveEvt";
|
||||
import { RunAutomodOnJoinEvt, RunAutomodOnLeaveEvt } from "./events/runAutomodOnJoinLeaveEvt";
|
||||
import { RunAutomodOnMemberUpdate } from "./events/runAutomodOnMemberUpdate";
|
||||
import { runAutomodOnMessage } from "./events/runAutomodOnMessage";
|
||||
import { runAutomodOnModAction } from "./events/runAutomodOnModAction";
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
import { guildEventListener } from "knub";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
|
||||
export const RunAutomodOnVoiceJoin = guildEventListener<AutomodPluginType>()(
|
||||
"voiceChannelJoin",
|
||||
({ pluginData, args: { member, newChannel } }) => {
|
||||
const context: AutomodContext = {
|
||||
member,
|
||||
timestamp: Date.now(),
|
||||
voiceChannel: {
|
||||
joined: newChannel,
|
||||
},
|
||||
user: member.user,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(() => {
|
||||
runAutomod(pluginData, context);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
export const RunAutomodOnVoiceLeave = guildEventListener<AutomodPluginType>()(
|
||||
"voiceChannelLeave",
|
||||
({ pluginData, args: { member, oldChannel } }) => {
|
||||
const context: AutomodContext = {
|
||||
member,
|
||||
timestamp: Date.now(),
|
||||
voiceChannel: {
|
||||
left: oldChannel,
|
||||
},
|
||||
user: member.user,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(() => {
|
||||
runAutomod(pluginData, context);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
export const RunAutomodOnVoiceSwitch = guildEventListener<AutomodPluginType>()(
|
||||
"voiceChannelSwitch",
|
||||
({ pluginData, args: { member, oldChannel, newChannel } }) => {
|
||||
const context: AutomodContext = {
|
||||
member,
|
||||
timestamp: Date.now(),
|
||||
voiceChannel: {
|
||||
left: oldChannel,
|
||||
joined: newChannel,
|
||||
},
|
||||
user: member.user,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(() => {
|
||||
runAutomod(pluginData, context);
|
||||
});
|
||||
},
|
||||
);
|
|
@ -1,6 +1,6 @@
|
|||
import * as t from "io-ts";
|
||||
import { ChannelTypeStrings } from "../../../types";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { Constants } from "eris";
|
||||
|
||||
interface JoinVoiceChannelResult {
|
||||
matchedChannelId: string;
|
||||
|
@ -36,11 +36,11 @@ export const JoinVoiceChannelTrigger = automodTrigger<JoinVoiceChannelResult>()(
|
|||
},
|
||||
|
||||
renderMatchInformation({ matchResult, pluginData, contexts }) {
|
||||
const channel = pluginData.guild.channels.get(matchResult.extra.matchedChannelId);
|
||||
const channelName = channel?.name || "Unknown";
|
||||
const channel = pluginData.guild.channels.resolve(matchResult.extra.matchedChannelId);
|
||||
const channelName = channel?.name ?? "Unknown";
|
||||
const member = contexts[0].member!;
|
||||
const memberName = `**${member.user.username}#${member.user.discriminator}** (\`${member.id}\`)`;
|
||||
const voiceOrStage = channel?.type === Constants.ChannelTypes.GUILD_STAGE ? "stage" : "voice";
|
||||
const voiceOrStage = channel?.type === ChannelTypeStrings.STAGE ? "stage" : "voice";
|
||||
return `${memberName} has joined the ${channelName} (\`${matchResult.extra.matchedChannelId}\`) ${voiceOrStage} channel`;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Constants } from "eris";
|
||||
import * as t from "io-ts";
|
||||
import { ChannelTypeStrings } from "../../../types";
|
||||
import { automodTrigger } from "../helpers";
|
||||
|
||||
interface LeaveVoiceChannelResult {
|
||||
|
@ -36,11 +36,11 @@ export const LeaveVoiceChannelTrigger = automodTrigger<LeaveVoiceChannelResult>(
|
|||
},
|
||||
|
||||
renderMatchInformation({ matchResult, pluginData, contexts }) {
|
||||
const channel = pluginData.guild.channels.get(matchResult.extra.matchedChannelId);
|
||||
const channelName = channel?.name || "Unknown";
|
||||
const channel = pluginData.guild.channels.resolve(matchResult.extra.matchedChannelId);
|
||||
const channelName = channel?.name ?? "Unknown";
|
||||
const member = contexts[0].member!;
|
||||
const memberName = `**${member.user.username}#${member.user.discriminator}** (\`${member.id}\`)`;
|
||||
const voiceOrStage = channel?.type === Constants.ChannelTypes.GUILD_STAGE ? "stage" : "voice";
|
||||
const voiceOrStage = channel?.type === ChannelTypeStrings.STAGE ? "stage" : "voice";
|
||||
return `${memberName} has left the ${channelName} (\`${matchResult.extra.matchedChannelId}\`) ${voiceOrStage} channel`;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue