wolfram alpha responses now get an embed

This commit is contained in:
Luke Robles 2021-01-13 14:27:47 -08:00
parent f2f4552caf
commit 09b7d078ff
3 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,4 @@
FROM python:3.8 as build
RUN apt-get update && apt-get install -y gcc
ADD app/requirements.txt /requirements.txt
RUN pip install -r requirements.txt

View File

@ -1,6 +1,4 @@
FROM python:3.8 as build
RUN apt-get update && apt-get install -y gcc
ADD app/requirements.txt /requirements.txt
RUN pip install -r requirements.txt

View File

@ -11,7 +11,7 @@ bot = commands.Bot(command_prefix='!')
# Remove the default !help action so we can use our own
bot.remove_command('help')
def generate_embed(embed_url=None, embed_title=None, embed_description=None, embed_color=None):
def generate_embed(embed_url=None, embed_title=None, embed_description=None, embed_color=None, author_name=None, author_image=None):
"""
generate_embed(embed_url=None, embed_title=None, embed_description=None, embed_color=None)
@ -34,6 +34,9 @@ def generate_embed(embed_url=None, embed_title=None, embed_description=None, emb
if embed_url:
embed.set_image(url=embed_url)
if author_image or author_name:
embed.set_author(name=author_name, icon_url=author_image)
return embed
@bot.event
@ -53,7 +56,11 @@ async def on_ready():
async def ask(ctx):
import questions
await ctx.send(
questions.answer_question(ctx.message.content)
embed=generate_embed(
embed_title=questions.answer_question(ctx.message.content),
author_name='Wolfram Alpha says'
author_image='https://cdn.iconscout.com/icon/free/png-256/wolfram-alpha-2-569293.png',
)
)
@bot.command(name='invite')