mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-24 00:34:10 +00:00
Merge branch 'testing' into 'master'
1.9 Closes #91, #98, #99, and #100 See merge request piotrex43/RcGcDw!63
This commit is contained in:
commit
33d3f54846
|
@ -2,11 +2,11 @@ Welcome!
|
||||||
If you got here, it means you want to learn how to contribute to my little project. That's great! Thank you for your interest.
|
If you got here, it means you want to learn how to contribute to my little project. That's great! Thank you for your interest.
|
||||||
|
|
||||||
## Code ##
|
## Code ##
|
||||||
This may be a bit painful, the quality of code can be very... Questionable, to say the least. However, if you like adventures, you are free to contribute to the project! All I ask you is just so you send merge requests to the testing unstable.
|
This may be a bit painful, the quality of code can be very... Questionable, to say the least. However, if you like adventures, you are free to contribute to the project!
|
||||||
Current branch rules are as follows:
|
If you contribute, I ask of you to create merge requests based on testing branch. These can be merge requests for specific issues, but please use the testing branch as the base for your MR and a destination of your MR.
|
||||||
|
|
||||||
`master` - the most stable branch that has been tested for at least one day.
|
`master` - the most stable branch that has been tested for at least one day.
|
||||||
`testing `- testing branch is what all of my hosted scripts run. It is used to test the code before merging it with master branch. All languages must be finished for code to be pushed to this branch.
|
`testing `- testing branch is what all of my hosted scripts run. It is used to test the code before merging it with master branch.
|
||||||
`unstable` - the most unstable of unstable. Can result in frying the machine, well, not really, but all of new changes come here first, after some internal testing and translations it can be merged with testing branch.
|
|
||||||
|
|
||||||
## Translations ##
|
## Translations ##
|
||||||
If you speak in other languages than English, you are more than welcome to. All you need to do, is grab the [translation template file](rcgcdw.pot) and fill out the empty strings under every English sentence. You can use software like Poedit or use your favorite text editor to do that. If you are looking for examples, you can look at [Polish translation](/locale/pl/LC_MESSAGES/rcgcdw.po). After you translate it, you can either send a merge request to the testing branch, or, if you don't know git [contact me directly](https://minecraft.gamepedia.com/User:Frisk#Contact) so I can do this for you.
|
If you speak in other languages than English, you are more than welcome to. All you need to do, is grab the [translation template file](rcgcdw.pot) and fill out the empty strings under every English sentence. You can use software like Poedit or use your favorite text editor to do that. If you are looking for examples, you can look at [Polish translation](/locale/pl/LC_MESSAGES/rcgcdw.po). After you translate it, you can either send a merge request to the testing branch, or, if you don't know git [contact me directly](https://minecraft.gamepedia.com/User:Frisk#Contact) so I can do this for you.
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
## Overview ##
|
## Overview ##
|
||||||
*Recent changes Gamepedia compatible Discord webhook* is a project made from earlier recent changes module of IRC bot. It has been remade as independent script for public use.
|
*Recent changes Goat compatible Discord webhook* is a project created to track changes on the wiki directly on Discord.
|
||||||
Screenshots of the script in action can be found [on the wiki](https://gitlab.com/piotrex43/RcGcDw/wikis/Presentation).
|
**Screenshots** of the script in action can be found [on the wiki](https://gitlab.com/piotrex43/RcGcDw/wikis/Presentation).
|
||||||
|
|
||||||
### Features ###
|
### Features ###
|
||||||
* Fetch recent changes from Gamepedia wiki and send them to Discord channel using a webhook
|
* Fetch recent changes from MediaWiki wiki and send them to Discord channel using a webhook
|
||||||
* Two appearance modes - embed and compact
|
* Two appearance modes - embed and compact
|
||||||
* Send daily overviews, that show general information about wiki activity
|
* Send daily overviews, that show general information about wiki activity
|
||||||
* Supports multiple languages (included EN, PL, BR, RU, FR, UK)
|
* Supports multiple languages (included EN, PL, BR, RU, FR, UK)
|
||||||
* Re-sends missed edits after start
|
* Re-sends missed edits after start
|
||||||
|
* Very customizable
|
||||||
|
|
||||||
### Dependencies ###
|
### Dependencies ###
|
||||||
* **Python 3.6>**
|
* **Python 3.6>**
|
||||||
|
@ -20,7 +21,7 @@ Screenshots of the script in action can be found [on the wiki](https://gitlab.co
|
||||||
[Explanation for settings](https://gitlab.com/piotrex43/RcGcDw/wikis/settings.json)
|
[Explanation for settings](https://gitlab.com/piotrex43/RcGcDw/wikis/settings.json)
|
||||||
|
|
||||||
### How to use ###
|
### How to use ###
|
||||||
[Refer to the guide on the wiki](https://gitlab.com/piotrex43/RcGcDw/wikis/Guide). If you don't have the means to host it you can request me to host it for you.
|
[Refer to the guide on the wiki](https://gitlab.com/piotrex43/RcGcDw/wikis/Guide).
|
||||||
|
|
||||||
### Contributors ###
|
### Contributors ###
|
||||||
* MarkusRost for enormous help with pointing out bugs, space for improvements and contributing to the code.
|
* MarkusRost for enormous help with pointing out bugs, space for improvements and contributing to the code.
|
||||||
|
|
|
@ -6,7 +6,7 @@ try: # load settings
|
||||||
if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1:
|
if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1:
|
||||||
settings["limitrefetch"] = settings["limit"]
|
settings["limitrefetch"] = settings["limit"]
|
||||||
if "user-agent" in settings["header"]:
|
if "user-agent" in settings["header"]:
|
||||||
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.7.3") # set the version in the useragent
|
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.9") # set the version in the useragent
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
|
logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
2
misc.pot
2
misc.pot
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2019-08-10 16:48+0200\n"
|
"POT-Creation-Date: 2020-03-17 20:53+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
34
misc.py
34
misc.py
|
@ -45,9 +45,9 @@ def generate_datafile():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def load_datafile() -> object:
|
def load_datafile() -> dict:
|
||||||
"""Read a data.json file and return a dictionary with contents
|
"""Read a data.json file and return a dictionary with contents
|
||||||
:rtype: object
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open("data.json") as data:
|
with open("data.json") as data:
|
||||||
|
@ -75,7 +75,7 @@ def weighted_average(value, weight, new_value):
|
||||||
|
|
||||||
def link_formatter(link):
|
def link_formatter(link):
|
||||||
"""Formats a link to not embed it"""
|
"""Formats a link to not embed it"""
|
||||||
return "<" + re.sub(r"([ )])", "\\\\\\1", link) + ">"
|
return "<" + re.sub(r"([)])", "\\\\\\1", link).replace(" ", "_") + ">"
|
||||||
|
|
||||||
|
|
||||||
class ContentParser(HTMLParser):
|
class ContentParser(HTMLParser):
|
||||||
|
@ -147,34 +147,6 @@ class ContentParser(HTMLParser):
|
||||||
self.current_tag = ""
|
self.current_tag = ""
|
||||||
|
|
||||||
|
|
||||||
class LinkParser(HTMLParser):
|
|
||||||
new_string = ""
|
|
||||||
recent_href = ""
|
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
|
||||||
for attr in attrs:
|
|
||||||
if attr[0] == 'href':
|
|
||||||
self.recent_href = attr[1]
|
|
||||||
if self.recent_href.startswith("//"):
|
|
||||||
self.recent_href = "https:{rest}".format(rest=self.recent_href)
|
|
||||||
elif not self.recent_href.startswith("http"):
|
|
||||||
self.recent_href = "https://{wiki}.gamepedia.com".format(wiki=settings["wiki"]) + self.recent_href
|
|
||||||
self.recent_href = self.recent_href.replace(")", "\\)")
|
|
||||||
|
|
||||||
def handle_data(self, data):
|
|
||||||
if self.recent_href:
|
|
||||||
self.new_string = self.new_string + "[{}](<{}>)".format(data, self.recent_href)
|
|
||||||
self.recent_href = ""
|
|
||||||
else:
|
|
||||||
self.new_string = self.new_string + data
|
|
||||||
|
|
||||||
def handle_comment(self, data):
|
|
||||||
self.new_string = self.new_string + data
|
|
||||||
|
|
||||||
def handle_endtag(self, tag):
|
|
||||||
misc_logger.debug(self.new_string)
|
|
||||||
|
|
||||||
|
|
||||||
def safe_read(request, *keys):
|
def safe_read(request, *keys):
|
||||||
if request is None:
|
if request is None:
|
||||||
return None
|
return None
|
||||||
|
|
454
rcgcdw.pot
454
rcgcdw.pot
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"cooldown": 30,
|
"cooldown": 60,
|
||||||
"wiki": "minecraft",
|
"wiki_url": "https://ucp-rail-test.fandom.com/pl/",
|
||||||
"lang": "en",
|
"lang": "en",
|
||||||
"header": {
|
"header": {
|
||||||
"user-agent": "RcGcDw/{version}"
|
"user-agent": "RcGcDw/{version}"
|
||||||
|
@ -77,6 +77,10 @@
|
||||||
"icon":"https://i.imgur.com/egJpa81.png",
|
"icon":"https://i.imgur.com/egJpa81.png",
|
||||||
"color":null
|
"color":null
|
||||||
},
|
},
|
||||||
|
"upload/revert": {
|
||||||
|
"icon": "https://i.imgur.com/egJpa81.png",
|
||||||
|
"color": null
|
||||||
|
},
|
||||||
"delete/delete":{
|
"delete/delete":{
|
||||||
"icon":"https://i.imgur.com/BU77GD3.png",
|
"icon":"https://i.imgur.com/BU77GD3.png",
|
||||||
"color":1
|
"color":1
|
||||||
|
@ -189,6 +193,10 @@
|
||||||
"icon":"",
|
"icon":"",
|
||||||
"color":null
|
"color":null
|
||||||
},
|
},
|
||||||
|
"curseprofile/comment-purged":{
|
||||||
|
"icon":"",
|
||||||
|
"color":null
|
||||||
|
},
|
||||||
"curseprofile/comment-replied":{
|
"curseprofile/comment-replied":{
|
||||||
"icon":"https://i.imgur.com/hkyYsI1.png",
|
"icon":"https://i.imgur.com/hkyYsI1.png",
|
||||||
"color":null
|
"color":null
|
||||||
|
|
Loading…
Reference in a new issue