-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathping.py
37 lines (28 loc) · 1.15 KB
/
ping.py
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
"""Contains cog classes for any ping interactions."""
import random
from typing import TYPE_CHECKING
import discord
from config import settings
from utils import TeXBotBaseCog
if TYPE_CHECKING:
from collections.abc import Sequence
from utils import TeXBotApplicationContext
__all__: "Sequence[str]" = ("PingCommandCog",)
class PingCommandCog(TeXBotBaseCog):
"""Cog class that defines the "/remindme" command and its call-back method."""
@discord.slash_command(description="Replies with Pong!") # type: ignore[no-untyped-call, misc]
async def ping(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
"""Definition & callback response of the "ping" command."""
await ctx.respond(
random.choices( # noqa: S311
[
"Pong!",
"`64 bytes from TeX-Bot: icmp_seq=1 ttl=63 time=0.01 ms`",
],
weights=(
100 - settings["PING_COMMAND_EASTER_EGG_PROBABILITY"],
settings["PING_COMMAND_EASTER_EGG_PROBABILITY"],
),
)[0],
ephemeral=True,
)