Skip to content

A Telegram User-Mode Only bot based on Pyrogram made for my personal use.

Notifications You must be signed in to change notification settings

thedragonsinn/plain-ub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLAIN UB

Header Image Header Image

A simple Telegram User-Bot.

Made for my personal use

Example Plugins:

  • Basic Plugin:
from app import BOT, bot, Message

@bot.add_cmd(cmd="test")
async def test_function(bot: BOT, message: Message):
    await message.reply("Testing....")
    """Your rest of the code."""
    
  • Plugin with Multiple Commands:
    Instead of stacking @add_cmd you can pass in a list of command triggers.
from app import BOT, bot, Message

@bot.add_cmd(cmd=["cmd1", "cmd2"])
async def test_function(bot: BOT, message: Message):
    if message.cmd=="cmd1":
        await message.reply("cmd1 triggered function")
    """Your rest of the code."""
    
  • Plugin with DB access:
from app import BOT, bot, Message, CustomDB

TEST_COLLECTION = CustomDB("TEST_COLLECTION")

@bot.add_cmd(cmd="add_data")
async def test_function(bot: BOT, message: Message):
    async for data in TEST_COLLECTION.find():
        """Your rest of the code."""
    # OR
    await TEST_COLLECTION.add_data(data={"_id":"test", "data":"some_data"})
    await TEST_COLLECTION.delete_data(id="test")
  • Conversational Plugin:
    • Bound Method

      from pyrogram import filters
      from app import BOT, bot, Message
      @bot.add_cmd(cmd="test")
      async def test_function(bot: BOT, message: Message):
          response = await message.get_response(
              filters=filters.text&filters.user([1234]), 
              timeout=10,
          )
          # Will return First text it receives in chat where cmd was ran
          """ rest of the code """
             
    • Conversational

      from app import BOT, bot, Message, Convo
      from pyrogram import filters
      
      @bot.add_cmd(cmd="test")
      async def test_function(bot: BOT, message: Message):
          async with Convo(
              client=bot, 
              chat_id=1234, 
              filters=filters.text, 
              timeout=10
          ) as convo:
              await convo.get_response(timeout=10)
              await convo.send_message(text="abc", get_response=True, timeout=8)
              # and so on
          

About

A Telegram User-Mode Only bot based on Pyrogram made for my personal use.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published