add /remove
This commit is contained in:
+14
-1
@@ -272,7 +272,20 @@ def add_stan_quote(message):
|
|||||||
bot.send_message(message.chat.id, f'✅ <b>Добавил</b>\n └ <i>{message.reply_to_message.text}</i>')
|
bot.send_message(message.chat.id, f'✅ <b>Добавил</b>\n └ <i>{message.reply_to_message.text}</i>')
|
||||||
else:
|
else:
|
||||||
bot.send_message(message.chat.id,
|
bot.send_message(message.chat.id,
|
||||||
f'⛔️ <b><u>Не добавил</u></b>, есть токое\n └ <i>{message.reply_to_message.text}</i>')
|
f'⛔️ <b>Не добавил</b>, есть токое\n └ <i>{message.reply_to_message.text}</i>')
|
||||||
|
|
||||||
|
|
||||||
|
@bot.message_handler(func=is_white, commands=['remove'])
|
||||||
|
def remove_stan_quote(message):
|
||||||
|
if message.reply_to_message and message.reply_to_message.text:
|
||||||
|
if message.reply_to_message.text in (i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')):
|
||||||
|
quotes = [i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')]
|
||||||
|
with open('Stan.txt', 'w', encoding='utf8') as stan_quotes:
|
||||||
|
quotes.remove(message.reply_to_message.text)
|
||||||
|
stan_quotes.writelines(quotes)
|
||||||
|
bot.send_message(message.chat.id, f'✅ <b>Удолил</b>\n └ <i>{message.reply_to_message.text}</i>')
|
||||||
|
else:
|
||||||
|
bot.send_message(message.chat.id, f'⛔️ <b>Нет такого</b>\n └ <i>{message.reply_to_message.text}</i>')
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(func=is_admin, commands=['stats'])
|
@bot.message_handler(func=is_admin, commands=['stats'])
|
||||||
|
|||||||
Reference in New Issue
Block a user