Adapted functions to new help on error

This commit is contained in:
Twentysix 2016-02-18 15:00:59 +01:00
parent 0fc8a95158
commit abaf1778c7
3 changed files with 17 additions and 13 deletions

View File

@ -2,7 +2,7 @@ import discord
from discord.ext import commands from discord.ext import commands
from .utils.dataIO import fileIO from .utils.dataIO import fileIO
from .utils import checks from .utils import checks
from __main__ import user_allowed from __main__ import user_allowed, send_cmd_help
import os import os
class CustomCommands: class CustomCommands:
@ -21,7 +21,7 @@ class CustomCommands:
!addcom yourcommand Text you want !addcom yourcommand Text you want
""" """
if text == (): if text == ():
await self.bot.say("addcom [command] [text/url]") await send_cmd_help(ctx)
return return
server = ctx.message.server server = ctx.message.server
channel = ctx.message.channel channel = ctx.message.channel
@ -46,7 +46,7 @@ class CustomCommands:
!editcom yourcommand Text you want !editcom yourcommand Text you want
""" """
if text == (): if text == ():
await self.bot.say("editcom [command] [text/url]") await send_cmd_help(ctx)
return return
server = ctx.message.server server = ctx.message.server
channel = ctx.message.channel channel = ctx.message.channel

View File

@ -3,6 +3,8 @@ from discord.ext import commands
from .utils.dataIO import fileIO from .utils.dataIO import fileIO
from .utils import checks from .utils import checks
from random import randint from random import randint
from copy import deepcopy
from __main__ import send_cmd_help
import os import os
import time import time
@ -31,7 +33,7 @@ class Economy:
async def _bank(self, ctx): async def _bank(self, ctx):
"""Bank operations""" """Bank operations"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.say("Type help bank for info.") await send_cmd_help(ctx)
@_bank.command(pass_context=True, no_pm=True) @_bank.command(pass_context=True, no_pm=True)
async def register(self, ctx): async def register(self, ctx):

View File

@ -2,6 +2,7 @@ import discord
from discord.ext import commands from discord.ext import commands
from .utils import checks from .utils import checks
from .utils.dataIO import fileIO from .utils.dataIO import fileIO
from __main__ import send_cmd_help
import os import os
class Mod: class Mod:
@ -52,7 +53,7 @@ class Mod:
cleanup user [name/mention] [number] cleanup user [name/mention] [number]
cleanup text \"Text here\" [number]""" cleanup text \"Text here\" [number]"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.say("Type help cleanup for info.") await send_cmd_help(ctx)
@cleanup.command(pass_context=True, no_pm=True) @cleanup.command(pass_context=True, no_pm=True)
async def text(self, ctx, text : str, number : int): async def text(self, ctx, text : str, number : int):
@ -121,7 +122,7 @@ class Mod:
async def blacklist(self, ctx): async def blacklist(self, ctx):
"""Bans user from using the bot""" """Bans user from using the bot"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.say("Type help blacklist for info.") await send_cmd_help(ctx)
@blacklist.command(name="add") @blacklist.command(name="add")
async def _blacklist_add(self, user : discord.Member): async def _blacklist_add(self, user : discord.Member):
@ -149,7 +150,7 @@ class Mod:
async def whitelist(self, ctx): async def whitelist(self, ctx):
"""Users who will be able to use the bot""" """Users who will be able to use the bot"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.say("Type help whitelist for info.") await send_cmd_help(ctx)
@whitelist.command(name="add") @whitelist.command(name="add")
async def _whitelist_add(self, user : discord.Member): async def _whitelist_add(self, user : discord.Member):
@ -180,8 +181,8 @@ class Mod:
async def ignore(self, ctx): async def ignore(self, ctx):
"""Adds servers/channels to ignorelist""" """Adds servers/channels to ignorelist"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
await self.bot.say(self.count_ignored() + "Type help ignore for info.") await self.bot.say(self.count_ignored())
@ignore.command(name="channel", pass_context=True) @ignore.command(name="channel", pass_context=True)
async def ignore_channel(self, ctx, channel : discord.Channel=None): async def ignore_channel(self, ctx, channel : discord.Channel=None):
@ -221,7 +222,8 @@ class Mod:
async def unignore(self, ctx): async def unignore(self, ctx):
"""Removes servers/channels from ignorelist""" """Removes servers/channels from ignorelist"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.say(self.count_ignored() + "Type help unignore for info.") await send_cmd_help(ctx)
await self.bot.say(self.count_ignored())
@unignore.command(name="channel", pass_context=True) @unignore.command(name="channel", pass_context=True)
async def unignore_channel(self, ctx, channel : discord.Channel=None): async def unignore_channel(self, ctx, channel : discord.Channel=None):
@ -271,7 +273,7 @@ class Mod:
Using this command with no subcommands will send Using this command with no subcommands will send
the list of the server's filtered words.""" the list of the server's filtered words."""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.say("Type help filter for info.") await send_cmd_help(ctx)
server = ctx.message.server server = ctx.message.server
author = ctx.message.author author = ctx.message.author
msg = "" msg = ""
@ -291,7 +293,7 @@ class Mod:
filter add word1 word2 word3 filter add word1 word2 word3
filter add \"This is a sentence\"""" filter add \"This is a sentence\""""
if words == (): if words == ():
await self.bot.say("Type help filter add for info.") await send_cmd_help(ctx)
return return
server = ctx.message.server server = ctx.message.server
added = 0 added = 0
@ -316,7 +318,7 @@ class Mod:
filter remove word1 word2 word3 filter remove word1 word2 word3
filter remove \"This is a sentence\"""" filter remove \"This is a sentence\""""
if words == (): if words == ():
await self.bot.say("Type help filter remove for info.") await send_cmd_help(ctx)
return return
server = ctx.message.server server = ctx.message.server
removed = 0 removed = 0