BastiGameツ
BastiGameツ
Explore posts from servers
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
Thank you 🙂
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
And can i maybe have the bug hanter role 🙂
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
thank you very much. Do you make a new release for this? We don't want to use the dev branch for the live bot.
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
static async leaveAndStop(voiceChannel, client, guild) {
if (voiceChannel.members.size > 1) return;

const player = client.moonlink.getPlayer(guild.id);
if (!player && !player?.connected) return;
player.destroy();

}

static async #play(client, voiceChannel, guild, trackUrl) {
const player = client.moonlink.getPlayer(guild.id) || client.moonlink.createPlayer({
guildId: guild.id,
voiceChannelId: voiceChannel.id,
textChannelId: voiceChannel.id,
volume: 50,
loop: 'track'
});


if (player.playing) return

player.connect({ setDeaf: true });

const result = await client.moonlink.search({
query: trackUrl,
})

const track = result.tracks[0];

player.queue.clear();
player.queue.add(track);

await player.play().catch(error => {
Logger.error(LogModule.AUDIO, null, error?.message, error?.stack);
});
}
static async leaveAndStop(voiceChannel, client, guild) {
if (voiceChannel.members.size > 1) return;

const player = client.moonlink.getPlayer(guild.id);
if (!player && !player?.connected) return;
player.destroy();

}

static async #play(client, voiceChannel, guild, trackUrl) {
const player = client.moonlink.getPlayer(guild.id) || client.moonlink.createPlayer({
guildId: guild.id,
voiceChannelId: voiceChannel.id,
textChannelId: voiceChannel.id,
volume: 50,
loop: 'track'
});


if (player.playing) return

player.connect({ setDeaf: true });

const result = await client.moonlink.search({
query: trackUrl,
})

const track = result.tracks[0];

player.queue.clear();
player.queue.add(track);

await player.play().catch(error => {
Logger.error(LogModule.AUDIO, null, error?.message, error?.stack);
});
}
This is the code we currently have. It does not work with this one. But I don't see any difference to your code
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
The fact that the bot now takes longer may also be due to the fact that I tested it locally. Unfortunately, I can't test it directly on the host at the moment.
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
okay, i would test it
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
yes
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
this is all that is in the log file
47 replies
MIA🎶 Moonlink.js - Imagine a Music Application
Created by BastiGameツ on 4/25/2025 in #issues
Start playing the wrong track
I also left the Voice Channel at the end. But I don't see the destroy in the log file. But the bot leaves the voice channel. Is that perhaps the problem?
47 replies
AutoLeave not working
Oh okay, thanks for the help then.
17 replies
AutoLeave not working
yes
17 replies
AutoLeave not working
Would you add this as a feature or do we have to code it ourselves?
17 replies
AutoLeave not working
Oh, we need that the bot leaves when there are no more members in the channel
17 replies
DIAdiscord.js - Imagine an app
Created by BastiGameツ on 4/16/2025 in #djs-questions
Error with guild.members.me
for (const guild of client.guilds.cache.values()) {

if (!guild.available) {
Logger.debug(LogModule.BOT, guild?.id, "Guild " + guild?.id + " is not available");
continue
}

const youTubeModule = await client.getGuildModule(guild.id, ModuleList.youtube);

if (youTubeModule) {
updateYouTubeCount += await this.#updateYouTubeSlots(client, guild, youTubeModule);
}
for (const guild of client.guilds.cache.values()) {

if (!guild.available) {
Logger.debug(LogModule.BOT, guild?.id, "Guild " + guild?.id + " is not available");
continue
}

const youTubeModule = await client.getGuildModule(guild.id, ModuleList.youtube);

if (youTubeModule) {
updateYouTubeCount += await this.#updateYouTubeSlots(client, guild, youTubeModule);
}
async #updateYouTubeSlots(client, guild, youtubeModule) {
if (!await ModuleSetupChecker.areSocialMediaSlotsSetup(youtubeModule)) return 0;

if (Object.values(youtubeModule.slots).length === 0) return 0;

let count = 0;
for (const slot of Object.values(youtubeModule.slots)) {
let youtuber;
let youtuberList = null;

youtuber = await client.redis.getString("youtuber:" + slot.youtuber.id);
if (!youtuber) continue;
youtuber = JSON.parse(youtuber);

if (!youtuber.video) continue;

count += await YouTubeSlotsUpdateHandler.updateCurrentVideoInSlot(client, guild, slot, youtuber, youtubeModule, youtuberList);
}

return count;
}
async #updateYouTubeSlots(client, guild, youtubeModule) {
if (!await ModuleSetupChecker.areSocialMediaSlotsSetup(youtubeModule)) return 0;

if (Object.values(youtubeModule.slots).length === 0) return 0;

let count = 0;
for (const slot of Object.values(youtubeModule.slots)) {
let youtuber;
let youtuberList = null;

youtuber = await client.redis.getString("youtuber:" + slot.youtuber.id);
if (!youtuber) continue;
youtuber = JSON.parse(youtuber);

if (!youtuber.video) continue;

count += await YouTubeSlotsUpdateHandler.updateCurrentVideoInSlot(client, guild, slot, youtuber, youtubeModule, youtuberList);
}

return count;
}
static async updateCurrentVideoInSlot(client, guild, slot, youtuber, youtubeModule, youtuberList) {

if (!guild.members.me) {
Logger.info(LogModule.YOUTUBE, guild.id, "Guild.members.me null for guild " + guild.id);
}

const videosChannel = await FetchUtil.fetchChannel(guild, null, slot.videosChannel.id);
if (!videosChannel) return 0;
static async updateCurrentVideoInSlot(client, guild, slot, youtuber, youtubeModule, youtuberList) {

if (!guild.members.me) {
Logger.info(LogModule.YOUTUBE, guild.id, "Guild.members.me null for guild " + guild.id);
}

const videosChannel = await FetchUtil.fetchChannel(guild, null, slot.videosChannel.id);
if (!videosChannel) return 0;
static async fetchChannel(guild, interaction, channelID) {
if (!guild) {
Logger.warn(LogModule.FETCH, null, "Cannot fetch channel because guild is null or undefined");
return null;
}

if (!channelID) {
Logger.warn(LogModule.FETCH, guild.id, "Cannot fetch channel because channel is null or undefined");
return null;
}

const date = Date.now();

if (ThrottleUtil.check(guild.channels.fetch, channelID, date, 60 * 1000)) return null;

if (!await PermissionUtil.hasNeededDiscordPermissions(guild.members.me, PermissionsBitField.Flags.ViewChannel)) return null;
static async fetchChannel(guild, interaction, channelID) {
if (!guild) {
Logger.warn(LogModule.FETCH, null, "Cannot fetch channel because guild is null or undefined");
return null;
}

if (!channelID) {
Logger.warn(LogModule.FETCH, guild.id, "Cannot fetch channel because channel is null or undefined");
return null;
}

const date = Date.now();

if (ThrottleUtil.check(guild.channels.fetch, channelID, date, 60 * 1000)) return null;

if (!await PermissionUtil.hasNeededDiscordPermissions(guild.members.me, PermissionsBitField.Flags.ViewChannel)) return null;
that the code from the beginning to the error
33 replies
DIAdiscord.js - Imagine an app
Created by BastiGameツ on 4/16/2025 in #djs-questions
Error with guild.members.me
Because of an NDA I am not allowed to send it in a public chat. can we continue writing via dm?
33 replies
DIAdiscord.js - Imagine an app
Created by BastiGameツ on 4/16/2025 in #djs-questions
Error with guild.members.me
yes that will be checked
33 replies
DIAdiscord.js - Imagine an app
Created by BastiGameツ on 4/16/2025 in #djs-questions
Error with guild.members.me
guild comes from client.guilds.cache.values()
33 replies
DIAdiscord.js - Imagine an app
Created by BastiGameツ on 4/16/2025 in #djs-questions
Error with guild.members.me
static async hasNeededDiscordPermissions(member, permissions, interaction = null) {
if (!member) {
Logger.warn(LogModule.BOT, null, "Cannot check member permissions because member is null or undefined");
return false;
}
}

static async hasNeededDiscordPermissions(member, permissions, interaction = null) {
if (!member) {
Logger.warn(LogModule.BOT, null, "Cannot check member permissions because member is null or undefined");
return false;
}
}

here comes the log that member was not found
if (!await PermissionUtil.hasNeededDiscordPermissions(guild.members.me, PermissionsBitField.Flags.ViewChannel)) return null;
if (!await PermissionUtil.hasNeededDiscordPermissions(guild.members.me, PermissionsBitField.Flags.ViewChannel)) return null;
with this code I call the hasNeededDiscordPermissions
33 replies
DIAdiscord.js - Imagine an app
Created by BastiGameツ on 4/16/2025 in #djs-questions
Error with guild.members.me
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildExpressions,
];
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildExpressions,
];
- these are the intents - the rest is not mine, could that cause problems?
33 replies