-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomPing.py
More file actions
80 lines (69 loc) · 3.54 KB
/
CustomPing.py
File metadata and controls
80 lines (69 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from hikkatl.types import Message
from .. import loader, utils
import time
import random
"""
███ ███ ██ ██ ██████ ██ ██ ██ ██████ ███████ ███████
████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ███████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██ ██ ██████ ███████ ██████ ███████ ███████
CustomPing
📜 Licensed under the GNU AGPLv3
"""
# meta banner: https://0x0.st/HYVX.jpg
# meta desc: desc
# meta developer: @BruhHikkaModules
@loader.tds
class CustomPing(loader.Module):
"""Have you seen a customizable ping module in Netfoll? I have, yes, but I find it unacceptable to use Netfoll, so I took the idea of custom ping, and replicated it."""
strings = {
"name": "CustomPing",
"configping": "Your custom text.\n"
"You can use placeholders:\n"
"{ping} - That's your ping.\n"
"{uptime} - It's your uptime.\n"
"{ping_hint} - This is the same hint as in the hikka module, it is chosen with random chance, also you can specify this hint in the config ",
"hint": "Set a hint",
}
strings_ru = {
"_cls_doc": "Вы видели настраиваемый модуль ping в Netfoll? Я, да но я считаю недопустимо использовать Netfoll, поэтому я взял за идею кастомный пинг, и повторил его.",
"configping": "Ваш кастомный текст.\n"
"Вы можете использовать плейсхолдеры:\n"
"{ping} - Это ваш пинг\n"
"{uptime} - Это ваш аптайм\n"
"{ping_hint} - Это такая же подсказка как и в модуле хикки, оно также будет выбираться случайно, вы также можете это указать в конфиге\n",
"hint": "Укажите подсказку",
}
def __init__(self):
self.config = loader.ModuleConfig(
loader.ConfigValue(
"text",
"🕐 Задержка юзербота: {ping}",
lambda: self.strings["configping"],
validator=loader.validators.String(),
),
loader.ConfigValue(
"hint",
"This is example hint!",
lambda: self.strings["hint"],
validator=loader.validators.String(),
),
)
@loader.command(
ru_doc=" - Узнать пинг вашего юзербота",
)
async def cping(self, message: Message):
"""- Find out your userbot ping"""
start = time.perf_counter_ns()
message = await utils.answer(message, "🌘")
await utils.answer(
message,
self.config["text"].format(
ping=round((time.perf_counter_ns() - start) / 10**6, 3),
uptime=utils.formatted_uptime(),
ping_hint=(
(self.config["hint"]) if random.choice([0, 0, 1]) == 1 else ""
),
),
)