Skip to content

Commit c5744f6

Browse files
committed
fix(module_modo): ban interaction doesn't works
1 parent 6410f5a commit c5744f6

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

module_modo.lua

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function Module:OnEnable(guild)
113113
for _, channel in pairs(guild.textChannels) do
114114
self:CheckTextMutePermissions(channel)
115115
end
116-
116+
117117
for _, channel in pairs(guild.voiceChannels) do
118118
self:CheckVoiceMutePermissions(channel)
119119
end
@@ -184,7 +184,7 @@ local function GenerateJumpToComponents(message)
184184
style = enums.buttonStyle.link,
185185
url = bot:GenerateMessageLink(message),
186186
label = "Jump to message"
187-
}
187+
}
188188
}
189189
}
190190
end
@@ -544,7 +544,7 @@ function Module:OnInteractionCreate(interaction)
544544
flags = enums.interactionResponseFlag.ephemeral
545545
}
546546
})
547-
547+
548548
return
549549
end
550550

@@ -710,16 +710,29 @@ function Module:OnInteractionCreate(interaction)
710710

711711
actionStr = "Muted " .. util.DiscordRelativeTime(duration) .. " by " .. moderator.mentionString
712712
elseif interactionType == "alertmodule_ban" then
713-
local duration = interaction.data.values and interaction.data.values[1] or nil
714713

715-
local ban = Bot:GetModuleForGuild(guild, "ban")
716-
if (ban and not mute:CheckPermissions(moderator)) or (not ban and not moderator:hasPermission(enums.permission.banMembers)) then
714+
if (not moderator:hasPermission(enums.permission.banMembers)) then
717715
interaction:editResponse({
718716
content = string.format("❌ You do not have permission mute this member")
719717
})
718+
720719
return
721720
end
722-
721+
722+
local ban = Bot:GetModuleForGuild(guild, "ban")
723+
if not ban then
724+
interaction:respond({
725+
type = enums.interactionResponseType.channelMessageWithSource,
726+
data = {
727+
content = "❌ The ban module isn't enabled on this server",
728+
flags = enums.interactionResponseFlag.ephemeral
729+
}
730+
})
731+
732+
return
733+
end
734+
735+
local duration = interaction.data.values and interaction.data.values[1] or nil
723736
if duration == "0" or duration == "0_deletemessages" then
724737
-- "Waiting"
725738
interaction:respond({
@@ -748,7 +761,7 @@ function Module:OnInteractionCreate(interaction)
748761
interaction:editResponse({
749762
content = "✅ the member has been banned" .. (purgeDays > 0 and " (and its last 24h message deleted)" or "")
750763
})
751-
764+
752765
actionStr = "banned permanently by " .. moderator.mentionString .. (purgeDays > 0 and " (last 24h message deleted)" or "")
753766
else
754767
duration = duration and tonumber(duration) or nil
@@ -798,7 +811,7 @@ function Module:OnInteractionCreate(interaction)
798811
interaction:editResponse({
799812
content = "✅ the member has been banned for " .. durationStr
800813
})
801-
814+
802815
actionStr = "banned for " .. durationStr .. " by " .. moderator.mentionString
803816
end
804817
else

0 commit comments

Comments
 (0)