whatever this is

This commit is contained in:
WhatDidYouExpect 2025-02-26 20:28:50 +01:00 committed by GitHub
parent 713e21abf4
commit 64e3189ea8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

20
bot.py
View file

@ -6,6 +6,7 @@ import markovify
import nltk import nltk
from nltk.tokenize import word_tokenize from nltk.tokenize import word_tokenize
import random import random
from textblob import TextBlob
import os import os
import time import time
import re import re
@ -111,8 +112,8 @@ def check_for_update():
gooberhash = latest_version_info.get("hash") gooberhash = latest_version_info.get("hash")
if gooberhash == currenthash: if gooberhash == currenthash:
if local_version < latest_version: if local_version < latest_version:
print(f"New version available: {latest_version} (Current: {local_version})") print(f"{YELLOW}New version available: {latest_version} (Current: {local_version}){RESET}")
print(f"Check {VERSION_URL}/goob/changes.txt to check out the changelog for version {latest_version}\n\n") print(f"Check {VERSION_URL}/goob/changes.txt to check out the changelog\n\n")
elif local_version > latest_version: elif local_version > latest_version:
if IGNOREWARNING == False: if IGNOREWARNING == False:
print(f"\n{RED}The version: {local_version} isnt valid!") print(f"\n{RED}The version: {local_version} isnt valid!")
@ -130,8 +131,9 @@ def check_for_update():
print(f"{GREEN}You're using the latest version: {local_version}{RESET}") print(f"{GREEN}You're using the latest version: {local_version}{RESET}")
print(f"Check {VERSION_URL}/goob/changes.txt to check out the changelog\n\n") print(f"Check {VERSION_URL}/goob/changes.txt to check out the changelog\n\n")
else: else:
print(f"{YELLOW}Goober has been modified! Skipping checks entirely...{RESET}") print(f"{YELLOW}Goober has been modified! Skipping server checks entirely...")
print("Current Hash:", currenthash) print(f"Reported Version: {local_version}{RESET}")
print(f"Current Hash: {currenthash}")
check_for_update() check_for_update()
@ -257,13 +259,15 @@ def ping_server():
except Exception as e: except Exception as e:
print(f"An error occurred while sending data: {str(e)}") print(f"An error occurred while sending data: {str(e)}")
positive_keywords = ["happy", "good", "great", "amazing", "awesome", "joy", "love", "fantastic", "positive", "cheerful", "victory", "favorite", "lmao", "lol", "xd", "XD", "xD", "Xd"]
positive_gifs = os.getenv("POSITIVE_GIFS").split(',') positive_gifs = os.getenv("POSITIVE_GIFS").split(',')
def is_positive(sentence): def is_positive(sentence):
sentence_lower = sentence.lower() blob = TextBlob(sentence)
return any(keyword in sentence_lower for keyword in positive_keywords) sentiment_score = blob.sentiment.polarity
print(sentiment_score)
return sentiment_score > 0.1
async def send_message(ctx, message=None, embed=None, file=None, edit=False, message_reference=None): async def send_message(ctx, message=None, embed=None, file=None, edit=False, message_reference=None):
if edit and message_reference: if edit and message_reference:
@ -378,7 +382,7 @@ async def help(ctx):
) )
command_categories = { command_categories = {
"General": ["mem", "talk", "ask", "about", "ping"], "General": ["mem", "talk", "about", "ping"],
"Administration": ["stats", "retrain"] "Administration": ["stats", "retrain"]
} }