mirror of
https://github.com/jarulsamy/Plex-Bot.git
synced 2024-08-19 15:01:55 +02:00
✨ Add custom help command
This commit is contained in:
parent
08a235d55e
commit
228c2b480b
@ -29,6 +29,8 @@ plex_log.setLevel(config["plex"]["log_level"])
|
||||
bot_log.setLevel(config["discord"]["log_level"])
|
||||
|
||||
bot = Bot(command_prefix=BOT_PREFIX)
|
||||
# Remove help command, we have our own custom one.
|
||||
bot.remove_command("help")
|
||||
bot.add_cog(General(bot))
|
||||
bot.add_cog(Plex(bot, BASE_URL, PLEX_TOKEN, LIBRARY_NAME, BOT_PREFIX))
|
||||
bot.run(TOKEN)
|
||||
|
@ -19,6 +19,24 @@ root_log = logging.getLogger()
|
||||
plex_log = logging.getLogger("Plex")
|
||||
bot_log = logging.getLogger("Bot")
|
||||
|
||||
help_text = """
|
||||
General:
|
||||
kill [silent] - Halt the bot [silently].
|
||||
help - Print this help message.
|
||||
cleanup - Delete old messages from the bot.
|
||||
|
||||
Plex:
|
||||
play <SONG_NAME> - Play a song from the plex server.
|
||||
album <ALBUM_NAME> - Queue an entire album to play.
|
||||
np - Print the current playing song.
|
||||
stop - Halt playback and leave vc.
|
||||
pause - Pause playback.
|
||||
resume - Resume playback.
|
||||
clear - Clear play queue.
|
||||
|
||||
[] - Optional args.
|
||||
"""
|
||||
|
||||
|
||||
class General(commands.Cog):
|
||||
"""General commands
|
||||
@ -60,6 +78,22 @@ class General(commands.Cog):
|
||||
await self.bot.close()
|
||||
bot_log.info("Stopping upon the request of %s", ctx.author.mention)
|
||||
|
||||
@command(name="help")
|
||||
async def help(self, ctx):
|
||||
"""Prints command help
|
||||
|
||||
Args:
|
||||
ctx: discord.ext.commands.Context message context from command
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Raise:
|
||||
None
|
||||
"""
|
||||
|
||||
await ctx.send(f"```{help_text}```")
|
||||
|
||||
@command()
|
||||
async def cleanup(self, ctx, limit=250):
|
||||
"""Delete old messages from bot
|
||||
@ -91,11 +125,11 @@ class General(commands.Cog):
|
||||
|
||||
|
||||
class Plex(commands.Cog):
|
||||
"""Discord commands pertinent to interacting with Plex
|
||||
|
||||
Contains user commands such as play, pause, resume, stop, etc.
|
||||
Grabs, and parses all data from plex database.
|
||||
"""
|
||||
Discord commands pertinent to interacting with Plex
|
||||
|
||||
Contains user commands such as play, pause, resume, stop, etc.
|
||||
Grabs, and parses all data from plex database.
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
|
Loading…
Reference in New Issue
Block a user