Untitled

 avatar
unknown
python
2 years ago
1.3 kB
28
Indexable
from pathlib import Path
import botogram
import requests
from time import sleep
import json
class MyACL(botogram.Component):
    component_name = "myacl"

    def __init__(self, allowed=None):
        if allowed is None:
            allowed = []
        self.allowed = allowed
        self.add_before_processing_hook(self.filter)

    def filter(self, chat, message):
        if str(message.sender.id) not in self.allowed:
            return True

acl = myacl.MyACL()
acl.allowed = ["telegramuserid"]
bot = botogram.create("botkey")
bot.use(acl)
owner = you telegram id
@bot.command("addmem")
def send_botogram_link(shared, chat, message, args):
    """add new member for bot"""
    #adduswe
    user = str(chat.creator.id)
    if user == str(owner):
        acl.allowed.append(str(args[0]))
        chat.send("added user " + str(args[0]))
        chat.send('total user is %s' % str(acl.allowed))
       
       
@bot.command("remove")
def send_botogram_link(chat, message, args):
    """remove member"""
    #adduswe
    user = str(chat.creator.id)
    chat.send(str(listofacc))
    if user == str(owner):
            rem = str(args[0])
            acl.allowed.remove(rem)
            chat.send("removed user " + str(args[0]))
            count = len(acl.allowed)
            chat.send('total user is %s' % count)
 
Editor is loading...