mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-21 01:42:08 +00:00
Added discord server
This commit is contained in:
parent
3884ba5881
commit
30e5c797a9
27
lollms/apps/discord_server/__init__.py
Normal file
27
lollms/apps/discord_server/__init__.py
Normal file
@ -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')
|
Loading…
x
Reference in New Issue
Block a user