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:
|
class Administration:
|
||||||
|
"""Handles the administration of the bot for a server; this is mainly different settings for the bot"""
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = 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.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@utils.can_run(manage_guild=True)
|
@utils.can_run(manage_guild=True)
|
||||||
|
|
|
@ -79,6 +79,8 @@ def parse_string(date):
|
||||||
|
|
||||||
|
|
||||||
class Birthday:
|
class Birthday:
|
||||||
|
"""Track and announcebirthdays"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.task = self.bot.loop.create_task(self.birthday_task())
|
self.task = self.bot.loop.create_task(self.birthday_task())
|
||||||
|
|
|
@ -21,6 +21,8 @@ card_map = {
|
||||||
|
|
||||||
|
|
||||||
class Blackjack:
|
class Blackjack:
|
||||||
|
"""Pretty self-explanatory"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.games = {}
|
self.games = {}
|
||||||
|
|
|
@ -8,6 +8,8 @@ from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
class Chess:
|
class Chess:
|
||||||
|
"""Pretty self-explanatory"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = 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
|
# 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:
|
class Hangman:
|
||||||
|
"""Pretty self-explanatory"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.games = {}
|
self.games = {}
|
||||||
|
|
|
@ -9,6 +9,8 @@ from . import utils
|
||||||
|
|
||||||
|
|
||||||
class Images:
|
class Images:
|
||||||
|
"""Commands that post images, or look up images"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import asyncio
|
||||||
|
|
||||||
|
|
||||||
class Moderation:
|
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):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
|
@ -11,6 +11,8 @@ MAX_RETRIES = 5
|
||||||
|
|
||||||
|
|
||||||
class Osu:
|
class Osu:
|
||||||
|
"""View OSU stats"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.api = OsuApi(utils.osu_key, connector=AHConnector())
|
self.api = OsuApi(utils.osu_key, connector=AHConnector())
|
||||||
|
|
|
@ -11,6 +11,8 @@ BASE_URL = 'https://api.picarto.tv/v1'
|
||||||
|
|
||||||
|
|
||||||
class Picarto:
|
class Picarto:
|
||||||
|
"""Pretty self-explanatory"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.task = self.bot.loop.create_task(self.picarto_task())
|
self.task = self.bot.loop.create_task(self.picarto_task())
|
||||||
|
|
|
@ -36,6 +36,8 @@ class Poll:
|
||||||
|
|
||||||
|
|
||||||
class Polls:
|
class Polls:
|
||||||
|
"""Create custom polls that can be tracked through reactions"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.polls = []
|
self.polls = []
|
||||||
|
|
|
@ -11,6 +11,8 @@ import traceback
|
||||||
|
|
||||||
|
|
||||||
class Raffle:
|
class Raffle:
|
||||||
|
"""Used to hold custom raffles"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.bot.loop.create_task(self.raffle_task())
|
self.bot.loop.create_task(self.raffle_task())
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Roles:
|
||||||
total_members = len(role.members)
|
total_members = len(role.members)
|
||||||
embed.add_field(name="Total members", value=str(total_members))
|
embed.add_field(name="Total members", value=str(total_members))
|
||||||
# If there are only a few members in this role, display them
|
# 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))
|
embed.add_field(name="Members", value="\n".join(m.display_name for m in role.members))
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -9,6 +9,7 @@ from . import utils
|
||||||
|
|
||||||
|
|
||||||
class Roulette:
|
class Roulette:
|
||||||
|
"""A fun game that ends in someone getting kicked!"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
|
@ -9,6 +9,8 @@ from . import utils
|
||||||
|
|
||||||
|
|
||||||
class Spotify:
|
class Spotify:
|
||||||
|
"""Pretty self-explanatory"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self._token = None
|
self._token = None
|
||||||
|
|
|
@ -98,6 +98,8 @@ class Board:
|
||||||
|
|
||||||
|
|
||||||
class TicTacToe:
|
class TicTacToe:
|
||||||
|
"""Pretty self-explanatory"""
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.boards = {}
|
self.boards = {}
|
||||||
|
|
|
@ -92,6 +92,9 @@ async def check_not_restricted(ctx):
|
||||||
# Source should ALWAYS be a command in this case
|
# Source should ALWAYS be a command in this case
|
||||||
source = from_restriction.get('source')
|
source = from_restriction.get('source')
|
||||||
destination = from_restriction.get('destination')
|
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
|
# Convert destination to the object we want
|
||||||
destination = await utilities.convert(ctx, destination)
|
destination = await utilities.convert(ctx, destination)
|
||||||
# If we couldn't find the destination, just continue with other restrictions
|
# If we couldn't find the destination, just continue with other restrictions
|
||||||
|
|
Loading…
Reference in a new issue