Reword stat phrasing

This commit is contained in:
nex 2023-02-09 13:44:49 +00:00
parent 95d7d3b561
commit e59883c535
4 changed files with 61 additions and 80 deletions

View file

@ -55,13 +55,7 @@ class Mod(commands.Cog):
@commands.slash_command(name="block")
@owner_or_admin()
async def block_user(
self,
ctx: discord.ApplicationContext,
user: discord.Member,
reason: str,
until: str
):
async def block_user(self, ctx: discord.ApplicationContext, user: discord.Member, reason: str, until: str):
"""Blocks a user from using the bot."""
await ctx.defer()
date = datetime.utcnow()

View file

@ -460,8 +460,8 @@ class OtherCog(commands.Cog):
"SOA",
"SRV",
"TXT",
]
)
],
),
):
"""Looks up a domain name"""
await ctx.defer()
@ -497,43 +497,25 @@ class OtherCog(commands.Cog):
self,
ctx: discord.ApplicationContext,
url: str,
port: discord.Option(
int,
description="Port to use",
default=None
),
port: discord.Option(int, description="Port to use", default=None),
ping_type: discord.Option(
str,
name="ping-type",
description="Type of ping to use. See `traceroute --help`",
choices=["icmp", "tcp", "udp", "udplite", "dccp", "default"],
default="default"
default="default",
),
use_ip_version: discord.Option(
str,
name="ip-version",
description="IP version to use.",
choices=["ipv4", "ipv6"],
default="ipv4"
str, name="ip-version", description="IP version to use.", choices=["ipv4", "ipv6"], default="ipv4"
),
max_ttl: discord.Option(
int,
name="ttl",
description="Max number of hops",
default=30
)
max_ttl: discord.Option(int, name="ttl", description="Max number of hops", default=30),
):
"""Performs a traceroute request."""
await ctx.defer()
if re.search(r"\s+", url):
return await ctx.respond("URL cannot contain spaces.")
args = [
"sudo",
"-E",
"-n",
"traceroute"
]
args = ["sudo", "-E", "-n", "traceroute"]
flags = {
"ping_type": {
"icmp": "-I",
@ -542,10 +524,7 @@ class OtherCog(commands.Cog):
"udplite": "-UL",
"dccp": "-D",
},
"use_ip_version": {
"ipv4": "-4",
"ipv6": "-6"
}
"use_ip_version": {"ipv4": "-4", "ipv6": "-6"},
}
if ping_type != "default":
@ -683,7 +662,14 @@ class OtherCog(commands.Cog):
try:
async with self.lock:
screenshot, driver, fetch_time, screenshot_time = await self.screenshot_website(
ctx, url.geturl(), browser, render_timeout, load_timeout, window_height, window_width, capture_whole_page
ctx,
url.geturl(),
browser,
render_timeout,
load_timeout,
window_height,
window_width,
capture_whole_page,
)
except TimeoutError:
return await ctx.edit(content="Rendering screenshot timed out. Try using a smaller resolution.")

View file

@ -282,7 +282,6 @@ class UptimeCompetition(commands.Cog):
def generate_embed(target, specific_entries: list[UptimeEntry]):
targ = target
# targ = self.get_target(target_id=target)
embed = discord.Embed(
title=f"Uptime stats for {targ['name']}",
description=f"Showing uptime stats for the last {look_back:,} days.",
@ -308,10 +307,12 @@ class UptimeCompetition(commands.Cog):
name="\u200b",
value=f"*Started monitoring {discord.utils.format_dt(first_check, style='R')}, "
f"{total_count:,} monitoring events collected*\n"
f"**Online:**\n\t\\* {online_avg:.2f}% of the time\n\t\\* Last online: "
f"**Online:**\n\t\\* {online_avg:.2f}% of the time ({online_count:,} events)\n\t"
f"\\* Last seen online: "
f"{discord.utils.format_dt(last_online, 'R') if last_online else 'Never'}\n"
f"\n"
f"**Offline:**\n\t\\* {100 - online_avg:.2f}% of the time\n\t\\* Last offline: "
f"**Offline:**\n\t\\* {100 - online_avg:.2f}% of the time ({offline_count:,} events)\n\t"
f"\\* Last seen offline: "
f"{discord.utils.format_dt(last_offline, 'R') if last_offline else 'Never'}\n"
f"\n"
f"**Average Response Time:**\n\t\\* {average_response_time:.2f}ms",
@ -499,18 +500,18 @@ class UptimeCompetition(commands.Cog):
await ctx.respond("Monitor added!")
@monitors.command(name="dump")
async def show_monitor(self, ctx: discord.ApplicationContext, name: discord.Option(str, description="The name of the monitor.")):
"""Shows a monitors data."""
async def show_monitor(
self, ctx: discord.ApplicationContext, name: discord.Option(str, description="The name of the monitor.")
):
"""Shows a monitor's data."""
await ctx.defer()
name: str
targets = self.cached_targets
for target in targets:
if target["name"] == name or target["id"] == name:
target = self.get_target(name)
if target:
return await ctx.respond(f"```json\n{json.dumps(target, indent=4)}```")
await ctx.respond("Monitor not found.")
@monitors.command(name="remove")
@commands.is_owner()
async def remove_monitor(

View file

@ -30,7 +30,7 @@ __all__ = [
"Assignments",
"Tutors",
"UptimeEntry",
"JimmyBans"
"JimmyBans",
]
T = TypeVar("T")