52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
# Copyright (C) 2022 nocturn9x
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
import logging
|
|
from pyrogram.types import Message
|
|
from pyrogram.errors import RPCError
|
|
from pyrogram import Client, filters
|
|
from pyrogram.enums.parse_mode import ParseMode
|
|
|
|
|
|
HELP_MSG = """List of available commands:
|
|
- /help: Opens help menu (you are here)
|
|
- /start: Starts the bot
|
|
- /play: Create a lobby to play UNO!
|
|
- /stop: Stops the current game
|
|
- /draw: Draw a card from the deck
|
|
- /uno: Say UNO!
|
|
- /pass: End your turn
|
|
- /join <id>: Join a game lobby
|
|
- /close: Close the game lobby to new players
|
|
- /open: Reopens a lobby to new players
|
|
- /list: List all players in the current lobby
|
|
- /leave: Leave the current lobby
|
|
- /kick <id>: Kicks a given player from the current game
|
|
- /begin: Starts the game and closes the lobby
|
|
- /broadcast <message>: Sends a message to all users
|
|
- /whisper <id> <message>: Sends a message to a single user
|
|
- /throw <card>: Throws a card onto the table
|
|
- /info: Shows the current state of the game (your cards and the table)
|
|
"""
|
|
|
|
|
|
@Client.on_message(filters.command("help"))
|
|
async def help(_: Client, message: Message):
|
|
"""
|
|
Handles the /help command
|
|
"""
|
|
|
|
try:
|
|
await message.reply_text(HELP_MSG, parse_mode=ParseMode.MARKDOWN)
|
|
except RPCError as rpc_error:
|
|
logging.error(f"An unexpected RPC error occurred: {type(rpc_error).__name__} -> {rpc_error}")
|