mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deab24e916 | ||
|
|
2bb9b87db9 | ||
|
|
5bd044d646 | ||
|
|
371292e03a | ||
|
|
acc5baec7d | ||
|
|
ed692bcaa5 | ||
|
|
7352f76b87 |
@@ -1,3 +1,30 @@
|
|||||||
|
.. 3.2.x Changelogs
|
||||||
|
|
||||||
|
Redbot 3.2.2 (2020-01-10)
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Hotfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix Help Pagination issue
|
||||||
|
|
||||||
|
Docs
|
||||||
|
----
|
||||||
|
|
||||||
|
- Correct venv docs
|
||||||
|
|
||||||
|
|
||||||
|
Redbot 3.2.1 (2020-01-10)
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Hotfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix Mongo conversion from being incorrectly blocked
|
||||||
|
- Fix announcer not creating a message for success feedback
|
||||||
|
- Log an error with creating case types rather than crash
|
||||||
|
|
||||||
|
|
||||||
Redbot 3.2.0 (2020-01-09)
|
Redbot 3.2.0 (2020-01-09)
|
||||||
=========================
|
=========================
|
||||||
Core Bot Changes
|
Core Bot Changes
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ to keep it in a location which is easy to type out the path to. From now, we'll
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Create your virtual environment with the following command::
|
Create your virtual environment with the following command::
|
||||||
|
|
||||||
python3.7 -m venv redenv
|
python3.8 -m venv redenv
|
||||||
|
|
||||||
And activate it with the following command::
|
And activate it with the following command::
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ Continue reading `below <after-activating-virtual-environment>`.
|
|||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
Create your virtual environment with the following command::
|
Create your virtual environment with the following command::
|
||||||
|
|
||||||
py -3.7 -m venv redenv
|
py -3.8 -m venv redenv
|
||||||
|
|
||||||
And activate it with the following command::
|
And activate it with the following command::
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ Using ``pyenv virtualenv``
|
|||||||
Using ``pyenv virtualenv`` saves you the headache of remembering where you installed your virtual
|
Using ``pyenv virtualenv`` saves you the headache of remembering where you installed your virtual
|
||||||
environments. If you haven't already, install pyenv with `pyenv-installer`_.
|
environments. If you haven't already, install pyenv with `pyenv-installer`_.
|
||||||
|
|
||||||
First, ensure your pyenv interpreter is set to python 3.7.0 or greater with the following command::
|
First, ensure your pyenv interpreter is set to python 3.8.1 or greater with the following command::
|
||||||
|
|
||||||
pyenv version
|
pyenv version
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ def _update_event_loop_policy():
|
|||||||
_asyncio.set_event_loop_policy(_uvloop.EventLoopPolicy())
|
_asyncio.set_event_loop_policy(_uvloop.EventLoopPolicy())
|
||||||
|
|
||||||
|
|
||||||
__version__ = "3.2.0"
|
__version__ = "3.2.2"
|
||||||
version_info = VersionInfo.from_str(__version__)
|
version_info = VersionInfo.from_str(__version__)
|
||||||
|
|
||||||
# Filter fuzzywuzzy slow sequence matcher warning
|
# Filter fuzzywuzzy slow sequence matcher warning
|
||||||
|
|||||||
@@ -466,6 +466,10 @@ def main():
|
|||||||
log.info("Shutting down with exit code: %s", exc.code)
|
log.info("Shutting down with exit code: %s", exc.code)
|
||||||
if red is not None:
|
if red is not None:
|
||||||
loop.run_until_complete(shutdown_handler(red, None, exc.code))
|
loop.run_until_complete(shutdown_handler(red, None, exc.code))
|
||||||
|
except Exception as exc: # Non standard case.
|
||||||
|
log.exception("Unexpected exception (%s): ", type(exc), exc_info=exc)
|
||||||
|
if red is not None:
|
||||||
|
loop.run_until_complete(shutdown_handler(red, None, ExitCodes.CRITICAL))
|
||||||
finally:
|
finally:
|
||||||
# Allows transports to close properly, and prevent new ones from being opened.
|
# Allows transports to close properly, and prevent new ones from being opened.
|
||||||
# Transports may still not be closed correcly on windows, see below
|
# Transports may still not be closed correcly on windows, see below
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class Announcer:
|
|||||||
if len(failed) == 1
|
if len(failed) == 1
|
||||||
else _("I could not announce to the following servers: ")
|
else _("I could not announce to the following servers: ")
|
||||||
)
|
)
|
||||||
|
if failed:
|
||||||
msg += humanize_list(tuple(map(inline, failed)))
|
msg += humanize_list(tuple(map(inline, failed)))
|
||||||
await self.ctx.bot.send_to_owners(msg)
|
await self.ctx.bot.send_to_owners(msg)
|
||||||
self.active = False
|
self.active = False
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class RedHelpFormatter:
|
|||||||
shorten_line(f"**{name}** {command.short_doc}")
|
shorten_line(f"**{name}** {command.short_doc}")
|
||||||
for name, command in sorted(subcommands.items())
|
for name, command in sorted(subcommands.items())
|
||||||
)
|
)
|
||||||
for i, page in enumerate(pagify(subtext, page_length=1000, shorten_by=0)):
|
for i, page in enumerate(pagify(subtext, page_length=500, shorten_by=0)):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
title = "**__Subcommands:__**"
|
title = "**__Subcommands:__**"
|
||||||
else:
|
else:
|
||||||
@@ -281,12 +281,12 @@ class RedHelpFormatter:
|
|||||||
f_len = len(f.value) + len(f.name)
|
f_len = len(f.value) + len(f.name)
|
||||||
|
|
||||||
# Commands start at the 1st index of fields, i < 2 is a hacky workaround for now
|
# Commands start at the 1st index of fields, i < 2 is a hacky workaround for now
|
||||||
if not current_count or f_len + current_count > max_chars or i < 2:
|
if not current_count or f_len + current_count < max_chars or i < 2:
|
||||||
current_count += f_len
|
current_count += f_len
|
||||||
curr_group.append(f)
|
curr_group.append(f)
|
||||||
elif curr_group:
|
elif curr_group:
|
||||||
ret.append(curr_group)
|
ret.append(curr_group)
|
||||||
current_count = 0
|
current_count = f_len
|
||||||
curr_group = [f]
|
curr_group = [f]
|
||||||
else:
|
else:
|
||||||
if curr_group:
|
if curr_group:
|
||||||
@@ -299,7 +299,7 @@ class RedHelpFormatter:
|
|||||||
pages = []
|
pages = []
|
||||||
|
|
||||||
page_char_limit = await ctx.bot._config.help.page_char_limit()
|
page_char_limit = await ctx.bot._config.help.page_char_limit()
|
||||||
page_char_limit = min(page_char_limit, 5990) # Just in case someone was manually...
|
page_char_limit = min(page_char_limit, 5500) # Just in case someone was manually...
|
||||||
|
|
||||||
author_info = {"name": f"{ctx.me.display_name} Help Menu", "icon_url": ctx.me.avatar_url}
|
author_info = {"name": f"{ctx.me.display_name} Help Menu", "icon_url": ctx.me.avatar_url}
|
||||||
|
|
||||||
@@ -318,13 +318,13 @@ class RedHelpFormatter:
|
|||||||
# We could consider changing this to always just subtract the offset,
|
# We could consider changing this to always just subtract the offset,
|
||||||
# But based on when this is being handled (very end of 3.2 release)
|
# But based on when this is being handled (very end of 3.2 release)
|
||||||
# I'd rather not stick a major visual behavior change in at the last moment.
|
# I'd rather not stick a major visual behavior change in at the last moment.
|
||||||
if page_char_limit + offset > 5990:
|
if page_char_limit + offset > 5500:
|
||||||
# This is still neccessary with the max interaction above
|
# This is still neccessary with the max interaction above
|
||||||
# While we could subtract 100% of the time the offset from page_char_limit
|
# While we could subtract 100% of the time the offset from page_char_limit
|
||||||
# the intent here is to shorten again
|
# the intent here is to shorten again
|
||||||
# *only* when neccessary, by the exact neccessary amount
|
# *only* when neccessary, by the exact neccessary amount
|
||||||
# To retain a visual match with prior behavior.
|
# To retain a visual match with prior behavior.
|
||||||
page_char_limit = 5990 - offset
|
page_char_limit = 5500 - offset
|
||||||
elif page_char_limit < 250:
|
elif page_char_limit < 250:
|
||||||
# Prevents an edge case where a combination of long cog help and low limit
|
# Prevents an edge case where a combination of long cog help and low limit
|
||||||
# Could prevent anything from ever showing up.
|
# Could prevent anything from ever showing up.
|
||||||
@@ -393,7 +393,7 @@ class RedHelpFormatter:
|
|||||||
shorten_line(f"**{name}** {command.short_doc}")
|
shorten_line(f"**{name}** {command.short_doc}")
|
||||||
for name, command in sorted(coms.items())
|
for name, command in sorted(coms.items())
|
||||||
)
|
)
|
||||||
for i, page in enumerate(pagify(command_text, page_length=1000, shorten_by=0)):
|
for i, page in enumerate(pagify(command_text, page_length=500, shorten_by=0)):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
title = "**__Commands:__**"
|
title = "**__Commands:__**"
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -643,7 +643,14 @@ class Config:
|
|||||||
return pickle.loads(pickle.dumps(self._defaults, -1))
|
return pickle.loads(pickle.dumps(self._defaults, -1))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_conf(cls, cog_instance, identifier: int, force_registration=False, cog_name=None):
|
def get_conf(
|
||||||
|
cls,
|
||||||
|
cog_instance,
|
||||||
|
identifier: int,
|
||||||
|
force_registration=False,
|
||||||
|
cog_name=None,
|
||||||
|
allow_old: bool = False,
|
||||||
|
):
|
||||||
"""Get a Config instance for your cog.
|
"""Get a Config instance for your cog.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
@@ -676,11 +683,16 @@ class Config:
|
|||||||
A new Config object.
|
A new Config object.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if allow_old:
|
||||||
|
log.warning(
|
||||||
|
"DANGER! This is getting an outdated driver. "
|
||||||
|
"Hopefully this is only being done from convert"
|
||||||
|
)
|
||||||
uuid = str(identifier)
|
uuid = str(identifier)
|
||||||
if cog_name is None:
|
if cog_name is None:
|
||||||
cog_name = type(cog_instance).__name__
|
cog_name = type(cog_instance).__name__
|
||||||
|
|
||||||
driver = get_driver(cog_name, uuid)
|
driver = get_driver(cog_name, uuid, allow_old=allow_old)
|
||||||
if hasattr(driver, "migrate_identifier"):
|
if hasattr(driver, "migrate_identifier"):
|
||||||
driver.migrate_identifier(identifier)
|
driver.migrate_identifier(identifier)
|
||||||
|
|
||||||
@@ -693,7 +705,7 @@ class Config:
|
|||||||
return conf
|
return conf
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_core_conf(cls, force_registration: bool = False):
|
def get_core_conf(cls, force_registration: bool = False, allow_old: bool = False):
|
||||||
"""Get a Config instance for the core bot.
|
"""Get a Config instance for the core bot.
|
||||||
|
|
||||||
All core modules that require a config instance should use this
|
All core modules that require a config instance should use this
|
||||||
@@ -706,7 +718,11 @@ class Config:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
return cls.get_conf(
|
return cls.get_conf(
|
||||||
None, cog_name="Core", identifier=0, force_registration=force_registration
|
None,
|
||||||
|
cog_name="Core",
|
||||||
|
identifier=0,
|
||||||
|
force_registration=force_registration,
|
||||||
|
allow_old=allow_old,
|
||||||
)
|
)
|
||||||
|
|
||||||
def __getattr__(self, item: str) -> Union[Group, Value]:
|
def __getattr__(self, item: str) -> Union[Group, Value]:
|
||||||
@@ -1457,7 +1473,7 @@ class Config:
|
|||||||
async def migrate(cur_driver_cls: Type[BaseDriver], new_driver_cls: Type[BaseDriver]) -> None:
|
async def migrate(cur_driver_cls: Type[BaseDriver], new_driver_cls: Type[BaseDriver]) -> None:
|
||||||
"""Migrate from one driver type to another."""
|
"""Migrate from one driver type to another."""
|
||||||
# Get custom group data
|
# Get custom group data
|
||||||
core_conf = Config.get_core_conf()
|
core_conf = Config.get_core_conf(allow_old=True)
|
||||||
core_conf.init_custom("CUSTOM_GROUPS", 2)
|
core_conf.init_custom("CUSTOM_GROUPS", 2)
|
||||||
all_custom_group_data = await core_conf.custom("CUSTOM_GROUPS").all()
|
all_custom_group_data = await core_conf.custom("CUSTOM_GROUPS").all()
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,12 @@ def get_driver_class(storage_type: Optional[BackendType] = None) -> Type[BaseDri
|
|||||||
|
|
||||||
|
|
||||||
def get_driver(
|
def get_driver(
|
||||||
cog_name: str, identifier: str, storage_type: Optional[BackendType] = None, **kwargs
|
cog_name: str,
|
||||||
|
identifier: str,
|
||||||
|
storage_type: Optional[BackendType] = None,
|
||||||
|
*,
|
||||||
|
allow_old: bool = False,
|
||||||
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Get a driver instance.
|
"""Get a driver instance.
|
||||||
|
|
||||||
@@ -107,7 +112,10 @@ def get_driver(
|
|||||||
storage_type = BackendType.JSON
|
storage_type = BackendType.JSON
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if not allow_old:
|
||||||
driver_cls: Type[BaseDriver] = get_driver_class(storage_type)
|
driver_cls: Type[BaseDriver] = get_driver_class(storage_type)
|
||||||
|
else:
|
||||||
|
driver_cls: Type[BaseDriver] = _get_driver_class_include_old(storage_type)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if storage_type in (BackendType.MONGOV1, BackendType.MONGO):
|
if storage_type in (BackendType.MONGOV1, BackendType.MONGO):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import logging
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import List, Union, Optional, cast, TYPE_CHECKING
|
from typing import List, Union, Optional, cast, TYPE_CHECKING
|
||||||
|
|
||||||
@@ -21,6 +22,8 @@ from .generic_casetypes import all_generics
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
|
||||||
|
log = logging.getLogger("red.core.modlog")
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Case",
|
"Case",
|
||||||
"CaseType",
|
"CaseType",
|
||||||
@@ -497,12 +500,15 @@ class CaseType:
|
|||||||
image: str,
|
image: str,
|
||||||
case_str: str,
|
case_str: str,
|
||||||
guild: Optional[discord.Guild] = None,
|
guild: Optional[discord.Guild] = None,
|
||||||
|
**kwargs,
|
||||||
):
|
):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.default_setting = default_setting
|
self.default_setting = default_setting
|
||||||
self.image = image
|
self.image = image
|
||||||
self.case_str = case_str
|
self.case_str = case_str
|
||||||
self.guild = guild
|
self.guild = guild
|
||||||
|
if kwargs:
|
||||||
|
log.warning("Got unexpected keys in case %s", ",".join(kwargs.keys()))
|
||||||
|
|
||||||
async def to_json(self):
|
async def to_json(self):
|
||||||
"""Transforms the case type into a dict and saves it"""
|
"""Transforms the case type into a dict and saves it"""
|
||||||
|
|||||||
1
tox.ini
1
tox.ini
@@ -52,7 +52,6 @@ basepython = python3.8
|
|||||||
extras = docs
|
extras = docs
|
||||||
commands =
|
commands =
|
||||||
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/html" -W -bhtml
|
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/html" -W -bhtml
|
||||||
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/linkcheck" -W -blinkcheck
|
|
||||||
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/doctest" -W -bdoctest
|
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/doctest" -W -bdoctest
|
||||||
|
|
||||||
[testenv:style]
|
[testenv:style]
|
||||||
|
|||||||
Reference in New Issue
Block a user