Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def scheduled_daily_demotion_reset(context: CallbackContext):
- # Get all users group stat
- cursor.execute("SELECT user_id, group_status FROM users")
- gstats = cursor.fetchall()
- update = Update
- # check each user's group_status
- for user_id, group_status in gstats:
- if group_status == 'out':
- # Remove user from the group if out
- chat_id = update.message.chat_id
- kick(user_id, chat_id, update, context)
- # Command handler for /kick
- def kick(user_id, chat_id, update: Update, context: CallbackContext) -> None:
- # Remove user from the group if out
- context.bot.kick_chat_member(chat_id, user_id)
- update.message.reply_text(f"{user_id} have been removed from the group due to 'out' status.")
- Error I get:
- chat_id = update.message.chat_id
- ^^^^^^^^^^^^^^^^^^^^^^
- AttributeError: 'member_descriptor' object has no attribute 'chat_id'
Advertisement
Add Comment
Please, Sign In to add comment