mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Few fixes
This commit is contained in:
parent
3a23b5c003
commit
d725b97c2a
|
@ -13,4 +13,4 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
|
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import base
|
import extensions.base
|
|
@ -13,4 +13,4 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
|
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import mediawiki
|
import extensions.base.mediawiki
|
||||||
|
|
|
@ -20,7 +20,7 @@ from src.api import formatter
|
||||||
from src.i18n import rc_formatters
|
from src.i18n import rc_formatters
|
||||||
from src.api.client import Client, client
|
from src.api.client import Client, client
|
||||||
from src.configloader import settings
|
from src.configloader import settings
|
||||||
|
from src.exceptions import *
|
||||||
|
|
||||||
_ = rc_formatters.gettext
|
_ = rc_formatters.gettext
|
||||||
|
|
||||||
|
@ -59,16 +59,19 @@ class base():
|
||||||
minor=_("m") if action == "edit" and "minor" in change else "", bot=_('b') if "bot" in change else "",
|
minor=_("m") if action == "edit" and "minor" in change else "", bot=_('b') if "bot" in change else "",
|
||||||
space=" " if "bot" in change or (action == "edit" and "minor" in change) or action == "new" else "")
|
space=" " if "bot" in change or (action == "edit" and "minor" in change) or action == "new" else "")
|
||||||
if settings["appearance"]["embed"]["show_edit_changes"]:
|
if settings["appearance"]["embed"]["show_edit_changes"]:
|
||||||
|
try:
|
||||||
if action == "new":
|
if action == "new":
|
||||||
changed_content = safe_read(recent_changes._safe_request(
|
changed_content = ctx.client.make_api_request(
|
||||||
"{wiki}?action=compare&format=json&fromtext=&torev={diff}&topst=1&prop=diff".format(
|
"{wiki}?action=compare&format=json&fromtext=&torev={diff}&topst=1&prop=diff".format(
|
||||||
wiki=ctx.client.WIKI_API_PATH, diff=change["revid"]
|
wiki=ctx.client.WIKI_API_PATH, diff=change["revid"]
|
||||||
)), "compare", "*")
|
), "compare", "*")
|
||||||
else:
|
else:
|
||||||
changed_content = safe_read(recent_changes._safe_request(
|
changed_content = ctx.client.make_api_request(
|
||||||
"{wiki}?action=compare&format=json&fromrev={oldrev}&torev={diff}&topst=1&prop=diff".format(
|
"{wiki}?action=compare&format=json&fromrev={oldrev}&torev={diff}&topst=1&prop=diff".format(
|
||||||
wiki=ctx.client.WIKI_API_PATH, diff=change["revid"], oldrev=change["old_revid"]
|
wiki=ctx.client.WIKI_API_PATH, diff=change["revid"], oldrev=change["old_revid"]
|
||||||
)), "compare", "*")
|
), "compare", "*")
|
||||||
|
except (ServerError):
|
||||||
|
changed_content = None
|
||||||
if changed_content:
|
if changed_content:
|
||||||
EditDiff = ctx.client.content_parser()
|
EditDiff = ctx.client.content_parser()
|
||||||
EditDiff.feed(changed_content)
|
EditDiff.feed(changed_content)
|
||||||
|
|
|
@ -62,4 +62,3 @@ class Client:
|
||||||
|
|
||||||
|
|
||||||
client = Client()
|
client = Client()
|
||||||
client.make_api_request()
|
|
|
@ -13,7 +13,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
|
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from src.rcgcdw import formatter_hooks
|
import src.rcgcdw
|
||||||
from src.configloader import settings
|
from src.configloader import settings
|
||||||
from src.exceptions import FormatterBreaksAPISpec
|
from src.exceptions import FormatterBreaksAPISpec
|
||||||
from src.discord.message import DiscordMessage
|
from src.discord.message import DiscordMessage
|
||||||
|
@ -35,7 +35,7 @@ def _register_formatter(func: Callable[[dict], DiscordMessage], kwargs: dict[str
|
||||||
if action_type is None:
|
if action_type is None:
|
||||||
raise FormatterBreaksAPISpec("event type")
|
raise FormatterBreaksAPISpec("event type")
|
||||||
if settings["appearance"]["mode"] == formatter_type:
|
if settings["appearance"]["mode"] == formatter_type:
|
||||||
formatter_hooks[action_type] = func
|
src.rcgcdw.formatter_hooks[action_type] = func
|
||||||
|
|
||||||
|
|
||||||
def embed(**kwargs):
|
def embed(**kwargs):
|
||||||
|
|
|
@ -47,9 +47,10 @@ logger = logging.getLogger("rcgcdw")
|
||||||
logger.debug("Current settings: {settings}".format(settings=settings))
|
logger.debug("Current settings: {settings}".format(settings=settings))
|
||||||
from src.migrations import * # migrations after logging
|
from src.migrations import * # migrations after logging
|
||||||
try:
|
try:
|
||||||
import exceptions
|
import extensions
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.critical("No extensions module found. What's going on?")
|
logger.critical("No extensions module found. What's going on?")
|
||||||
|
raise
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
storage = datafile
|
storage = datafile
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue