From c5c5b457419ee0090dda86cac6e747618ce2cdba Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Tue, 21 Apr 2020 00:42:49 +0300 Subject: [PATCH] BREAKING: Move initial cogs to config FORK MAINTAINERS: Merging this without updating your config WILL lead to your bot not starting properly. --- Robocop.py | 32 ++++----------------------- config_template.py | 54 ++++++++++++++++++++++++++++++++++++++++------ requirements.txt | 3 --- 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/Robocop.py b/Robocop.py index 1c46a30..15face3 100755 --- a/Robocop.py +++ b/Robocop.py @@ -1,5 +1,4 @@ import os -import asyncio import sys import logging import logging.handlers @@ -43,29 +42,6 @@ wanted_jsons = ["data/restrictions.json", "data/userlog.json", "data/invites.json"] -initial_extensions = ['cogs.common', - 'cogs.admin', - 'cogs.verification', - 'cogs.mod', - 'cogs.mod_note', - 'cogs.mod_reacts', - 'cogs.mod_userlog', - 'cogs.mod_timed', - 'cogs.mod_watch', - 'cogs.basic', - 'cogs.logs', - 'cogs.err', - 'cogs.lockdown', - 'cogs.legacy', - 'cogs.links', - 'cogs.remind', - 'cogs.robocronp', - 'cogs.meme', - 'cogs.imagemanip', - 'cogs.pin', - 'cogs.invites', - 'cogs.lists'] - bot = commands.Bot(command_prefix=get_prefix, description=config.bot_description) bot.help_command = commands.DefaultHelpCommand(dm_help=True) @@ -76,11 +52,11 @@ bot.script_name = script_name bot.wanted_jsons = wanted_jsons if __name__ == '__main__': - for extension in initial_extensions: + for cog in config.initial_cogs: try: - bot.load_extension(extension) - except Exception as e: - log.error(f'Failed to load extension {extension}.') + bot.load_extension(cog) + except: + log.error(f'Failed to load cog {cog}.') log.error(traceback.print_exc()) diff --git a/config_template.py b/config_template.py index 6ca1949..b2be450 100644 --- a/config_template.py +++ b/config_template.py @@ -15,6 +15,36 @@ embed_desc = "Robocop-NG is developed by [Ave](https://github.com/aveao)"\ "of Robocop.\nRobocop is based on Kurisu by 916253 and ihaveamac." +# The cogs the bot will load on startup. +initial_cogs = ['cogs.common', + 'cogs.admin', + 'cogs.verification', + 'cogs.mod', + 'cogs.mod_note', + 'cogs.mod_reacts', + 'cogs.mod_userlog', + 'cogs.mod_timed', + 'cogs.mod_watch', + 'cogs.basic', + 'cogs.logs', + 'cogs.err', + 'cogs.lockdown', + 'cogs.legacy', + 'cogs.links', + 'cogs.remind', + 'cogs.robocronp', + 'cogs.meme', + 'cogs.invites'] + +# The following cogs are also available but aren't loaded by default: +# cogs.imagemanip - Adds a meme command called .cox. +# Requires Pillow to be installed with pip. +# cogs.lists - Allows managing list channels (rules, FAQ) easily through the bot +# PR'd in at: https://github.com/reswitched/robocop-ng/pull/65 +# cogs.pin - Lets users pin important messages +# and sends pins above limit to a github gist + + # Minimum account age required to join the guild # If user's account creation is shorter than the time delta given here # then user will be kicked and informed @@ -84,7 +114,9 @@ lockdown_configs = { # As we no longer have mute role on ReSwitched, I set it to 0 here mute_role = 0 # Mute role in ReSwitched -# Channels that will be cleaned every minute/hour +# Channels that will be cleaned every minute/hour. +# This feature isn't very good rn. +# See https://github.com/reswitched/robocop-ng/issues/23 minutely_clean_channels = [] hourly_clean_channels = [] @@ -95,9 +127,6 @@ spy_channels = general_channels allowed_pin_channels = [] allowed_pin_roles = [] -# Used for the pinboard. Leave empty if you don't wish for a gist pinboard. -github_oauth_token = "" - # Channel to upload text files while editing list items. (They are cleaned up.) list_files_channel = 0 @@ -112,5 +141,18 @@ suspect_words = ["sx", "tx", "reinx", # piracy-enabling cfws "cracked", # older term for pirated games "xci", "nsz"] # "backup" format -# List of words that will be ignored if they match one of the suspect_words (This is used to remove false positives) -suspect_ignored_words = [] +# List of words that will be ignored if they match one of the +# suspect_words (This is used to remove false positives) +suspect_ignored_words = ["excit", + "s/x", + "3dsx", + "psx", + "txt", + "s(x", + "txd", + "t=x", + "osx"] + +# == Only if you want to use cogs.pin == +# Used for the pinboard. Leave empty if you don't wish for a gist pinboard. +github_oauth_token = "" diff --git a/requirements.txt b/requirements.txt index b5c9702..60c81ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,3 @@ humanize parsedatetime aiohttp gidgethub - -# Only if you'll enable imagemanip, which is only used for meme commands -Pillow