mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 14:23:18 +00:00
commit
aa116518b3
2
.github/workflows/typescript-build.yml
vendored
2
.github/workflows/typescript-build.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: install node v16
|
- name: install node v16
|
||||||
uses: actions/setup-node@v2.4.1
|
uses: actions/setup-node@v2.5.0
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
- name: npm install
|
- name: npm install
|
||||||
|
921
package-lock.json
generated
921
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eximiabots-radiox",
|
"name": "eximiabots-radiox",
|
||||||
"version": "0.3.12",
|
"version": "0.3.13",
|
||||||
"description": "Internet Radio to your Discord guild",
|
"description": "Internet Radio to your Discord guild",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -18,11 +18,11 @@
|
|||||||
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^0.8.2",
|
"@discordjs/builders": "^0.9.0",
|
||||||
"@discordjs/opus": "^0.7.0",
|
"@discordjs/opus": "^0.7.0",
|
||||||
"@discordjs/rest": "^0.1.1-canary.0",
|
"@discordjs/rest": "^0.2.0-canary.0",
|
||||||
"@discordjs/voice": "^0.7.5",
|
"@discordjs/voice": "^0.7.5",
|
||||||
"discord-api-types": "^0.24.0",
|
"discord-api-types": "^0.25.2",
|
||||||
"discord.js": "^13.2.0",
|
"discord.js": "^13.2.0",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"libsodium-wrappers": "^0.7.9",
|
"libsodium-wrappers": "^0.7.9",
|
||||||
@ -30,19 +30,19 @@
|
|||||||
"path": "^0.12.7"
|
"path": "^0.12.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.10",
|
"@types/node": "^17.0.2",
|
||||||
"@types/ws": "^8.2.0",
|
"@types/ws": "^8.2.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
||||||
"@typescript-eslint/parser": "^5.4.0",
|
"@typescript-eslint/parser": "^5.8.0",
|
||||||
"eslint": "^8.3.0",
|
"eslint": "^8.5.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"nodemon": "^2.0.15",
|
"nodemon": "^2.0.15",
|
||||||
"prettier": "^2.5.0",
|
"prettier": "^2.5.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"ts-node": "^10.4.0",
|
"ts-node": "^10.4.0",
|
||||||
"tsc-watch": "^4.5.0",
|
"tsc-watch": "^4.6.0",
|
||||||
"typescript": "^4.5.2"
|
"typescript": "^4.5.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.9.1",
|
"node": ">=16.9.1",
|
||||||
|
@ -70,17 +70,6 @@ module.exports = class {
|
|||||||
const url = station.stream[station.stream.default];
|
const url = station.stream[station.stream.default];
|
||||||
const resource = createAudioResource(url);
|
const resource = createAudioResource(url);
|
||||||
audioPlayer.play(resource);
|
audioPlayer.play(resource);
|
||||||
resource.playStream
|
|
||||||
.on("readable", () => {
|
|
||||||
this.logger('Streamer', station.name + " / " + "Readable");
|
|
||||||
})
|
|
||||||
.on("finish", () => {
|
|
||||||
this.logger('Streamer', station.name + " / " + "Finished");
|
|
||||||
})
|
|
||||||
.on("error", error => {
|
|
||||||
this.logger('Streamer', station.name + " / " + "Error" + "\n" + error);
|
|
||||||
});
|
|
||||||
|
|
||||||
audioPlayer
|
audioPlayer
|
||||||
.on('playing', () => {
|
.on('playing', () => {
|
||||||
this.logger('Streamer', station.name + " / " + "Playing");
|
this.logger('Streamer', station.name + " / " + "Playing");
|
||||||
@ -88,6 +77,7 @@ module.exports = class {
|
|||||||
.on('idle', () => {
|
.on('idle', () => {
|
||||||
this.logger('Streamer', station.name + " / " + "Idle");
|
this.logger('Streamer', station.name + " / " + "Idle");
|
||||||
audioPlayer.removeAllListeners();
|
audioPlayer.removeAllListeners();
|
||||||
|
if(this.mode == "manual" && audioPlayer.subscribers.length == 0) return;
|
||||||
this.play(station);
|
this.play(station);
|
||||||
})
|
})
|
||||||
.on('paused', () => {
|
.on('paused', () => {
|
||||||
@ -117,15 +107,12 @@ module.exports = class {
|
|||||||
|
|
||||||
listen(station) {
|
listen(station) {
|
||||||
let audioPlayer = this.map.get(station.name);
|
let audioPlayer = this.map.get(station.name);
|
||||||
if(!audioPlayer){
|
if(!audioPlayer || this.mode == "manual" && audioPlayer.subscribers.length == 0) audioPlayer = this.play(station);
|
||||||
audioPlayer = this.play(station);
|
|
||||||
}
|
|
||||||
return audioPlayer;
|
return audioPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave(client) {
|
leave(client) {
|
||||||
if(!client.stations) return;
|
if(!client.stations) return;
|
||||||
|
|
||||||
client.stations.forEach(station => {
|
client.stations.forEach(station => {
|
||||||
this.stop(station);
|
this.stop(station);
|
||||||
});
|
});
|
||||||
|
@ -60,6 +60,17 @@ module.exports = {
|
|||||||
Routes.applicationCommands(client.user.id),
|
Routes.applicationCommands(client.user.id),
|
||||||
{ body: commands }
|
{ body: commands }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let guilds = await client.guilds.fetch();
|
||||||
|
guilds.forEach(async guild => {
|
||||||
|
try {
|
||||||
|
await rest.put(
|
||||||
|
Routes.applicationGuildCommands(client.user.id, guild.id),
|
||||||
|
{ body: [] }
|
||||||
|
);
|
||||||
|
} catch (DiscordAPIError) {
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
client.funcs.logger('Slash Commands', 'Successfully reloaded application (/) commands.' + "\n");
|
client.funcs.logger('Slash Commands', 'Successfully reloaded application (/) commands.' + "\n");
|
||||||
|
@ -5,6 +5,7 @@ module.exports = {
|
|||||||
console.log(error.stack);
|
console.log(error.stack);
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
|
if(error.name == "DiscordAPIError" && error.message == "Unknown interaction") return;
|
||||||
process.emit('SIGINT');
|
process.emit('SIGINT');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user