Skip to content

Commit 2b2a3b7

Browse files
authored
Merge pull request #14 from botagas/testing
Fix button persistence
2 parents bb58ece + da11fbc commit 2b2a3b7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ The new Captcha system uses **slash commands**, **modals**, and **UI buttons**.
114114
- Supports **custom before/after/embed messages**
115115

116116
#### Known Limitation / WIP:
117-
- After a restart or reload, you must re-run `/captcha deploy` to restore the verification button for proper operation
117+
- Currently, none.
118118

119119
---
120120

captcha/core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def __init__(self, bot: Red) -> None:
9696
self.task: asyncio.Task = asyncio.create_task(self._initialize())
9797
self._dm_messages: Dict[int, discord.Message] = {}
9898

99+
# Register persistent view
100+
from .views import CaptchaVerifyButton
101+
102+
self.bot.add_view(CaptchaVerifyButton(self))
103+
99104
def register_active_challenge(
100105
self, user_id: int, code: str, guild_id: int, timeout: int
101106
) -> None:

captcha/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional
1+
from typing import Any
22

33
import discord
44

@@ -51,8 +51,8 @@ async def submit(self, interaction: discord.Interaction, button: discord.ui.Butt
5151

5252

5353
class CaptchaVerifyButton(discord.ui.View):
54-
def __init__(self, cog: Any, timeout: Optional[float] = None):
55-
super().__init__(timeout=timeout)
54+
def __init__(self, cog: Any):
55+
super().__init__(timeout=None)
5656
self.cog = cog
5757

5858
@discord.ui.button(

0 commit comments

Comments
 (0)