mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
added include_moves option to join_voice_channel and leave_voice_channel
This commit is contained in:
parent
ec2eb4a8bb
commit
f949a3825a
2 changed files with 20 additions and 8 deletions
|
@ -7,17 +7,23 @@ interface JoinVoiceChannelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const JoinVoiceChannelTrigger = automodTrigger<JoinVoiceChannelResult>()({
|
export const JoinVoiceChannelTrigger = automodTrigger<JoinVoiceChannelResult>()({
|
||||||
configType: t.union([t.string, t.array(t.string)]),
|
configType: t.type({
|
||||||
|
channels: t.union([t.string, t.array(t.string)]),
|
||||||
|
include_moves: t.boolean,
|
||||||
|
}),
|
||||||
|
|
||||||
defaultConfig: "",
|
defaultConfig: {},
|
||||||
|
|
||||||
async match({ triggerConfig, context }) {
|
async match({ triggerConfig, context }) {
|
||||||
const matchedChannelId = context.voiceChannel?.joined?.id;
|
const matchedChannelId = context.voiceChannel?.joined?.id;
|
||||||
if (!context.member || !matchedChannelId || context.voiceChannel?.left) {
|
const includeMoves =
|
||||||
|
typeof triggerConfig === "object" && !Array.isArray(triggerConfig) && triggerConfig.include_moves;
|
||||||
|
|
||||||
|
if (!context.member || !matchedChannelId || (context.voiceChannel?.left && !includeMoves)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const triggerChannels = Array.isArray(triggerConfig) ? triggerConfig : [triggerConfig];
|
const triggerChannels = Array.isArray(triggerConfig.channels) ? triggerConfig.channels : [triggerConfig.channels];
|
||||||
if (!triggerChannels.includes(matchedChannelId)) {
|
if (!triggerChannels.includes(matchedChannelId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,23 @@ interface LeaveVoiceChannelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LeaveVoiceChannelTrigger = automodTrigger<LeaveVoiceChannelResult>()({
|
export const LeaveVoiceChannelTrigger = automodTrigger<LeaveVoiceChannelResult>()({
|
||||||
configType: t.union([t.string, t.array(t.string)]),
|
configType: t.type({
|
||||||
|
channels: t.union([t.string, t.array(t.string)]),
|
||||||
|
include_moves: t.boolean,
|
||||||
|
}),
|
||||||
|
|
||||||
defaultConfig: "",
|
defaultConfig: {},
|
||||||
|
|
||||||
async match({ triggerConfig, context }) {
|
async match({ triggerConfig, context }) {
|
||||||
const matchedChannelId = context.voiceChannel?.left?.id;
|
const matchedChannelId = context.voiceChannel?.left?.id;
|
||||||
if (!context.member || !matchedChannelId || context.voiceChannel?.joined) {
|
const includeMoves =
|
||||||
|
typeof triggerConfig === "object" && !Array.isArray(triggerConfig) && triggerConfig.include_moves;
|
||||||
|
|
||||||
|
if (!context.member || !matchedChannelId || (context.voiceChannel?.joined && !includeMoves)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const triggerChannels = Array.isArray(triggerConfig) ? triggerConfig : [triggerConfig];
|
const triggerChannels = Array.isArray(triggerConfig.channels) ? triggerConfig.channels : [triggerConfig.channels];
|
||||||
if (!triggerChannels.includes(matchedChannelId)) {
|
if (!triggerChannels.includes(matchedChannelId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue