mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 01:13:17 +00:00
commit
0f184a9fc6
3
.github/workflows/typescript-build.yml
vendored
3
.github/workflows/typescript-build.yml
vendored
@ -2,7 +2,6 @@ name: TypeScript Build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
tsc:
|
||||
@ -14,8 +13,6 @@ jobs:
|
||||
uses: actions/setup-node@v2.3.1
|
||||
with:
|
||||
node-version: 16
|
||||
- name: npm install -g npm
|
||||
run: npm install -g npm
|
||||
- name: npm install
|
||||
run: npm install
|
||||
- name: tsc
|
||||
|
@ -10,8 +10,6 @@ WORKDIR /usr/src/app
|
||||
|
||||
COPY / /usr/src/app/
|
||||
|
||||
RUN npm install -g npm
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN npm run build
|
||||
|
180
package-lock.json
generated
180
package-lock.json
generated
@ -1,15 +1,17 @@
|
||||
{
|
||||
"name": "eximiabots-radiox",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "eximiabots-radiox",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.6.0",
|
||||
"@discordjs/opus": "^0.6.0",
|
||||
"@discordjs/rest": "^0.1.1-canary.0",
|
||||
"@discordjs/voice": "^0.6.0",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"discord.js": "^13.1.0",
|
||||
@ -19,19 +21,19 @@
|
||||
"path": "^0.12.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.6.1",
|
||||
"@types/node": "^16.7.8",
|
||||
"@types/ws": "^7.4.7",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
||||
"@typescript-eslint/parser": "^4.29.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"nodemon": "^2.0.12",
|
||||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-node": "^10.2.1",
|
||||
"tsc-watch": "^4.5.0",
|
||||
"typescript": "^4.3.5"
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.6.0",
|
||||
@ -163,15 +165,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.6.0.tgz",
|
||||
"integrity": "sha512-mH3Gx61LKk2CD05laCI9K5wp+a3NyASHDUGx83DGJFkqJlRlSV5WMJNY6RS37A5SjqDtGMF4wVR9jzFaqShe6Q==",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"ow": "^0.27.0",
|
||||
"ts-mixer": "^6.0.0",
|
||||
"tslib": "^2.3.0"
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0",
|
||||
@ -231,6 +233,24 @@
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/rest": {
|
||||
"version": "0.1.1-canary.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.1.1-canary.0.tgz",
|
||||
"integrity": "sha512-zUhGBok8eVJYkQjhOVTxVKwglQd0lElhkwCfvRus5xVD46zyz4h0UzoZFVpeAb9GNaAmEazcw/j/2s07DnQcnw==",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^0.2.1",
|
||||
"@sapphire/async-queue": "^1.1.4",
|
||||
"@sapphire/snowflake": "^2.0.0",
|
||||
"abort-controller": "^3.0.0",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"form-data": "^4.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/voice": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.6.0.tgz",
|
||||
@ -377,6 +397,15 @@
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sapphire/snowflake": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-2.0.0.tgz",
|
||||
"integrity": "sha512-gPSOQKmEWeuif2ftmW7gyToCnOoqpDqTSNrxX7HsoMwGNLtrT9p5DHcQolkBg5CEK3ooDFy5DNEFKUshQU7vyQ==",
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
|
||||
@ -604,6 +633,17 @@
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
@ -1273,6 +1313,22 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/discord.js/node_modules/@discordjs/builders": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"ow": "^0.27.0",
|
||||
"ts-mixer": "^6.0.0",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
@ -1437,9 +1493,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-prettier": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz",
|
||||
"integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==",
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz",
|
||||
"integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"prettier-linter-helpers": "^1.0.0"
|
||||
@ -1448,8 +1504,8 @@
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": ">=5.0.0",
|
||||
"prettier": ">=1.13.0"
|
||||
"eslint": ">=7.28.0",
|
||||
"prettier": ">=2.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"eslint-config-prettier": {
|
||||
@ -1632,6 +1688,14 @@
|
||||
"through": "~2.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
@ -1724,6 +1788,19 @@
|
||||
"integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/from": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
|
||||
@ -3940,15 +4017,15 @@
|
||||
}
|
||||
},
|
||||
"@discordjs/builders": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.6.0.tgz",
|
||||
"integrity": "sha512-mH3Gx61LKk2CD05laCI9K5wp+a3NyASHDUGx83DGJFkqJlRlSV5WMJNY6RS37A5SjqDtGMF4wVR9jzFaqShe6Q==",
|
||||
"requires": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"ow": "^0.27.0",
|
||||
"ts-mixer": "^6.0.0",
|
||||
"tslib": "^2.3.0"
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"@discordjs/collection": {
|
||||
@ -3991,6 +4068,21 @@
|
||||
"node-addon-api": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@discordjs/rest": {
|
||||
"version": "0.1.1-canary.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.1.1-canary.0.tgz",
|
||||
"integrity": "sha512-zUhGBok8eVJYkQjhOVTxVKwglQd0lElhkwCfvRus5xVD46zyz4h0UzoZFVpeAb9GNaAmEazcw/j/2s07DnQcnw==",
|
||||
"requires": {
|
||||
"@discordjs/collection": "^0.2.1",
|
||||
"@sapphire/async-queue": "^1.1.4",
|
||||
"@sapphire/snowflake": "^2.0.0",
|
||||
"abort-controller": "^3.0.0",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"form-data": "^4.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
},
|
||||
"@discordjs/voice": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.6.0.tgz",
|
||||
@ -4094,6 +4186,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.4.tgz",
|
||||
"integrity": "sha512-fFrlF/uWpGOX5djw5Mu2Hnnrunao75WGey0sP0J3jnhmrJ5TAPzHYOmytD5iN/+pMxS+f+u/gezqHa9tPhRHEA=="
|
||||
},
|
||||
"@sapphire/snowflake": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-2.0.0.tgz",
|
||||
"integrity": "sha512-gPSOQKmEWeuif2ftmW7gyToCnOoqpDqTSNrxX7HsoMwGNLtrT9p5DHcQolkBg5CEK3ooDFy5DNEFKUshQU7vyQ=="
|
||||
},
|
||||
"@sindresorhus/is": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
|
||||
@ -4238,6 +4335,14 @@
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"requires": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
@ -4746,6 +4851,20 @@
|
||||
"discord-api-types": "^0.22.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"ws": "^7.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/builders": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||
"requires": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"ow": "^0.27.0",
|
||||
"ts-mixer": "^6.0.0",
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"doctrine": {
|
||||
@ -4893,9 +5012,9 @@
|
||||
"requires": {}
|
||||
},
|
||||
"eslint-plugin-prettier": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz",
|
||||
"integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==",
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz",
|
||||
"integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"prettier-linter-helpers": "^1.0.0"
|
||||
@ -5012,6 +5131,11 @@
|
||||
"through": "~2.3.1"
|
||||
}
|
||||
},
|
||||
"event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
@ -5092,6 +5216,16 @@
|
||||
"integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==",
|
||||
"dev": true
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
|
||||
|
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eximiabots-radiox",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"description": "Internet Radio to your Discord guild",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -18,7 +18,9 @@
|
||||
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.6.0",
|
||||
"@discordjs/opus": "^0.6.0",
|
||||
"@discordjs/rest": "^0.1.1-canary.0",
|
||||
"@discordjs/voice": "^0.6.0",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"discord.js": "^13.1.0",
|
||||
@ -28,19 +30,19 @@
|
||||
"path": "^0.12.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.6.1",
|
||||
"@types/node": "^16.7.8",
|
||||
"@types/ws": "^7.4.7",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
||||
"@typescript-eslint/parser": "^4.29.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"nodemon": "^2.0.12",
|
||||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-node": "^10.2.1",
|
||||
"tsc-watch": "^4.5.0",
|
||||
"typescript": "^4.3.5"
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.6.0",
|
||||
|
@ -5,18 +5,16 @@ import Datastore from "./client/datastore.js";
|
||||
import { command, radio } from "./client/utils/typings.js";
|
||||
import config from "./config.js";
|
||||
import messages from "./client/messages.js";
|
||||
import path from "path"
|
||||
import path from "path";
|
||||
|
||||
const GatewayIntents = new Discord.Intents();
|
||||
GatewayIntents.add(
|
||||
1 << 0, // GUILDS
|
||||
1 << 7, // GUILD_VOICE_STATES
|
||||
1 << 9 // GUILD_MESSAGES
|
||||
);
|
||||
|
||||
class RadioClient extends Client {
|
||||
readonly commands: Collection<string, command>;
|
||||
readonly commandAliases: Collection<string, command>;
|
||||
readonly radio: Map<string, radio>;
|
||||
public funcs: any;
|
||||
readonly config = config;
|
||||
@ -27,7 +25,6 @@ class RadioClient extends Client {
|
||||
intents: GatewayIntents
|
||||
});
|
||||
this.commands = new Collection();
|
||||
this.commandAliases = new Collection();
|
||||
this.radio = new Map();
|
||||
this.datastore = null;
|
||||
|
||||
@ -35,23 +32,22 @@ class RadioClient extends Client {
|
||||
this.funcs.check = require("./client/funcs/check.js");
|
||||
this.funcs.checkFetchStatus = require("./client/funcs/checkFetchStatus.js");
|
||||
this.funcs.isDev = require("./client/funcs/isDev.js");
|
||||
this.funcs.logger = require("./client/funcs/logger.js");
|
||||
this.funcs.msToTime = require("./client/funcs/msToTime.js");
|
||||
this.funcs.statisticsUpdate = require("./client/funcs/statisticsUpdate.js");
|
||||
|
||||
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./client/commands/${file}`);
|
||||
command.uses = 0;
|
||||
this.commands.set(command.name, command);
|
||||
this.commandAliases.set(command.alias, command);
|
||||
}
|
||||
|
||||
this.on("ready", () => {
|
||||
require(`${events}ready`).execute(this, Discord);
|
||||
require(`${events}ready`).execute(this);
|
||||
this.datastore = new Datastore();
|
||||
});
|
||||
this.on("messageCreate", msg => {
|
||||
require(`${events}msg`).execute(this, msg, Discord);
|
||||
this.on("interactionCreate", interaction => {
|
||||
require(`${events}interactionCreate`).execute(this, interaction);
|
||||
});
|
||||
this.on("voiceStateUpdate", (oldState, newState) => {
|
||||
require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
|
||||
|
67
src/client/commands.js
Normal file
67
src/client/commands.js
Normal file
@ -0,0 +1,67 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { REST } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v9');
|
||||
const { token, version } = require('../config.js');
|
||||
const fs = require('fs');
|
||||
const path = require ('path');
|
||||
|
||||
module.exports = {
|
||||
async execute(client) {
|
||||
const commands = [];
|
||||
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
|
||||
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands/${file}`);
|
||||
command.data = new SlashCommandBuilder()
|
||||
.setName(command.name)
|
||||
.setDescription(command.description);
|
||||
|
||||
command.data = command.data.toJSON();
|
||||
if(command.options) {
|
||||
command.options.forEach(function(option) {
|
||||
if(option.type == "STRING") option.type = 3;
|
||||
command.data.options.push(option);
|
||||
});
|
||||
}
|
||||
|
||||
commands.push(command.data);
|
||||
}
|
||||
|
||||
const rest = new REST({ version: '9' }).setToken(token);
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
client.funcs.logger('Slash Commands', 'Started refreshing application (/) commands.');
|
||||
|
||||
if(version.includes("-dev")){
|
||||
await rest.put(
|
||||
Routes.applicationCommands(client.user.id),
|
||||
{ body: [] },
|
||||
);
|
||||
|
||||
let guilds = await client.guilds.fetch();
|
||||
guilds.forEach(async guild => {
|
||||
try {
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(client.user.id, guild.id),
|
||||
{ body: commands },
|
||||
);
|
||||
} catch (DiscordAPIError) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await rest.put(
|
||||
Routes.applicationCommands(client.user.id),
|
||||
{ body: commands },
|
||||
);
|
||||
}
|
||||
|
||||
client.funcs.logger('Slash Commands', 'Successfully reloaded application (/) commands.' + "\n");
|
||||
} catch (error) {
|
||||
client.funcs.logger('Slash Commands', 'Reloading application (/) commands failed.' + "\n");
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ module.exports = {
|
||||
description: 'Report a bug',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
||||
@ -17,7 +17,10 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.bugDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
@ -5,48 +5,32 @@ module.exports = {
|
||||
description: 'Get help using bot',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
if (args[1]) {
|
||||
if (!client.commands.has(args[1]) || (client.commands.has(args[1]) && client.commands.get(args[1]).omitFromHelp === true)) return msg.channel.send('That command does not exist');
|
||||
const command = client.commands.get(args[1]);
|
||||
|
||||
message.helpCommandTitle = client.messages.helpCommandTitle.replace("%client.config.prefix%", client.config.prefix);
|
||||
message.helpCommandTitle = message.helpCommandTitle.replace("%command.name%", command.name);
|
||||
message.helpCommandTitle = message.helpCommandTitle.replace("%command.usage%", command.usage);
|
||||
message.helpCommandDescription = client.messages.helpCommandDescription.replace("%command.description%", command.description);
|
||||
message.helpCommandDescription = message.helpCommandDescription.replace("%command.alias%", command.alias);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.helpCommandTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpCommandDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
} else {
|
||||
const categories = [];
|
||||
let commandsToArray = Array.from(client.commands.values());
|
||||
for (let i = 0; i < client.commands.size; i++) {
|
||||
if (!categories.includes(commandsToArray[i].category)) categories.push(commandsToArray[i].category);
|
||||
}
|
||||
let commands = '';
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`;
|
||||
}
|
||||
|
||||
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
||||
message.helpDescription = client.messages.helpDescription.replace("%commands%", commands);
|
||||
message.helpDescription = message.helpDescription.replace("%client.config.prefix%", client.config.prefix);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.helpTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
const categories = [];
|
||||
for (let i = 0; i < client.commands.size; i++) {
|
||||
if (!categories.includes([...client.commands.values()][i].category)) categories.push([...client.commands.values()][i].category);
|
||||
}
|
||||
let commands = '';
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`;
|
||||
}
|
||||
|
||||
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
||||
message.helpDescription = client.messages.helpDescription.replace("%commands%", commands);
|
||||
message.helpDescription = message.helpDescription.replace("%client.config.prefix%", client.config.prefix);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.helpTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -5,14 +5,18 @@ module.exports = {
|
||||
description: 'Invite Bot',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.inviteTitle)
|
||||
.setColor(client.config.embedColor)
|
||||
.setURL("https://discordapp.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=3427328&scope=bot")
|
||||
.setURL("https://discordapp.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=2184465408&scope=applications.commands%20bot") //View Channels, Send Messages, Embed Links, Use External Emojis, Use Slash Commands, Connect, Speak, Use Voice Activity
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
@ -2,19 +2,19 @@ module.exports = {
|
||||
name: 'list',
|
||||
alias: 'l',
|
||||
usage: '',
|
||||
description: 'List radio stations.',
|
||||
description: 'List radio stations',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
||||
const hashs = stations.split('**#**').length;
|
||||
for (let i = 0; i < hashs; i++) {
|
||||
stations = stations.replace('**#**', `**${i + 1}**`);
|
||||
stations = stations.replace('**#**', `**${i + 1}.**`);
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
@ -23,6 +23,10 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(stations)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
@ -5,14 +5,14 @@ module.exports = {
|
||||
description: 'Bot Maintenance',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
if(!client.funcs.isDev(client.config.devId, msg.author.id)) return msg.channel.send(client.messageEmojis["error"] + client.messages.notAllowed);
|
||||
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply(client.messageEmojis["error"] + client.messages.notAllowed);
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
let currentRadios = client.radio.keys();
|
||||
@ -27,8 +27,8 @@ module.exports = {
|
||||
|
||||
if(currentRadio){
|
||||
client.funcs.statisticsUpdate(client, currentRadio.currentGuild.guild, currentRadio);
|
||||
currentRadio.connection.destroy();
|
||||
currentRadio.audioPlayer.stop();
|
||||
currentRadio.connection?.destroy();
|
||||
currentRadio.audioPlayer?.stop();
|
||||
const cembed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
@ -48,6 +48,10 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
@ -5,19 +5,23 @@ module.exports = {
|
||||
description: 'Current Radio Station',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
if (!radio) return msg.channel.send('There is nothing playing.');
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
const completed = (radio.connection.dispatcher.streamTime.toFixed(0));
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
if (!radio) return interaction.reply('There is nothing playing.');
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
let date = new Date();
|
||||
radio.currentTime = date.getTime();
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
const completed = (radio.playTime);
|
||||
|
||||
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed, \"hh:mm:ss\")%", client.funcs.msToTime(completed, "hh:mm:ss"));
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed)%", client.funcs.msToTime(completed));
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.nowplayingTitle)
|
||||
@ -25,6 +29,10 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.nowplayingDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
@ -9,88 +9,150 @@ module.exports = {
|
||||
name: "play",
|
||||
alias: "p",
|
||||
usage: "<song name>",
|
||||
description: "Play some music.",
|
||||
description: "Play radio",
|
||||
options: [
|
||||
{ type: "STRING", name: "query", description: "Select station", required: false}
|
||||
],
|
||||
permission: "none",
|
||||
category: "radio",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
let url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
if (!radio) {
|
||||
if (!msg.member.voice.channel)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.noVoiceChannel
|
||||
let query = interaction.options?.getString("query") ?? interaction.values?.[0];
|
||||
if(!query){
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
let stations = new Array();
|
||||
|
||||
let options = new Array();
|
||||
options[1] = new Array();
|
||||
options[2] = new Array();
|
||||
|
||||
stations[1] = client.stations.slice(0,24).forEach(station => {
|
||||
station = {
|
||||
label: station.name,
|
||||
description: station.owner,
|
||||
value: station.name
|
||||
};
|
||||
options[1].push(station);
|
||||
});
|
||||
|
||||
stations[2] = client.stations.slice(25).forEach(station => {
|
||||
station = {
|
||||
label: station.name,
|
||||
description: station.owner,
|
||||
value: station.name
|
||||
};
|
||||
options[2].push(station);
|
||||
});
|
||||
|
||||
const menu = new Discord.MessageActionRow()
|
||||
.addComponents(
|
||||
new Discord.MessageSelectMenu()
|
||||
.setCustomId('play')
|
||||
.setPlaceholder('Nothing selected')
|
||||
.addOptions(options[1])
|
||||
.addOptions(options[2])
|
||||
);
|
||||
|
||||
stations = null;
|
||||
options = null;
|
||||
|
||||
return interaction.reply({
|
||||
content: '**Select station:**',
|
||||
components: [menu],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
let url = query ? query.replace(/<(.+)>/g, "$1") : "";
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
const voiceChannel = interaction.member.voice.channel;
|
||||
if (!radio) {
|
||||
if (!interaction.member.voice.channel)
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.noVoiceChannel,
|
||||
ephemeral: true
|
||||
});
|
||||
} else {
|
||||
if (voiceChannel !== radio.voiceChannel)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.wrongVoiceChannel
|
||||
);
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.wrongVoiceChannel,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
if (!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace(
|
||||
"%client.config.supportGuild%",
|
||||
client.config.supportGuild
|
||||
);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + message.errorToGetPlaylist,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
if (!args[1]) return msg.channel.send(client.messages.noQuery);
|
||||
const permissions = voiceChannel.permissionsFor(msg.client.user);
|
||||
if (!query) return interaction.reply(client.messages.noQuery);
|
||||
const permissions = voiceChannel.permissionsFor(interaction.client.user);
|
||||
if (!permissions.has("CONNECT")) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsConnect);
|
||||
return interaction.reply(client.messageEmojis["error"] + client.messages.noPermsConnect);
|
||||
}
|
||||
if (!permissions.has("SPEAK")) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsSpeak);
|
||||
return interaction.reply(client.messageEmojis["error"] + client.messages.noPermsSpeak);
|
||||
}
|
||||
let station;
|
||||
const number = parseInt(args[1] - 1);
|
||||
const number = parseInt(query - 1);
|
||||
if (url.startsWith("http")) {
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.errorStationURL
|
||||
);
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.errorStationURL,
|
||||
ephemeral: true
|
||||
});
|
||||
} else if (!isNaN(number)) {
|
||||
if (number > client.stations.length - 1) {
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.wrongStationNumber
|
||||
);
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.wrongStationNumber,
|
||||
ephemeral: true
|
||||
});
|
||||
} else {
|
||||
url = client.stations[number].stream[client.stations[number].stream.default];
|
||||
station = client.stations[number];
|
||||
}
|
||||
} else {
|
||||
if (args[1].length < 3)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.tooShortSearch
|
||||
);
|
||||
const sstation = await searchStation(args.slice(1).join(" "), client);
|
||||
if (query.length < 3)
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.tooShortSearch,
|
||||
ephemeral: true
|
||||
});
|
||||
const sstation = await searchStation(query, client);
|
||||
if (!sstation)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.noSearchResults
|
||||
);
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.noSearchResults,
|
||||
ephemeral: true
|
||||
});
|
||||
url = sstation.stream[sstation.stream.default];
|
||||
station = sstation;
|
||||
}
|
||||
|
||||
if (radio) {
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
||||
radio.audioPlayer.stop();
|
||||
|
||||
radio.station = station;
|
||||
radio.textChannel = msg.channel;
|
||||
play(msg.guild, client, url);
|
||||
radio.textChannel = interaction.channel;
|
||||
play(interaction, interaction.guild, client, url, Discord);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const construct = {
|
||||
textChannel: msg.channel,
|
||||
textChannel: interaction.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
message: null,
|
||||
audioPlayer: createAudioPlayer(),
|
||||
station: station
|
||||
};
|
||||
client.radio.set(msg.guild.id, construct);
|
||||
client.radio.set(interaction.guild.id, construct);
|
||||
|
||||
try {
|
||||
const connection =
|
||||
@ -103,25 +165,26 @@ module.exports = {
|
||||
construct.connection = connection;
|
||||
let date = new Date();
|
||||
construct.startTime = date.getTime();
|
||||
play(msg.guild, client, url);
|
||||
play(interaction, interaction.guild, client, url, Discord);
|
||||
|
||||
client.datastore.checkEntry(msg.guild.id);
|
||||
construct.currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
client.datastore.checkEntry(interaction.guild.id);
|
||||
construct.currentGuild = client.datastore.getEntry(interaction.guild.id);
|
||||
|
||||
if (!construct.currentGuild.statistics[construct.station.name]) {
|
||||
construct.currentGuild.statistics[construct.station.name] = {};
|
||||
construct.currentGuild.statistics[construct.station.name].time = 0;
|
||||
construct.currentGuild.statistics[construct.station.name].used = 0;
|
||||
client.datastore.updateEntry(msg.guild, construct.currentGuild);
|
||||
client.datastore.updateEntry(interaction.guild, construct.currentGuild);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
client.radio.delete(msg.guild.id);
|
||||
return msg.channel.send(client.messageEmojis["error"] + `An error occured: ${error}`);
|
||||
client.radio.delete(interaction.guild.id);
|
||||
return interaction.reply(client.messageEmojis["error"] + `An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
function play(guild, client, url) {
|
||||
|
||||
async function play(interaction, guild, client, url, Discord) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(guild.id);
|
||||
const resource = createAudioResource(url);
|
||||
@ -129,24 +192,85 @@ function play(guild, client, url) {
|
||||
radio.audioPlayer.play(resource);
|
||||
resource.playStream
|
||||
.on("readable", () => {
|
||||
console.log("Stream started");
|
||||
client.funcs.logger('Radio', 'Stream started' + " / " + guild.id + " / " + radio.station.name);
|
||||
})
|
||||
.on("finish", () => {
|
||||
console.log("Stream finished");
|
||||
client.funcs.logger('Radio', 'Stream finished' + " / " + guild.id);
|
||||
client.funcs.statisticsUpdate(client, guild, radio);
|
||||
radio.connection.destroy();
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.radio.delete(guild.id);
|
||||
return;
|
||||
})
|
||||
.on("error", error => {
|
||||
client.funcs.logger('Radio', 'Stream errored');
|
||||
console.error(error);
|
||||
radio.connection.destroy();
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.radio.delete(guild.id);
|
||||
return radio.textChannel.send(client.messages.errorPlaying);
|
||||
return interaction.reply(client.messages.errorPlaying);
|
||||
});
|
||||
|
||||
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed)%", "");
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("**", "");
|
||||
message.nowplayingDescription = message.nowplayingDescription.replace("**", "");
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.user.username)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.addField(client.messages.nowplayingTitle, message.nowplayingDescription, true)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
|
||||
const buttons = new Discord.MessageActionRow()
|
||||
.addComponents(
|
||||
new Discord.MessageButton()
|
||||
.setCustomId('list')
|
||||
.setEmoji(client.messageEmojis["list"])
|
||||
.setStyle('SECONDARY')
|
||||
)
|
||||
.addComponents(
|
||||
new Discord.MessageButton()
|
||||
.setCustomId('prev')
|
||||
.setEmoji(client.messageEmojis["prev"])
|
||||
.setStyle('SECONDARY')
|
||||
.setDisabled(true)
|
||||
)
|
||||
.addComponents(
|
||||
new Discord.MessageButton()
|
||||
.setCustomId('stop')
|
||||
.setEmoji(client.messageEmojis["stop"])
|
||||
.setStyle('SECONDARY')
|
||||
)
|
||||
.addComponents(
|
||||
new Discord.MessageButton()
|
||||
.setCustomId('next')
|
||||
.setEmoji(client.messageEmojis["next"])
|
||||
.setStyle('SECONDARY')
|
||||
.setDisabled(true)
|
||||
)
|
||||
.addComponents(
|
||||
new Discord.MessageButton()
|
||||
.setCustomId('statistics')
|
||||
.setEmoji(client.messageEmojis["statistics"])
|
||||
.setStyle('SECONDARY')
|
||||
);
|
||||
|
||||
if(!radio.message){
|
||||
radio.message = await radio.textChannel.send({ embeds: [embed], components: [buttons] });
|
||||
} else {
|
||||
radio.message.edit({ embeds: [embed], components: [buttons] });
|
||||
}
|
||||
|
||||
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
|
||||
radio.textChannel.send(client.messageEmojis["play"] + message.play);
|
||||
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["play"] + message.play,
|
||||
ephemeral: true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function searchStation(key, client) {
|
||||
@ -154,6 +278,15 @@ function searchStation(key, client) {
|
||||
let foundStations = [];
|
||||
if (!key) return false;
|
||||
if (key == "radio") return false;
|
||||
|
||||
client.stations
|
||||
.filter(
|
||||
x => x.name.toUpperCase().includes(key.toUpperCase()) || x === key
|
||||
)
|
||||
.forEach(x =>
|
||||
foundStations.push({ station: x, name: x.name, probability: 100 })
|
||||
);
|
||||
|
||||
if (key.startsWith("radio ")) key = key.slice(6);
|
||||
const probabilityIncrement = 100 / key.split(" ").length / 2;
|
||||
for (let i = 0; i < key.split(" ").length; i++) {
|
||||
|
@ -2,19 +2,19 @@ module.exports = {
|
||||
name: 'statistics',
|
||||
alias: 'stats',
|
||||
usage: '',
|
||||
description: 'Show usage statistics.',
|
||||
description: 'Show statistics',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
let stations = client.stations;
|
||||
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
let currentGuild = client.datastore.getEntry(interaction.guild.id);
|
||||
let statistics = "";
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
||||
statistics = "You have not listened any radio station";
|
||||
@ -22,7 +22,7 @@ module.exports = {
|
||||
Object.keys(stations).forEach(function(station) {
|
||||
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) > 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) > 0){
|
||||
statistics += `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "dd:hh:mm:ss") + "\n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time) + "\n";
|
||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||
}
|
||||
});
|
||||
@ -34,6 +34,10 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(statistics)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
};
|
@ -1,27 +1,31 @@
|
||||
module.exports = {
|
||||
name: 'status',
|
||||
alias: 'none',
|
||||
alias: 'st',
|
||||
usage: '',
|
||||
description: 'Bot Status',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
async execute(interaction, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
||||
let uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss");
|
||||
let uptime = client.funcs.msToTime(client.uptime);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.statusTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.addField(client.messages.statusField1, Date.now() - msg.createdTimestamp + "ms", true)
|
||||
.addField(client.messages.statusField1, Date.now() - interaction.createdTimestamp + "ms", true)
|
||||
.addField(client.messages.statusField2, client.ws.ping + "ms", true)
|
||||
.addField(client.messages.statusField3, uptime, true)
|
||||
.addField(client.messages.statusField4, client.config.version, true)
|
||||
.addField(client.messages.statusField5, client.config.hostedBy, true)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed],
|
||||
ephemeral: true
|
||||
});
|
||||
|
||||
}
|
||||
};
|
@ -1,18 +1,41 @@
|
||||
module.exports = {
|
||||
name: 'stop',
|
||||
description: 'Stop command.',
|
||||
alias: 's',
|
||||
usage: '',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.radio.delete(msg.guild.id);
|
||||
msg.channel.send(client.messageEmojis["stop"] + client.messages.stop);
|
||||
}
|
||||
}
|
||||
name: 'stop',
|
||||
description: 'Stop radio',
|
||||
alias: 's',
|
||||
usage: '',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
async execute(interaction, client, Discord, command) {
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + interaction.guild.id);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.user.username)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.addField(client.messages.nowplayingTitle, "-", true)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
|
||||
if(!radio.message){
|
||||
radio.message = await radio.textChannel.send({ embeds: [embed], components: [] });
|
||||
} else {
|
||||
radio.message.edit({ embeds: [embed], components: [] });
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
radio.message.delete();
|
||||
}, 5000);
|
||||
|
||||
client.radio.delete(interaction.guild.id);
|
||||
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["stop"] + client.messages.stop,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
@ -9,7 +9,9 @@ module.exports = {
|
||||
stop: "<:RadioXStop:688541155377414168>",
|
||||
statistics: "<:RadioXStatistics:694954485507686421>",
|
||||
maintenance: "<:RadioXMaintenance:695043843057254493>",
|
||||
error: "<:RadioXError:688541155792781320>"
|
||||
error: "<:RadioXError:688541155792781320>",
|
||||
prev: "<:RadioXPrev:882153637370023957>",
|
||||
next: "<:RadioXNext:882153637474893834>"
|
||||
};
|
||||
|
||||
let fallbackEmojis = {
|
||||
@ -20,7 +22,9 @@ module.exports = {
|
||||
stop: "⏹️",
|
||||
statistics: "📊",
|
||||
maintenance: "🛠️",
|
||||
error: "❌"
|
||||
error: "❌",
|
||||
prev: "⏪",
|
||||
next: "⏩"
|
||||
};
|
||||
|
||||
client.messageEmojis = {};
|
||||
|
35
src/client/events/interactionCreate.js
Normal file
35
src/client/events/interactionCreate.js
Normal file
@ -0,0 +1,35 @@
|
||||
import Discord from "discord.js";
|
||||
|
||||
module.exports = {
|
||||
name: 'interactionCreate',
|
||||
async execute(client, interaction) {
|
||||
/*if (!interaction.isCommand()) return;*/
|
||||
|
||||
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
||||
if (!permissions.has('EMBED_LINKS')) return interaction.send(client.messages.noPermsEmbed);
|
||||
|
||||
if(interaction.isCommand()){
|
||||
const commandName = interaction.commandName;
|
||||
const command = client.commands.get(commandName);
|
||||
if (!command) return;
|
||||
|
||||
try {
|
||||
command.execute(interaction, client, Discord, command);
|
||||
} catch (error) {
|
||||
interaction.reply(client.messages.runningCommandFailed);
|
||||
console.error(error);
|
||||
}
|
||||
} else if (interaction.isSelectMenu() || interaction.isButton()){
|
||||
const commandName = interaction.customId;
|
||||
const command = client.commands.get(commandName);
|
||||
if (!command) return;
|
||||
|
||||
try {
|
||||
command.execute(interaction, client, Discord, command);
|
||||
} catch (error) {
|
||||
interaction.reply(client.messages.runningCommandFailed);
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'message',
|
||||
async execute(client, msg, Discord) {
|
||||
if (msg.author.bot || !msg.guild) return;
|
||||
let prefix = client.config.prefix;
|
||||
if(msg.mentions.members.first()){
|
||||
if(msg.mentions.members.first().user.id === client.user.id){
|
||||
prefix = "<@!" + client.user.id + "> ";
|
||||
}
|
||||
}
|
||||
const args = msg.content.slice(prefix.length).split(' ');
|
||||
if (!msg.content.startsWith(prefix)) return;
|
||||
if (!args[0]) return;
|
||||
const commandName = args[0].toLowerCase();
|
||||
if (commandName === 'none') return;
|
||||
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
||||
if (!command && msg.content !== `${prefix}`) return;
|
||||
const permissions = msg.channel.permissionsFor(msg.client.user);
|
||||
if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
|
||||
try {
|
||||
command.execute(msg, args, client, Discord, command);
|
||||
} catch (error) {
|
||||
msg.reply(client.messages.runningCommandFailed);
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,38 +2,59 @@ const fetch = require('node-fetch');
|
||||
|
||||
module.exports = {
|
||||
name: 'ready',
|
||||
async execute(client, Discord) {
|
||||
async execute(client) {
|
||||
|
||||
console.log('RadioX');
|
||||
console.log('RadioX ' + client.config.version);
|
||||
console.log('Internet Radio to your Discord guild');
|
||||
console.log('(c)2020-2021 EximiaBots by Warén Group');
|
||||
console.log('');
|
||||
|
||||
/*DEVELOPERS*/
|
||||
client.funcs.logger('Developers', 'List');
|
||||
|
||||
client.developers = "";
|
||||
let user = "";
|
||||
for (let i = 0; i < client.config.devId.length; i++) {
|
||||
user = await client.users.fetch(client.config.devId[i]);
|
||||
console.log(" - " + user.tag);
|
||||
if (i == client.config.devId.length - 1) {
|
||||
client.developers += user.tag;
|
||||
} else {
|
||||
client.developers += user.tag + " & ";
|
||||
}
|
||||
}
|
||||
console.log("\n");
|
||||
|
||||
/*STATIONS*/
|
||||
try {
|
||||
client.funcs.logger('Stations', 'Started fetching list – ' + client.config.stationslistUrl);
|
||||
client.stations = await fetch(client.config.stationslistUrl)
|
||||
.then(client.funcs.checkFetchStatus)
|
||||
.then(response => response.json());
|
||||
|
||||
client.funcs.logger('Stations', 'List');
|
||||
client.stations.forEach(station => {
|
||||
console.log(" - " + station.name);
|
||||
});
|
||||
console.log("\n");
|
||||
|
||||
client.funcs.logger('Stations', 'Successfully fetched list');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
client.funcs.logger('Stations', 'Fetching list failed');
|
||||
console.error(error + "\n");
|
||||
}
|
||||
|
||||
setInterval(async () => {
|
||||
try {
|
||||
client.funcs.logger('Stations', 'Started fetching list – ' + client.config.stationslistUrl);
|
||||
client.stations = await fetch(client.config.stationslistUrl)
|
||||
.then(client.funcs.checkFetchStatus)
|
||||
.then(response => response.json());
|
||||
|
||||
client.funcs.logger('Stations', 'Successfully fetched list');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
client.funcs.logger('Stations', 'Fetching list failed');
|
||||
//console.error(error);
|
||||
}
|
||||
}, 3600000);
|
||||
|
||||
@ -41,8 +62,26 @@ module.exports = {
|
||||
client.user.setStatus('dnd');
|
||||
}
|
||||
|
||||
/*GUILDS*/
|
||||
client.funcs.logger('Guilds', 'Started fetching list');
|
||||
|
||||
client.funcs.logger('Guilds', 'List');
|
||||
let guilds = await client.guilds.fetch();
|
||||
guilds.forEach(guild => {
|
||||
console.log(" - " + guild.id + ": " + guild.name);
|
||||
});
|
||||
console.log("\n");
|
||||
|
||||
client.funcs.logger('Guilds', 'Successfully fetched list');
|
||||
|
||||
/*STATISTICS*/
|
||||
client.datastore.calculateGlobal(client);
|
||||
|
||||
/*EMOJIS*/
|
||||
require(`../emojis.js`).execute(client);
|
||||
|
||||
/*COMMANDS*/
|
||||
require(`../commands.js`).execute(client);
|
||||
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ module.exports = {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
||||
return client.radio.delete(newState.guild.id);
|
||||
}
|
||||
|
||||
@ -38,6 +39,7 @@ module.exports = {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
||||
client.radio.delete(oldState.guild.id);
|
||||
}
|
||||
return;
|
||||
@ -56,9 +58,10 @@ module.exports = {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
||||
client.radio.delete(newState.guild.id);
|
||||
}
|
||||
}, 120000);
|
||||
}, 60000);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -1,19 +1,28 @@
|
||||
module.exports = function (client, msg, command) {
|
||||
module.exports = function (client, interaction, command) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const permissions = msg.channel.permissionsFor(msg.author);
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
const permissions = interaction.channel.permissionsFor(interaction.user);
|
||||
if (!radio) {
|
||||
msg.channel.send(client.messageEmojis["error"] + client.messages.notPlaying);
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.notPlaying,
|
||||
ephemeral: true
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (msg.member.voice.channel !== radio.voiceChannel) {
|
||||
msg.channel.send(client.messageEmojis["error"] + client.messages.wrongVoiceChannel);
|
||||
if (interaction.member.voice.channel !== radio.voiceChannel) {
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.wrongVoiceChannel,
|
||||
ephemeral: true
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if(!command.permission == 'none'){
|
||||
if (!permissions.has(command.permission)) {
|
||||
message.noPerms = client.messages.noPerms.replace("%command.permission%", command.permission);
|
||||
msg.channel.send(client.messageEmojis["error"] + message.noPerms);
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["error"] + message.noPerms,
|
||||
ephemeral: true
|
||||
});
|
||||
return false;
|
||||
} else return true;
|
||||
} else return true;
|
||||
|
4
src/client/funcs/logger.js
Normal file
4
src/client/funcs/logger.js
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = function (area, text){
|
||||
let date = new Date();
|
||||
console.log('[' + area + '] – ' + date.toISOString() + '\n' + text + '\n');
|
||||
}
|
@ -1,17 +1,12 @@
|
||||
module.exports = function msToTime(duration, format) {
|
||||
var seconds = Math.floor((duration / 1000) % 60),
|
||||
module.exports = function msToTime(duration) {
|
||||
let seconds = Math.floor((duration / 1000) % 60),
|
||||
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
||||
hours = Math.floor((duration / (1000 * 60 * 60)) % 24),
|
||||
days = Math.floor((duration / (1000 * 60 * 60 * 24)));
|
||||
|
||||
days = (days < 10) ? "0" + days : days;
|
||||
hours = (hours < 10) ? "0" + hours : hours;
|
||||
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
||||
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
||||
|
||||
if (format === "hh:mm:ss") {
|
||||
return `${hours}:${minutes}:${seconds}`;
|
||||
} else if (format === "dd:hh:mm:ss") {
|
||||
return `${days}:${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
return +days > 0
|
||||
? `${days}:${+hours < 10 ? `0${hours}` : hours}:${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}`
|
||||
: +hours > 0
|
||||
? `${+hours < 10 ? `0${hours}` : hours}:${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}`
|
||||
: `${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}`;
|
||||
}
|
@ -13,7 +13,7 @@ module.exports = {
|
||||
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
||||
listTitle: "Radio Stations",
|
||||
nowplayingTitle: "Now Playing",
|
||||
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed, \"hh:mm:ss\")%",
|
||||
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed)%",
|
||||
noVoiceChannel: "You need to be in a voice channel to play radio!",
|
||||
noQuery: "You need to use a number or search for a supported station!",
|
||||
noPermsConnect: "I cannot connect to your voice channel.",
|
||||
|
@ -21,6 +21,7 @@ module.exports = {
|
||||
|
||||
//Settings
|
||||
prefix: process.env.RADIOX_PREFIX || "rx-",
|
||||
version: process.env.RADIOX_VERSION || process.env.npm_package_version
|
||||
version: process.env.RADIOX_VERSION || process.env.npm_package_version,
|
||||
debug: process.env.DEBUG_MODE || false
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user