Skip to content

Commit

Permalink
Added discord server
Browse files Browse the repository at this point in the history
  • Loading branch information
ParisNeo committed Oct 22, 2023
1 parent 3884ba5 commit 30e5c79
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lollms/apps/discord_server/__init__.py
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 30e5c79

Please sign in to comment.