Spaces:
Runtime error
Runtime error
File size: 858 Bytes
c914190 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import os
import discord
from discord.ext import commands
from src.chatbot import Chatbot
from src.imagebot import Imagebot
intents = discord.Intents.default()
bot = commands.Bot(command_prefix="/", intents=intents)
chatbot = Chatbot(os.environ["poe_api_token"])
imagebot = Imagebot(os.environ["replicate_api_token"])
@bot.event
async def on_ready():
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
@bot.command(name="q")
async def q(ctx, *query):
query = " ".join(query)
await ctx.send(f"{chatbot.query_from_api(query=query)}")
@bot.command(name="gen")
async def gen(ctx, *query):
query = " ".join(query)
await ctx.send(imagebot.generate_image(query=query))
@bot.command(name="python")
async def python(ctx, *query):
query = " ".join(query)
await ctx.send(f"{exec(query)}")
bot.run(os.environ["discord_token"])
|