Example #1
0
 def __init__(self, bot):
     self.bot = bot
     self.config = Config.get_conf(self, identifier=5349824615)
     default_global = {"TOKEN": "123"}
     self.config.register_global(**default_global)
     print('Addon "{}" loaded'.format(self.__class__.__name__))
     self.endpoint = "https://api.scpslgame.com/v2/admin/badge.php"
Example #2
0
    def __init__(self, bot: Red):
        super().__init__()
        self.bot = bot
        self._aliases = Config.get_conf(self, 8927348724)

        self._aliases.register_global(**self.default_global_settings)
        self._aliases.register_guild(**self.default_guild_settings)
Example #3
0
 def __init__(self, bot):
     super().__init__()
     self.bot = bot
     self.settings = Config.get_conf(self, identifier=2652104208, force_registration=True)
     self.settings.register_global(**self.default_global)
     self.session = aiohttp.ClientSession()
     self.imgur_base_url = "https://api.imgur.com/3/"
Example #4
0
 def __init__(self, bot):
     super().__init__()
     self.bot = bot
     self.key = 414589031223512
     self.config = Config.get_conf(self, self.key)
     self.config.register_guild(commands={})
     self.commandobj = CommandObj(config=self.config, bot=self.bot)
     self.cooldowns = {}
Example #5
0
 def __init__(self, bot: Red):
     super().__init__()
     self.bot = bot
     self.config = Config.get_conf(self, 78631113035100160, force_registration=True)
     self.config.register_guild(**self.default_guild_settings)
     self.config.register_custom("REPORT", **self.default_report)
     self.antispam = {}
     self.user_cache = []
     self.tunnel_store = {}
Example #6
0
 def __init__(self, bot):
     self.bot = bot
     self.config = Config.get_conf(self, 8237492837454039, force_registration=True)
     self.config.register_guild(**self.default_guild)
     self.futures = []
     self.time_format = (
         "%b %d, %Y @ %I:%M %p UTC"
     )  # https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior
     asyncio.ensure_future(self.restart_loas())
Example #7
0
 def __init__(self, bot: Red):
     super().__init__()
     self.bot = bot
     self.file_path = "data/economy/settings.json"
     self.config = Config.get_conf(self, 1256844281)
     self.config.register_guild(**self.default_guild_settings)
     self.config.register_global(**self.default_global_settings)
     self.config.register_member(**self.default_member_settings)
     self.config.register_user(**self.default_user_settings)
     self.config.register_role(**self.default_role_settings)
     self.slot_register = defaultdict(dict)
Example #8
0
    def __init__(self, bot):
        super().__init__()
        self.bot = bot
        self.open_rifts = {}
        self.requesting_users = []
        self.bot.loop.create_task(self.load_rifts())

        self.config = Config.get_conf(self, identifier=2_113_674_295, force_registration=True)
        self.config.register_global(rifts=[])
        self.config.register_channel(blacklisted=False)
        self.config.register_guild(blacklisted=False)
        self.config.register_user(blacklisted=False)
Example #9
0
    def __init__(self, bot: Red):
        super().__init__()
        self.db = Config.get_conf(self, 26262626)

        self.db.register_global(**self.global_defaults)

        self.db.register_guild(**self.guild_defaults)

        self.db.register_role(**self.role_defaults)

        self.bot: Red = bot

        self.streams: List[Stream] = []
        self.task: Optional[asyncio.Task] = None

        self.yt_cid_pattern = re.compile("^UC[-_A-Za-z0-9]{21}[AQgw]$")
Example #10
0
    def __init__(self, bot):
        self.bot = bot
        self.last_change = None
        self.config = Config.get_conf(self, 2752521001, force_registration=True)

        default_global = {
            "botstats": False,
            "delay": "300",
            "statuses": [
                "her Turn()",
                "Tomb Raider II",
                "Transistor",
                "NEO Scavenger",
                "Python",
                "with your heart.",
            ],
            "type": "1",
        }

        self.config.register_global(**default_global)
Example #11
0
 def __init__(self, bot: Red):
     self.bot = bot
     self.logger = logging.getLogger("red.ZeCogsV3.react_roles")
     self.logger.setLevel(logging.INFO)
     self.inject_before_invokes()
     self.previous_locale = None
     self.reload_translations()
     # force_registration is for weaklings
     unique_id = int(
         hashlib.sha512((self.__author__ + "@" + self.__class__.__name__).encode()).hexdigest(),
         16,
     )
     self.config = Config.get_conf(self, identifier=unique_id)
     self.config.register_guild(links={})
     self.role_queue = asyncio.Queue()
     self.role_map = {}
     self.role_cache = {}
     self.links = {}  # {server.id: {channel.id_message.id: [role]}}
     self.message_cache = {}  # {channel.id_message.id: message}
     asyncio.ensure_future(self._init_bot_manipulation())
     asyncio.ensure_future(self.process_role_queue())
Example #12
0
	def __init__(self, bot):
		super().__init__()
		self.db = Config.get_conf(self, 118624118624, force_registration=True)
		self.bot = bot

		self.lastResponse = None

		default_guild_settings = {
			"reminderchannel":  -1,
			"alertroom":        -1,
			"alertsenabled":    False,
			"alertlastmessage": -1
		}
		default_global_settings = {
			"alertsdelay":    10
		}

		self.db.register_guild(**default_guild_settings)
		self.db.register_global(**default_global_settings)

		self.statusTask = asyncio.ensure_future(self._checkStatusTask())
		self.reminderTask = asyncio.ensure_future(self._reminderTask())
Example #13
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.load_check = self.bot.loop.create_task(self.bump_worker())
        self.config = Config.get_conf(self,
                                      identifier=9765573181940385953309,
                                      force_registration=True)
        default_guild = {
            "channel": None,
            "role": None,
            "message":
            "It's been 2 hours since the last successful bump, could someone run `!d bump`?",
            "tyMessage":
            "{member} thank you for bumping! Make sure to leave a review at <https://disboard.org/server/{guild.id}>.",
            "nextBump": None,
            "clean": False,
        }
        default_member = {
            "count": 0,
        }

        self.config.register_member(**default_member)
        self.config.register_guild(**default_guild)
Example #14
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.path = str(cog_data_path(self)).replace("\\", "/")

        self.image_path = self.path + "/"

        self.config = Config.get_conf(self,
                                      identifier=9811198108111121,
                                      force_registration=True)
        default_global = {
            "messages": [],
            "images": [],
            "time": {
                "hour": 0,
                "minute": 0,
                "second": 0
            },
        }
        default_guild = {"channelid": None}

        self.config.register_global(**default_global)
        self.config.register_guild(**default_guild)
Example #15
0
    def __init__(self, bot):
        self.bot = bot
        self.config = Config.get_conf(self, 2700081001, force_registration=True)

        default_guild = {
            "announce_channel": None,
            "auto_ban": False,
            "auto_ban_message": None,
            "auto_blacklist": False,
            "dm_message": None,
            "dm_toggle": False,
            "dungeon_channel": None,
            "dungeon_role": None,
            "join_days": 7,
            "mod_log": False,
            "profile_toggle": False,
            "toggle": False,
            "user_role": None,
            "user_role_toggle": False,
        }

        self.config.register_guild(**default_guild)
Example #16
0
    def __init__(self, bot):
        self.bot = bot
        self.config = Config.get_conf(self, identifier=3734879387937497)

        default_guild = {
            "channels": [],
            "roles": [],
            "lockdown_message": None,
            "unlockdown_message": None,
            "locked": False,
            "vc_channels": [],
            "music_channels": [],
            "send_alert": True,
            "nondefault": False,
            "secondary_role": None,
            "secondary_channels": [],
            "lock_role": None,
            "logging_channel": None,
        }

        self.config.register_guild(**default_guild)
        self.log = logging.getLogger("red.kko-cogs.lockitup")
Example #17
0
    async def create(cls, bot):
        """Remplace la fonction init qui ne peut pas être async"""

        obj = cls.__new__(cls)
        super(commands.Cog, obj).__init__()

        obj._loop = asyncio.get_event_loop()
        obj.next_tick = None

        obj.bot = bot

        # tableau associatif qui va contenir si une note est présente ou pas
        obj.marks_map = {}

        obj.browser = await launch()
        obj.page = await obj.browser.newPage()
        obj.config = Config.get_conf(obj, identifier=3031688555)

        # config par défaut
        default_global = {
            'username': '',
            'password': '',
            'frequency': 60,
        }
        obj.config.register_global(**default_global)

        # cache en mémoire de la config pour avoir des accès plus faciles / rapides
        obj.username = await obj.config.username()
        obj.password = await obj.config.password()
        obj.frequency = await obj.config.frequency()

        # initialisation des notes déjà présentes
        await obj.scrape(True)
        log.info(
            'Initialisation terminée.\nRecherche de nouvelles notes toutes les %s s.',
            obj.frequency)

        obj.set_interval(obj.should_scrape)
        return obj
Example #18
0
    def __init__(self, cog_instance):
        self.config = Config.get_conf(cog_instance,
                                      identifier=46772245354364,
                                      force_registration=True)
        default_global = {
            "default_member_stats_template":
            "/Activitytracker/default_member_stats.json",
            "giveaway_path": "data/giveaway.json",
            "mysql": {
                "host": "127.0.0.1",
                "port": 3306,
                "user": "******",
                "password": "******",
                "db": "dongermod",
            }
        }
        self.config.register_global(**default_global)

        self.default_member_stats_template = None
        self.mysql_cfg = {}
        self.connection = None
        self.ready = False
Example #19
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.enabled_cache = {}

        self.config = Config.get_conf(self,
                                      identifier=5465324654986213156,
                                      force_registration=False)

        self.config.register_guild(
            enabled=None,
            request_channel=None,
            channel=None,
            open_category=None,
            closed_category=None,
            role=None,
            active_channels=[],
            active_users=[],
            active_msgs=[],
            closed=[],  # [channel_id, channel_id]
            cases=
            {},  # {'emoji': {'title': 'title here', 'desc': 'description here'}}
        )
Example #20
0
    def __init__(self, bot):
        self.bot = bot

        self.path = str(datam.cog_data_path(self)).replace("\\", "/")
        self.attachment_path = self.path + "/attachments"

        self.check_folder()

        self.event_types = [
            "on_member_update",
            "on_voice_state_update",
            "on_message_edit",
            "on_message_delete",
            "on_raw_bulk_message_delete",
            "on_guild_channel_create",
            "on_guild_channel_delete",
            "on_guild_channel_update",
            "on_guild_update",
            "on_guild_role_create",
            "on_guild_role_delete",
            "on_guild_role_update",
            "on_member_ban",
            "on_member_unban",
            "on_member_kick",
            "on_member_remove",
            "on_member_join",
        ]

        self.config = Config.get_conf(self, identifier=6198483584)
        default_guild = {
            "enabled": False,
            "compact": False,
            "events": {},
            "ignore": {
                "channels": {},
                "members": {}
            },
        }
        self.config.register_guild(**default_guild)
Example #21
0
 def __init__(self, bot):
     """Set up the cog."""
     super().__init__()
     self.bot = bot
     self.config = Config.get_conf(self,
                                   identifier=1224364860,
                                   force_registration=True)
     self.config.register_global(**self.default_global_settings)
     self.config.register_guild(**self.default_guild_settings)
     # user id -> user reminder id
     self.config.init_custom("REMINDER", 2)
     self.config.register_custom("REMINDER",
                                 **self.default_reminder_settings)
     self.bg_loop_task = None
     self.next_reminder_to_send = {}
     self.search_for_next_reminder = True
     self.me_too_reminders = {}
     self.clicked_me_too_reminder = {}
     self.reminder_emoji = "\N{BELL}"
     self.reminder_parser = ReminderParser()
     self.problematic_reminders = []
     self.sent_retry_warning = False
Example #22
0
	def __init__(self, bot):
		self.bot = bot
		self.games = []
		self.config = Config.get_conf(self, identifier=7345167904)
		self.config.register_guild(
			doMention = False,
			startCash = 1500,
			incomeValue = 200,
			luxuryValue = 100,
			doAuction = True,
			bailValue = 50,
			maxJailRolls = 3,
			doDoubleGo = False,
			goValue = 200,
			freeParkingValue = None,
			hotelLimit = 12,
			houseLimit = 32,
			timeoutValue = 60,
			minRaise = 1,
			darkMode = False,
			saves = {}
		)
Example #23
0
    def __init__(self, bot):
        self.bot = bot
        dir_path = bundled_data_path(self)
        
        file_path = os.path.join(dir_path, cards_filename)
        with open (file_path, 'r') as file:
            self.cards = load(file)
        
        file_path = os.path.join(dir_path, consts_filename)
        with open (file_path, 'r') as file:
            self.constants = load(file)

        self.database = Config.get_conf(self, identifier=7894561230, force_registration=True)
        self.database.register_member(**member_settings)
        
        # init card data
        self.cards_abbrev = {}

        for k, v in self.cards.items():
            for value in v:
                self.cards_abbrev[value] = k
            self.cards_abbrev[k] = k
Example #24
0
 def __init__(self, bot: Red):
     self.bot = bot
     self.config = Config.get_conf(self,
                                   5641654654621651651,
                                   force_registration=True)
     self.antispam = {}
     self.config.register_guild(
         is_set=False,
         applicant_id=None,
         accepter_id=None,
         channel_id=None,
         applicant_role=True,
         questions=[
             ["What position are you applying for?", "Position", 120],
             ["What is your name?", "Name", 120],
             ["How old are you?", "Age", 120],
             [
                 "What timezone are you in? (Google is your friend.)",
                 "Timezone", 120
             ],
             [
                 "How many days per week can you be active?",
                 "Active days/week", 120
             ],
             [
                 "How many hours per day can you be active?",
                 "Active hours/day", 120
             ],
             [
                 "Do you have any previous experience? If so, please describe.",
                 "Previous experience", 120
             ],
             [
                 "Why do you want to be a member of our staff?", "Reason",
                 120
             ],
         ],
     )
Example #25
0
    def __init__(self, bot: Red) -> None:
        self.bot = bot

        # config
        default: dict = {}  # pointless typehint but hey
        self.config: Config = Config.get_conf(
            self,
            identifier="Vexed-status"  # type:ignore
        )  # shit idntfr... bit late to change it... even mypy agrees...
        self.config.register_global(version=2)
        self.config.register_global(feed_store=default)
        self.config.register_global(old_ids=[])
        self.config.register_global(
            latest=default)  # this is unused? i think? remove soonish
        self.config.register_channel(feeds=default)
        self.config.register_guild(service_restrictions=default)

        # other stuff
        self.session = aiohttp.ClientSession()
        self.last_checked = LastChecked()
        self.config_wrapper = ConfigWrapper(self.config, self.last_checked)
        self.service_cooldown = ServiceCooldown()

        self.statusapi = StatusAPI(self.session)

        self.ready = False

        asyncio.create_task(self._async_init())

        if 418078199982063626 in self.bot.owner_ids:  # type:ignore  # im lazy
            try:
                self.bot.add_dev_env_value("status", lambda _: self)
                self.bot.add_dev_env_value("statusapi",
                                           lambda _: self.statusapi)
                self.bot.add_dev_env_value("sendupdate", lambda _: SendUpdate)
                _log.debug("Added dev env vars.")
            except Exception:
                _log.exception("Unable to add dev env vars.", exc_info=True)
Example #26
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.config = Config.get_conf(self, 4712468135468475)
        default_guild = {
            self.XP_GOAL_BASE: 100,
            self.XP_GAIN_FACTOR: 0.1,
            self.XP_MIN: 15,
            self.XP_MAX: 25,
            self.COOLDOWN: 60,
            self.SINGLE_ROLE: True,
            self.MAKE_ANNOUNCEMENTS: True,
            self.ACTIVE: True,
            self.LEADERBOARD_MAX: 20,
            self.LEVEL_UP_MESSAGE:
            "Congratulations {mention}, you're now level {level}. ",
            self.ROLE_CHANGE_MESSAGE:
            "Your days as {oldrole} are over. Your new role is {newrole}.",
            self.GUILD_ROLES: []
        }

        default_channel = {self.IGNORED_CHANNEL: False}

        default_member = {
            self.MEMBER_ID: self.DEFAULT_ID,
            self.USERNAME: self.DEFAULT_USERNAME,
            self.ROLE_NAME: self.DEFAULT_ROLE,
            self.EXP: 0,
            self.LEVEL: 0,
            self.GOAL: 100,
            self.LAST_TRIGGER: 0,
            self.MESSAGE_COUNT: 0,
            self.MESSAGE_WITH_XP: 0
        }

        self.config.register_guild(**default_guild, force_registration=True)
        self.config.register_channel(**default_channel,
                                     force_registration=True)
        self.config.register_member(**default_member, force_registration=True)
Example #27
0
    def __init__(self, bot):
        self.bot = bot
        self.conf = Config.get_conf(self, identifier=208092)

        
        self.template_source = {
            "id": "",           # name to be used to identify the source
            "sub": "",          # subreddit to get the images from
            "nsfw": False,      # restrict use to nsfw channels
            "frequency": 3600,  # time in seconds to refresh data list
            "keep": 1000,       # number of records to keep in data
            "last": 0,          # unixtime of last time data was refreshed
            "data": []          # list of image links retrived with some metadata
        }

        self.template_data = {
            "url": "",
            "meta": {
                "score": 0,
                "views": 0,
                "last": 0
            }
        }

        
        default_source = self.template_source.copy()
        default_source.update({
            'id': "aww",
            'sub': "aww"
        })

        # registers default config
        default_global = {
            "sources": [
                default_source
            ]
        }
        self.conf.register_global(**default_global)
Example #28
0
 def __init__(self, bot):
     self.bot = bot
     self.config = Config.get_conf(self, identifier=218773382617890828, force_registration=True)
     self.config.register_global(version="0.0.0")
     default_guild = {
         "reaction_roles": {},
         "auto_roles": [],
     }
     default_role = {
         "sticky": False,
         "auto": False,
         "reactions": [],
         "selfassignable": False,
         "selfremovable": False,
         "exclusive_to": [],
         "inclusive_with": [],
         "required": [],
     }
     default_member = {"sticky_roles": []}
     self.config.register_guild(**default_guild)
     self.config.register_role(**default_role)
     self.config.register_member(**default_member)
     self.settings = {}
Example #29
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.config = Config.get_conf(self,
                                      identifier=5842647,
                                      force_registration=True)
        self.config.register_guild(
            **BASE_GUILD)  # Register default (empty) settings.
        self.update_wait = False  # boolean to check if already waiting

        # Initialize logger, and save to cog folder.
        saveFolder = data_manager.cog_data_path(cog_instance=self)
        self.logger = logging.getLogger("red.SmartReact")
        if self.logger.level == 0:
            # Prevents the self.logger from being loaded again in case of module reload.
            self.logger.setLevel(logging.INFO)
            handler = logging.FileHandler(filename=str(saveFolder) +
                                          "/info.log",
                                          encoding="utf-8",
                                          mode="a")
            handler.setFormatter(
                logging.Formatter("%(asctime)s %(message)s",
                                  datefmt="[%d/%m/%Y %H:%M:%S]"))
            self.logger.addHandler(handler)
Example #30
0
    def __init__(self, bot):
        self.config = Config.get_conf(self, identifier=32539819)

        default_guild = {
            'emoji_cost': 80000,
            'cc_cost': 90000,
            'rarecost': 250000,
            'epiccost': 750000,
            'legendarycost': 1000000,
            'passroyale_cost': 10000000,
            'nitroclassic_cost': 10000000,
            'rareid': 713274827150196778,
            'epicid': 713274877213147237,
            'legendaryid': 713274877213147237,
            'level100id': 713277924874387468,
            'logchannel': 713348481216937994,
        }

        self.config.register_guild(**default_guild)
        self.bot = bot
        self.cc_main = self.bot.get_cog('CustomCommands')
        self.cc = self.bot.get_cog('CustomCommands').cc_create
        self.prepare_args = self.bot.get_cog('CustomCommands').prepare_args
Example #31
0
 def __init__(self, bot: Red):
     self.bot = bot
     self.config = Config.get_conf(self,
                                   identifier=218773382617890828,
                                   force_registration=True)
     self.config.register_global(version="0.0.0", atomic=True)
     self.config.register_guild(reaction_roles={},
                                auto_roles=[],
                                atomic=None)
     self.config.register_role(
         sticky=False,
         auto=False,
         reactions=[],
         selfassignable=False,
         selfremovable=False,
         exclusive_to=[],
         inclusive_with=[],
         required=[],
         cost=0,
     )
     self.config.register_member(sticky_roles=[])
     self.settings: Dict[int, Any] = {}
     self._ready: asyncio.Event = asyncio.Event()
Example #32
0
    def __init__(self, bot):
        self.bot = bot
        self.config = Config.get_conf(
            self,
            identifier=160805014090190130501014,
            force_registration=True,
        )

        default_guild = {
            "channel": None,
        }

        default_user = {
            "reputation": 0,
            "title": "{user}'s shop",
            "description": "{user} doesn't have a shop...",
            "color": 0x000000,
            "entries": [],
            "reviews": {},  # coming soon...
        }

        self.config.register_user(**default_user)
        self.config.register_guild(**default_guild)
Example #33
0
 def __init__(self, bot):
     self.bot = bot
     self.config = Config.get_conf(self,
                                   156434873547,
                                   force_registration=True)
     default_guild = {
         "reaction": False,
         "text": False,
         "whitelist": [],
         "blacklist": []
     }
     default = {
         "api_key": None,
         "cooldown": {
             "past_flags": [],
             "timeout": 0,
             "multiple": False,
         }
     }
     self.config.register_guild(**default_guild)
     self.config.register_global(**default)
     self.cache = {"translations": []}
     self.clear_cache = self.bot.loop.create_task(self.cleanup_cache())
Example #34
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.config = Config.get_conf(self,
                                      identifier=5842647,
                                      force_registration=True)
        self.config.register_member(**BASE_MEMBER)
        self.config.register_channel(**BASE_CHANNEL)
        self.config.register_guild(**BASE_GUILD)

        # Initialize logger, and save to cog folder.
        saveFolder = data_manager.cog_data_path(cog_instance=self)
        self.logger = logging.getLogger("red.Stats")
        if self.logger.level == 0:
            # Prevents the self.logger from being loaded again in case of module reload.
            self.logger.setLevel(logging.INFO)
            handler = logging.FileHandler(filename=str(saveFolder) +
                                          "/info.log",
                                          encoding="utf-8",
                                          mode="a")
            handler.setFormatter(
                logging.Formatter("%(asctime)s %(message)s",
                                  datefmt="[%d/%m/%Y %H:%M:%S]"))
            self.logger.addHandler(handler)
Example #35
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.config = Config.get_conf(self, identifier=5842647, force_registration=True)
        # Register default (empty) settings.
        self.config.register_guild(**BASE_GUILD)
        self.config.register_member(**BASE_GUILD_MEMBER)

        # Initialize logger, and save to cog folder.
        saveFolder = data_manager.cog_data_path(cog_instance=self)
        logPath = os.path.join(saveFolder, "info.log")
        self.logger = logging.getLogger("red.luicogs.Birthday")
        if self.logger.level == 0:
            # Prevents the self.logger from being loaded again in case of module reload.
            self.logger.setLevel(logging.INFO)
            handler = logging.FileHandler(filename=logPath, encoding="utf-8", mode="a")
            handler.setFormatter(
                logging.Formatter("%(asctime)s %(message)s", datefmt="[%d/%m/%Y %H:%M:%S]")
            )
            self.logger.addHandler(handler)

        # On cog load, we want the loop to run once.
        self.lastChecked = datetime.now() - timedelta(days=1)
        self.bgTask = self.bot.loop.create_task(self.birthdayLoop())
Example #36
0
    def __init__(self, bot: Red):
        self.bot = bot
        self.config = Config.get_conf(self,
                                      identifier=5842647,
                                      force_registration=True)
        self.config.register_guild(**DEFAULT_GUILD)

        # Initialize logger, and save to cog folder.
        saveFolder = data_manager.cog_data_path(cog_instance=self)
        self.logger = logging.getLogger("red.luicogs.GoodSmileInfo")
        if self.logger.level == 0:
            # Prevents the self.logger from being loaded again in case of module reload.
            self.logger.setLevel(logging.DEBUG)
            handler = logging.FileHandler(filename=str(saveFolder) +
                                          "/info.log",
                                          encoding="utf-8",
                                          mode="a")
            handler.setFormatter(
                logging.Formatter("%(asctime)s %(message)s",
                                  datefmt="[%d/%m/%Y %H:%M:%S]"))
            self.logger.addHandler(handler)

        self.bgTask = self.bot.loop.create_task(self.bgLoop())
Example #37
0
    async def delete_gdc(bot, guild):
        """
            Deletes all game day channels in a given guild
        """
        config = Config.get_conf(None, CONFIG_ID, cog_name="Hockey")
        channels = await config.guild(guild).gdc()

        for channel in channels:
            chn = bot.get_channel(channel)
            if chn is None:
                try:
                    await config._clear_scope(Config.CHANNEL, str(chn))
                except:
                    pass
                continue
            if not await config.channel(chn).to_delete():
                continue
            try:
                await config.channel(chn).clear()
                await chn.delete()
            except Exception as e:
                log.error("Cannot delete GDC channels")
        await config.guild(guild).gdc.set([])
Example #38
0
    def __init__(self, bot: Red):
        super().__init__()
        self.bot = bot
        self.config = Config.get_conf(self,
                                      identifier=5842647,
                                      force_registration=True)
        self.config.register_guild(**
                                   BASE)  # Register default (empty) settings.

        # Initialize logger, and save to cog folder.
        saveFolder = data_manager.cog_data_path(cog_instance=self)
        self.logger = logging.getLogger("red.luicogs.WordFilter")
        if self.logger.level == 0:
            # Prevents the self.logger from being loaded again in case of module reload.
            self.logger.setLevel(logging.INFO)
            logPath = os.path.join(saveFolder, "info.log")
            handler = logging.FileHandler(filename=logPath,
                                          encoding="utf-8",
                                          mode="a")
            handler.setFormatter(
                logging.Formatter("%(asctime)s %(message)s",
                                  datefmt="[%d/%m/%Y %H:%M:%S]"))
            self.logger.addHandler(handler)
Example #39
0
    def __init__(self, bot):
        self.bot = bot
        self.config = Config.get_conf(self,
                                      identifier=672261474290237490,
                                      force_registration=True)
        self.visible_config = [
            "mysql_host", "mysql_port", "mysql_user", "mysql_db",
            "mysql_prefix", "min_living_minutes", "verified_role"
        ]

        default_guild = {
            "mysql_host": "127.0.0.1",
            "mysql_port": 3306,
            "mysql_user": "******",
            "mysql_password": "******",
            "mysql_db": "database",
            "mysql_prefix": "",
            "min_living_minutes": 60,
            "verified_role": None,
        }

        self.config.register_guild(**default_guild)
        self.pool = None
Example #40
0
    def __init__(self, bot, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.bot = bot

        # 77 79 86 73 69 == 'MOVIE'
        self.config = Config.get_conf(self, identifier=7779867369)

        default_global = {}

        default_guild = {
            "vote_size": 10,  # Deprecated
            "suggestions": [],
            "timezone_str": "UTC",  # Deprecated
            "movie_time": "0 20 * * 5",  # Deprecated
            "next_movie_title": "",  # Deprecated
            "prev_vote_msg_id": -1
        }

        self.config.register_global(**default_global)
        self.config.register_guild(**default_guild)

        self.vote_info = {}
Example #41
0
    def __init__(self, bot):
        self.bot = bot

        crtools_cog = self.bot.get_cog("ClashRoyaleTools")
        self.tags = getattr(crtools_cog, "tags", None)
        self.constants = getattr(crtools_cog, "constants", "None")

        self.config = Config.get_conf(self, identifier=2286464642345664456)
        default_global = {"clans": list()}
        self.config.register_global(**default_global)

        try:
            self.claninfo_path = str(cog_data_path(self) / "clans.json")
            with open(self.claninfo_path) as file:
                self.family_clans = dict(json.load(file))
        except:
            self.family_clans = {}

        self.claninfo_lock = asyncio.Lock()

        self.token_task = self.bot.loop.create_task(self.crtoken())
        self.refresh_task = self.refresh_data.start()
        self.last_updated = None
Example #42
0
    def __init__(self, bot):
        print('Loaded Leaderboard')
        self.boss_last_leaderboard = None
        self.last_leaderboard = None
        self.last_richest_user = None
        self.last_most_kills_user = None
        self.last_most_kills_users = []
        self.bot = bot
        self.config = Config.get_conf(self,
                                      8358350000,
                                      force_registration=True)

        self.guild = 278639962558300160
        self.boss_channel = 474801276408954891
        self.boss_message = 482438653776494605

        self.bal_channel = 474801276408954891
        self.bal_message = 482438585736495104

        print('[Leaderboard] task create')
        self.bot.loop.create_task(self.update_leaderboard())
        self.bot.loop.create_task(self.update_boss_leaderboard())
        self.bot.loop.create_task(self.update_leader_roles())
Example #43
0
 def __init__(self):
     self.config = Config.get_conf(self, identifier=806715409318936616)
     default_guild = {
         "searchEngines": [
             {
                 "title": "Google",
                 "url": "https://www.google.com/search?hl=en&q="
             },
             {
                 "title": "Bing",
                 "url": "https://www.bing.com/search?q="
             },
             {
                 "title": "Ecosia",
                 "url": "https://www.ecosia.org/search?q="
             },
             {
                 "title": "DuckDuckGo",
                 "url": "https://duckduckgo.com/?t=ffab&q="
             },
         ]
     }
     self.config.register_guild(**default_guild)
Example #44
0
    def __init__(self, bot: Red):
        super().__init__()
        self.bot = bot

        self.conf = Config.get_conf(self, identifier=998240343, force_registration=True)

        self.conf.register_global(installed=[])

        self.already_agreed = False

        self.LIB_PATH = cog_data_path(self) / "lib"
        self.SHAREDLIB_PATH = self.LIB_PATH / "cog_shared"
        self.SHAREDLIB_INIT = self.SHAREDLIB_PATH / "__init__.py"

        self.LIB_PATH.mkdir(parents=True, exist_ok=True)
        self.SHAREDLIB_PATH.mkdir(parents=True, exist_ok=True)
        if not self.SHAREDLIB_INIT.exists():
            with self.SHAREDLIB_INIT.open(mode="w", encoding="utf-8") as _:
                pass

        if str(self.LIB_PATH) not in syspath:
            syspath.insert(1, str(self.LIB_PATH))

        self._repo_manager = RepoManager()
Example #45
0
    def __init__(self, bot):
        self.bot = bot

        self.path = str(datam.cog_data_path(self)).replace("\\", "/")
        self.attachment_path = self.path + "/attachments"

        self.check_folder()

        self.event_types = [
            "on_member_update",
            "on_voice_state_update",
            "on_message_edit",
            "on_message_delete",
            "on_raw_bulk_message_delete",
            "on_guild_channel_create",
            "on_guild_channel_delete",
            "on_guild_channel_update",
            "on_guild_update",
            "on_guild_role_create",
            "on_guild_role_delete",
            "on_guild_role_update",
            "on_member_ban",
            "on_member_unban",
            "on_member_kick",
            "on_member_remove",
            "on_member_join",
        ]

        self.config = Config.get_conf(self, identifier=6198483584)
        default_guild = {
            "enabled": False,
            "compact": False,
            "events": {},
            "ignore": {"channels": {}, "members": {}},
        }
        self.config.register_guild(**default_guild)
Example #46
0
    def __init__(self, bot):
        self.bot = bot
        self.config = Config.get_conf(self, identifier=9999114111108101)
        default_guild = {"cmdlist": {}, "settings": {}}

        self.config.register_guild(**default_guild)
Example #47
0
from redbot.core import Config


db = Config.get_conf(None, 228174739, force_registration=True, cog_name="leveler")


backgrounds = {
    "levelup": {
        "default": "http://i.imgur.com/eEFfKqa.jpg"
    },
    "profile": {
        "alice": "http://i.imgur.com/MUSuMao.png",
        "bluestairs": "http://i.imgur.com/EjuvxjT.png",
        "coastline": "http://i.imgur.com/XzUtY47.jpg",
        "default": "http://i.imgur.com/8T1FUP5.jpg",
        "greenery": "http://i.imgur.com/70ZH6LX.png",
        "iceberg": "http://i.imgur.com/8KowiMh.png",
        "lamp": "http://i.imgur.com/0nQSmKX.jpg",
        "miraiglasses": "http://i.imgur.com/2Ak5VG3.png",
        "miraikuriyama": "http://i.imgur.com/jQ4s4jj.png",
        "mountaindawn": "http://i.imgur.com/kJ1yYY6.jpg",
        "redblack": "http://i.imgur.com/74J2zZn.jpg",
        "waterlilies": "http://i.imgur.com/qwdcJjI.jpg"
    },
    "rank": {
        "abstract": "http://i.imgur.com/70ZH6LX.png",
        "aurora": "http://i.imgur.com/gVSbmYj.jpg",
        "city": "http://i.imgur.com/yr2cUM9.jpg",
        "default": "http://i.imgur.com/SorwIrc.jpg",
        "mountain": "http://i.imgur.com/qYqEUYp.jpg",
        "nebula": "http://i.imgur.com/V5zSCmO.jpg"
Example #48
0
 def __init__(self, bot: Red):
     self.bot = bot
     self.config = Config.get_conf(self, 86345009)
     self.config.register_guild(**self.guild_defaults)
Example #49
0
 def __init__(self, bot):
     self.bot = bot
     self.db = Config.get_conf(self, 5074395005, force_registration=True)
     self.db.register_guild(**self.raffle_defaults)
     self.load_check = self.bot.loop.create_task(self.raffle_worker())
Example #50
0
 def __init__(self, bot):
     self.bot = bot
     self.config = Config.get_conf(self, 45463543548)
     self.config.register_guild(**default_settings)
     self.users = {}
Example #51
0
 def __init__(self, bot):
     self.bot = bot
     self.global_servers = {}
     self.config = Config.get_conf(self, 8237492837454049, force_registration=True)
     self.config.register_global(**self.default_global)
     self.config.register_guild(**self.default_guild)
Example #52
0
 def __init__(self, bot):
     self.bot = bot
     self.config = Config.get_conf(self, 50745431254379423, force_registration=True)
     self.config.register_guild(**self.default_guild)
Example #53
0
 def __init__(self, bot):
     self.bot = bot
     self.conf = Config.get_conf(self, identifier=UNIQUE_ID, force_registration=True)
     self.conf.register_channel(stickied=None, last=None)
     self.locked_channels = set()