Skip to content

Commit b0cef6c

Browse files
authoredJan 30, 2025
Get steam profile mod
yeah because some of yall dont know how to use steam apis
1 parent efa429c commit b0cef6c

16 files changed

+1594
-1298
lines changed
 

‎Actions/checkIfText_MOD.js

+149-149
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,150 @@
1-
modVersion = "s.v1.0"
2-
module.exports = {
3-
data: {
4-
name: "Check If Text",
5-
},
6-
info: {
7-
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
8-
creator: "Acedia QOLs",
9-
donate: "https://ko-fi.com/slothyacedia",
10-
},
11-
category: "Text",
12-
modules: [],
13-
UI: [
14-
{
15-
element: "largeInput",
16-
storeAs: "sourceText",
17-
name: "Source Text",
18-
},
19-
{
20-
element: "typedDropdown",
21-
storeAs: "criteria",
22-
name: "Check If Text",
23-
choices: {
24-
startsWith: {name: "Starts With", field: false},
25-
endsWith: {name: "Ends With", field: false},
26-
includes: {name: "Includes", field: false},
27-
equals: {name: "Equals", field: false},
28-
matchesRegex: {name: "Matches Regex", field: false}
29-
}
30-
},
31-
{
32-
element: "largeInput",
33-
storeAs: "lookup",
34-
name: "Text"
35-
},
36-
{
37-
element: "condition",
38-
storeAs: "true",
39-
storeActionsAs: "trueActions",
40-
name: "If True"
41-
},
42-
{
43-
element: "condition",
44-
storeAs: "false",
45-
storeActionsAs: "falseActions",
46-
name: "If False"
47-
},
48-
{
49-
element: "text",
50-
text: modVersion,
51-
}
52-
],
53-
54-
script: (values) => {
55-
function refreshElements(skipAnimation){
56-
type = values.data.criteria.type
57-
switch(type){
58-
case "matchesRegex":
59-
values.UI[2].name = "Regex Term"
60-
break
61-
62-
default:
63-
values.UI[2].name = "Text"
64-
break
65-
}
66-
67-
setTimeout(()=>{
68-
values.updateUI()
69-
}, skipAnimation?1: values.commonAnimation*100)
70-
}
71-
72-
refreshElements(true)
73-
74-
values.events.on("change", ()=>{
75-
refreshElements()
76-
})
77-
},
78-
79-
subtitle: (values) => {
80-
let looktype
81-
switch (values.criteria.type){
82-
case "startsWith":
83-
looktype = `Starts With`
84-
break
85-
86-
case "endsWith":
87-
looktype = `Ends With`
88-
break
89-
90-
case "includes":
91-
looktype = `Includes`
92-
break
93-
94-
case "equals":
95-
looktype = `Equals`
96-
break
97-
98-
case "matchesRegex":
99-
looktype = `Matches Regex`
100-
break
101-
}
102-
return `Check If Text ${looktype} "${values.lookup||""}"`
103-
},
104-
105-
compatibility: ["Any"],
106-
107-
async run(values, message, client, bridge){
108-
srcTxt = bridge.transf(values.sourceText)
109-
lookFor = bridge.transf(values.lookup)
110-
criterion = bridge.transf(values.criteria.type)
111-
112-
let result = false
113-
114-
switch (criterion) {
115-
case "startsWith":
116-
if (srcTxt.startsWith(lookFor)){
117-
result = true
118-
}
119-
break
120-
121-
case "endsWith":
122-
if (srcTxt.endsWith(lookFor)){
123-
result = true
124-
}
125-
break
126-
127-
case "includes":
128-
if (srcTxt.includes(lookFor)){
129-
result = true
130-
}
131-
break
132-
133-
case "equals":
134-
if (srcTxt === lookFor){
135-
result = true
136-
}
137-
break
138-
139-
case "matchesRegex":
140-
if (srcTxt.match(new RegExp("^" + lookFor + "$", "i"))){
141-
result = true
142-
}
143-
break
144-
}
145-
146-
if (result == true){
147-
await bridge.call(values.true, values.trueActions)
148-
} else if (result == false){await bridge.call(values.false, values.falseActions)}
149-
}
1+
modVersion = "s.v1.0"
2+
module.exports = {
3+
data: {
4+
name: "Check If Text",
5+
},
6+
info: {
7+
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
8+
creator: "Acedia QOLs",
9+
donate: "https://ko-fi.com/slothyacedia",
10+
},
11+
category: "Text",
12+
modules: [],
13+
UI: [
14+
{
15+
element: "largeInput",
16+
storeAs: "sourceText",
17+
name: "Source Text",
18+
},
19+
{
20+
element: "typedDropdown",
21+
storeAs: "criteria",
22+
name: "Check If Text",
23+
choices: {
24+
startsWith: {name: "Starts With", field: false},
25+
endsWith: {name: "Ends With", field: false},
26+
includes: {name: "Includes", field: false},
27+
equals: {name: "Equals", field: false},
28+
matchesRegex: {name: "Matches Regex", field: false}
29+
}
30+
},
31+
{
32+
element: "largeInput",
33+
storeAs: "lookup",
34+
name: "Text"
35+
},
36+
{
37+
element: "condition",
38+
storeAs: "true",
39+
storeActionsAs: "trueActions",
40+
name: "If True"
41+
},
42+
{
43+
element: "condition",
44+
storeAs: "false",
45+
storeActionsAs: "falseActions",
46+
name: "If False"
47+
},
48+
{
49+
element: "text",
50+
text: modVersion,
51+
}
52+
],
53+
54+
script: (values) => {
55+
function refreshElements(skipAnimation){
56+
type = values.data.criteria.type
57+
switch(type){
58+
case "matchesRegex":
59+
values.UI[2].name = "Regex Term"
60+
break
61+
62+
default:
63+
values.UI[2].name = "Text"
64+
break
65+
}
66+
67+
setTimeout(()=>{
68+
values.updateUI()
69+
}, skipAnimation?1: values.commonAnimation*100)
70+
}
71+
72+
refreshElements(true)
73+
74+
values.events.on("change", ()=>{
75+
refreshElements()
76+
})
77+
},
78+
79+
subtitle: (values) => {
80+
let looktype
81+
switch (values.criteria.type){
82+
case "startsWith":
83+
looktype = `Starts With`
84+
break
85+
86+
case "endsWith":
87+
looktype = `Ends With`
88+
break
89+
90+
case "includes":
91+
looktype = `Includes`
92+
break
93+
94+
case "equals":
95+
looktype = `Equals`
96+
break
97+
98+
case "matchesRegex":
99+
looktype = `Matches Regex`
100+
break
101+
}
102+
return `Check If Text ${looktype} "${values.lookup||""}"`
103+
},
104+
105+
compatibility: ["Any"],
106+
107+
async run(values, message, client, bridge){
108+
srcTxt = bridge.transf(values.sourceText)
109+
lookFor = bridge.transf(values.lookup)
110+
criterion = bridge.transf(values.criteria.type)
111+
112+
let result = false
113+
114+
switch (criterion) {
115+
case "startsWith":
116+
if (srcTxt.startsWith(lookFor)){
117+
result = true
118+
}
119+
break
120+
121+
case "endsWith":
122+
if (srcTxt.endsWith(lookFor)){
123+
result = true
124+
}
125+
break
126+
127+
case "includes":
128+
if (srcTxt.includes(lookFor)){
129+
result = true
130+
}
131+
break
132+
133+
case "equals":
134+
if (srcTxt === lookFor){
135+
result = true
136+
}
137+
break
138+
139+
case "matchesRegex":
140+
if (srcTxt.match(new RegExp("^" + lookFor + "$", "i"))){
141+
result = true
142+
}
143+
break
144+
}
145+
146+
if (result == true){
147+
await bridge.call(values.true, values.trueActions)
148+
} else if (result == false){await bridge.call(values.false, values.falseActions)}
149+
}
150150
}

‎Actions/createFile.js

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
modVersion = "s.v1.0 | AceFix"
2-
module.exports = {
3-
data: {
4-
name: "Create File",
5-
},
6-
category: "Files",
7-
info: {
8-
source: "https://github.com/slothyace/bmods-acedia/tree/main/Fixes",
9-
creator: "Acedia Fixes",
10-
donate: "https://ko-fi.com/slothyacedia"
11-
},
12-
UI: [
13-
{
14-
element: "input",
15-
name: "Path",
16-
storeAs: "path"
17-
},
18-
"-",
19-
{
20-
element: "largeInput",
21-
placeholder: "File Text Content",
22-
storeAs: "content",
23-
name: "Content"
24-
},
25-
{
26-
element: "text",
27-
text: modVersion
28-
}
29-
],
30-
subtitle: (data) => {
31-
return `Path: ${data.path} - Content: ${data.content}`
32-
},
33-
compatibility: ["Any"],
34-
run(values, message, client, bridge) {
35-
let fs = bridge.fs;
36-
37-
fs.writeFileSync(bridge.transf(values.path), bridge.transf(values.content))
38-
},
39-
};
1+
modVersion = "s.v1.0 | AceFix"
2+
module.exports = {
3+
data: {
4+
name: "Create File",
5+
},
6+
category: "Files",
7+
info: {
8+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Fixes",
9+
creator: "Acedia Fixes",
10+
donate: "https://ko-fi.com/slothyacedia"
11+
},
12+
UI: [
13+
{
14+
element: "input",
15+
name: "Path",
16+
storeAs: "path"
17+
},
18+
"-",
19+
{
20+
element: "largeInput",
21+
placeholder: "File Text Content",
22+
storeAs: "content",
23+
name: "Content"
24+
},
25+
{
26+
element: "text",
27+
text: modVersion
28+
}
29+
],
30+
subtitle: (data) => {
31+
return `Path: ${data.path} - Content: ${data.content}`
32+
},
33+
compatibility: ["Any"],
34+
run(values, message, client, bridge) {
35+
let fs = bridge.fs;
36+
37+
fs.writeFileSync(bridge.transf(values.path), bridge.transf(values.content))
38+
},
39+
};

‎Actions/execute.js

+52-52
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
modVersion = "s.v1.1 | AceFix"
2-
module.exports = {
3-
data: {
4-
name: "Execute",
5-
},
6-
info: {
7-
source: "https://github.com/slothyace/bmods-acedia/tree/main/Fixes",
8-
creator: "Acedia Fixes",
9-
donate: "https://ko-fi.com/slothyacedia"
10-
},
11-
UI: [
12-
{
13-
element: "largeInput",
14-
storeAs: "command",
15-
name: "Command",
16-
max: 5000000
17-
},
18-
"-",
19-
{
20-
element: "storage",
21-
storeAs: "result",
22-
name: "Store Result As"
23-
},
24-
{
25-
element: "text",
26-
text: modVersion,
27-
}
28-
],
29-
category: "Control",
30-
subtitle: (values, constants) => {
31-
return `Store Result As: ${constants.variable(values.result)}`
32-
},
33-
34-
async run(values, command, client, bridge) {
35-
await client.getMods().require("child_process")
36-
await new Promise((res, rej) => {
37-
let toExec = String.raw`${bridge.transf(values.command)}`
38-
require('child_process').exec(toExec, (error, stdout, stderr) => {
39-
if (error) {
40-
bridge.store(values.result, `Error: ${error.message}`)
41-
return res()
42-
}
43-
if (stderr) {
44-
bridge.store(values.result, `Stderr: ${stderr}`)
45-
return res()
46-
}
47-
bridge.store(values.result, stdout)
48-
res()
49-
})
50-
})
51-
}
52-
}
1+
modVersion = "s.v1.1 | AceFix"
2+
module.exports = {
3+
data: {
4+
name: "Execute",
5+
},
6+
info: {
7+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Fixes",
8+
creator: "Acedia Fixes",
9+
donate: "https://ko-fi.com/slothyacedia"
10+
},
11+
UI: [
12+
{
13+
element: "largeInput",
14+
storeAs: "command",
15+
name: "Command",
16+
max: 5000000
17+
},
18+
"-",
19+
{
20+
element: "storage",
21+
storeAs: "result",
22+
name: "Store Result As"
23+
},
24+
{
25+
element: "text",
26+
text: modVersion,
27+
}
28+
],
29+
category: "Control",
30+
subtitle: (values, constants) => {
31+
return `Store Result As: ${constants.variable(values.result)}`
32+
},
33+
34+
async run(values, command, client, bridge) {
35+
await client.getMods().require("child_process")
36+
await new Promise((res, rej) => {
37+
let toExec = String.raw`${bridge.transf(values.command)}`
38+
require('child_process').exec(toExec, (error, stdout, stderr) => {
39+
if (error) {
40+
bridge.store(values.result, `Error: ${error.message}`)
41+
return res()
42+
}
43+
if (stderr) {
44+
bridge.store(values.result, `Stderr: ${stderr}`)
45+
return res()
46+
}
47+
bridge.store(values.result, stdout)
48+
res()
49+
})
50+
})
51+
}
52+
}

‎Actions/extractSteamSummary.js

+212
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
modVersion = "s.v1.0"
2+
module.exports = {
3+
data: {
4+
name: "Extract Steam Summary"
5+
},
6+
aliases: [],
7+
modules: [],
8+
category: "",
9+
info: {
10+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
11+
creator: "Acedia",
12+
donate: "https://ko-fi.com/slothyacedia",
13+
},
14+
UI: [
15+
{
16+
element: "variable",
17+
storeAs: "steamSummary",
18+
name: "Steam Summary",
19+
},
20+
"-",
21+
{
22+
element: "store",
23+
storeAs: "steamId",
24+
name: "Store Steam ID As",
25+
},
26+
"-",
27+
{
28+
element: "store",
29+
storeAs: "visibilityState",
30+
name: "Store Profile Visibility State As",
31+
},
32+
{
33+
element: "store",
34+
storeAs: "profileState",
35+
name: "Store Profile Config State As",
36+
},
37+
{
38+
element: "store",
39+
storeAs: "personaState",
40+
name: "Store Current Status As (Online/Offline/Away etc)",
41+
},
42+
// {
43+
// element: "store",
44+
// storeAs: "personaStateFlags",
45+
// name: "Store Account Flags As",
46+
// },
47+
"-",
48+
{
49+
element: "store",
50+
storeAs: "displayName",
51+
name: "Store Display Name As",
52+
},
53+
{
54+
element: "store",
55+
storeAs: "realName",
56+
name: "Store Real Name As",
57+
},
58+
{
59+
element: "store",
60+
storeAs: "profileUrl",
61+
name: "Store Profile URL As",
62+
},
63+
{
64+
element: "store",
65+
storeAs: "steamAvatar",
66+
name: "Store Avatar URL As (Object, Use .base/medium/full/hash. eg: ${tempVars('avatar').full})",
67+
},
68+
{
69+
element: "store",
70+
storeAs: "primaryClanId",
71+
name: "Store Primary Clan Id As",
72+
},
73+
{
74+
element: "store",
75+
storeAs: "commentPermission",
76+
name: "Store Profile Comment Permission As",
77+
},
78+
"-",
79+
{
80+
element: "store",
81+
storeAs: "profileCreationTs",
82+
name: "Store Account Creation Timestamp As",
83+
},
84+
{
85+
element: "store",
86+
storeAs: "lastOnlineTs",
87+
name: "Store Last Offline Timestamp As",
88+
},
89+
"-",
90+
{
91+
element: "store",
92+
storeAs: "countryCode",
93+
name: "Store Country Code As",
94+
},
95+
{
96+
element: "store",
97+
storeAs: "stateCode",
98+
name: "Store State Code As",
99+
},
100+
{
101+
element: "store",
102+
storeAs: "cityCode",
103+
name: "Store City Code As",
104+
},
105+
"-",
106+
{
107+
element: "store",
108+
storeAs: "currentGame",
109+
name: "Store Current Playing Game As",
110+
},
111+
{
112+
element: "store",
113+
storeAs: "currentGameId",
114+
name: "Store Current Playing Game ID As"
115+
},
116+
{
117+
element: "store",
118+
storeAs: "currentGameServerIp",
119+
name: "Store Current Playing Game Server IP As"
120+
}
121+
],
122+
123+
subtitle: (values) =>{
124+
return `Extract Steam Summary Of ${values.steamSummary.type}(${values.steamSummary.value})`
125+
},
126+
127+
compatibility: ["Any"],
128+
129+
async run(values, message, client, bridge){
130+
let steamSummary = bridge.get(values.steamSummary)
131+
132+
if (typeof steamSummary == "object" && steamSummary?.steamid != undefined){
133+
134+
bridge.store(values.steamId, steamSummary.steamid || "Unknown")
135+
136+
const communityVisibilityStates = {
137+
1: "Private",
138+
2: "Friends Only",
139+
3: "Public",
140+
4: "Unknown",
141+
}
142+
bridge.store(values.visibilityState, communityVisibilityStates[steamSummary.communityvisibilitystate] || "Unknown")
143+
144+
const profileStates = {
145+
0: "Profile Not Configured",
146+
1: "Profile Configured"
147+
}
148+
bridge.store(values.profileState, profileStates[steamSummary.profilestate] || "Unknown")
149+
150+
const personaStates = {
151+
0: "Offline",
152+
1: "Online",
153+
2: "Busy",
154+
3: "Away",
155+
4: "Snoozing",
156+
5: "Looking To Trade",
157+
6: "Looking To Play",
158+
}
159+
bridge.store(values.personaState, personaStates[steamSummary.personastate] || "Unknown")
160+
161+
// const bitFlag = parseInt(steamSummary.personastateflags).toString(2).padStart(7, 0).split("").reverse().join("")
162+
// const bitMeanings = {
163+
// 0: "Trade Banned",
164+
// 1: "Running Game Server",
165+
// 2: "Logged In On Steam Web",
166+
// 3: "Logged In On Steam Mobile",
167+
// 4: "On Steam Big Picture Mode",
168+
// 5: "Logged In On A Tablet",
169+
// 6: "Streaming"
170+
// }
171+
// let activeFlags = []
172+
// for (let bitIndex = 0; bitIndex < bitFlag.length; bitIndex++){
173+
// if (bitFlag[bitIndex] === "1"){
174+
// activeFlags.push(bitMeanings[bitIndex] || "Unknown")
175+
// }
176+
// }
177+
// if (activeFlags.length = 0){activeFlags.push("No Profile State Flags")}
178+
// bridge.store(values.personaStateFlags, activeFlags)
179+
180+
bridge.store(values.displayName, steamSummary.personaname || "Unknown")
181+
bridge.store(values.profileUrl, steamSummary.profileurl || "Unknown")
182+
183+
const avatarObj = {
184+
base: steamSummary.avatar || "Unknown",
185+
medium: steamSummary.avatarmedium || "Unknown",
186+
full: steamSummary.avatarfull || "Unknown",
187+
hash: steamSummary.avatarhash || "Unknown"
188+
}
189+
bridge.store(values.steamAvatar, avatarObj)
190+
191+
bridge.store(values.realName, steamSummary.realname || "Unknown")
192+
bridge.store(values.primaryClanId, steamSummary.primaryclanid || "Unknown")
193+
194+
const commentPermissionStates = {
195+
0: "Public",
196+
1: "Friends Only",
197+
2: "Private",
198+
3: "Blocked"
199+
}
200+
bridge.store(values.commentPermission, commentPermissionStates[steamSummary.commentpermission] || "Unknown")
201+
202+
bridge.store(values.profileCreationTs, steamSummary.timecreated || "Unknown")
203+
bridge.store(values.lastOnlineTs, steamSummary.lastlogoff || "Unknown")
204+
bridge.store(values.countryCode, steamSummary.loccountrycode || "Unknown")
205+
bridge.store(values.stateCode, steamSummary.locstatecode || "Unknown")
206+
bridge.store(values.cityCode, steamSummary.loccityid || "Unknown")
207+
bridge.store(values.currentGame, steamSummary.gameextrainfo || "Unknown")
208+
bridge.store(values.currentGameId, steamSummary.gameid || "Unknown")
209+
bridge.store(values.currentGameServerIp, steamSummary.gameserverip || "Unknown")
210+
}
211+
}
212+
}

‎Actions/fetchSteamId_MOD.js

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
modVersion = "s.v1.0"
2+
module.exports = {
3+
data: {
4+
name: "Fetch Steam Profile Info",
5+
},
6+
aliases: ["Resolve Steam Id"],
7+
modules: ["node-fetch"],
8+
category: "WebAPIs",
9+
info: {
10+
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
11+
creator: "Acedia QOLs",
12+
donate: "https://ko-fi.com/slothyacedia",
13+
},
14+
UI: [
15+
{
16+
element: "input",
17+
storeAs: "steamApiKey",
18+
name: "Steam API Key",
19+
placeholder: "https://steamcommunity.com/dev/apikey"
20+
},
21+
{
22+
element: "input",
23+
storeAs: "steamProfileLink",
24+
name: "Steam Profile Link",
25+
},
26+
"-",
27+
{
28+
element: "store",
29+
storeAs: "steamId",
30+
name: "Store Steam ID As",
31+
},
32+
{
33+
element: "store",
34+
storeAs: "profileSummary",
35+
name: "Store Steam Profile Summary As",
36+
},
37+
],
38+
39+
subtitle: (values) =>{
40+
return `Fetch Steam Profile Summary Of ${values.steamProfileLink}`
41+
},
42+
43+
compatibility: ["Any"],
44+
45+
async run(values, message, client, bridge){
46+
this.modules.forEach(moduleName =>{
47+
client.getMods().require(moduleName)
48+
})
49+
let steamApiKey = bridge.transf(values.steamApiKey)
50+
let steamProfileLink = bridge.transf(values.steamProfileLink)
51+
52+
const extractionRegex = /(?:https?:\/\/)?(?:steamcommunity\.com\/)?(id|profiles)\/([^/]+)/
53+
let match = steamProfileLink.match(extractionRegex)
54+
let identifier = match ? match[2] : steamProfileLink
55+
56+
let steamId
57+
if (/^\d+$/.test(identifier) == true && identifier != undefined){
58+
steamId = identifier
59+
} else if (/^\d+$/.test(identifier) == false && identifier != undefined){
60+
const vanityQuery = await fetch(`https://api.steampowered.com/ISteamUser/ResolveVanityURL/v1/?key=${steamApiKey}&vanityurl=${identifier}`)
61+
const vanityResponse = await vanityQuery.json()
62+
if (vanityResponse.response.success == 1) {
63+
steamId = vanityResponse.response.steamid; // Resolved Steam ID
64+
} else {
65+
console.error("Failed To Resolve Vanity To Steam ID");
66+
steamId = "Failed To Resolve Vanity To Steam ID"
67+
}
68+
} else {steamId = "Failed To Resolve Vanity To Steam ID"}
69+
bridge.store(values.steamId, steamId)
70+
71+
let profileObject
72+
if (steamId != undefined && values.profileSummary){
73+
const profileObjectQuery = await fetch(`https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=${steamApiKey}&steamids=${steamId}`)
74+
const profileObjectResponse = await profileObjectQuery.json()
75+
if (profileObjectResponse.response.players.length > 0) {
76+
profileObject = profileObjectResponse.response.players[0]
77+
} else {
78+
console.error("Failed To Fetch Profile Information")
79+
profileObject = "Failed To Fetch Profile Information"
80+
}
81+
} else {profileObject = "No Fetching Of Profile Information"}
82+
bridge.store(values.profileSummary, profileObject)
83+
}
84+
}

‎Actions/getCommandAliases_MOD.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
data: {
88
name: "",
99
},
10-
aliases: ["Get Command Aliases"],
10+
aliases: [],
1111
category: "Bot",
1212
info: {
1313
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",

‎Actions/getMentions_MOD.js

+61-61
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
modVersion = "s.v1.0"
2-
module.exports = {
3-
data: {
4-
name: "Get User Mentions In List",
5-
},
6-
info: {
7-
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
8-
creator: "Acedia QOLs",
9-
donate: "https://ko-fi.com/slothyacedia",
10-
},
11-
category: "Shortcuts",
12-
modules: [],
13-
UI: [
14-
{
15-
element: "var",
16-
storeAs: "membersList",
17-
name: "Initial member or user List",
18-
},
19-
"-",
20-
{
21-
element: "typedDropdown",
22-
storeAs: "style",
23-
name: "Output Style",
24-
choices:{
25-
list: {name: "List", field: false},
26-
text: {name: "Text", field: true, placeholder: "Delimiter"},
27-
},
28-
},
29-
{
30-
element: "store",
31-
storeAs: "result",
32-
name: "Store Result As:",
33-
},
34-
{
35-
element: "text",
36-
text: modVersion,
37-
}
38-
],
39-
40-
subtitle: (values, constants) => {
41-
return `Get Mentions Of ${constants.variable(values.membersList)}`
42-
},
43-
44-
async run(values, message, client, bridge){
45-
let memList = bridge.get(values.membersList)
46-
47-
memList = memList.map(member =>{
48-
return `<@${member.id}>`
49-
})
50-
51-
let styleType = bridge.transf(values.style.type)
52-
let delimiter = bridge.transf(values.style.value)
53-
let mentionList
54-
if (styleType == "text"){
55-
mentionList = memList.join(delimiter)
56-
} else {mentionList = memList}
57-
58-
bridge.store(values.result, mentionList)
59-
}
60-
}
61-
1+
modVersion = "s.v1.0"
2+
module.exports = {
3+
data: {
4+
name: "Get User Mentions In List",
5+
},
6+
info: {
7+
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
8+
creator: "Acedia QOLs",
9+
donate: "https://ko-fi.com/slothyacedia",
10+
},
11+
category: "Shortcuts",
12+
modules: [],
13+
UI: [
14+
{
15+
element: "var",
16+
storeAs: "membersList",
17+
name: "Initial member or user List",
18+
},
19+
"-",
20+
{
21+
element: "typedDropdown",
22+
storeAs: "style",
23+
name: "Output Style",
24+
choices:{
25+
list: {name: "List", field: false},
26+
text: {name: "Text", field: true, placeholder: "Delimiter"},
27+
},
28+
},
29+
{
30+
element: "store",
31+
storeAs: "result",
32+
name: "Store Result As:",
33+
},
34+
{
35+
element: "text",
36+
text: modVersion,
37+
}
38+
],
39+
40+
subtitle: (values, constants) => {
41+
return `Get Mentions Of ${constants.variable(values.membersList)}`
42+
},
43+
44+
async run(values, message, client, bridge){
45+
let memList = bridge.get(values.membersList)
46+
47+
memList = memList.map(member =>{
48+
return `<@${member.id}>`
49+
})
50+
51+
let styleType = bridge.transf(values.style.type)
52+
let delimiter = bridge.transf(values.style.value)
53+
let mentionList
54+
if (styleType == "text"){
55+
mentionList = memList.join(delimiter)
56+
} else {mentionList = memList}
57+
58+
bridge.store(values.result, mentionList)
59+
}
60+
}
61+

‎Actions/joinVoiceChannel.js

+130-130
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,130 @@
1-
modVersion = "s.v1.2 | AceFix"
2-
module.exports = {
3-
category: "Channels",
4-
data: {
5-
name: "Join Voice Channel",
6-
},
7-
info: {
8-
source: "https://github.com/slothyace/bmods-acedia/tree/main/Fixes",
9-
creator: "Acedia Fixes",
10-
donate: "https://ko-fi.com/slothyacedia",
11-
},
12-
UI: [
13-
{
14-
element: "channel",
15-
storeAs: "channel",
16-
excludeUsers: true
17-
},
18-
{
19-
element: "text",
20-
text: modVersion
21-
}
22-
],
23-
subtitle: (values, constants) => {
24-
return `${constants.channel(values.channel)}`
25-
},
26-
async run(values, message, client, bridge) {
27-
let channel = await bridge.getChannel(values.channel);
28-
29-
try {
30-
let member = bridge.guild.members.get(client.application.id) || (await client.rest.users.get(client.application.id));
31-
const res = member.voiceState;
32-
if (res?.channelID == channel.id && bridge.getGlobal({ class: "voice", name: bridge.guild.id })) {
33-
return
34-
}
35-
} catch (err) {
36-
console.log(err)
37-
}
38-
39-
let connection = client.joinVoiceChannel({
40-
channelID: channel.id,
41-
guildID: channel.guild.id,
42-
voiceAdapterCreator: channel.guild.voiceAdapterCreator
43-
});
44-
45-
46-
const { VoiceConnectionStatus, AudioPlayerStatus, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
47-
48-
const player = createAudioPlayer();
49-
connection.subscribe(player);
50-
51-
52-
bridge.createGlobal({
53-
class: "voice",
54-
name: bridge.guild.id,
55-
value: {
56-
connection,
57-
player,
58-
channel,
59-
queue: [],
60-
nowPlaying: {},
61-
startedAt: new Date().getTime(),
62-
addToQueue: (at, track) => {
63-
voiceStuff.queue.splice(at === undefined ? 0 : Number(at), 0, track);
64-
client.emit('queueSongAdd', bridge.guild, channel, track)
65-
66-
if (player.state.status == 'idle') {
67-
player.play(track.audio);
68-
voiceStuff.nowPlaying = track;
69-
voiceStuff.queue.splice(0,0)
70-
client.emit("queueStart", bridge.guild, channel)
71-
client.emit('trackStart', bridge.guild, channel, voiceStuff.queue[0])
72-
}
73-
}
74-
}
75-
});
76-
77-
let voiceStuff = bridge.getGlobal({ name: bridge.guild.id, class: "voice" });
78-
79-
let errorHandler = (error) => {
80-
console.log('Error occurred while playing music, skipping forwards.', error);
81-
if (voiceStuff.queue.length != 0) {
82-
player.play(voiceStuff.queue[0].audio);
83-
84-
voiceStuff.queue[0]
85-
voiceStuff.nowPlaying = voiceStuff.queue[0];
86-
voiceStuff.queue.splice(0, 1);
87-
client.emit('trackStart', bridge.guild, channel, voiceStuff.queue[0]);
88-
} else {
89-
client.emit('queueEnd', bridge.guild, channel)
90-
}
91-
}
92-
93-
player.on('stateChange', (oldStatus, newStatus) => {
94-
// console.log(oldStatus , "\n\n", newStatus, "\n\n")
95-
if (newStatus.status === "playing" && oldStatus.status === "playing"){
96-
client.emit("trackEnd", bridge.guild, channel)
97-
voiceStuff.nowPlaying = {}
98-
voiceStuff.queue.splice(0,1)
99-
if (voiceStuff.queue.length > 0 && voiceStuff.queue[0] != undefined){
100-
player.play(voiceStuff.queue[0].audio)
101-
voiceStuff.nowPlaying = voiceStuff.queue[0]
102-
client.emit("trackStart", bridge.guild, channel, voiceStuff.queue[0])
103-
// voiceStuff.queue.splice(0,1)
104-
}
105-
else{
106-
client.emit("queueEnd", bridge.guild, channel)
107-
}
108-
}
109-
else if (newStatus.status === "idle" && oldStatus.status === "playing"){
110-
client.emit("trackEnd", bridge.guild, channel)
111-
voiceStuff.nowPlaying = {}
112-
voiceStuff.queue.splice(0,1)
113-
if (voiceStuff.queue.length > 0 && voiceStuff.queue[0] != undefined){
114-
player.play(voiceStuff.queue[0].audio)
115-
voiceStuff.nowPlaying = voiceStuff.queue[0]
116-
client.emit("trackStart", bridge.guild, channel, voiceStuff.queue[0])
117-
// voiceStuff.queue.splice(0,1)
118-
}
119-
else{
120-
client.emit("queueEnd", bridge.guild, channel)
121-
}
122-
}
123-
else {
124-
voiceStuff.forgiveIdling = false
125-
}
126-
});
127-
128-
player.on('error', errorHandler)
129-
},
130-
};
1+
modVersion = "s.v1.2 | AceFix"
2+
module.exports = {
3+
category: "Channels",
4+
data: {
5+
name: "Join Voice Channel",
6+
},
7+
info: {
8+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Fixes",
9+
creator: "Acedia Fixes",
10+
donate: "https://ko-fi.com/slothyacedia",
11+
},
12+
UI: [
13+
{
14+
element: "channel",
15+
storeAs: "channel",
16+
excludeUsers: true
17+
},
18+
{
19+
element: "text",
20+
text: modVersion
21+
}
22+
],
23+
subtitle: (values, constants) => {
24+
return `${constants.channel(values.channel)}`
25+
},
26+
async run(values, message, client, bridge) {
27+
let channel = await bridge.getChannel(values.channel);
28+
29+
try {
30+
let member = bridge.guild.members.get(client.application.id) || (await client.rest.users.get(client.application.id));
31+
const res = member.voiceState;
32+
if (res?.channelID == channel.id && bridge.getGlobal({ class: "voice", name: bridge.guild.id })) {
33+
return
34+
}
35+
} catch (err) {
36+
console.log(err)
37+
}
38+
39+
let connection = client.joinVoiceChannel({
40+
channelID: channel.id,
41+
guildID: channel.guild.id,
42+
voiceAdapterCreator: channel.guild.voiceAdapterCreator
43+
});
44+
45+
46+
const { VoiceConnectionStatus, AudioPlayerStatus, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
47+
48+
const player = createAudioPlayer();
49+
connection.subscribe(player);
50+
51+
52+
bridge.createGlobal({
53+
class: "voice",
54+
name: bridge.guild.id,
55+
value: {
56+
connection,
57+
player,
58+
channel,
59+
queue: [],
60+
nowPlaying: {},
61+
startedAt: new Date().getTime(),
62+
addToQueue: (at, track) => {
63+
voiceStuff.queue.splice(at === undefined ? 0 : Number(at), 0, track);
64+
client.emit('queueSongAdd', bridge.guild, channel, track)
65+
66+
if (player.state.status == 'idle') {
67+
player.play(track.audio);
68+
voiceStuff.nowPlaying = track;
69+
voiceStuff.queue.splice(0,0)
70+
client.emit("queueStart", bridge.guild, channel)
71+
client.emit('trackStart', bridge.guild, channel, voiceStuff.queue[0])
72+
}
73+
}
74+
}
75+
});
76+
77+
let voiceStuff = bridge.getGlobal({ name: bridge.guild.id, class: "voice" });
78+
79+
let errorHandler = (error) => {
80+
console.log('Error occurred while playing music, skipping forwards.', error);
81+
if (voiceStuff.queue.length != 0) {
82+
player.play(voiceStuff.queue[0].audio);
83+
84+
voiceStuff.queue[0]
85+
voiceStuff.nowPlaying = voiceStuff.queue[0];
86+
voiceStuff.queue.splice(0, 1);
87+
client.emit('trackStart', bridge.guild, channel, voiceStuff.queue[0]);
88+
} else {
89+
client.emit('queueEnd', bridge.guild, channel)
90+
}
91+
}
92+
93+
player.on('stateChange', (oldStatus, newStatus) => {
94+
// console.log(oldStatus , "\n\n", newStatus, "\n\n")
95+
if (newStatus.status === "playing" && oldStatus.status === "playing"){
96+
client.emit("trackEnd", bridge.guild, channel)
97+
voiceStuff.nowPlaying = {}
98+
voiceStuff.queue.splice(0,1)
99+
if (voiceStuff.queue.length > 0 && voiceStuff.queue[0] != undefined){
100+
player.play(voiceStuff.queue[0].audio)
101+
voiceStuff.nowPlaying = voiceStuff.queue[0]
102+
client.emit("trackStart", bridge.guild, channel, voiceStuff.queue[0])
103+
// voiceStuff.queue.splice(0,1)
104+
}
105+
else{
106+
client.emit("queueEnd", bridge.guild, channel)
107+
}
108+
}
109+
else if (newStatus.status === "idle" && oldStatus.status === "playing"){
110+
client.emit("trackEnd", bridge.guild, channel)
111+
voiceStuff.nowPlaying = {}
112+
voiceStuff.queue.splice(0,1)
113+
if (voiceStuff.queue.length > 0 && voiceStuff.queue[0] != undefined){
114+
player.play(voiceStuff.queue[0].audio)
115+
voiceStuff.nowPlaying = voiceStuff.queue[0]
116+
client.emit("trackStart", bridge.guild, channel, voiceStuff.queue[0])
117+
// voiceStuff.queue.splice(0,1)
118+
}
119+
else{
120+
client.emit("queueEnd", bridge.guild, channel)
121+
}
122+
}
123+
else {
124+
voiceStuff.forgiveIdling = false
125+
}
126+
});
127+
128+
player.on('error', errorHandler)
129+
},
130+
};

‎Actions/multiCompare.js

+124-124
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,124 @@
1-
modVersion = "s.v1.0 | aceqol"
2-
module.exports = {
3-
data: {
4-
name: "Multiple Comparisons",
5-
},
6-
category: "Control",
7-
8-
info: {
9-
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
10-
creator: "Acedia QOLs",
11-
donate: "https://ko-fi.com/slothyacedia",
12-
},
13-
14-
UI: [
15-
{
16-
element: "input",
17-
storeAs: "input",
18-
name: "Input Value"
19-
},
20-
"-",
21-
{
22-
element: "menu",
23-
storeAs: "cases",
24-
name: "Comparisons",
25-
types: {
26-
comparison: "Comparison"
27-
},
28-
max: 200,
29-
UItypes: {
30-
comparison: {
31-
data: {},
32-
name: "Comparison",
33-
preview: "`${option.data.comparator} ${option.data.value}`",
34-
UI: [
35-
{
36-
element: "dropdown",
37-
storeAs: "comparator",
38-
name: "Comparator",
39-
choices: [
40-
{
41-
name: "="
42-
},
43-
{
44-
name: "!="
45-
},
46-
{
47-
name: "<"
48-
},
49-
{
50-
name: ">"
51-
}
52-
]
53-
},
54-
"_",
55-
{
56-
element: "input",
57-
storeAs: "value",
58-
name: "Compare Input Value To"
59-
},
60-
"-",
61-
{
62-
element: "condition",
63-
storeAs: "true",
64-
storeActionsAs: "trueActions",
65-
name: "If True"
66-
},
67-
"-",
68-
{
69-
element: "condition",
70-
storeAs: "false",
71-
storeActionsAs: "falseActions",
72-
name: "If False"
73-
}
74-
]
75-
}
76-
}
77-
},
78-
{
79-
element: "text",
80-
text: modVersion,
81-
}
82-
],
83-
84-
subtitle: (data) => {
85-
return `Compare: ${data.input} To ${data.cases.length} Cases`
86-
},
87-
compatibility: ["Any"],
88-
89-
async run(values, message, client, bridge) {
90-
91-
let firstValue = bridge.transf(values.input);
92-
93-
for (let c in values.cases) {
94-
let comparison = values.cases[c].data;
95-
let secondValue = bridge.transf(comparison.value);
96-
let matchesCriteria = false;
97-
98-
switch (comparison.comparator) {
99-
case "!=":
100-
matchesCriteria = firstValue != secondValue;
101-
break;
102-
103-
case "=":
104-
matchesCriteria = firstValue == secondValue;
105-
break;
106-
107-
case ">":
108-
matchesCriteria = firstValue > secondValue;
109-
break;
110-
111-
case "<":
112-
matchesCriteria = firstValue < secondValue;
113-
break;
114-
}
115-
116-
117-
if (matchesCriteria == true) {
118-
await bridge.call(comparison.true, comparison.trueActions)
119-
} else {
120-
await bridge.call(comparison.false, comparison.falseActions)
121-
}
122-
}
123-
},
124-
};
1+
modVersion = "s.v1.0 | aceqol"
2+
module.exports = {
3+
data: {
4+
name: "Multiple Comparisons",
5+
},
6+
category: "Control",
7+
8+
info: {
9+
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
10+
creator: "Acedia QOLs",
11+
donate: "https://ko-fi.com/slothyacedia",
12+
},
13+
14+
UI: [
15+
{
16+
element: "input",
17+
storeAs: "input",
18+
name: "Input Value"
19+
},
20+
"-",
21+
{
22+
element: "menu",
23+
storeAs: "cases",
24+
name: "Comparisons",
25+
types: {
26+
comparison: "Comparison"
27+
},
28+
max: 200,
29+
UItypes: {
30+
comparison: {
31+
data: {},
32+
name: "Comparison",
33+
preview: "`${option.data.comparator} ${option.data.value}`",
34+
UI: [
35+
{
36+
element: "dropdown",
37+
storeAs: "comparator",
38+
name: "Comparator",
39+
choices: [
40+
{
41+
name: "="
42+
},
43+
{
44+
name: "!="
45+
},
46+
{
47+
name: "<"
48+
},
49+
{
50+
name: ">"
51+
}
52+
]
53+
},
54+
"_",
55+
{
56+
element: "input",
57+
storeAs: "value",
58+
name: "Compare Input Value To"
59+
},
60+
"-",
61+
{
62+
element: "condition",
63+
storeAs: "true",
64+
storeActionsAs: "trueActions",
65+
name: "If True"
66+
},
67+
"-",
68+
{
69+
element: "condition",
70+
storeAs: "false",
71+
storeActionsAs: "falseActions",
72+
name: "If False"
73+
}
74+
]
75+
}
76+
}
77+
},
78+
{
79+
element: "text",
80+
text: modVersion,
81+
}
82+
],
83+
84+
subtitle: (data) => {
85+
return `Compare: ${data.input} To ${data.cases.length} Cases`
86+
},
87+
compatibility: ["Any"],
88+
89+
async run(values, message, client, bridge) {
90+
91+
let firstValue = bridge.transf(values.input);
92+
93+
for (let c in values.cases) {
94+
let comparison = values.cases[c].data;
95+
let secondValue = bridge.transf(comparison.value);
96+
let matchesCriteria = false;
97+
98+
switch (comparison.comparator) {
99+
case "!=":
100+
matchesCriteria = firstValue != secondValue;
101+
break;
102+
103+
case "=":
104+
matchesCriteria = firstValue == secondValue;
105+
break;
106+
107+
case ">":
108+
matchesCriteria = firstValue > secondValue;
109+
break;
110+
111+
case "<":
112+
matchesCriteria = firstValue < secondValue;
113+
break;
114+
}
115+
116+
117+
if (matchesCriteria == true) {
118+
await bridge.call(comparison.true, comparison.trueActions)
119+
} else {
120+
await bridge.call(comparison.false, comparison.falseActions)
121+
}
122+
}
123+
},
124+
};

‎Actions/playBinaryVar_MOD.js

+137-137
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,137 @@
1-
modVersion = "s.v1.2"
2-
module.exports = {
3-
data: {
4-
name: "Play Binary Variable",
5-
},
6-
modules: ["fs", "ffmpeg", "stream", "@discordjs/voice", "libsodium", "libsodium-wrappers"],
7-
category: "Music",
8-
info: {
9-
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
10-
creator: "Acedia",
11-
donate: "https://ko-fi.com/slothyacedia",
12-
},
13-
UI: [
14-
{
15-
element: "variable",
16-
storeAs: "bufferVar",
17-
name: "Buffer Variable (Gotten From The File Output Of Download Music File)"
18-
},
19-
{
20-
element: "input",
21-
storeAs: "songName",
22-
name: "Song Name",
23-
},
24-
"-",
25-
{
26-
element: "dropdown",
27-
name: "Queuing",
28-
storeAs: "queuing",
29-
extraField: "queuePosition",
30-
choices: [
31-
{ name: "Don't Queue, Just Play" },
32-
{ name: "At End Of Queue" },
33-
{ name: "At Start Of Queue" },
34-
{
35-
name: "At Custom Position",
36-
field: true,
37-
placeholder: "Queue Starts At #0",
38-
},
39-
],
40-
},
41-
{
42-
element: "toggle",
43-
storeAs: "logging",
44-
name: "Log Debug Statements"
45-
},
46-
{
47-
element: "text",
48-
text: modVersion,
49-
}
50-
],
51-
subtitle: (values, constants) => {
52-
return `File: ${constants.variable(values.bufferVar)} - ${values.queuing}`;
53-
},
54-
compatibility: ["Any"],
55-
async run(values, message, client, bridge) {
56-
await client.getMods().require("fs")
57-
await client.getMods().require("ffmpeg")
58-
await client.getMods().require("stream")
59-
await client.getMods().require("@discordjs/voice")
60-
61-
const fs = require("fs")
62-
const ffmpeg = require("ffmpeg")
63-
const {Readable} = require("stream")
64-
const { createAudioResource } = require("@discordjs/voice")
65-
66-
let audioBuffer = bridge.get(values.bufferVar)
67-
let songName = bridge.transf(values.songName)
68-
69-
if (values.logging == true){
70-
console.log("Instance Of Buffer:",audioBuffer instanceof Buffer)
71-
console.log("Type Of:",typeof audioBuffer)
72-
}
73-
74-
if (audioBuffer instanceof Buffer == true && typeof audioBuffer == "object"){
75-
let audioStream = Readable.from(audioBuffer)
76-
let audio = createAudioResource(audioStream)
77-
78-
79-
let utilities = bridge.getGlobal({
80-
class: "voice",
81-
name: bridge.guild.id,
82-
});
83-
84-
switch (values.queuing) {
85-
case `Don't Queue, Just Play`:
86-
utilities.player.play(audio);
87-
utilities.nowPlaying = {
88-
file: "Binary Stream",
89-
name: songName,
90-
author: "",
91-
url: "",
92-
src: "Local",
93-
audio: audio,
94-
};
95-
client.emit('trackStart', bridge.guild, utilities.channel, utilities.nowPlaying);
96-
break;
97-
98-
case `At End Of Queue`:
99-
utilities.addToQueue(utilities.queue.length, {
100-
file: "Binary Stream",
101-
name: songName,
102-
author: "",
103-
url: "",
104-
src: "Local",
105-
audio: audio,
106-
});
107-
break;
108-
109-
case `At Start Of Queue`:
110-
utilities.addToQueue(0, {
111-
file: "Binary Stream",
112-
name: songName,
113-
author: "",
114-
url: "",
115-
src: "Local",
116-
audio: audio,
117-
});
118-
break;
119-
120-
case `At Custom Position`:
121-
utilities.addToQueue(Number(bridge.transf(values.queuePosition)), {
122-
file: "Binary Stream",
123-
name: songName,
124-
author: "",
125-
url: "",
126-
src: "Local",
127-
audio: audio,
128-
});
129-
break;
130-
}
131-
}
132-
133-
else{
134-
console.log(`Variable Is Not A Instance Of Buffer And Can't Be Played.`)
135-
}
136-
},
137-
};
1+
modVersion = "s.v1.2"
2+
module.exports = {
3+
data: {
4+
name: "Play Binary Variable",
5+
},
6+
modules: ["fs", "ffmpeg", "stream", "@discordjs/voice", "libsodium", "libsodium-wrappers"],
7+
category: "Music",
8+
info: {
9+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
10+
creator: "Acedia",
11+
donate: "https://ko-fi.com/slothyacedia",
12+
},
13+
UI: [
14+
{
15+
element: "variable",
16+
storeAs: "bufferVar",
17+
name: "Buffer Variable (Gotten From The File Output Of Download Music File)"
18+
},
19+
{
20+
element: "input",
21+
storeAs: "songName",
22+
name: "Song Name",
23+
},
24+
"-",
25+
{
26+
element: "dropdown",
27+
name: "Queuing",
28+
storeAs: "queuing",
29+
extraField: "queuePosition",
30+
choices: [
31+
{ name: "Don't Queue, Just Play" },
32+
{ name: "At End Of Queue" },
33+
{ name: "At Start Of Queue" },
34+
{
35+
name: "At Custom Position",
36+
field: true,
37+
placeholder: "Queue Starts At #0",
38+
},
39+
],
40+
},
41+
{
42+
element: "toggle",
43+
storeAs: "logging",
44+
name: "Log Debug Statements"
45+
},
46+
{
47+
element: "text",
48+
text: modVersion,
49+
}
50+
],
51+
subtitle: (values, constants) => {
52+
return `File: ${constants.variable(values.bufferVar)} - ${values.queuing}`;
53+
},
54+
compatibility: ["Any"],
55+
async run(values, message, client, bridge) {
56+
await client.getMods().require("fs")
57+
await client.getMods().require("ffmpeg")
58+
await client.getMods().require("stream")
59+
await client.getMods().require("@discordjs/voice")
60+
61+
const fs = require("fs")
62+
const ffmpeg = require("ffmpeg")
63+
const {Readable} = require("stream")
64+
const { createAudioResource } = require("@discordjs/voice")
65+
66+
let audioBuffer = bridge.get(values.bufferVar)
67+
let songName = bridge.transf(values.songName)
68+
69+
if (values.logging == true){
70+
console.log("Instance Of Buffer:",audioBuffer instanceof Buffer)
71+
console.log("Type Of:",typeof audioBuffer)
72+
}
73+
74+
if (audioBuffer instanceof Buffer == true && typeof audioBuffer == "object"){
75+
let audioStream = Readable.from(audioBuffer)
76+
let audio = createAudioResource(audioStream)
77+
78+
79+
let utilities = bridge.getGlobal({
80+
class: "voice",
81+
name: bridge.guild.id,
82+
});
83+
84+
switch (values.queuing) {
85+
case `Don't Queue, Just Play`:
86+
utilities.player.play(audio);
87+
utilities.nowPlaying = {
88+
file: "Binary Stream",
89+
name: songName,
90+
author: "",
91+
url: "",
92+
src: "Local",
93+
audio: audio,
94+
};
95+
client.emit('trackStart', bridge.guild, utilities.channel, utilities.nowPlaying);
96+
break;
97+
98+
case `At End Of Queue`:
99+
utilities.addToQueue(utilities.queue.length, {
100+
file: "Binary Stream",
101+
name: songName,
102+
author: "",
103+
url: "",
104+
src: "Local",
105+
audio: audio,
106+
});
107+
break;
108+
109+
case `At Start Of Queue`:
110+
utilities.addToQueue(0, {
111+
file: "Binary Stream",
112+
name: songName,
113+
author: "",
114+
url: "",
115+
src: "Local",
116+
audio: audio,
117+
});
118+
break;
119+
120+
case `At Custom Position`:
121+
utilities.addToQueue(Number(bridge.transf(values.queuePosition)), {
122+
file: "Binary Stream",
123+
name: songName,
124+
author: "",
125+
url: "",
126+
src: "Local",
127+
audio: audio,
128+
});
129+
break;
130+
}
131+
}
132+
133+
else{
134+
console.log(`Variable Is Not A Instance Of Buffer And Can't Be Played.`)
135+
}
136+
},
137+
};

‎Actions/playMP3.js

+136-136
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,136 @@
1-
// should free the file after its done reading so that other actions can be performed on the file if needed
2-
modVersion = "s.v1.2"
3-
4-
module.exports = {
5-
data: {
6-
name: "Play File",
7-
},
8-
category: "Music",
9-
info: {
10-
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
11-
creator: "Acedia QOLs",
12-
donate: "https://ko-fi.com/slothyacedia",
13-
},
14-
modules: ["fs", "ffmpeg", "stream", "@discordjs/voice", "libsodium", "libsodium-wrappers"],
15-
UI: [
16-
{
17-
element: "input",
18-
name: "File Path",
19-
placeholder: "In Project Directory",
20-
storeAs: "path",
21-
},
22-
"-",
23-
{
24-
element: "dropdown",
25-
name: "Queuing",
26-
storeAs: "queuing",
27-
extraField: "queuePosition",
28-
choices: [
29-
{ name: "Don't Queue, Just Play" },
30-
{ name: "At End Of Queue" },
31-
{ name: "At Start Of Queue" },
32-
{
33-
name: "At Custom Position",
34-
field: true,
35-
placeholder: "Queue Starts At #0",
36-
},
37-
],
38-
},
39-
{
40-
element: "toggle",
41-
storeAs: "logging",
42-
name: "Log Debug Statements"
43-
},
44-
{
45-
element: "text",
46-
text: modVersion,
47-
}
48-
],
49-
subtitle: (data, constants) => {
50-
return `File: ${data.path} - ${data.queuing}`;
51-
},
52-
compatibility: ["Any"],
53-
async run(values, message, client, bridge) {
54-
await client.getMods().require("fs")
55-
await client.getMods().require("ffmpeg")
56-
await client.getMods().require("@discordjs/voice")
57-
await client.getMods().require("stream")
58-
59-
const fs = require("fs");
60-
const ffmpeg = require("ffmpeg");
61-
const {createAudioResource} = require("@discordjs/voice");
62-
const {Readable} = require("stream")
63-
let path;
64-
if (fs.existsSync(`${require("../data.json").prjSrc}`)) {
65-
path = `${require("../data.json").prjSrc}/${bridge.transf(values.path)}`;
66-
} else {
67-
path = `./${bridge.transf(values.path)}`;
68-
}
69-
70-
let audioBuffer = bridge.fs.readFileSync(path)
71-
if(values.logging == true){console.log(audioBuffer instanceof Buffer)}
72-
73-
if (audioBuffer instanceof Buffer == true && typeof audioBuffer == "object"){
74-
let audioStream = Readable.from(audioBuffer)
75-
let audio = createAudioResource(audioStream)
76-
77-
let utilities = bridge.getGlobal({
78-
class: "voice",
79-
name: bridge.guild.id,
80-
});
81-
82-
let fileName = path.match(/[\\/][^\\/]+$/)?.[0]?.substring(1) || "Unknown File"
83-
84-
switch (values.queuing) {
85-
case `Don't Queue, Just Play`:
86-
utilities.player.play(audio);
87-
utilities.nowPlaying = {
88-
file: bridge.transf(values.path),
89-
name: fileName,
90-
author: "",
91-
url: "",
92-
src: "Local",
93-
audio: audio,
94-
};
95-
client.emit('trackStart', bridge.guild, utilities.channel, utilities.nowPlaying);
96-
break;
97-
98-
case `At End Of Queue`:
99-
utilities.addToQueue(utilities.queue.length, {
100-
file: bridge.transf(values.path),
101-
name: fileName,
102-
author: "",
103-
url: "",
104-
src: "Local",
105-
audio: audio,
106-
});
107-
break;
108-
109-
case `At Start Of Queue`:
110-
utilities.addToQueue(0, {
111-
file: bridge.transf(values.path),
112-
name: fileName,
113-
author: "",
114-
url: "",
115-
src: "Local",
116-
audio: audio,
117-
});
118-
break;
119-
120-
case `At Custom Position`:
121-
utilities.addToQueue(Number(bridge.transf(values.queuePosition)), {
122-
file: bridge.transf(values.path),
123-
name: fileName,
124-
author: "",
125-
url: "",
126-
src: "Local",
127-
audio: audio,
128-
});
129-
break;
130-
}
131-
}
132-
else{
133-
console.log(`An Error Occured After Reading The File And Can't Be Played.`)
134-
}
135-
},
136-
};
1+
// should free the file after its done reading so that other actions can be performed on the file if needed
2+
modVersion = "s.v1.2"
3+
4+
module.exports = {
5+
data: {
6+
name: "Play File",
7+
},
8+
category: "Music",
9+
info: {
10+
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
11+
creator: "Acedia QOLs",
12+
donate: "https://ko-fi.com/slothyacedia",
13+
},
14+
modules: ["fs", "ffmpeg", "stream", "@discordjs/voice", "libsodium", "libsodium-wrappers"],
15+
UI: [
16+
{
17+
element: "input",
18+
name: "File Path",
19+
placeholder: "In Project Directory",
20+
storeAs: "path",
21+
},
22+
"-",
23+
{
24+
element: "dropdown",
25+
name: "Queuing",
26+
storeAs: "queuing",
27+
extraField: "queuePosition",
28+
choices: [
29+
{ name: "Don't Queue, Just Play" },
30+
{ name: "At End Of Queue" },
31+
{ name: "At Start Of Queue" },
32+
{
33+
name: "At Custom Position",
34+
field: true,
35+
placeholder: "Queue Starts At #0",
36+
},
37+
],
38+
},
39+
{
40+
element: "toggle",
41+
storeAs: "logging",
42+
name: "Log Debug Statements"
43+
},
44+
{
45+
element: "text",
46+
text: modVersion,
47+
}
48+
],
49+
subtitle: (data, constants) => {
50+
return `File: ${data.path} - ${data.queuing}`;
51+
},
52+
compatibility: ["Any"],
53+
async run(values, message, client, bridge) {
54+
await client.getMods().require("fs")
55+
await client.getMods().require("ffmpeg")
56+
await client.getMods().require("@discordjs/voice")
57+
await client.getMods().require("stream")
58+
59+
const fs = require("fs");
60+
const ffmpeg = require("ffmpeg");
61+
const {createAudioResource} = require("@discordjs/voice");
62+
const {Readable} = require("stream")
63+
let path;
64+
if (fs.existsSync(`${require("../data.json").prjSrc}`)) {
65+
path = `${require("../data.json").prjSrc}/${bridge.transf(values.path)}`;
66+
} else {
67+
path = `./${bridge.transf(values.path)}`;
68+
}
69+
70+
let audioBuffer = bridge.fs.readFileSync(path)
71+
if(values.logging == true){console.log(audioBuffer instanceof Buffer)}
72+
73+
if (audioBuffer instanceof Buffer == true && typeof audioBuffer == "object"){
74+
let audioStream = Readable.from(audioBuffer)
75+
let audio = createAudioResource(audioStream)
76+
77+
let utilities = bridge.getGlobal({
78+
class: "voice",
79+
name: bridge.guild.id,
80+
});
81+
82+
let fileName = path.match(/[\\/][^\\/]+$/)?.[0]?.substring(1) || "Unknown File"
83+
84+
switch (values.queuing) {
85+
case `Don't Queue, Just Play`:
86+
utilities.player.play(audio);
87+
utilities.nowPlaying = {
88+
file: bridge.transf(values.path),
89+
name: fileName,
90+
author: "",
91+
url: "",
92+
src: "Local",
93+
audio: audio,
94+
};
95+
client.emit('trackStart', bridge.guild, utilities.channel, utilities.nowPlaying);
96+
break;
97+
98+
case `At End Of Queue`:
99+
utilities.addToQueue(utilities.queue.length, {
100+
file: bridge.transf(values.path),
101+
name: fileName,
102+
author: "",
103+
url: "",
104+
src: "Local",
105+
audio: audio,
106+
});
107+
break;
108+
109+
case `At Start Of Queue`:
110+
utilities.addToQueue(0, {
111+
file: bridge.transf(values.path),
112+
name: fileName,
113+
author: "",
114+
url: "",
115+
src: "Local",
116+
audio: audio,
117+
});
118+
break;
119+
120+
case `At Custom Position`:
121+
utilities.addToQueue(Number(bridge.transf(values.queuePosition)), {
122+
file: bridge.transf(values.path),
123+
name: fileName,
124+
author: "",
125+
url: "",
126+
src: "Local",
127+
audio: audio,
128+
});
129+
break;
130+
}
131+
}
132+
else{
133+
console.log(`An Error Occured After Reading The File And Can't Be Played.`)
134+
}
135+
},
136+
};

‎Actions/playYT.js

+159-159
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,159 @@
1-
const generatePoToken = require('./generatePoToken');
2-
modVersion = "s.v1.0 | AceTweaks"
3-
4-
module.exports = {
5-
data: {
6-
name: "Play YouTube Song",
7-
},
8-
category: "Music",
9-
info: {
10-
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
11-
creator: "Acedia QOLs",
12-
donate: "https://ko-fi.com/slothyacedia",
13-
},
14-
UI: [
15-
{
16-
element: "input",
17-
name: "URL",
18-
placeholder: "YouTube Video URL",
19-
storeAs: "url",
20-
},
21-
"-",
22-
{
23-
element: "dropdown",
24-
name: "Queuing",
25-
storeAs: "queuing",
26-
extraField: "queuePosition",
27-
choices: [
28-
{ name: "Don't Queue, Just Play" },
29-
{ name: "At End Of Queue" },
30-
{ name: "At Start Of Queue" },
31-
{
32-
name: "At Custom Position",
33-
field: true,
34-
placeholder: "Queue Starts At #0",
35-
},
36-
],
37-
},
38-
"-",
39-
{
40-
element: "input",
41-
name: "Timeout After x Seconds Of Trying To Fetch Audio | Leave Empty For 60s",
42-
placeholder: "20",
43-
storeAs: "timeoutAfter",
44-
},
45-
{
46-
element: "condition",
47-
storeAs: "timeoutCondition",
48-
storeActionsAs: "timeoutActions",
49-
name: "If Timeout Occurs",
50-
},
51-
{
52-
element: "text",
53-
text: modVersion
54-
}
55-
],
56-
subtitle: (values, constants) => {
57-
return `URL: ${values.url} - ${values.queuing}`;
58-
},
59-
compatibility: ["Any"],
60-
async run(values, message, client, bridge) {
61-
const fs = require('fs');
62-
const search = require('yt-search');
63-
const stream = require('stream');
64-
const ytdl = require('@distube/ytdl-core');
65-
const randInt = (Date.now()*Math.random()*1000*Math.random()*1000).toString().replaceAll(".","").replaceAll(",","").slice(0,16)
66-
const generatedFilePath = `./temp_${new Date().getTime()}_${randInt}.mp3`
67-
const { createAudioResource } = require('@discordjs/voice');
68-
let timeoutDur = values.timeoutAfter ? parseInt(bridge.transf(values.timeoutAfter))*1000 : 60000
69-
70-
const result = await search(bridge.transf(values.url));
71-
let url = result.videos[0]?.url || bridge.transf(values.url);
72-
try{
73-
await Promise.race([
74-
new Promise((resolve, reject) => {
75-
let stream = ytdl(url, { filter: 'audioonly' }).pipe(fs.createWriteStream(generatedFilePath)).on('finish', () => {
76-
stream.close();
77-
resolve();
78-
}).on("error", (err) =>{
79-
fs.unlinkSync(generatedFilePath)
80-
reject(err)
81-
})
82-
}),
83-
84-
new Promise((_, reject) => setTimeout(()=> {
85-
reject(new Error(`Fetching Audio Took Too Long!`))
86-
}, timeoutDur))
87-
])
88-
} catch (err){
89-
console.error(err)
90-
bridge.call(values.timeoutCondition, values.timeoutActions)
91-
fs.unlinkSync(generatedFilePath)
92-
return
93-
}
94-
95-
let Readable = stream.Readable.from(fs.readFileSync(generatedFilePath));
96-
const audio = createAudioResource(Readable);
97-
98-
fs.unlinkSync(generatedFilePath);
99-
100-
let utilities = bridge.getGlobal({
101-
class: "voice",
102-
name: bridge.guild.id,
103-
});
104-
105-
106-
switch (values.queuing) {
107-
case `Don't Queue, Just Play`:
108-
utilities.player.play(audio);
109-
utilities.nowPlaying = {
110-
file: null,
111-
name: result.videos[0].title,
112-
author: result.videos[0].author.name,
113-
url: bridge.transf(values.url),
114-
src: "YouTube",
115-
audio,
116-
raw: result.videos[0],
117-
playURL: url
118-
};
119-
client.emit('trackStart', bridge.guild, utilities.channel, utilities.nowPlaying);
120-
break;
121-
122-
case `At End Of Queue`:
123-
utilities.addToQueue(utilities.queue.length, {
124-
file: null,
125-
name: result.videos[0].title,
126-
author: result.videos[0].author.name,
127-
url: bridge.transf(values.url),
128-
src: "YouTube",
129-
audio: audio,
130-
raw: result.videos[0]
131-
});
132-
break;
133-
134-
case `At Start Of Queue`:
135-
utilities.addToQueue(0, {
136-
file: null,
137-
name: result.videos[0].title,
138-
author: result.videos[0].author.name,
139-
url: bridge.transf(values.url),
140-
src: "YouTube",
141-
audio: audio,
142-
raw: result.videos[0]
143-
});
144-
break;
145-
146-
case `At Custom Position`:
147-
utilities.addToQueue(Number(bridge.transf(values.queuePosition)), {
148-
file: null,
149-
name: result.videos[0].title,
150-
author: result.videos[0].author.name,
151-
url: bridge.transf(values.url),
152-
src: "YouTube",
153-
audio: audio,
154-
raw: result.videos[0]
155-
});
156-
break;
157-
}
158-
},
159-
};
1+
const generatePoToken = require('./generatePoToken');
2+
modVersion = "s.v1.0 | AceTweaks"
3+
4+
module.exports = {
5+
data: {
6+
name: "Play YouTube Song",
7+
},
8+
category: "Music",
9+
info: {
10+
source: "https://github.com/slothyace/bmods-acedia/tree/main/QOLs",
11+
creator: "Acedia QOLs",
12+
donate: "https://ko-fi.com/slothyacedia",
13+
},
14+
UI: [
15+
{
16+
element: "input",
17+
name: "URL",
18+
placeholder: "YouTube Video URL",
19+
storeAs: "url",
20+
},
21+
"-",
22+
{
23+
element: "dropdown",
24+
name: "Queuing",
25+
storeAs: "queuing",
26+
extraField: "queuePosition",
27+
choices: [
28+
{ name: "Don't Queue, Just Play" },
29+
{ name: "At End Of Queue" },
30+
{ name: "At Start Of Queue" },
31+
{
32+
name: "At Custom Position",
33+
field: true,
34+
placeholder: "Queue Starts At #0",
35+
},
36+
],
37+
},
38+
"-",
39+
{
40+
element: "input",
41+
name: "Timeout After x Seconds Of Trying To Fetch Audio | Leave Empty For 60s",
42+
placeholder: "20",
43+
storeAs: "timeoutAfter",
44+
},
45+
{
46+
element: "condition",
47+
storeAs: "timeoutCondition",
48+
storeActionsAs: "timeoutActions",
49+
name: "If Timeout Occurs",
50+
},
51+
{
52+
element: "text",
53+
text: modVersion
54+
}
55+
],
56+
subtitle: (values, constants) => {
57+
return `URL: ${values.url} - ${values.queuing}`;
58+
},
59+
compatibility: ["Any"],
60+
async run(values, message, client, bridge) {
61+
const fs = require('fs');
62+
const search = require('yt-search');
63+
const stream = require('stream');
64+
const ytdl = require('@distube/ytdl-core');
65+
const randInt = (Date.now()*Math.random()*1000*Math.random()*1000).toString().replaceAll(".","").replaceAll(",","").slice(0,16)
66+
const generatedFilePath = `./temp_${new Date().getTime()}_${randInt}.mp3`
67+
const { createAudioResource } = require('@discordjs/voice');
68+
let timeoutDur = values.timeoutAfter ? parseInt(bridge.transf(values.timeoutAfter))*1000 : 60000
69+
70+
const result = await search(bridge.transf(values.url));
71+
let url = result.videos[0]?.url || bridge.transf(values.url);
72+
try{
73+
await Promise.race([
74+
new Promise((resolve, reject) => {
75+
let stream = ytdl(url, { filter: 'audioonly' }).pipe(fs.createWriteStream(generatedFilePath)).on('finish', () => {
76+
stream.close();
77+
resolve();
78+
}).on("error", (err) =>{
79+
fs.unlinkSync(generatedFilePath)
80+
reject(err)
81+
})
82+
}),
83+
84+
new Promise((_, reject) => setTimeout(()=> {
85+
reject(new Error(`Fetching Audio Took Too Long!`))
86+
}, timeoutDur))
87+
])
88+
} catch (err){
89+
console.error(err)
90+
bridge.call(values.timeoutCondition, values.timeoutActions)
91+
fs.unlinkSync(generatedFilePath)
92+
return
93+
}
94+
95+
let Readable = stream.Readable.from(fs.readFileSync(generatedFilePath));
96+
const audio = createAudioResource(Readable);
97+
98+
fs.unlinkSync(generatedFilePath);
99+
100+
let utilities = bridge.getGlobal({
101+
class: "voice",
102+
name: bridge.guild.id,
103+
});
104+
105+
106+
switch (values.queuing) {
107+
case `Don't Queue, Just Play`:
108+
utilities.player.play(audio);
109+
utilities.nowPlaying = {
110+
file: null,
111+
name: result.videos[0].title,
112+
author: result.videos[0].author.name,
113+
url: bridge.transf(values.url),
114+
src: "YouTube",
115+
audio,
116+
raw: result.videos[0],
117+
playURL: url
118+
};
119+
client.emit('trackStart', bridge.guild, utilities.channel, utilities.nowPlaying);
120+
break;
121+
122+
case `At End Of Queue`:
123+
utilities.addToQueue(utilities.queue.length, {
124+
file: null,
125+
name: result.videos[0].title,
126+
author: result.videos[0].author.name,
127+
url: bridge.transf(values.url),
128+
src: "YouTube",
129+
audio: audio,
130+
raw: result.videos[0]
131+
});
132+
break;
133+
134+
case `At Start Of Queue`:
135+
utilities.addToQueue(0, {
136+
file: null,
137+
name: result.videos[0].title,
138+
author: result.videos[0].author.name,
139+
url: bridge.transf(values.url),
140+
src: "YouTube",
141+
audio: audio,
142+
raw: result.videos[0]
143+
});
144+
break;
145+
146+
case `At Custom Position`:
147+
utilities.addToQueue(Number(bridge.transf(values.queuePosition)), {
148+
file: null,
149+
name: result.videos[0].title,
150+
author: result.videos[0].author.name,
151+
url: bridge.transf(values.url),
152+
src: "YouTube",
153+
audio: audio,
154+
raw: result.videos[0]
155+
});
156+
break;
157+
}
158+
},
159+
};

‎Actions/rconCommander_MOD.js

+125-125
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,126 @@
1-
modVersion = "s.v1.2"
2-
module.exports = {
3-
data: {
4-
name: "Extended RCON Commander"
5-
},
6-
aliases: ["Send RCON Command v2"],
7-
category: "RCON",
8-
info: {
9-
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
10-
creator: "Acedia",
11-
donate: "https://ko-fi.com/slothyacedia",
12-
},
13-
modules: ["rcon"],
14-
UI: [
15-
{
16-
element: "input",
17-
storeAs: "ipAddress",
18-
name: "RCON Server IP Address",
19-
},
20-
{
21-
element: "input",
22-
storeAs: "ipPort",
23-
name: "RCON Server Port",
24-
},
25-
{
26-
element: "input",
27-
storeAs: "rconPassword",
28-
name: "RCON Server Password",
29-
},
30-
{
31-
element: "toggle",
32-
storeAs: "tcpudp",
33-
name: "TCP / UDP",
34-
true: "TCP",
35-
false: "UDP",
36-
},
37-
{
38-
element: "toggle",
39-
storeAs: "challengePtc",
40-
name: "Use Challenge Protocol"
41-
},
42-
"-",
43-
{
44-
element: "largeInput",
45-
storeAs: "rconCommand",
46-
name: "RCON Command",
47-
},
48-
{
49-
element: "store",
50-
storeAs: "rconResponse",
51-
name: "Store Command Response As",
52-
},
53-
{
54-
element: "actions",
55-
storeAs: "actions",
56-
name: "On Response, Run"
57-
},
58-
{
59-
element: "toggle",
60-
storeAs: "logging",
61-
name: "Log To Console For Debugging?",
62-
true: "Yes",
63-
false: "No"
64-
},
65-
{
66-
element: "text",
67-
text: modVersion,
68-
}
69-
],
70-
71-
subtitle: (values) => {
72-
return `Send command: ${values.rconCommand} to ${values.ipAddress}:${values.ipPort}`
73-
},
74-
75-
compatibility: ["Any"],
76-
77-
async run(values, interaction, client, bridge){
78-
await client.getMods().require("rcon")
79-
const Rcon = require("rcon")
80-
81-
const config = {
82-
tcp: bridge.transf(values.tcpudp),
83-
challenge: bridge.transf(values.challengePtc)
84-
}
85-
86-
const ipAddr = bridge.transf(values.ipAddress)
87-
const ipPort = bridge.transf(values.ipPort)
88-
const rconPw = bridge.transf(values.rconPassword)
89-
const rconCm = bridge.transf(values.rconCommand)
90-
const logging = values.logging
91-
92-
const rconServer = new Rcon(ipAddr, ipPort, rconPw, config)
93-
rconServer.setTimeout(() => {
94-
if (logging == true){console.log(`Connection to ${ipAddr}:${ipPort} timed out.`)}
95-
bridge.store(values.rconResponse, `Connection timed out.`)
96-
rconServer.disconnect()
97-
}, 1500)
98-
99-
rconServer.on("auth", function(){
100-
if (logging == true){
101-
console.log(`Connection to ${ipAddr}:${ipPort} established.`)
102-
console.log(`Sending command: ${rconCm}`)}
103-
rconServer.send(rconCm)
104-
})
105-
106-
rconServer.on("response", function(str){
107-
if (logging == true){console.log("Response received: "+ str)}
108-
bridge.store(values.rconResponse, str)
109-
rconServer.disconnect()
110-
bridge.runner(values.actions)
111-
})
112-
113-
rconServer.on("end", function(){
114-
if (logging == true){console.log(`Connection to ${ipAddr}:${ipPort} dropped.`)}
115-
rconServer.disconnect()
116-
})
117-
118-
rconServer.on("error", function(str){
119-
if (logging == true){console.log(`Error: ${str}`)}
120-
bridge.store(values.rconResponse, `Error: ${str}`)
121-
rconServer.disconnect()
122-
})
123-
124-
rconServer.connect()
125-
}
1+
modVersion = "s.v1.2"
2+
module.exports = {
3+
data: {
4+
name: "Extended RCON Commander"
5+
},
6+
aliases: ["Send RCON Command v2"],
7+
category: "RCON",
8+
info: {
9+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
10+
creator: "Acedia",
11+
donate: "https://ko-fi.com/slothyacedia",
12+
},
13+
modules: ["rcon"],
14+
UI: [
15+
{
16+
element: "input",
17+
storeAs: "ipAddress",
18+
name: "RCON Server IP Address",
19+
},
20+
{
21+
element: "input",
22+
storeAs: "ipPort",
23+
name: "RCON Server Port",
24+
},
25+
{
26+
element: "input",
27+
storeAs: "rconPassword",
28+
name: "RCON Server Password",
29+
},
30+
{
31+
element: "toggle",
32+
storeAs: "tcpudp",
33+
name: "TCP / UDP",
34+
true: "TCP",
35+
false: "UDP",
36+
},
37+
{
38+
element: "toggle",
39+
storeAs: "challengePtc",
40+
name: "Use Challenge Protocol"
41+
},
42+
"-",
43+
{
44+
element: "largeInput",
45+
storeAs: "rconCommand",
46+
name: "RCON Command",
47+
},
48+
{
49+
element: "store",
50+
storeAs: "rconResponse",
51+
name: "Store Command Response As",
52+
},
53+
{
54+
element: "actions",
55+
storeAs: "actions",
56+
name: "On Response, Run"
57+
},
58+
{
59+
element: "toggle",
60+
storeAs: "logging",
61+
name: "Log To Console For Debugging?",
62+
true: "Yes",
63+
false: "No"
64+
},
65+
{
66+
element: "text",
67+
text: modVersion,
68+
}
69+
],
70+
71+
subtitle: (values) => {
72+
return `Send command: ${values.rconCommand} to ${values.ipAddress}:${values.ipPort}`
73+
},
74+
75+
compatibility: ["Any"],
76+
77+
async run(values, interaction, client, bridge){
78+
await client.getMods().require("rcon")
79+
const Rcon = require("rcon")
80+
81+
const config = {
82+
tcp: bridge.transf(values.tcpudp),
83+
challenge: bridge.transf(values.challengePtc)
84+
}
85+
86+
const ipAddr = bridge.transf(values.ipAddress)
87+
const ipPort = bridge.transf(values.ipPort)
88+
const rconPw = bridge.transf(values.rconPassword)
89+
const rconCm = bridge.transf(values.rconCommand)
90+
const logging = values.logging
91+
92+
const rconServer = new Rcon(ipAddr, ipPort, rconPw, config)
93+
rconServer.setTimeout(() => {
94+
if (logging == true){console.log(`Connection to ${ipAddr}:${ipPort} timed out.`)}
95+
bridge.store(values.rconResponse, `Connection timed out.`)
96+
rconServer.disconnect()
97+
}, 1500)
98+
99+
rconServer.on("auth", function(){
100+
if (logging == true){
101+
console.log(`Connection to ${ipAddr}:${ipPort} established.`)
102+
console.log(`Sending command: ${rconCm}`)}
103+
rconServer.send(rconCm)
104+
})
105+
106+
rconServer.on("response", function(str){
107+
if (logging == true){console.log("Response received: "+ str)}
108+
bridge.store(values.rconResponse, str)
109+
rconServer.disconnect()
110+
bridge.runner(values.actions)
111+
})
112+
113+
rconServer.on("end", function(){
114+
if (logging == true){console.log(`Connection to ${ipAddr}:${ipPort} dropped.`)}
115+
rconServer.disconnect()
116+
})
117+
118+
rconServer.on("error", function(str){
119+
if (logging == true){console.log(`Error: ${str}`)}
120+
bridge.store(values.rconResponse, `Error: ${str}`)
121+
rconServer.disconnect()
122+
})
123+
124+
rconServer.connect()
125+
}
126126
}

‎Actions/rconListener_MOD.js

+131-131
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,132 @@
1-
modVersion = "s.v1.2"
2-
module.exports = {
3-
data: {
4-
name: "RCON Listener",
5-
},
6-
category: "RCON",
7-
info: {
8-
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
9-
creator: "Acedia",
10-
donate: "https://ko-fi.com/slothyacedia",
11-
},
12-
modules: ["rcon"],
13-
UI: [
14-
{
15-
element: "input",
16-
storeAs: "ipAddress",
17-
name: "RCON Server IP Address",
18-
},
19-
{
20-
element: "input",
21-
storeAs: "ipPort",
22-
name: "RCON Server Port",
23-
},
24-
{
25-
element: "input",
26-
storeAs: "rconPassword",
27-
name: "RCON Server Password",
28-
},
29-
{
30-
element: "toggle",
31-
storeAs: "tcpudp",
32-
name: "TCP / UDP",
33-
true: "TCP",
34-
false: "UDP",
35-
},
36-
{
37-
element: "toggle",
38-
storeAs: "challengePtc",
39-
name: "Use Challenge Protocol"
40-
},
41-
"-",
42-
{
43-
element: "toggle",
44-
storeAs: "maintain",
45-
name: "Maintain Connection",
46-
},
47-
{
48-
element: "store",
49-
storeAs: "serverMessage",
50-
name: "Store RCON Server Message As",
51-
},
52-
{
53-
element: "actions",
54-
storeAs: "toRunAct",
55-
name: "Run actions",
56-
},
57-
{
58-
element: "toggle",
59-
storeAs: "logging",
60-
name: "Log To Console For Debugging?",
61-
true: "Yes",
62-
false: "No"
63-
},
64-
{
65-
element: "text",
66-
text: modVersion,
67-
}
68-
],
69-
70-
subtitle: (values) => {
71-
return `Listen to ${values.ipAddress}:${values.ipPort}, maintained: ${values.maintain}`
72-
},
73-
74-
compatibility: ["Any"],
75-
76-
async run(values, interaction, client, bridge){
77-
await client.getMods().require("rcon")
78-
const Rcon = require("rcon")
79-
80-
const config = {
81-
tcp: bridge.transf(values.tcpudp),
82-
challenge: bridge.transf(values.challengePtc)
83-
}
84-
85-
const ipAddr = bridge.transf(values.ipAddress)
86-
const ipPort = bridge.transf(values.ipPort)
87-
const rconPw = bridge.transf(values.rconPassword)
88-
const logging = values.logging
89-
90-
const rconServer = new Rcon(ipAddr, ipPort, rconPw, config)
91-
92-
rconServer.on("auth", function(){
93-
if (logging == true){console.log(`Connection made with ${ipAddr}:${ipPort}, authentication success.`)}
94-
})
95-
96-
rconServer.on("error", function(err){
97-
if (logging == true){console.log(`Error: ${err}`)}
98-
bridge.store(values.serverMessage, `Error: ${err}`)
99-
if (bridge.transf(values.maintain) == true){
100-
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped, attempting reconnecting.`)}
101-
rconServer.connect()
102-
} else if (bridge.transf(values.maintain) == false){
103-
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped.`)}
104-
rconServer.disconnect()
105-
}
106-
})
107-
108-
rconServer.on("end", function(){
109-
if (bridge.transf(values.maintain) == true){
110-
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped, attempting reconnecting.`)}
111-
rconServer.connect()
112-
} else if (bridge.transf(values.maintain) == false){
113-
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped.`)}
114-
rconServer.disconnect()
115-
}
116-
})
117-
118-
rconServer.on("response", function (str) {
119-
if (logging == true){console.log(str)}
120-
bridge.store(values.serverMessage, str)
121-
bridge.runner(values.toRunAct)
122-
})
123-
124-
rconServer.on("server", function (str) {
125-
if (logging == true){console.log(str)}
126-
bridge.store(values.serverMessage, str)
127-
bridge.runner(values.toRunAct)
128-
})
129-
130-
rconServer.connect()
131-
}
1+
modVersion = "s.v1.2"
2+
module.exports = {
3+
data: {
4+
name: "RCON Listener",
5+
},
6+
category: "RCON",
7+
info: {
8+
source: "https://github.com/slothyace/bmods-acedia/tree/main/Actions",
9+
creator: "Acedia",
10+
donate: "https://ko-fi.com/slothyacedia",
11+
},
12+
modules: ["rcon"],
13+
UI: [
14+
{
15+
element: "input",
16+
storeAs: "ipAddress",
17+
name: "RCON Server IP Address",
18+
},
19+
{
20+
element: "input",
21+
storeAs: "ipPort",
22+
name: "RCON Server Port",
23+
},
24+
{
25+
element: "input",
26+
storeAs: "rconPassword",
27+
name: "RCON Server Password",
28+
},
29+
{
30+
element: "toggle",
31+
storeAs: "tcpudp",
32+
name: "TCP / UDP",
33+
true: "TCP",
34+
false: "UDP",
35+
},
36+
{
37+
element: "toggle",
38+
storeAs: "challengePtc",
39+
name: "Use Challenge Protocol"
40+
},
41+
"-",
42+
{
43+
element: "toggle",
44+
storeAs: "maintain",
45+
name: "Maintain Connection",
46+
},
47+
{
48+
element: "store",
49+
storeAs: "serverMessage",
50+
name: "Store RCON Server Message As",
51+
},
52+
{
53+
element: "actions",
54+
storeAs: "toRunAct",
55+
name: "Run actions",
56+
},
57+
{
58+
element: "toggle",
59+
storeAs: "logging",
60+
name: "Log To Console For Debugging?",
61+
true: "Yes",
62+
false: "No"
63+
},
64+
{
65+
element: "text",
66+
text: modVersion,
67+
}
68+
],
69+
70+
subtitle: (values) => {
71+
return `Listen to ${values.ipAddress}:${values.ipPort}, maintained: ${values.maintain}`
72+
},
73+
74+
compatibility: ["Any"],
75+
76+
async run(values, interaction, client, bridge){
77+
await client.getMods().require("rcon")
78+
const Rcon = require("rcon")
79+
80+
const config = {
81+
tcp: bridge.transf(values.tcpudp),
82+
challenge: bridge.transf(values.challengePtc)
83+
}
84+
85+
const ipAddr = bridge.transf(values.ipAddress)
86+
const ipPort = bridge.transf(values.ipPort)
87+
const rconPw = bridge.transf(values.rconPassword)
88+
const logging = values.logging
89+
90+
const rconServer = new Rcon(ipAddr, ipPort, rconPw, config)
91+
92+
rconServer.on("auth", function(){
93+
if (logging == true){console.log(`Connection made with ${ipAddr}:${ipPort}, authentication success.`)}
94+
})
95+
96+
rconServer.on("error", function(err){
97+
if (logging == true){console.log(`Error: ${err}`)}
98+
bridge.store(values.serverMessage, `Error: ${err}`)
99+
if (bridge.transf(values.maintain) == true){
100+
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped, attempting reconnecting.`)}
101+
rconServer.connect()
102+
} else if (bridge.transf(values.maintain) == false){
103+
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped.`)}
104+
rconServer.disconnect()
105+
}
106+
})
107+
108+
rconServer.on("end", function(){
109+
if (bridge.transf(values.maintain) == true){
110+
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped, attempting reconnecting.`)}
111+
rconServer.connect()
112+
} else if (bridge.transf(values.maintain) == false){
113+
if (logging == true){console.log(`Connection with ${ipAddr}:${ipPort} dropped.`)}
114+
rconServer.disconnect()
115+
}
116+
})
117+
118+
rconServer.on("response", function (str) {
119+
if (logging == true){console.log(str)}
120+
bridge.store(values.serverMessage, str)
121+
bridge.runner(values.toRunAct)
122+
})
123+
124+
rconServer.on("server", function (str) {
125+
if (logging == true){console.log(str)}
126+
bridge.store(values.serverMessage, str)
127+
bridge.runner(values.toRunAct)
128+
})
129+
130+
rconServer.connect()
131+
}
132132
}

‎Actions/skipInQueue.js

+43-43
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
modVersion = "s.v1.0 | AceFix"
2-
module.exports = {
3-
data: {
4-
name: "Skip In Queue",
5-
skip: 1
6-
},
7-
UI: [
8-
{
9-
element: "input",
10-
name: "Skip Over # Songs",
11-
placeholder: "Number (#)",
12-
storeAs: "skip"
13-
},
14-
{
15-
element: "text",
16-
text: modVersion
17-
}
18-
],
19-
category: "Music",
20-
subtitle: (data, constants) => {
21-
return `Skip: ${data.skip}`;
22-
},
23-
compatibility: ["Any"],
24-
async run(values, message, client, bridge) {
25-
let utilities = bridge.getGlobal({
26-
class: "voice",
27-
name: bridge.guild.id,
28-
});
29-
30-
utilities.queue.splice(0, Number(bridge.transf(values.skip)) - 1);
31-
utilities.forgiveIdling = true;
32-
utilities.player.stop()
33-
// if (utilities.queue[0]) {
34-
// utilities.player.play(utilities.queue[0].audio);
35-
// utilities.nowPlaying = utilities.queue[0];
36-
// utilities.queue.splice(0,1)
37-
// }
38-
39-
// if (utilities.queue.length == 0) {
40-
// client.emit('queueEnd', bridge.guild, utilities.channel)
41-
// }
42-
},
43-
};
1+
modVersion = "s.v1.0 | AceFix"
2+
module.exports = {
3+
data: {
4+
name: "Skip In Queue",
5+
skip: 1
6+
},
7+
UI: [
8+
{
9+
element: "input",
10+
name: "Skip Over # Songs",
11+
placeholder: "Number (#)",
12+
storeAs: "skip"
13+
},
14+
{
15+
element: "text",
16+
text: modVersion
17+
}
18+
],
19+
category: "Music",
20+
subtitle: (data, constants) => {
21+
return `Skip: ${data.skip}`;
22+
},
23+
compatibility: ["Any"],
24+
async run(values, message, client, bridge) {
25+
let utilities = bridge.getGlobal({
26+
class: "voice",
27+
name: bridge.guild.id,
28+
});
29+
30+
utilities.queue.splice(0, Number(bridge.transf(values.skip)) - 1);
31+
utilities.forgiveIdling = true;
32+
utilities.player.stop()
33+
// if (utilities.queue[0]) {
34+
// utilities.player.play(utilities.queue[0].audio);
35+
// utilities.nowPlaying = utilities.queue[0];
36+
// utilities.queue.splice(0,1)
37+
// }
38+
39+
// if (utilities.queue.length == 0) {
40+
// client.emit('queueEnd', bridge.guild, utilities.channel)
41+
// }
42+
},
43+
};

‎Events/queue_start_MOD.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
modVersion = "s.v1.0"
2-
module.exports = {
3-
name: "Queue Start",
4-
nameSchemes: ["Store Voice Channel As"],
5-
initialize(client, data, run) {
6-
client.on('queueStart', (guild, channel) => {
7-
run([
8-
channel
9-
], {guild})
10-
})
11-
}
1+
modVersion = "s.v1.0"
2+
module.exports = {
3+
name: "Queue Start",
4+
nameSchemes: ["Store Voice Channel As"],
5+
initialize(client, data, run) {
6+
client.on('queueStart', (guild, channel) => {
7+
run([
8+
channel
9+
], {guild})
10+
})
11+
}
1212
};

0 commit comments

Comments
 (0)
Please sign in to comment.