-
-
Notifications
You must be signed in to change notification settings - Fork 105
Example
Mr.Miss edited this page Feb 23, 2021
·
7 revisions
from anjani_bot import listener, plugin
class PluginClass(plugin.Plugin):
name = "plugin-name" # Mandatory variable this plugin has a help string
helpable = True # You don't have to add this var if the plugin doesn't have a helper
# class function that don't need decorator
# This sometimes need to simplify your main plugin
async def hi(self, chat_id):
# self have the client too!
await self.bot.client.send_message(
chat_id=chat_id,
text=f"Hi again i'm {self.bot.name}", # self.bot refer to `~Anjani`
)
# self.bot.client refer to `~pyrogram.Client`
@listener.on("hello")
async def hello(self, message):
await message.reply_text("Hi...")
await self.hi(message.chat.id) # refer to hi() class function above
@listener.on(filters=filters.new_chat_members, group=7, update="message") # This method called every member joined a group chats
async def member_joined(self, message):
await message.reply_text("A new member has joined the chats")
@listener.on(filters=filters.regex(r"button_(.*?)"), update="callbackquery") # This method called updates that match te regex
async def button_callback(self, query):
await self.bot.client.send_message(query.message.chat.id, "Button Clicked")
Wiki of Anjani © Copyright 2021, UserBotIndo