Skip to content

Commit

Permalink
Revert "Send [p]activemutes as a menu instead of multiple messages r…
Browse files Browse the repository at this point in the history
…esolves Cog-Creators#6263"

This reverts commit 4939180.
  • Loading branch information
TrustyJAID committed Mar 31, 2024
1 parent 4939180 commit f6ea96c
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions redbot/cogs/mutes/mutes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import contextlib
import logging
from abc import ABC
from datetime import datetime, timedelta, timezone
Expand All @@ -17,7 +18,8 @@
pagify,
)
from redbot.core.utils.mod import get_audit_reason
from redbot.core.utils.views import ConfirmView, SimpleMenu
from redbot.core.utils.menus import start_adding_reactions
from redbot.core.utils.predicates import MessagePredicate, ReactionPredicate

from .converters import MuteTime
from .models import ChannelMuteResponse, MuteResponse
Expand Down Expand Up @@ -1102,15 +1104,8 @@ async def activemutes(self, ctx: commands.Context):
msg += "\n"

if msg:
msgs = []
for page in pagify(msg):
if ctx.embed_requested():
msgs.append(
discord.Embed(description=page, colour=await self.bot.get_embed_color(ctx))
)
else:
msgs.append(page)
await SimpleMenu(msgs).start(ctx)
await ctx.maybe_send_embed(page)
return
await ctx.maybe_send_embed(_("There are no mutes on this server right now."))

Expand Down Expand Up @@ -1303,16 +1298,37 @@ async def handle_issues(
message = _(
"Some users could not be properly muted or unmuted. Would you like to see who, where, and why?"
)
view = ConfirmView(ctx.author)

can_react = can_user_react_in(ctx.me, ctx.channel)
if not can_react:
message += " (y/n)"
view.message = await ctx.send(message, view=view)
await view.wait()
if not view.result:
await ctx.send(_("OK then."))
query: discord.Message = await ctx.send(message)
if can_react:
# noinspection PyAsyncCall
start_adding_reactions(query, ReactionPredicate.YES_OR_NO_EMOJIS)
pred = ReactionPredicate.yes_or_no(query, ctx.author)
event = "reaction_add"
else:
pred = MessagePredicate.yes_or_no(ctx)
event = "message"
try:
await ctx.bot.wait_for(event, check=pred, timeout=30)
except asyncio.TimeoutError:
with contextlib.suppress(discord.NotFound):
await query.delete()
return

if not pred.result:
if can_react:
with contextlib.suppress(discord.NotFound):
await query.delete()
else:
await ctx.send(_("OK then."))
return
else:
if can_react:
with contextlib.suppress(discord.Forbidden):
await query.clear_reactions()
issue = "\n".join(self.parse_issues(issue) for issue in issue_list)
resp = pagify(issue)
await ctx.send_interactive(resp)
Expand Down

0 comments on commit f6ea96c

Please sign in to comment.