small tweaks
This commit is contained in:
17
garfmain.py
17
garfmain.py
@@ -117,30 +117,30 @@ async def garfbot_qr(ctx, *, text):
|
||||
f"QR Code Request - User: {ctx.author.name}, Server: {ctx.guild.name}, Text: {text}"
|
||||
)
|
||||
if len(text) > 1000:
|
||||
await ctx.send("❌ Text too long! Maximum 1000 characters.")
|
||||
await ctx.reply("❌ Text too long! Maximum 1000 characters.")
|
||||
else:
|
||||
try:
|
||||
qr_code = await generate_qr(text)
|
||||
sendfile = discord.File(fp=qr_code, filename="qrcode.png")
|
||||
await ctx.send(file=sendfile)
|
||||
await ctx.reply(file=sendfile)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
await ctx.send(e)
|
||||
await ctx.reply(e)
|
||||
|
||||
|
||||
@garfbot.command(name="wiki")
|
||||
async def garfbot_wiki(ctx, *, query):
|
||||
summary = await garfield.wikisum(query)
|
||||
await ctx.send(summary)
|
||||
await ctx.reply(summary)
|
||||
|
||||
|
||||
@garfbot.command(name="shop")
|
||||
async def garfbot_shop(ctx, *, query):
|
||||
try:
|
||||
response = kroger.garfshop(query)
|
||||
await ctx.send(response)
|
||||
await ctx.reply(response)
|
||||
except Exception as e:
|
||||
await ctx.send(f"`GarfBot Error: {str(e)}`")
|
||||
await ctx.reply(f"`GarfBot Error: {str(e)}`")
|
||||
|
||||
|
||||
@garfbot.command(name="weather")
|
||||
@@ -153,11 +153,12 @@ async def garfchat(ctx, *, prompt):
|
||||
if "is this true" in prompt.lower():
|
||||
messages = [msg async for msg in ctx.channel.history(limit=2)]
|
||||
prompt = messages[1].content
|
||||
prompt = f"Is this true: {prompt}"
|
||||
answer = await garfield.generate_chat(prompt)
|
||||
logger.info(
|
||||
f"Chat Request - User: {ctx.author.name}, Server: {ctx.guild.name}, Prompt: {prompt}"
|
||||
)
|
||||
await ctx.send(answer)
|
||||
await ctx.reply(answer)
|
||||
|
||||
|
||||
# @garfbot.command(name="pic")
|
||||
@@ -165,7 +166,7 @@ async def garfchat(ctx, *, prompt):
|
||||
# logger.info(
|
||||
# f"Image Request - User: {ctx.author.name}, Server: {ctx.guild.name}, Prompt: {prompt}"
|
||||
# )
|
||||
# await ctx.send(f"`Please wait... image generation queued: {prompt}`")
|
||||
# await ctx.reply(f"`Please wait... image generation queued: {prompt}`")
|
||||
# await garfield.garfpic(ctx, prompt)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user