mirror of
https://github.com/artiemis/artemis.git
synced 2026-02-14 08:31:55 +00:00
(isdown): add isup alias, assume https when no protocol specified
This commit is contained in:
parent
bfe00bbb19
commit
401d89e0fd
@ -15,8 +15,7 @@ from discord.ext import commands
|
|||||||
from discord.utils import format_dt, snowflake_time
|
from discord.utils import format_dt, snowflake_time
|
||||||
from humanize import naturalsize
|
from humanize import naturalsize
|
||||||
|
|
||||||
from .. import utils
|
from ..utils.common import ArtemisError, check_for_ssrf, is_valid_url
|
||||||
from ..utils.common import ArtemisError
|
|
||||||
from ..utils.views import BaseView
|
from ..utils.views import BaseView
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -44,10 +43,18 @@ class Meta(commands.Cog):
|
|||||||
embed.set_footer(text="Thanks for checking in on me!")
|
embed.set_footer(text="Thanks for checking in on me!")
|
||||||
await ctx.reply(embed=embed)
|
await ctx.reply(embed=embed)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(aliases=["isup"])
|
||||||
async def isdown(self, ctx: commands.Context, url: utils.URL):
|
async def isdown(self, ctx: commands.Context, url: str):
|
||||||
"""Check if a site is down."""
|
"""Check if a site is down."""
|
||||||
|
|
||||||
|
url = url.strip("<>")
|
||||||
|
if not url.startswith(("https://", "http://")):
|
||||||
|
url = f"https://{url}"
|
||||||
|
|
||||||
|
if not is_valid_url(url):
|
||||||
|
raise ArtemisError("That doesn't look like a valid URL.")
|
||||||
|
check_for_ssrf(url)
|
||||||
|
|
||||||
headers = {"User-Agent": self.bot.user_agent}
|
headers = {"User-Agent": self.bot.user_agent}
|
||||||
|
|
||||||
await ctx.typing()
|
await ctx.typing()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user