vivian <3
vivian <3
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/5/2023 in #djs-questions
waiting for interaction collector to finish before executing another function
gotcha
6 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/5/2023 in #djs-questions
waiting for interaction collector to finish before executing another function
i took a look at the documentation. seems to only return the first interaction. is there any way to return all the interactions or do i need to promisify messagecomponentcollector myself?
6 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/5/2023 in #djs-questions
waiting for interaction collector to finish before executing another function
there's no way around it? the for loop after the end event is meant to execute multiple more message comp collectors, each time relying on data from the previous to execute. i want to see if i can do this without recursion
6 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
i need myself some coffee 😅
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
perfect, thanks! i don't know how i didn't see that... the last time i had that error i fixed it the exact same way
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
(async function () {
// Load models

let model = await Promise.all([
tf.loadLayersModel(`file://./utils/models/1-180/model.json`),
tf.loadLayersModel(`file://./utils/models/181-360/model.json`),
tf.loadLayersModel(`file://./utils/models/361-540/model.json`),
tf.loadLayersModel(`file://./utils/models/541-720/model.json`),
tf.loadLayersModel(`file://./utils/models/721-898/model.json`),
tf.loadLayersModel(`file://./utils/models/899-fin/model.json`)
]);


/*
let model = await Promise.all([
tf.loadLayersModel(`file://./utils/models/1-272/model.json`),
tf.loadLayersModel(`file://./utils/models/273-544/model.json`),
tf.loadLayersModel(`file://./utils/models/545-816/model.json`),
tf.loadLayersModel(`file://./utils/models/817-1088_event/model.json`),
]);
*/

// Event Handler
const folders = ["admin", "legacy", "main"];
for (const val in folders) {
fs.readdir(`./events/${folders[val]}/`, async (err, files) => {
files.forEach(async (file) => {
const eventFunction = require(`./events/${folders[val]}/${file}`);
client.on(eventFunction.event, (...args) => eventFunction.run(...args, client, model));
});
});
}

// Command Handler
const subdir = ["a_suite", "ai", "misc", /*"moderation",*/ "pokemon", /*"pride",*/ "reps", "standard", "tags", "economy"];
const subdirs = subdir.values();
for (const dir of subdirs) {
const commandFiles = fs.readdirSync(`./commands/${dir}`).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${dir}/${file}`);
client.commands.set(command.data.name, command);
client.help.set(command.data.name, command.cmdInfo);
};
};

client.login(token);
})();


// Debug, Warn, and Unhandled Rejections
//client.on("debug", console.log)
client.on("warn", console.log);
process.on('unhandledRejection', error => console.error('Unhandled promise rejection:', error));
(async function () {
// Load models

let model = await Promise.all([
tf.loadLayersModel(`file://./utils/models/1-180/model.json`),
tf.loadLayersModel(`file://./utils/models/181-360/model.json`),
tf.loadLayersModel(`file://./utils/models/361-540/model.json`),
tf.loadLayersModel(`file://./utils/models/541-720/model.json`),
tf.loadLayersModel(`file://./utils/models/721-898/model.json`),
tf.loadLayersModel(`file://./utils/models/899-fin/model.json`)
]);


/*
let model = await Promise.all([
tf.loadLayersModel(`file://./utils/models/1-272/model.json`),
tf.loadLayersModel(`file://./utils/models/273-544/model.json`),
tf.loadLayersModel(`file://./utils/models/545-816/model.json`),
tf.loadLayersModel(`file://./utils/models/817-1088_event/model.json`),
]);
*/

// Event Handler
const folders = ["admin", "legacy", "main"];
for (const val in folders) {
fs.readdir(`./events/${folders[val]}/`, async (err, files) => {
files.forEach(async (file) => {
const eventFunction = require(`./events/${folders[val]}/${file}`);
client.on(eventFunction.event, (...args) => eventFunction.run(...args, client, model));
});
});
}

// Command Handler
const subdir = ["a_suite", "ai", "misc", /*"moderation",*/ "pokemon", /*"pride",*/ "reps", "standard", "tags", "economy"];
const subdirs = subdir.values();
for (const dir of subdirs) {
const commandFiles = fs.readdirSync(`./commands/${dir}`).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${dir}/${file}`);
client.commands.set(command.data.name, command);
client.help.set(command.data.name, command.cmdInfo);
};
};

client.login(token);
})();


// Debug, Warn, and Unhandled Rejections
//client.on("debug", console.log)
client.on("warn", console.log);
process.on('unhandledRejection', error => console.error('Unhandled promise rejection:', error));
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
const fs = require('fs');
const Discord = require('discord.js');
const db = require('quick.db');
const tf = require('@tensorflow/tfjs-node');
const { m, m2, pokeArr } = require('./utils/data/arrs.js'); // arrays of pokemon names
const { n } = require('./utils/functions.js'); // convenient helper functions
const { languages } = require('./utils/data/languages.js'); // list of languages and code-abbrevs for translate functions
const configFile = require('./config.json');
const token = configFile[profile];

const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.GuildMembers,
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.DirectMessages,
Discord.GatewayIntentBits.MessageContent
],
partials: [
Discord.Partials.Channel
],
restRequestTimeout: 60000,
});
const mod = new db.table("mod");
const eco = {
bot: new db.table("bot"),
guild: new db.table("guild"),
prefix: new db.table("prefix"),
reg: new db.table("reg"),
user: new db.table("user"),
seid: new db.table("seid"),
cd: new db.table("cd"),
eco: new db.table("eco"),
corp: new db.table("corp"),
server: new db.table("server"),
aegis: new db.table("aegis"),
market: new db.table("market")
};

// Export all needed values, dependencies, functions, and files
module.exports = { Discord, m, m2, pokeArr, n, languages, mod, eco };

// Initiate Collections
client.afk = new Discord.Collection();
client.commands = new Discord.Collection();
client.help = new Discord.Collection();
const fs = require('fs');
const Discord = require('discord.js');
const db = require('quick.db');
const tf = require('@tensorflow/tfjs-node');
const { m, m2, pokeArr } = require('./utils/data/arrs.js'); // arrays of pokemon names
const { n } = require('./utils/functions.js'); // convenient helper functions
const { languages } = require('./utils/data/languages.js'); // list of languages and code-abbrevs for translate functions
const configFile = require('./config.json');
const token = configFile[profile];

const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.GuildMembers,
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.DirectMessages,
Discord.GatewayIntentBits.MessageContent
],
partials: [
Discord.Partials.Channel
],
restRequestTimeout: 60000,
});
const mod = new db.table("mod");
const eco = {
bot: new db.table("bot"),
guild: new db.table("guild"),
prefix: new db.table("prefix"),
reg: new db.table("reg"),
user: new db.table("user"),
seid: new db.table("seid"),
cd: new db.table("cd"),
eco: new db.table("eco"),
corp: new db.table("corp"),
server: new db.table("server"),
aegis: new db.table("aegis"),
market: new db.table("market")
};

// Export all needed values, dependencies, functions, and files
module.exports = { Discord, m, m2, pokeArr, n, languages, mod, eco };

// Initiate Collections
client.afk = new Discord.Collection();
client.commands = new Discord.Collection();
client.help = new Discord.Collection();
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
client is used to log into another bot, not the one being sharded. the token used with client automatically sends a status update to the bot's official support server
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
const { ShardingManager } = require('discord.js');
const configFile = require('./config.json');
const token = configFile[`token`];
const innerToken = configFile[`protocol2`];
const { eco } = require('./index.js');
const Discord = require('discord.js');
const client = new Discord.Client({ intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildMessages, Discord.GatewayIntentBits.DirectMessages, Discord.GatewayIntentBits.MessageContent],
partials: [Discord.Partials.Channel], });

const manager = new ShardingManager('./index.js', { token: `${token}` });
const shardCount = 45;

const main = async () => {
await client.login(innerToken);
let msg;

manager.on('shardCreate', async shard => {
console.log(`Launched shard ${shard.id}`)
await eco.bot.set(`shard`, `${shard.id}`)



const guild = client.guilds.cache.get(`870331544911372308`);
const chan = guild.channels.cache.get(`870526084825882715`);
if (shard.id == 1) {
msg = await chan.send(`:yellow_circle: **Automated Status Update**\n\nBot is currently restarting.\n(This message will be automatically edited when bot is online)`);
await msg.crosspost();
};
if (shard.id == shardCount - 1) {
await msg.edit(`:green_circle: **Automated Status Update**\n\nBot is online on all shards. (This message is automatic)`);
await client.destroy();
};

});

}
main();

// spawn shards
manager.spawn({ amount: shardCount, delay: 10000, timeout: 1 * 1000 * 60 });
const { ShardingManager } = require('discord.js');
const configFile = require('./config.json');
const token = configFile[`token`];
const innerToken = configFile[`protocol2`];
const { eco } = require('./index.js');
const Discord = require('discord.js');
const client = new Discord.Client({ intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildMessages, Discord.GatewayIntentBits.DirectMessages, Discord.GatewayIntentBits.MessageContent],
partials: [Discord.Partials.Channel], });

const manager = new ShardingManager('./index.js', { token: `${token}` });
const shardCount = 45;

const main = async () => {
await client.login(innerToken);
let msg;

manager.on('shardCreate', async shard => {
console.log(`Launched shard ${shard.id}`)
await eco.bot.set(`shard`, `${shard.id}`)



const guild = client.guilds.cache.get(`870331544911372308`);
const chan = guild.channels.cache.get(`870526084825882715`);
if (shard.id == 1) {
msg = await chan.send(`:yellow_circle: **Automated Status Update**\n\nBot is currently restarting.\n(This message will be automatically edited when bot is online)`);
await msg.crosspost();
};
if (shard.id == shardCount - 1) {
await msg.edit(`:green_circle: **Automated Status Update**\n\nBot is online on all shards. (This message is automatic)`);
await client.destroy();
};

});

}
main();

// spawn shards
manager.spawn({ amount: shardCount, delay: 10000, timeout: 1 * 1000 * 60 });
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 6/1/2023 in #djs-questions
'sharding is required' error, with sharding
Unhandled promise rejection: Error: Sharding is required
at WebSocketShard.onClose (D:\Discord Bot @13\node_modules\@discordjs\ws\dist\index.js:1057:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (D:\Discord Bot @13\node_modules\ws\lib\websocket.js:258:10)
at TLSSocket.socketOnClose (D:\Discord Bot @13\node_modules\ws\lib\websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:757:14
at TCP.done (node:_tls_wrap:584:7)
Unhandled promise rejection: Error: Sharding is required
at WebSocketShard.onClose (D:\Discord Bot @13\node_modules\@discordjs\ws\dist\index.js:1057:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (D:\Discord Bot @13\node_modules\ws\lib\websocket.js:258:10)
at TLSSocket.socketOnClose (D:\Discord Bot @13\node_modules\ws\lib\websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:757:14
at TCP.done (node:_tls_wrap:584:7)
9 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 4/24/2023 in #djs-questions
checking server boosters without roles
@Jô 🌈 🦄 thanks. any way to check multiple boosts?
6 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 1/10/2023 in #djs-questions
transfer ownership from bot to user
perfect thank you
4 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
dingdingding perfect. thanks a bunch for the clarification
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
never noticed it, only use setActivity(). oh well. how long does it take for setActivity() to go away though? (the status doesn't last, and i just want to know how long it stays for)
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
most class and method params only take objects now (at least the ones i use)
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
Everything’s gotta be an object now lol
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
RIP string literal params
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
Huh alright thanks
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
If you’re talking about adding it via <client>.user.setActivity(), that’s what I already do
18 replies
DIAdiscord.js - Imagine an app
Created by vivian <3 on 12/7/2022 in #djs-questions
How often should client.user.setActivity() be used?
Been like that for a while
18 replies