46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
|
# plugins/commands.py
|
||
|
|
||
|
import logging
|
||
|
import simplematrixbotlib as botlib
|
||
|
|
||
|
async def handle_command(room, message, bot, PREFIX):
|
||
|
"""
|
||
|
Function to handle the !commands command.
|
||
|
|
||
|
Args:
|
||
|
room (Room): The Matrix room where the command was invoked.
|
||
|
message (RoomMessage): The message object containing the command.
|
||
|
|
||
|
Returns:
|
||
|
None
|
||
|
"""
|
||
|
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||
|
if match.is_not_from_this_bot() and match.prefix() and match.command("commands"):
|
||
|
logging.info("Fetching commands documentation")
|
||
|
commands_message = """
|
||
|
**Available Commands:**
|
||
|
|
||
|
**!fortune**
|
||
|
Returns a random fortune message.
|
||
|
|
||
|
**!date**
|
||
|
Displays the current date and time.
|
||
|
|
||
|
**!proxy**
|
||
|
Retrieves and tests random SOCKS5 and HTTP proxies.
|
||
|
|
||
|
**!isup <domain/ip>**
|
||
|
Checks if the specified domain or IP address is reachable.
|
||
|
|
||
|
**!karma <user>**
|
||
|
Retrieves the karma points for the specified user.
|
||
|
|
||
|
**!karma <user> up**
|
||
|
Increases the karma points for the specified user by 1.
|
||
|
|
||
|
**!karma <user> down**
|
||
|
Decreases the karma points for the specified user by 1.
|
||
|
"""
|
||
|
await bot.api.send_markdown_message(room.room_id, commands_message)
|
||
|
logging.info("Sent commands documentation to the room")
|