#development
1 messages Ā· Page 58 of 1
would it be bad if i made mine on a google doc?
Would probably be enough yeah
just export it to text afterwards and add it to ur repo
or go even more overkill, pastebin
how do i make a vote command for my bot
could you help make a vote command
You mean a command that is only usable after voting
just create a command that responds with a link to the voting page
ill have my developer do it lol
woah, calm down satan
and my prefix commands broke for no reason lol
could you help figure out what this means TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
at Object.execute (/home/runner/all-in-one/commands/info/help.js:224:35)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
could you post your code that caused this
theres the help command
cant look into it myself, you'll need to wait for someone who has knowledge in js
ok
thats the only command that broke is the issue lol
and my command to figure out why shuts off the bot
holy mother of god
pro tip: please post the code that's actually relevant to your problem and not the entire 550 line file
because I'll just tell you now, I don't think anybody is going to read your code if you post something that big
Nor able to read a txt file on mobile
its having issues with the help file
idk where in it lol
read the error
help.js line 224 column 35
that's what the littlehelp.js:224:35 thing means
const collector = helpmsg.createMessageComponentCollector({
const collector = helpmsg.createMessageComponentCollector({
filter: (i) => (i.isButton() || i.isSelectMenu()) && i.user && i.message.author.id == client.user.id,
time: 180e3
});
collector.on('collect', async b => {
try {
if (b.isButton()) {
if (b.user.id !== message.author.id)
return b.reply({
content: `${client.allEmojis.x} **Only the one who typed \`${prefix}help\` is allowed to react!**`,
ephemeral: true
});
lets say, the whole codeblock starting from helpmsg till the end that causes the error
š¤¦
^
^ this too
sigh
its a long file lol
^ until the point where the error is caused
not to mention you still have not posted the only portion that is actually relevant to the problem. helpmsg is undefined, and we don't know why because we can't see where you defined it
Here I'm just going to post it for you, let me look through it
var edited = false;
let helpmsg = await message.reply({
embeds: [OverviewEmbed],
components: allbuttons_home
}).catch(e => {
console.log(e)
return
});
const collector = helpmsg.createMessageComponentCollector({
filter: (i) => (i.isButton() || i.isSelectMenu()) && i.user && i.message.author.id == client.user.id,
time: 180e3
});
that's what we needed
So, helpmsg is undefined
Can I see what your command handler looks like?
i dont were that would be in this mess
Did you write this code
yes\
...so you should know where your command handler is
i wasnt very organized when i did it
const {
Client
} = require("discord.js");
const {
Perms
} = require("../validator/permissions");
const {
promisify
} = require("util");
const {
glob
} = require("glob");
const PG = promisify(glob);
/**
- @param {Client} client
*/
module.exports = async (client) => {
try {
let amount = 0;
(await PG(${process.cwd()}/commands/*/*.js)).map(async (file) => {
const command = require(file);
if (command.name) {
client.commands.set(command.name, command);
amount++;
} else {
await client.logger(Command Error: ${command.name || "Missing Name"} | Directory: ${file.split("/")[7] + / + file.split("/")[8]}.brightRed);
return;
}
if (command.userPermissions) {
if (!Perms.includes(command.userPermissions)) return await client.logger(Command Error: Invalid Permission | Directory: ${file.split("/")[7] + / + file.split("/")[8]}.brightRed);
}
if (command.botPermissions) {
if (!Perms.includes(command.botPermissions)) return await client.logger(Command Error: Invalid Permission | Directory: ${file.split("/")[7] + / + file.split("/")[8]}.brightRed);
}
if (command.aliases && Array.isArray(command.aliases)) command.aliases.forEach((alias) => client.aliases.set(alias, command.name));
});
await client.logger(${amount} Commands Loaded.brightGreen);
} catch (e) {
console.log(String(e.stack).bgRed)
}
}
Okay that still doesn't show me anything. You are not ever calling command.execute() there
Basically where is client.on('messageCreate', async message => ...)
I need to see where you're calling your execute function on your commands, which I'm assuming is in your messageCreate event
thats legit my command handler
That's not how that works
You are calling .execute() somewhere in your code
That's what I need to see
That code you posted just loads your commands into a Collection property on your client
what should the file be called lol
There's probably somewhere that you do for(const command of client.commands) or something similar
I don't know, you claimed you wrote this code so you should know where that is
I have a feeling you didn't write the code
Just sayin
It's okay if you didn't, but you need to be transparent with that so we know to assume that you're not sure where everything is
It's probably in index.js or something similar, unless you have an event handler along with it
ah bot.js
Unless you have an events folder, then it would probably be in events/messageCreate.js
(Or something similarly named)
const {
Events
} = require("../validator/eventNames");
const {
promisify
} = require("util");
const {
glob
} = require("glob");
const PG = promisify(glob);
/**
- @param {Client} client
*/
module.exports = async (client) => {
try {
(await PG(`${process.cwd()}/events/*/*.js`)).map(async (file) => {
const event = require(file);
if (!Events.includes(event.name) || !event.name) {
await client.logger(`Event Error: ${event.name || "MISSING"} | Directory: ${file.split("/")[6] + `/` + file.split("/")[7]}`.brightRed);
return;
}
if (event.once) {
client.once(event.name, (...args) => event.execute(client, ...args));
} else {
client.on(event.name, (...args) => event.execute(client, ...args));
}
});
await client.logger(`Events Loaded`.brightGreen);
await client.logger(`Logging into the BOT...`.bold.yellow)
} catch (e) {
console.log(String(e.stack).bgRed)
}
};
ok so that part is correct
this bot is not fun to find stuff in
this is basically all I can give you
Other than that, the code is incredibly unreadable and hard to comb through for bugs
well, that's what "maintainability" means
The likelihood is that message.reply() is failing
rn i only 2 errors that pop up so far
RangeError [BUTTON_URL]: MessageButton URL must be a string
at Function.verifyString (/home/runner/all-in-one/node_modules/discord.js/src/util/Util.js:416:41)
at MessageButton.setURL (/home/runner/all-in-one/node_modules/discord.js/src/structures/MessageButton.js:127:21)
at Object.execute (/home/runner/all-in-one/commands/utility/support.js:42:14)
at Object.execute (/home/runner/all-in-one/events/guild/messageCreate.js:177:29)
at Client.<anonymous> (/home/runner/all-in-one/structures/handlers/eventHandler.js:28:50)
at Client.emit (node:events:402:35)
at MessageCreateAction.handle (/home/runner/all-in-one/node_modules/discord.js/src/client/actions/MessageCreate.js:26:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/runner/all-in-one/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/runner/all-in-one/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
at WebSocketShard.onPacket (/home/runner/all-in-one/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/runner/all-in-one/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/runner/all-in-one/node_modules/discord.js/node_modules/ws/lib/event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (/home/runner/all-in-one/node_modules/discord.js/node_modules/ws/lib/websocket.js:1137:20)
at Receiver.emit (node:events:390:28)
at Receiver.dataMessage (/home/runner/all-in-one/node_modules/discord.js/node_modules/ws/lib/receiver.js:528:14)
this my other error
try doing something like ```js
let helpmsg = await message.reply({
// Stuff
}).catch(e => {});
if(!helpmsg) return;
I can't help anymore, gotta write some college essays
well it dont throught the error now but dont worl
work
let helpmsg = await message.reply({
embeds: [OverviewEmbed],
components: allbuttons_home
}).catch(e => {
console.log(e)
return
});
What ādonāt workā?
my help command
im still having issues with my help command
Ok once again⦠what doesnāt work
Provide some details
I donāt own a magical glass ball

lies, yes you do
same issue
At least⦠I wouldnāt tell anybody if so
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
at Object.execute (/home/runner/all-in-one/commands/info/help.js:224:35)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
like a client of mine used to say:
the problem lies between the keyboard and the chair
this was the error i got
This could actually fit to a lot of things
but ye the bot sends the errors to a channel in my support sserver
enjoy this one fake
Oh
yes fake, enjoy this one
waffle couldnt fix it lol
Ya⦠waffle big nuuuub
ya so your var helpmsg is undefined
How do you define it?
var edited = false;
let helpmsg = await message.reply({
embeds: [OverviewEmbed],
components: allbuttons_home
}).catch(e => {
console.log(e)
return
});
const collector = helpmsg.createMessageComponentCollector({
filter: (i) => (i.isButton() || i.isSelectMenu()) && i.user && i.message.author.id == client.user.id,
time: 180e3
});
it sent an error in discord
wich is this
helpmsg is undefined
if i can find the backup of that command im gonna see if it fixes it
thats were it defines it
and before i changed the emojis it was working fine
And before creating the collector on it you didnāt check if itās undefined or nothing
so it worked fine until i changed the emojis through out the command
What does your console log says
nothing lol
Since it fails it has to log something
last thing it says is it loaded mongo
Does the reply work, is a message being sent
no
Probably crashing before there then
ok now the error pops up again
The one you mentioned above?
Still canāt open txt files on mobile, that hasnāt changed yet
how is it invalid
if (b.customId == "Home") {
await helpmsg.edit({
embeds: [OverviewEmbed],
components: allbuttons_home,
// ephemeral: true
}).catch(e => {})
b.deferUpdate().catch(e => {})
}
Try again
Read again what I wrote
I wanna see how you defined your components
Because itās wrong
idk where that is in this mess
ye it shows up in 6 spots
Then show them to me
if (b.customId == "Home") {
await helpmsg.edit({
embeds: [OverviewEmbed],
components: allbuttons_home,
// ephemeral: true
}).catch(e => {})
b.deferUpdate().catch(e => {})
}
const allbuttons_home = [allbuttons_home_list_Button, menuCategory]
const allbuttons_command_commant = [allbuttons_home_list_Button]
const allbuttons_buttons = [allbuttons_home_list_Button, buttonCategory, buttonCategory2, buttonCategory3]
found it
well
(I have a feeling he didn't write this code)
Now show me how both items of your array are defined
i made most the commands
not the whole bot
cough
now i dont know what that is
components: allbuttons_command_commant,
// ephemeral: true
}).catch(e => {})
b.deferUpdate().catch(e => {})
}
if (b.customId == "Button_Menu") {
await helpmsg.edit({
embeds: [OverviewEmbed],
components: allbuttons_buttons,
// ephemeral: true
}).catch(e => {})
b.deferUpdate().catch(e => {})
}
allbuttons_home_list_Button and menuCategory
ok
let allbuttons_home_list_Button = new MessageActionRow()
.addComponents([button_home, button_cmd_list, button_button_menu])

AGAIN MORE VARS
let menuCategory = new MessageActionRow()
.addComponents([menuSelection])
vars are helpfull
@boreal iron here's the full code if he hasn't sent the whole thing in a pastebin yet, just so you can have a look https://pastebin.com/SmBMiBbZ
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Fuck pastebin on mobile man
There we go
I donāt wanna search the stuff myself on mobile
Provide me those 3 vars
Canāt be so difficult
let me go find them
.addComponents([button_home, button_cmd_list, button_button_menu])
// let buttonhome = new MessageActionRow()
// .addComponents([button_home.setDisabled(true), button_cmd_list.setDisabled(false), button_button_menu.setDisabled(false)])
// let allbuttonscommand_commant = new MessageActionRow()
// .addComponents([button_home.setDisabled(false), button_cmd_list.setDisabled(true), button_button_menu.setDisabled(false)])
// let allbuttonsbuttons = new MessageActionRow()
// .addComponents([button_home.setDisabled(false), button_cmd_list.setDisabled(false), button_button_menu.setDisabled(true)])
Thatās not what I want
I want those 3 I shows in my screenshot
button_home, button_cmd_list and button_button_menu
// let buttonhome = new MessageActionRow()
// .addComponents([button_home.setDisabled(true), button_cmd_list.setDisabled(false), button_button_menu.setDisabled(false)])
// let allbuttonscommand_commant = new MessageActionRow()
// .addComponents([button_home.setDisabled(false), button_cmd_list.setDisabled(true), button_button_menu.setDisabled(false)])
// let allbuttonsbuttons = new MessageActionRow()
// .addComponents([button_home.setDisabled(false), button_cmd_list.setDisabled(false), button_button_menu.setDisabled(true)])
thats button home
NO
lmao
// let buttonhome = new MessageActionRow()
Thatās still N O T button**_**home, thatās buttonhome
var IS NOT EQUAL TO vaR
or VaR
or vAr
let button_home = new MessageButton().setStyle('SECONDARY').setCustomId('Home').setEmoji("š ").setLabel("Home")
or v_ar
Ok now I need some poor pleb using builders to tell us what you need to provide as argument in the setEmoji method
@wheat mesa

takes a unicode emoji, what he has is right
š
Just as long as š is in it's unicode form of \š
I guess itās not then
when i typed it in it was in : house:
Can you show a screenshot of this code please
:house: isnāt an emoji
yeah you can't do that
Itās a string
ok fudge
i cant copy paste houses
\š
He he
i cant copy paste emojis
You can
just look up "unicode house emoji"
ok
You can even mark and copy it right of discord
so im coding this in on a chromebook
It will may show a weird character in your code
i dont have a text editor
you're using replit
replit is an online IDE
There we go
i am using replit cause its an easy way to test it
Anyways⦠you will have to replace all of it with actual Unicode emojis
fudge
@quartz kindle @wheat mesa
So I solved it⦠now kneel down and praise lord FakE
to be fair I didn't want to navigate through that mess in the first place lol
writing college admissions essays rn š
I see youāre a junkie
I can sell you some drugs to get rid of that issue mr waffle
it aint fixed lol
how much
it still broke
same error
Provide the error please
same error
Exactly the same?
Iāve seen so much I donāt even find the link anymore
probably did something wrong
Send a screenshot of the code again
How much for the damn drugs Waffle
i am 18+ š
Are those the only buttons with emojis?
i think so
I mean you didnāt provide the two other vars I asked for yet
Just search your code for setEmoji and make sure all are set as Unicode chars
i found more buttons is the issue
thank you im pissed now cause its fixed
Cause it's a dumb issue

I have to update VSC right......?
only If I could tell you.
That's a VS error. You need Visual Studio build tools installed
Nothing to do with VSC
How do I get an API field to return None if it can't be found currently in Python?
That's not how that works lol
It's trying to compile stuff in C++ and they don't have any build tools for it
Thatās exactly how it works young men
Doesn't matter what IDE/editor you're using if you don't have the compiler
It does, trust me and listen to an old man
Just remove it from your system
And no error messages will pop up any more
I swear
...

I am still lost.
with
I told you how to solve your problem
oh...yep not gonna get into this
Waffle canāt leave discord
why? too addicted?
I'm procrastinating on writing essays
console.log('Go write your essays')
I have no idea how to even begin with this, it's such a broad question and it's limited to 300 words
college application question
I've tried using if res['alerts'] == None: but it still errors out since it can't be found
what tools would I need
one of the reasons I give up on coding in js
you know about coding tho
not in js, one of the reasons above
barely could bother with that error
anyways it cant find your vscode installation, possibly reinstall it
oh
it's not anything to do with visual studio code
bruh
Not that waffle said this like 10 times already
It needs Visual Studio Community's C++ compiler to compile some of your nodejs dependencies that have bindings to C++
there ya have it, I have barely any clue on js, now I shall disappear
make sure you select "Desktop development with C++" when it prompts you
Imagine bitching about JS but using python
to be fair it's not a js issue
ok
(sorta)
Poor Aurel 
though must admit
cringe to require virtual studio to do some npm terminal based stuff
node-gyp is a package for binding js to C++, but if you don't have a C++ compiler built into your system (most windows systems do not come with one by default), then it won't be able to compile stuff
oh
It doesn't need the visual studio part, it just needs the build tools that are installed with visual studio
how hard is it to get redis database
how to install linter in replit?
don't think u can
replit has its own editor
but on the other hand, why don't u simply download the project and edit it locally?
you can use git to keep both sides in sync
why does discord respond with bad request?
Missing scope possibly?
I got identify and guilds
yes
Show what your actual request body looks like in the end blurring out client_secret
ah, managed to fix it, originally I directly got the tokens but messed it up somehow and to fix that I just had to change the type in the uri to token
why am I getting a ton of 429s? Im just requesting user info and guild list when the page is loaded (requests are made on the browser, not bot)
That means you're ratelimited, you've made too many of those requests in a short period of time
that would be the manage server/guild permission
I'm tryna check if an email is valid or not
like by the way how it is formed
tried a few ways but they don't seem to work
(javascript)
.
Well⦠you gotta use regex to match your mail address
How can i get the picture of the message author and maybe use it for embeds
Where? In JS, Windows, your garden, your car⦠where?
gotta add my api token on my car
The api provides the user avatar as part of the user (author) object
omg
Two hackers have developed a tool that can hijack a Jeep over the internet. WIRED senior writer Andy Greenberg takes the SUV for a spin on the highway while the hackers attack it from miles away.
Read the article on WIRED here: https://www.wired.com/2015/07/hackers-remotely-kill-jeep-highway/
Still havenāt subscribed to WIRED on YouTube? āŗāŗ ...
Yee welcome to the future of connecting anything
But no worries, everything is save!!!1!
Ah thanks 
whats the best way to authenticate requests to my bot api for the dashboard?
elaborate authenticate:
allowing your users to for example configure things?
yes, I dont want user xyz to configure settings that only user zyx can configure
on every session (since I'm assuming you'd use discord oauth), generate a new session token and track that internally in your bot api, associate that session token with an actual discord user
always check if the session token provided is actually associated with the action you're about to do (such as changing a user-specific prefix on a user that doesnt match the session token)
Like, discord settings? Youāre probably going to need an OAuth grant for seeing the userās guilds and their permission levels in them
at least thats what I'm guessing you mean
I already got all that
also, always invalidate previous sessions when users decide to authorize again and logout
Aurel has more experience with this than I do, Iāll leave it to them
I dont
I have actually tried to setup myself something like this, but that's the way I'd do that with my current knowledge of sessions
so I basically save a generated token in my db and if the user logs out / the oauth token expires it gets removed from the db?
Nah, I havenāt ever made a dashboard lol
correct
always make sure to invalidate sessions to avoid zombie-sessions, also ensure you're not colliding sessions
couldnt I technically just use the accessToken?
bad idea
Also youāre going to want to store the temporary token on the userās browser locally, most higher level libs have easy ways to do that. Just so your user doesnāt have to log in between each request
use something that you provide yourself, the access token allows you to access the scope-data on a user
through settings the cookies yeah
thus a session token
yeah, I already save stuff in cookies
you could technically use a hashed version of the access token
but I highly suggest using a generated one from yourself
Are cookies the way to go for that? I remember something about being told to not use cookies for tokens when I was making an API in ASP.NET
But maybe Iām remembering wrong
you can also use the session Storage, though since I have never actually done front-end based things on a dashboard, I have mainly worked with cookies
cookies are the go-to way because the server also has the access to them
with localStorage you'll always have to send it yourself
so essentially:
- once a user authorizes, provide a cookie for example that contains a session token, associate session token with user (id, possibly access token, refresh token)
- authorize actions using that session token, always confirm actions done with that session token are actually affecting that user associated with that token and not someone else
- once a user logs out, invalidate session token
- once a user authorizes again, invalidate previous session token
and the server can't set it in any way
oh yeah localStorage was it, this is probably useful if you're doing requests within the frontend directly
though cookies are more easy, since these are sent along requests too
you could also go the way discord does it with their authorization tokens, I don't know if theres some standard on it
yeah, Ill try that. While im here, how can I search for something in an json array? example every json has a value property, how can I find the index where the value is x?
js right?
yea
yeah nvm gotta ask someone with proper js knowledge on that
im trying to make a reaction role with buttons. Everything works but when i click the button nothing happens and i dont get any errors
CODE:
async handleButtonResponse(interaction, args, client) {
const roleId = TEST_ROLE;
if (interaction.isButton === "partnership_yes") {
await interaction.member.roles.add(roleId);
return await interaction.reply({
content: `<@&${roleId}> role has been added!`,
ephemeral: true,
});
} else if (interaction.isButton === "partnership_no") {
await interaction.member.roles.remove(roleId);
return await interaction.reply({
content: `<@&${roleId}> role has been removed!`,
ephemeral: true,
});
}
}
If anyone can help me that would be be great
isButton is a boolean that contains either true if it is a button and false if it is not (such as being a select menu instead)
so both conditions would fail as you're comparing them with a string
isButton actually is a method not a property

so what you're possibly looking for is customId im guessing?
it is
no clue about discordjs, yet am able to read docs 

the custom id of the button is the same as the interaction part
Yes as the button triggers an interaction
but nothing works
How can i get bot developer role?
Have an approved bot on topgg
gotta love our bot going down every 10 seconds š
well fudge my bots code is on and its dead
if (email.value.match(validRegex)) {
Cannot read properties of undefined (reading 'value')
help me fixxx
RangeError: Invalid count value
at String.repeat (<anonymous>)
at /home/container/src/commands/information/help.js:243:37
at /home/container/node_modules/discord.js/node_modules/@discordjs/collection/dist/index.js:1:3113
at Function.from (<anonymous>)
at Map.map (/home/container/node_modules/discord.js/node_modules/@discordjs/collection/dist/index.js:1:3053)
at module.exports.run (/home/container/src/commands/information/help.js:237:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async module.exports.runCommand (/home/container/src/events/message/messageCreate.js:302:5)
at async module.exports.run (/home/container/src/events/message/messageCreate.js:276:9)
else if (
(args && args[0].toLowerCase() == "config") ||
(args && args[0].toLowerCase() == "configuration")
) {
embed.setTitle(` ${emojis.economy} - Configuration`);
embed.setDescription(
this.client.botCommands
.filter((cmd) => cmd.category.toLowerCase() === "config")
.map(
(cmd) =>
`${
cmd.disabled || disabledCommands.includes(cmd.name || cmd)
? red
: green
} \`${cmd.name} ${" ".repeat(9 - Number(cmd.name.length))}:\` ${
cmd.description
}`
)
.join("\n")
);
embed.setFooter({
text: `Requested by ${message.author.username}`,
iconURL: message.author.displayAvatarURL({ dynamic: true }),
});
embed.setTimestamp();
embed.addField(
"\u200b",
"**[Invite](https://universebot.xyz/invite) | " +
"[Support Server](https://universebot.xyz/support) | " +
"[Dashboard](https://universebot.xyz/dashboard)**"
);
return message.channel.sendCustom({ embeds: [embed] });
What is going on
hello guys! i've been programming my own discord bot for 2 years and i would like to learn how to monetize it but i don't know where to start. Do u have useful links?
.sendCustom ???
its just .send
message.channel.send
I've been using .sendCustom lol and it works
but anyways
what is going on with the count eror
RangeError: Invalid count value
i sent the full error and code above
We've helped you with this exact same issue before, that means you're passing a negative number to the .repeat function
And as Tim said before, there's a method called padEnd that you should use instead of doing this
^
TypeError: Cannot read properties of undefined (reading 'name')
Name isn't a defined value I guess
Look at your code and adapt that to it, that was just an example
no, whatever is before name isnt
so im trying to listen to when users vote to track and give rewards
but it just doesnt work
like doesnt return anything
site link is alright
and everything
checked on the npm page for the tutorial but it didnt work
It's not alright if you're not receiving anything
const webhook = new Webhook("my code")
const app = express();
app.post('/dblwebhook', webhook.listener(vote => {
console.log(vote.user)
}))
app.listen(3000)
client.login(token)```
And what have you set as your webhook URL in the website? (Omit the IP address if you've put that in)
Hmm that's correct, in the "my code" part are you putting in the password you entered in the website?
yeah
the exact same
where are u running that code? on your PC, a server ... etc.?
pc
well, you will have to open and forward the ports in your router and firewall
in order to receive incoming requests
and you're required to have a public ipv4 address
kk
can i have help testing my bot
what kind of help?
Making sure they work
why do u need other people to do that?
just test all the use-cases yourself
test as if you were purposely trying to mess it up
well it has 160 commands
wich is what i need help testing
why did u make 160 commands with no test?
clones 
like, it's common sense to test your batch every few commands
else u get technical debt
KuuHaKu, do you like your bots with or without testing
actualy i recoded the bot
most of it works from what ive tested
Discord bot developers on their way to shove as many commands as possible to their Discord bots (almost every bot has those commands)
lmao I'm allergic to technical debt thx
wanna see the help list lol
Oh God oh hell naw
its big
That's what she said 
lol
i made a bug report command
thats sends the bug reports to the support server
nobody ever reports
That could be abused, sending random shit just to troll
And yeah nobody ever uses those commands to report actual bugs
its a handy feature lol
it is indeed, but in my 3 years of bot coding, I think I saw 6 or 7 valid reports
To you, it's better to just let people join the support server and report the bugs/issues they encounter
can i have help testing my tictactoe game
for the bot
nowadays I just have a QA team to get the bugs themselves
i might use a vps a friend is offering if i give them credit for building the bot lol
so i dont have to pay the 5 dollars a month
$5 per month is literally nothing, I don't see why you wouldn't just pay it yourself unless you live in a country where no regional prices are available
if you have no income $5/month is kinda expensive C:
But it's the cost of hosting
For renting hardware that's on 24/7, $5/month is nothing
Sell your body ezpz
Alright so
@boreal iron
Ive been trying to setup port forwarding
Its quite easy
But does it take some time to open
Once you click save
can you help fix my vote command
const Discord = require("discord.js");
module.exports = {
name: "vote",
aliases: ["v"],
execute: async(client, message, args, data, db) => {
const embed= new Discord.MessageEmbed()
.addField(`Vote us Here -`, `[Click Here](https://voidbots.net/bot/1029882366212190260)``Vote us Here -`, `[Click Here](https://top.gg/bot/1029882366212190260)`)
message.channel.send(embed)
}
}
module.exports.help = {
name: "vote",
description: "Vote the bot",
usage: "vote",
type: "General"
}
Show me what u did
can you help
My magical glass ball doesnāt tell whatās wrong/not working
Dunno it must be broken
(node:180) UnhandledPromiseRejectionWarning: TypeError: "Click Here" is not a function
at Object.execute (/home/runner/Sprites-all-in-one-Bot/commands/ā¹ļø General Info/vote.js
113)
at module.exports (/home/runner/Sprites-all-in-one-Bot/events/message.js:162:25)
(Use node --trace-warnings ... to show where the warning was created)
(node:180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I'm gonna sell your beloved car! Mwahahaha
thats the error im getting
YOU AINT TOUCHING IT
Just watch 
Man just add proper quotes to your strings
Can you upload this somewhere like hastebin
sure
Or use code blocks
The ` inside the code will interfere with code blocks
oh it doesn't
Not for me
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
But uploading it to somewhere else is better anyways than discord
not the error
Lol
the code
ok
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
ok
You're basically trying to call a template string as a function (it's called template invocation)
Use a \ to escape the ` if you're using them inside a template string
Can you still pass he field name and value as arguments?
Thought that doesnāt work anymore
Canāt check the docs atm
how do i fix the bot
The addField() method doesn't even exist on v14, it's only addFields()
Although they seem to be using v13
i got it partial working
why are there no builder methods in v14/main
now the bot kills the server
Well you know what Iām thinking about builders
the bot turns off when i do .vote
There are, it's called EmbedBuilder for embeds for example
Builders are included by default on v14
You're supposed to use them
ok how do i add the second vote website
to the command
Iām supposed to abuse you
Not more or less
ok so
Its supposed to work lol
Status is on
voltrex any help
I put protocol on "both"
I'm supposed to sell your beloved car

TCP
@boreal iron help pls
Just add another field
then the bot shuts off
and doesnt start
Because you're doing it incorrectly, what's the error?
none
it just kills itself
Show code
const embed= new Discord.MessageEmbed()
.addField(Vote us Here on void bots -, [Click Here](https://voidbots.net/bot/1029882366212190260) )
message.channel.send(embed)
Still says port 3000 is closed on my ip
You donāt have to put in a local address but topgg IP as remove address
SyntaxError: Identifier 'embed' has already been declared
ok
whats top.gg ip
Err is mentioned in the docs
Exactly what the error says, you've declared two variables with the same name (which is embed in this case), that's not allowed
then how am i supposed to do this
Name the variable something else, it can be whatever you want
could make another command for it
Uhh
Bro just rename the variable š
and how long do bots take to get verified
In Top.gg or Discord itself?
What are you all using for your database of choice?
I've heard a ton about MongoDB. Does anyone here use SQL?
Depends on your needs
That's true. For an RPG write-heavy application, what would you recommend?
PostgreSQL, it's awesome and very scalable, there's also ScyllaDB (the one that Discord currently uses), and MariaDB
I'm starting with Postgres for now. Traditional relational style has actually been my weakpoint since college, haha
Write intensive isnāt an issue but how you access and store data in other words the structure makes is important
I understand storing data efficiently for your needs, but I've been reading a ton of conflicting articles. On the radical hand, some don't use any foreign keys ... strictly store everything needed on a page load / for a character. They'll even redundantly store data.
Then, on the normalization end, some folks will do everything in its own table and link everything back with foreign keys.
Some use databases to keep integrity, others place the burden on their application to handle it.
And I'm trying building a discord bot right now - struggling to think through it.
I had a discord bot before using DynamoDB. It worked really well and was super cheap, but restricted me for future querying patterns.
In general, you should strive for a database with foreign keys/relations.
Having your database manage relations relieves you from many problems associated with linking data.
Of course, a database can do more than relations, and SQL can be a burden.
generally speaking the tradeoff is between performance and space efficiency
tables with duplicated columns have better performance and allow independent queries but use more space
normalization is used for 2 things: reducing space (by removing duplicates) and protecting data (no duplicates mean no risk of accidentally changing an id in one table but not in another)
but those things cost read performance, so your queries will be slower
id say go for normalization if you have a column common to multiple tables that is frequently updated
so you dont have to update multiple tables every time
otherwise go for denorm
is there a way to use this link (https://static.wikia.nocookie.net/virtualyoutuber/images/9/94/Moona_Hoshinova_Portrait.jpg/revision/latest/scale-to-width-down/350?cb=20200411161426) as an img src?
someone who know how to make a manual post request to post the server count?
How do i make a headline like that for my Bots description on top.gg?
and the text should be a bit smaller how do i do?
# Text
## Text
### Text
...
see these as <h1> <h2> and <h3>
ok thanks
try removing anything past the .jpg
or removing the query parameters
if it still doesn't work then you can use inspect element
i guess yea i can but thats pretty annoying to do
use a proxy https://external-content.duckduckgo.com/iu/?u=https://static.wikia.nocookie.net/virtualyoutuber/images/9/94/Moona_Hoshinova_Portrait.jpg/revision/latest/scale-to-width-down/350?cb=20200411161426
no problem
why do you need a proxy for that
idk but that works ig
cors perhaps?
how's it cors if it returns 404
ig this trailing stuff is the issue /revision/latest/scale-to-width-down/350?cb=20200411161426
so what i said was true
yes
Can anyone provide me an api which shows food images!? because mine isn't working š
hey guys
void show_universe(Cell universe[NO_OF_ROWS][NO_OF_COLUMNS], string starter)
{
ofstream output;
output.open(starter);
if(output.fail()){
cout << "Error opening output file " << starter << endl;
}
// precondition
assert(sizeof(universe[0]) / sizeof(Cell) == 60);
// postcondition
// Result is the display of the 2d universe array in the console with dimensions 40x60.
for (int i = 0; i < NO_OF_ROWS; i++)
{
for (int j = 0; j < NO_OF_COLUMNS; j++)
{
if (universe[i][j] == Dead)
{
output << DEAD;
cout << DEAD;
if (j == 59)
{
cout << '\n';
output << '\n';
}
}
else
{
output << LIVE;
cout << LIVE;
if (j == 59)
{
cout << '\n';
output << '\n';
}
}
}
}
output.close();
}
```i made this function in c++, it basically just showcases the game of life in the console. I have added it alongside:```c++
show_universe(next, saveuniverse);
sleep(350);
set_cursor_position(0,40);
clear_screen();
But as you can see its focking slow
as it writes each line one by one. Any way to optimize this
how can I get every server a user is on (yes, I know the bot also has to be on it) in discord.js v14?
Using Discordās OAUTH flow to get informations like that from the user
But I guess thatās not what u mean
is there a way through discord.js though? I get ratelimited from oauth after 2 requests
You will have to fetch a guild member providing that user ID for every guild
Which I would consider as API spam
instead of writing to console one line at a time save all lines in a string and write the string to the console
this should only make 1 request, right?
Whatās your intention to map that collection?
for(const [id, guild] of client.guilds.cache) console.log(guild.name);
Just loop through it instead of creating an array for no reason
And no, it wonāt make any api request
It just iterates your cache
and if I dont use my cache?
Fetching the guilds will do one request per guild, yes, but only if you enforce it
If not fetch will check the cache as well
I think im actually going in the wrong direction right now, I want to make my dashboard api check if a user is permitted to do that and etc, I thought about saving each of their guilds but if they left theyd still have access to it because im only checking when they authorize
You canāt constantly check that unless your bot is in any guild the user is, too
If so you gonna listen to the guild events for joining/leaving members
And update the user guilds in the background ones he joins/leaves a guild to be up to date
what if he is already in x guild but isnt in the db because the bot didnt detect it because the feature didnt exist yet?
I mean, I already display a list of servers a user is in, already have it only show guilds he has perms in but I need the api to know the same without getting my servers ip rate limited
If thatās the case you need to loop through any guild and fetch that member or generally all members
But nothing I would recommend
And will get I rate limited as well
The user using your dashboard should perform a login via the OAUTH flow
Then keep his guild joins/leaves up to date by listening to the mentioned events
Let him login on any new session, donāt save the session and you should be always up to date
but with that, how would I know that he has permissions?
any ideas?
trying to register commands in a server your bot is not in/your bot does not have perms to create slash commands
ok, one sec
made sure it was the server and that it had the perms yet I get it still
Just reset token and it works now :/
thank you Aurel
man resetting his token more often than changing his pants
My bot got hacled
based
I know.
how tho
Probably posted his token somewhere without realizing it
Exactly what happened
And I had the token hidden
P
No you didn't my dude. You had jt in config file not a environment (.env)
I thought I had it hidden
function validateEmail(email) {
let validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
console.log(email + "This is the email")
if (email.value.match(validRegex)) {
return true;
} else {
return false;
}
}
so i am tryna validate an email
Cannot read properties of undefined (reading 'match')
getting this error rn
don't mind the console log, it was there just to confirm that email is passing
what does it log
well then why do you have email.value.match and not email.match
also you could just return return email.value.match(validRegex) instead of having an if statement
can i
oh i was honestly wondering
and understand what you're copy-pasting
sorry
the thing had other values previously since it was made to work in html
was returning some weird shit
so that explains .value
your email regex is incomplete btw
like, there are no email regexes that'll work 100%, but the official RFC regex is much longer
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
javascript allows some compression of that thing
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
webpage shows this for js
man... that accepts mail addresses for non-fqdm as well
who tf respects the rfc
so to verify 100% an email u should prolly use an api? or start making it urself?
no
it's pretty much impossible to have a 100% proof email validator unless u try to send an email to it
you simply use a regex to filter the most out already, then send a verification email to verify the address
that's why most sites use the "please verify your email"
function validateEmail(email) {
let validRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return email.match(validRegex)
}
let emailValidation = await validateEmail(email)
console.log("EMAIL VALIDATION: " + emailValidation)
if (emailValidation === null) {
return interaction.reply('Please use an actual email!')
}
const encodedEmail = encodeURIComponent(email)
console.log(encodedEmail)
``` so this is what i came up with, looks OK to me
please let me know if i am using await wrong
so you know what it means
it'd be worthy to compile that regex btw
i might add way more to the code idk
so u don't recompile it on every function call
hmm
also why do you await that function?
wait
ah nvm, just noticed the brackets are off
I thought u were recursively calling it
discord doesn't like tabs
and yes, u dont need to await since it's not an async function
fixd
how am i supposed to compile it
is this it?
I've noticed developer.mozilla has some crazy docs
yeah i see there is a warning about this
new RegExp("regex")
I don't think new RegExp does any special "compilation" different from /.../
we need to put some testing into it
hm, perhaps since it's a string literal
once you're too stupid to understand what it means, add comments to your code
Here
Before regular expressions can be used, they have to be compiled. This process allows them to perform matches more efficiently. There are two ways to compile and get a RegExp object.
The literal notation results in compilation of the regular expression when the expression is evaluated. On the other hand, the constructor of the RegExp object,
new RegExp('ab+c'), results in runtime compilation of the regular expression.
How do you create webhooks?
like discord webhooks?
postgress or mongodb what would be the best choice for a discord bot
might get big
hehehe
not about development too much but how do I make this new .setColor() line have tabs accordingly to where its in?
enable regex and type \t
i mean, if you want auto indentation, then you cant do it via search
alt + 0009
Yes!
I know how to make them on Discord, I just don't know how to make them work.
Another Question can you make slowmode on Discord Slash Commands? Like 10s to prevent spam?
webhooks on discord are basically messengers - they allow external services to send messages directly though it
you can use them yourself for stuff like messages with name and avatar unique for each message, or to have some kind of broadcasting feature
if u don't need something like that, webhooks will offer very little value compared to normal messages
Omg tysm š
Is there something that helps you send the messages using them?
most discord libraries have built in support for webhooks
? looping through certain guild members (fetched) + i have intents on
for(const userDocs of shuffled) {
if(pickedDiscordIDs.length < amount) {
let search = await users.find({ DiscordID: userDocs })
let user = search[0].DiscordID;
let guildMem = await message.guild.members.fetch({ user: user, withPresences: true, force: true });
if(guildMem.presence != null && (guildMem.presence.status == 'online' || guildMem.presence.status == 'idle' || guildMem.presence.status == 'dnd')) {
console.log(guildMem.presence.status);
pickedDiscordIDs.push("<@" + user + ">");
pickedRobloxUsers.push(search[0].RobloxUser);
console.log(pickedDiscordIDs.length);
console.log(pickedDiscordIDs);
}
}
}```
Just as note⦠if your presence is āonlineā or ādndā etc. it automatically means it canāt be null
ah yeah that was just for testing
So that condition isnāt needed
going to remove it after this is finalized
but ye idk why its giving a timeout error
google says intents problem but i have the server members intent on
I was about to say members not arriving in time can happen when fetching all members of big guilds
But thatās not the case
ye thats why i was fetching one by one
about 1.1k
and also another reason y im not fetching all guild members is bc this cmd is only for people in the database
so it would b pretty useless to fetch everyone
since theres like 2k people not in the database
Still assuming youāre getting rate limited, too
1.1k requests will get you there real quick
its not doing it all at once tho
ive printed out how many times it goes through
and its spaced out by like 1-2 seconds
its not like its instantly doing it
Well I donāt see any timeout or sleep
If shuffled really is 1k large then the requests will be made one after each other
Just the response will take a few seconds
how would i make it wait like 1 second after each fetch
it says theres a time option
That entire concept isnāt really good tbh
Why would you need to fetch so many users anyways?
i mean theoretically speaking im not fetching all 1.1k, i'm only fetching until i meet a certain # of users
its for a event bot so we pick only online members
out of the people who registered to join the event
usually we only need 100 members but a lot of members are offline
Hmm I feel like fetching all members, filtering them by your registered users might be the better solution and still faster
but wouldnt fetching all members also result in the same error
fetching multiple members via #fetch()
Well you should enable the debug log to see if youāre getting rate limited
djs has its own event for you can listen to
Yeah
alr ty
when you specify the user field in members.fetch() it goes through the REQUEST_GUILD_MEMBERS gateway command, instead of the get /guilds/id/members/id endpoint
the REQUEST_GUILD_MEMBERS gateway command is designed to handle large amounts of members at once, it can easily handle 1000+ members per second
just put all your member ids into a single fetch request
instead of making separate requests for each member
hmm alr
let guildMem = await message.guild.members.fetch({ withPresences: true, force: true }).then(async members => {
for(const userDocs of shuffled) {
if(pickedDiscordIDs.length < amount) {
let search = await users.find({ DiscordID: userDocs })
let user = search[0].DiscordID;
let guildMem = members.filter(m => m.user.id === user);
console.log(guildMem.presence);
how come guildMem.presence returns undefined
guildMem returns the user perfectly fine
do you have the presences intent?
also, you dont need to fetch all members, you can specify an array of ids to fetch
o
doesnt seem to work
this is shuffled
- 1000 more values
console.log members
nothing prints
thats so weirdddd
it worked before i specified users
but like its an array so it should work

nothing logs
do u have the intent?
did u enable it?
did u enable the partials?
how about this ```js
client.on("raw", x => {
if(x.t && x.t === "GUILD_MEMBERS_CHUNK") {
console.log(x.d)
}
})
oh i just got a error actually
btw, I recommend dumping that to a file instead of having an array loaded at all times
or better yet, a database
it is in a database
are you running that code on startup?
the members fetch thing
uh well once it fully starts then i run the cmd

