diff --git a/code/code.py b/code/code.py index 61ab1af..5597522 100644 --- a/code/code.py +++ b/code/code.py @@ -5,7 +5,7 @@ from discord import Intents import asyncio # pip install asyncio import cogs # import the cogs import datetime # pip install datetime -from config import debug, conn, c # import the debug function and the database connectionimport apsw # pip install apsw. ApSW is a Python interface to SQLite 3 +from config import debug, conn, c, discord_token #add the message content intent to the bot, aka discord.Intents.default() and discord.Intents.message_content intents = discord.Intents.default() intents.message_content = True @@ -22,12 +22,9 @@ async def on_ready(): await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="your messages to answer you")) debug("Bot is ready") -#run the bot -# Replace the following with your bot's token -with open("./key.txt") as f: - key = f.read() + -bot.run(key) +bot.run(discord_token) # run the bot #set the bot's watching status to watcing your messages to answer you @bot.event async def on_ready(): diff --git a/code/config.py b/code/config.py index 8227b71..f1ae9c0 100644 --- a/code/config.py +++ b/code/config.py @@ -4,6 +4,7 @@ from dotenv import load_dotenv import os load_dotenv() perspective_api_key = os.getenv("PERSPECTIVE_API_KEY") +discord_token = os.getenv("DISCORD_TOKEN") max_uses: int = 400 logging.basicConfig(level=logging.INFO) diff --git a/code/makeprompt.py b/code/makeprompt.py index 0ee569b..95b5047 100644 --- a/code/makeprompt.py +++ b/code/makeprompt.py @@ -111,7 +111,6 @@ Botator is an AI and a regular Discord user. He types casually, uses a lot of em if message.content.lower().find("carpet") != -1: prompt += "System: Carpet detected. Botator is now mad. He will start talking in capital letters and will say mad things without sense, insulting the person and talk in capital letters with exclamation points everywhere. A lot of exclamation points.\n" if message.content.lower().find("mail") != -1 and message.author.name.lower().find("latouff") != -1: prompt += "System: Mail detected. Latouff said mail, Botator will say \"Mail? why did you say mail, Liam? Mail is your name in reverse.\" because Latouff's name is Liam, and mail in reverse is Liam. Then, after saying that in the sentence, botato will continue his sentence saying something else.\n" if message.author.name.lower().find("fives3d##print") != -1: prompt += "System: Fives3d#print detected. Botator will be very nice and cute with fives3d#print.\n" - now = message.created_at prompt = prompt + f"\n{self.bot.user.name}:" openai.api_key = api_key response = ""