2024-05-25 07:05:14 +00:00
|
|
|
import logging
|
2024-05-25 12:27:15 +00:00
|
|
|
import random
|
2024-05-25 07:05:14 +00:00
|
|
|
|
|
|
|
from telegram import Update
|
2024-05-25 07:10:59 +00:00
|
|
|
from telegram.ext import (
|
|
|
|
ApplicationBuilder,
|
|
|
|
CommandHandler,
|
2024-05-25 07:58:57 +00:00
|
|
|
ContextTypes,
|
2024-05-25 07:10:59 +00:00
|
|
|
MessageHandler,
|
|
|
|
filters,
|
|
|
|
)
|
2024-05-25 07:05:14 +00:00
|
|
|
|
2024-05-25 12:27:15 +00:00
|
|
|
import nlp
|
2024-05-25 07:05:14 +00:00
|
|
|
from settings import Settings
|
|
|
|
|
2024-05-25 07:58:57 +00:00
|
|
|
# Load environment variables
|
2024-05-25 07:05:14 +00:00
|
|
|
settings = Settings()
|
|
|
|
|
2024-05-25 07:58:57 +00:00
|
|
|
# Set the log level
|
|
|
|
log_level = logging.getLevelNamesMapping().get(settings.log_level, logging.INFO)
|
2024-05-25 07:05:14 +00:00
|
|
|
logging.basicConfig(
|
|
|
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=log_level
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
|
|
await context.bot.send_message(
|
|
|
|
chat_id=update.effective_chat.id, text="Hello, deez nuts on yo chin!"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-05-25 07:10:59 +00:00
|
|
|
async def message_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
2024-05-25 12:27:15 +00:00
|
|
|
msg = update.effective_message
|
|
|
|
msg_content = msg.text
|
2024-05-25 07:58:57 +00:00
|
|
|
|
|
|
|
if not msg_content:
|
|
|
|
return
|
|
|
|
|
2024-05-25 12:27:15 +00:00
|
|
|
# generate exploitable phrases
|
|
|
|
exploitable_phrases = nlp.find_exploitable_phrases(msg_content)
|
|
|
|
|
|
|
|
phrase = random.choice(exploitable_phrases)
|
2024-05-25 07:58:57 +00:00
|
|
|
|
2024-05-25 12:35:01 +00:00
|
|
|
await msg.reply_text(f"{phrase} deez")
|
2024-05-25 07:10:59 +00:00
|
|
|
|
|
|
|
|
2024-05-25 07:05:14 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
app = ApplicationBuilder().token(settings.bot_token).build()
|
|
|
|
start_handler = CommandHandler("start", start)
|
2024-05-25 07:10:59 +00:00
|
|
|
message_handler = MessageHandler(filters.ALL, message_handler)
|
|
|
|
|
2024-05-25 07:05:14 +00:00
|
|
|
app.add_handler(start_handler)
|
2024-05-25 07:10:59 +00:00
|
|
|
app.add_handler(message_handler)
|
2024-05-25 07:05:14 +00:00
|
|
|
|
|
|
|
app.run_polling()
|