Removed personal settings from help module

master
Jef Roosens 2020-08-26 13:48:41 +02:00
parent 491bb74768
commit 0afb14203e
2 changed files with 14 additions and 21 deletions

View File

@ -52,7 +52,7 @@ Frank.
pass
@frank.default()
async def default_cmd(prefix, author, channel, mid):
async def default_cmd(self):
# do some default action
pass
```

View File

@ -3,10 +3,10 @@
from __future__ import annotations
# Third-party imports
import discord
from discord import Embed
# Own imports
from suzybot.frank import Module, default, command
from .. import Module, default, regex_command
# Typing imports
from typing import TYPE_CHECKING
@ -28,38 +28,31 @@ class HelpMod(Module):
NAME = 'help'
HELP = 'Shows help info about all modules'
def pre_start(self):
self.theme = discord.Color.dark_green()
@default(help_str='Show help about all modules.')
async def send_all(self, author: User, channel: Messageable, mid: int):
embed = discord.Embed(colour=self.theme)
embed.set_author(name='Suzy')
embed = Embed()
for mod in self._client._modules:
embed.add_field(name=mod.NAME, value=mod.HELP, inline=False)
await channel.send(embed=embed)
@command(cmd='.+', help_str='Show help about a certain module.')
async def show_module_help(self, cmd: List[str], author: User,
@regex_command(cmd='.+', help_str='Show help about a certain module.')
async def show_module_help(self, prefix: str, cmd: List[str], author: User,
channel: Messageable, mid: int):
# Exit if no arguments are given
if not cmd:
return
mod_name = cmd[0].lower()
# Yes, this command just ignores cmd at the moment
mod_name = prefix.lower()
mod = next((mod for mod in self._client._modules
if mod.NAME.lower() == mod_name), None)
if mod:
embed = discord.Embed(colour=self.theme)
embed = Embed()
if mod._DEFAULT:
embed.add_field(name='default', value=mod._help, inline=False)
for cmd in mod._COMMANDS:
embed.add_field(name=cmd._command, value=mod._help,
if mod.default:
embed.add_field(name='default', value=mod.default.help_str,
inline=False)
for cmd in mod._COMMANDS:
embed.add_field(name=cmd.cmd, value=mod.help_str, inline=False)
await channel.send(embed=embed)