Added demo bot for testing. Supports image input, but does not have dialog memory or tools usage yet.
This commit is contained in:
parent
f195d77e67
commit
90d5dd973c
38
reginaldCog/demo_bot.py
Normal file
38
reginaldCog/demo_bot.py
Normal file
@ -0,0 +1,38 @@
|
||||
import os
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from reginaldCog.messenger_clients.services import MessageService
|
||||
|
||||
TOKEN = os.getenv('SCREAMING_OPOSSUM') # Your Discord bot token goes here
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
bot = commands.Bot(command_prefix='!', intents=intents)
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
|
||||
print('------')
|
||||
try:
|
||||
synced = await bot.tree.sync()
|
||||
print(f'Synced {len(synced)} command(s).')
|
||||
except Exception as e:
|
||||
print(f'Failed to sync commands: {e}')
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_message(message: discord.Message):
|
||||
|
||||
if message.author == bot.user:
|
||||
return
|
||||
|
||||
async with message.channel.typing():
|
||||
message_service = MessageService(message)
|
||||
response = await message_service.get_llm_response()
|
||||
await message.channel.send(response)
|
||||
print(response)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if TOKEN is None:
|
||||
raise RuntimeError('Discord token is not set')
|
||||
bot.run(TOKEN)
|
||||
Loading…
x
Reference in New Issue
Block a user