Skip to content

Commit

Permalink
Change activity location
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Apr 8, 2021
1 parent 7bd6a2f commit 4ea772d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions assets/json/activity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"activities": [
{
"type": "WATCHING",
"name": "TOP NEWS"
},
{
"type": "PLAYING",
"name": "Escape FishStop 3D"
}
]
}
12 changes: 6 additions & 6 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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++
}
Expand Down
12 changes: 1 addition & 11 deletions bot_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 0 additions & 4 deletions docs/bot_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4ea772d

Please sign in to comment.