adding more methods to the new bot. fixes #4 #10 #20 #21 #22 #23 #29

This commit is contained in:
Luke Robles 2020-09-01 17:51:50 -07:00
parent a5d8988201
commit 858ccb6b2a
3 changed files with 59 additions and 8 deletions

View File

@ -3,12 +3,11 @@ RUN apt-get update && apt-get install -y gcc make automake
# RUN apk update && apk add --no-cache make python3-dev automake gcc libxml2-dev libxslt-dev g++
ADD app/requirements.txt /requirements.txt
RUN pip install -r requirements.txt
RUN pip install pylint
ADD app /app
RUN printf "\n\nTesting your python code for errors\n\n" && \
pylint -E /app/*.py
# RUN pip install pylint
# ADD app /app
# RUN printf "\n\nTesting your python code for errors\n\n" && \
# pylint -E /app/*.py
WORKDIR /app
RUN printf "\n#########################\n Run dragon bot by typing \n python bot.py\n#########################\n\n"
RUN chmod +x /app/bot.py
CMD python /app/bot.py
# RUN printf "\n#########################\n Run dragon bot by typing \n python bot.py\n#########################\n\n"
# CMD python /app/bot.py

52
app/bot.py Normal file → Executable file
View File

@ -1,6 +1,7 @@
#!/usr/local/bin/python
import os
import random
import requests
import discord
from discord.ext import commands
@ -85,6 +86,57 @@ async def help(ctx):
embed=help_methods.get_help_embed(bot)
)
@bot.command(name='wink')
async def wink(ctx):
await ctx.send(
embed=generate_embed(
embed_url=requests.get('https://some-random-api.ml/animu/wink').json()['link']
)
)
@bot.command(name='smug')
async def smug(ctx):
import get_from_reddit
await ctx.send(embed=generate_embed(embed_url=get_from_reddit.get_image('smuganimegirls')))
@bot.command(name='pout')
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):
import dice
await ctx.send(embed=dice.parse_message(ctx.message.content))
@bot.command(name='quake')
async def quake(ctx):
import quake
await ctx.send(embed=quake.parse_message(ctx.message))
@bot.command(name='excuse')
async def excuse(ctx):
import excuse
await ctx.send(excuse.get_excuse())
@bot.command(name='avatar')
async def avatar(ctx):
profile = [ctx.message.author]
if len(ctx.message.mentions):
profile = ctx.message.mentions
# Code stolen from this reddit post
# https://www.reddit.com/r/discordapp/comments/74bb4z/retrieve_a_mentioned_users_avatar_using_discordpy
for user in profile:
await ctx.send(
embed=generate_embed(
embed_title="{}#{}".format(user.name, user.discriminator),
embed_url=str(user.avatar_url).replace('.webp', '.png'),
embed_description="[Direct Link]({})".format(str(user.avatar_url).replace('.webp', '.png'))
)
)
@bot.command(name='redpanda')
async def redpanda(ctx):

View File

@ -6,4 +6,4 @@ printf "[+] Done\n"
printf "\n[-] Running dragon bot in test mode\n"
docker build -f ./Dockerfile-test-env -t dragon-bot-test . || exit
docker run -ti --rm --name dragon-bot-test -e DRAGON_ENV=test -e token="MzQ1MjkwMTI5OTQ4Mjc4Nzg0.DG5IBw._9umb82PrL22bPe7GjmHClU-NtU" dragon-bot-test sh
docker run -ti -v $(pwd)/app:/app --rm --name dragon-bot-test -e DRAGON_ENV=test -e token="MzQ1MjkwMTI5OTQ4Mjc4Nzg0.DG5IBw._9umb82PrL22bPe7GjmHClU-NtU" dragon-bot-test sh