コード例 #1
0
def del_fed(bot: Bot, update: Update, args: List[str]):

        chat = update.effective_chat  # type: Optional[Chat]
        user = update.effective_user  # type: Optional[User]
        fed_id = sql.get_fed_id(chat.id)

        if not fed_id:
            update.effective_message.reply_text(tld(chat.id, "At the moment, We only support deleting federation on the group that joined it."))
            return

        if not is_user_fed_owner(fed_id, user.id):
            update.effective_message.reply_text(tld(chat.id, "Only fed owner can do this!"))
            return

        sql.del_fed(fed_id, chat.id)
        update.effective_message.reply_text(tld(chat.id, "Deleted!"))
コード例 #2
0
def del_fed_button(bot, update):
	query = update.callback_query
	userid = query.message.chat.id
	fed_id = query.data.split("_")[1]

	if fed_id == 'cancel':
		query.message.edit_text("Federation deletion cancelled")
		return

	getfed = sql.get_fed_info(fed_id)
	if getfed:
		delete = sql.del_fed(fed_id)
		if delete:
			query.message.edit_text("You have removed your Federation! Now all the Groups that are connected with `{}` do not have a Federation.".format(getfed['fname']), parse_mode='markdown')