feat(aurora): added timeouts to configuration views
This commit is contained in:
parent
6c56ee6181
commit
d6f33857a3
5 changed files with 36 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
|||
from discord import ButtonStyle, Interaction, ui
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import error
|
||||
|
||||
|
@ -7,9 +7,14 @@ from aurora.utilities.factory import addrole_embed
|
|||
|
||||
|
||||
class Addrole(ui.View):
|
||||
def __init__(self, ctx: commands.Context):
|
||||
def __init__(self, ctx: commands.Context, message: Message, timeout: int = 0):
|
||||
super().__init__()
|
||||
self.ctx = ctx
|
||||
self.message = message
|
||||
self.timeout = timeout
|
||||
|
||||
async def on_timeout(self):
|
||||
await self.message.edit(view=None)
|
||||
|
||||
@ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25)
|
||||
async def addrole_select(self, interaction: Interaction, select: ui.RoleSelect):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from discord import ButtonStyle, Interaction, ui
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
|
||||
from aurora.utilities.config import config
|
||||
|
@ -7,9 +7,14 @@ from aurora.utilities.utils import create_pagesize_options
|
|||
|
||||
|
||||
class Guild(ui.View):
|
||||
def __init__(self, ctx: commands.Context):
|
||||
def __init__(self, ctx: commands.Context, message: Message, timeout: int = 0):
|
||||
super().__init__()
|
||||
self.ctx = ctx
|
||||
self.message = message
|
||||
self.timeout = timeout
|
||||
|
||||
async def on_timeout(self):
|
||||
await self.message.edit(view=None)
|
||||
|
||||
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
|
||||
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from discord import ButtonStyle, Interaction, ui
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import error
|
||||
|
||||
|
@ -7,9 +7,14 @@ from aurora.utilities.factory import immune_embed
|
|||
|
||||
|
||||
class Immune(ui.View):
|
||||
def __init__(self, ctx: commands.Context):
|
||||
def __init__(self, ctx: commands.Context, message: Message, timeout: int = 0):
|
||||
super().__init__()
|
||||
self.ctx = ctx
|
||||
self.message = message
|
||||
self.timeout = timeout
|
||||
|
||||
async def on_timeout(self):
|
||||
await self.message.edit(view=None)
|
||||
|
||||
@ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25)
|
||||
async def immune_select(self, interaction: Interaction, select: ui.RoleSelect):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from discord import ButtonStyle, Interaction, ui
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
|
||||
from aurora.utilities.config import config
|
||||
|
@ -7,9 +7,14 @@ from aurora.utilities.utils import create_pagesize_options
|
|||
|
||||
|
||||
class Overrides(ui.View):
|
||||
def __init__(self, ctx: commands.Context):
|
||||
def __init__(self, ctx: commands.Context, message: Message, timeout: int = 0):
|
||||
super().__init__()
|
||||
self.ctx = ctx
|
||||
self.message = message
|
||||
self.timeout = timeout
|
||||
|
||||
async def on_timeout(self):
|
||||
await self.message.edit(view=None)
|
||||
|
||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
|
||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue