def bancb(bot, update): uid = update.message.from_user.id gid = update.message.chat.id if not isAdmin(bot, uid, gid): return userid = update.message.reply_to_message.from_user.id if isAdmin(bot, userid, gid): bot.sendMessage(gid, text="You can't kick an administrator") else: db, cur = SetupSession() if BanUser(db, cur, userid, gid): #bot.kickChatMember(gid,userid) bot.sendMessage(gid, text="User wiped") db.close()
def unbancb(bot, update): uid = update.message.from_user.id gid = update.message.chat.id if not isAdmin(bot, uid, gid): return userid = update.message.reply_to_message.from_user.id if isAdmin(bot, userid, gid): #remove admin rights print("rimuovi poteri") else: db, cur = SetupSession() if UnbanUser(db, cur, userid, gid): #bot.unbanChatMember(gid,userid) bot.sendMessage(gid, text="Ban removed") db.close
def modecb(bot, update, args): suid = update.message.from_user.id gid = update.message.chat_id # only an administrator can do that if not isAdmin(bot, suid, gid): return db, cur = SetupSession() try: username = update.message.reply_to_message.from_user.username userid = update.message.reply_to_message.from_user.id except AttributeError: bot.sendMessage( gid, text="Usage:\nquoting the user you want to change mode\n/mode +o|-o" ) return RegisterUser(db, cur, userid, username) if args[0] == "+o": # promote_to_admin if not AdminInDb(db, cur, userid, gid): bot.sendMessage(gid, text=username + " promoted to op") RegisterAdmin(db, cur, userid, gid) else: bot.sendMessage(gid, text=username + " already Op") elif args[0] == "-o": if AdminInDb(db, cur, userid, gid): bot.sendMessage(gid, text=username + " removed from op") RemoveAdmin(db, cur, userid, gid)
def genlink(bot, update): uid = update.message gid = update.message.chat_id if isAdmin(bot, uid, gid): bot.sendMessage(gid, link)