Add descriptions to classes for help command
This commit is contained in:
parent
c63b7a176f
commit
087114033c
|
@ -10,9 +10,75 @@ valid_perms = [p for p in dir(discord.Permissions) if isinstance(getattr(discord
|
|||
|
||||
|
||||
class Administration:
|
||||
"""Handles the administration of the bot for a server; this is mainly different settings for the bot"""
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@utils.can_run(manage_guild=True)
|
||||
async def disable(self, ctx, *, command):
|
||||
"""Disables the use of a command on this server"""
|
||||
if command == "disable" or command == "enable":
|
||||
await ctx.send("You cannot disable `{}`".format(command))
|
||||
return
|
||||
|
||||
cmd = self.bot.get_command(command)
|
||||
if cmd is None:
|
||||
await ctx.send("No command called `{}`".format(command))
|
||||
return
|
||||
|
||||
from_entry = {
|
||||
'source': cmd.qualified_name,
|
||||
'destination': "everyone",
|
||||
}
|
||||
|
||||
restrictions = self.bot.db.load('server_settings', key=ctx.message.guild.id, pluck='restrictions') or {}
|
||||
_from = restrictions.get('from', [])
|
||||
if from_entry not in _from:
|
||||
_from.append(from_entry)
|
||||
update = {
|
||||
'server_id': str(ctx.message.guild.id),
|
||||
'restrictions': {
|
||||
'from': _from
|
||||
}
|
||||
}
|
||||
await self.bot.db.save('server_settings', update)
|
||||
await ctx.send("I have disabled `{}`".format(cmd.qualified_name))
|
||||
else:
|
||||
await ctx.send("That command is already disabled")
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@utils.can_run(manage_guild=True)
|
||||
async def enable(self, ctx, *, command):
|
||||
"""Enables the use of a command on this server"""
|
||||
cmd = self.bot.get_command(command)
|
||||
if cmd is None:
|
||||
await ctx.send("No command called `{}`".format(command))
|
||||
return
|
||||
|
||||
from_entry = {
|
||||
'source': cmd.qualified_name,
|
||||
'destination': "everyone",
|
||||
}
|
||||
|
||||
restrictions = self.bot.db.load('server_settings', key=ctx.message.guild.id, pluck='restrictions') or {}
|
||||
_from = restrictions.get('from', [])
|
||||
try:
|
||||
_from.remove(from_entry)
|
||||
except ValueError:
|
||||
await ctx.send("That command is not disabled")
|
||||
else:
|
||||
update = {
|
||||
'server_id': str(ctx.message.guild.id),
|
||||
'restrictions': {
|
||||
'from': _from
|
||||
}
|
||||
}
|
||||
await self.bot.db.save('server_settings', update)
|
||||
await ctx.send("I have enabled `{}`".format(cmd.qualified_name))
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@utils.can_run(manage_guild=True)
|
||||
|
|
|
@ -79,6 +79,8 @@ def parse_string(date):
|
|||
|
||||
|
||||
class Birthday:
|
||||
"""Track and announcebirthdays"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.task = self.bot.loop.create_task(self.birthday_task())
|
||||
|
|
|
@ -21,6 +21,8 @@ card_map = {
|
|||
|
||||
|
||||
class Blackjack:
|
||||
"""Pretty self-explanatory"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.games = {}
|
||||
|
|
|
@ -8,6 +8,8 @@ from enum import Enum
|
|||
|
||||
|
||||
class Chess:
|
||||
"""Pretty self-explanatory"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
# Our format for games is going to be a little different, because we do want to allow multiple games per guild
|
||||
|
|
|
@ -65,6 +65,8 @@ class Game:
|
|||
|
||||
|
||||
class Hangman:
|
||||
"""Pretty self-explanatory"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.games = {}
|
||||
|
|
|
@ -9,6 +9,8 @@ from . import utils
|
|||
|
||||
|
||||
class Images:
|
||||
"""Commands that post images, or look up images"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import asyncio
|
|||
|
||||
|
||||
class Moderation:
|
||||
"""Commands that can be used by a or an admin, depending on the command"""
|
||||
"""Moderation commands, things that help control a server...but not the settings of the server"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
|
|
@ -11,6 +11,8 @@ MAX_RETRIES = 5
|
|||
|
||||
|
||||
class Osu:
|
||||
"""View OSU stats"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.api = OsuApi(utils.osu_key, connector=AHConnector())
|
||||
|
|
|
@ -11,6 +11,8 @@ BASE_URL = 'https://api.picarto.tv/v1'
|
|||
|
||||
|
||||
class Picarto:
|
||||
"""Pretty self-explanatory"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.task = self.bot.loop.create_task(self.picarto_task())
|
||||
|
|
|
@ -36,6 +36,8 @@ class Poll:
|
|||
|
||||
|
||||
class Polls:
|
||||
"""Create custom polls that can be tracked through reactions"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.polls = []
|
||||
|
|
|
@ -11,6 +11,8 @@ import traceback
|
|||
|
||||
|
||||
class Raffle:
|
||||
"""Used to hold custom raffles"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.bot.loop.create_task(self.raffle_task())
|
||||
|
|
|
@ -85,7 +85,7 @@ class Roles:
|
|||
total_members = len(role.members)
|
||||
embed.add_field(name="Total members", value=str(total_members))
|
||||
# If there are only a few members in this role, display them
|
||||
if total_members <= 5:
|
||||
if total_members <= 5 and total_members > 0:
|
||||
embed.add_field(name="Members", value="\n".join(m.display_name for m in role.members))
|
||||
await ctx.send(embed=embed)
|
||||
else:
|
||||
|
|
|
@ -9,6 +9,7 @@ from . import utils
|
|||
|
||||
|
||||
class Roulette:
|
||||
"""A fun game that ends in someone getting kicked!"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
|
|
@ -9,6 +9,8 @@ from . import utils
|
|||
|
||||
|
||||
class Spotify:
|
||||
"""Pretty self-explanatory"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self._token = None
|
||||
|
|
|
@ -98,6 +98,8 @@ class Board:
|
|||
|
||||
|
||||
class TicTacToe:
|
||||
"""Pretty self-explanatory"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.boards = {}
|
||||
|
|
|
@ -92,6 +92,9 @@ async def check_not_restricted(ctx):
|
|||
# Source should ALWAYS be a command in this case
|
||||
source = from_restriction.get('source')
|
||||
destination = from_restriction.get('destination')
|
||||
# Special check for what the "disable" command produces
|
||||
if destination == "everyone":
|
||||
return False
|
||||
# Convert destination to the object we want
|
||||
destination = await utilities.convert(ctx, destination)
|
||||
# If we couldn't find the destination, just continue with other restrictions
|
||||
|
|
Loading…
Reference in a new issue