venbot-tg/main.py
2024-07-20 08:22:18 -04:00

58 lines
2.1 KiB
Python

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"),
BotCommand("source", "View venbot-tg's source code")
]
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", "h"], prefixes=P))
async def help(client, message: Message):
help_message = "--You can either use the `v` prefix or the native `/` commands from Telegram. Both work the same way--\n"
for command in COMMANDS:
help_message += f"**{command.command}**{' 👑 ' if command.description.startswith('(👑)') else ' '}- {command.description.replace('(👑) ', '')}\n"
await message.reply(help_message, parse_mode=enums.ParseMode.MARKDOWN)
#region Fun
@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)
@app.on_message(filters.command(["source", "sc"], prefixes=P))
async def source(client, message: Message):
await message.reply("I am free software! You can look at my code on https://git.nin0.dev/nin0/venbot-tg", disable_web_page_preview=True)
#endregion
@app.on_message()
async def message_handler(client, message: Message):
if message.text == "pussy in bio":
await message.reply("kys")
app.run()