mirror of
https://github.com/Nick80835/microbot
synced 2025-08-30 14:08:31 +00:00
add some ping testers
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from time import time_ns
|
||||
|
||||
from ubot.micro_bot import micro_bot
|
||||
|
||||
ldr = micro_bot.loader
|
||||
@@ -8,6 +10,18 @@ DAN_URL = "http://danbooru.donmai.us/posts.json"
|
||||
DAN_SAUCE_URL = "https://danbooru.donmai.us/posts/"
|
||||
|
||||
|
||||
@ldr.add("danping", sudo=True)
|
||||
async def danbooru_ping(event):
|
||||
params = {"limit": 1,
|
||||
"random": "true"}
|
||||
|
||||
start = time_ns()
|
||||
|
||||
async with ldr.aioclient.get(DAN_URL, params=params) as _:
|
||||
time_taken_ms = int((time_ns() - start) / 1000000)
|
||||
await event.reply(f"Danbooru response time -> **{time_taken_ms}**ms")
|
||||
|
||||
|
||||
@ldr.add("dan(s|x|q|)(f|)", nsfw=True)
|
||||
async def danbooru(event):
|
||||
safety_arg = event.pattern_match.group(1)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from random import choice
|
||||
from time import time_ns
|
||||
|
||||
from ubot.micro_bot import micro_bot
|
||||
|
||||
@@ -10,6 +11,21 @@ GEL_URL = "https://gelbooru.com/index.php"
|
||||
GEL_SAUCE_URL = "https://gelbooru.com/index.php?page=post&s=view&id="
|
||||
|
||||
|
||||
@ldr.add("gelping", sudo=True)
|
||||
async def danbooru_ping(event):
|
||||
params = {"page": "dapi",
|
||||
"s": "post",
|
||||
"q": "index",
|
||||
"json": 1,
|
||||
"tags": f"sort:random"}
|
||||
|
||||
start = time_ns()
|
||||
|
||||
async with ldr.aioclient.get(GEL_URL, params=params) as _:
|
||||
time_taken_ms = int((time_ns() - start) / 1000000)
|
||||
await event.reply(f"Gelbooru response time -> **{time_taken_ms}**ms")
|
||||
|
||||
|
||||
@ldr.add("gel(s|x|q|)(f|)", nsfw=True)
|
||||
async def gelbooru(event):
|
||||
safety_arg = event.pattern_match.group(1)
|
||||
|
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from time import time_ns
|
||||
|
||||
from ubot.micro_bot import micro_bot
|
||||
|
||||
ldr = micro_bot.loader
|
||||
@@ -8,6 +10,19 @@ SAN_URL = "https://capi-v2.sankakucomplex.com/posts"
|
||||
SAN_SAUCE_URL = "https://beta.sankakucomplex.com/post/show/"
|
||||
|
||||
|
||||
@ldr.add("sanping", sudo=True)
|
||||
async def sankaku_ping(event):
|
||||
params = {"page": 1,
|
||||
"limit": 5,
|
||||
"tags": f"order:random"}
|
||||
|
||||
start = time_ns()
|
||||
|
||||
async with ldr.aioclient.get(SAN_URL, params=params) as _:
|
||||
time_taken_ms = int((time_ns() - start) / 1000000)
|
||||
await event.reply(f"Sankaku response time -> **{time_taken_ms}**ms")
|
||||
|
||||
|
||||
@ldr.add("san(s|x|q|)(f|)", nsfw=True)
|
||||
async def sankaku(event):
|
||||
safety_arg = event.pattern_match.group(1)
|
||||
|
Reference in New Issue
Block a user