mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Reword stat phrasing
This commit is contained in:
parent
95d7d3b561
commit
e59883c535
4 changed files with 61 additions and 80 deletions
|
@ -55,13 +55,7 @@ class Mod(commands.Cog):
|
||||||
|
|
||||||
@commands.slash_command(name="block")
|
@commands.slash_command(name="block")
|
||||||
@owner_or_admin()
|
@owner_or_admin()
|
||||||
async def block_user(
|
async def block_user(self, ctx: discord.ApplicationContext, user: discord.Member, reason: str, until: str):
|
||||||
self,
|
|
||||||
ctx: discord.ApplicationContext,
|
|
||||||
user: discord.Member,
|
|
||||||
reason: str,
|
|
||||||
until: str
|
|
||||||
):
|
|
||||||
"""Blocks a user from using the bot."""
|
"""Blocks a user from using the bot."""
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
date = datetime.utcnow()
|
date = datetime.utcnow()
|
||||||
|
|
|
@ -460,8 +460,8 @@ class OtherCog(commands.Cog):
|
||||||
"SOA",
|
"SOA",
|
||||||
"SRV",
|
"SRV",
|
||||||
"TXT",
|
"TXT",
|
||||||
]
|
],
|
||||||
)
|
),
|
||||||
):
|
):
|
||||||
"""Looks up a domain name"""
|
"""Looks up a domain name"""
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
|
@ -497,43 +497,25 @@ class OtherCog(commands.Cog):
|
||||||
self,
|
self,
|
||||||
ctx: discord.ApplicationContext,
|
ctx: discord.ApplicationContext,
|
||||||
url: str,
|
url: str,
|
||||||
port: discord.Option(
|
port: discord.Option(int, description="Port to use", default=None),
|
||||||
int,
|
|
||||||
description="Port to use",
|
|
||||||
default=None
|
|
||||||
),
|
|
||||||
ping_type: discord.Option(
|
ping_type: discord.Option(
|
||||||
str,
|
str,
|
||||||
name="ping-type",
|
name="ping-type",
|
||||||
description="Type of ping to use. See `traceroute --help`",
|
description="Type of ping to use. See `traceroute --help`",
|
||||||
choices=["icmp", "tcp", "udp", "udplite", "dccp", "default"],
|
choices=["icmp", "tcp", "udp", "udplite", "dccp", "default"],
|
||||||
default="default"
|
default="default",
|
||||||
),
|
),
|
||||||
use_ip_version: discord.Option(
|
use_ip_version: discord.Option(
|
||||||
str,
|
str, name="ip-version", description="IP version to use.", choices=["ipv4", "ipv6"], default="ipv4"
|
||||||
name="ip-version",
|
|
||||||
description="IP version to use.",
|
|
||||||
choices=["ipv4", "ipv6"],
|
|
||||||
default="ipv4"
|
|
||||||
),
|
),
|
||||||
max_ttl: discord.Option(
|
max_ttl: discord.Option(int, name="ttl", description="Max number of hops", default=30),
|
||||||
int,
|
|
||||||
name="ttl",
|
|
||||||
description="Max number of hops",
|
|
||||||
default=30
|
|
||||||
)
|
|
||||||
):
|
):
|
||||||
"""Performs a traceroute request."""
|
"""Performs a traceroute request."""
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
if re.search(r"\s+", url):
|
if re.search(r"\s+", url):
|
||||||
return await ctx.respond("URL cannot contain spaces.")
|
return await ctx.respond("URL cannot contain spaces.")
|
||||||
|
|
||||||
args = [
|
args = ["sudo", "-E", "-n", "traceroute"]
|
||||||
"sudo",
|
|
||||||
"-E",
|
|
||||||
"-n",
|
|
||||||
"traceroute"
|
|
||||||
]
|
|
||||||
flags = {
|
flags = {
|
||||||
"ping_type": {
|
"ping_type": {
|
||||||
"icmp": "-I",
|
"icmp": "-I",
|
||||||
|
@ -542,10 +524,7 @@ class OtherCog(commands.Cog):
|
||||||
"udplite": "-UL",
|
"udplite": "-UL",
|
||||||
"dccp": "-D",
|
"dccp": "-D",
|
||||||
},
|
},
|
||||||
"use_ip_version": {
|
"use_ip_version": {"ipv4": "-4", "ipv6": "-6"},
|
||||||
"ipv4": "-4",
|
|
||||||
"ipv6": "-6"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ping_type != "default":
|
if ping_type != "default":
|
||||||
|
@ -683,7 +662,14 @@ class OtherCog(commands.Cog):
|
||||||
try:
|
try:
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
screenshot, driver, fetch_time, screenshot_time = await self.screenshot_website(
|
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:
|
except TimeoutError:
|
||||||
return await ctx.edit(content="Rendering screenshot timed out. Try using a smaller resolution.")
|
return await ctx.edit(content="Rendering screenshot timed out. Try using a smaller resolution.")
|
||||||
|
|
|
@ -282,7 +282,6 @@ class UptimeCompetition(commands.Cog):
|
||||||
|
|
||||||
def generate_embed(target, specific_entries: list[UptimeEntry]):
|
def generate_embed(target, specific_entries: list[UptimeEntry]):
|
||||||
targ = target
|
targ = target
|
||||||
# targ = self.get_target(target_id=target)
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=f"Uptime stats for {targ['name']}",
|
title=f"Uptime stats for {targ['name']}",
|
||||||
description=f"Showing uptime stats for the last {look_back:,} days.",
|
description=f"Showing uptime stats for the last {look_back:,} days.",
|
||||||
|
@ -308,10 +307,12 @@ class UptimeCompetition(commands.Cog):
|
||||||
name="\u200b",
|
name="\u200b",
|
||||||
value=f"*Started monitoring {discord.utils.format_dt(first_check, style='R')}, "
|
value=f"*Started monitoring {discord.utils.format_dt(first_check, style='R')}, "
|
||||||
f"{total_count:,} monitoring events collected*\n"
|
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"{discord.utils.format_dt(last_online, 'R') if last_online else 'Never'}\n"
|
||||||
f"\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"{discord.utils.format_dt(last_offline, 'R') if last_offline else 'Never'}\n"
|
||||||
f"\n"
|
f"\n"
|
||||||
f"**Average Response Time:**\n\t\\* {average_response_time:.2f}ms",
|
f"**Average Response Time:**\n\t\\* {average_response_time:.2f}ms",
|
||||||
|
@ -499,18 +500,18 @@ class UptimeCompetition(commands.Cog):
|
||||||
await ctx.respond("Monitor added!")
|
await ctx.respond("Monitor added!")
|
||||||
|
|
||||||
@monitors.command(name="dump")
|
@monitors.command(name="dump")
|
||||||
async def show_monitor(self, ctx: discord.ApplicationContext, name: discord.Option(str, description="The name of the monitor.")):
|
async def show_monitor(
|
||||||
"""Shows a monitors data."""
|
self, ctx: discord.ApplicationContext, name: discord.Option(str, description="The name of the monitor.")
|
||||||
|
):
|
||||||
|
"""Shows a monitor's data."""
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
targets = self.cached_targets
|
target = self.get_target(name)
|
||||||
for target in targets:
|
if target:
|
||||||
if target["name"] == name or target["id"] == name:
|
|
||||||
return await ctx.respond(f"```json\n{json.dumps(target, indent=4)}```")
|
return await ctx.respond(f"```json\n{json.dumps(target, indent=4)}```")
|
||||||
await ctx.respond("Monitor not found.")
|
await ctx.respond("Monitor not found.")
|
||||||
|
|
||||||
|
|
||||||
@monitors.command(name="remove")
|
@monitors.command(name="remove")
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def remove_monitor(
|
async def remove_monitor(
|
||||||
|
|
|
@ -30,7 +30,7 @@ __all__ = [
|
||||||
"Assignments",
|
"Assignments",
|
||||||
"Tutors",
|
"Tutors",
|
||||||
"UptimeEntry",
|
"UptimeEntry",
|
||||||
"JimmyBans"
|
"JimmyBans",
|
||||||
]
|
]
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
Loading…
Reference in a new issue