def define_cmd(bot, trigger):
    """.define_cmd <name> <lua script> - Create a command based on the given lua script"""
    if not trigger.group(2):
        return bot.say(define_cmd.__doc__)

    commands = bot.db.get_channel_value(trigger.sender, 'commands')
    if not commands:
        commands = dict()

    command = trigger.group(3).lower().strip()
    script = trigger.group(2).replace(command, '', 1).strip()
    commands[command] = script
    bot.db.set_channel_value(trigger.sender, 'commands', commands)
    bot.say("Successfully created new command. You should now be able to run '%s' in %s" % (trigger.group(3), trigger.sender))