wolfram alpha responses now get an embed
This commit is contained in:
parent
f2f4552caf
commit
09b7d078ff
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
11
app/bot.py
11
app/bot.py
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user