Browse Source

add rcscript to help

Markus-Rost 4 years ago
parent
commit
5a0ea73a38
5 changed files with 50 additions and 11 deletions
  1. 10 6
      cmds/help.js
  2. 1 1
      functions/special_page.js
  3. 1 1
      i18n/de.json
  4. 36 2
      i18n/en.json
  5. 2 1
      package.json

+ 10 - 6
cmds/help.js

@@ -1,7 +1,8 @@
 const help_server = require('../functions/helpserver.js');
 
 const helpmap = {
-	link: ['default', 'inline.link', 'inline.template', 'gamepedia', 'fandom', 'wikia'],
+	linkHelp: ['default', 'inline.link', 'inline.template', 'gamepedia', 'fandom', 'wikia'],
+	link: ['default', 'inline.link', 'inline.template', 'gamepedia', 'fandom', 'wikia', 'mwprojects'],
 	inline: ['inline.link', 'inline.template'],
 	user: ['user'],
 	overview: ['overview'],
@@ -9,7 +10,7 @@ const helpmap = {
 	diff: ['diff.name', 'diff.id'],
 	page: ['page'],
 	search: ['search'],
-	minecraft: ['minecraft.default', 'minecraft.bug'],
+	minecraftHelp: ['minecraft.default', 'minecraft.bug'],
 	command: ['minecraft.default', 'minecraft.command'],
 	bug: ['minecraft.bug'],
 	discussion: ['discussion.thread', 'discussion.post'],
@@ -18,6 +19,7 @@ const helpmap = {
 	settings: ['settings.default', 'settings.wiki', 'settings.lang', 'settings.inline', 'settings.prefix', 'settings.channel'],
 	verify: ['verify'],
 	verification: ['verification.default', 'verification.add', 'verification.channel', 'verification.role', 'verification.editcount', 'verification.usergroup', 'verification.accountage', 'verification.rename', 'verification.delete'],
+	rcscript: ['rcscript.default', 'rcscript.add', 'rcscript.wiki', 'rcscript.lang', 'rcscript.display', 'rcscript.feeds', 'rcscript.delete'],
 	voice: ['voice'],
 	pause: ['pause.inactive'],
 	test: ['test'],
@@ -25,12 +27,12 @@ const helpmap = {
 
 const helplist = {
 	default: [
-		'link',
+		'linkHelp',
 		'user',
 		'overview',
 		'random',
 		'diff',
-		'minecraft',
+		'minecraftHelp',
 		'discussion',
 		'info',
 		'help',
@@ -41,6 +43,7 @@ const helplist = {
 		'settings.default',
 		'verification.default',
 		'help.verification',
+		'rcscript.default',
 		'voice',
 		'pause.inactive'
 	],
@@ -48,6 +51,7 @@ const helplist = {
 		'pause.active',
 		'settings.default',
 		'verification.default',
+		'rcscript.default',
 		'voice',
 		'test'
 	],
@@ -60,9 +64,9 @@ const helplist = {
 const restrictions = {
 	fandom: ['discussion'],
 	minecraft: ['command', 'bug'],
-	admin: ['settings', 'verification', 'voice', 'pause'],
+	admin: ['settings', 'verification', 'rcscript', 'voice', 'pause'],
 	inline: ['inline.link', 'inline.template'],
-	patreon: ['settings.prefix']
+	patreon: ['settings.prefix', 'rcscript.default', 'rcscript.add', 'rcscript.wiki', 'rcscript.lang', 'rcscript.display', 'rcscript.feeds', 'rcscript.delete']
 }
 
 /**

+ 1 - 1
functions/special_page.js

@@ -127,7 +127,7 @@ function special_page(lang, msg, title, specialpage, embed, wiki, reaction, spoi
 		return;
 	}
 	if ( specialpage === 'recentchanges' && msg.isAdmin() && msg.guild.id in patreons ) {
-		embed.addField( lang.get('rcscript.title'), lang.get('rcscript.ad', ( patreons[msg?.guild?.id] || process.env.prefix )) );
+		embed.addField( lang.get('rcscript.title'), lang.get('rcscript.ad', ( patreons[msg?.guild?.id] || process.env.prefix ), '[RcGcDw](https://gitlab.com/piotrex43/RcGcDw)') );
 	}
 	got.get( wiki + 'api.php?action=query&meta=siteinfo|allmessages&siprop=general&amenableparser=true&amtitle=' + encodeURIComponent( title ) + '&ammessages=' + ( specialpage in descriptions ? descriptions[specialpage] : encodeURIComponent( specialpage ) + '-summary' ) + ( specialpage in querypages ? querypages[specialpage][0] : '' ) + '&format=json', {
 		responseType: 'json'

+ 1 - 1
i18n/de.json

@@ -20,7 +20,7 @@
 	"prefix": "das Präfix für diesen Server ist `$1`. Du kannst das Präfix mit `$1settings prefix` ändern. Für eine Liste aller Befehle nutze `$1hilfe`.",
 	"missingperm": "mir fehlen einige Berechtigungen für diesen Befehl:",
 	"limit": "🚨 **Stop, du hast ein Limit erreicht!** 🚨\n\n$1, deine Nachricht enthält zu viele Befehle!",
-	"disclaimer": "Ich bin ein kleiner Bot mit der Aufgabe auf Gamepedia- und Fandom-Wikis zu verlinken. Geschrieben wurde ich von $1 in JavaScript.\n\n**Ich stehe in keinem Zusammenhang mit Fandom und bin ein inoffizieller Bot!**\n\nDu kannst mich auf Patreon unterstützen:",
+	"disclaimer": "Ich bin ein kleiner Bot mit der Aufgabe einfach auf MediaWiki Websites, wie Gamepedia- und Fandom-Wikis, zu verlinken und diese zu durchsuchen. Ich zeige kurze Beschreibungen und zusätliche Informationen zu Seiten und kann Weiterleitungen auflösen und Interwiki-Links folgen. Geschrieben wurde ich von $1 in JavaScript.\n\nDu kannst mich auf Patreon unterstützen:",
 	"helpserver": "Bei Fragen oder Problemen besuche bitte meinen Support-Server:",
 	"patreon": "dies ist eine Patreon-Funktion!\nDu kannst mich auf Patreon unterstützen um Zugang zu dieser Funktion zu erhalten:",
 	"settings": {

+ 36 - 2
i18n/en.json

@@ -14,7 +14,7 @@
 	"prefix": "the prefix for this server is `$1`. You can change the prefix with `$1settings prefix`. For a list of all commands see `$1help`.",
 	"missingperm": "I'm missing some permissions for this command:",
 	"limit": "🚨 **Stop, you hit a limit!** 🚨\n\n$1, your message contained too many commands!",
-	"disclaimer": "I am a small bot with the task to link to Gamepedia and Fandom wikis. $1 wrote me in JavaScript.\n\n**I am not affiliated with Fandom and am an unofficial tool!**\n\nYou can support me on Patreon:",
+	"disclaimer": "I am a small bot with the purpose to easily link and search MediaWiki sites like Gamepedia and Fandom wikis. I show short descriptions and additional info about pages and am able to resolve redirects and follow interwiki links. $1 wrote me in JavaScript.\n\nYou can support me on Patreon:",
 	"helpserver": "For questions and problems please visit my support server:",
 	"patreon": "this is a Patreon only feature!\nYou can support me on Patreon to get access to this feature:",
 	"settings": {
@@ -153,7 +153,7 @@
 	},
 	"rcscript": {
 		"title": "Recent changes webhook",
-		"ad": "You want recent changes directly in Discord? Use `$1rcscript` to add a **Recent changes Goat compatible Discord webhook** to your Discord server!",
+		"ad": "You want recent changes directly in Discord? Use `$1rcscript` to add a recent changes webhook based on **$2** to your Discord server!",
 		"missing": "there are no recent changes webhooks for this server yet.",
 		"current": "these are the current recent changes webhooks for this server:",
 		"current_selected": "this is the recent changes webhook for this server:",
@@ -398,6 +398,10 @@
 				"cmd": "??<wiki> <search term>",
 				"desc": "I will answer with a link to a matching article in the named Wikia wiki: `https://<wiki>.wikia.org/`"
 			},
+			"mwprojects": {
+				"cmd": "!!<wiki> <search term>",
+				"desc": "I will answer with a link to a matching article in the named MediaWiki project. Example: `$1!!en.wikipedia.org Cookie`"
+			},
 			"user": {
 				"cmd": "User:<username>",
 				"desc": "I will show some information about the user."
@@ -542,6 +546,36 @@
 					"desc": "I will delete the wiki verification."
 				}
 			},
+			"rcscript": {
+				"default": {
+					"cmd": "rcscript",
+					"desc": "I will change the recent changes webhook."
+				},
+				"add": {
+					"cmd": "rcscript add [<wiki>]",
+					"desc": "I will add a new recent changes webhook."
+				},
+				"wiki": {
+					"cmd": "rcscript wiki <new wiki>",
+					"desc": "I will change the wiki for the recent changes webhook."
+				},
+				"lang": {
+					"cmd": "rcscript lang <new language>",
+					"desc": "I will change the language for the recent changes webhook."
+				},
+				"display": {
+					"cmd": "rcscript display <new display mode>",
+					"desc": "I will change the display mode for the recent changes webhook."
+				},
+				"feeds": {
+					"cmd": "rcscript feeds",
+					"desc": "I will toggle discussions changes on a Fandom wiki for the recent changes webhook."
+				},
+				"delete": {
+					"cmd": "rcscript delete",
+					"desc": "I will delete the recent changes webhook."
+				}
+			},
 			"voice": {
 				"cmd": "voice",
 				"desc": "I try to give everyone in a voice channel a specific role."

+ 2 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "discord-wiki-bot",
   "version": "2.3.0",
-  "description": "Wiki-Bot is a bot with the purpose to easily search for and link to wiki pages. Wiki-Bot shows short descriptions and additional info about the pages and is able to resolve redirects and follow interwiki links.",
+  "description": "Wiki-Bot is a bot with the purpose to easily search for and link to wiki pages. Wiki-Bot shows short descriptions and additional info about pages and is able to resolve redirects and follow interwiki links.",
   "main": "main.js",
   "scripts": {
     "test": "node main.js debug",
@@ -27,6 +27,7 @@
     "url": "git+https://github.com/Markus-Rost/discord-wiki-bot.git"
   },
   "keywords": [
+    "mediawiki",
     "fandom",
     "gamepedia",
     "wikia",