Compare commits

..

No commits in common. "e559db9f10bc798fab1834f7ed50292ba9633754" and "7c8aaba309a90b15c5f46006f21282b2b00ac9e8" have entirely different histories.

6 changed files with 7 additions and 51 deletions

View file

@ -1224,31 +1224,7 @@ class Aurora(commands.Cog):
error("Please provide a valid GalacticBot moderation export file.") error("Please provide a valid GalacticBot moderation export file.")
) )
@aurora.group(autohelp=True, name="convert") @aurora.command(aliases=["tdc", "td", "timedeltaconvert"])
async def aurora_convert(self, ctx: commands.Context):
"""Convert strings to various Python objects."""
pass
@aurora_convert.command(aliases=["dt"])
async def datetime(self, ctx: commands.Context, *, date: str) -> None:
"""Convert a string to a datetime object.
This command converts a date to a [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime) Python object.
**Example usage**
`[p]aurora datetime 08/20/2024`
**Output**
`2024-08-20 12:00:00`"""
try:
parsed_date = parse(date)
await ctx.send(f"`{parsed_date}`")
except (ParserError, OverflowError) as e:
if e == ParserError:
await ctx.send(error("Invalid date format!"))
if e == OverflowError:
await ctx.send(error("Date is too far in the future!"))
@aurora_convert.command(aliases=["td"])
async def timedelta(self, ctx: commands.Context, *, duration: str) -> None: async def timedelta(self, ctx: commands.Context, *, duration: str) -> None:
"""Convert a string to a timedelta. """Convert a string to a timedelta.
@ -1265,7 +1241,7 @@ class Aurora(commands.Cog):
return return
await ctx.send(f"`{parsed_time}`") await ctx.send(f"`{parsed_time}`")
@aurora_convert.command(aliases=["rd"]) @aurora.command(aliases=["rdc", "rd", "relativedeltaconvert"])
async def relativedelta(self, ctx: commands.Context, *, duration: str) -> None: async def relativedelta(self, ctx: commands.Context, *, duration: str) -> None:
"""Convert a string to a relativedelta. """Convert a string to a relativedelta.

View file

@ -1,5 +1,4 @@
from discord import ButtonStyle, Interaction, Message, ui from discord import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from redbot.core.utils.chat_formatting import error from redbot.core.utils.chat_formatting import error
@ -15,10 +14,7 @@ class Addrole(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): async def on_timeout(self):
try:
await self.message.edit(view=None) await self.message.edit(view=None)
except NotFound:
pass
@ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25) @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): async def addrole_select(self, interaction: Interaction, select: ui.RoleSelect):

View file

@ -1,5 +1,4 @@
from discord import ButtonStyle, Interaction, Message, ui from discord import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from ..utilities.config import config from ..utilities.config import config
@ -15,10 +14,7 @@ class Guild(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): async def on_timeout(self):
try:
await self.message.edit(view=None) await self.message.edit(view=None)
except NotFound:
pass
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0) @ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument

View file

@ -1,5 +1,4 @@
from discord import ButtonStyle, Interaction, Message, ui from discord import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from redbot.core.utils.chat_formatting import error from redbot.core.utils.chat_formatting import error
@ -15,10 +14,7 @@ class Immune(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): async def on_timeout(self):
try:
await self.message.edit(view=None) await self.message.edit(view=None)
except NotFound:
pass
@ui.select(cls=ui.RoleSelect, placeholder="Select a role", min_values=0, max_values=25) @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): async def immune_select(self, interaction: Interaction, select: ui.RoleSelect):

View file

@ -1,5 +1,4 @@
from discord import ButtonStyle, Interaction, Message, ui from discord import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from ..utilities.config import config from ..utilities.config import config
@ -15,10 +14,7 @@ class Overrides(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): async def on_timeout(self):
try:
await self.message.edit(view=None) await self.message.edit(view=None)
except NotFound:
pass
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0) @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 async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument

View file

@ -1,5 +1,4 @@
from discord import ButtonStyle, Interaction, Message, ui from discord import ButtonStyle, Interaction, Message, ui
from discord.errors import NotFound
from redbot.core import commands from redbot.core import commands
from ..models.type import Type from ..models.type import Type
@ -16,10 +15,7 @@ class Types(ui.View):
self.timeout = timeout self.timeout = timeout
async def on_timeout(self): async def on_timeout(self):
try:
await self.message.edit(view=None) await self.message.edit(view=None)
except NotFound:
pass
@ui.button(label="Show in History", style=ButtonStyle.green, row=0) @ui.button(label="Show in History", style=ButtonStyle.green, row=0)
async def show_in_history(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument async def show_in_history(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument