fix remove
This commit is contained in:
@@ -356,4 +356,4 @@ facepalm.jpg
|
|||||||
не бережешь ты себя, золотой ты человек
|
не бережешь ты себя, золотой ты человек
|
||||||
🦔
|
🦔
|
||||||
наш человек че там
|
наш человек че там
|
||||||
хренасси год начинается, в чате питон обсуждают
|
хренасси год начинается, в чате питон обсуждают
|
||||||
|
|||||||
+3
-3
@@ -268,7 +268,7 @@ def add_stan_quote(message):
|
|||||||
if message.reply_to_message and message.reply_to_message.text:
|
if message.reply_to_message and message.reply_to_message.text:
|
||||||
with open('Stan.txt', 'a', encoding='utf8') as stan_quotes:
|
with open('Stan.txt', 'a', encoding='utf8') as stan_quotes:
|
||||||
if message.reply_to_message.text not in (i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')):
|
if message.reply_to_message.text not in (i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')):
|
||||||
stan_quotes.write('\n' + message.reply_to_message.text)
|
stan_quotes.write(message.reply_to_message.text + '\n')
|
||||||
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,
|
||||||
@@ -279,9 +279,9 @@ def add_stan_quote(message):
|
|||||||
def remove_stan_quote(message):
|
def remove_stan_quote(message):
|
||||||
if message.reply_to_message and message.reply_to_message.text:
|
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')):
|
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')]
|
quotes = list(open('Stan.txt', 'r', encoding='utf8'))
|
||||||
with open('Stan.txt', 'w', encoding='utf8') as stan_quotes:
|
with open('Stan.txt', 'w', encoding='utf8') as stan_quotes:
|
||||||
quotes.remove(message.reply_to_message.text)
|
quotes.remove(message.reply_to_message.text + '\n')
|
||||||
stan_quotes.writelines(quotes)
|
stan_quotes.writelines(quotes)
|
||||||
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:
|
||||||
|
|||||||
+1
-1
@@ -5,4 +5,4 @@ import random
|
|||||||
def speak(chance_of):
|
def speak(chance_of):
|
||||||
number = random.randint(0, chance_of)
|
number = random.randint(0, chance_of)
|
||||||
if number == 0:
|
if number == 0:
|
||||||
return random.choice(i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8'))
|
return random.choice(i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8') if i)
|
||||||
|
|||||||
Reference in New Issue
Block a user