From 30e5c797a9864038fa20a2c78331208e0e0b74c2 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sun, 22 Oct 2023 04:22:46 +0200 Subject: [PATCH] Added discord server --- lollms/apps/discord_server/__init__.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lollms/apps/discord_server/__init__.py diff --git a/lollms/apps/discord_server/__init__.py b/lollms/apps/discord_server/__init__.py new file mode 100644 index 00000000..d702adf8 --- /dev/null +++ b/lollms/apps/discord_server/__init__.py @@ -0,0 +1,27 @@ +import discord +from discord.ext import commands +from lollms.apps.console import Conversation + +bot = commands.Bot(command_prefix='!') + +class ChatBot(commands.Cog): + def __init__(self, bot): + self.bot = bot + self.cv = Conversation() + + @commands.command() + async def chat(self, ctx, *, prompt): + full_discussion = "" + def callback(text, type=None): + full_discussion += text + return True + self.cv.safe_generate(full_discussion, callback=callback) + await ctx.send(full_discussion) + +@bot.event +async def on_ready(): + print(f'Logged in as {bot.user}') + print('------') + +bot.add_cog(ChatBot(bot)) +bot.run('YOUR_BOT_TOKEN')