mirror of
https://github.com/UiO-Gaming/mustafa.git
synced 2026-11-05 13:56:48 +01:00
use discord.py built in num range limiter for command params
This commit is contained in:
1 parent
0c0e4ff5ff
commit
e2283200d9
3 files changed
+23
-5
No files matched your search
@@ -238,7 +238,13 @@ class Birthday(commands.Cog):
|
||||
@app_commands.checks.bot_has_permissions(embed_links=True)
|
||||
@app_commands.checks.cooldown(1, 5)
|
||||
@birthday_group.command(name="sett", description="Lagrer din bursdag i databasen")
|
||||
async def birthday_set(self, interaction: discord.Interaction, dag: int, måned: int, år: int):
|
||||
async def birthday_set(
|
||||
self,
|
||||
interaction: discord.Interaction,
|
||||
dag: app_commands.Range[int, 1, 31],
|
||||
måned: app_commands.Range[int, 1, 12],
|
||||
år: int,
|
||||
):
|
||||
"""
|
||||
Allows the user to set their birthday in the database.
|
||||
|
||||
|
||||
+9
-2
@@ -162,7 +162,12 @@ class Misc(commands.Cog):
|
||||
@app_commands.checks.bot_has_permissions(embed_links=True)
|
||||
@app_commands.checks.cooldown(1, 2)
|
||||
@app_commands.command(name="mock", description="vEt dU iKkE hVa mOcKtEkSt eR eLlEr?")
|
||||
async def mock(self, interation: discord.Interaction, tekst: str, bruker: discord.User | None = None):
|
||||
async def mock(
|
||||
self,
|
||||
interation: discord.Interaction,
|
||||
tekst: app_commands.Range[str, 1, 4096],
|
||||
bruker: discord.User | None = None,
|
||||
):
|
||||
"""
|
||||
dO i rEaLlY nEeD tO eXpLaIn??
|
||||
|
||||
@@ -195,7 +200,9 @@ class Misc(commands.Cog):
|
||||
@app_commands.checks.bot_has_permissions(embed_links=True)
|
||||
@app_commands.checks.cooldown(1, 5)
|
||||
@app_commands.command(name="helligdager", description="Se helligdager i et land for et år")
|
||||
async def holidays(self, interaction: discord.Interaction, *, land: str = "NO", år: int = None):
|
||||
async def holidays(
|
||||
self, interaction: discord.Interaction, *, land: app_commands.Range[str, 2, 2] = "NO", år: int = None
|
||||
):
|
||||
"""
|
||||
Get holidays for a country for a given year
|
||||
|
||||
|
||||
@@ -31,7 +31,12 @@ class TempVoice(commands.Cog):
|
||||
@app_commands.checks.bot_has_permissions(manage_channels=True, embed_links=True)
|
||||
@app_commands.checks.cooldown(1, 300)
|
||||
@app_commands.command(name="tempvoice")
|
||||
async def tempvoice(self, interaction: discord.Interaction, name: str, limit: int = 0):
|
||||
async def tempvoice(
|
||||
self,
|
||||
interaction: discord.Interaction,
|
||||
name: app_commands.Range[str, 1, 100],
|
||||
limit: app_commands.Range[int, 0, 99] = 0,
|
||||
):
|
||||
"""
|
||||
Create a temporary voice channel
|
||||
|
||||
@@ -39,7 +44,7 @@ class TempVoice(commands.Cog):
|
||||
----------
|
||||
interaction (discord.Interaction): The interaction object
|
||||
name (str): The name of the channel
|
||||
limit (int): The user limit of the channel
|
||||
limit (int): The user limit of the channel. 0 means no limit
|
||||
"""
|
||||
|
||||
channel = await self.temp_voice_helper.create_temp_voice(interaction, name, limit)
|
||||
|
||||
Reference in new issue
Block a user