it is rude
it is rude
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by it is rude on 9/7/2023 in #djs-questions
Mobile Status
I have tried to set the mobile status by doing the Discord iOS in ws/index.js but It doesn't seem to be working, is there any other way, I have also tried Discord Android same location. I am not sure if its my ready file that may be causing the mobile status not to appear but below I have attached my ready file as well, I did make a attepmt to add the location of the ws into my ready file
const AvonClientEvent = require("../../structures/Eventhandler");
const { Client, GatewayIntentBits, ActivityType } = require('discord.js');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
// .. more intents as needed
],
ws: { properties: { browser: 'Discord Android' } },
});

class AvonReady extends AvonClientEvent{
get name(){
return 'ready';
}
async run(){
console.log(`${this.client.user.username} is Online!`);
this.client.poru.init(this.client);

// Define the statuses, types, botStatuses, and URLs for full customization
let baseStatuses = [`${this.client.config.prefix}help`];
let statuses = baseStatuses.map(status => `${status}`);
let types = [ActivityType.Listening]; // You can add more types in this array as needed
let botStatuses = [ws: { properties: { browser: 'Discord Android' } }]; // You can add more bot statuses (like 'online', 'idle') in this array as needed
let streamURL = "https://twitch.tv/rutrruns"; // Stream URL

setInterval(() => {
let status = statuses[Math.floor(Math.random()*statuses.length)];
let type = types[Math.floor(Math.random() * types.length)];
let botStatus = botStatuses[Math.floor(Math.random() * botStatuses.length)];

this.client.user.setPresence({
activities: [
{
name: status,
type: type,
url: streamURL // Add the streaming URL
}
],
status: botStatus
});
}, 1000);

const guilds = this.client.guilds.cache.map(x => x.id);
guilds.forEach(async g => {
let guild = await this.client.guilds.fetch(g);
if(!guild) return;

let db = await this.client.data.get(`${guild.id}-247`);
if(!db || db === null)
{
this.client.data.set(`${guild.id}-247`,`disabled`)
}
else if(db === `disabled`)
{
this.client.data.delete(`${guild.id}-voice`);
this.client.data.delete(`${guild.id}-text`);
}
else if(db === `enabled`)
{
let voiceChannel = guild.channels.cache.get(await this.client.data.get(`${guild.id}-voice`));
if(!voiceChannel){
this.client.data.delete(`${guild.id}-voice`);
this.client.data.delete(`${guild.id}-text`);
this.client.data.set(`${guild.id}-247`,`disabled`);
}

try{ this.client.poru.createConnection({
guildId : guild.id,
textChannel : await this.client.data.get(`${guild.id}-text`),
voiceChannel : await this.client.data.get(`${guild.id}-voice`),
selfMute : false,
selfDeaf : true
});
} catch(e) { this.client.data.delete(`${guild.id}-text`); this.client.data.delete(`${guild.id}-voice`); this.client.data.set(`${guild.id}-247`,`disabled`) }
}
})
}
}
const avonReady = new AvonReady(client);
module.exports = AvonReady;
const AvonClientEvent = require("../../structures/Eventhandler");
const { Client, GatewayIntentBits, ActivityType } = require('discord.js');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
// .. more intents as needed
],
ws: { properties: { browser: 'Discord Android' } },
});

class AvonReady extends AvonClientEvent{
get name(){
return 'ready';
}
async run(){
console.log(`${this.client.user.username} is Online!`);
this.client.poru.init(this.client);

// Define the statuses, types, botStatuses, and URLs for full customization
let baseStatuses = [`${this.client.config.prefix}help`];
let statuses = baseStatuses.map(status => `${status}`);
let types = [ActivityType.Listening]; // You can add more types in this array as needed
let botStatuses = [ws: { properties: { browser: 'Discord Android' } }]; // You can add more bot statuses (like 'online', 'idle') in this array as needed
let streamURL = "https://twitch.tv/rutrruns"; // Stream URL

setInterval(() => {
let status = statuses[Math.floor(Math.random()*statuses.length)];
let type = types[Math.floor(Math.random() * types.length)];
let botStatus = botStatuses[Math.floor(Math.random() * botStatuses.length)];

this.client.user.setPresence({
activities: [
{
name: status,
type: type,
url: streamURL // Add the streaming URL
}
],
status: botStatus
});
}, 1000);

const guilds = this.client.guilds.cache.map(x => x.id);
guilds.forEach(async g => {
let guild = await this.client.guilds.fetch(g);
if(!guild) return;

let db = await this.client.data.get(`${guild.id}-247`);
if(!db || db === null)
{
this.client.data.set(`${guild.id}-247`,`disabled`)
}
else if(db === `disabled`)
{
this.client.data.delete(`${guild.id}-voice`);
this.client.data.delete(`${guild.id}-text`);
}
else if(db === `enabled`)
{
let voiceChannel = guild.channels.cache.get(await this.client.data.get(`${guild.id}-voice`));
if(!voiceChannel){
this.client.data.delete(`${guild.id}-voice`);
this.client.data.delete(`${guild.id}-text`);
this.client.data.set(`${guild.id}-247`,`disabled`);
}

try{ this.client.poru.createConnection({
guildId : guild.id,
textChannel : await this.client.data.get(`${guild.id}-text`),
voiceChannel : await this.client.data.get(`${guild.id}-voice`),
selfMute : false,
selfDeaf : true
});
} catch(e) { this.client.data.delete(`${guild.id}-text`); this.client.data.delete(`${guild.id}-voice`); this.client.data.set(`${guild.id}-247`,`disabled`) }
}
})
}
}
const avonReady = new AvonReady(client);
module.exports = AvonReady;
4 replies
DIAdiscord.js - Imagine a boo! 👻
Created by it is rude on 9/7/2023 in #djs-questions
/home/container/src/commands/music/Play.js:21 try } ^SyntaxError: Unexpected token '}'
I'm having difficulty pinpointing which bracket is causing a syntax error in my code. I've tried various fixes, but I can't seem to resolve the issue. Could you offer some assistance? Your help would be greatly appreciated.
9 replies
DIAdiscord.js - Imagine a boo! 👻
Created by it is rude on 9/5/2023 in #djs-questions
TypeError
I am currently on a discord music bot which has a 247 command and for some reason the bot just times out after few hours, so I am trying to code so that if by chance the bot does leave or gets disconnet it will attempt to rejoin the voice chat, but I am running to a TypeError: realVoiceChannel.join is not a function;
20 replies
DIAdiscord.js - Imagine a boo! 👻
Created by it is rude on 9/4/2022 in #djs-voice
Headers Timeout Error
TypeError: Cannot read properties of undefined (reading 'loadType')
at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Music\play.js:55:17)
at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
ee [HeadersTimeoutError]: Headers Timeout Error
at Timeout.ct [as _onTimeout] (C:\Users\rudei\lavamusic-2\node_modules\petitio\dist\index.js:4:5697)
at listOnTimeout (node:internal/timers:561:11)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_HEADERS_TIMEOUT'
}
TypeError: Cannot read properties of undefined (reading 'loadType')
at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Music\play.js:55:17)
at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
TypeError: Cannot read properties of undefined (reading 'loadType')
at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Music\play.js:55:17)
at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
ee [HeadersTimeoutError]: Headers Timeout Error
at Timeout.ct [as _onTimeout] (C:\Users\rudei\lavamusic-2\node_modules\petitio\dist\index.js:4:5697)
at listOnTimeout (node:internal/timers:561:11)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_HEADERS_TIMEOUT'
}
TypeError: Cannot read properties of undefined (reading 'loadType')
at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Music\play.js:55:17)
at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
7 replies