mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 14:23:41 +00:00
Compare commits
105 Commits
Author | SHA1 | Date | |
---|---|---|---|
e39a24de2a | |||
aa715aaafa | |||
9303dd1c19 | |||
9a5075f27e | |||
60ef1cd138 | |||
235a02ca60 | |||
05852b99d4 | |||
01730cd08b | |||
6335a4617f | |||
552d3c81f9 | |||
2d9b0ce732 | |||
3b0f8068c1 | |||
c142fc61b4 | |||
dcfde4131f | |||
a1cb21d98e | |||
4c731c1942 | |||
d2a6d70cf6 | |||
a86cf0c769 | |||
7a0a3e0d50 | |||
479c0ee13d | |||
b280981e1c | |||
933140502d | |||
dfada15b00 | |||
8fdcdd0116 | |||
11573a5113 | |||
7e3a83743d | |||
38af503626 | |||
534bc74936 | |||
ea2be5d5fb | |||
38a8571ddc | |||
2d41c7a76b | |||
16bc2aab52 | |||
17132cd51a | |||
ec6ea7e839 | |||
c81dbddab1 | |||
e0226c5cfe | |||
3f12bafee0 | |||
3fc28a79cb | |||
72d0054d25 | |||
25356be323 | |||
e8d90f8a3c | |||
c724ae502f | |||
a3efdbf3cb | |||
2857b6886f | |||
1e24e89568 | |||
3609e6af10 | |||
d5fefcdbbc | |||
8860952c07 | |||
d27cdf6ee5 | |||
0d4c46cfd4 | |||
9ef6b3f36f | |||
1a5caf244f | |||
9040b84050 | |||
1518ff7809 | |||
ba5b142bbe | |||
4ccace9450 | |||
711e6d48fb | |||
83cfec4678 | |||
90f47825b6 | |||
b0270e651e | |||
238a67c267 | |||
2e5f0a781a | |||
d9e57a47e9 | |||
13a085b9de | |||
fddc57d90e | |||
9d9ae80dbe | |||
314c744527 | |||
555b4d14f0 | |||
0f4e0b952b | |||
3ec1892a09 | |||
7d4fb50351 | |||
179914a2f2 | |||
a8fc38ffca | |||
329986be53 | |||
5ec4ea6aae | |||
e546001be8 | |||
f2158ba8ae | |||
a1f85a0d19 | |||
430e0f9e51 | |||
45b23722fa | |||
66ace838c6 | |||
8e9546097f | |||
61981a5b0b | |||
65f83bc522 | |||
74239f71a7 | |||
46237fd91e | |||
bf0811945a | |||
706e65bc06 | |||
12337f499b | |||
da71137f68 | |||
45bd690c05 | |||
eba7551329 | |||
fea24ec1aa | |||
1fd6c2c691 | |||
492df398ff | |||
a1d4e356a6 | |||
c4fb1d5147 | |||
b6c47d7c6f | |||
5208a3feb1 | |||
8a10697edd | |||
f786abebe4 | |||
5e53a908e7 | |||
0d795a6efb | |||
01514454bf | |||
3dd5b9d36e |
@ -1,3 +1,2 @@
|
|||||||
DISCORD_TOKEN=
|
DISCORD_TOKEN=
|
||||||
RADIOX_STATIONSLISTURL=https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json
|
RADIOX_STATIONSLISTURL=https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json
|
||||||
RADIOX_PREFIX=rx-
|
|
@ -4,12 +4,9 @@ Internet Radio to your Discord guild
|
|||||||
## [Radio Stations List](https://gitea.cwinfo.org/cwchristerw/radio)
|
## [Radio Stations List](https://gitea.cwinfo.org/cwchristerw/radio)
|
||||||
This bot is using Gitea repo to get radio stations from [playlist.json](https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json) file. List is currently maintained by Christer Warén. You can use alternative list with same format when using RADIOX_STATIONSLISTURL environment variable.
|
This bot is using Gitea repo to get radio stations from [playlist.json](https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json) file. List is currently maintained by Christer Warén. You can use alternative list with same format when using RADIOX_STATIONSLISTURL environment variable.
|
||||||
|
|
||||||
## PREFIX
|
|
||||||
Default prefix is "rx-" and you can change it with using RADIOX_PREFIX environment variable.
|
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
1. `docker build -t warengroup/eximiabots-radiox .`
|
1. `docker build -t warengroup/eximiabots-radiox .`
|
||||||
2. `docker run --name radiox-dev -d --net host -e DISCORD_TOKEN= -e RADIOX_PREFIX="rx-" -v "$PWD/datastore":/usr/src/app/datastore/ warengroup/eximiabots-radiox`
|
2. `docker run --name radiox-dev -d --net host -e DISCORD_TOKEN= -v "$PWD/datastore":/usr/src/app/datastore/ warengroup/eximiabots-radiox`
|
||||||
|
|
||||||
## Join our Discord Server
|
## Join our Discord Server
|
||||||
https://discord.gg/rRA65Mn
|
https://discord.gg/rRA65Mn
|
||||||
|
170
package-lock.json
generated
170
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "eximiabots-radiox",
|
"name": "eximiabots-radiox",
|
||||||
"version": "0.3.0",
|
"version": "0.3.5",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "eximiabots-radiox",
|
"name": "eximiabots-radiox",
|
||||||
"version": "0.3.0",
|
"version": "0.3.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^0.6.0",
|
"@discordjs/builders": "^0.6.0",
|
||||||
@ -460,9 +460,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "16.7.8",
|
"version": "16.7.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz",
|
||||||
"integrity": "sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg=="
|
"integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/ws": {
|
"node_modules/@types/ws": {
|
||||||
"version": "7.4.7",
|
"version": "7.4.7",
|
||||||
@ -797,12 +797,15 @@
|
|||||||
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
||||||
},
|
},
|
||||||
"node_modules/are-we-there-yet": {
|
"node_modules/are-we-there-yet": {
|
||||||
"version": "1.1.5",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
|
||||||
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
|
"integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"delegates": "^1.0.0",
|
"delegates": "^1.0.0",
|
||||||
"readable-stream": "^2.0.6"
|
"readable-stream": "^3.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/arg": {
|
"node_modules/arg": {
|
||||||
@ -1158,11 +1161,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||||
},
|
},
|
||||||
"node_modules/core-util-is": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
|
||||||
},
|
|
||||||
"node_modules/create-require": {
|
"node_modules/create-require": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
@ -1230,9 +1228,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/deep-is": {
|
"node_modules/deep-is": {
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/defer-to-connect": {
|
"node_modules/defer-to-connect": {
|
||||||
@ -2246,11 +2244,6 @@
|
|||||||
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/isarray": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
|
||||||
},
|
|
||||||
"node_modules/isexe": {
|
"node_modules/isexe": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
@ -2650,11 +2643,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/npmlog": {
|
"node_modules/npmlog": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
|
||||||
"integrity": "sha512-ftpIiLjerL2tUg3dCqN8pOSoB90gqZlzv/gaZoxHaKjeLClrfJIEQ1Pdxi6qSzflz916Bljdy8dTWQ4J7hAFSQ==",
|
"integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"are-we-there-yet": "^1.1.5",
|
"are-we-there-yet": "^2.0.0",
|
||||||
"console-control-strings": "^1.1.0",
|
"console-control-strings": "^1.1.0",
|
||||||
"gauge": "^3.0.0",
|
"gauge": "^3.0.0",
|
||||||
"set-blocking": "^2.0.0"
|
"set-blocking": "^2.0.0"
|
||||||
@ -2874,11 +2867,6 @@
|
|||||||
"node": ">= 0.6.0"
|
"node": ">= 0.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/process-nextick-args": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
|
||||||
},
|
|
||||||
"node_modules/progress": {
|
"node_modules/progress": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||||
@ -2985,17 +2973,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/readable-stream": {
|
"node_modules/readable-stream": {
|
||||||
"version": "2.3.7",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core-util-is": "~1.0.0",
|
"inherits": "^2.0.3",
|
||||||
"inherits": "~2.0.3",
|
"string_decoder": "^1.1.1",
|
||||||
"isarray": "~1.0.0",
|
"util-deprecate": "^1.0.1"
|
||||||
"process-nextick-args": "~2.0.0",
|
},
|
||||||
"safe-buffer": "~5.1.1",
|
"engines": {
|
||||||
"string_decoder": "~1.1.1",
|
"node": ">= 6"
|
||||||
"util-deprecate": "~1.0.1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/readdirp": {
|
"node_modules/readdirp": {
|
||||||
@ -3121,9 +3108,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/safe-buffer": {
|
"node_modules/safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "7.3.5",
|
"version": "7.3.5",
|
||||||
@ -3254,11 +3255,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string_decoder": {
|
"node_modules/string_decoder": {
|
||||||
"version": "1.1.1",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"safe-buffer": "~5.1.0"
|
"safe-buffer": "~5.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string-argv": {
|
"node_modules/string-argv": {
|
||||||
@ -4236,9 +4237,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "16.7.8",
|
"version": "16.7.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz",
|
||||||
"integrity": "sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg=="
|
"integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA=="
|
||||||
},
|
},
|
||||||
"@types/ws": {
|
"@types/ws": {
|
||||||
"version": "7.4.7",
|
"version": "7.4.7",
|
||||||
@ -4456,12 +4457,12 @@
|
|||||||
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
||||||
},
|
},
|
||||||
"are-we-there-yet": {
|
"are-we-there-yet": {
|
||||||
"version": "1.1.5",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
|
||||||
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
|
"integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"delegates": "^1.0.0",
|
"delegates": "^1.0.0",
|
||||||
"readable-stream": "^2.0.6"
|
"readable-stream": "^3.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"arg": {
|
"arg": {
|
||||||
@ -4740,11 +4741,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
|
||||||
},
|
|
||||||
"create-require": {
|
"create-require": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
@ -4792,9 +4788,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"deep-is": {
|
"deep-is": {
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"defer-to-connect": {
|
"defer-to-connect": {
|
||||||
@ -5562,11 +5558,6 @@
|
|||||||
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"isarray": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
|
||||||
},
|
|
||||||
"isexe": {
|
"isexe": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
@ -5881,11 +5872,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"npmlog": {
|
"npmlog": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
|
||||||
"integrity": "sha512-ftpIiLjerL2tUg3dCqN8pOSoB90gqZlzv/gaZoxHaKjeLClrfJIEQ1Pdxi6qSzflz916Bljdy8dTWQ4J7hAFSQ==",
|
"integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"are-we-there-yet": "^1.1.5",
|
"are-we-there-yet": "^2.0.0",
|
||||||
"console-control-strings": "^1.1.0",
|
"console-control-strings": "^1.1.0",
|
||||||
"gauge": "^3.0.0",
|
"gauge": "^3.0.0",
|
||||||
"set-blocking": "^2.0.0"
|
"set-blocking": "^2.0.0"
|
||||||
@ -6046,11 +6037,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||||
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
|
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
|
||||||
},
|
},
|
||||||
"process-nextick-args": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
|
||||||
},
|
|
||||||
"progress": {
|
"progress": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||||
@ -6124,17 +6110,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "2.3.7",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-util-is": "~1.0.0",
|
"inherits": "^2.0.3",
|
||||||
"inherits": "~2.0.3",
|
"string_decoder": "^1.1.1",
|
||||||
"isarray": "~1.0.0",
|
"util-deprecate": "^1.0.1"
|
||||||
"process-nextick-args": "~2.0.0",
|
|
||||||
"safe-buffer": "~5.1.1",
|
|
||||||
"string_decoder": "~1.1.1",
|
|
||||||
"util-deprecate": "~1.0.1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"readdirp": {
|
"readdirp": {
|
||||||
@ -6215,9 +6197,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "7.3.5",
|
"version": "7.3.5",
|
||||||
@ -6319,11 +6301,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"string_decoder": {
|
"string_decoder": {
|
||||||
"version": "1.1.1",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "~5.1.0"
|
"safe-buffer": "~5.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"string-argv": {
|
"string-argv": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eximiabots-radiox",
|
"name": "eximiabots-radiox",
|
||||||
"version": "0.3.0",
|
"version": "0.3.5",
|
||||||
"description": "Internet Radio to your Discord guild",
|
"description": "Internet Radio to your Discord guild",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
import Discord, { Client, Collection } from "discord.js";
|
import Discord, { Client, Collection } from "discord.js";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
const events = "./client/events/";
|
|
||||||
import Datastore from "./client/datastore.js";
|
import Datastore from "./client/datastore.js";
|
||||||
import { command, radio } from "./client/utils/typings.js";
|
import { command, radio } from "./client/utils/typings.js";
|
||||||
import config from "./config.js";
|
import config from "./config.js";
|
||||||
import messages from "./client/messages.js";
|
import messages from "./client/messages.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
|
const events = "./client/events/";
|
||||||
|
|
||||||
const GatewayIntents = new Discord.Intents();
|
const GatewayIntents = new Discord.Intents();
|
||||||
GatewayIntents.add(
|
GatewayIntents.add(
|
||||||
1 << 0, // GUILDS
|
1 << 0, // GUILDS
|
||||||
1 << 7, // GUILD_VOICE_STATES
|
1 << 7, // GUILD_VOICE_STATES
|
||||||
|
1 << 9 // GUILD_MESSAGES
|
||||||
);
|
);
|
||||||
|
|
||||||
class RadioClient extends Client {
|
class RadioClient extends Client {
|
||||||
@ -35,6 +37,20 @@ class RadioClient extends Client {
|
|||||||
this.funcs.logger = require("./client/funcs/logger.js");
|
this.funcs.logger = require("./client/funcs/logger.js");
|
||||||
this.funcs.msToTime = require("./client/funcs/msToTime.js");
|
this.funcs.msToTime = require("./client/funcs/msToTime.js");
|
||||||
this.funcs.statisticsUpdate = require("./client/funcs/statisticsUpdate.js");
|
this.funcs.statisticsUpdate = require("./client/funcs/statisticsUpdate.js");
|
||||||
|
this.funcs.saveState = require("./client/funcs/saveState.js");
|
||||||
|
this.funcs.loadState = require("./client/funcs/loadState.js");
|
||||||
|
this.funcs.searchStation = require("./client/funcs/searchStation.js");
|
||||||
|
this.funcs.play = require("./client/funcs/play.js");
|
||||||
|
this.funcs.listStations = require("./client/funcs/listStations.js");
|
||||||
|
this.funcs.restoreRadios = require("./client/funcs/restoreRadios.js");
|
||||||
|
this.funcs.saveRadios = require("./client/funcs/saveRadios.js");
|
||||||
|
|
||||||
|
console.log('RadioX ' + this.config.version);
|
||||||
|
console.log('Internet Radio to your Discord guild');
|
||||||
|
console.log('(c)2020-2021 EximiaBots by Warén Group');
|
||||||
|
console.log('');
|
||||||
|
|
||||||
|
this.funcs.logger("Bot", "Starting");
|
||||||
|
|
||||||
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
|
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
@ -44,14 +60,32 @@ class RadioClient extends Client {
|
|||||||
|
|
||||||
this.on("ready", () => {
|
this.on("ready", () => {
|
||||||
require(`${events}ready`).execute(this);
|
require(`${events}ready`).execute(this);
|
||||||
this.datastore = new Datastore();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.on("messageCreate", msg => {
|
||||||
|
require(`${events}messageCreate`).execute(this, msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.on("messageDelete", msg => {
|
||||||
|
require(`${events}messageDelete`).execute(this, msg);
|
||||||
|
});
|
||||||
|
|
||||||
this.on("interactionCreate", interaction => {
|
this.on("interactionCreate", interaction => {
|
||||||
require(`${events}interactionCreate`).execute(this, interaction);
|
require(`${events}interactionCreate`).execute(this, interaction);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("voiceStateUpdate", (oldState, newState) => {
|
this.on("voiceStateUpdate", (oldState, newState) => {
|
||||||
require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
|
require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.on('SIGINT', () => {
|
||||||
|
require(`${events}SIGINT`).execute(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
process.on('SIGTERM', () => {
|
||||||
|
require(`${events}SIGTERM`).execute(this);
|
||||||
|
});
|
||||||
|
|
||||||
this.on("error", error => {
|
this.on("error", error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
@ -20,6 +20,7 @@ module.exports = {
|
|||||||
if(command.options) {
|
if(command.options) {
|
||||||
command.options.forEach(function(option) {
|
command.options.forEach(function(option) {
|
||||||
if(option.type == "STRING") option.type = 3;
|
if(option.type == "STRING") option.type = 3;
|
||||||
|
if(option.type == "NUMBER") option.type = 10;
|
||||||
command.data.options.push(option);
|
command.data.options.push(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -44,16 +45,18 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
await rest.put(
|
await rest.put(
|
||||||
Routes.applicationGuildCommands(client.user.id, guild.id),
|
Routes.applicationGuildCommands(client.user.id, guild.id),
|
||||||
{ body: commands },
|
{ body: commands }
|
||||||
);
|
);
|
||||||
|
client.funcs.logger('Slash Commands', 'Guild Applications – Successful' + "\n" + guild.id + " / " + guild.name);
|
||||||
} catch (DiscordAPIError) {
|
} catch (DiscordAPIError) {
|
||||||
|
client.funcs.logger('Slash Commands', 'Guild Applications – Failed' + "\n" + guild.id + " / " + guild.name);
|
||||||
|
if(DiscordAPIError.name != "DiscordAPIError[50001]") console.error(DiscordAPIError.message + "\n\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await rest.put(
|
await rest.put(
|
||||||
Routes.applicationCommands(client.user.id),
|
Routes.applicationCommands(client.user.id),
|
||||||
{ body: commands },
|
{ body: commands }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'bug',
|
name: 'bug',
|
||||||
alias: 'none',
|
|
||||||
usage: '',
|
|
||||||
description: 'Report a bug',
|
description: 'Report a bug',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
async execute(interaction, client, Discord, command) {
|
async execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
|
|
||||||
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
||||||
message.bugDescription = message.bugDescription.replace("%client.config.supportGuild%", client.config.supportGuild);
|
message.bugDescription = client.messages.bugDescription.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(message.bugTitle)
|
.setTitle(message.bugTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.setDescription(message.bugDescription)
|
.setDescription(message.bugDescription)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'help',
|
name: 'help',
|
||||||
alias: 'h',
|
|
||||||
usage: '<command(opt)>',
|
|
||||||
description: 'Get help using bot',
|
description: 'Get help using bot',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction, client, Discord, command) {
|
execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
|
|
||||||
const categories = [];
|
const categories = [];
|
||||||
@ -19,13 +19,13 @@ module.exports = {
|
|||||||
|
|
||||||
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
||||||
message.helpDescription = client.messages.helpDescription.replace("%commands%", commands);
|
message.helpDescription = client.messages.helpDescription.replace("%commands%", commands);
|
||||||
message.helpDescription = message.helpDescription.replace("%client.config.prefix%", client.config.prefix);
|
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(message.helpTitle)
|
.setTitle(message.helpTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.setDescription(message.helpDescription)
|
.setDescription(message.helpDescription)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'invite',
|
name: 'invite',
|
||||||
alias: 'i',
|
|
||||||
usage: '',
|
|
||||||
description: 'Invite Bot',
|
description: 'Invite Bot',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction, client, Discord, command) {
|
execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
|
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(message.inviteTitle)
|
.setTitle(message.inviteTitle)
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.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
|
.setURL("https://discord.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
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
|
@ -1,32 +1,40 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'list',
|
name: 'list',
|
||||||
alias: 'l',
|
|
||||||
usage: '',
|
|
||||||
description: 'List radio stations',
|
description: 'List radio stations',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'radio',
|
category: 'radio',
|
||||||
execute(interaction, client, Discord, command) {
|
execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
if(!client.stations) {
|
if(!client.stations) {
|
||||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||||
}
|
}
|
||||||
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
|
||||||
const hashs = stations.split('**#**').length;
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
for (let i = 0; i < hashs; i++) {
|
|
||||||
stations = stations.replace('**#**', `**${i + 1}.**`);
|
if(radio){
|
||||||
|
client.funcs.listStations(client, interaction);
|
||||||
|
} else {
|
||||||
|
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}.**`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let embed = new Discord.MessageEmbed()
|
||||||
|
.setTitle(client.messages.listTitle)
|
||||||
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
|
||||||
|
.setColor(client.config.embedColor)
|
||||||
|
.setDescription(stations)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(client.messages.listTitle)
|
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
|
|
||||||
.setColor(client.config.embedColor)
|
|
||||||
.setDescription(stations)
|
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
|
||||||
|
|
||||||
interaction.reply({
|
|
||||||
embeds: [embed],
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,15 +1,122 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'maintenance',
|
name: 'maintenance',
|
||||||
alias: 'm',
|
|
||||||
usage: '',
|
|
||||||
description: 'Bot Maintenance',
|
description: 'Bot Maintenance',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction, client, Discord, command) {
|
options: [
|
||||||
|
{ type: "NUMBER", name: "action", description: "Select action", required: false}
|
||||||
|
],
|
||||||
|
async execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
|
|
||||||
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply(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);
|
||||||
|
let action = interaction.options?.getNumber("action") ?? interaction.values?.[0];
|
||||||
|
const options = new Array(
|
||||||
|
{
|
||||||
|
emoji: "🌀",
|
||||||
|
label: "Restart Bot",
|
||||||
|
description: "",
|
||||||
|
value: "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: "<:RadioXStop:688541155377414168>",
|
||||||
|
label: "Save Radios",
|
||||||
|
description: "",
|
||||||
|
value: "4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: "<:RadioXPlay:688541155712827458>",
|
||||||
|
label: "Restore Radios",
|
||||||
|
description: "",
|
||||||
|
value: "5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: "#️⃣",
|
||||||
|
label: "Reload Commands",
|
||||||
|
description: "",
|
||||||
|
value: "6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: "<:dnd:746069698139127831>",
|
||||||
|
label: "Enable Maintenance Mode",
|
||||||
|
description: "",
|
||||||
|
value: "8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: "<:online:746069731836035098>",
|
||||||
|
label: "Disable Maintenance Mode",
|
||||||
|
description: "",
|
||||||
|
value: "9"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const menu = new Discord.MessageActionRow()
|
||||||
|
.addComponents(
|
||||||
|
new Discord.MessageSelectMenu()
|
||||||
|
.setCustomId('maintenance')
|
||||||
|
.setPlaceholder('Select action')
|
||||||
|
.addOptions(options)
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!action){
|
||||||
|
return interaction.reply({
|
||||||
|
content: "**" + client.messages.maintenanceTitle + "**",
|
||||||
|
components: [menu],
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
client.funcs.logger('Maintenance', options.find(option => option.value == action).label);
|
||||||
|
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setTitle(client.messages.maintenanceTitle)
|
||||||
|
.setColor(client.config.embedColor)
|
||||||
|
.setDescription(options.find(option => option.value == action).label)
|
||||||
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
|
switch(action){
|
||||||
|
case "0":
|
||||||
|
process.emit('SIGINT');
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
client.user.setStatus('idle');
|
||||||
|
setTimeout(function () {
|
||||||
|
client.funcs.saveRadios(client);
|
||||||
|
}, 5000);
|
||||||
|
client.user.setStatus('online');
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
client.user.setStatus('idle');
|
||||||
|
let guilds = await client.guilds.fetch();
|
||||||
|
setTimeout(function () {
|
||||||
|
client.funcs.restoreRadios(client, guilds);
|
||||||
|
}, 5000);
|
||||||
|
client.user.setStatus('online');
|
||||||
|
break;
|
||||||
|
case "6":
|
||||||
|
client.user.setStatus('idle');
|
||||||
|
require(`../commands.js`).execute(client);
|
||||||
|
client.user.setStatus('online');
|
||||||
|
break;
|
||||||
|
case "8":
|
||||||
|
client.user.setStatus('dnd');
|
||||||
|
break;
|
||||||
|
case "9":
|
||||||
|
client.user.setStatus('online');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
if(!client.stations) {
|
if(!client.stations) {
|
||||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||||
@ -26,18 +133,12 @@ module.exports = {
|
|||||||
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
||||||
|
|
||||||
if(currentRadio){
|
if(currentRadio){
|
||||||
client.funcs.statisticsUpdate(client, currentRadio.currentGuild.guild, currentRadio);
|
client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
|
||||||
currentRadio.connection?.destroy();
|
currentRadio.connection?.destroy();
|
||||||
currentRadio.audioPlayer?.stop();
|
currentRadio.audioPlayer?.stop();
|
||||||
const cembed = new Discord.MessageEmbed()
|
currentRadio.message?.delete();
|
||||||
.setTitle(client.messages.maintenanceTitle)
|
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
|
||||||
.setColor(client.config.embedColor)
|
|
||||||
.setDescription(client.messages.sendedMaintenanceMessage)
|
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
|
||||||
currentRadio.textChannel.send({ embeds: [cembed] });
|
|
||||||
client.radio.delete(radio.value);
|
client.radio.delete(radio.value);
|
||||||
stoppedRadios += "-" + radio.value + ": " + currentRadio.currentGuild.guild.name + "\n";
|
stoppedRadios += "-" + radio.value + ": " + currentRadio.guild.name + "\n";
|
||||||
}
|
}
|
||||||
radio = currentRadios.next();
|
radio = currentRadios.next();
|
||||||
}
|
}
|
||||||
@ -47,11 +148,13 @@ module.exports = {
|
|||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
|
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});*/
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
35
src/client/commands/next.js
Normal file
35
src/client/commands/next.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'next',
|
||||||
|
description: 'Next Station',
|
||||||
|
permission: 'none',
|
||||||
|
category: 'radio',
|
||||||
|
async execute(interaction, client, command) {
|
||||||
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
|
|
||||||
|
let index = client.stations.findIndex(station => station.name == radio.station.name) + 1;
|
||||||
|
if(index == client.stations.length) index = 0;
|
||||||
|
|
||||||
|
let station = client.stations[index];
|
||||||
|
|
||||||
|
if(!station) return interaction.reply({
|
||||||
|
content: client.messageEmojis["error"] + client.messages.noSearchResults,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
|
interaction.deferUpdate();
|
||||||
|
|
||||||
|
let url = station.stream[station.stream.default];
|
||||||
|
|
||||||
|
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
||||||
|
radio.audioPlayer.stop();
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
radio.station = station;
|
||||||
|
radio.textChannel = interaction.channel;
|
||||||
|
radio.startTime = date.getTime();
|
||||||
|
client.funcs.play(null, interaction.guild, client, url);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,38 +1,36 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'nowplaying',
|
name: 'nowplaying',
|
||||||
alias: 'np',
|
|
||||||
usage: '',
|
|
||||||
description: 'Current Radio Station',
|
description: 'Current Radio Station',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'radio',
|
category: 'radio',
|
||||||
async execute(interaction, client, Discord, command) {
|
async execute(interaction, client, command) {
|
||||||
let message = {};
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
let message = {};
|
||||||
if (!radio) return interaction.reply('There is nothing playing.');
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
if(!client.stations) {
|
|
||||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
let date = new Date();
|
||||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
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)%", client.funcs.msToTime(completed));
|
||||||
|
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setTitle(client.messages.nowplayingTitle)
|
||||||
|
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
|
||||||
|
.setColor(client.config.embedColor)
|
||||||
|
.setDescription(message.nowplayingDescription)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [embed],
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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)%", client.funcs.msToTime(completed));
|
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(client.messages.nowplayingTitle)
|
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))
|
|
||||||
.setColor(client.config.embedColor)
|
|
||||||
.setDescription(message.nowplayingDescription)
|
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
|
||||||
|
|
||||||
interaction.reply({
|
|
||||||
embeds: [embed],
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,13 +1,11 @@
|
|||||||
const {
|
const {
|
||||||
createAudioPlayer,
|
createAudioPlayer,
|
||||||
createAudioResource,
|
|
||||||
getVoiceConnection,
|
getVoiceConnection,
|
||||||
joinVoiceChannel
|
joinVoiceChannel
|
||||||
} = require("@discordjs/voice");
|
} = require("@discordjs/voice");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "play",
|
name: "play",
|
||||||
alias: "p",
|
|
||||||
usage: "<song name>",
|
usage: "<song name>",
|
||||||
description: "Play radio",
|
description: "Play radio",
|
||||||
options: [
|
options: [
|
||||||
@ -15,56 +13,16 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
permission: "none",
|
permission: "none",
|
||||||
category: "radio",
|
category: "radio",
|
||||||
async execute(interaction, client, Discord, command) {
|
async execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
|
if(!client.stations) {
|
||||||
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||||
|
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||||
|
}
|
||||||
|
|
||||||
let query = interaction.options?.getString("query") ?? interaction.values?.[0];
|
let query = interaction.options?.getString("query") ?? interaction.values?.[0];
|
||||||
if(!query){
|
if(!query){
|
||||||
if(!client.stations) {
|
return client.funcs.listStations(client, interaction);
|
||||||
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") : "";
|
let url = query ? query.replace(/<(.+)>/g, "$1") : "";
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
@ -82,16 +40,6 @@ module.exports = {
|
|||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!client.stations) {
|
|
||||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace(
|
|
||||||
"%client.config.supportGuild%",
|
|
||||||
client.config.supportGuild
|
|
||||||
);
|
|
||||||
return interaction.reply({
|
|
||||||
content: client.messageEmojis["error"] + message.errorToGetPlaylist,
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!query) return interaction.reply(client.messages.noQuery);
|
if (!query) return interaction.reply(client.messages.noQuery);
|
||||||
const permissions = voiceChannel.permissionsFor(interaction.client.user);
|
const permissions = voiceChannel.permissionsFor(interaction.client.user);
|
||||||
if (!permissions.has("CONNECT")) {
|
if (!permissions.has("CONNECT")) {
|
||||||
@ -123,7 +71,7 @@ module.exports = {
|
|||||||
content: client.messageEmojis["error"] + client.messages.tooShortSearch,
|
content: client.messageEmojis["error"] + client.messages.tooShortSearch,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
const sstation = await searchStation(query, client);
|
const sstation = await client.funcs.searchStation(query, client);
|
||||||
if (!sstation)
|
if (!sstation)
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messageEmojis["error"] + client.messages.noSearchResults,
|
content: client.messageEmojis["error"] + client.messages.noSearchResults,
|
||||||
@ -137,9 +85,11 @@ module.exports = {
|
|||||||
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
||||||
radio.audioPlayer.stop();
|
radio.audioPlayer.stop();
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
radio.station = station;
|
radio.station = station;
|
||||||
radio.textChannel = interaction.channel;
|
radio.textChannel = interaction.channel;
|
||||||
play(interaction, interaction.guild, client, url, Discord);
|
radio.startTime = date.getTime();
|
||||||
|
client.funcs.play(interaction, interaction.guild, client, url);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -165,7 +115,7 @@ module.exports = {
|
|||||||
construct.connection = connection;
|
construct.connection = connection;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
construct.startTime = date.getTime();
|
construct.startTime = date.getTime();
|
||||||
play(interaction, interaction.guild, client, url, Discord);
|
client.funcs.play(interaction, interaction.guild, client, url);
|
||||||
|
|
||||||
client.datastore.checkEntry(interaction.guild.id);
|
client.datastore.checkEntry(interaction.guild.id);
|
||||||
construct.currentGuild = client.datastore.getEntry(interaction.guild.id);
|
construct.currentGuild = client.datastore.getEntry(interaction.guild.id);
|
||||||
@ -183,155 +133,3 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function play(interaction, guild, client, url, Discord) {
|
|
||||||
let message = {};
|
|
||||||
const radio = client.radio.get(guild.id);
|
|
||||||
const resource = createAudioResource(url);
|
|
||||||
radio.connection.subscribe(radio.audioPlayer);
|
|
||||||
radio.audioPlayer.play(resource);
|
|
||||||
resource.playStream
|
|
||||||
.on("readable", () => {
|
|
||||||
client.funcs.logger('Radio', 'Stream started' + " / " + guild.id + " / " + radio.station.name);
|
|
||||||
})
|
|
||||||
.on("finish", () => {
|
|
||||||
client.funcs.logger('Radio', 'Stream finished' + " / " + guild.id);
|
|
||||||
client.funcs.statisticsUpdate(client, guild, radio);
|
|
||||||
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.audioPlayer?.stop();
|
|
||||||
client.radio.delete(guild.id);
|
|
||||||
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);
|
|
||||||
|
|
||||||
interaction.reply({
|
|
||||||
content: client.messageEmojis["play"] + message.play,
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function searchStation(key, client) {
|
|
||||||
if (client.stations === null) return false;
|
|
||||||
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++) {
|
|
||||||
client.stations
|
|
||||||
.filter(
|
|
||||||
x => x.name.toUpperCase().includes(key.split(" ")[i].toUpperCase()) || x === key
|
|
||||||
)
|
|
||||||
.forEach(x =>
|
|
||||||
foundStations.push({ station: x, name: x.name, probability: probabilityIncrement })
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (foundStations.length === 0) return false;
|
|
||||||
for (let i = 0; i < foundStations.length; i++) {
|
|
||||||
for (let j = 0; j < foundStations.length; j++) {
|
|
||||||
if (foundStations[i] === foundStations[j] && i !== j) foundStations.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i = 0; i < foundStations.length; i++) {
|
|
||||||
if (foundStations[i].name.length > key.length) {
|
|
||||||
foundStations[i].probability -=
|
|
||||||
(foundStations[i].name.split(" ").length - key.split(" ").length) *
|
|
||||||
(probabilityIncrement * 0.5);
|
|
||||||
} else if (foundStations[i].name.length === key.length) {
|
|
||||||
foundStations[i].probability += probabilityIncrement * 0.9;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let j = 0; j < key.split(" ").length; j++) {
|
|
||||||
if (!foundStations[i].name.toUpperCase().includes(key.toUpperCase().split(" ")[j])) {
|
|
||||||
foundStations[i].probability -= probabilityIncrement * 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let highestProbabilityStation;
|
|
||||||
for (let i = 0; i < foundStations.length; i++) {
|
|
||||||
if (
|
|
||||||
!highestProbabilityStation ||
|
|
||||||
highestProbabilityStation.probability < foundStations[i].probability
|
|
||||||
)
|
|
||||||
highestProbabilityStation = foundStations[i];
|
|
||||||
if (
|
|
||||||
highestProbabilityStation &&
|
|
||||||
highestProbabilityStation.probability === foundStations[i].probability
|
|
||||||
) {
|
|
||||||
highestProbabilityStation = foundStations[i].station;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return highestProbabilityStation;
|
|
||||||
}
|
|
||||||
|
35
src/client/commands/prev.js
Normal file
35
src/client/commands/prev.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'prev',
|
||||||
|
description: 'Previous Station',
|
||||||
|
permission: 'none',
|
||||||
|
category: 'radio',
|
||||||
|
async execute(interaction, client, command) {
|
||||||
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
|
|
||||||
|
let index = client.stations.findIndex(station => station.name == radio.station.name) - 1;
|
||||||
|
if(index == -1) index = client.stations.length - 1;
|
||||||
|
|
||||||
|
let station = client.stations[index];
|
||||||
|
|
||||||
|
if(!station) return interaction.reply({
|
||||||
|
content: client.messageEmojis["error"] + client.messages.noSearchResults,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
|
interaction.deferUpdate();
|
||||||
|
|
||||||
|
let url = station.stream[station.stream.default];
|
||||||
|
|
||||||
|
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
||||||
|
radio.audioPlayer.stop();
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
radio.station = station;
|
||||||
|
radio.textChannel = interaction.channel;
|
||||||
|
radio.startTime = date.getTime();
|
||||||
|
client.funcs.play(null, interaction.guild, client, url);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,16 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'statistics',
|
name: 'statistics',
|
||||||
alias: 'stats',
|
|
||||||
usage: '',
|
|
||||||
description: 'Show statistics',
|
description: 'Show statistics',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction, client, Discord, command) {
|
execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
let stations = client.stations;
|
let stations = client.stations;
|
||||||
let currentGuild = client.datastore.getEntry(interaction.guild.id);
|
let currentGuild = client.datastore.getEntry(interaction.guild.id);
|
||||||
|
let global = client.datastore.getEntry("global");
|
||||||
let statistics = "";
|
let statistics = "";
|
||||||
|
|
||||||
if(!client.stations) {
|
if(!client.stations) {
|
||||||
@ -17,13 +19,17 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
||||||
statistics = "You have not listened any radio station";
|
statistics = "You have not listened any radio stations";
|
||||||
} else {
|
} else {
|
||||||
Object.keys(stations).forEach(function(station) {
|
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){
|
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 += `**${parseInt(station) + 1}. ` + stations[station].name + "** \n";
|
||||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time) + "\n";
|
if(global && global.statistics[stations[station].name] && global.statistics[stations[station].name].time && parseInt(global.statistics[stations[station].name].time) > 0 && global.statistics[stations[station].name].used && parseInt(global.statistics[stations[station].name].used) > 0){
|
||||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
statistics += "Guild – Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time) + " (" + ((currentGuild.statistics[stations[station].name].time / global.statistics[stations[station].name].time) * 100).toFixed(0) + "%" + ")" + " / " + "Used: " + currentGuild.statistics[stations[station].name].used + " (" + ((currentGuild.statistics[stations[station].name].used / global.statistics[stations[station].name].used) * 100).toFixed(0) + "%" + ")" + "\n";
|
||||||
|
statistics += "Global – Time: " + client.funcs.msToTime(global.statistics[stations[station].name].time) + " / " + "Used: " + global.statistics[stations[station].name].used + "\n\n";
|
||||||
|
} else {
|
||||||
|
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time) + " / " + "Used: " + currentGuild.statistics[stations[station].name].used + "\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -33,6 +39,7 @@ module.exports = {
|
|||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.setDescription(statistics)
|
.setDescription(statistics)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'status',
|
name: 'status',
|
||||||
alias: 'st',
|
|
||||||
usage: '',
|
|
||||||
description: 'Bot Status',
|
description: 'Bot Status',
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
async execute(interaction, client, Discord, command) {
|
async execute(interaction, client) {
|
||||||
let message = {};
|
let message = {};
|
||||||
|
|
||||||
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
||||||
@ -20,6 +20,7 @@ module.exports = {
|
|||||||
.addField(client.messages.statusField3, uptime, true)
|
.addField(client.messages.statusField3, uptime, true)
|
||||||
.addField(client.messages.statusField4, client.config.version, true)
|
.addField(client.messages.statusField4, client.config.version, true)
|
||||||
.addField(client.messages.statusField5, client.config.hostedBy, true)
|
.addField(client.messages.statusField5, client.config.hostedBy, true)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'stop',
|
name: 'stop',
|
||||||
description: 'Stop radio',
|
description: 'Stop radio',
|
||||||
alias: 's',
|
|
||||||
usage: '',
|
|
||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'radio',
|
category: 'radio',
|
||||||
async execute(interaction, client, Discord, command) {
|
async execute(interaction, client, command) {
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
if (client.funcs.check(client, interaction, command)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
client.funcs.statisticsUpdate(client, interaction.guild, radio);
|
||||||
@ -18,16 +18,17 @@ module.exports = {
|
|||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.addField(client.messages.nowplayingTitle, "-", true)
|
.addField(client.messages.nowplayingTitle, "-", true)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
if(!radio.message){
|
if(!radio.message){
|
||||||
radio.message = await radio.textChannel.send({ embeds: [embed], components: [] });
|
radio.message = radio.textChannel.send({ embeds: [embed], components: [] });
|
||||||
} else {
|
} else {
|
||||||
radio.message.edit({ embeds: [embed], components: [] });
|
radio.message.edit({ embeds: [embed], components: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(async function() {
|
||||||
radio.message.delete();
|
await radio.message?.delete();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
client.radio.delete(interaction.guild.id);
|
client.radio.delete(interaction.guild.id);
|
||||||
|
@ -80,6 +80,7 @@ module.exports = class {
|
|||||||
newData.guild = {};
|
newData.guild = {};
|
||||||
newData.guild.id = id;
|
newData.guild.id = id;
|
||||||
newData.statistics = {};
|
newData.statistics = {};
|
||||||
|
newData.state = {};
|
||||||
this.map.set(id, newData);
|
this.map.set(id, newData);
|
||||||
this.saveEntry(id, newData);
|
this.saveEntry(id, newData);
|
||||||
}
|
}
|
||||||
@ -90,6 +91,10 @@ module.exports = class {
|
|||||||
|
|
||||||
updateEntry(guild, newData) {
|
updateEntry(guild, newData) {
|
||||||
newData.guild.name = guild.name;
|
newData.guild.name = guild.name;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
newData.updated = date.toISOString().substring(0, 10)
|
||||||
|
|
||||||
this.map.set(guild.id, newData);
|
this.map.set(guild.id, newData);
|
||||||
this.saveEntry(guild.id, newData);
|
this.saveEntry(guild.id, newData);
|
||||||
//this.showEntry(this.getEntry(guild.id));
|
//this.showEntry(this.getEntry(guild.id));
|
||||||
@ -110,6 +115,9 @@ module.exports = class {
|
|||||||
"time": 0,
|
"time": 0,
|
||||||
"used": 0
|
"used": 0
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"state": {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
src/client/events/SIGINT.js
Normal file
23
src/client/events/SIGINT.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
const { REST } = require('@discordjs/rest');
|
||||||
|
const { Routes } = require('discord-api-types/v9');
|
||||||
|
const { token, version } = require('../../config.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'SIGINT',
|
||||||
|
async execute(client) {
|
||||||
|
client.user.setStatus('dnd');
|
||||||
|
|
||||||
|
console.log("\n");
|
||||||
|
client.funcs.logger("Bot", "Closing");
|
||||||
|
console.log("\n");
|
||||||
|
|
||||||
|
setTimeout(async function () {
|
||||||
|
let message = {};
|
||||||
|
|
||||||
|
if (!client.stations) return process.exit();
|
||||||
|
|
||||||
|
await client.funcs.saveRadios(client);
|
||||||
|
await process.exit();
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
}
|
6
src/client/events/SIGTERM.js
Normal file
6
src/client/events/SIGTERM.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'SIGTERM',
|
||||||
|
async execute(client) {
|
||||||
|
process.emit('SIGINT');
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,14 @@
|
|||||||
import Discord from "discord.js";
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
/*if (!interaction.isCommand()) return;*/
|
|
||||||
|
|
||||||
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
||||||
if (!permissions.has('EMBED_LINKS')) return interaction.send(client.messages.noPermsEmbed);
|
if (!permissions.has('VIEW_CHANNEL')) return;
|
||||||
|
|
||||||
|
if (!permissions.has('EMBED_LINKS')) return interaction.reply({
|
||||||
|
content: client.messages.noPermsEmbed,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
if(interaction.isCommand()){
|
if(interaction.isCommand()){
|
||||||
const commandName = interaction.commandName;
|
const commandName = interaction.commandName;
|
||||||
@ -14,9 +16,12 @@ module.exports = {
|
|||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
command.execute(interaction, client, Discord, command);
|
command.execute(interaction, client);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.reply(client.messages.runningCommandFailed);
|
interaction.reply({
|
||||||
|
content: client.messages.runningCommandFailed,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
} else if (interaction.isSelectMenu() || interaction.isButton()){
|
} else if (interaction.isSelectMenu() || interaction.isButton()){
|
||||||
@ -25,9 +30,12 @@ module.exports = {
|
|||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
command.execute(interaction, client, Discord, command);
|
command.execute(interaction, client, command);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.reply(client.messages.runningCommandFailed);
|
interaction.reply({
|
||||||
|
content: client.messages.runningCommandFailed,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
55
src/client/events/messageCreate.js
Normal file
55
src/client/events/messageCreate.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
module.exports = {
|
||||||
|
name: 'messageCreate',
|
||||||
|
async execute(client, message) {
|
||||||
|
|
||||||
|
if (message.author.bot || !message.guild) return;
|
||||||
|
let prefix = "rx$";
|
||||||
|
if(client.user.username == "RadioX"){
|
||||||
|
prefix = "rx>";
|
||||||
|
} else if (client.user.username == "RadioX Beta"){
|
||||||
|
prefix = "rx-";
|
||||||
|
} else if (client.user.username == "RadioX Dev"){
|
||||||
|
prefix = "rx$";
|
||||||
|
} else if(message.mentions.members.first() && message.mentions.members.first().user.id === client.user.id){
|
||||||
|
prefix = "<@!" + client.user.id + "> ";
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const args = message.content.slice(prefix.length).split(' ');
|
||||||
|
if (!message.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));
|
||||||
|
if (!command && message.content !== `${prefix}`) return;
|
||||||
|
const permissions = message.channel.permissionsFor(message.client.user);
|
||||||
|
if (!permissions.has('EMBED_LINKS')) return message.channel.send(client.messages.noPermsEmbed);
|
||||||
|
try {
|
||||||
|
let newMessage = {};
|
||||||
|
|
||||||
|
newMessage.messageCommandsDeprecatedTitle = client.messages.messageCommandsDeprecatedTitle.replace("%client.user.username%", client.user.username);
|
||||||
|
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setTitle(newMessage.messageCommandsDeprecatedTitle)
|
||||||
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||||
|
.setColor(client.config.embedColor)
|
||||||
|
.setDescription(client.messages.messageCommandsDeprecatedDescription)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
|
let msg = await message.channel.send({ embeds: [embed] });
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
msg.delete();
|
||||||
|
}, 30000);
|
||||||
|
} catch (error) {
|
||||||
|
message.reply({
|
||||||
|
content: client.messages.runningCommandFailed,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
src/client/events/messageDelete.js
Normal file
10
src/client/events/messageDelete.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'messageDelete',
|
||||||
|
async execute(client, msg) {
|
||||||
|
if (!msg.author.bot || !msg.guild) return;
|
||||||
|
const radio = client.radio.get(msg.guild.id);
|
||||||
|
if (!radio) return;
|
||||||
|
if(msg.id != radio.message.id) return;
|
||||||
|
radio.message = null;
|
||||||
|
}
|
||||||
|
}
|
@ -1,22 +1,32 @@
|
|||||||
const fetch = require('node-fetch');
|
import Datastore from "../datastore.js";
|
||||||
|
import fetch from "node-fetch";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'ready',
|
name: 'ready',
|
||||||
async execute(client) {
|
async execute(client) {
|
||||||
|
|
||||||
console.log('RadioX ' + client.config.version);
|
client.funcs.logger("Bot", "Ready");
|
||||||
console.log('Internet Radio to your Discord guild');
|
|
||||||
console.log('(c)2020-2021 EximiaBots by Warén Group');
|
/*DATASTORE*/
|
||||||
console.log('');
|
client.funcs.logger('Datastore', 'Initialize');
|
||||||
|
client.datastore = new Datastore();
|
||||||
|
|
||||||
|
client.funcs.logger('Datastore');
|
||||||
|
client.datastore.map.forEach(datastore => {
|
||||||
|
console.log("- " + datastore.guild.id + " / " + datastore.guild.name);
|
||||||
|
});
|
||||||
|
console.log("\n");
|
||||||
|
|
||||||
|
client.funcs.logger('Datastore', 'Ready');
|
||||||
|
|
||||||
/*DEVELOPERS*/
|
/*DEVELOPERS*/
|
||||||
client.funcs.logger('Developers', 'List');
|
client.funcs.logger('Developers');
|
||||||
|
|
||||||
client.developers = "";
|
client.developers = "";
|
||||||
let user = "";
|
let user = "";
|
||||||
for (let i = 0; i < client.config.devId.length; i++) {
|
for (let i = 0; i < client.config.devId.length; i++) {
|
||||||
user = await client.users.fetch(client.config.devId[i]);
|
user = await client.users.fetch(client.config.devId[i]);
|
||||||
console.log(" - " + user.tag);
|
console.log("- " + user.tag);
|
||||||
if (i == client.config.devId.length - 1) {
|
if (i == client.config.devId.length - 1) {
|
||||||
client.developers += user.tag;
|
client.developers += user.tag;
|
||||||
} else {
|
} else {
|
||||||
@ -32,9 +42,9 @@ module.exports = {
|
|||||||
.then(client.funcs.checkFetchStatus)
|
.then(client.funcs.checkFetchStatus)
|
||||||
.then(response => response.json());
|
.then(response => response.json());
|
||||||
|
|
||||||
client.funcs.logger('Stations', 'List');
|
client.funcs.logger('Stations');
|
||||||
client.stations.forEach(station => {
|
client.stations.forEach(station => {
|
||||||
console.log(" - " + station.name);
|
console.log("- " + station.name);
|
||||||
});
|
});
|
||||||
console.log("\n");
|
console.log("\n");
|
||||||
|
|
||||||
@ -65,10 +75,10 @@ module.exports = {
|
|||||||
/*GUILDS*/
|
/*GUILDS*/
|
||||||
client.funcs.logger('Guilds', 'Started fetching list');
|
client.funcs.logger('Guilds', 'Started fetching list');
|
||||||
|
|
||||||
client.funcs.logger('Guilds', 'List');
|
client.funcs.logger('Guilds');
|
||||||
let guilds = await client.guilds.fetch();
|
let guilds = await client.guilds.fetch();
|
||||||
guilds.forEach(guild => {
|
guilds.forEach(guild => {
|
||||||
console.log(" - " + guild.id + ": " + guild.name);
|
console.log("- " + guild.id + " / " + guild.name);
|
||||||
});
|
});
|
||||||
console.log("\n");
|
console.log("\n");
|
||||||
|
|
||||||
@ -83,5 +93,10 @@ module.exports = {
|
|||||||
/*COMMANDS*/
|
/*COMMANDS*/
|
||||||
require(`../commands.js`).execute(client);
|
require(`../commands.js`).execute(client);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
/*RESTORE RADIOS*/
|
||||||
|
client.funcs.restoreRadios(client, guilds);
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,6 +17,7 @@ module.exports = {
|
|||||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
radio.audioPlayer?.stop();
|
radio.audioPlayer?.stop();
|
||||||
|
radio.message?.delete();
|
||||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
||||||
return client.radio.delete(newState.guild.id);
|
return client.radio.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
@ -39,6 +40,7 @@ module.exports = {
|
|||||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
radio.audioPlayer?.stop();
|
radio.audioPlayer?.stop();
|
||||||
|
radio.message?.delete();
|
||||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
||||||
client.radio.delete(oldState.guild.id);
|
client.radio.delete(oldState.guild.id);
|
||||||
}
|
}
|
||||||
@ -58,6 +60,7 @@ module.exports = {
|
|||||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
radio.audioPlayer?.stop();
|
radio.audioPlayer?.stop();
|
||||||
|
radio.message?.delete();
|
||||||
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id);
|
||||||
client.radio.delete(newState.guild.id);
|
client.radio.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,14 @@ module.exports = function (client, interaction, command) {
|
|||||||
let message = {};
|
let message = {};
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
const permissions = interaction.channel.permissionsFor(interaction.user);
|
const permissions = interaction.channel.permissionsFor(interaction.user);
|
||||||
|
if(!client.stations) {
|
||||||
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||||
|
interaction.reply({
|
||||||
|
content: client.messageEmojis["error"] + message.errorToGetPlaylist,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!radio) {
|
if (!radio) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messageEmojis["error"] + client.messages.notPlaying,
|
content: client.messageEmojis["error"] + client.messages.notPlaying,
|
||||||
|
33
src/client/funcs/listStations.js
Normal file
33
src/client/funcs/listStations.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
|
||||||
|
module.exports = function (client, interaction){
|
||||||
|
let stations = new Array();
|
||||||
|
let options = new Array();
|
||||||
|
|
||||||
|
stations = client.stations.forEach(station => {
|
||||||
|
if(station.name == "GrooveFM") return;
|
||||||
|
station = {
|
||||||
|
label: station.name,
|
||||||
|
description: station.owner,
|
||||||
|
value: station.name
|
||||||
|
};
|
||||||
|
options.push(station);
|
||||||
|
});
|
||||||
|
|
||||||
|
const menu = new Discord.MessageActionRow()
|
||||||
|
.addComponents(
|
||||||
|
new Discord.MessageSelectMenu()
|
||||||
|
.setCustomId('play')
|
||||||
|
.setPlaceholder('Nothing selected')
|
||||||
|
.addOptions(options)
|
||||||
|
);
|
||||||
|
|
||||||
|
stations = null;
|
||||||
|
options = null;
|
||||||
|
|
||||||
|
return interaction.reply({
|
||||||
|
content: '**Select station:**',
|
||||||
|
components: [menu],
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
}
|
10
src/client/funcs/loadState.js
Normal file
10
src/client/funcs/loadState.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = function loadState(client, guild){
|
||||||
|
let data = client.datastore.getEntry(guild.id);
|
||||||
|
if(!data) return;
|
||||||
|
let state;
|
||||||
|
|
||||||
|
state = data.state;
|
||||||
|
data.state = {};
|
||||||
|
client.datastore.updateEntry(guild, data);
|
||||||
|
return state;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
module.exports = function (area, text){
|
module.exports = function (area, text){
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
console.log('[' + area + '] – ' + date.toISOString() + '\n' + text + '\n');
|
console.log('[' + area + '] – ' + date.toISOString());
|
||||||
|
if(text) console.log(text + '\n');
|
||||||
}
|
}
|
93
src/client/funcs/play.js
Normal file
93
src/client/funcs/play.js
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
const {
|
||||||
|
createAudioResource
|
||||||
|
} = require("@discordjs/voice");
|
||||||
|
|
||||||
|
module.exports = async function play(interaction, guild, client, url) {
|
||||||
|
let message = {};
|
||||||
|
const radio = client.radio.get(guild.id);
|
||||||
|
const resource = createAudioResource(url);
|
||||||
|
radio.connection.subscribe(radio.audioPlayer);
|
||||||
|
radio.audioPlayer.play(resource);
|
||||||
|
resource.playStream
|
||||||
|
.on("readable", () => {
|
||||||
|
client.funcs.logger('Radio', 'Stream started' + " / " + guild.id + " / " + radio.station.name);
|
||||||
|
})
|
||||||
|
.on("finish", () => {
|
||||||
|
client.funcs.logger('Radio', 'Stream finished' + " / " + guild.id);
|
||||||
|
client.funcs.statisticsUpdate(client, guild, radio);
|
||||||
|
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.audioPlayer?.stop();
|
||||||
|
client.radio.delete(guild.id);
|
||||||
|
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("Owner: ", "");
|
||||||
|
message.nowplayingDescription = message.nowplayingDescription.replace("**", "");
|
||||||
|
message.nowplayingDescription = message.nowplayingDescription.replace("**", "");
|
||||||
|
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setTitle(client.user.username)
|
||||||
|
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
|
||||||
|
.setColor(client.config.embedColor)
|
||||||
|
.addField(client.messages.nowplayingTitle, message.nowplayingDescription, true)
|
||||||
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
|
.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')
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new Discord.MessageButton()
|
||||||
|
.setCustomId('stop')
|
||||||
|
.setEmoji(client.messageEmojis["stop"])
|
||||||
|
.setStyle('SECONDARY')
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new Discord.MessageButton()
|
||||||
|
.setCustomId('next')
|
||||||
|
.setEmoji(client.messageEmojis["next"])
|
||||||
|
.setStyle('SECONDARY')
|
||||||
|
)
|
||||||
|
.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);
|
||||||
|
|
||||||
|
interaction?.reply({
|
||||||
|
content: client.messageEmojis["play"] + message.play,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
62
src/client/funcs/restoreRadios.js
Normal file
62
src/client/funcs/restoreRadios.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import Discord from "discord.js";
|
||||||
|
const {
|
||||||
|
createAudioPlayer,
|
||||||
|
getVoiceConnection,
|
||||||
|
joinVoiceChannel
|
||||||
|
} = require("@discordjs/voice");
|
||||||
|
|
||||||
|
module.exports = async function restoreRadios(client, guilds) {
|
||||||
|
if(!client.stations) return;
|
||||||
|
|
||||||
|
guilds.forEach(async guild => {
|
||||||
|
let state = client.funcs.loadState(client, guild);
|
||||||
|
if(!state) return;
|
||||||
|
if(!state.station || !state.channels.voice || !state.channels.text) return;
|
||||||
|
let voiceChannel = client.channels.cache.get(state.channels.voice);
|
||||||
|
if(!voiceChannel) return;
|
||||||
|
if(voiceChannel.members.size === 0) return;
|
||||||
|
|
||||||
|
|
||||||
|
const sstation = await client.funcs.searchStation(state.station.name, client);
|
||||||
|
let url = sstation.stream[sstation.stream.default];
|
||||||
|
let station = sstation;
|
||||||
|
|
||||||
|
const construct = {
|
||||||
|
textChannel: client.channels.cache.get(state.channels.text),
|
||||||
|
voiceChannel: client.channels.cache.get(state.channels.voice),
|
||||||
|
connection: null,
|
||||||
|
message: null,
|
||||||
|
audioPlayer: createAudioPlayer(),
|
||||||
|
station: station
|
||||||
|
};
|
||||||
|
client.radio.set(guild.id, construct);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const connection =
|
||||||
|
getVoiceConnection(guild.id) ??
|
||||||
|
joinVoiceChannel({
|
||||||
|
channelId: voiceChannel.id,
|
||||||
|
guildId: voiceChannel.guild.id,
|
||||||
|
adapterCreator: voiceChannel.guild.voiceAdapterCreator
|
||||||
|
});
|
||||||
|
|
||||||
|
construct.connection = connection;
|
||||||
|
let date = new Date();
|
||||||
|
construct.startTime = date.getTime();
|
||||||
|
|
||||||
|
client.funcs.play(null, guild, client, url, Discord);
|
||||||
|
|
||||||
|
client.datastore.checkEntry(guild.id);
|
||||||
|
construct.datastore = client.datastore.getEntry(guild.id);
|
||||||
|
|
||||||
|
if (!construct.datastore.statistics[construct.station.name]) {
|
||||||
|
construct.datastore.statistics[construct.station.name] = {};
|
||||||
|
construct.datastore.statistics[construct.station.name].time = 0;
|
||||||
|
construct.datastore.statistics[construct.station.name].used = 0;
|
||||||
|
client.datastore.updateEntry(guild, construct.datastore);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
20
src/client/funcs/saveRadios.js
Normal file
20
src/client/funcs/saveRadios.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
module.exports = async function saveRadios(client) {
|
||||||
|
let currentRadios = client.radio.keys();
|
||||||
|
let radio = currentRadios.next();
|
||||||
|
|
||||||
|
while (!radio.done) {
|
||||||
|
let currentRadio = client.radio.get(radio.value);
|
||||||
|
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
||||||
|
|
||||||
|
if (currentRadio) {
|
||||||
|
await client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
|
||||||
|
await client.funcs.saveState(client, currentRadio.guild, currentRadio);
|
||||||
|
currentRadio.connection?.destroy();
|
||||||
|
currentRadio.audioPlayer?.stop();
|
||||||
|
currentRadio.message?.delete();
|
||||||
|
client.radio.delete(radio.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio = currentRadios.next();
|
||||||
|
}
|
||||||
|
}
|
18
src/client/funcs/saveState.js
Normal file
18
src/client/funcs/saveState.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
module.exports = function saveState(client, guild, radio){
|
||||||
|
client.datastore.checkEntry(guild.id);
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
|
||||||
|
let data = client.datastore.getEntry(guild.id);
|
||||||
|
|
||||||
|
data.state = {};
|
||||||
|
data.state.channels = {};
|
||||||
|
data.state.channels.text = radio.textChannel.id;
|
||||||
|
data.state.channels.voice = radio.voiceChannel.id;
|
||||||
|
data.state.date = date.toISOString();
|
||||||
|
data.state.station = {};
|
||||||
|
data.state.station.name = radio.station.name;
|
||||||
|
data.state.station.owner = radio.station.owner;
|
||||||
|
|
||||||
|
client.datastore.updateEntry(guild, data);
|
||||||
|
}
|
62
src/client/funcs/searchStation.js
Normal file
62
src/client/funcs/searchStation.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
module.exports = function searchStation(key, client) {
|
||||||
|
if (client.stations === null) return false;
|
||||||
|
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++) {
|
||||||
|
client.stations
|
||||||
|
.filter(
|
||||||
|
x => x.name.toUpperCase().includes(key.split(" ")[i].toUpperCase()) || x === key
|
||||||
|
)
|
||||||
|
.forEach(x =>
|
||||||
|
foundStations.push({ station: x, name: x.name, probability: probabilityIncrement })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (foundStations.length === 0) return false;
|
||||||
|
for (let i = 0; i < foundStations.length; i++) {
|
||||||
|
for (let j = 0; j < foundStations.length; j++) {
|
||||||
|
if (foundStations[i] === foundStations[j] && i !== j) foundStations.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < foundStations.length; i++) {
|
||||||
|
if (foundStations[i].name.length > key.length) {
|
||||||
|
foundStations[i].probability -=
|
||||||
|
(foundStations[i].name.split(" ").length - key.split(" ").length) *
|
||||||
|
(probabilityIncrement * 0.5);
|
||||||
|
} else if (foundStations[i].name.length === key.length) {
|
||||||
|
foundStations[i].probability += probabilityIncrement * 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let j = 0; j < key.split(" ").length; j++) {
|
||||||
|
if (!foundStations[i].name.toUpperCase().includes(key.toUpperCase().split(" ")[j])) {
|
||||||
|
foundStations[i].probability -= probabilityIncrement * 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let highestProbabilityStation;
|
||||||
|
for (let i = 0; i < foundStations.length; i++) {
|
||||||
|
if (
|
||||||
|
!highestProbabilityStation ||
|
||||||
|
highestProbabilityStation.probability < foundStations[i].probability
|
||||||
|
)
|
||||||
|
highestProbabilityStation = foundStations[i];
|
||||||
|
if (
|
||||||
|
highestProbabilityStation &&
|
||||||
|
highestProbabilityStation.probability === foundStations[i].probability
|
||||||
|
) {
|
||||||
|
highestProbabilityStation = foundStations[i].station;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return highestProbabilityStation;
|
||||||
|
}
|
@ -2,21 +2,21 @@ module.exports = function statisticsUpdate(client, guild, radio) {
|
|||||||
|
|
||||||
client.datastore.checkEntry(guild.id);
|
client.datastore.checkEntry(guild.id);
|
||||||
|
|
||||||
radio.currentGuild = client.datastore.getEntry(guild.id);
|
radio.datastore = client.datastore.getEntry(guild.id);
|
||||||
|
|
||||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
if(!radio.datastore.statistics[radio.station.name]){
|
||||||
radio.currentGuild.statistics[radio.station.name] = {};
|
radio.datastore.statistics[radio.station.name] = {};
|
||||||
radio.currentGuild.statistics[radio.station.name].time = 0;
|
radio.datastore.statistics[radio.station.name].time = 0;
|
||||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
radio.datastore.statistics[radio.station.name].used = 0;
|
||||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
client.datastore.updateEntry(guild, radio.datastore);
|
||||||
}
|
}
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
radio.currentTime = date.getTime();
|
radio.currentTime = date.getTime();
|
||||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
radio.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||||
|
|
||||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1;
|
||||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
client.datastore.updateEntry(guild, radio.datastore);
|
||||||
client.datastore.calculateGlobal(client);
|
client.datastore.calculateGlobal(client);
|
||||||
}
|
}
|
@ -5,15 +5,13 @@ module.exports = {
|
|||||||
runningCommandFailed: "Running this command failed!",
|
runningCommandFailed: "Running this command failed!",
|
||||||
noPermsEmbed: "I cannot send embeds (Embed links).",
|
noPermsEmbed: "I cannot send embeds (Embed links).",
|
||||||
bugTitle: "Found a bug with %client.user.username%?",
|
bugTitle: "Found a bug with %client.user.username%?",
|
||||||
bugDescription: "Join the support server \n %client.config.supportGuild%",
|
bugDescription: "Join the support server" + "\n" + "%client.config.supportGuild%",
|
||||||
helpTitle: "%client.user.username% help:",
|
helpTitle: "%client.user.username% help:",
|
||||||
helpDescription: "%commands%",
|
helpDescription: "%commands%",
|
||||||
helpCommandTitle: "%client.config.prefix%%command.name% %command.usage%",
|
|
||||||
helpCommandDescription: "%command.description% \n Command Alias: %command.alias%",
|
|
||||||
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
||||||
listTitle: "Radio Stations",
|
listTitle: "Radio Stations",
|
||||||
nowplayingTitle: "Now Playing",
|
nowplayingTitle: "Now Playing",
|
||||||
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed)%",
|
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!",
|
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!",
|
noQuery: "You need to use a number or search for a supported station!",
|
||||||
noPermsConnect: "I cannot connect to your voice channel.",
|
noPermsConnect: "I cannot connect to your voice channel.",
|
||||||
@ -36,5 +34,7 @@ module.exports = {
|
|||||||
statusField3: "Uptime",
|
statusField3: "Uptime",
|
||||||
statusField4: "Version",
|
statusField4: "Version",
|
||||||
statusField5: "Hosted by",
|
statusField5: "Hosted by",
|
||||||
errorStationURL: "Station can't be URL"
|
errorStationURL: "Station can't be URL",
|
||||||
|
messageCommandsDeprecatedTitle: "%client.user.username%",
|
||||||
|
messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055)" + "\n\n" + "**Invite Bot**" + "\n" + "https://wgi.fi/radiox_invite" + "\n\n" + "This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord." + "\n\n" + "We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released."
|
||||||
};
|
};
|
@ -20,7 +20,6 @@ module.exports = {
|
|||||||
hostedBy: "[Warén Group](https://waren.io)",
|
hostedBy: "[Warén Group](https://waren.io)",
|
||||||
|
|
||||||
//Settings
|
//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
|
debug: process.env.DEBUG_MODE || false
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user