added discord bot

This commit is contained in:
wea_ondara
2024-04-17 21:06:42 +02:00
parent 41d5b4f591
commit 71b25ef337
4 changed files with 47 additions and 12 deletions

26
discord_bot.py Normal file
View File

@@ -0,0 +1,26 @@
import discord
from chat import ChatClient
from discord_bot_token import discord_bot_token
intents = discord.Intents.default()
intents.message_content = True
discord_client = discord.Client(intents=intents)
chat_client = ChatClient()
@discord_client.event
async def on_ready():
print(f'We have logged in as {discord_client.user}')
@discord_client.event
async def on_message(message):
if message.author == discord_client.user:
return
response = chat_client.input(message.content)
await message.channel.send(response)
discord_client.run(discord_bot_token)