added slash support
This commit is contained in:
parent
61cdc17abd
commit
302513a7e7
1 changed files with 30 additions and 9 deletions
39
main.py
39
main.py
|
@ -1,32 +1,53 @@
|
|||
import time
|
||||
import pyrogram
|
||||
from pyrogram import Client, filters, enums, types
|
||||
from pyrogram.types import Message, BotCommand
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
load_dotenv()
|
||||
|
||||
P = ["v", "/"]
|
||||
COMMANDS = [
|
||||
BotCommand("help", "Get bot help"),
|
||||
BotCommand("minky", "minker"),
|
||||
BotCommand("sync", "(👑) Sync bot commands")
|
||||
]
|
||||
OWNER_ID = 1911826384
|
||||
|
||||
app = Client(
|
||||
"venbot",
|
||||
api_id=os.getenv("API_ID"), api_hash=os.getenv("API_HASH"),
|
||||
bot_token=os.getenv("BOT_TOKEN")
|
||||
)
|
||||
|
||||
|
||||
|
||||
@app.on_message(filters.command(["help"], prefixes="v"))
|
||||
async def help(client, message: types.Message):
|
||||
@app.on_message(filters.command(["help", "h"], prefixes=P))
|
||||
async def help(client, message: Message):
|
||||
await message.reply("""
|
||||
|
||||
v**help** (h) - Send this
|
||||
v**minky** (mink, minker) - minker
|
||||
--You can either use the `v` prefix or the native `/` commands from Telegram. Both work the same way--
|
||||
**help** (h) - Send this
|
||||
**minky** (mink, minker) - minker
|
||||
**sync** 👑 - Sync slash commands
|
||||
""", parse_mode=enums.ParseMode.MARKDOWN)
|
||||
|
||||
#region Fun
|
||||
@app.on_message(filters.command(["minky", "mink", "minker"], prefixes="v"))
|
||||
async def minky(client, message: types.Message):
|
||||
@app.on_message(filters.command(["minky", "mink", "minker"], prefixes=P))
|
||||
async def minky(client, message: Message):
|
||||
await message.reply_chat_action(enums.ChatAction.UPLOAD_PHOTO)
|
||||
await message.reply_photo(f"https://minky.materii.dev?{time.time()}")
|
||||
#endregion
|
||||
|
||||
#region Util
|
||||
@app.on_message(filters.command("sync", prefixes=P))
|
||||
async def sync(client, message: Message):
|
||||
await message.reply_chat_action(enums.ChatAction.TYPING)
|
||||
if message.from_user.id != OWNER_ID:
|
||||
await message.reply_voice("https://files.catbox.moe/8t4ljl.mp3")
|
||||
return
|
||||
await app.set_bot_commands(COMMANDS)
|
||||
await message.reply("done")
|
||||
await message.reply_chat_action(enums.ChatAction.CANCEL)
|
||||
|
||||
#endregion
|
||||
|
||||
app.run()
|
Loading…
Reference in a new issue