# Buggy code
def __init__(self, *args, cli_flags=None, bot_dir: Path = Path.cwd(), **kwargs):
    self._shutdown_mode = ExitCodes.CRITICAL
    self.db = Config.get_core_conf(force_registration=True)
    self._co_owners = cli_flags.co_owner
    self.rpc_enabled = cli_flags.rpc
    self._last_exception = None
    self.db.register_global(
        token=None,
        prefix=[],
        packages=[],
        owner=None,
        whitelist=[],
        blacklist=[],
        locale="en-US",
        embeds=True,
        color=15158332,
        fuzzy=False,
        custom_info=None,
        help__page_char_limit=1000,
        help__max_pages_in_guild=2,
        help__tagline="",
        disabled_commands=[],
        disabled_command_msg="That command is disabled.",
        api_tokens={},
    )

    self.db.register_guild(
        prefix=[],
        whitelist=[],
        blacklist=[],
        admin_role=None,
        mod_role=None,
        embeds=None,
        use_bot_color=False,
        fuzzy=False,
        disabled_commands=[],
        autoimmune_ids=[],
    )

    self.db.register_user(embeds=None)

    self.db.init_custom(CUSTOM_GROUPS, 2)
    self.db.register_custom(CUSTOM_GROUPS)

    async def prefix_manager(bot, message):
        if not cli_flags.prefix:
            global_prefix = await bot.db.prefix()
        else:
            global_prefix = cli_flags.prefix
        if message.guild is None:
            return global_prefix
        server_prefix = await bot.db.guild(message.guild).prefix()
        if cli_flags.mentionable:
            return (
                when_mentioned_or(*server_prefix)(bot, message)
                if server_prefix
                else when_mentioned_or(*global_prefix)(bot, message)
            )
        else:
            return server_prefix if server_prefix else global_prefix

    if "command_prefix" not in kwargs:
        kwargs["command_prefix"] = prefix_manager

    if cli_flags.owner and "owner_id" not in kwargs:
        kwargs["owner_id"] = cli_flags.owner

    if "owner_id" not in kwargs:
        loop = asyncio.get_event_loop()
        loop.run_until_complete(self._dict_abuse(kwargs))

    if "command_not_found" not in kwargs:
        kwargs["command_not_found"] = "Command {} not found.\n{}"

    self.counter = Counter()
    self.uptime = None
    self.checked_time_accuracy = None
    self.color = discord.Embed.Empty  # This is needed or color ends up 0x000000

    self.main_dir = bot_dir

    self.cog_mgr = CogManager()

    super().__init__(*args, help_command=None, **kwargs)
    # Do not manually use the help formatter attribute here, see `send_help_for`,
    # for a documented API. The internals of this object are still subject to change.
    self._help_formatter = commands.help.RedHelpFormatter()
    self.add_command(commands.help.red_help)

    self._permissions_hooks: List[commands.CheckPredicate] = []


# Traceback (discord.errors.Forbidden)
019-05-15 16:23:44] [ERROR] red: Exception in command 'help'
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/core.py", line 63, in wrapped
ret = await coro(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/redbot/core/commands/help.py", line 513, in red_help
await ctx.bot.send_help_for(ctx, thing_to_get_help_for)
File "/usr/local/lib/python3.7/site-packages/redbot/core/bot.py", line 132, in send_help_for
return await self._help_formatter.send_help(ctx, help_for)
File "/usr/local/lib/python3.7/site-packages/redbot/core/commands/help.py", line 95, in send_help
await self.format_bot_help(ctx)
File "/usr/local/lib/python3.7/site-packages/redbot/core/commands/help.py", line 394, in format_bot_help
await self.send_pages(ctx, pages, embed=False)
File "/usr/local/lib/python3.7/site-packages/redbot/core/commands/help.py", line 500, in send_pages
await destination.send(page)
File "/usr/local/lib/python3.7/site-packages/discord/abc.py", line 776, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, nonce=nonce)
File "/usr/local/lib/python3.7/site-packages/discord/http.py", line 218, in request
raise Forbidden(r, data)
discord.errors.Forbidden: FORBIDDEN (status code: 403): Cannot send messages to this user

# Fixed code
def __init__(self, *args, cli_flags=None, bot_dir: Path = Path.cwd(), **kwargs):
    self._shutdown_mode = ExitCodes.CRITICAL
    self.db = Config.get_core_conf(force_registration=True)
    self._co_owners = cli_flags.co_owner
    self.rpc_enabled = cli_flags.rpc
    self._last_exception = None
    self.db.register_global(
        token=None,
        prefix=[],
        packages=[],
        owner=None,
        whitelist=[],
        blacklist=[],
        locale="en-US",
        embeds=True,
        color=15158332,
        fuzzy=False,
        custom_info=None,
        help__page_char_limit=1000,
        help__max_pages_in_guild=2,
        help__use_menus=False,
        help__show_hidden=False,
        help__verify_checks=True,
        help__verify_exists=False,
        help__tagline="",
        disabled_commands=[],
        disabled_command_msg="That command is disabled.",
        api_tokens={},
    )

    self.db.register_guild(
        prefix=[],
        whitelist=[],
        blacklist=[],
        admin_role=None,
        mod_role=None,
        embeds=None,
        use_bot_color=False,
        fuzzy=False,
        disabled_commands=[],
        autoimmune_ids=[],
    )

    self.db.register_user(embeds=None)

    self.db.init_custom(CUSTOM_GROUPS, 2)
    self.db.register_custom(CUSTOM_GROUPS)

    async def prefix_manager(bot, message):
        if not cli_flags.prefix:
            global_prefix = await bot.db.prefix()
        else:
            global_prefix = cli_flags.prefix
        if message.guild is None:
            return global_prefix
        server_prefix = await bot.db.guild(message.guild).prefix()
        if cli_flags.mentionable:
            return (
                when_mentioned_or(*server_prefix)(bot, message)
                if server_prefix
                else when_mentioned_or(*global_prefix)(bot, message)
            )
        else:
            return server_prefix if server_prefix else global_prefix

    if "command_prefix" not in kwargs:
        kwargs["command_prefix"] = prefix_manager

    if cli_flags.owner and "owner_id" not in kwargs:
        kwargs["owner_id"] = cli_flags.owner

    if "owner_id" not in kwargs:
        loop = asyncio.get_event_loop()
        loop.run_until_complete(self._dict_abuse(kwargs))

    if "command_not_found" not in kwargs:
        kwargs["command_not_found"] = "Command {} not found.\n{}"

    self.counter = Counter()
    self.uptime = None
    self.checked_time_accuracy = None
    self.color = discord.Embed.Empty  # This is needed or color ends up 0x000000

    self.main_dir = bot_dir

    self.cog_mgr = CogManager()

    super().__init__(*args, help_command=None, **kwargs)
    # Do not manually use the help formatter attribute here, see `send_help_for`,
    # for a documented API. The internals of this object are still subject to change.
    self._help_formatter = commands.help.RedHelpFormatter()
    self.add_command(commands.help.red_help)

    self._permissions_hooks: List[commands.CheckPredicate] = []