浏览代码

Link the dashboard

Markus-Rost 4 年之前
父节点
当前提交
d9e215e6c6
共有 7 个文件被更改,包括 58 次插入47 次删除
  1. 5 11
      README.md
  2. 2 1
      cmds/help.js
  3. 33 25
      cmds/rcscript.js
  4. 4 1
      cmds/settings.js
  5. 10 3
      cmds/verification.js
  6. 1 1
      functions/helpsetup.js
  7. 3 5
      i18n/en.json

+ 5 - 11
README.md

@@ -3,10 +3,12 @@
 
 **Wiki-Bot** is a bot for [Discord](https://discord.com/) with the purpose to easily link and search [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) sites like [Gamepedia](https://www.gamepedia.com/) and [Fandom](https://www.fandom.com/) wikis. **Wiki-Bot** shows short descriptions and additional info about pages and is able to resolve redirects and follow interwiki links.
 
-**Wiki-Bot** has translations for English, German, French, Hindi, Dutch, Polish, Portuguese, Russian, Turkish and Chinese.
+**Wiki-Bot** has translations for English, Bengali, German, French, Hindi, Dutch, Polish, Portuguese, Russian, Turkish and Chinese.
 
 [Use this link to invite **Wiki-Bot** to your Discord server.](https://discord.com/oauth2/authorize?client_id=461189216198590464&permissions=939904064&scope=bot)
 
+[Change the server settings for **Wiki-Bot** using the dashboard.](https://settings.wikibot.de/)
+
 Support server: [https://discord.gg/v77RTk5](https://discord.gg/v77RTk5)
 
 #### Table of Contents
@@ -56,21 +58,13 @@ For a full list with all administrator commands use `!wiki help admin`
 | ------- | ----------- |
 | `!wiki help admin` | **Wiki-Bot** will list all administrator commands. |
 | `!wiki settings` | **Wiki-Bot** will change the settings for the server. |
-| `!wiki settings lang <language>` | **Wiki-Bot** will change the language for the server. |
-| `!wiki settings wiki <wiki>` | **Wiki-Bot** will change the default wiki for the server. |
-| `!wiki settings channel` | **Wiki-Bot** will change the channel overwrites for the current channel. |
 | `!wiki verification` | **Wiki-Bot** will change the wiki verifications used by the `!wiki verify` command. |
-| `!wiki verification add <role>` | **Wiki-Bot** will add a new wiki verification. Accepts a `\|` separated list. |
-| `!wiki verification <id> channel <new channel>` | **Wiki-Bot** will change the channel for the wiki verification. Accepts a `\|` separated list. |
-| `!wiki verification <id> role <new role>` | **Wiki-Bot** will change the role for the wiki verification. Accepts a `\|` separated list. |
-| `!wiki verification <id> editcount <new edit count>` | **Wiki-Bot** will change the minimal edit count for the wiki verification. |
-| `!wiki verification <id> usergroup <new user group>` | **Wiki-Bot** will change the user group for the wiki verification. Accepts a `\|` separated list.<br>• Provide `AND` as the first list entry to make all provided user groups required. |
-| `!wiki verification <id> accountage <new account age>` | **Wiki-Bot** will change the minimal account age (in days) for the wiki verification. |
-| `!wiki verification <id> rename` | **Wiki-Bot** will change if the users Discord nickname should be changed to their wiki username for the wiki verification. |
 | `!wiki rcscript` | **Wiki-Bot** will change the recent changes webhook. |
 | `!wiki voice` | **Wiki-Bot** will try to give everyone in a voice channel a specific role. |
 | `!wiki pause @Wiki-Bot` | **Wiki-Bot** will ignore all commands on this server, except a few admin commands. |
 
+Administators can also use the [dashboard](https://settings.wikibot.de/) to change the bot settings.
+
 ## User Verification
 Using the `!wiki verify <wiki username>` command, users are able to verify themselves as a specific wiki user by using the Discord field on their wiki profile. If the user matches and user verifications are set up on the server, **Wiki-Bot** will give them the roles for all verification entries they matched.
 

+ 2 - 1
cmds/help.js

@@ -42,7 +42,6 @@ const helplist = {
 		'help.admin',
 		'settings.default',
 		'verification.default',
-		'help.verification',
 		'rcscript.default',
 		'voice',
 		'pause.inactive'
@@ -94,6 +93,8 @@ function cmd_help(lang, msg, args, line, wiki) {
 			if ( !msg.channel.isGuild() || msg.isAdmin() ) {
 				var cmdlist = lang.get('help.admin') + '\n';
 				cmdlist += formathelp(helplist.admin, msg, lang);
+				cmdlist += '\n🔸 ' + lang.get('help.adminfooter');
+				cmdlist += '\n\t\t' + new URL(( msg.channel.isGuild() ? `/guild/${msg.guild.id}/settings` : '/' ), process.env.dashboard).href;
 				msg.sendChannel( cmdlist, {split:{char:'\n🔹',prepend:'🔹',maxLength}} );
 			}
 			else {

+ 33 - 25
cmds/rcscript.js

@@ -464,7 +464,8 @@ function cmd_rcscript(lang, msg, args, line, wiki) {
 				}
 				return;
 			} ).then( channel => {
-				var text = lang.get('rcscript.current_selected') + '\n';
+				var text = lang.get('rcscript.current_selected', selected_row.configid);
+				text += `\n<${new URL(`/guild/${msg.guild.id}/rcscript/${selected_row.configid}`, process.env.dashboard).href}>\n`;
 				text += '\n' + lang.get('rcscript.channel') + ' <#' + channel + '>\n';
 				text += '\n' + lang.get('rcscript.wiki') + ' <' + selected_row.wiki + '>';
 				text += '\n`' + cmd + ' wiki ' + lang.get('rcscript.new_wiki') + '`\n';
@@ -507,30 +508,37 @@ function cmd_rcscript(lang, msg, args, line, wiki) {
 			rows = rows.filter( row => row.channel );
 			var only = ( rows.length === 1 );
 			var text = '';
-			if ( rows.length ) text += lang.get('rcscript.current') + rows.map( row => {
-				var cmd = prefix + 'rcscript' + ( only ? '' : ' ' + row.configid );
-				var row_text = '\n';
-				if ( !only ) row_text += '\n`' + cmd + '`';
-				row_text += '\n' + lang.get('rcscript.channel') + ' <#' + row.channel + '>';
-				if ( only ) row_text += '\n';
-				row_text += '\n' + lang.get('rcscript.wiki') + ' <' + row.wiki + '>';
-				if ( only ) row_text += '\n`' + cmd + ' wiki ' + lang.get('rcscript.new_wiki') + '`\n';
-				row_text += '\n' + lang.get('rcscript.lang') + ' `' + allLangs.names[row.lang] + '`';
-				if ( only ) row_text += '\n`' + cmd + ' lang ' + lang.get('rcscript.new_lang') + '`\n';
-				row_text += '\n' + lang.get('rcscript.display') + ' `' + display_types[row.display] + '`';
-				if ( only ) row_text += '\n`' + cmd + ' display (' + display.join('|') + ')`\n';
-				if ( row.rcid === -1 ) {
-					row_text += '\n' + lang.get('rcscript.rc') + ' *`' + lang.get('rcscript.disabled' ) + '`*';
-					if ( only ) row_text += '\n`' + cmd + ' feeds only` ' + lang.get('rcscript.toggle') + '\n';
-				}
-				if ( new Wiki(row.wiki).isFandom(false) ) {
-					row_text += '\n' + lang.get('rcscript.feeds') + ' *`' + lang.get('rcscript.' + ( row.wikiid ? 'enabled' : 'disabled' )) + '`*';
-					if ( only ) row_text += '\n' + lang.get('rcscript.help_feeds') + '\n`' + cmd + ' feeds` ' + lang.get('rcscript.toggle') + '\n';
-				}
-				if ( only ) row_text += '\n' + lang.get('rcscript.delete') + '\n`' + cmd + ' delete`\n';
-				return row_text;
-			} ).join('');
-			else text += lang.get('rcscript.missing');
+			if ( rows.length ) {
+				text += lang.get('rcscript.current');
+				text += `\n<${new URL(`/guild/${msg.guild.id}/rcscript`, process.env.dashboard).href}>`;
+				text += rows.map( row => {
+					var cmd = prefix + 'rcscript' + ( only ? '' : ' ' + row.configid );
+					var row_text = '\n';
+					if ( !only ) row_text += '\n`' + cmd + '`';
+					row_text += '\n' + lang.get('rcscript.channel') + ' <#' + row.channel + '>';
+					if ( only ) row_text += '\n';
+					row_text += '\n' + lang.get('rcscript.wiki') + ' <' + row.wiki + '>';
+					if ( only ) row_text += '\n`' + cmd + ' wiki ' + lang.get('rcscript.new_wiki') + '`\n';
+					row_text += '\n' + lang.get('rcscript.lang') + ' `' + allLangs.names[row.lang] + '`';
+					if ( only ) row_text += '\n`' + cmd + ' lang ' + lang.get('rcscript.new_lang') + '`\n';
+					row_text += '\n' + lang.get('rcscript.display') + ' `' + display_types[row.display] + '`';
+					if ( only ) row_text += '\n`' + cmd + ' display (' + display.join('|') + ')`\n';
+					if ( row.rcid === -1 ) {
+						row_text += '\n' + lang.get('rcscript.rc') + ' *`' + lang.get('rcscript.disabled' ) + '`*';
+						if ( only ) row_text += '\n`' + cmd + ' feeds only` ' + lang.get('rcscript.toggle') + '\n';
+					}
+					if ( new Wiki(row.wiki).isFandom(false) ) {
+						row_text += '\n' + lang.get('rcscript.feeds') + ' *`' + lang.get('rcscript.' + ( row.wikiid ? 'enabled' : 'disabled' )) + '`*';
+						if ( only ) row_text += '\n' + lang.get('rcscript.help_feeds') + '\n`' + cmd + ' feeds` ' + lang.get('rcscript.toggle') + '\n';
+					}
+					if ( only ) row_text += '\n' + lang.get('rcscript.delete') + '\n`' + cmd + ' delete`\n';
+					return row_text;
+				} ).join('');
+			}
+			else {
+				text += lang.get('rcscript.missing');
+				text += `\n<${new URL(`/guild/${msg.guild.id}/rcscript`, process.env.dashboard).href}>`;
+			}
 			if ( rows.length < limit ) text += '\n\n' + lang.get('rcscript.add_more') + '\n`' + prefix + 'rcscript add ' + lang.get('rcscript.new_wiki') + '`';
 			msg.replyMsg( text, {split:true}, true );
 		} );

+ 4 - 1
cmds/settings.js

@@ -37,7 +37,9 @@ function cmd_settings(lang, msg, args, line, wiki) {
 		var inlinepage = ( lang.localNames.page || 'page' );
 		var text = lang.get('settings.missing', '`' + prefix + 'settings lang`', '`' + prefix + 'settings wiki`');
 		if ( rows.length ) {
-			text = lang.get('settings.current') + '\n' + lang.get('settings.currentlang') + ' `' + allLangs.names[guild.lang] + '` - `' + prefix + 'settings lang`';
+			text = lang.get('settings.current');
+			text += `\n<${new URL(`/guild/${msg.guild.id}/settings`, process.env.dashboard).href}>`;
+			text += '\n' + lang.get('settings.currentlang') + ' `' + allLangs.names[guild.lang] + '` - `' + prefix + 'settings lang`';
 			if ( msg.guild.id in patreons ) text += '\n' + lang.get('settings.currentprefix') + ' `' + prefix + '` - `' + prefix + 'settings prefix`';
 			text += '\n' + lang.get('settings.currentinline') + ' ' + ( guild.inline ? '~~' : '' ) + '`[[' + inlinepage + ']]`' + ( guild.inline ? '~~' : '' ) + ' - `' + prefix + 'settings inline`';
 			text += '\n' + lang.get('settings.currentwiki') + ' ' + guild.wiki + ' - `' + prefix + 'settings wiki`';
@@ -59,6 +61,7 @@ function cmd_settings(lang, msg, args, line, wiki) {
 			var channel = rows.find( row => row.channel === msg.channel.id );
 			if ( !channel ) channel = Object.assign({channel:msg.channel.id}, guild);
 			text = lang.get('settings.' + prelang + 'current');
+			text += `\n<${new URL(`/guild/${msg.guild.id}/settings/${msg.channel.id}`, process.env.dashboard).href}>`;
 			if ( msg.guild.id in patreons ) {
 				text += '\n' + lang.get('settings.currentlang') + ' `' + allLangs.names[channel.lang] + '` - `' + prefix + 'settings channel lang`';
 				text += '\n' + lang.get('settings.currentinline') + ' ' + ( channel.inline ? '~~' : '' ) + '`[[' + inlinepage + ']]`' + ( channel.inline ? '~~' : '' ) + ' - `' + prefix + 'settings channel inline`';

+ 10 - 3
cmds/verification.js

@@ -68,8 +68,15 @@ function cmd_verification(lang, msg, args, line, wiki) {
 				return;
 			}
 			var text = '';
-			if ( rows.length ) text += lang.get('verification.current') + rows.map( row => formatVerification(false, true, row) ).join('');
-			else text += lang.get('verification.missing');
+			if ( rows.length ) {
+				text += lang.get('verification.current');
+				text += `\n<${new URL(`/guild/${msg.guild.id}/verification`, process.env.dashboard).href}>`;
+				text += rows.map( row => formatVerification(false, true, row) ).join('');
+			}
+			else {
+				text += lang.get('verification.missing');
+				text += `\n<${new URL(`/guild/${msg.guild.id}/verification`, process.env.dashboard).href}>`;
+			}
 			text += '\n\n' + lang.get('verification.add_more') + '\n`' + prefix + 'verification add ' + lang.get('verification.new_role') + '`';
 			return msg.sendChannel( '<@' + msg.author.id + '>, ' + text, {split:true}, true );
 		}
@@ -224,7 +231,7 @@ function cmd_verification(lang, msg, args, line, wiki) {
 				} ) );
 			}
 		}
-		return msg.sendChannel( '<@' + msg.author.id + '>, ' + lang.get('verification.current_selected', row.configid) + formatVerification(true) +'\n\n' + lang.get('verification.delete_current') + '\n`' + prefix + 'verification ' + row.configid + ' delete`', {split:true}, true );
+		return msg.sendChannel( '<@' + msg.author.id + '>, ' + lang.get('verification.current_selected', row.configid) + `\n<${new URL(`/guild/${msg.guild.id}/verification/${row.configid}`, process.env.dashboard).href}>` + formatVerification(true) +'\n\n' + lang.get('verification.delete_current') + '\n`' + prefix + 'verification ' + row.configid + ' delete`', {split:true}, true );
 		
 		function formatVerification(showCommands, hideNotice, {
 			configid,

+ 1 - 1
functions/helpsetup.js

@@ -5,7 +5,7 @@
  */
 function help_setup(lang, msg) {
 	msg.defaultSettings = false;
-	msg.replyMsg( lang.get('settings.missing', '`' + process.env.prefix + 'settings lang`', '`' + process.env.prefix + 'settings wiki`') );
+	msg.replyMsg( lang.get('general.default', '`' + process.env.prefix + 'settings`') + '\n' + new URL(`/guild/${msg.guild.id}/settings`, process.env.dashboard).href );
 }
 
 module.exports = help_setup;

+ 3 - 5
i18n/en.json

@@ -144,6 +144,7 @@
         " "
     ],
     "general": {
+        "default": "this server isn't set up yet. Use $1 or the dashboard to change the settings.",
         "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:",
         "experimental": "**This feature is experimental! It is not guaranteed to work correctly and may be removed in the future.**",
         "helpserver": "For questions and problems please visit my support server:",
@@ -155,6 +156,7 @@
     },
     "help": {
         "admin": "These commands can only be performed by administrators:",
+        "adminfooter": "Administrators can also use the dashboard to change the bot settings:",
         "all": "So, you want to know what things I can do? Here is a list of all commands that I understand:",
         "footer": "If you got an unwanted response, you can react with 🗑️ (`:wastebasket:`) to my message and I will delete it.",
         "list": {
@@ -202,10 +204,6 @@
                 "default": {
                     "cmd": "help",
                     "desc": "I will list all the commands that I understand."
-                },
-                "verification": {
-                    "cmd": "help verification",
-                    "desc": "I will explain in more detail how the verification command works."
                 }
             },
             "info": {
@@ -444,7 +442,7 @@
         "current": "these are the current recent changes webhooks for this server:",
         "current_display": "the display mode for this webhook is:",
         "current_lang": "the language for this webhook is:",
-        "current_selected": "this is the recent changes webhook for this server:",
+        "current_selected": "this is the recent changes webhook `$1` for this server:",
         "current_wiki": "the wiki for this webhook is:",
         "dashboard": {
             "added": "$1 added the recent changes webhook with id `$2`.",