-
Notifications
You must be signed in to change notification settings - Fork 6
/
ping.py
34 lines (25 loc) · 1.03 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
"""Contains cog classes for any ping interactions."""
from collections.abc import Sequence
__all__: Sequence[str] = ("PingCommandCog",)
import random
import discord
from config import settings
from utils import TeXBotApplicationContext, TeXBotBaseCog
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:
"""Definition & callback response of the "ping" command."""
await ctx.respond(
random.choices(
[
"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,
)