added discord bot
This commit is contained in:
26
discord_bot.py
Normal file
26
discord_bot.py
Normal 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)
|
||||
Reference in New Issue
Block a user