Exemplo n.º 1
0
async def setup(bot: tbb.TravusBotBase):
    """Setup function ran when module is loaded."""
    mutes_dict: Dict[Tuple[int, int], Optional[datetime]] = {}
    async with bot.db.acquire() as conn:
        async with conn.transaction():
            await conn.execute("CREATE TABLE IF NOT EXISTS mutes(guild TEXT NOT NULL, muted_user TEXT "
                               "NOT NULL, until TIMESTAMPTZ, PRIMARY KEY(guild, muted_user))")
        mutes = await conn.fetch("SELECT * FROM mutes")
        for mute in mutes:
            try:
                guild = int(mute["guild"])
                muted_user = int(mute["muted_user"])
                mutes_dict[(guild, muted_user)] = mute["until"]
            except ValueError:
                continue

    await bot.add_cog(ModerationCog(bot, mutes_dict))  # Add cog and command help info.
    bot.add_module("Moderation", "[Travus](https://github.com/Travus):\n\tCommands", ModerationCog.usage,
                   """This module includes commands helpful for moderation, such as retrieving info about users,
                   mass-deleting messages, etc. This module is intended to be used by moderators, and as such the
                   commands in this section are locked behind permissions and/or roles.""")
    bot.add_command_help(ModerationCog.whois, "Moderation", {"perms": ["Manage Server"]},
                         ["Travus#8888", "118954681241174016"])
    bot.add_command_help(ModerationCog.purge, "Moderation", {"perms": ["Manage Messages"]},
                         ["50", "50 penguin_pen", "25 Travus#8888", "25 bot_room BernieBot#4328"])
    bot.add_command_help(ModerationCog.mute, "Moderation", {"perms": ["Manage Roles"]},
                         ["Travus#8888", "Travus#8888 12h"])
    bot.add_command_help(ModerationCog.unmute, "Moderation", {"perms": ["Manage Roles"]}, ["Travus#8888"])
Exemplo n.º 2
0
async def setup(bot: tbb.TravusBotBase):
    """Setup function ran when module is loaded."""
    reminder_dict: Dict[Tuple[Optional[int], Optional[int], int],
                        Tuple[datetime, str]] = {}
    async with bot.db.acquire() as conn:
        async with conn.transaction():
            await conn.execute(
                "CREATE TABLE IF NOT EXISTS reminders(guild TEXT, channel TEXT, reminding_user "
                "TEXT NOT NULL, until TIMESTAMPTZ NOT NULL, message TEXT NOT NULL)"
            )
        reminders = await conn.fetch("SELECT * FROM reminders")
        for reminder in reminders:
            try:
                guild = None if reminder["guild"] is None else int(
                    reminder["guild"])
                channel = None if reminder["channel"] is None else int(
                    reminder["channel"])
                reminding_user = int(reminder["reminding_user"])
                reminder_dict[(guild, channel,
                               reminding_user)] = (reminder["until"],
                                                   reminder["message"])
            except ValueError:
                continue

    await bot.add_cog(UtilsCog(bot, reminder_dict)
                      )  # Add cog and command help info.
    bot.add_module(
        "Utils", "[Travus](https://github.com/Travus):\n\tCommands",
        UtilsCog.usage,
        """This module includes various utility commands, such as setting server info, user count, setting
                   reminders, etc. There commands are meant for use by both regular users and moderators and the
                   commands are intended to provide some value, opposed to just give fun responses."""
    )
    bot.add_command_help(UtilsCog.usercount, "Utility", None, [""])
    bot.add_command_help(UtilsCog.guildinfo, "Utility", None, [""])
    bot.add_command_help(UtilsCog.remindme, "Utility", None,
                         ["2h Check for a response", "2h30m Do the dishes"])
Exemplo n.º 3
0
async def teardown(bot: tbb.TravusBotBase):
    """Teardown function ran when module is unloaded."""
    await bot.remove_cog("ModerationCog")  # Remove cog and command help info.
    bot.remove_module("Moderation")
    bot.remove_command_help(ModerationCog)
Exemplo n.º 4
0
def teardown(bot: tbb.TravusBotBase):
    """Teardown function ran when module is unloaded."""
    bot.remove_cog("DevCog")  # Remove cog and command help info.
    bot.remove_module("Dev")
    bot.remove_command_help(DevCog)
Exemplo n.º 5
0
def setup(bot: tbb.TravusBotBase):
    """Setup function ran when module is loaded."""
    bot.add_cog(DevCog(bot))  # Add cog and command help info.
    bot.add_module(
        "Dev",
        "[Travus](https://github.com/Travus):\n\tEval command\n\tRoleID command\n\tChannelID command"
        "\n\tLast error command\n\n[Rapptz](https://github.com/Rapptz):\n\tSudo command",
        DevCog.usage,
        """This module includes developer functionality that supply information useful for
                   programming, such as IDs, as well as some debug and testing options such as code execution and
                   remote command execution. Also allows checking the most recent error.""",
        "[Rapptz](https://github.com/Rapptz):\n\tEval example\n\n"
        "[nerdstep710](https://github.com/nerdstep710):\n\tMystbin example")
    bot.add_command_help(DevCog.eval, "Dev", None,
                         ["return 4 + 7", "return channel.id"])
    bot.add_command_help(
        DevCog.sudo, "Dev", None,
        ["travus bot_room help", "118954681241174016 about dev"])
    bot.add_command_help(DevCog.roleids, "Dev", {"perms": ["Manage Roles"]},
                         ["all bot_room", "all dm", "muted"])
    bot.add_command_help(DevCog.channelids, "Dev",
                         {"perms": ["Manage Channels"]},
                         ["all bot_room", "all dm", "general"])
    bot.add_command_help(DevCog.lasterror, "Dev", {"perms": ["Manage Server"]},
                         [""])
Exemplo n.º 6
0
async def teardown(bot: tbb.TravusBotBase):
    """Teardown function ran when module is unloaded."""
    await bot.remove_cog("CoreFunctionalityCog")  # Remove cog and command help info.
    bot.remove_command_help(CoreFunctionalityCog)
Exemplo n.º 7
0
async def setup(bot: tbb.TravusBotBase):
    """Setup function ran when module is loaded."""
    await bot.add_cog(CoreFunctionalityCog(bot))  # Add cog and command help info.
    bot.add_command_help(CoreFunctionalityCog.botconfig_prefix, "Core", None, ["$", "bot!", "bot ?", "remove"])
    bot.add_command_help(CoreFunctionalityCog.botconfig_deletemessages, "Core", None, ["enable", "y", "disable", "n"])
    bot.add_command_help(CoreFunctionalityCog.module_list, "Core", {"perms": ["Administrator"]}, [""])
    bot.add_command_help(CoreFunctionalityCog.module_load, "Core", {"perms": ["Administrator"]}, ["fun", "economy"])
    bot.add_command_help(CoreFunctionalityCog.module_unload, "Core", {"perms": ["Administrator"]}, ["fun", "economy"])
    bot.add_command_help(CoreFunctionalityCog.module_reload, "Core", {"perms": ["Administrator"]}, ["fun", "economy"])
    bot.add_command_help(CoreFunctionalityCog.default, "Core", None, ["list", "add", "remove"])
    bot.add_command_help(CoreFunctionalityCog.default_list, "Core", None, [""])
    bot.add_command_help(CoreFunctionalityCog.default_add, "Core", None, ["fun", "economy"])
    bot.add_command_help(CoreFunctionalityCog.default_remove, "Core", None, ["fun", "economy"])
    bot.add_command_help(CoreFunctionalityCog.command_enable, "Core", {"perms": ["Administrator"]}, ["balance", "pay"])
    bot.add_command_help(CoreFunctionalityCog.command_disable, "Core", {"perms": ["Administrator"]}, ["balance", "pay"])
    bot.add_command_help(CoreFunctionalityCog.command_show, "Core", {"perms": ["Administrator"]}, ["module", "balance"])
    bot.add_command_help(CoreFunctionalityCog.command_hide, "Core", {"perms": ["Administrator"]}, ["module", "balance"])
    bot.add_command_help(CoreFunctionalityCog.about, "Core", None, ["", "fun"])
    bot.add_command_help(CoreFunctionalityCog.usage, "Core", None, ["", "dev"])
    bot.add_command_help(CoreFunctionalityCog.config, "Core", {"perms": ["Administrator"]}, ["get", "set", "unset"])
    bot.add_command_help(CoreFunctionalityCog.config_get, "Core", {"perms": ["Administrator"]}, ["alert_channel"])
    bot.add_command_help(CoreFunctionalityCog.config_unset, "Core", {"perms": ["Administrator"]}, ["alert_channel"])
    bot.add_command_help(CoreFunctionalityCog.shutdown, "Core", None, ["", "1h", "1h30m", "10m-30s", "2m30s"])
    bot.add_command_help(
        CoreFunctionalityCog.botconfig, "Core", None, ["prefix", "deletemessages", "description", "credits"]
    )
    bot.add_command_help(
        CoreFunctionalityCog.botconfig_description, "Core", None, ["remove", "This is a sample description."]
    )
    bot.add_command_help(
        CoreFunctionalityCog.module, "Core", {"perms": ["Administrator"]}, ["list", "load", "unload", "reload"]
    )
    bot.add_command_help(
        CoreFunctionalityCog.command, "Core", {"perms": ["Administrator"]}, ["enable", "disable", "show", "hide"]
    )
    bot.add_command_help(
        CoreFunctionalityCog.config_set, "Core", {"perms": ["Administrator"]}, ["alert_channel 353246496952418305"]
    )
    bot.add_command_help(
        CoreFunctionalityCog.botconfig_credits,
        "Core",
        None,
        ["remove", "`\n```\n[Person](URL):\n\tBot Profile Image\n``"],
    )