import key
from telegram.ext import *
import random
from telegram import *
print("Starting up bot..")
def start_command(update, context):
update.message.reply_text("I live in the American Gardens Building on West 81st Street on the 11th floor. My name is Patrick Bateman. I’m 27 years old. I believe in taking care of myself, and a balanced diet and a rigorous exercise routine. ")
def goals_command(update, context):
update.message.reply_text("1. Wstajemy o 7:30 \n 2.Czytamy min. 30 stron książki \n 3.Poświęcamy min. pół godziny na dążeniu do ustalonego celu (nauka czy coś) \n 4. Ćwiczymy lub rozciągamy się \n 5. Minimum jeden high effort meal from scratch")
def custom_command(update, context):
update.message.reply_text("......")
def pierwszy_command(update, context):
update.message.reply_text(f"{update.message.chat.firstname} był pierwszy")
def handle_response(text: str) -> str:
if 'hello' in text:
return 'Siemaszko'
if 'łopa to' in text:
return 'zodiakara'
if "jak oceniasz" in text:
return f"{random.randrange(1,10)} na 10"
if "świadomość" in text:
return "Tak mam to, lol, przecież jestem żywą istotą, essunia."
if 'szanse' in text:
return f"z moich obliczeń wynika, że istnieje {random.randrange(1,100)}% szansy na powodzenie"
if 'słowo na n' in text:
return 'Negacja'
# if 'gm' in text:
# gm_command()
spanish_words = ["estupido bambino!", "coño pendejito!!", "chupamedia chingada", "joder mierda!!!", "tu puta madre perrito!", "la hostia!", "ay carambito bebito, como te llamas???", "Tu madre es coma el tomatina, me gusta comerla"]
def powiedzmu_command(update, context):
update.message.reply_text(random.choice(spanish_words))
# def gm_command(update, context):
# update.message.photo(-695610881, 'waltuh.jpg', 'rb')
def gm_command(update:Update, context:CallbackContext):
stickers = ["hood1.png","hood2.png", "hood3.png","hood4.png","hood5.png","hood6.png",
"hood7.png","hood8.png","hood9.png","hood10.png","hood11.png","hood12.png","hood13.png","hood14.png","hood15.png"]
generator = random.choice(stickers)
photo = open(f"{generator}", 'rb')
context.bot.send_sticker(chat_id=update.effective_chat.id, sticker=photo)
def handle_message(update, context):
message_type = update.message.chat.type
text = str(update.message.text).lower()
response = ''
print(f"User ({update.message.chat.id}) says: {text} in {message_type}")
if message_type == 'group':
if '@amerykanski_psychol_bot' in text:
new_text = text.replace('@amerykanski_psychol_bot', '').strip()
resposne = handle_response(text)
else:
response = handle_response(text)
update.message.reply_text(response)
def error(update, context):
print(f"Update {update} caused error {context.error}")
if __name__ == '__main__':
updater = Updater(key.token, use_context=True)
dp = updater.dispatcher
# Commands
dp.add_handler(CommandHandler('start', start_command))
dp.add_handler(CommandHandler('goals', goals_command))
dp.add_handler(CommandHandler('custom', custom_command))
dp.add_handler(CommandHandler('pierwszy', pierwszy_command))
dp.add_handler(CommandHandler('powiedzmu', powiedzmu_command))
dp.add_handler(CommandHandler('gm', gm_command))
# Messages
dp.add_handler(MessageHandler(Filters.text, handle_message))
# Log all errors
dp.add_error_handler(error)
# Run the bot
updater.start_polling(1.0)
updater.idle()