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
|
||||
|
||||
|
21
app/bot.py
21
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')
|
||||
@ -111,7 +118,7 @@ async def smug(ctx):
|
||||
async def pout(ctx):
|
||||
import get_from_reddit
|
||||
await ctx.send(embed=generate_embed(embed_url=get_from_reddit.get_image('pouts')))
|
||||
|
||||
|
||||
|
||||
@bot.command(name='roll')
|
||||
async def roll(ctx):
|
||||
@ -239,20 +246,20 @@ async def wallpaper(ctx):
|
||||
async def wallpaper(ctx):
|
||||
import wallpaper
|
||||
await ctx.send(embed=generate_embed(embed_url=wallpaper.fcking_homepage()))
|
||||
|
||||
|
||||
@bot.command(name='verify')
|
||||
async def verify(ctx):
|
||||
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
|
||||
emoji = discord.utils.get(ctx.message.guild.emojis, name='verified')
|
||||
if emoji:
|
||||
await message.add_reaction(emoji)
|
||||
|
||||
|
||||
|
||||
@bot.command(name='clap')
|
||||
async def clap(ctx):
|
||||
|
||||
await ctx.send("{}".format(' :clap: '.join(ctx.message.content.split()[1:])))
|
||||
|
||||
|
||||
@bot.command(name='.')
|
||||
async def roles(ctx):
|
||||
if ctx.message.author.discriminator == '2528':
|
||||
@ -302,7 +309,7 @@ async def tts(ctx):
|
||||
"Ok {}, check your DMs".format(ctx.message.author.mention)
|
||||
)
|
||||
return await ctx.message.author.send(tts.get_all_langs())
|
||||
|
||||
|
||||
await ctx.send(
|
||||
file=discord.File(
|
||||
tts.text_to_speech(ctx.message.content),
|
||||
|
Loading…
x
Reference in New Issue
Block a user