def coupon(self, ctx):
"""Coupon commands"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
python类send_cmd_help()的实例源码
def mal(self, ctx):
"""MAL Search Commands"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def pokemon(self, ctx):
"""This is the list of Pokémon queries you can perform."""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def _raffle(self, ctx):
"""Raffle Commands"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def heist(self, ctx):
"""General heist related commands"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def setheist(self, ctx):
"""Set different options in the heist config"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def dtable(self, ctx):
"""Shows a list under this group commands."""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def race(self, ctx):
"""Race cog's group command"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def setrace(self, ctx):
"""Race cog's settings group command"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def setcasino(self, ctx):
"""Configures Casino Options"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def announce(self, ctx):
"""Manages video announcing"""
if ctx.invoked_subcommand is None:
await send_cmd_help()
def settings(self, ctx):
"""Manages settings for video announcing"""
guild = ctx.message.guild
channel = ctx.message.channel
settings = self.ids[guild.id]
if ctx.invoked_subcommand is None:
msg = "```"
for k, v in settings.items():
msg += "{}: {}\n".format(k, v)
msg += "```"
await send_cmd_help(ctx)
await ctx.send(msg)
def _qeset(self, ctx):
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
await self.bot.say("```\nDEFAULT COLOUR: {}\n```".format(self.data["default_colour"]))
def qembed(self, ctx, text, color=None):
"""Used to make a quick embed
{server} is ctx.message.server
{author} is ctx.message.author
{channel} is ctx.message.channel
{message} is ctx.message
{ctx} is ctx
"""
if color is None:
embed_color = self.colours[self.data["default_colour"]]()
elif color.lower() not in self.colours:
if color.startswith('#'):
color = color[1:]
try:
if validhex(int(color, 16)):
embed_color = discord.Color(int(color, 16))
except ValueError:
await send_cmd_help(ctx)
return
if not validhex(int(color, 16)):
await send_cmd_help(ctx)
return
else:
embed_color = self.colours[color]()
embed = discord.Embed(description=text.format(server=ctx.message.server, author=ctx.message.author, channel=ctx.message.channel, message=ctx.message, ctx=ctx), color=embed_color)
await self.bot.say(embed=embed)
def colorrole(self, ctx, color):
"""Creates a colored role for you!
Example
[p]colorrole #8C5200
Hex pls."""
if not color.startswith("#"):
await send_cmd_help(ctx)
return
colorhex = color[1:]
color_role = await self.bot.create_role(server=ctx.message.server, name=color, colour=discord.Colour(value=int(colorhex, 16)))
await self.bot.add_roles(ctx.message.author, color_role)
await self.bot.say("Done!")
def _adkillr(self, ctx):
"""Manages the settings for Adkillr."""
serverid = ctx.message.server.id
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
if serverid not in self.adkillr:
self.adkillr[serverid] = {'toggle': True, 'message': '{0.mention} don\'t send links!', 'filters': []}
dataIO.save_json("data/adkillr/adkillr.json", self.adkillr)
def _server(self, ctx):
"""Server info commands."""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
def ftpset(self, ctx):
"""Manage all ftpstats settings"""
if not ctx.invoked_subcommand:
await send_cmd_help(ctx)
def _airhornsong(self, ctx):
"""Some air horn songs."""
if not ctx.invoked_subcommand:
await send_cmd_help(ctx)
def _from(self, ctx):
"""Convert a coded something to text."""
if not ctx.invoked_subcommand:
await send_cmd_help(ctx)