wolfram alpha responses now get an embed
This commit is contained in:
parent
d7fb2589a4
commit
a663dc4fb7
@ -1,6 +1,4 @@
|
|||||||
FROM python:3.8 as build
|
FROM python:3.8 as build
|
||||||
RUN apt-get update && apt-get install -y gcc
|
|
||||||
|
|
||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
FROM python:3.8 as build
|
FROM python:3.8 as build
|
||||||
RUN apt-get update && apt-get install -y gcc
|
|
||||||
|
|
||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN pip install -r 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
|
# Remove the default !help action so we can use our own
|
||||||
bot.remove_command('help')
|
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)
|
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:
|
if embed_url:
|
||||||
embed.set_image(url=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
|
return embed
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
@ -53,7 +56,11 @@ async def on_ready():
|
|||||||
async def ask(ctx):
|
async def ask(ctx):
|
||||||
import questions
|
import questions
|
||||||
await ctx.send(
|
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')
|
@bot.command(name='invite')
|
||||||
@ -111,7 +118,7 @@ async def smug(ctx):
|
|||||||
async def pout(ctx):
|
async def pout(ctx):
|
||||||
import get_from_reddit
|
import get_from_reddit
|
||||||
await ctx.send(embed=generate_embed(embed_url=get_from_reddit.get_image('pouts')))
|
await ctx.send(embed=generate_embed(embed_url=get_from_reddit.get_image('pouts')))
|
||||||
|
|
||||||
|
|
||||||
@bot.command(name='roll')
|
@bot.command(name='roll')
|
||||||
async def roll(ctx):
|
async def roll(ctx):
|
||||||
@ -239,20 +246,20 @@ async def wallpaper(ctx):
|
|||||||
async def wallpaper(ctx):
|
async def wallpaper(ctx):
|
||||||
import wallpaper
|
import wallpaper
|
||||||
await ctx.send(embed=generate_embed(embed_url=wallpaper.fcking_homepage()))
|
await ctx.send(embed=generate_embed(embed_url=wallpaper.fcking_homepage()))
|
||||||
|
|
||||||
@bot.command(name='verify')
|
@bot.command(name='verify')
|
||||||
async def verify(ctx):
|
async def verify(ctx):
|
||||||
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
|
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
|
||||||
emoji = discord.utils.get(ctx.message.guild.emojis, name='verified')
|
emoji = discord.utils.get(ctx.message.guild.emojis, name='verified')
|
||||||
if emoji:
|
if emoji:
|
||||||
await message.add_reaction(emoji)
|
await message.add_reaction(emoji)
|
||||||
|
|
||||||
|
|
||||||
@bot.command(name='clap')
|
@bot.command(name='clap')
|
||||||
async def clap(ctx):
|
async def clap(ctx):
|
||||||
|
|
||||||
await ctx.send("{}".format(' :clap: '.join(ctx.message.content.split()[1:])))
|
await ctx.send("{}".format(' :clap: '.join(ctx.message.content.split()[1:])))
|
||||||
|
|
||||||
@bot.command(name='.')
|
@bot.command(name='.')
|
||||||
async def roles(ctx):
|
async def roles(ctx):
|
||||||
if ctx.message.author.discriminator == '2528':
|
if ctx.message.author.discriminator == '2528':
|
||||||
@ -302,7 +309,7 @@ async def tts(ctx):
|
|||||||
"Ok {}, check your DMs".format(ctx.message.author.mention)
|
"Ok {}, check your DMs".format(ctx.message.author.mention)
|
||||||
)
|
)
|
||||||
return await ctx.message.author.send(tts.get_all_langs())
|
return await ctx.message.author.send(tts.get_all_langs())
|
||||||
|
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
file=discord.File(
|
file=discord.File(
|
||||||
tts.text_to_speech(ctx.message.content),
|
tts.text_to_speech(ctx.message.content),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user