Procházet zdrojové kódy

Seperate config options for mentions and author ID styling

Owen Diffey před 5 roky
rodič
revize
2be0831c27
3 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 1 1
      README.md
  2. 1 0
      config.json.example
  3. 2 2
      index.js

+ 1 - 1
README.md

@@ -14,7 +14,7 @@ I made this realy quick for a friend, so don't expect much.
   1. First make shure that you have the latest version of [node js](https://nodejs.org/en/) installed.
   2. Run this command in a command prompt to install all the libraries required to run the code: ``` npm i mysql discord.js ``` .
   3. Copy the example and open the config file and add your bot key.
-  4. Next put all the required setting about wich channel would you like to be checked (Put the ID that can be obtained by right clicking on the channel name on the channel list), and all the information reguarding the database you'd like the information to be sent. Note that you can put as much channels and server as you want as the 'servers' parameter is an array. Also here you are able to choose how the name of the user is save in the database with the setting 'mentionsMode'. This is for each server individualy and my default it's setted to the tag (username + discriminator), if you set it to 0 you get the id, if you set it 1 it sends the username only, anything else goes to default value.
+  4. Next put all the required setting about wich channel would you like to be checked (Put the ID that can be obtained by right clicking on the channel name on the channel list), and all the information reguarding the database you'd like the information to be sent. Note that you can put as much channels and server as you want as the 'servers' parameter is an array. Also here you are able to choose how the name of the user is save in the database with the setting 'mentionsMode' and 'authorMode'. This is for each server individualy and my default it's setted to the tag (username + discriminator), if you set it to 0 you get the id, if you set it 1 it sends the username only, anything else goes to default value.
   5. Save and with the help of the [developer portal on the discord website](https://discordapp.com/developers) make your bot join the server in wich the channel to check is present.
   6. Setup the database table with the following query, replacing "TABLE_NAME" as appropriate.
   ```

+ 1 - 0
config.json.example

@@ -4,6 +4,7 @@
 		{
 			"channel": "DISCORD_CHANNEL",
 			"mentionsMode": "2",
+			"authorMode": "2",
 			"dbHost": "MYSQL_HOST",
 			"dbUser": "MYSQL_USER",
 			"dbPassword": "MYSQL_PASSWORD",

+ 2 - 2
index.js

@@ -63,9 +63,9 @@ client.on('message', message => {
 		}
 	}
 
-	if (serverData.mentionsMode == 0) {
+	if (serverData.authorMode == 0) {
 		var author = message.author.id;
-	} else if (serverData.mentionsMode == 1) {
+	} else if (serverData.authorMode == 1) {
 		var author = message.author.username;
 	} else {
 		var author = message.author.tag;