-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (25 loc) · 904 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import discord
import os
from openai_response import response
user_response = ""
#CONFIG'
TOKEN = '' ####TYPE YOUR DISCORD TOKEN HERE####
intents = discord.Intents.all()
CHANNEL=[] #The channels that bot can talk
#CONFIG
client = discord.Client(intents=discord.Intents.all())
@client.event
async def on_ready():
print("You're now logged in as {0.user}".format(client))
os.environ["STARTUP"] = "0"
@client.event
async def on_message(message):
if message.channel.id not in CHANNEL: #Add change "in" to "not in" if you want let AI only not talk at the channels you set
if message.author == client.user:
return
else:
if message.content.startswith("!"):
async with message.channel.typing():
user_response = message.content
await message.channel.send(response(user_response))
client.run(TOKEN)