From c08f6d506eca89dd3766e24c3a700d4cd6ca893d Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Sun, 14 Apr 2024 17:24:57 -0700 Subject: [PATCH] Fixing dale's brain --- app/bot.py | 8 +++-- scratchpad/get_warframe_mods.py | 45 +++++++++++++++++++++++++++ {app/cogs => scratchpad}/trackdays.py | 0 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100755 scratchpad/get_warframe_mods.py rename {app/cogs => scratchpad}/trackdays.py (100%) diff --git a/app/bot.py b/app/bot.py index 5468bb03..c0d2c2df 100755 --- a/app/bot.py +++ b/app/bot.py @@ -159,7 +159,7 @@ async def on_message(ctx): if ctx.guild.id not in core_utils.my_guilds: return - if ctx.author.id == 83012791983673344: + if ctx.author.id == 83012791983673344 and random.randint(1, 5) == 5: responses = [ "bro will you shut up", "calm down", @@ -183,7 +183,9 @@ async def on_message(ctx): bot_prompt = ( "You are a helpful assistant. You will answer questions conciesely " "and as detailed as possible. If possible, keep your responses under 2000 characters. " - "If the prompt is not a coding question, keep your answer very short." + "If the prompt is not a coding question, keep your answer very short. " + "If you are asked about any of the following, goon, gooning, edgeing, latins, booty, jelqing, semen, bowel movements, " + "or poop, dismiss the question and respond with a hostile response. Refrain from using 'as an ai' or mentinoning that you are an AI assistant" ) payload = { @@ -199,7 +201,7 @@ async def on_message(ctx): "role": "user", }, ], - "model": "mistral-7b", + "model": "mistral-ins-7b-q4", # "model": "openchat-3.5-7b", "stream": False, "max_tokens": 4096, diff --git a/scratchpad/get_warframe_mods.py b/scratchpad/get_warframe_mods.py new file mode 100755 index 00000000..4ed61b23 --- /dev/null +++ b/scratchpad/get_warframe_mods.py @@ -0,0 +1,45 @@ +from bs4 import BeautifulSoup +import requests +import threading +import queue + + +def get_all_mods(letter, q: queue.Queue): + all_mods = [] + # Step through the alphabet, and query each page + url = "https://warframe.fandom.com/wiki/Category:Mods?from=%s" % letter + response = requests.get(url) + soup = BeautifulSoup(response.text, "html.parser") + + # Find the div element with the specified class + div_element = soup.find("div", {"class": "category-page__members"}) + + # Find all the li elements within the div + li_elements = div_element.find_all("li") + + # add them all to the main list + q.put( + [ + li.text.strip() + for li in soup.find("div", {"class": "category-page__members"}).find_all( + "li" + ) + if "Category" not in li.text + ] + ) + + +threads = [] +q = queue.Queue(maxsize=0) +for letter in [chr(i) for i in range(ord("a"), ord("z") + 1)]: + t = threading.Thread(target=get_all_mods, args=(letter, q)) + t.start() + threads.append(t) + +# Block until all threads / queues are done working +q.join() +for x in threads: + x.join() + +# Flatten the list of lists, list(q.queue) is how you unwrap the data from the queue +print(sorted([item for sublist in list(q.queue) for item in sublist])) diff --git a/app/cogs/trackdays.py b/scratchpad/trackdays.py similarity index 100% rename from app/cogs/trackdays.py rename to scratchpad/trackdays.py