#development
1 messages · Page 1832 of 1
Most wrappers go like that
Yes, but Discord.js is currently the most mainstream library. Though, one of the few things I like about the message intents update is everyone using the same command framework (slash commands)
how can I refresh my command list
Depends on what refresh means to you and what you're using
If you mean reload it
Then it depends on your language and how you loaded the command
I use command handler
and added slash commands
but the first time I use bot on slash after the bot starts, I get an error Invalid interaction application command
Be specific
why does everyone get wet over detritus
at that stage you might as well just make your own websocket connection and api requests
It does a lot of stuff right for them
I believe I can solve that issue if I refresh the command list
But I find that too many libraries and frameworks are concrete and just easy rather than simple so it comes back to haunt them later
basically, I'm using slash command.
When I first use the bot on slash after it starts, it shows an error Invalid interaction application command
But after that, it works fine...
Can anyone help?
^ Is that global command?
yes
Then it is is expected behaviour when you set it for first time or doing it on every time you reboot bot
where command will re-register to discord
how can I make it register when the bot starts?
You don't, only register it once
so that it doesn't give the error the first time
dont register it everytime restart
how can i make it happen?
you can do deploy command via the normal message command
module.exports = {
name:'deploy',
description: 'Deploy global slash command(s)',
guildOnly:true,
owner:true,
/**
* @param {import('discord.js').Message} message
*/
async run(message) {
// @ts-expect-error
const { SlashCommands } = message.client;
const guildCommand = await SlashCommands.get('deploy');
await message.client.application.commands.create(guildCommand, guildCommand.guildId);
message.channel.send({ content:'Done' });
},
};``` This I do to register my `/` command for deploying
then after it I can deploy from my /deploy after it registered
:^)
is there a way to auto deploy, bc I use a free host service and the bot restarts randomly
what do u mean auto deploy
so that I don't have to use command but it'll still work
what
is there any after(ready) thingy?
i dont get it
you only need to deploy once. then the command will stay on discord db
just do it when on the ready event?
ok thank you very much for your time
I'd be careful about that tbh
discord loves to randomly disconnect you, thus calling onReady again
and onReady is called for every single time a shard (re)connects
this can easily make you hit command update ratelimit
@sterile thicket ^ read this too
Thats why you want to implement a function to compare the code of the original command and the command you’re registering
Why can't Discord dispatch RECONNECT?
At least thats how I do
discord can't even add attachments to ephemerals, what were you expecting?
True lol
discord actively competes with riot for messiest codebase
What I don't get is why they disconnect you in the first place
One reason I fucking hate working with Discord API lol
Alright, multithreading is already feeling like pain to do
Or... let's see how my program does without it
What are you trying to require
what are you multithreading?
Selenium!
no I mean, WHAT exactly
A function that utilizes Selenium in Rust
idk how more precise it can get 
It automates logging in via few accounts and doing stuff with them
What's your filetree like?
God, how do I chunk my MappedRows now, ffs
Where in your code does it happen?
Can you send the full traceback?
91 | .chunks(2);
| ^^^^^^ method not found in `MappedRows<'_, [closure@src\structs.rs:83:36: 89:22]>`
pain
Full traceback could help someone who is actually proficient in JS
its used for image modification
tbh, the error explains everything.
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
Hey, I have a problem, I'm doing the welcome system but when someone enters any server, it appears on all servers, could someone help me?
,.,
somebody?
Yeah lmao how'd that happen
It is not that I have the guildMemberAdd in event, so when someone joins in any server it is sent to all servers
Well, I do not know
are you using djs
So you did
yes
Haven't used djs yet but couldn't you just get the guild id of the server, search with that on the db and then collect the channel id and send it into there
I'll try.
yeah true. instead of client.on(... just do client.once @sterile thicket
@primal plinthor just show us your code
idk its weird, its only when discord dcs telling u to reconnect u they dispatch that packet, otherwise it cant be used elsewhere
try edit your page and then save
idk if it still works
thats my code
nah didn't work
whats the problem?
I am with the welcomes but when someone enters any server they send the welcome message to all the servers
Ok thanks
yes
anyone have heroku discord server invite?
heroku has a discord?
I got locked out of my account and 2FA is not working
Idk I am asking
👀 if you looked at the page i linked to
https://help.heroku.com/7IDU8QZZ/what-should-i-do-if-i-m-locked-out-of-my-heroku-account
redirected to login page
oh weird
😩
tbh, on discord if you get locked out of 2fa you just lose the account.
👀
u have extra 2fa codes
ye
9 or 12 of them
99% of users dont save them anywhere
but in heroku they give you .txt file when u enable 2fa and i lost that file also
any prisma users here?
i save all my 2fa codes
otherwise you're royally fucked
always save them somewhere in the cloud
yes I learned that hard way
Is it possible to use those external link buttons together with interactions? As it says data.components[0]: The specified component type is invalid in this context
But maybe I'm doing it wrong
Anyone who uses dpy, and was able to use slash commands?
That's using a 3rd party lib
Or?
maybe, that's the first thing that popped when I seached "discord.py slash commands"
Also, this:
NameError: name 'slash' is not defined
I have extra created an alt to double backup the code on it
your code?
it could be console.log(slash) too which leads to the same error, so you have to be a little more specific
python... not js
My error: ```
C:\Users\asus\Downloads\test\node_modules\discord.js\src\rest\RequestHandler.js:154
throw new DiscordAPIError(request.path, data, request.method, res.status);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (C:\Users\asus\Downloads\test\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async RequestHandler.push (C:\Users\asus\Downloads\test\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
at async GuildMemberRoleManager.add (C:\Users\asus\Downloads\test\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:96:7) {
method: 'put',
path: '/guilds/840984159618990113/members/681407594354573312/roles/851390008086626314',
code: 50001,
httpStatus: 403
}
My bot is admin and its my code: ```
client.on("presenceUpdate", async (oldPresence, newPresence) => {
if (!newPresence.activities[0]) return
if (!newPresence.activities[0].state) return
const guild = client.guilds.cache.get("848100598908846110")
const role = guild.roles.cache.get("851390008086626314")
if(newPresence.activities[0].state.includes(".gg/aruna")) {
newPresence.member.roles.add(role)
} else if(oldPresence.activities[0].state.includes(".gg/aruna")) {
if(!newPresence.activities[0].state.includes(".gg/aruna")) {
newPresence.member.roles.remove(role)
}
}
});
maybe the other role is higher than the bot's highest role
const { MessageButton } = require('discord-buttons');
client.api.interactions(interaction.id, interaction.token).callback.post({ data: {
type: 4,
data: {
components: [ new MessageButton().setStyle('url').setLabel('Google').setURL('https://google.com') ]
}
}});```
How can I fix ```DiscordAPIError: Invalid Form Body
data.components[0]: The specified component type is invalid in this context```
Component needs to be a message action row
new MessageActionRow().addComponents(new MessageButton()…)
@tulip ledge thanks! Now it says data.components[0].type: Value "ACTION_ROW" is not int.
Huh.
const component = new MessageActionRow().addComponents(new MessageButton().setStyle('url').setLabel('Google').setURL('https://google.com'));
oh that doesn't have anything to do with this line
Its where u send it
Issue might be with discord buttons, I just use the built in methods of djs
is there a built in method? Ohh, then I will use that one
`
hmm oh yes I think so too
console.log(Discord.MessageButton) is undefined for me
U can just say
import { MessageButton, MessageActionRow } from “discord.js”
Ye
Its dev then
yes so I got this now to try it out, before doing it with interactions, but it's only sending the content
const { MessageButton, MessageActionRow } = require('discord-buttons');
const component = new MessageActionRow().addComponents(new MessageButton().setStyle('url').setLabel('Google').setURL('https://google.com'));
client.channels.cache.get(interaction.channel_id).send('hi', { components: [component] })```
very ugly, but just to try
Can u show the error again
no error with these lines
console.log(component):
MessageActionRow {
type: 1,
components: [
{
type: 2,
style: 5,
label: 'Google',
emoji: undefined,
disabled: false,
url: 'https://google.com',
custom_id: undefined
}
]
}```
I cant help anymore, entering al elevator, then going to the shop, sorry bro
Yeah, please ignore that ss
I got it to work
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction```
I get this now
Hey, quick question.
let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*?>/; // Change this line
let result = text.match(myRegex);
console.log(result); // ["<h1>"]
How does this return <h1>.. in the regex, I was supposed to make it /<.1*?>/ not /<.*?>/.
what do you want it to return?
The regex, based on my understanding, has it start with < then a . which is known as a wildcard period.. but where's the 1?
Create an embed.. and put the invite link there.. or a command that sends a message containing the invite link.
Show your code.
.. wait.. I have a question. If it was this.
let text = "HamoodiHajjiri";
let myRegex = /H.*?i/; // Change this line
let result = text.match(myRegex);
console.log(result); // ["Hamoodi"]
.. so the regex is finding anything that starts with H and then a character from [a-z] meaning even though I don't add the . or the [a-z].. it will still send, right?
about the discord.js dev version: is it easy to get that version and does it break any working things in the stable version?
it breaks a lot of things, read the v13 changes guide
why I'm asking is that I can't send message components, or I'm dumb
oh let me rephrase it: does it add bugs to existing features or does it remove existing features?
I mean, the second is okay but I don't want extra bugs
wdym bugs?
it changes a lot of existing things, so if you dont change your code to the updated versions, it will likely break things
Tim, quick question.
What does the . symbolize in the regex I mentioned in this example.
let text = "HamoodiHajjiri";
let myRegex = /H.*?i/; // Change this line
let result = text.match(myRegex);
console.log(result); // ["Hamoodi"]
.. does it mean all the characters in between the start from and the ends with?
. as in [a-z]
oh that is fine. We will eventually have to update so I can better implement slash commands and v13 at once
I meant if it will be like an alpha/beta version which can contain bugs
Any character except linebreak
yes, its essentially a beta, it can contain bugs
hm okay
But it will better support slash commands and message components right?
okay that's awesome
hm my discord.js version won't update. I uninstalled and installed it again, but it's still 12.5.3
do npm i discordjs/discord.js
do you guys have something where i can host my bot 24/7 for free
ok thanks
👍 👍 👍
Sweet.. thanks!
it doesn't work 🤔
Replit hacker plan
that costs money
thanks, will try
There is free one
Express replit
Ez bz
⣿⣿⣿⣿⣿⠟⣩⣴⣶⡶⣶⣲⡶⠶⣶⠶⣶⣶⣖⣀⣉⣭⣉⣛⠻⢿⣿⣿⣿⣿ ⣿⣿⣿⡿⢃⣾⣿⣻⣟⢮⣿⣮⣽⣿⣿⣻⣿⣿⣶⡲⣾⣿⣿⡳⣿⣶⡌⢿⣿⣿ ⣿⣿⠟⢡⣾⣿⣿⢿⡷⠋⠉⠉⠩⣭⣙⠻⣿⣿⣿⡿⠟⠛⠛⠻⡿⣿⣿⣘⢿⣿ ⡟⣡⣵⠟⣩⡭⣍⡛⠿⠶⠛⣩⣷⣶⣬⣴⣿⣿⣦⠠⣶⣶⣾⣿⠿⠛⠿⡪⣧⢸ ⡇⣿⣿⢘⣛⠁⣬⣙⠛⠿⣿⣛⣻⡝⢩⠽⠿⣿⣿⣶⠍⠻⢷⣶⣾⠹⣿⣣⡟⢸ ⣷⣌⠮⢾⣿⣷⡈⣙⠓⠰⣶⣦⣍⢉⣚⠻⠿⠿⠭⠡⠾⠿⠟⣊⢡⠁⢱⡿⢰⣿ ⣿⣿⣷⡙⢿⣿⣷⣌⠓⣰⣤⣌⡉⡘⠛⠛⠓⠘⠛⠂⠚⠛⠂⠛⠈⠄⢸⡇⣿⣿ ⣿⣿⣿⣷⣌⠻⡿⣿⣿⣦⣙⠛⢡⣿⣿⣷⠄⣦⣤⠄⣤⠄⡤⢠⡀⢢⣿⡇⣿⣿ ⣿⣿⣿⣿⣿⣷⣬⣑⠻⢷⣯⢟⣲⠶⣬⣭⣤⡭⠭⠬⢭⣬⣥⣴⢶⣿⣿⣧⢸⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣍⡓⠿⢿⣤⣿⣿⣟⣛⣿⣿⣿⣷⣛⣿⣾⡿⣸⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣬⣭⣙⣛⡛⠿⠿⠿⠿⠿⢟⣋⣴⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣬⣭⣙⣛⡛⠿⠿⠿⠿⠿⢟⣋⣴⣿⣿
@quartz kindle Some necessary changes in v13 have been made as I can see.
Great property names changes (for example ownerID to ownerId)
god damn...
The new verification form is just great
huh which new verification form?
Did they not realize ID is a valid word
lmao
very necessary indeed
yup 😂
I don't like that change
now I have to fucking take a look at the docs for any damn property
and I can't even update to v13 ...
im doing that but it still randomly updates sometimes
The server region doesn't seem to be available anymore, too, at least I can't see it inside the guild obj.
@quartz kindle is there anything that should be enabled or something in order to have v13? Or a node version? I have Node 14.15.4 so that should be good
that's weird, it isn't listed in the changes
wow nice, the form has select menus now
no, there isnt anything like that
Place holder for forms makes it easy to understand what question means what
What you talking about timmey
right
npm WARN nobotesterbot@1.0.0 No repository field.
+ discord.js@12.5.3
added 15 packages from 18 contributors and audited 194 packages in 1.593s
39 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities```
oh I see it has a warning but idk
or isn't this what you mean
show the command you ran
edited ^
I see you probably a discordjs newbie
did you not do npm install discordjs/discord.js?
oh I also did that, but I thought I could choose between both
well I wrote my whole bot in js so I don't think I'm a newbie 😂
show the install log from discordjs/discord.js
Then why can’t you install a simple package
Im bored anyone need help
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/discordjs/discord.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\menno\AppData\Roaming\npm-cache\_logs\2021-08-04T18_02_45_542Z-debug.log```
Looks like these changes have been made recently.
Before my bot got verified I got asked about details regarding the infos you can now find in the new select options etc.
because they all say npm install discord.js, look here: https://discordjs.guide/additional-info/changes-in-v13.html#api-version
The Message Developer Q&A has begun. 🎉
npm install discordjs@latest
because that is written to be the future stable version
not a dev version
to install dev versions you always install it directly from the github master branch
Err it's not required to install git.
npm install https://github.com/discordjs/discord.js/tarball/master will do the job as well
ohh I didn't know that, thanks
and that's why you do npm install discordjs/discord.js instead of npm install discord.js?
yes
okay
username/package installs from github
package installs from npm
ohh right
you can also try what fake said
oh wait git is not a npm package right
no
and with FakE's option I don't need to install git from the internet?
haven't installed git as well, that's why you can install it how I said, too
apparently yes, try it
no, it's not required to install git, did that, too a few days ago
awesome, it's changed!
but package.json now has the url as the version, is that right?
yes
because dev versions dont have a fixed versioning
it simply means "always download from this url"
meaning its always the latest possible version
(including broken/experimental stuff)
ohh
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
there we go again lmao
👍
really thanks for the help, everyone who helped me!
I've noticed the GUILDS intent doesn't include the members anymore?
The member collection only includes bots... huh
weird
const g = client.guilds.cache.get(interaction.guild_id);
await g.members.fetch()
console.log(g.members.cache.size)
// => 12
and 12 members in the guild
oh wait I don't know if this is correct
oh... you're fetching the members
does it matter that this bot isn't verified?
yes, else it only shows the cached members which is him and me
always has been like that for me
yeah, somehow my cache doesn't show up any member except the bot
oh wait
it does cache me
But it does that after the second time I send an interaction which is weird
how can i make sure my day command doesn’t @ everyone?
in which library
discord.js
nvm
👀
version?
12
tyyyyy
np
was looking for something w the wrong name in the docs
lol
client.user.setActivity("Managing B. Support", { type: "STREAMING" })
Why will this shown as "Playing Managing B. Support"?
v12?
it'll always show activity + message
I think you need to set the url as well.
what url?
To some Twitch stream
lool that could be true
How is the event called when a member leaves? GuildMemberRemove?
lowercase g
what object do we parse? The member who left or the guild? I think its the member, right?
Do you have the intent enabled on the developer portal and when initializing your client
and in your source code
var Discord = require('discord.js');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES'] })
module.exports = {
name: 'guildMemberRemove',
async execute(member) {
}
})
that's probably your problem
are you trying to create a new client and listen for events from it
rather than using your existing client
I have an event handler
For example, listening to member.client.on(...)
ah I see now
You need to include the GUILD_MEMBERS intent.
In your original client initialization.
You can't just create a new client instance like that
i have it like this:
const client = new Discord.Client({
intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILD_MESSAGE_REACTIONS'],
partials: ['MESSAGE', 'CHANNEL', 'REACTION']
})
Do you get the events now?
nope I already had it like this
all events are working fine excpept of this one
Can you show what your event handler looks like?
guildMemberAdd does work fine too
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
Hmm, it looks correct at glance.
I am on v13 dev
let starboardChannel = reaction.message.guild.channels.cache.get('<ID>');
let starboardFetch = await starboardChannel.fetch({limit:100})
let exists = starboardFetch.message.cache.find(m => m.embeds.length >= 1 && m.embeds[0].title === '⭐ Starboard' && m.embeds[0].fields[0].value.match(reaction.message.id));
why do i get this error:
(node:9660) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' of undefined (on the let exists)
I got it to work
There's no "message" property in a collection
well, now it can't read property 'find' of undefined
Help me pls https://i.imgur.com/cX2yG0Z.png
console.log what starboardFetch is
a bunch of this
so much it covered my entire console and i cant see anything about it lmao
show how you're doing it
let starboardChannel = reaction.message.guild.channels.cache.get('871766974236098640');
let starboardFetch = await starboardChannel.messages.fetch({limit:100})
console.log(starboardFetch);
let exist = starboardFetch.cache.find(m => m.embeds.length >= 1 && m.embeds[0].title === '⭐ Starboard' && m.embeds[0].fields[0].value.match(reaction.message.id));
this is it really
remove .cache
collections don't have a cache
you already fetched those messages
welp
(node:48864) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 messageReactionAdd listeners added to [Client]. Use emitter.setMaxListeners() to increase limit (Use `node --trace-warnings ...` to show where the warning was created)
even more errors lol
...are you adding listeners inside commands?
idk if im being stupid or what
does anyone know why https://pastebin.com/d4j0Mrbk is creating a slash command but options are not a thing
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.
like uh
(the names dont matter cuz i changed the code after)
did you wait at least 1 hour?
you dont need to for guild slash commands
and even if i had to, it would create the command as a whole, it won't leave out the options but send the name and desc
Probably nothing, just giving general advice
Loads instantly (as long as your reload your discord)
As we figured out these days having the same issue clear your browser cache
ALL of the Discord cache
And/or try the commands on mobile
Index:
let set = new Set()
client.on('message', msg => {
if (msg.member.user.bot === true) return
let functions = require('./function')
functions.spamCheck(msg, set, 10000)
})
function.js
function spamCheck(msg, set, time) {
let bool = false
let user = { id: msg.author.id, time: Date.now(), times: 2 }
for (let u of set) {
if (isNaN(u.times)) u.times = 2
if (u.id === msg.author.id) {
bool = true
if (u.times >= 5) {
msg.reply(`Woah, not so fast!`)
} else if ((Date.now() - u.time) <= time) {
u.times++
u.time = Date.now()
}
}
}
if (bool === false) {
set.add(user)
}
}
Error:
TypeError: functions.spamCheck is not a function
Are you exporting the function?
ex ```js
// index.js
let functions = require('./function.js')
functions.myFunction()
js
// function.js
module.exports = {
myFunction() {
console.log("My Function used in a separate file!")
}
}
anyone? #development message
how does that work?
I linked the file and defined it as functions
You’re not exporting it
import "./functions"?
You need to export it to use in other files afaik
This
ah thx
in the index file?
In that example, index is just whatever file you need to use the function in
Also you should use require at the top of your code unless you’re dynamically loading something
I already tried require
What?
const functions = require('./functions')
yes but it doenst work too
where?
Look at this, you see where it says module.exports =?
That’s a way of exporting your function from that file
module.exports = {
myFunction() {
console.log("My Function used in a separate file!")
function spamCheck(msg, set, time) {
// if (msg.member.roles.cache.find(role => role.name === 'Muted')) return
let bool = false // the bool will be set to true if a member was found in the set object
// 'times' is the amount of messages
let user = { id: msg.author.id, time: Date.now(), times: 2 }
for (let u of set) {
if (isNaN(u.times)) u.times = 2
if (u.id === msg.author.id) {
bool = true
if (u.times >= 5) {
msg.reply(`Woah, not so fast!`)
} else if ((Date.now() - u.time) <= time) {
u.times++
u.time = Date.now()
}
}
}
if (bool === false) {
set.add(user)
}
}
}
}
Like this?
No
You don’t need myFunction()
That was just an example
Also when you’re in the scope of module.exports you don’t need to define your function with the function keyword
Instead of function spamCheck(), it would be spamCheck()
module.exports = {
spamCheck(msg, set, time) {
let bool = false
let user = { id: msg.author.id, time: Date.now(), times: 2 }
for (let u of set) {
if (isNaN(u.times)) u.times = 2
if (u.id === msg.author.id) {
bool = true
if (u.times >= 5) {
msg.reply(`Woah, not so fast!`)
} else if ((Date.now() - u.time) <= time) {
u.times++
u.time = Date.now()
}
}
}
if (bool === false) {
set.add(user)
}
}
}
like this?
Yes
thx it works
bool === false 😩
how can I pass window or document to my controller in ejs?
One of your commands export is fucked probably
ive checked through all of them
literally all of them
AND NOW ITS SAYING Encountered an error when trying to execute command.
BRUHRUHRHURUHRRH#
i give up
Is that your error handler?
Then you must have the actual error silenced then, print that I suppose
can someone body help it still redirects to next page even if the passwords dont match
<script>
var password = document.getElementById('register-password')
var repeat = document.getElementById('register-password-repeat')
var incorrect = document.getElementById('password-match')
function validateRegister() {
if(password.value && repeat.value && password.value !== repeat.value) {
incorrect.style.display = "block"
} else
if(password.value && repeat.value && password.value == repeat.value) {
incorrect.style.display = "none"
}
}
repeat.onkeyup = validateRegister;
</script>```
@wooden kindle dont ghost ping me, thanks.
there was a scam msg
then dont delete your message
one of those grabify links to free nitro
just leave it
okay sorry
You’re calling a var named validateRegister (which doesn’t exist) not the actual function
darn Discord mobile trash
hes assigning the function to the keyup event
Oh yeah you’re right, nvm then
i fixed it :))
Damn I wish Discord code blocks on mobile would be scrollable horizontal instead of forcing line breaks anywhere.
does any1 know how to make a help command with pages
Sure, pretty simple. Just array/list of pages.
On a button press just edit the message to the index of that page.
do you have any examples because i just dont understand it
Not on hand, there are a ton of examples online
would be better if you do:
function spamCheck(msg, set, time) {
let bool = false
let user = { id: msg.author.id, time: Date.now(), times: 2 }
for (let u of set) {
if (isNaN(u.times)) u.times = 2
if (u.id === msg.author.id) {
bool = true
if (u.times >= 5) {
msg.reply(`Woah, not so fast!`)
} else if ((Date.now() - u.time) <= time) {
u.times++
u.time = Date.now()
}
}
}
if (bool === false) {
set.add(user)
}
}
module.exports = spamCheck;
Another file:
const spamCheck = require('../../path/to/function');
spamCeck(params, of, function);
its not my function, i just copy-pasted to show an example 💀

do you guys know any way to disable the automatic packaging on replit
function name: spamCheck
function u were calling: spamCeck
:dog_kek:
bruh its typing error
don't use replit
😆
im broke what else would i use
a vps or a rdp
u think 2 GB is good enough to host a discord bot
because i want to stop using a VPS and start self hosting
Define "self hosting"
raspberry pi
yea
yessir
Well, some people here managed to run on it
But you need to make some sacrifices
Like with caching
because the VPS i use RN is 3GB and im gonna downgrade by 1gb so it aint much
does raspberry pi have google
Pi is just a mini computer
ahh i see
yea im only gonna have it to update very small things
or should i just update the repo and copy it from there
No, i mean, leave coding to outside resources
Or if it's just a quick fix use a text editor
Like nano
should i just keep VSC open to use that as a terminal or no
No, forget vsc please
okk
i see
If possible don't even install graphical version of the OS
Too much space used for little advantage
vsc would take up like 25% of your ram available on the pi just from running it
You want to maximize available space and ram for your bot
Bot first
Everything else is disposable
ok
is heroku good?
Depends for what you need
Alright
It's like asking if a potato is good
What is the language for your bot @earnest phoenix
Nutritive? Yes
Can win a soccer game? Don't think so
@paper frigatediscord.js node.js making on repl
Alright
This here is what I suggest,
Unless you make an API yourself
If it looks good, yeah
@paper frigatewhich type of ip
just use embeds and stuff
?
i just need it to host a bot 24/7
@paper frigate
To interact with Discords API and YouTubes
What language?
@paper frigatehow i will get it
python
@paper frigate how i get api of youtube and discord
Hey @earnest phoenix! I'm glad you are interested in learning about nodejs development but this isn't the place for it, this is for minor help on ongoing projects and such
I'd be happy to send you some links with information on learning if you'd like
This is a site I send to most people starting out, it's got most of what you'll need to get going
There's also a bunch of somewhat low cost courses on udemy, just check the reviews first
in C, how can I read a black and white bmp file, and detect if it is completely white?
hey
so umm, how do i enable json1 extention on sqlite on grafana?
i basically have a json column to be used in where clause
yeah, just checked their github
Uncaught Promise Error: TypeError: Cannot read property 'user' of null
in some servers it gives the name in others it shows this
(python) i added this bot status code to it and now it is saying that the keep alive row is incorrect when it wasnt before?
lol
see bot.run
u forgot )
req.session.user = user;
return res.redirect('/account/management/dashboard')
}
}
admin(req, res) {
console.log(req.session)``` req.session dosent return user in admin
huh
that doesn't really make any sense @earnest phoenix
can you copy and paste the full code?
it should detect when user has a role, but it always returns false
Is there any idea about how can I solve this problem?
You're only going to get the reply to trigger if the member doesn't have the role. Is that what you want to do?
Remove the exclamation from the if statement
ye
That's saying "if the user doesn't have the role, reply to the message with "cancel that"
yeah, i tried with find but that didnt work too
So the role id is correct? You're sure about that?
Sorry i should have seen that immediately 😂 it's too early
let role = message.mentions.roles.first() || await message.guild.roles.cache.get(role.id)```
ReferenceError: Cannot access 'role' before initialization
when I put a role = ID it is not work
role.id you try to access the variable before it's initialized
like that
what
You need to change the variable name
but how
What do you want to do exactly...
same thing
resolve a problem
that's very descriptive ....
I need help with some mongoDB questions
So I already saved this in my mongoDB Database
prefix: "="
guild: "my guild id"
``` Now , how do I push and change the old prefix to the new prefix I set from a command
JS?
which driver are you using?
node.js
i mean like mongoose, monk, etc
mongoose
Just a quick question - if I want people to be able to connect their discord account to my website (say for a bot dasboard) would I throw the oauth on the same discord application as the bot or create a new application
https://sourceb.in/WqO7se9u1n this is my current setprefix command
@narrow sedge should be await MongooseModel.updateOne( query_to_get_the_doc, { $set: { prefix: newPrefix} });
the query should be like { guild: <guild>.id }
i guess im not sure what youre querying over
Yup it worked! Thanks for helping me :3
I query the guild id
Did somebody used vuepress with @discord-message-components/vue
anyone use socketio?
I have used it, why's that?
do you know how i can proxy pass a socket connection to a second service?
like web -> api gateway -> comms
how can i connect to comms through api?
I didn't get quite that advanced sorry
with nginx?
np haha
so you have a nodejs and want to proxy to another nodejs?
yeah
im already using it to proxy other routes
but not sure how to proxy ws
from the web i call api with the port and stuff, i needs to redirect that connection to comms
have you tried one of those proxy libs from npm?
nop, my api gateway is fast-gateway, there isn't much middlewares around it
trying to find a workaround and see if i can pass it manually or something
i think im using a proxy itself actually, but for routes
hmm
i guess the only way would be using requesthooks
you can intercept a request in the gateway, and if its a websocket, you can create a socket connection
i dont know if you can redirect the whole thing to comms you might need to create a socket in the gateway itself
can you access comms from the web? is it publicly accessible?
if so you can make a redirect instead of a proxy
ideally i dont want to allow comms to be accessible publicly hence the api gateway
i just read fast gateway github
they dont have ws support
sad
node.js isn't a vallid command
Oh
Node .
^^
done everything but need help on how to put welcomes in. Because i am stupid!
const banned = await message.guild.fetchBans();
Why this is err🥲
Is it even allowed by gooogle TOS?
What this mean
Probably not if i making money of out it
I don't know. Best to read Discord's TOS and Gmail TOS
Also what's the use case scenario?
@rose warren but thats not what i meant
Why not just DM the person?
For someone who left discorf
Why use a command to send an email?
If they left Discord without giving anyone details on how to contact them, that's probably for a reason.
Yea, someone will also gonna increased trust level
I just think it's an invasion of privacy and could also be maliciously used
But i still wanna make a bot with third party support like gmail
Even if it's not against TOS it doesn't mean it's a good idea
Also are cloud storage via discord is on at least not death topic?
How can I check if the bot's highest role is higher than another user he tries to kick? I mean if the role hirachy is high enaugh to make something
You mean member
there is a position property on a role
member.manageable
or that
It depends on what language you're using
bot's role too.
Read the docs I sent
how can i get the voice channels my bot is connected to? i’m using discord.js
in v12 its client.voice.connections
that will give you a collection of VoiceConnection
which have .channel properties
Just can i get the answer 😅
thank you!
let me check docs
which version are you using?
how do i make an anti-nsfw system,
like what api should i use 
throw e;
^
Error: \\?\C:\Users\sakit\Documents\Flame Bot v12\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\\?\C:\Users\sakit\Documents\Flame Bot v12\node_modules\better-sqlite3\build\Release\better_sqlite3.node```
wot
how do i correctly define a directory for my config.js
my setup is Main file + the node modules and everything that you get at the start > commands > information > help.js
i have tried so many different things but its not working
it should be .../ right?
just code it :3 thats how mine is
how?
check if the channel is nsfw or not and work accordingly
how do i check if the image is nsfw?
idk if you can scan images like that but you can filter nsfw commands
im asking how to check if an image is an nsfw image
ye idk if thats possible :3
probably exists some 3rd party modules
true true
you look at it, if it has bewbs it is nsfw, if not, it not nsfw
bruh
build a program where you sit down look at and check every image being sent
you might be able to find some high tech api for it but ik ive never seen it done lol
Though discord have setting for it. I did set up the nsfw filter on for my server
no need code etc
lol
i found this
https://github.com/infinitered/nsfwjs
im not familiar but i'm sure theres some docs
yes
¯_(ツ)_/¯
monika ily
no
rejection
i don't exist
you do in my world
sure (we're ot here)
loll
well imma go back to remaking my bot from scratch so top.gg cant decline it for the millionth time
have fun
I need help making the bot say that he doesn't have the permission to kick people, i know it's dumb but client.hasPermission doesnt seem to be a thing
it would be !kick {username}
the rest is working but i've noticed that if my bot for some reason is missing the permission to kick people it crashes
this is not a thing i think
its not the client needing permissions
its the user using the command
try something like this
if(msg.member.hasPermission("KICK_MEMBERS"))
I know, i've made it that if the user making the command doesn't have permission the the bot says that he's not strong enough, problem is that if my bot doesn't have permission it crashes
<message>.guild.me
Then is there a way to make the bot that he doesn't have permission either, like if someone removed him the permission to kick people?
@earnest phoenix got something for you
reason = [{"264445053596991498":"test"},{"264445053596991492":"test"}];
result = reason.find((element) => element["264445053596991498"]);
will return the found element, an object in this case
How would I return it's obj.values as "one-liner"?
I mean getting obj.values of result is boring... is there a one line solution also respecting if find returns undefined?
it should be the bot's perms you are checking
hasPermission isn't up to date anymore, but ...permissions.has(...) is
so it just got updated
so it'll be more like this
is .me a thing?
yes
yes
let a, m = (a = reason.find((element) => element[...])) ? Object.values(a) : undefined;
oh damn yeah, makes sense lol 👍 ty
What does the var m represents?
Thanks guys, it's now working
Oh err ok I see
help :3
idk why it wont let me define the dir right
ive tried so many things
That sexy tohsaka distracting
LOL sorry
how do u read that bruh
watchu mean
its bullying my eyes
can someone help me with discord buttons?
lool
../config.json double dot
lemme try
i had to start over so i need help from the start...
still failed ayeven
ok with?
wtf are you doing? If you wanna jump to the parent folder use ./../config
buttons
bruh lemme try
yes but wdym
u can use a library, discord.js-buttons
still failed
ok
show the code
Looking at your screenshot your path the commands is in two subfolders?
/commands/informations/help.js?
If so you will have to chdir 2 times
Can't see the full path on your screenshot, but if so, ./../../config.json
../ means parent folder, if you need to jump 2 folders, than use it 2 times
true true tysm
./ means relative to the current file location
yuh
That would lead to an error
i hate when my bot doesnt work but doesnt error oml
time to spend 3 hours finding the issue
that's why you catch the errors and print them or log them at least
ive tried but sometimes even that fails
no shit
how do i make a subdomain that redirects to a bot invite
like i have a domain example.xyz which is redirected to github pages with cname but how do i make invite.example.xyz to redirect to a bot invite
make invite.example.xyz a cname to the invite page
i cant enter that large invite in my value
It should allow up to 250 chars.
The common auth URL is around 100 or something
https://discord.com/api/oauth2/authorize?client_id=xxx&permissions=xxx&scope=bot%20applications.commands
im temporally using freenom for testing and its isnt allowing
welp
You can't use CNAME to redirect to urls only domains
use a web server that redirects to the invite
^
alr ty
Actually
In the Domain Name System, a Uniform Resource Identifier (URI) record (RFC 7553) is a means for publishing mappings from hostnames to URIs.
This might work
is it right that inside an object property, this is undefined, while inside an object property that is a function, this will return the object?
Of course you can, you don't add the protocol to the record
which would effectivly be:
discord.com/api/oauth2/authorize?client_id=xxx&permissions=xxx&scope=bot%20applications.commands
that's a valid URL, too just missing the protocol
how are you going to access this inside a property when not being in the object scope
const obj = {
name: 'objectName',
description: 'an object',
values: this
}
const obj = {
name: 'objectName',
description: 'an object',
values() {
return this
}
}```
No you can't you can only redirect to a domain or subdomain, eg discord.com https://en.wikipedia.org/wiki/CNAME_record
A Canonical Name record (abbreviated as CNAME record) is a type of resource record in the Domain Name System (DNS) that maps one domain name (an alias) to another (the canonical name).This can prove convenient when running multiple services (like an FTP server and a web server, each running on different ports) from a single IP address. One can, ...
that's a valid URL, too just missing the protocol
I hope the code I just sent provides the answer
CNAME Isn't for urls, it's for domain to domain
god damn, you actually don't even understand what I quoted
console.log(this); // window
const obj = { whodis: this }; // { whodis: window };
obj.whodisFunction = function() {
return this; // obj
}
Since you can't read wikis, here's cloudflares dns verification explaning it
use a web server that redirects to the invite link
^ or https://en.wikipedia.org/wiki/URI_record which cloudflare at least does seem to support (you can always point your freenom domain to cloudflares free dns)
In the Domain Name System, a Uniform Resource Identifier (URI) record (RFC 7553) is a means for publishing mappings from hostnames to URIs.
well I have almost the same, but my window is just an empty object
But okay, if I want to access the object inside an object, that should be in a function
I think we should let astrex test the cname configuration to see if it works instead if arguing about it
Yes
okay thanks
btw, if I'm using slash commands and I want different choices inside an option for each guild, do I have to make that command guild specific?
for example, the choices of the option are all members with admin perms
or does the API provide a way to have dynamic options inside a global command?
You get the data from the interaction
So they don't need to be guild specific
You handle the interaction data similarly to how you handled message args
No, I mean that they can choose from one of the admins from a dropdown menu
I haven't tried dropdowns but I imagine you can get that data dynamically and populate the dropdown with it
or maybe I don't understand the slash commands yet, I will make an example and screenshot it
that would be very helpful tho
I'd say read the docs and see if you can do a for loop around the list of admins to populate the menu
I read the docs on the dev portal, but will look at discord.js.org. Thanks
{
name: this.name,
description: this.description,
options: [{
name: 'title',
description: 'The title',
type: 3,
required: false
}, {
name: 'description',
description: 'The description',
type: 3,
required: false
}, {
name: 'colour',
description: 'The colour',
required: false,
type: 3,
choices: [{
name: 'red',
value: '#FF0000'
}, {
name: 'green',
value: '#008000'
}, {
name: 'blue',
value: '#0000FF'
}, {
name: 'yellow',
value: '#FFFF00'
}]
}, {
name: 'image',
description: 'The url to an image',
type: 3,
required: false
}
]
}```
this is what I mean. Of course, it isn't about the colours
Oh those are command options
yes
I thought you meant the dropdown selector
oh the select menu's?
hmm that could be an option too, but this would be nicer and user-friendlier
Sure. I just don't know what you're trying to do it for.
I thought you were talking about the select menus 😂
😅
np
I'm not sure if that's possible.
But one way to do it would be to have the slash command without it.
Send a message response letting them select menu.
Practically the same experience for the user.
But I know you can pass roles and channels as args so I guess there's probably a way to do it
I've had about 10 minutes experience with v13 so far so I'm not much help
I've only adapted my ping command so far
I asked it in the DDevs server, it will be added to slash commands so it would be a waste of time to do it with select menus now
New option types: Autocomplete - choices populated dynamically by the applicaiton
https://github.com/discord/discord-api-docs/discussions/3581
lmao then I'm 1 day ahead of you, yesterday that was my progress
I did all/most args free commands now
I'm currently investigating, too building a new command handler as we got 9 months to so, only 
Not sure what type of bots Discord will whitelist in the future requesting the message.content privilege
oh yes I did that too lol
It's a bit of work but in the end it will be better I think
oh I believe that
Well the slash commands aren't a bad thing at all tbh
Already quite ahead with slashies
imagine not having a slash command handler 
imagine seeing the duck as an apple
lmao same
imagine not being a duck
anyways offtopic to development 
yeah, I'm aware of this, but
We know that many bots and apps function specifically to read, moderate, and otherwise manage messages sent by Discord users. We expect to grant those requests for message content without issue.
If your bot has unique functionality that cannot be replicated or otherwise implemented with interactions, you can begin applying once we open the queue for this intent in fall of 2021.
... can be interpreted very differently
just add a function that will delete messages containing "f*ck" and you're safe ;)
It like the question, does your bot really require to read other's member message to functioning
Yes, as I need to report the messages to the NSA.
obviously, how else would I sell conversation data to google?
xd

Imagine making an AI that learns off Discord conversation data 
🤯
That poor AI, need to learn from
trash
bullshit
meme
trash
actual good content
trash
meme
meme
...
That's the point 😂
Discord ML AI bot will end humanity
It will deem the end of human existence necessary
Why does it say Cannot read property 'includes' of undefined
then config.globalBannedUsers is not defined
it is
log config and you will see the issue :)
listed with an id
the error say otherwise, so log it and trace from there
wait lol
well the console says it's undefined 😅
I misspelled users
lol
There we go, logging the var is always the first attempt to see what's going on
declaring the var outsite of your loop
o
let yano = false;
loop { yano = true }
console.log(yano);
and using var
🤌
and here's me, iterating over the whole portuguese dictionary to gather data for my game
nope
wierd.... still doesnt reply..
4b
better don't think about it, the amount is necessary
just took ~ 15 days to generate as you can see 
and the index is bigger than the actual data
Would have been faster if I would have 800GB of RAM available of course
Yes, table - 3 cols - 2 are indexed because they are hashes
That's the cause of the huge index size

On Pins, it says how long it was. How does he do this API?
Oh.. timestamp snowflakes
???

