haiz
haiz
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by haiz on 10/16/2023 in #djs-questions
Is there an api to access connections?
My profile has an xbox connection, and I want the bot to get my username
8 replies
DIAdiscord.js - Imagine an app
Created by haiz on 9/16/2023 in #djs-voice
Script plays local files well but can't play url streams, why?
const Discord = require('discord.js');
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents:
[
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
]
});

const config = require('./config.json');

const { joinVoiceChannel, createAudioPlayer, NoSubscriberBehavior, createAudioResource, AudioPlayerStatus, VoiceConnectionStatus, StreamType } = require('@discordjs/voice');
const { join } = require('path');

client.once('ready', async() => {
console.log("connected");
const channels = client.guilds.cache.find(f => f.name==="Riverside").channels;
let channel= channels.cache.find(r => r.name === "General");
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guildId,
adapterCreator: channel.guild.voiceAdapterCreator,
});
console.log("joined voice channel");
const player = createAudioPlayer();
let resource = createAudioResource("https://streams.ilovemusic.de/iloveradio2.mp3", { inlineVolume: true,
inputType: StreamType.Arbitrary});
resource.volume.setVolume(1)
connection.subscribe(player);
player.play(resource);
});
client.login(config.token);
const Discord = require('discord.js');
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents:
[
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
]
});

const config = require('./config.json');

const { joinVoiceChannel, createAudioPlayer, NoSubscriberBehavior, createAudioResource, AudioPlayerStatus, VoiceConnectionStatus, StreamType } = require('@discordjs/voice');
const { join } = require('path');

client.once('ready', async() => {
console.log("connected");
const channels = client.guilds.cache.find(f => f.name==="Riverside").channels;
let channel= channels.cache.find(r => r.name === "General");
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guildId,
adapterCreator: channel.guild.voiceAdapterCreator,
});
console.log("joined voice channel");
const player = createAudioPlayer();
let resource = createAudioResource("https://streams.ilovemusic.de/iloveradio2.mp3", { inlineVolume: true,
inputType: StreamType.Arbitrary});
resource.volume.setVolume(1)
connection.subscribe(player);
player.play(resource);
});
client.login(config.token);
9 replies