mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 21:43:38 +00:00
Compare commits
98 Commits
Author | SHA1 | Date | |
---|---|---|---|
22e6db7585 | |||
5d8c1cca81 | |||
17da8dd72f | |||
34f61d323b | |||
0625f0d426 | |||
abd3a68eaa | |||
ad3403aea5 | |||
e0828217c0 | |||
4b95913e31 | |||
c8f2c4d44f | |||
f14cd6fd2b | |||
69b0becf83 | |||
b1cc21749a | |||
447e16ee1d | |||
223b7e3eba | |||
f8e1aea696 | |||
dd0861e861 | |||
ca11b925b8 | |||
38084c1572 | |||
c5063a074c | |||
545e37bbd3 | |||
58df0cd51a | |||
cd868aa254 | |||
bcf179358b | |||
aa41403df6 | |||
950e3749c9 | |||
d8248795d5 | |||
b8eadb7ea7 | |||
ed8ebc8b33 | |||
6ee765733b | |||
f93b708444 | |||
eb58cda826 | |||
6ac3f83bb1 | |||
9a681bde9e | |||
e2f8533dfe | |||
0d322dae14 | |||
fc4bbeacaf | |||
565daab38e | |||
3a0f3fbe48 | |||
aa9e7c1191 | |||
80248d3d1b | |||
78bf44e1cb | |||
7f9e963af4 | |||
300406ac8e | |||
18b71794e7 | |||
c6e249291d | |||
049c3195b4 | |||
c44eaf1256 | |||
889dba29d2 | |||
170c5af188 | |||
6e32773a35 | |||
fb260aa53d | |||
654833a0cb | |||
e5ecfb6174 | |||
be0bf170c4 | |||
7114c5e629 | |||
7cfe6af287 | |||
8f16a0b30d | |||
ed8f977768 | |||
e39b94881b | |||
debfd82bbb | |||
20361b0f6a | |||
09d8eb7c00 | |||
973cd00c82 | |||
a1403d7047 | |||
5c44838b8a | |||
718a10a991 | |||
e423088e9d | |||
99a652abc7 | |||
e3ca47c8e4 | |||
d1bc206f26 | |||
b746f07927 | |||
ab8a11c8dc | |||
afb07001f4 | |||
c9eb534f88 | |||
08a6f2c78f | |||
724ed6e44b | |||
20b9b6179c | |||
6ecf0eaab6 | |||
5f42164b30 | |||
d7a8ead5a3 | |||
854b64d10a | |||
c3792b3b3c | |||
cf9de37b99 | |||
011e41e3c1 | |||
09287fab26 | |||
45e68ce497 | |||
7597917cb1 | |||
04b9922854 | |||
eeb5899eb1 | |||
f773cbab8c | |||
5be8d74353 | |||
d2a675216b | |||
a885f04179 | |||
8f475e861c | |||
5f72e8e366 | |||
263b807653 | |||
8eec6049af |
2
.github/workflows/docker-build.yml
vendored
2
.github/workflows/docker-build.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3.3.0
|
uses: docker/setup-buildx-action@v3.11.1
|
||||||
id: buildx
|
id: buildx
|
||||||
with:
|
with:
|
||||||
install: true
|
install: true
|
||||||
|
55
CHANGELOG.md
55
CHANGELOG.md
@ -1,6 +1,6 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
## 0.5.7 (19.6.2023)
|
## 0.5.11 (20.6.2025)
|
||||||
|
|
||||||
Patch Release
|
Patch Release
|
||||||
|
|
||||||
@ -10,7 +10,56 @@ Patch Release
|
|||||||
**Contributors:**
|
**Contributors:**
|
||||||
[cwchristerw](<https://github.com/cwchristerw>)
|
[cwchristerw](<https://github.com/cwchristerw>)
|
||||||
|
|
||||||
## 0.5.6 (8.6.2023)
|
## 0.5.10 (14.6.2025)
|
||||||
|
|
||||||
|
Patch Release
|
||||||
|
|
||||||
|
**Package**
|
||||||
|
- Dependencies Update
|
||||||
|
|
||||||
|
**Miscellaneous:**
|
||||||
|
- Dockerfile: Use NodeJS 22
|
||||||
|
|
||||||
|
**Contributors:**
|
||||||
|
[cwchristerw](<https://github.com/cwchristerw>)
|
||||||
|
|
||||||
|
## 0.5.9 (23.2.2025)
|
||||||
|
|
||||||
|
Patch Release
|
||||||
|
|
||||||
|
- Updating code, because Discord.js has deprecated few options previously used.
|
||||||
|
|
||||||
|
**Package**
|
||||||
|
- Dependencies Update
|
||||||
|
|
||||||
|
**Contributors:**
|
||||||
|
[cwchristerw](<https://github.com/cwchristerw>)
|
||||||
|
|
||||||
|
## 0.5.8 (30.9.2024)
|
||||||
|
|
||||||
|
Patch Release
|
||||||
|
|
||||||
|
**Package**
|
||||||
|
- Dependencies Update
|
||||||
|
|
||||||
|
**Documentation**
|
||||||
|
- Update radio stations list address and repo in README.md
|
||||||
|
- Fix versions 0.5.5-0.5.7 release years in CHANGELOG.md
|
||||||
|
|
||||||
|
**Contributors:**
|
||||||
|
[cwchristerw](<https://github.com/cwchristerw>)
|
||||||
|
|
||||||
|
## 0.5.7 (19.6.2024)
|
||||||
|
|
||||||
|
Patch Release
|
||||||
|
|
||||||
|
**Package**
|
||||||
|
- Dependencies Update
|
||||||
|
|
||||||
|
**Contributors:**
|
||||||
|
[cwchristerw](<https://github.com/cwchristerw>)
|
||||||
|
|
||||||
|
## 0.5.6 (8.6.2024)
|
||||||
|
|
||||||
Patch Release
|
Patch Release
|
||||||
|
|
||||||
@ -23,7 +72,7 @@ Patch Release
|
|||||||
**Contributors:**
|
**Contributors:**
|
||||||
[cwchristerw](<https://github.com/cwchristerw>)
|
[cwchristerw](<https://github.com/cwchristerw>)
|
||||||
|
|
||||||
## 0.5.5 (30.4.2023)
|
## 0.5.5 (30.4.2024)
|
||||||
|
|
||||||
Patch Release
|
Patch Release
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/library/node:20-alpine
|
FROM docker.io/library/node:22-alpine
|
||||||
|
|
||||||
#Dependencies
|
#Dependencies
|
||||||
RUN apk add --virtual .build-deps python3 make g++ gcc git
|
RUN apk add --virtual .build-deps python3 make g++ gcc git
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2024 EximiaBots by Warén Group
|
Copyright (c) 2020-2025 EximiaBots by Warén Group
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
# RadioX by EximiaBots
|
# RadioX by EximiaBots
|
||||||
Internet Radio to your Discord guild
|
Internet Radio to your Discord guild
|
||||||
|
|
||||||
## [Radio Stations List](https://git.cwinfo.net/cwchristerw/radio)
|
## [Radio Stations List](https://eximiabots.waren.io/radiox/stations.json)
|
||||||
This bot is using Gitea repo to get radio stations from [playlist.json](https://git.cwinfo.net/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 getting radio stations from our servers.
|
||||||
|
|
||||||
|
https://eximiabots.waren.io/radiox/stations.json
|
||||||
|
|
||||||
|
List is generated with cwchristerw's [radio](https://git.waren.io/cwchristerw/radio) repo. This list is currently maintained by Christer Warén. You can use alternative list with same format when using RADIOX_STATIONSLISTURL environment variable.
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
|
537
package-lock.json
generated
537
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eximiabots-radiox",
|
"name": "eximiabots-radiox",
|
||||||
"version": "0.5.7",
|
"version": "0.5.11",
|
||||||
"description": "Internet Radio to your Discord guild",
|
"description": "Internet Radio to your Discord guild",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -18,18 +18,18 @@
|
|||||||
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/voice": "^0.17.0",
|
"@discordjs/voice": "^0.18.0",
|
||||||
"discord.js": "^14.15.3",
|
"discord.js": "^14.20.0",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.5.0",
|
||||||
"libsodium-wrappers": "^0.7.13",
|
"libsodium-wrappers": "^0.7.15",
|
||||||
"path": "^0.12.7"
|
"path": "^0.12.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"rimraf": "^5.0.7",
|
"rimraf": "^6.0.1",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0",
|
"node": ">=22.0.0",
|
||||||
"npm": ">=10.0.0"
|
"npm": ">=10.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ export default class Datastore {
|
|||||||
return this.map.get(id);
|
return this.map.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateEntry(guild: Guild | { id: string, name: string }, newData: datastore) {
|
updateEntry(guild: Guild | { id: string, name?: string }, newData: datastore) {
|
||||||
newData.guild.name = guild.name;
|
newData.guild.name = guild.name;
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import { Collection, GuildMember, Message, OAuth2Guild, TextBasedChannel, VoiceBasedChannel, VoiceChannel } from "discord.js";
|
import { Collection, GuildMember, Message, Guild, OAuth2Guild, TextBasedChannel, VoiceBasedChannel, VoiceChannel } from "discord.js";
|
||||||
import { getVoiceConnection, joinVoiceChannel, VoiceConnection } from "@discordjs/voice";
|
import { DiscordGatewayAdapterCreator, getVoiceConnection, joinVoiceChannel, VoiceConnection } from "@discordjs/voice";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { station } from "./Stations";
|
import { station } from "./Stations";
|
||||||
import { datastore } from "./Datastore";
|
import { datastore } from "./Datastore";
|
||||||
|
|
||||||
export interface radio {
|
export interface radio {
|
||||||
textChannel: TextBasedChannel | undefined | null,
|
textChannel: TextBasedChannel | null,
|
||||||
voiceChannel: VoiceBasedChannel | undefined,
|
voiceChannel: VoiceBasedChannel | null,
|
||||||
connection: VoiceConnection | null,
|
connection: VoiceConnection | undefined,
|
||||||
message: Message | null,
|
message: Message | null,
|
||||||
station: station,
|
station: station,
|
||||||
datastore?: datastore,
|
datastore?: datastore,
|
||||||
currentTime?: number,
|
currentTime?: number,
|
||||||
startTime: number,
|
startTime: number,
|
||||||
playTime?: number,
|
playTime?: number,
|
||||||
guild?: any
|
guild?: Guild | { id: string, name?: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface state {
|
export interface state {
|
||||||
@ -78,10 +78,11 @@ export default class Radio extends Map<string, radio> {
|
|||||||
const construct: radio = {
|
const construct: radio = {
|
||||||
textChannel: client.channels.cache.get(state.channels.text) as TextBasedChannel,
|
textChannel: client.channels.cache.get(state.channels.text) as TextBasedChannel,
|
||||||
voiceChannel: client.channels.cache.get(state.channels.voice) as VoiceBasedChannel,
|
voiceChannel: client.channels.cache.get(state.channels.voice) as VoiceBasedChannel,
|
||||||
connection: null,
|
connection: undefined,
|
||||||
message: null,
|
message: null,
|
||||||
station: station,
|
station: station,
|
||||||
startTime: date.getTime()
|
startTime: date.getTime(),
|
||||||
|
guild: guild
|
||||||
};
|
};
|
||||||
this.set(guild.id, construct);
|
this.set(guild.id, construct);
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ export default class Radio extends Map<string, radio> {
|
|||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: voiceChannel.id,
|
channelId: voiceChannel.id,
|
||||||
guildId: voiceChannel.guild.id,
|
guildId: voiceChannel.guild.id,
|
||||||
adapterCreator: voiceChannel.guild.voiceAdapterCreator
|
adapterCreator: voiceChannel.guild.voiceAdapterCreator as DiscordGatewayAdapterCreator
|
||||||
});
|
});
|
||||||
|
|
||||||
construct.connection = connection;
|
construct.connection = connection;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Guild } from "discord.js";
|
import { Guild, OAuth2Guild } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { radio } from "./Radio";
|
import { radio } from "./Radio";
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ export default class Statistics {
|
|||||||
this.map = new Map();
|
this.map = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
update(client: RadioClient, guild: Guild | null, radio: radio) {
|
update(client: RadioClient, guild: Guild | { id: string, name?: string } | undefined, radio: radio) {
|
||||||
if(!guild) return;
|
if(!guild) return;
|
||||||
|
|
||||||
client.datastore?.checkEntry(guild.id);
|
client.datastore?.checkEntry(guild.id);
|
||||||
|
@ -10,7 +10,7 @@ export default {
|
|||||||
|
|
||||||
if(!client.user) return interaction.reply({
|
if(!client.user) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
@ -28,7 +28,7 @@ export default {
|
|||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ export default {
|
|||||||
if(client.config.maintenanceMode){
|
if(client.config.maintenanceMode){
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ export default {
|
|||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
"%client.config.supportGuild%": client.config.supportGuild
|
"%client.config.supportGuild%": client.config.supportGuild
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ export default {
|
|||||||
|
|
||||||
if(!client.funcs.isDev(client.config.devIDs, interaction.user.id)) return interaction.reply({
|
if(!client.funcs.isDev(client.config.devIDs, interaction.user.id)) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.notAllowed,
|
content: client.messages.emojis["error"] + client.messages.notAllowed,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
let action : number | string | null = null;
|
let action : number | string | null = null;
|
||||||
@ -107,7 +107,7 @@ export default {
|
|||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: "**" + client.messages.maintenanceTitle + "**",
|
content: "**" + client.messages.maintenanceTitle + "**",
|
||||||
components: [menu],
|
components: [menu],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ export default {
|
|||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
let guilds = await client.guilds.fetch();
|
let guilds = await client.guilds.fetch();
|
||||||
|
@ -16,7 +16,7 @@ export default {
|
|||||||
if(client.config.maintenanceMode){
|
if(client.config.maintenanceMode){
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ export default {
|
|||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
"%client.config.supportGuild%": client.config.supportGuild
|
"%client.config.supportGuild%": client.config.supportGuild
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ export default {
|
|||||||
|
|
||||||
if(!station) return interaction.reply({
|
if(!station) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noSearchResults,
|
content: client.messages.emojis["error"] + client.messages.noSearchResults,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
client.statistics?.update(client, interaction.guild, radio);
|
client.statistics?.update(client, interaction.guild, radio);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ApplicationCommandOptionType, ChatInputCommandInteraction, GuildMember, PermissionFlagsBits, StringSelectMenuInteraction } from "discord.js";
|
import { ApplicationCommandOptionType, ChatInputCommandInteraction, GuildMember, PermissionFlagsBits, StringSelectMenuInteraction } from "discord.js";
|
||||||
import { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
|
import { DiscordGatewayAdapterCreator, getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { radio } from "../classes/Radio"
|
import { radio } from "../classes/Radio"
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ export default {
|
|||||||
if(client.config.maintenanceMode){
|
if(client.config.maintenanceMode){
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ export default {
|
|||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
"%client.config.supportGuild%": client.config.supportGuild
|
"%client.config.supportGuild%": client.config.supportGuild
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,32 +52,32 @@ export default {
|
|||||||
|
|
||||||
if (!voiceChannel) return interaction.reply({
|
if (!voiceChannel) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noVoiceChannel,
|
content: client.messages.emojis["error"] + client.messages.noVoiceChannel,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (radio) {
|
if (radio) {
|
||||||
if (voiceChannel !== radio.voiceChannel) return interaction.reply({
|
if (voiceChannel !== radio.voiceChannel) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
|
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!query) return interaction.reply({
|
if (!query) return interaction.reply({
|
||||||
content: client.messages.noQuery,
|
content: client.messages.noQuery,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
const permissions = voiceChannel.permissionsFor(interaction.client.user);
|
const permissions = voiceChannel.permissionsFor(interaction.client.user);
|
||||||
if (!permissions?.has(PermissionFlagsBits.Connect)) {
|
if (!permissions?.has(PermissionFlagsBits.Connect)) {
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noPermsConnect,
|
content: client.messages.emojis["error"] + client.messages.noPermsConnect,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!permissions?.has(PermissionFlagsBits.Speak)) {
|
if (!permissions?.has(PermissionFlagsBits.Speak)) {
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noPermsSpeak,
|
content: client.messages.emojis["error"] + client.messages.noPermsSpeak,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let station;
|
let station;
|
||||||
@ -87,7 +87,7 @@ export default {
|
|||||||
if(number > client.stations.length - 1) {
|
if(number > client.stations.length - 1) {
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.wrongStationNumber,
|
content: client.messages.emojis["error"] + client.messages.wrongStationNumber,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
station = client.stations[number];
|
station = client.stations[number];
|
||||||
@ -96,7 +96,7 @@ export default {
|
|||||||
|
|
||||||
if(query.length < 3) return interaction.reply({
|
if(query.length < 3) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.tooShortSearch,
|
content: client.messages.emojis["error"] + client.messages.tooShortSearch,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
let type = "text";
|
let type = "text";
|
||||||
@ -108,7 +108,7 @@ export default {
|
|||||||
const sstation = client.stations.search(query, type);
|
const sstation = client.stations.search(query, type);
|
||||||
if (!sstation) return interaction.reply({
|
if (!sstation) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noSearchResults,
|
content: client.messages.emojis["error"] + client.messages.noSearchResults,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
station = sstation;
|
station = sstation;
|
||||||
}
|
}
|
||||||
@ -129,10 +129,11 @@ export default {
|
|||||||
const construct: radio = {
|
const construct: radio = {
|
||||||
textChannel: interaction.channel,
|
textChannel: interaction.channel,
|
||||||
voiceChannel: voiceChannel,
|
voiceChannel: voiceChannel,
|
||||||
connection: null,
|
connection: undefined,
|
||||||
message: null,
|
message: null,
|
||||||
station: station,
|
station: station,
|
||||||
startTime: date.getTime()
|
startTime: date.getTime(),
|
||||||
|
guild: interaction.guild
|
||||||
};
|
};
|
||||||
client.radio?.set(interaction.guild?.id, construct);
|
client.radio?.set(interaction.guild?.id, construct);
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ export default {
|
|||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: voiceChannel.id,
|
channelId: voiceChannel.id,
|
||||||
guildId: voiceChannel.guild.id,
|
guildId: voiceChannel.guild.id,
|
||||||
adapterCreator: voiceChannel.guild.voiceAdapterCreator
|
adapterCreator: voiceChannel.guild?.voiceAdapterCreator as DiscordGatewayAdapterCreator
|
||||||
});
|
});
|
||||||
construct.connection = connection;
|
construct.connection = connection;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
@ -154,7 +155,7 @@ export default {
|
|||||||
client.radio?.delete(interaction.guild?.id);
|
client.radio?.delete(interaction.guild?.id);
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + `An error occured: ${error}`,
|
content: client.messages.emojis["error"] + `An error occured: ${error}`,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ export default {
|
|||||||
if(client.config.maintenanceMode){
|
if(client.config.maintenanceMode){
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ export default {
|
|||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
"%client.config.supportGuild%": client.config.supportGuild
|
"%client.config.supportGuild%": client.config.supportGuild
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ export default {
|
|||||||
|
|
||||||
if(!station) return interaction.reply({
|
if(!station) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noSearchResults,
|
content: client.messages.emojis["error"] + client.messages.noSearchResults,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
client.statistics?.update(client, interaction.guild, radio);
|
client.statistics?.update(client, interaction.guild, radio);
|
||||||
|
@ -10,7 +10,7 @@ export default {
|
|||||||
|
|
||||||
if(!interaction.guild) return interaction.reply({
|
if(!interaction.guild) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
let currentGuild = client.datastore?.getEntry(interaction.guild.id);
|
let currentGuild = client.datastore?.getEntry(interaction.guild.id);
|
||||||
@ -22,7 +22,7 @@ export default {
|
|||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
"%client.config.supportGuild%": client.config.supportGuild
|
"%client.config.supportGuild%": client.config.supportGuild
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ export default {
|
|||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@ export default {
|
|||||||
|
|
||||||
if(!client.user) return interaction.reply({
|
if(!client.user) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
let uptime = client.funcs.msToTime(client.uptime || 0);
|
let uptime = client.funcs.msToTime(client.uptime || 0);
|
||||||
@ -35,7 +35,7 @@ export default {
|
|||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ButtonInteraction, ChatInputCommandInteraction, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
import { ButtonInteraction, ChannelType, ChatInputCommandInteraction, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { command } from "../commands";
|
import { command } from "../commands";
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ export default {
|
|||||||
if(!interaction.guild) return;
|
if(!interaction.guild) return;
|
||||||
const radio = client.radio?.get(interaction.guild?.id);
|
const radio = client.radio?.get(interaction.guild?.id);
|
||||||
if(!radio) return;
|
if(!radio) return;
|
||||||
|
if(radio.textChannel?.type == ChannelType.DM || radio.textChannel?.type == ChannelType.GroupDM) return;
|
||||||
client.statistics?.update(client, interaction.guild, radio);
|
client.statistics?.update(client, interaction.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
client.funcs.logger('Radio', interaction.guild?.id + " / " + 'Stop');
|
client.funcs.logger('Radio', interaction.guild?.id + " / " + 'Stop');
|
||||||
@ -47,7 +48,7 @@ export default {
|
|||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messages.emojis["stop"] + client.messages.stop,
|
content: client.messages.emojis["stop"] + client.messages.stop,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,15 @@ import RadioClient from "../../Client";
|
|||||||
|
|
||||||
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
|
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
|
||||||
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
|
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
|
||||||
|
if(interaction.channel?.type == ChannelType.DM || interaction.channel?.type == ChannelType.GroupDM) return;
|
||||||
|
|
||||||
if(interaction.channel?.type != ChannelType.DM){
|
|
||||||
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
|
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
|
||||||
if (!permissions?.has(PermissionFlagsBits.ViewChannel)) return;
|
if (!permissions?.has(PermissionFlagsBits.ViewChannel)) return;
|
||||||
|
|
||||||
if (!permissions?.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
|
if (!permissions?.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.noPermsEmbed,
|
content: client.messages.emojis["error"] + client.messages.noPermsEmbed,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if(interaction.isChatInputCommand()){
|
if(interaction.isChatInputCommand()){
|
||||||
const commandName = interaction.commandName;
|
const commandName = interaction.commandName;
|
||||||
@ -24,7 +23,7 @@ export default function interactionCreate(client: RadioClient, interaction: Inte
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.runningCommandFailed,
|
content: client.messages.emojis["error"] + client.messages.runningCommandFailed,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@ -38,7 +37,7 @@ export default function interactionCreate(client: RadioClient, interaction: Inte
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.runningCommandFailed,
|
content: client.messages.emojis["error"] + client.messages.runningCommandFailed,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import { GuildMember, PermissionFlagsBits, VoiceState } from "discord.js";
|
import { GuildMember, PermissionFlagsBits, VoiceState } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
const {
|
import { DiscordGatewayAdapterCreator, getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
|
||||||
getVoiceConnection,
|
|
||||||
joinVoiceChannel
|
|
||||||
} = require("@discordjs/voice");
|
|
||||||
|
|
||||||
export default async function voiceStateUpdate(client: RadioClient, oldState: VoiceState, newState: VoiceState) {
|
export default async function voiceStateUpdate(client: RadioClient, oldState: VoiceState, newState: VoiceState) {
|
||||||
if (oldState.channel === null) return;
|
if (oldState.channel === null) return;
|
||||||
@ -27,9 +24,9 @@ export default async function voiceStateUpdate(client: RadioClient, oldState: Vo
|
|||||||
setTimeout(
|
setTimeout(
|
||||||
async () => (
|
async () => (
|
||||||
radio.connection = joinVoiceChannel({
|
radio.connection = joinVoiceChannel({
|
||||||
channelId: oldState.channel?.id,
|
channelId: oldState.channel?.id as string,
|
||||||
guildId: oldState.channel?.guild.id,
|
guildId: oldState.channel?.guild.id as string,
|
||||||
adapterCreator: oldState.channel?.guild.voiceAdapterCreator
|
adapterCreator: oldState.channel?.guild.voiceAdapterCreator as DiscordGatewayAdapterCreator
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
1000
|
1000
|
||||||
|
@ -11,14 +11,14 @@ export default function check(client: RadioClient, interaction: ButtonInteractio
|
|||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
"%client.config.supportGuild%": client.config.supportGuild
|
"%client.config.supportGuild%": client.config.supportGuild
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!radio) {
|
if (!radio) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.notPlaying,
|
content: client.messages.emojis["error"] + client.messages.notPlaying,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ export default function check(client: RadioClient, interaction: ButtonInteractio
|
|||||||
if (interaction.member instanceof GuildMember && interaction.member?.voice.channel !== radio.voiceChannel) {
|
if (interaction.member instanceof GuildMember && interaction.member?.voice.channel !== radio.voiceChannel) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
|
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,6 @@ export default function listStations(client: RadioClient, interaction: ButtonInt
|
|||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: '**Select station:**',
|
content: '**Select station:**',
|
||||||
components: [menu],
|
components: [menu],
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, EmbedBuilder, Guild, OAuth2Guild, StringSelectMenuInteraction } from "discord.js";
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, ChatInputCommandInteraction, EmbedBuilder, Guild, OAuth2Guild, StringSelectMenuInteraction } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { station } from "../classes/Stations";
|
import { station } from "../classes/Stations";
|
||||||
|
|
||||||
@ -7,6 +7,7 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
|
|
||||||
const radio = client.radio?.get(guild.id);
|
const radio = client.radio?.get(guild.id);
|
||||||
if(!radio) return;
|
if(!radio) return;
|
||||||
|
if(radio.textChannel?.type == ChannelType.DM || radio.textChannel?.type == ChannelType.GroupDM) return;
|
||||||
const audioPlayer = client.streamer?.listen(station);
|
const audioPlayer = client.streamer?.listen(station);
|
||||||
if(!audioPlayer) return;
|
if(!audioPlayer) return;
|
||||||
radio.connection?.subscribe(audioPlayer);
|
radio.connection?.subscribe(audioPlayer);
|
||||||
@ -123,7 +124,7 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
let timer : NodeJS.Timeout = setInterval(async function(){
|
let timer : NodeJS.Timeout = setInterval(async function(){
|
||||||
const radio = client.radio?.get(guild.id);
|
const radio = client.radio?.get(guild.id);
|
||||||
|
|
||||||
if(!radio || !oldRadio || radio.station.name != oldRadio.station.name) {
|
if(!radio || !oldRadio || radio.station.name != oldRadio.station.name || radio.textChannel?.type == ChannelType.DM || radio.textChannel?.type == ChannelType.GroupDM) {
|
||||||
return clearInterval(timer);
|
return clearInterval(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
content: client.messages.emojis["play"] + client.messages.replace(client.messages.play, {
|
content: client.messages.emojis["play"] + client.messages.replace(client.messages.play, {
|
||||||
"%radio.station.name%": radio.station.name
|
"%radio.station.name%": radio.station.name
|
||||||
}),
|
}),
|
||||||
ephemeral: true
|
flags: 'Ephemeral'
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ import { Guild } from "discord.js";
|
|||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { radio } from "../classes/Radio";
|
import { radio } from "../classes/Radio";
|
||||||
|
|
||||||
export default function saveState(client: RadioClient, guild: Guild, radio: radio){
|
export default function saveState(client: RadioClient, guild: Guild | { id: string, name?: string } | undefined, radio: radio){
|
||||||
if(!client.datastore) return;
|
if(!client.datastore || !guild) return;
|
||||||
client.datastore.checkEntry(guild.id);
|
client.datastore.checkEntry(guild.id);
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
Reference in New Issue
Block a user