#development
1 messages · Page 1245 of 1
same way u sharded the
1- Having a sharded bot that some of it's shards may not be available or has emited their death event, there is no way
2- If you want, once the shards all get ready, send the guild objects all to the second instance by an api, but this ain't no efficient because the data is never updated after a shard is dead
3- Using the official discord api to fetch the guild info from a invite might help, but all shards across all the guilds has to make an invite and send it to some kind of api, but this is obviously api abuse, then use this to fetch anything you need
to clarify im using Djs and Express
how do you do it
My only solution for this is to just fetch the guild info from the official discord api, through invites
there's no way to have a discord.js client without events but rather access to all guilds
?
wdym through invites
what
d.js doesn't have rest capabilities alone
you need to go through the gateway
only event needed is the ready event, and yes, you can fetch a guild info from an invite
Iterate through the guilds and create invites?
no....

thats a violation of TOS and error prone
that is extremely fucking grey area
get the guild from the rest and fetch the info from that then
bruh
simpul
no
what
that’s on the wrong side of the line I’d say
what r u tryna do, @dusk vault
No violation intended, this can't violate anything
read my question @digital ibex
why this dont work?
channels.forEach(ch => {
ch.updateOverwrite(id, {
SEND_MESSAGES: args[1]
}).catch(error => { });
});```
It's just API abuse of creating invites over and over
@misty sigil you were saying I can run an express server on multiple processes
no
why cant u?
svice
anyway so whats a fast legitimate and reasonable method that wont break then
um
He's trying to fetch values and roles ids through shards by broadcast but sometimes fails because not all shards are available at all times
then its a 500 error
option 1 - if it fails, display an error message in the dashboard and ask them to retry or auto-retry later
option 2 - fetch it from the rest api
so the server responding with an internal server error is the solution
no, send an error page or indicate to the user that theres been an error
or tim's method
whatever u want
what's the best website to code a bot
@earnest phoenix bots are not coded on sites
Hello I am trying to link to 0 permissions for my bot it was for a server I set the bot parameters in Developer portal but that but only the creator of the bot can add The bot and I can't help you.
I know it's a sucker but there is a problem I don't know why its not want to work and that it does that ;-;
turn on “Public bot”

I have to check it; -;
Not judge 😭 😭
we literally arent judging you
are we judging? this is a development channel, we never judge someone.
Okey
what's the problem?
@earnest phoenix Try this https://discord.com/oauth2/authorize?client_id=CLIENT_ID_HERE&permissions=08&scope=bot
Where it says CLIENT_ID_HERE put your bot id
you can look at the link
accidental ads™️
are you logged in?
Yes
i see ur problem
accidental ads™️
@misty sigil what's this ._.
Ouffff thankssss
The link worked perfectly for me
np
Lol
@opal plank
i connected mongodb
but when i send ?start work after restarted bot not working
whenever i try to replace the prefix value it does this
Whatever you're parsing and trying to write to the file is the issue.
Although, I recommend you use an actual database rather than JSON.
whats the difference
Databases like SQLite and Postgres are made for the purpose of holding data. JSON is meant for holding static data.
json corrupts easily
ok
is there a better way of doing client.guilds.cache.size
like
getting an accurate number
sorry DMs off
i send u add
im gonna sleep in like 2 mins now anyway
my embed in my command manger isnt working it works if i just print normal text but if i run exports.run = (bot, message, Discord) => { const embed = new Discord.RichEmbed() .setTitle("Hello!") .setDescription(`My name is ${bot.user}, and I'm bot!`) message.channel.sendMessage(embed); } it doesnt work no error or anything
i have a gti repo https://github.com/juls0730/Echo-Bot
how do i solve this error?
[ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
fetch(ulke).then(results => results.json()).then(body => {
if(body.message === `Country not found or doesn't have any cases`) return message.channel.send(`**${message.author.tag}**: Ülke bulunamadı.`);
I use it, but when I use Turkish characters, it gives an error in the console.
how can I make node-fetch understand Turkish characters?
Ü U

example: Ö, Ğ, Ş, Ç
my embed in my command manger isnt working it works if i just print normal text but if i run
const embed = new Discord.RichEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.sendMessage(embed);
}```
it doesnt work no error or anything
i have a git repo https://github.com/juls0730/Echo-Bot
İ
const { MessageEmbed, MessageAttachment } = require('discord.js')
exports.run = (bot, message) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
use this
Discord.js version 12.3.1. discord.richembed has been removed in this release.
and sendMessage
i changed it to this ```const { MessageEmbed, MessageAttachment } = require('discord.js');
exports.run = (bot, message, Discord) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(My name is ${bot.user}, and I'm bot!)
message.channel.send(embed);
};``` (yes i tried the original) and neither work
const {MessageEmbed, MessageAttachment} = require ('discord.js') overwrite module.export
this? ```const { MessageEmbed, MessageAttachment } = require('discord.js')
module.export = (bot, message, Discord) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(My name is ${bot.user}, and I'm bot!)
message.channel.send(embed);
};```
no
can you send the exact version of the command
did you do
const { MessageEmbed, MessageAttachment } = require('discord.js')
module.exports = {
name: 'test',
description: 'test'
}
exports.run = (bot, message) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
Discord.MessageEmbed()
at Client.<anonymous> (/app/index.js:33:34)
at Client.emit (events.js:196:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:196:13)
at Receiver.receiverOnMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/websocket.js:797:20)```
module.exports = {
name: 'test',
description: 'test'
}
exports.execute = (bot, message, execute) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
``` ive adjusted to this im getting ```TypeError: client.commands.get(...).execute is not a function
at Client.<anonymous> (/app/index.js:33:34)
at Client.emit (events.js:196:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:196:13)
at Receiver.receiverOnMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/websocket.js:797:20)``` @thick gull
@restive notch execute should go inside module.exports
I need some help catching the shard count, How can I get the shard count? I did ${client.shard.count} but says client is not defined
Ah ok I'ma try
In the index.js?
Cloud Music
can you ping it?
Nope
why?
Doesnt show it
688370250059874338
Well not really
did you make the bot?
do you have a command handler?
also i don't think you can define condt lol
const*
like
const const = new discord.Client()
Commandhandler yeah
bruh
Command handler*
maybe define client in the file the command is in smh
Looks like you copied someones code
I didn't copy but okii
Yeah but then again, I do have my developers and they usually work on it and I worked on other stuff like v11 so idk
that's a terrible excuse
defining stuff hasd been the same in v11 and v12
Discord doesn't make the defining studd node does
NVM I got it working
Fixed it, I just needed to add message to the client.shard.count, now it works fine
i think you mean
const count = guild.members.cache.filter(m => m.roles.cache.has('700534730629840897')).size
instead of
const count = guild.members.cache.filter(m => m.roles.cache.has('700534730629840897').size)
m.roles.cache.has('700534730629840897').size doesn't make any sense since .has returns a boolean, so you're checking for a size property on a boolean?
are you trying to do a per guild??
you can't have different status for each guild
oh
client.guilds.cache.get('your-server-id')
thats your <Guild>
hm
move the parenthesis
Every 5 min
...m.roles.cache.has('700534730629840897').size)
...m.roles.cache.has('700534730629840897')).size```
I believe change it to message.author
so you get (ctx).message.author.roles.cache.has(num)).size
that gives you a <User> instance, which doesn't have any roles
you need to use message.memver
member

uhh
weird ok
I'd check docs but my phone is about to die
well huh
i remember that the member type always has roles
there should be a callback function
guild.members.filter(guild.members.roles.cache.has('700534730629840897'))
also a GuildMemberManager has no roles property?
If I just wanted to do a reaction roles bot, would I put all of the reaction roles code in my main folder? And if so, where in it?
This is a single-server bot and I don't plan to use it anywhere else
check channel to see if it’s NSFW
^
If(!message.channel.nsfw) // ..
when i run ```const { MessageEmbed, MessageAttachment } = require('discord.js')
module.exports = {
name: 'test',
description: 'test'
}
exports.execute = (bot, message) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(My name is ${bot.user}, and I'm bot!)
message.channel.send(embed)
}``` and then do e!test then it print this is console
at Client.<anonymous> (/app/index.js:33:34)
at Client.emit (events.js:196:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:196:13)
at Receiver.receiverOnMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/websocket.js:797:20)
If(!message.channel.nsfw) // ..
@earnest phoenix
@earnest phoenix discordjs?
Its fine
well
next time you should check the docs
Its hard
it’ll help
We alr saw that
sry
Its fine..
execute is not a function
There is a problem with your command handler
put it in the module.exports
wdym
Yeah
so just put exports.run (because it need to be .run) in module.exports
I’m not sure how your thing is
Send your handler..
index.js:
const Discord = require("discord.js");
const { prefix, token } = require("./config.json");
const client = new Discord.Client();
client.commands = new Discord.Collection();
const commandFiles = fs
.readdirSync("./commands")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.once("ready", () => {
console.log("Ready!");
});
client.on("message", message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
try {
client.commands.get(command).execute(message, args);
} catch (error) {
console.error(error);
message.reply("there was an error trying to execute that command!");
}
});
client.login(token);
put execute(message, args) {code here} in the exports
iirc that’s how it should be
my ping.js rn is ```const { MessageEmbed, MessageAttachment } = require('discord.js')
module.exports = {
name: 'test',
description: 'test'
}
exports.run = (bot, message) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(My name is ${bot.user}, and I'm bot!)
message.channel.send(embed)
}
You can check the djs guide they have a handler tutorial 
No
i looked at that nothing about embeds in command handler
Your issue isn’t embeds?
my ping.js rn is ```const { MessageEmbed, MessageAttachment } = require('discord.js')
module.exports = {
name: 'test',
description: 'test'
exports.run = (bot, message) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(My name is ${bot.user}, and I'm bot!)
message.channel.send(embed)
}
}```
yeah it’s inside
Wait wtf
what
The function your calling is execute

Yeah that too
What
module.exports = {
name: 'test',
description: 'test'
exports.execute = (bot, message) => {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
}```
that says SyntaxError: Unexpected identifier at Module._compile (internal/modules/cjs/loader.js:703:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Module.require (internal/modules/cjs/loader.js:666:19) at require (internal/modules/cjs/helpers.js:16:16) at Object.<anonymous> (/app/index.js:13:19) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) and it says exports.execute is an unexpected token
Huh
"Parsing Error: Unexpected token exports"
I don’t know mate.
thats what my ide says when i hover
import fetch from "node-fetch";
fetch(process.env.ANTI_DUPE!)
.then(res => res.json())
.then(run => {
if (run) import("./main");
});``` same code as in another repl
this one doesnt work but the other one does
Why exports.execute
module.exports = {
name: 'test',
description: 'test'
execute(bot, message) {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
}```
both have installed node-fetch
this is my current code now
Just export a function called execute in the module.exports
Just export a function called
executein themodule.exports
i just did that
module.exports = {
name: 'test',
description: 'test'
execute(bot, message) {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
}```
Shouldnt => negate that error?
module.exports = {
name: 'test',
description: 'test' // <-- missing comma
execute(bot, message) {```
=> should literally state that run and res have an any type
oooooooooooooooooooooooohhhhhhhhhh
im dumb
yeah it doesnt say unexpected now
but now it says (when i do e!test)
at Object.execute (/app/commands/ping.js:11:25)
at Client.<anonymous> (/app/index.js:33:34)
at Client.emit (events.js:196:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:196:13)```
@opaque hawk .then(res => { res.json() })
@restive notch read the error and troubleshoot
@plush magnet same error
Then it's a package issue with typescript
Do what the errors says you might need to install types for it if they've done so
What do you mean it sends the picture and message too
Is that not what you want it to do
So what you mean to say is your command is working by saying its the wrong channel but still sending the image
Are you returning when the bot checks that its an incorrect channel
Well firstly your logic there is wrong
Read that if statement to me
Thats fine but read the if statement the way the bot would read it
message.channel.nsfw is aboolean
true or false
if its nsfw it's true
by adding the ! your checking if its NOT true
like
if (!message.channel.nsfw)
becomes
if (not nsfw)
if (message.author.bot) would be true for bots
if (!message.author.bot) would be false for bots

i have ```const { MessageEmbed, MessageAttachment } = require('discord.js')
module.exports = {
name: 'test',
description: 'test',
execute(bot, message, args) {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
}```
logs: TypeError: Cannot read property 'send' of undefined at Object.execute (/app/commands/ping.js:11:25) at Client.<anonymous> (/app/index.js:33:34) at Client.emit (events.js:196:13) at MessageCreateAction.handle (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14) at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31) at WebSocketShard.onPacket (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22) at WebSocketShard.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10) at WebSocket.onMessage (/rbd/pnpm-volume/3267f550-6812-430b-91fc-4ba423438cb0/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/event-target.js:125:16) at WebSocket.emit (events.js:196:13)
yeah i just have it as that to test
e!test works though
athough gives that log i just gave
Can you show the ping command?
module.exports = {
name: 'test',
description: 'test',
execute(bot, message, args) {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
}```
its angry about ```const { MessageEmbed, MessageAttachment } = require('discord.js')
module.exports = {
name: 'test',
description: 'test',
execute(bot, message, args) {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
^
}
}```
that error means you're calling the function wrong
ie, where you use commands.get().execute()
then what do i use?
show what you did
module.exports = {
name: 'test',
description: 'test',
execute(bot, message, args) {
const embed = new MessageEmbed()
.setTitle("Hello!")
.setDescription(`My name is ${bot.user}, and I'm bot!`)
message.channel.send(embed)
}
}```
message.channel.send(embed)
``try {
client.commands.get(command).execute(message, args);
} catch (error) {
console.error(error);
message.reply("there was an error trying to execute that command!");
}
});
client.login(token);
'bot' is not defined
you dont know how functions work do you
not really just how to get ping and not much after that
functions take arguments by order, not by name
Dot dot dot, I'd suggest reading about basic computer science first
Like, making bots isn't an easy task for a starting project
function func(1, 2, 3)
-> log 1, 2, 3
func(1, 3, 2)
-> 1, 3, 2
Oh my
for example, execute() {} this is where you create the function. .execute() this is where you call the function.
execute(bot,message) you create the function and tell it to expect 2 arguments, and give them the name bot and message
.execute(message) this is where you call the function, you give it message as the first argument
so inside your function, the 1st argument is bot and you gave it message as the first when you used it.
therefore inside your function, what you named as bot is actually a message. and what you named as message is actually nothing. thats why your message doesnt work inside the function
@restive notch
i coppied and pasted the ('bot, message, args') from the execute and bot is still undefined
function someExample(a, b) {
console.log("Result is " + (a + b));
}
someExample(1, 2);
output -> Result is 3
i didnt
then why is it there
because its in the ping.js
why is it there
i dnot think i use it tho
Did you, by any chance, copypasted that code from somewhere?
Huh
Oh my
Just......remember not to copypaste the entire code as is, take your time to understand it first
yeah i know
99.9% the code you find on the internet won't work in ur project as is
i understand how the code works and what each par does
yeah thats why im learning to make the code by myself
thats why im mostly taking the code from the docs so i can learn what they do
const filter = (m) => m.author.id === message.author.id;
message.channel.send(embed).then(() => {
message.channel.awaitMessages(filter, { max: 1, time: 10000, errors: ['time'] })
.then(collected => {
console.log(filter.content)
})
.catch(err => {
console.log(err)
message.channel.send('Time out.');
})
})```
how do i get the um message sent by the user?
unprefexed commands will get your bot muted
huh what
< @ 264445053596991498 > help
lol
out of 5 servers no one has yet been able to help me
just how stupid am i lmao
does it log anything?
this is not valid
you get the content through collected, not filter
collected is a collection of received messages. since you only collected one, you can use collected.first() to get the first message the user sent
you can get the content afterwards (collected.first().content)
@stark abyss
That’s low key gay no mf told me about that
I spent hours asking for help not realizing how it worked
And they all kept on giving me docs
And now that I close all the tabs I get it

Aight thx
hey im python so when i do python main.py it replies with Traceback (most recent call last): File "main.py", line 352, in <module> main() File "main.py", line 348, in main DiscordBot().run(config.DISCORD_TOKEN) File "main.py", line 18, in __init__ allData = data.loadJSON(data.DATABASE_FILENAME) File "/home/container/data.py", line 92, in loadJSON return json.load(f) File "/usr/local/lib/python3.8/json/__init__.py", line 293, in load return loads(fp.read(), File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
maybe the json file is corrupted because of how many times it's trying to be modified?
yes
your json file has syntax error
hey
hm
is this wrong?
channel.startTyping();
setTimeout(()=>{
channel.send("test").then((message)=>{
channel.stopTyping();
});
}, 5000)```
I want to make a bot that shows "typing"
I mean a command*
and send test and stop after 5 seconds?
yeah
it should like show for 5 seconds that is typing
and then send the message
🤔
node
in the database.json
@indigo flax Are you using JSON to store data that is continuously being updated?
is there a way to get the largest value from an array? ex: ```js
let arrayThingyForDBL = [5,
10,
306,
52
]
is there a way to get the largest value from an array?
@karmic compass Yes, sorting for arrays is very common
you can use Math.max with the spread operator
And there is many ways to do it. Some built into JS. Or you can apply common algorithms used in comp sci
thank you epic gamers
thank you epic gamers
@karmic compass https://www.youtube.com/watch?v=kPRA0W1kECg if you're going with the latter (warning: flashing red color)
Visualization and "audibilization" of 15 Sorting Algorithms in 6 Minutes.
Sorts random shuffles of integers, with both speed and the number of items adapted to each algorithm's complexity.
The algorithms are: selection sort, insertion sort, quick sort, merge sort, heap sort, r...
star wars
"bogo sort is like the kahoot music"
Oh
it’s an alt
you need to fetch from the guild#ownerID
@delicate shore i like how your bot is in 1k but you still dont know how to fix stuff
@earnest phoenix I am his left hand man
@pure lion i like how you didnt teach him
yeet
i have a component called Alert and i want to know how to pass it props
tried<Alert warning="This is the content" />
but{{ warning }}does nothing
@sick cloud figured it out?
@delicate shore use ${message.guild.owner.user.tag} or ${message.guild.ownerID}
I saw you asking that in Nuxt's server
for discord.js v12
@steel heath yea i got it ty <3
alright
Nuxt is complicated
how?
Yes thats my question

haha no
joined server msg.guild.JoinedAt?
for the bot, yes
@pale vessel ok
and member
@main chasm use member.joinedAt
so basically
thank u
if (msg === `${prefix}EMBEDTEST`) {
message.channel.send("normal text");
const newEmbed = new Discord.MessageEmbed()
.setColor("#f4e542")
.setTitle("Current Prefix set to:")
.setDescription("hi")
.addField("title", "body")
message.channel.send(newEmbed);
}
``` the normal text sends but not the embed
duration: songInfo.duration.toString(),
i want change to hours how ?
@silver lintel message change to msg
which message?
msg is just let msg = message.content.toUpperCase();
hm
Just to test: do {embed: newEmbed} instead of just newEmbed
Does your bot actually have permission to "EMBED_LINKS"?
How can I get this working properly?
@raven urchin lmfao imagine managing 4 servers per shard
Yeah, ion know how to fix that
I put in 1000 for the servercount and just throws an error
Even if I put the servercount users, undefined
use google?
use google?
@fluid basin claps
well if you can't understand basic terminology and can't be bothered to, then stop asking
well if you can't understand basic terminology and can't be bothered to, then stop asking
@fluid basin .........
bot now can only get Verfied ✅?
use google?
@fluid basin i responded to it...
without badge?
anyone know how to do the command if one his dm closed the bot will reply help command in the channel
@flint yew check if the user has dms open
i want when one dm closed
i use comando
if their DMs are closed, user.send() will throw an error so,js user.send(data).catch(() => message.channel.send("Couldn't DM, here's the commands"));
k
Two questions @raven urchin
- Why the fuck are you sharding at 4 servers a shard
- Why the fuck are you sharding at 4 servers a shard
1,000 servers a shard, 4 shards a cluster is whats widely accepted as acceptable/normal, you on the other hand.. What in Gods name
I'm still considerably drunk so sorry if I'm misunderstanding you, but I seriously hope I am, otherwise.. Dear God.
It's just me testing it out and making sure I get it working first
Then disabling them until I reach 2.5k servers
What language?
D.js
I'm sowwy
ey
python is gae
Lol

is there a way to get the latency of ur vps using os-utils?
python is garbage
Ping google or smth
jk
It is garbage
true
guys
my bot, when user invited my bot send msg to owner server not a problem from approval ?
who did send a message? And to who exactly?
i dont think its a problem, but i'd remove that feature
bots who dm welcome messages and help commands are annoying
@midnight blaze to owner server
@raven urchin ur bot is copy of calypso. U only added the music and not working
that is a snitch move 👀 jk
@main chasm I would listen to Tim. Do not dm people. It is annoying most of the time
what are you whating about? O:
wait
about what?
Ur name
I said he should deactivate the dm function he has in his bot
ahh
xD
davon is German
Ah
@midnight blaze when a person invited my bot just send a msg to owner problem to approved bot in top.gg ?
you dont get, just stop. I can assure you most people dislike being dmd by a bot
when a bot sends a message to a user without the user interacting with the bot, it is a issue @main chasm
so yes, i'd recommend removing that feature
thats even worse, when the owner doesnt know about the bot
just remove it and it'll be good
now i remove code ?
It even don't help. Remove it. Good
ok
Like rythm
now what if that channel happens to be the rules channel?
hMMM
I'd let my bot just shut up about it
like yay the bot got added and so?
I was want to do that. But it send it to the general.chat so I stopped
Bcz like u will delete it if it send to the welcome channel
U can mansion ur bot and he will send u the prefix and that things
U can do that its good
now i remove my code when owner invited my bot and my bot send a msg to owner ? right
It will not if u deleted
ok
Cloud music
Smfh
@raven urchin old one was have other things that why nvm
Is it possible to make the bot by using only javascript? cuz i am learning python rn and thinking to quit if js can only do that
wdym? You can’t make a bot with multiple languages, I mean technically you can, but it wouldn’t be okay at all
wdym? You can’t make a bot with multiple languages, I mean technically you can, but it wouldn’t be okay at all
@flat pelican hmm... that's what i got as prob... i thought it would take like python,js... to make it then just saw discord.js and that makes me tensed...and i am now thinking of quitting python and start learning js but if leave python rn... it would be a great loss...
swear words are allowed here lmao
That’s fine as long as you’re not being extremely offensive and/or rude
I don’t see how you would use html on a bot
i mean they dont have a role or badge
hmmMMMMMMMMmm
@earnest phoenix see the status again...lol
Imagine you are using a channel, although it is intended for other topics.
Imagine you are using a channel, although it is intended for other topics.
@regal saddle we are talking about development
maybe
imagine discord.html
@earnest phoenix discord.css
Yup, sending images of people’s dc status and talk about it.
imagine
Aah wait
Someone please tell what's wrong in this code
Ping me if somebody knows the syntax error in it
@sick fable YOU REVEALED TOKEN
DELETE MESSAGE
QUICK
AND RESET BOT TOKEN
@sick fable @sick fable @sick fable @sick fable @sick fable
Smh
Man I really wanted that token
thought clyde would've caught that
AND RESET BOT TOKEN
@earnest phoenix bro I already knew about it
why would you send token anyways
It's not full tho

Regenerated the token😂


Can you make a GUI application using node.js native modules like you can do in Java (Minecraft uses the native javaw.exe thingy)?
@quartz kindle GIMME A PIZZA WITH EXTRA CHEESE
wut

What would you recommend to use when building a music function for your bot?
anything other than ytdl
small bots run fine with ytdl
but the problem is the youtube api ratelimits
you'll hit your daily quota in no time
prob worth checking spotify api for that
ah, if its a bot for 1 specific server?
then it should be fine using that
ok, cause ive tried using it but i keep running into the issue of opus
opus deprecated for js iirc
so what would you recommend to use for a tiny bot thats for 1 specific server to be able to play music? cause ive also tried soundcloud but their api thingy is currently closed
oh yeah they have discordjs/opus
but indeed the original got depreated
you should be fine running ytdl
how do i run ytdl? Cause every time i try it keeps asking for opus
const embedsinfo = require('../vars/embedsinfo.json');
const onoff = require('../vars/onoff.json');
const roles = require('../vars/roles.json');
const { prefix, token } = require('../vars/tokenprefix.json');
const Discord = require('discord.js');
const fs = require('fs');
const ytdl = require('ytdl-core');
const MongoClient = require('mongodb').MongoClient;
const url = "mongodb+srv://ArgentStudio:bp7EKNOEnOmrm4tJ@cluster0.tyfl9.mongodb.net/ArgentStudios?retryWrites=true&w=majority";
module.exports = {
name: 'music',
description: 'Clears messages',
guildOnly: true,
cooldown: 0,
aliases: [],
execute(message, args, client) {
if(message.member.roles.cache.has('751477774253949039')){
if (message.channel.type === 'dm') return;
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) {
return message.reply('please join a voice channel first!');
}
voiceChannel.join().then(connection => {
const stream = ytdl(args[0], { filter: 'audioonly' });
const dispatcher = connection.play(stream);
dispatcher.on('finish', () => voiceChannel.leave());
});
};
}
};
this is my current extremely basic system
check this if you unsure on how to make a music bot
k
yeah, im just stuborn and now that ive set my mind to adding music functions i cant stop
hey this is my code, ive made it play and disconect, how would i make it loop?
if (message.content.includes(prefix+"disc calm")){
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
const dispatcher = connection.play('./audio/calm.mp3');
dispatcher.on('start', () => {});
dispatcher.on('error', console.error);
message.channel.send('Playing: Calm')
}
else(message.channel.send('you must be in a voice channel'))
}
how would i make a command !loop? for it to loop the current song(i have 13 song mp3s) im in JS
One message removed from a suspended account.
how do i do that?
One message removed from a suspended account.
use `
One message removed from a suspended account.
One message removed from a suspended account.
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
const dispatcher = connection.play('./audio/calm.mp3');
dispatcher.on('start', () => {});
dispatcher.on('error', console.error);
message.channel.send('Playing: Calm')
}
else(message.channel.send('you must be in a voice channel'))
}``` how would i make it loop the current mp3?
oh
```js
code```
like this
replace code with your code
im seriously thinking about flipping my big monitor sideways for coding

and keep the other 2 normal
that would be dope
if (message.content.includes(prefix+"disc calm")){
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
const dispatcher = connection.play('./audio/calm.mp3');
dispatcher.on('start', () => {});
dispatcher.on('error', console.error);
message.channel.send('Playing: Calm')
}
else(message.channel.send('you must be in a voice channel'))
}``` ok now can someone help figure out how to make it loop the current mp3 its playing?
this is my janky code for a minecraft bot to play music file
theres a third one but thats not attached rn
k
I've been searching around and looked on the discord.py rewrite api doc and I can't seem to find and understand how to define roles as certain things such as moderator roles, etc which gives them access to certain commands. I know how to make the commands role only but I just don't know how to define said roles. Any help will be great, thanks!
That's the API
no
api doc*
it's literally link to discord.py's documentation
just put on the search bar "add roles" and it should be able to find it (inside of the searchbar located in left)
I don't want to add roles to people...
wait i misunderstood
so yea, look at the front page something like "restrict commands"
nothing
thats not the exact, so you have to use time to find it there
ik i have been searching around for a while and i had time today where i was working on the bot and i thought to finally ask
Someone please tell the error

import asyncio
from discord.ext import commands
client = commands.Bot(command_prefix = '?')
@client.event
async def on_ready():
print('Bot is ready for use Sir! ')
@client.event
async def on_member_join(member):
print(f"{member} has joined the server. Enjoy your time in this server. Make sure you read the rules of the server! and you are good to go :slightly_smile:")
@client.event
async def on_member_leave(member):
await ctx.send(f"{member} Adios amigo! We hope that you spent your good time in this server.")
@client.command(aliases=['8Ball' , 'test'])
async def _8Ball(ctx, *, question):
responses = ['Yes' , 'No']
await ctx.send( f'Question: {question}\nAnswer: {random.choice(responses)}')
client.run('Your daddy')```
Tell please
What?
I've just run it and it's an indent error
be patient
Yaa bro. Help me
import discord
import asyncio
from discord.ext import commands
client = commands.Bot(command_prefix = '?')
@client.event
async def on_ready():
print('Bot is ready for use Sir! ')
@client.event
async def on_member_join(member):
print(f"{member} has joined the server. Enjoy your time in this server. Make sure you read the rules of the server! and you are good to go :slightly_smile:")
@client.event
async def on_member_leave(member):
await ctx.send(f"{member} Adios amigo! We hope that you spent your good time in this server.")
@client.command(aliases=['8Ball' , 'test'])
async def _8Ball(ctx, *, question):
responses = ['Yes' , 'No']
await ctx.send( f'Question: {question}\nAnswer: {random.choice(responses)}')
client.run('Your daddy')
That's the fixed version
dont just give them code to copy paste
explain to them whats wrong and show them how to fix it themselves
I did
I told him he had an indent error
and you can see where the error is by looking at the code
That's the fixed version
@heavy marsh thank you so so much bro
np
oh
ok maybe its not so obvious
Your code:
@client.command(aliases=['8Ball' , 'test'])
async def _8Ball(ctx, *, question):
responses = ['Yes' , 'No']
await ctx.send( f'Question: {question}\nAnswer: {random.choice(responses)}')
Corrected code:
@client.command(aliases=['8Ball' , 'test'])
async def _8Ball(ctx, *, question):
responses = ['Yes' , 'No']
await ctx.send( f'Question: {question}\nAnswer: {random.choice(responses)}')
The gap between the responses line and the send line
[Error: EROFS: read-only file system, open '../config.json'] {
how could i fix this
😄
3
how to use MessageCollectorextends on an embed you send
so I can use it in my code and make various edits
this is djs
i wonder
can i do this in postgres?
CHECK (string = 'live' OR string = '' OR string = 'offline')
to add constraints?
the || operator is "OR"
which is what i've used
it basically says "If this string is empty or undefined, do the next" and repeat
im aware
so what is your goal here
im asking if that constraint is valid
idk if i'd need multiple CHECK or i can nest them all into one constraint
oh idk abt ts
uwotm8
wat
what does the duration look like
what do you want to make exactly
minutes and hours
i'm assuming they want to add time to an existing duration..............................?
or what exactly
basically the string needs to be either one of those @earnest phoenix
'live' '' 'offline'
yes
anything other than those should be error'd by the constraint
coherent english would also help
@opal plank yes I that is possible with postgres iirc
@pale vessel 
odd
from what im seeing you arent suppose to use checks for this
you make a type it seems
enum types
How do I get the starting channel in a guild?
first() ?
should return a collection
though it'll likely be bad
iirc collections are set in order
cuz the first channel is usually a category
so you might wanna loop for and then escape when you find the one you want
@tidal marlin
'starting channel' where people get like invited to
For example, a place where discord says that someone new joined
I used systemChannel for it
two separate things
but like bot doesn't like this
invite points to a channel thats specified on invite
system logs are set by the guild owner on any channel, regardless of your permission to see it
they are separate
Huh
you may wanna look for 'general' or check @ everyone permission in the loop form that i said
I just want the bot to say message in a channel that announces new users
that's systemChannel
then make the guild owner set a channel beforehand
you're already using it
yes
where is it?

!announcement #development
do something like that
to set the channel the user/admin wants to use
why would you have it hooked on a general chat? discord already displays it, whats the point of your bot saying the same thing twice?
then find a backup channel
who said you need DB requets?
you should only need DB requests on startup
if you doing anything else differently you doing it wrong
wdym start up?
DB is persistent storage
yeah?
Memory is for quick access
you dont pull fromyour database, grab all your database and dump it on memory on startup
same for prefixes and such
That's gonna take a lot of memory tho
not really
map(guildid, {prefix, announcementCHannel})
there
you are dumping the WHOLE database
require what you need to be accessed constantly
Don't think about even using it
databases arent used to be accessed too often
use redis if you need in memory database
I use nosql
somene why does my node dosent show up
But I need it to work when only needed, why would I make it stay on
cuz memory is for stuff that you require,database is to store data,not to serve as a request on the go thing
ok
stable isnt related to do with that
you SHOULDNT be requesting shit often from database
if you requesting stuff often,use memory
I have somewhere in some command, a function to get first available channel
Is it also wrong
what?
I have somewhere in some command, a function to get first available channel
@tidal marlin but it would be annoying to have a bot sending a message to a random channel
for general stuff its fine, but as i said, for announcements its annoying
first, if you hook on systemLog channel you'll get both messages
the system and your bot
hook?

Well yeah?
bad
Erwin just joined the server!
bot: Erwin joined the server!
why?
stupid
bad design
you'll just be repeating the same message
Admin/mod can set it's own message there






