From 4ea772d3a119dd6ba4bf0cc61ed7a657bf3fb9dd Mon Sep 17 00:00:00 2001 From: "Leomotors (WSL)" <59821765+Leomotors@users.noreply.github.com> Date: Thu, 8 Apr 2021 20:01:03 +0700 Subject: [PATCH] Change activity location --- README.md | 2 ++ assets/json/activity.json | 12 ++++++++++++ bot.js | 12 ++++++------ bot_settings.json | 12 +----------- docs/bot_settings.md | 4 ---- 5 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 assets/json/activity.json diff --git a/README.md b/README.md index 5e2d9a0..594914d 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Manual Training a.k.a hard code (Idk what to do 😅) ```./assets/json/``` +* activity.json : Status bot can use + * keywords.json : Keywords to trigger น้อน * morequotes.json : Aggressive stuff for น้อน to say on top of narze's repo's quote diff --git a/assets/json/activity.json b/assets/json/activity.json new file mode 100644 index 0000000..31ef522 --- /dev/null +++ b/assets/json/activity.json @@ -0,0 +1,12 @@ +{ + "activities": [ + { + "type": "WATCHING", + "name": "TOP NEWS" + }, + { + "type": "PLAYING", + "name": "Escape FishStop 3D" + } + ] +} \ No newline at end of file diff --git a/bot.js b/bot.js index fe1a09b..6ff041f 100644 --- a/bot.js +++ b/bot.js @@ -13,6 +13,7 @@ const salimDict = require("./assets/json/keywords.json") const moreWord = require("./assets/json/morequotes.json") const bot_settings = require("./bot_settings.json") const songs = require("./assets/music/songs.json") +const activity_list = require("./assets/json/activity.json").activities // * Import required module & function const request = require("request") @@ -78,15 +79,14 @@ client.on("ready", () => { }) function setStatus(id = -1, isDebug = false) { - let ac_list = bot_settings.activity_list if (id == -1) - id = Math.floor(Math.random() * ac_list.length) - client.user.setActivity(`${ac_list[id].name}`, { type: ac_list[id].type }) + id = Math.floor(Math.random() * activity_list.length) + client.user.setActivity(`${activity_list[id].name}`, { type: activity_list[id].type }) .then(presence => { if (isDebug) - logconsole(`Activity changed to ${presence.activities[0].name}`, "DEBUG") + logconsole(`Activity changed to ${presence.activities[0].type} ${presence.activities[0].name}`, "DEBUG") else - console.log(`[PRESENCE SETTED] Activity set to ${presence.activities[0].name}`) + console.log(`[PRESENCE SETTED] Activity set to ${presence.activities[0].type} ${presence.activities[0].name}`) }) .catch(console.error) } @@ -350,7 +350,7 @@ function debug(commandstr) { case "status": console.log("Showing all activities available") let a_index = 0 - for (let activity of bot_settings.activity_list) { + for (let activity of activity_list) { console.log(`#${a_index} ${activity.type} ${activity.name}`) a_index++ } diff --git a/bot_settings.json b/bot_settings.json index 1d59975..e430f6a 100644 --- a/bot_settings.json +++ b/bot_settings.json @@ -2,15 +2,5 @@ "allow_vc": true, "python_prefix": "python", "do_log": true, - "message_cache": 10, - "activity_list": [ - { - "type": "WATCHING", - "name": "TOP NEWS" - }, - { - "type": "PLAYING", - "name": "Escape FishStop 3D" - } - ] + "message_cache": 10 } \ No newline at end of file diff --git a/docs/bot_settings.md b/docs/bot_settings.md index b2c107a..2265f0d 100644 --- a/docs/bot_settings.md +++ b/docs/bot_settings.md @@ -17,7 +17,3 @@ Save bot log to file ## message_cache (Default: 10) Number of last sent messages that bot will keep - -## activity_list - -All Activity able to use in array, Each Activity is dictionary consists of type and name