mirror of
https://github.com/AskDavis/nate-discord.git
synced 2026-03-01 08:47:13 -08:00
mabel chat for discord
This commit is contained in:
BIN
app/discord_bot/__pycache__/connect_discord.cpython-310.pyc
Normal file
BIN
app/discord_bot/__pycache__/connect_discord.cpython-310.pyc
Normal file
Binary file not shown.
21
app/discord_bot/connect_discord.py
Normal file
21
app/discord_bot/connect_discord.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
import discord
|
||||
from app.mabel.connect_openai import chatgpt_response
|
||||
|
||||
load_dotenv()
|
||||
discord_token=os.getenv('DISCORD_TOKEN')
|
||||
class MyClient(discord.Client):
|
||||
async def on_ready(self):
|
||||
print('Logged in as: ', self.user)
|
||||
async def on_message(self, message):
|
||||
if message.author == self.user:
|
||||
return
|
||||
chat_response=chatgpt_response(message.content)
|
||||
if "mabel" in message.content.lower() or "Mabel" in message.content.lower():
|
||||
print(message.content)
|
||||
await message.channel.send(f"{chat_response}")
|
||||
return
|
||||
intents=discord.Intents.default()
|
||||
intents.messages=True
|
||||
client=MyClient(intents=intents)
|
||||
Reference in New Issue
Block a user