bringing help method to the new bot also added an invite link to the bottom, fixes #13

This commit is contained in:
Luke Robles 2020-09-01 12:05:12 -07:00
parent f383bab2ca
commit c45ccceaeb
3 changed files with 21 additions and 5 deletions

View File

@ -10,5 +10,5 @@ RUN printf "\n\nTesting your python code for errors\n\n" && \
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

View File

@ -1,3 +1,4 @@
#!/usr/local/bin/python
import os
import random
@ -6,6 +7,7 @@ from discord.ext import commands
TOKEN = os.getenv('token')
bot = commands.Bot(command_prefix='!')
bot.remove_command('help')
def generate_embed(embed_url=None, embed_title=None, embed_description=None, embed_color=None):
"""
@ -34,7 +36,7 @@ def generate_embed(embed_url=None, embed_title=None, embed_description=None, emb
@bot.event
async def on_ready():
print(f'{bot.user.name} has connected to Discord!')
print(f'{bot.user.name} has connected to Discord!')
# @bot.event
# async def on_member_join(member):
@ -69,6 +71,19 @@ async def invite(ctx):
)
await ctx.send(invite)
@bot.command(name='help')
async def help(ctx):
import help_methods
if len(ctx.message.content.split()) > 1:
await ctx.send(
help_methods.parse_message(ctx.message.content)
)
else:
await ctx.send(
embed=help_methods.get_help_embed(bot)
)
@bot.command(name='redpanda')
async def redpanda(ctx):

View File

@ -168,7 +168,7 @@ def get_help_message(method):
return "```css\n{}: {}\n```".format(method, ' '.join(supported_methods[method]))
def get_help_embed(client):
def get_help_embed(bot):
categories = {
'fun': ['ffxiv', 'clap', 'redanda', 'birb', 'youtube', 'dog', 'excuse', 'greentext', 'lewd', 'message', 'meme', 'homepage', 'pout', 'roll', 'smug', 'quake', 'wink',],
'util': ['corona', '8ball', 'decide', 'info', 'icon', 'wallpaper', 'stock', 'tts', 'issue'],
@ -178,7 +178,7 @@ def get_help_embed(client):
description = "\nBelow you can see all the commands I know.\n\n**Have a nice day!**"
embed = discord.Embed(description=description, color=0x428bca, type="rich")
embed.set_author(name="Hello! I'm {}".format(client.user.name), icon_url=client.user.default_avatar_url)
embed.set_author(name="Hello! I'm {}".format(bot.user.name), icon_url=bot.user.default_avatar_url)
for category in categories:
command_list = []
@ -188,7 +188,8 @@ def get_help_embed(client):
description2 = "**Use `!help <Command>` for more information about a command.** \n\n" + \
"**Examples:** \n `!help dog` for detailed help for the dog command \n\n" + \
"**Useful links:** [My source code](http://git.luker.gq/ldooks/dragon-bot), [Server status](http://luker.gq/status), [Donate](http://luker.gq/donate)"
"**Useful links:** [My source code](http://git.luker.gq/ldooks/dragon-bot), [Server status](http://luker.gq/status), [Donate](http://luker.gq/donate) \n\n" + \
"**Invite me to your server:** [Click here](https://discord.com/oauth2/authorize?client_id=391781301419638784&scope=bot)"
embed.add_field(name="\u200b", value=description2, inline=False)
return embed