#development

1 messages Β· Page 1673 of 1

solemn quartz
#

then wait a sec

vivid fulcrum
#

Angular is arguably the most advanced frontend JavaScript framework ever created. Learn the basics of Angular in 100 Seconds. https://fireship.io/courses/angular/

Docs https://angular.io

#webdev #js #100SecondsOfCode

Install the quiz app πŸ€“

iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://play.google.com/store/ap...

β–Ά Play video

React is a little JavaScript library with a big influence over the webdev world. Learn the basics of React in 100 Seconds https://fireship.io/tags/react/

How I make these Videos https://youtu.be/N6-Q2dgodLs

#react #webdev #100SecondsOfCode

Install the quiz app πŸ€“

iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://p...

β–Ά Play video
#

i definitely suggest watching these

lament ruin
#
const Discord = require('discord.js')

module.exports = {
    name: 'approved',
    run: async (message, args) => {
    const sayMessage = args.join(" ")
    let embed = new Discord.MessageEmbed()
    .setTitle("Approved")
    .setDescription("has been approved")
    .setColor("#00ff00")//it's aco's green color hehe


        message.channel.send(message.mentions.members.first(),embed)
    }
solemn quartz
#

@frigid mountain
This is it

const Discord = require('discord.js')

module.exports = {
    name: 'approved',
    run: async (message, args) => {
//Mention
function getUserFromMention(mention) {
    if (!mention) return;

    if (mention.startsWith('<@') && mention.endsWith('>')) {
        mention = mention.slice(2, -1);

        if (mention.startsWith('!')) {
            mention = mention.slice(1);
        }

        return client.users.cache.get(mention);
    }
  }
    const sayMessage = args.join(" ")
const approved = getUserFromMention(args[0])
const approvedM = message.guild.member(approved)
    let embed = new Discord.MessageEmbed()
    .setTitle("Approved")
    .setDescription("<@" + approvedM.id + ">" + " has been approved")
    .setColor("#00ff00")//it's aco's green color hehe

       
        message.channel.send(embed)
    }
} 
slender wagon
solemn quartz
#

wait

slender wagon
#

i think i will go with react people suggest it to me alot

lament ruin
solemn quartz
#

Yep

#

Fixed it 2 times but now it is

lament ruin
#

oh wait, i wanted to reply my own message

solemn quartz
#

Wait what

solemn quartz
#

i was talking to @frigid mountain

lament ruin
#

ik

#

but i think that the thing i sent could be a solution too

frigid mountain
solemn quartz
#

yeah but the way i sent it is the best i think, not sure tho

solemn quartz
#

does it work?

frigid mountain
#

Not really

#

But it's working

solemn quartz
#

send a pic

#

of what is it not doing

slender wagon
#

@vivid fulcrum sorry for the pong but would ejs be a good option too?

vivid fulcrum
#

of course

#

i never personally messed around with it

solemn quartz
slender wagon
#

oh alright

solemn quartz
vivid fulcrum
#

i would still recommend using a UI framework/library like react though

#

it's very good for complex and/or multi page apps

tender garnet
#

hi what if someone doesn’t have Nitro and using animate emoji with help of bot (bot creates web-hook of that author name and post with animated emoji) << is this cool or against discord TOS?

vivid fulcrum
#

it's allowed

slender wagon
#

EJS IS FIRE!

#

easy af

solemn quartz
#

Guys i need help, i (maybe) figured out how to make the bot edit a message, but i need help making it edit the msg after a certain amount of time

#

so how do i do that?

slender wagon
#

interval or something

solemn quartz
#

interval makes it a loop

#

i think

slender wagon
#

give me a moment

solemn quartz
#

k

slender wagon
#
.then(msg => {
solemn quartz
#

what

slender wagon
#

you need a timeout actually

solemn quartz
#

yeah

slender wagon
#
.then(msg => {
      msg.delete({ timeout: 5000 })
    })

here is a message delete case

solemn quartz
#

ok thank you

#

@slender wagon doesn't work

#

i mean, should this work?

tulip ledge
#

message.channel.send("Lol").then(msg => msg.edit("Test", { timeout: 10000 })

solemn quartz
lapis flame
#

how to create a space between these words if (command === 'help' + 'balance') I want that the command will be !help balance but as is now it is !helpbalance I have already tried if(command === 'help' + ' ' + 'balance') and if (command === 'help balance') but still nothing

tulip ledge
#

You want to work with arguments

#

Do you have arguments defined?

lapis flame
#

nope

solemn quartz
#

@tulip ledge doesn't work

#

it sends an error

tulip ledge
#

Show me your code

solemn quartz
#

wait

tulip ledge
#

and the error

summer torrent
solemn quartz
tulip ledge
#

u need to put another ) behind the line of code

solemn quartz
#

oh wow

#

thank you

tulip ledge
solemn quartz
#

Thank you! It worked

tulip ledge
#

np

solemn quartz
#

but how to do it if i want the message to get edited multiple times?

#

do i need to just add && ?

tulip ledge
#

u want to edit it again?

solemn quartz
#

yeah

#

like do you know the dank memer soccer thing? that the goalie moves around

tulip ledge
#

theres 2 options:

  • You add more .then() callbacks (which just makes it callback hell so I wouldn't recommend doing this)
  • You work with async/await
solemn quartz
#

well i got the async

#

but could you give me an example?

slender wagon
#

no he means just add more .then

lapis flame
tulip ledge
solemn quartz
slender wagon
#

aye cunt tf is wrong with u

tulip ledge
#

so await basically makes it so the js code "stops" and waits for the promise to resolve right, and when you send a message it's a promise as it takes time to complete

solemn quartz
#

i was literally bout to say "Not to be rude" but i cant even talk

tulip ledge
#

alright?

solemn quartz
#

hmm

slender wagon
#

yeah i wouldn't say that at all but anyways

solemn quartz
#

sorry ig

tulip ledge
#

So what you want to do is assign you sending a message to a variable while also awaiting with sending the message and then after that u can edit that variable using await <variable>.edit() get it?

solemn quartz
#

I just want the message to get edited multiple times

#

thats it

tulip ledge
#

yes I'm tryna put u on the right lead here

#

have u ever used async await?

solemn quartz
#

actually no, lol

tulip ledge
#

it's like what u did up here

solemn quartz
#

yeah i saw that from a yt tutorial

tulip ledge
#

u say

let msg = await message.channel.send(...); // Send ur initial message
await msg.edit(...); // Edit it
solemn quartz
#

i just added async at the message thing and then copy pasted that line

tulip ledge
#

And u can repeat the msg.edit as many times as u want

solemn quartz
#

Yeah but there is no timeout

#

so just like this?

if (message.content.toLowerCase().startsWith(config.prefix + "test")) {
let msg = await message.channel.send('test1'); 
await msg.edit('test2', {timeout: 50000});
await msg.edit('test3', {timeout: 50000}); 
}```
tulip ledge
#

should work yes

solemn quartz
#

just tried it, doesnt work

tulip ledge
#

that's weird

#

I guess

#

u stack callbacks then

solemn quartz
#

nevermind

#

it works

#

it didnt work with 120000 timeout but with 50000 it did

opal plank
#

you do know thats in ms right?

#

so thats 2 minutes

#

did you ACTUALLY wait for those 2 minutes to pass by?

solemn quartz
#

no?

#

120000 are 2 seconds

opal plank
#

no my dude

#

its in milliseconds

solemn quartz
#

yeah

opal plank
#

120000ms = 120000/ 1000 = 120 seconds = 2 minutes

#

math do be hard sometimes

solemn quartz
#

wait a second

#

maybe i didnt save when i changed it from 50000 to 120000

opal plank
#

for it to ACTUALLY edit the message, you should've waiting 2 minutes until it actually executed the edit

solemn quartz
#

no it works

#

it does it in 2 seconds

opal plank
#

then you arent sending the whole thing

solemn quartz
#

now ill add another 0 and i'll see

opal plank
#

also

#

my dude

#

i dont think edit() can take that timeout

#

its usually for delete()

#

just do this instead

solemn quartz
#

wait what

#

i added another 0 and nothing changed

#

wtf

opal plank
#
setTimeout(async () => {await msg.edit('blah')}, 120000)```
this is the equivalent of you're trying to do
#

use that instead[

#

it should wait for 2 minutes

#

replace your msg.edit() with that

solemn quartz
#

thank you, lemme try it

zenith terrace
#

@opal plank h moment

opal plank
solemn quartz
#

so this should be good?

opal plank
#

yeah, that

solemn quartz
#

wait i cant

opal plank
#

why not?

solemn quartz
#

the msg await isnt in the async function

opal plank
#

doesnt matter

#

thats what await is for

solemn quartz
#

it gives an error lol

opal plank
#

just do msg!

#

its cuz its inside a function

#

msg!.edit....

solemn quartz
#

cant i just do this

opal plank
#

no

solemn quartz
sage bobcat
#

One message removed from a suspended account.

opal plank
#

dont write more than 1 event listener

opal plank
sage bobcat
#

One message removed from a suspended account.

opal plank
#

u 2

solemn quartz
opal plank
#

cuz you getting an error?

opal plank
sage bobcat
#

One message removed from a suspended account.

opal plank
#

you do

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

zenith terrace
#

lol

opal plank
#

setTimeout(Function, timeout)

#

function needs to be async for it to use await keyword

#

if you dont explicitly state it, it'll simply error with cannot use await outside of top level expression

quartz kindle
#

interesing find of the day: js functions are fast

#

its faster to make a ton of small functions than few big functions

opal plank
#

@quartz kindle Should make a book of useless things probably nobody is ever going to remember or use, make it 3 volums long and make it so when they are side by side, the image shown says embed builders are bad

quartz kindle
#

lmao

#

check out this shit

#

ignore the undefined things, i only defined what im testing

#

this shit made my function 30% faster

#

than putting all of this inside a single function

#

this is the big function before

#

isolating the switch cases and the ifs into their own functions made it 30% faster wtf

opal plank
#

so we were wrong all along by telling people to use command handlers

quartz kindle
#

command handlers are good precisely because you're isolating each command into its own function

#

but you get more mileage if you isolate each conditional step into its own function

#

this is basically C-style functional programming

fierce ether
#

would <error>.type return the type?

quartz kindle
#

i dont think an error object has a type property

fierce ether
#

does every error have a type though?

quartz kindle
#

they have name

fierce ether
#

what would it return, do you know?

quartz kindle
#

where?

fierce ether
#

so if its an api error? it would return DISCORD_API_ERROR?

quartz kindle
#

depends what you want to do

#

there is no right or wrong way, you literally chose how you want to do it

fierce ether
#
    error({message}, error) {
        if (error instanceof Error) {
            const createErrorEmbed = new FailureE()
                .setTitle(error.name)
                .setDescription(error.message)``` its only a function for handling errors
quartz kindle
#

looks fine

fierce ether
#

ok thx

hoary crown
#

hmm

#

i can't get it to work

#

it's in typescript

opal plank
#

@hoary crown you gotta transpile first

#

either use tsc transpiler or install ts-node lib

fierce ether
#
    uncacheGuilds() {
        each([...this.client.guilds.values()], guild => {
            if (guild.id === this.config.guild) return;
            if (!utils.regionEnabled(guild)) {
                this.client.uncacheGuild(guild.id);
            }
        });
    }```
#

this would uncache guild correct?

hoary crown
opal plank
hoary crown
#

i installed it but it doesn't wrok

#

work

opal plank
#

cuz u clearly didnt use it

opal plank
#

or if you installed it globally

#

just use ts-node src/index.ts

quartz kindle
#

those functions are not built-in

fierce ether
#

whats best way to cache guilds then?

opal plank
#

just do ts for(let guild of [...client.guilds.cache.values()]) delete guild
done

#

dont do that tho

quartz kindle
#

you cant delete it like that lul

opal plank
#

why do you want to uncache guilds?

opal plank
quartz kindle
#

dont do !== doesnt work

#

xD

opal plank
#

aight fine

#
for(let guild of client.guilds.cache.keys()) client.guilds.cache.delete(guild)
#

happy now?

quartz kindle
#

:^)

opal plank
#

keys()

#

not values()

quartz kindle
#

oh

#

you got me

opal plank
#

gottem

#

that'd still not remove the reference iirc

quartz kindle
#

what ref?

zenith terrace
#

even tim got outplayed??

opal plank
#
for(let [key,val] of client.guilds.cache.entries()) {delete val; client.guilds.cache.delete(key)}
#

the object should be referenced no?

quartz kindle
#

nah

opal plank
#

delete() will just remove it frmo the map

#

not the object itself

quartz kindle
#

the object will be garbage collected

opal plank
#

hmmm

#

i guess

drifting shell
#

https://github.com/missive/emoji-mart anyone know something in a similar appearance to this that's useable in normal JS as I'm not using react

GitHub

One component to pick them all πŸ‘ŠπŸΌ. Contribute to missive/emoji-mart development by creating an account on GitHub.

#

i found some jquery ones but the physical appearance of them is....lacking

stark abyss
#

How can I get my bot to leave all the servers

lament ruin
stark abyss
#

ok thx

lament ruin
#

just loop through all the guilds

#

and do that

stark abyss
#

alright

fierce ether
#
    client.guilds.add(guild);
                  ^

TypeError: client.guilds.add is not a function```
#

never seen this before?

earnest phoenix
#

Is there a way that my kick command won't let me kick myself?

#

Like sends the message error: You cannot kick yourself.

zealous pelican
#

if(args[0 or 1] === message.author.id) return mesage.reply(''You cannot kick yourself)

earnest phoenix
#

Ahh okay.

#

Thank you.

zealous pelican
#

:D

earnest phoenix
#
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.609 s
[INFO] Finished at: 2021-03-27T21:27:34-04:00
[INFO] ------------------------------------------------------------------------```
#

Praise it

#

While it lasts

#

roast my code

scenic kelp
summer torrent
#

imagine not using formatter

drowsy epoch
#

To change the top link?

#

using meta

thin echo
#

What do they mean by, β€œan I modified version of a bot”?

earnest phoenix
#
const embed = new discord.MessageEmbed()
                              ^
TypeError: Cannot read property 'MessageEmbed' of undefined
at Manager.<anonymous> (/app/src/index.js:49:31)
    at Manager.emit (events.js:196:13)
    at Node.trackStart (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/erela.js/2.3.2/node_modules/erela.js/dist/structures/Node.js:228:22)
    at Node.handleEvent (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/erela.js/2.3.2/node_modules/erela.js/dist/structures/Node.js:206:18)
    at Node.message (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/erela.js/2.3.2/node_modules/erela.js/dist/structures/Node.js:190:22)
    at WebSocket.emit (events.js:196:13)
    at Receiver.receiverOnMessage (/rbd/pnpm-volume/6aa01aae-6f57-434c-8446-c7b36c7ba822/node_modules/.registry.npmjs.org/ws/7.4.4/node_modules/ws/lib/websocket.js:825:20)

#

?? What is this πŸ™„

earnest phoenix
summer torrent
#

what is discord

lyric mountain
#

a miserable little pile of bugs

earnest phoenix
spare portal
#

how do you do multiple attachments? im trying to use 2 different local files for a thumbnail and main image respectively

const attachment = new Discord.MessageAttachment(`./cards/${vv+ss}.png`, `${vv+ss}.png`);
const attachmentB = new Discord.MessageAttachment(`./cards/back.png`, `back.png`);
const embed = new Discord.MessageEmbed()
    .setTitle(`${valNames[posValues.indexOf(vv)]} of ${suitNames[posSuits.indexOf(ss)]}`)
    .attachFiles(attachment, attachmentB)
    .setImage(`attachment://${vv+ss}.png`)
    .setThumbnail(`attachment://back.png`);
msg.channel.send({embed});

but this only shows the title and main image, no thumbnail

#

is the .attachFiles section not formatted correctly?

earnest phoenix
#

@earnest phoenix fixed

#

And have you added const Discord = require('discord.js')

earnest phoenix
#

K.

spare portal
#

okay in response to my problem i figured it out for anyone who's also having that problem

#

you cant attach multiple in one function for some reason

#
.attachFiles(attachment)
.attachFiles(attachmentB)
.attachFiles(attachmentC)
#

you have to do this

#

which i mean you would probably only need two, one for image one for thumb

lyric mountain
#

that's one of the issues of accepting an arbitrary amount of params Β―_(ツ)_/Β―

pale vessel
#

it's called attachFile"s"

spare portal
#

in full i did attachFiles(attachment, attachmentB)

pale vessel
#

@spare portal have you tried attachFiles([attachment, attachmentB])

pale vessel
fierce ether
#
        error ({ t, message, channel, prefix }, error) {
        if (error instanceof Error) {
            const createErrorEmbed = new FailureE()
                .setTitle(error.name)
                .setDescription(error.message)

            return channel.send(createErrorEmbed)
        } 
        console.error(error)
    }
    }``` never sends embed for error always just sends console error
pale vessel
#

then error isn't an instance of Error

fierce ether
#
module.exports = class CommandError extends Error {
  constructor (message) {
    super(typeof message === 'object' ? 'EMBED_ERROR' : message)
    this.embed = typeof message === 'object' ? message : null
  }
}```
#

thats Error

pale vessel
#

what's the error

fierce ether
#

throw new Error(t(opts.errors.guildOnly))

autumn dust
#

help me
when i try to install sodium it gives me this err

PS C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master> npm i

> sodium@3.0.2 preinstall C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium
> node install.js --preinstall

MS Version: 2019
C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:312
    console.log('Invalid msvs_version ' + msvsVersion + '\n');
                                          ^

ReferenceError: msvsVersion is not defined
    at errorInvalidMSVSVersion (C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:312:43)
    at checkMSVSVersion (C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:329:9)
    at Object.<anonymous> (C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:353:5)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! sodium@3.0.2 preinstall: `node install.js --preinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sodium@3.0.2 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\justi_8vy6ryi\AppData\Roaming\npm-cache\_logs\2021-03-28T05_58_32_720Z-debug.log
PS C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master> 
earnest phoenix
#

PS C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master> npm i

sodium@3.0.2 preinstall C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium
node install.js --preinstall

MS Version: 2019
C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:312
console.log('Invalid msvs_version ' + msvsVersion + '\n');
^

ReferenceError: msvsVersion is not defined
at errorInvalidMSVSVersion (C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:312:43)
at checkMSVSVersion (C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:329:9)
at Object.<anonymous> (C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master\node_modules\sodium\install.js:353:5)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! sodium@3.0.2 preinstall: node install.js --preinstall
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sodium@3.0.2 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\justi_8vy6ryi\AppData\Roaming\npm-cache_logs\2021-03-28T05_58_32_720Z-debug.log
PS C:\Users\justi_8vy6ryi\Downloads\MuDiBot-master\MuDiBot-master> node install.js --preinstall

autumn dust
#

Β―_(ツ)_/Β―

#

it dosent let me install sodium

harsh roost
#

@everyone

earnest phoenix
#

I am creating a guildCreate event
I wrote .addField("Server owner", `${guild.owner.user.tag}`) so it's giving me error
Cannot read property of user?

pale vessel
#

The guild owner isn't cached

#

Fetch it by using guild.members.fetch(guild.ownerID)

#

It's a promise so you have to await it

earnest phoenix
#

how would i get the dbl api?

prisma wren
#
    name: 'help',
    description: "This command will provide you with some assistance.",
    execute(message, args, Discord) {
        const newEmbed = new Discord.MessageEmbed()
        .setcolor('#e10600')
        .setTitle('Greedy Lobster Help Menu')
        .setURL('discordinvite')
        .setDescription('You may see a list of commands with help for them in this embed.')
        .addFields(
            {name: '?ping', value: 'It is a simple command that does nothing but respond to you with Pong! :ping_pong:'}
        )
        .setFooter('Join the support server for additional help :)')

        message.channel.send(newEmbed);
    }
}

I am using JavaScript and did the node thing. When I ran the command in my server, it gave me an error at, const newEmbed = new Discord.MessageEmbed(). I can send the main.js bit if it'll help. I've also tried to uncapitalize the 'm' in MessageEmbed, but it gives the same error.

earnest phoenix
#

do you have a const Discord = require('discord.js')

prisma wren
#

yes

earnest phoenix
#

@prisma wren remove discord just use MessageEmbed

prisma wren
#

k

pale vessel
#

you never sent the error

prisma wren
earnest phoenix
#

@prisma wren do want I said

prisma wren
restive furnace
#

you just hided the real error

delicate shore
#

I wanna mass delete Something with MongoDB
I have a schema - "user info"
It has an element voter
i want to set ALL RECORDS's voter element to false

#

Any way to do it

#

I remember someone told me how to do that but I forgot

restive furnace
#

updateAll

#

ig

delicate shore
#
userinfo.update({"voter": yes}, {"$set":{"voter": no}}, (err, writeResult) => {});

This won't work pandasad

#

But it still doesn't work

blissful cliff
#

what are you trying to get out of it? the callback is empty

delicate shore
#

wait

#
const mongoose = require('mongoose');

const userinfo = new mongoose.Schema({
    prefix: {
        type: String
    },
    voter:{
        type: String
    },
    premium:{
        type: String
    },
    UserID: String
});

const MessageModel = module.exports = mongoose.model('users', userinfo);

My schema

#
let userinfo = require("./models/user.js")
 const userdetail = await userinfo.findOne({
      UserID: msg.author.id
})
blissful cliff
#

yeah alright, but i feel like its printing out the promise which might be interpreted as [object Object] instead of the result in the callback

delicate shore
#

and another problem is that

#

There is no voter field

#

I don't know how

blissful cliff
#

wait, so you want to set all voters to "no"? like a reset?

delicate shore
#

yes

#

or just completely delete the field voter

delicate shore
#

I don't know why

#

Also, why does it says undefiend

blissful cliff
#

undefined means the field doesnt exist at all

lusty quest
delicate shore
#

I didn't

blissful cliff
#

so the filter wont work as it wont find anything

delicate shore
#

I have the voter field

lusty quest
#

how did you call the update query?

delicate shore
#

I don't

#

I just delete the existing record

#

and create a new one

lusty quest
#

when a user votes?

delicate shore
#

ye

#
const userdetail = await userinfo.findOne({
      UserID: vote.user
    })

    if (!userdetail) {
      let newData = new userinfo({
        UserID: vote.user,
        voter: "yes"
      })
      newData.save()
    } else if (userdetail) {
      if (userdetail.premium === "yes") {
        await userinfo.findOneAndRemove({
          UserID: vote.user
        })

        let newData = new userinfo({
          voter: "yes",
          premium: "yes",
          UserID: vote.user
        })
        newData.save();
      } else {
        await userinfo.findOneAndRemove({
          UserID: vote.user
        })
        let newData = new userinfo({
          voter: "yes",
          UserID: vote.user
        })
        newData.save();
      }
    }
#

like this

lusty quest
#

so you create a new Dataset everytime someone votes?

delicate shore
#

I delete his previous one

#

and create it again

lusty quest
#

why?

delicate shore
#

i don't know

blissful cliff
#

tbh wouldnt it just be

db.collection.updateMany({}, {
  "$set": {
    "voter": "no"
  }
})

to fully force every document to have voter: no

delicate shore
#
userinfo.updateMany({}, {
  "$set": {
    "voter": "no"
  }
})
lusty quest
#

also what did ou want to do?

delicate shore
#

I want to set the voter field to no

#

so that

#

Everyone gets this message

lusty quest
#

if someone votes give him access to certain stuff. what is the restriction to get the vote negated?

delicate shore
#

I kept it that vote once to remove the message for 1 month

lusty quest
#

if you want to remove the stuff after a certain time you could use TTL

delicate shore
#

TTL?

lusty quest
#

MongoDB will delete the document when the TTL runs out

#

time to life

delicate shore
#

oh

#

but is there any way to do what I just said

lusty quest
#

i use this for my bot for vote rewards

delicate shore
#

ohh

#

createdAt: { type: Date, expires: 604800000 }

#

like this

lusty quest
#

yes

#

then the document will get deleted if the time runs out

delicate shore
#

Like this

lusty quest
#

and if you want to check if someone voted. just check if the document exist, if no document exist he doesnt voted

#

you just need then a document with the userid and the TTL

delicate shore
lusty quest
#

it will delete after 1 week

delicate shore
#

all of em?

lusty quest
#

only the one where the TTL runs out

delicate shore
#

like someone voted yesterday
i am making change in code today

lusty quest
#

createdAt: { type: Date, expires: "30d", default: Date.now }, i have it currently this way

delicate shore
lusty quest
#

creates a Document, sets the current timestamp as time and waits 30 days until it gets deleted

#

only the One document that runs out

delicate shore
#

so it won't affect the old ones

lusty quest
#

nope not the old ones

delicate shore
#

ohok

#

anyway to fix that problem?

lusty quest
#

but you maybe could update the old ones

delicate shore
#
    createdAt: { type: Date, expires: "1w", default: Date.now  },
delicate shore
lusty quest
#

update all existing documents to have this

#

ye

delicate shore
#

alright
Thanks ❀️

lusty quest
#

makes stuff way easyer

#

also you dont need such bloated schema

#

like i said, you just need the userid and the createdAt field

#

then just add a document if a user voted

radiant axle
#

euu

delicate shore
#

lol, my code is a mess
I have 7 schemas and my index file has 3k lines of code even tho I have command handler

radiant axle
#

when i will get my bot verified 😦

lusty quest
#

wtf

radiant axle
#

can anyone say

radiant axle
#

k

delicate shore
#

I still haven't shifted all my cmds to handler

#

will do it in summer vacations

slender thistle
delicate shore
#

I have been procasanating for months

#

ok ima go bye

radiant axle
#

anyone can say after how many server my bot joned that it will become verified ??

lusty quest
#

usually 2w

radiant axle
#

2w means ?

lusty quest
#

but can be longer

#

2 weeks

radiant axle
#

oh

#

but how many servcers it should be in

delicate shore
#
userinfo.updateMany({}, {
  "$set": {
    "createdAt": Date.now()
  }
})

this should work right?

lusty quest
delicate shore
#

oh

lusty quest
delicate shore
#

oh yeah

#

shit

#
userinfo.updateMany({}, {
  "$set": {
    "createdAt": { "status": 1 }, { expireAfterSeconds: 10000 }
  }
})

why don't I just remove every record after 10 seconds

#

and everything past this will be streamlined

lusty quest
#

why not remove all documents without the timestamp?

delicate shore
#

how?

lusty quest
#

$exist:false

delicate shore
#
userinfo.updateMany({}, {
  "$set": {
    "createdAt": { "Date": Date.now() }, { expireAfterSeconds: 10000 }
  }
})
delicate shore
#

but wait

#

that's what I wanna do

#

Thanks

lusty quest
#

db.inventory.find( { item : { $exists: false } } )

delicate shore
#

ohh

lusty quest
#

you could probably use find and remove

#

just look for the createdAt field

delicate shore
#

I am confused as heck

#

So first things first

lusty quest
#

db.inventory.deleteMany( { createdAt : { $exists: false } } )

#

in theory this should remove all documents where the createdAt field is missing

delicate shore
#

Ohhh
Thanks

#

userinfo.deleteMany( { createdAt : { $exists: false } } )

lusty quest
#

no

#

ye

delicate shore
#

k

#

My bot crashed

lusty quest
#

sounds about right

#

did you get an error?

delicate shore
#

It worked

#

pog

#

Thanks

delicate shore
lusty quest
#

well you probably froze it bcs it told the database to yeet 80k documents

earnest phoenix
#

Hey, so anyone worked with discord.py on_member_update here?

#

I have an issue, which everytime someone does a thing. The event getting called 3 times.

#

Hello,

For the purchase of a VPS for my discord bot, I have to choose its location.

Currently living in the European Union, I have the choice between The European Union and The United States.
What should I use!
Thank you

lusty quest
#

i dont know py, but did you have mutiple event listeners?

earnest phoenix
#

no ofc

earnest phoenix
#

Its only 1 event

#

but its getting called 3 times for no reason

vivid fulcrum
#

latency is important

lusty quest
#

i have 100ms and its fine

vivid fulcrum
#

pick a location that's in san francisco/closest to it

lusty quest
#

while my host is in the EU

earnest phoenix
#

So, US or EU?

vivid fulcrum
#

us

slender thistle
earnest phoenix
#

Yep i just knew that

#

thanks anyways

slender thistle
feral aspen
#

Ayo.

#

In discord python, there is something called as context modification, is there also for JS?

earnest phoenix
#

hi

#

how should i get the id from this?

#
resolved: {
  users: { '689724254883020810': [Object] },
  members: { '689724254883020810': [Object] }
}
#

id from users or members

#

it doesn't matter

feral aspen
#

They are both returning the same ID.

earnest phoenix
#

ik

#

i want to log only the id

lusty quest
#

resolved.users[0]?

#

also did you get this as a Object?

earnest phoenix
#

i get undefined

lusty quest
#

what did resovled.users return?

earnest phoenix
#
{
  '269095564317163520': {
    username: 't33o',
    public_flags: 64,
    id: '269095564317163520',
    discriminator: '3615',
    avatar: '27c5094878688abc34ec34cb5f961794'
  }
}
#

this

lusty quest
#

from where did you get this?

earnest phoenix
#

intercation.data.resolved.users

lusty quest
#

bcs the first id is the key for the entire sub object and it can be a bit annoying to use this way

earnest phoenix
#

it s the new thing from discord

#

with slash command

lusty quest
#

did you know the userid?

earnest phoenix
#

and intecation

#

is from client.ws.on('INTERACTION_CREATE', async (intercation) => {

lusty quest
#

if yes you could probably pass the userid

#

resolved.user.269095564317163520 would be the path

earnest phoenix
#

ik

#

that s the thing

#

idk the id

weary socket
#

Can someone help me?

crimson vapor
#

whats your issue?

earnest phoenix
#

just use topgg-autoposter

weary socket
weary socket
crimson vapor
#

what is api?

#

defined as

weary socket
#

Topgg API

crimson vapor
weary socket
#

I am using java

crimson vapor
weary socket
#

Should i use a loop and send Nr.2 multiple times or how should I get all the servers for you?

crimson vapor
#

im not too sure, I don't use java

weary socket
#

Javacord

#

I have them in a hashmap

#

Shards as a Value and the ID of it in a key

#

I tried that:

#
                futureApi.thenAccept(api -> {
                    top.setStats(api.getCurrentShard(), shardCollection.size(), api.getServers().size());
                });
            });```
#

Is that correct like that?

#

I am looping through every shard

crimson vapor
#

@opal plank I need some ts help with template literal types. discord-api-types (a package berry uses because he is too lazy to type everything and its already done here) defines Snowflake type as `${bigint}`, if I were to do guild.id ?? 'dm', I get RangeError: Maximum call stack size exceeded from ts and it breaks. https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html has the examples using types as constants, which doesn't have the same issues. Ex. I compiled ts type Snowflake = `${bigint}` interface Example { id?: Snowflake } const example: Example = {} console.log(example.id ?? 'no id') and it failed with the range error. Doing ts type test = 'string' type Snowflake = `${test}` interface Example { id?: Snowflake } const example: Example = {} console.log(example.id ?? 'no id') had no issues. Is discord-api-types making a mistake by using template literals like this or is there something else? https://github.com/discordjs/discord-api-types/commit/549a6f023698f05829f1dfdf1190c027a994d6cd was the commit which added Snowflake and here is current code https://github.com/discordjs/discord-api-types/blob/main/common/index.ts#L160

#

did you guys see me typing for like 3 minutes lol

#

lol

weary socket
#

So its ok to send thousends of data to top.gg?

#

No i dont but i just wanna ask if I would have 2000 shards...

crimson vapor
#

post what you have

#

or your bot may be removed

weary socket
#

I am not faking that xD

#

ok

#

rn? 1

#

I wanna make my Bot future save...So i dont have to write new stuff if it gets more servers

#

Or how many shards does Discord recommend for 200 servers?

crimson vapor
#

1

weary socket
#

oh ok

#

then 1

#

ok nice

#

Nah i dont wanna be mee6.....I wont crash Discord and I dont wanna be shit like that bot xD

#

yep

#

Every 20min

#

xD

#

Yay

#

Nah i am using completable future....So I am fine

#

I changed my framework to javacord only for async tasks and completablefuture

#

Trust me Its way better

#

no .queue at the end

#

yep thats why i switched to javacord

#

Not now 😦 And the AudioSupport is also ez but does have one bug...In the next update , they will bringt both the slash commands and the audio reconnect fix

#

yep

#

yes it is....But I had less code on audio and it also reconnects automatically on every problem...They managed it very good

#

I think so...Never tried lavalink...

crimson vapor
#

@swift umbra use discord-rose

#

wtf

crystal wigeon
#

how do i escape usernames with special cahracters

#

TT

#

its messing

#

with the embeds

vivid fulcrum
#

put a frontslash in front of the characters

#

\

lapis flame
#

how to don't let the bot to don't answer to any command in dms?

cinder patio
#

check if <Channel>.type is equal to dm

tulip ledge
#
    let items = [];

    fs.readdir(path.join(process.cwd(), "data", "items"), (err, files) => {
      if (err) throw err;
  
      files.forEach(file => {
        items.push(file.split(".")[0]);
      });
    });

Anyone knows why this logs an empty [] even though when I log file.split(".")[0] there are like 6 items

crimson vapor
#

because fs.readdir runs after you console log

tulip ledge
#

oh

cinder patio
#

You need to put the console log in the callback

crimson vapor
#

you can do readdirSync if its not important

cinder patio
#

or you can promisify it

tulip ledge
#

I can just make a promise out of it?

#

yeah alright

quartz kindle
#

there is fs.promises

crimson vapor
#

Hello Tim

lusty kindle
#

I made a last minute decision to keep the bot online

crimson vapor
#

Do you know anything about template literal types in ts?

cinder patio
#

template literal types?

#

they're strings

crimson vapor
#

ok so the big question is if you can do ```ts
type x = `${bigint}````

cinder patio
#

no

crimson vapor
#

man

#

cringe devs

earnest phoenix
#

hey

#

how long does it take lucifer to dm you once u made a discrd bot

tulip ledge
#

does Array.filter change the array itself?

earnest phoenix
#

really

#

why so long

crimson vapor
earnest phoenix
#

@dusky sundial

crimson vapor
#

hello Erwin

dusky sundial
opal plank
earnest phoenix
#

damn it

crimson vapor
waxen lake
#

Fock

crimson vapor
#

@opal plank can you confirm what GoogleFued said that ```ts
type Snowflake = ${bigint}

#

wouldn't work

#

and is stupid

opal plank
#

dude, why you getting bigint in the first place?

#

thats not how you do it

crimson vapor
#

yell at advaith or whoever did it

opal plank
#
let myid = '12874918287115';
let bigint = BigInt(myid); //this is big int now
let converted = bigint.toString();
#

who's the idiot that uses template literals for bigint convertion?

#

its so stupid

crimson vapor
opal plank
#

for types its strings

#

period

#

api returns strings

#

period

#

you want bigints, you do it in ur code

weary socket
#

Hey uhm you said you use lavalink.....Do you also use a IPV6/64 block?

opal plank
#

theres no types in it at all

crimson vapor
#

it doesn't do any conversion tho

#

it just types it like that

opal plank
#

cuz there isnt any to be done

crimson vapor
#

so why even type it

opal plank
#

discord api only uses it as string

#

the only integers discord returns are permissions

#

and opcodes and some other shit

#

not snowflakes

#

the name snowflake infers its a chain of numbers

crimson vapor
#

this was likely their reason

opal plank
#

typing it like that is stupid

crimson vapor
#

should I make an issue or just pr it back to a string?

opal plank
#

if you getting issues with it, yes

crimson vapor
#

so issue, right?

opal plank
crimson vapor
#

im really tired and can't tell whether people are saying yes to the first part of second most of the time

opal plank
#

make an issue if you have an issue

#

let them deal with the code

crimson vapor
#

alr

opal plank
#

also

#

check something for me rq

crimson vapor
#

mhm

opal plank
#

${0}

#

see if that fucks it up

crimson vapor
#

nope

#

and it shouldn't

opal plank
#
type Snowflake = \`${bigint}\` | \`${number}\`
crimson vapor
#

ok sec

#

that shouldn't work

opal plank
#

bigints are 19284n

#

not 18284

quartz kindle
opal plank
#

dunno if it turns into primitive

quartz kindle
#

good morning

opal plank
#

ohaio

crimson vapor
quartz kindle
#

dafuq

crimson vapor
#

its because of the primative type

#

who even thought it was a good idea

opal plank
#

retarded ngl

crimson vapor
#

I couldn't find anywhere any case of someone using ${string} let alone fucking bigint

#

well

#

string is dumb

#

but you know what I mean

cinder patio
#

{bigint} === string

crimson vapor
#

its a fancy string

#

but yea a string

opal plank
#

actually

#

@crimson vapor dont do anything else

quartz kindle
opal plank
#

just ```ts

let myvar:Snowflake = '0'```

#

import the snowflake type from ur lib

crimson vapor
#

that works yes

slender wagon
#

oof localhost stopped working it was just fine yest

crimson vapor
slender wagon
#

today it can't open up the liveserver

crimson vapor
#

thats what they define it as

opal plank
crimson vapor
#

I think its cool

quartz kindle
#

i mean if you think about it, it makes sense

crimson vapor
#

ye

quartz kindle
#

how else would you define a string that can only contain numbers?

#

with a regex type?

crimson vapor
#

you would need to ig

#

since primatives don't work

earnest phoenix
#

Hi

quartz kindle
earnest phoenix
#

I want to make a discord bot

opal plank
#

the name infers it

#

snowflake

crimson vapor
#

just don't be stupid, right?

earnest phoenix
#

Can anyone teach me how to make discord bot?

opal plank
quartz kindle
#

do you have any programming experience?

slender thistle
#

When pip decides to be a bitch, --force-reinstall

earnest phoenix
#

No@quartz kindle

crimson vapor
#

@opal plank yo when you install tsc on ubuntu, its sudo npm i typescript -g?

opal plank
#

i usually install my deps locallt

#

but you could install globally, yeah

earnest phoenix
#

I am here to learn how to make bots

quartz kindle
#

dont use sudo with npm

#

you will have issues

crimson vapor
#

what the fuck

#

maybe its not a real issue

#

am I just a version behind

quartz kindle
earnest phoenix
#

Ohk than i will learn coding

opal plank
#

its something that'll take a couple months btw, keep that in mind its not something quick to do

earnest phoenix
#

But where?

opal plank
#

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

#

@earnest phoenix

earnest phoenix
#

@opal plank thanks

crimson vapor
#

so ig the issue was fixed inbetween versions 4.1.5 and 4.2.3

#

I just wasted my time

slender thistle
#

CIRCULAR IMPORTS ARE PAIN

modest maple
slender thistle
#

http.py from . import __version__
init.py from .http import HTTPClient

#

because fuck you

modest maple
slender thistle
#

We're good

#

Just putting my imports at the very bottom of my init

old cliff
#

What is circular?

pale vessel
#

a requires b and b requires a

slender thistle
#

Basically a recursion

pale vessel
#

4head

old cliff
#

Ok

brittle hamlet
#

node:450) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 88.202.181.104:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
(node:450) 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:450) [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 started getting this error just now and now my bot isnt working any help please

opal plank
#

@brittle hamlet which library u using?

brittle hamlet
opal plank
#

one thing i can think of causing that is the domain change for discor

#

which version you're using?

brittle hamlet
#

one sec

opal plank
#

aight

brittle hamlet
#

How to find the version I think it is the latest

opal plank
#

look in your package.json

brittle hamlet
#

ok

#

12.5.1 version of discord.js

opal plank
#

so its not a version issue

#

hmmm

#

you running it locally?

brittle hamlet
#

No I imported the project in repl.it and hosting from there

opal plank
#

hmmm im out of ideas tbh

brittle hamlet
#

Oh

opal plank
#

doubt they would have banned the ip

opal plank
#

if you're using v12 its fine

#

even the old one should still work

brittle hamlet
#

Oh ok

opal plank
brittle hamlet
#

Oh

opal plank
#

but its been quite a while since that happened

brittle hamlet
#

Yeah

opal plank
#

but yeah i cant think f anything else

#

might be an issue with repl

brittle hamlet
#

Oh ok thanks anyway

long crow
#

Did you enable fetchAllmembers

brittle hamlet
long crow
#

all I can think is replit itself

#

Β―_(ツ)_/Β―

brittle hamlet
#

Ok so then it should be resolved under 12hrs or so right

#

like an assumption

opal plank
#

no guarantees it'll magically start working tho

earnest phoenix
#

Why is this error coming πŸ€”

brittle hamlet
brittle hamlet
earnest phoenix
brittle hamlet
#

I am also facing problem there

earnest phoenix
#

Git the error fixed @brittle hamlet

#

You have to enable both of the intents in the developer portal

brittle hamlet
earnest phoenix
#

that will also fix the error

brittle hamlet
earnest phoenix
#

go to your application then under the bot tab scroll a little bit above the permissions they are listed

opal plank
#

it has no affect whatsoever on ur error

brittle hamlet
#

Oh

opal plank
#

the error you're getting is that you are getting timeouts when trying to conect to the gateway

#

intents just dictates what discord should send you in terms of data

#

unrelated to ur issue

brittle hamlet
#

Ok thanks

opal plank
#

also

#

write a basic js file

earnest phoenix
#

but when it was disabled that my bot wasnt starting but after enabling them it works
πŸ€”

opal plank
#
const client = new (require('discord.js')).Client();
client.login('token');
client.on('debug', console.log);
client.on('ready', () => {console.log('ready')})
```@brittle hamlet can u run the above?
brittle hamlet
opal plank
#

this is just for testing

brittle hamlet
#

It gives error

opal plank
#

same error?

brittle hamlet
#

No says discord.js module not found

opal plank
#

did you install discord.js?

brittle hamlet
#

Yes I installed and repl.it automatically installs them

opal plank
#

hmmmmmm

#
const Discord = require('discord.js');
const client = new Discord.Client();
client.login('token');
client.on('debug', console.log);
client.on('ready', () => {console.log('ready')})
#

what if you try that?

#

if that doesnt wrk, check ur package.json

brittle hamlet
#

Ok

#

-> npm ci
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/runner/lol/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/lol/package.json'
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! /home/runner/.npm/_logs/2021-03-28T12_33_57_826Z-debug.log
exit status 254

gives this error now

opal plank
#

erm no idea bout that one

#

npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/lol/package.json'

#

run the basic.js file inside your main one

brittle hamlet
brittle hamlet
opal plank
#

just run it with node basic.js

#

instead of node index.js

brittle hamlet
brittle hamlet
#

Preparing to connect to the gateway...
[WS => Manager] Manager was destroyed. Called by:
Error: MANAGER_DESTROYED
at WebSocketManager.destroy (/home/runner/Shinchan-chatbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:333:54)
at Client.destroy (/home/runner/Shinchan-chatbot/node_modules/discord.js/src/client/Client.js:237:13)
at Client.login (/home/runner/Shinchan-chatbot/node_modules/discord.js/src/client/Client.js:226:12)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:802) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (/home/runner/Shinchan-chatbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:133:26)
at Client.login (/home/runner/Shinchan-chatbot/node_modules/discord.js/src/client/Client.js:223:21)
(node:802) 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:802) [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.

This is the error in the main project

#

Thanks @opal plank for the help but the problem resolved when I regenerated the token

earnest phoenix
#

I have a problem. When I use client.get_all_members(), the bot only returns it's own name and all the other members are missing. I already enabled the "Privileged Gateway Intents" in the Discord Developer Settings but nothing changed. What I am doing wrong?

cobalt spruce
#

did slash command come to discordjs?

long crow
#

not yet

cobalt spruce
pale vessel
#

you can still use it if you want

cobalt spruce
pale vessel
#

there's the raw event where you can use to receive integration create event and respond by using discord's REST API

lapis flame
#

How I can let the bot don't answet to any dm in private?

pale vessel
#

check if the message came from a DM

lapis flame
#

how I can check if it's a dm?

pale vessel
#

check the channel type

earnest phoenix
#

by checking the channel type

lapis flame
#

oh alright

earnest phoenix
#

I am using lavalink
Erela.js
While bot is Playing a song when adding more in queue the current song stops Playing I have to skip it to play another one
What to do.it doesn't showing any error

outer perch
#

(node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
if it says this, it means it found the user, but couldn't send a message, right?

#

permission problems on the user side

earnest phoenix
#

Yes dm s locked

outer perch
#

but I spoke to the person, which is my gf, and she has the exact same settings as me in the Security options

#

I thought it could be cuz she had DND status, but it makes no sense, since u can still receive messages

dusky sundial
#

Does she have this enabled?

#

For the server she shares with the bot

outer perch
#

yes

#

oh wtf, she switched on and off to test, and worked again

vale garden
#

hi

dusky sundial
outer perch
dusky sundial
#

I believe so, yes

vale garden
#

when i try adding a url to the interactions endpoint url, im getting this error

#

Error submitting form. Please try again, or click here to contact support.

#

someone help plz

lament rock
#

try refreshing the page then try again

vale garden
#

it didnt work

#

and now im getting this

#

Validation errors: interactions_endpoint_url: The specified interactions endpoint url could not be verified.

#

https://TrimDisloyalLanservers.multi76.repl.co this is the url btw

lament rock
#

Then that means the URL is not valid / returning a non OK status code. Make sure the web server is providing a response

cinder patio
#

I'm pretty sure discord makes a request to the URL and you have to send something back to confirm

vale garden
#

should that work

#

hm wait

#

the "ok" msg is being printed

#
Method Not Allowed
The method is not allowed for the requested URL.
``` but this is also being returned
#

oh wait a sec

#

i think i know what the problem is

lament rock
#

Is Discord using POST

vale garden
#

ye

#
if request.json["type"] == 1:
        return jsonify({
            "type": 1
        })
#

i think i need that

#

but idk how to define what request is

#

could someone help

lament rock
#

does your router provide parameters to the function such as a request object

vale garden
#

nope

#

so should i do that

#
@app.route('/', methods=['POST'])
def my_command():
    if request.json["type"] == 1:
        return jsonify({
            "type": 1
        })
``` in the docs it doesnt do that tho
#

i think ill have to do a get request or something

lament rock
#

Follow the docs for your router lib and how they access request data such as headers or POST body

#

interactions through the socket amandathink

lament rock
#

Discord making HTTP requests to your server

pale vessel
#

you can follow the structure

#

you can add choices and options

#
options[0].name: This field is required
options[0].type: This field is required```
#

just like the error says

summer torrent
#

@rustic nova hmm?

rustic nova
#

@earnest phoenix no thanks

#

actually

#

KEKW this dude can't even do proper css

#

Phishing site

slender thistle
#

With Flask you quite literally import request

earnest phoenix
#

Quick question, is there an tutorial or way to make an bot send gifs etc?
Like i know bots who send gifs if you do =hug
as a example

#

and its mixing up random gifs?

old cliff
#

why does it take my new bot account 2 minutes to start?

#

it takes 2 minutes for it to call the ready event

#

exactly 2 minutes every time

#

doesn't happen with my old bot account

pale vessel
#

monox hacked your bot account

leaden lake
#

how to make the timestamp change on the date, without modifying the embed message ?

in python please

old cliff
#

That bot account...

#

all old accounts get ready within 5 seconds

safe orbit
#

Hello,
Could you help me because I don't know how to introduce a command to make it a slash command

earnest phoenix
#

and i have another question

#

How do i do
it like that
that only people with an special role can do the bot commands?
like
there is some commands everyone can do
and some commands only locked for some members

#

message.author.roles.contains(r => r.name ="moderator")

#

like smt like this or?

quartz kindle
earnest phoenix
#

should i put the roleID

#

like the name of the role?

earnest phoenix
#

and as example this command

#

=Hello, =hug

#

can do everyone?

weary socket
#

Oh ok 😦

prisma wren
torn whale
#

how can i code the bot send a message to a specific channel when someone vote it?

tulip ledge
#

is it possible to get data from google docs into javascript discord bot?

earnest phoenix
round vault
#

How to host a Discord bot for 24/7 without heroku?

dusky sundial
round vault
#

@dusky sundial ahhhh man...

#

@dusky sundial how can I keep run computer for 24/7....bruh

dusky sundial
#

Start it, and don't turn it off? πŸ€”

umbral zealot
#

And make sure it never crashes.

round vault
#

πŸ˜‘

umbral zealot
#

Not sure what other answer you'd be expecting

#

A bot that runs 24/7 must be hosted on a machine that never goes down and the bot should not crash, that's just... the reality of it.

quiet topaz
#

btw make sure it doesnt go to powersaver mode

round vault
#

I got an Idea

earnest phoenix
quiet topaz
#

or buy a raspberry pi?

#

and run it there

round vault
#

I can run node.js in Glitch and the make a project that pings that bot project file every 5 mins later

quiet topaz
#

but Glitch is shit

round vault
quiet topaz
#

ye

#

whats wrong with buying a raspberry

round vault
#

@quiet topaz πŸ˜‘

dusky sundial
#

I hosted my bot on a raspberry pi for months

umbral zealot
round vault
#

@umbral zealot πŸ˜‘

umbral zealot
#

Doesn't matter if you agree, it's a fact that does not require anyone's agreement to be a fact.

round vault
#

@umbral zealot omg

quiet topaz
subtle river
round vault
#

So philosophical @umbral zealot

quiet topaz
#

dude just buy a raspberry pi

dusky sundial
#

If you don't want to self-host. A VPS is the way to go

umbral zealot
prisma wren
# earnest phoenix Show your code dude
module.exports = {
    name: 'help',
    description: "This command will provide you with some assistance.",
    execute(message, args, Discord) {
        const newEmbed = new Discord.MessageEmbed()
        .setcolor('#e10600')
        .setTitle('Greedy Lobster Help Menu')
        .setURL('discord link')
        .setDescription('you may see a list of commands with help for them in this embed.')
        .addFields(
            {name: '?ping', value: 'It is a simple command that does nothing but respond to you with Pong! :ping_pong:'}
        )
        .setFooter('Join the support server for additional help :)')

        message.channel.send(newEmbed);
    }
}
subtle river
#

If it worked I wouldn't be here.

I want to know if it is especially something wrong with the specific link or if it's wrong and I'm not understanding how OAuth works.

umbral zealot
#

The link seems fine, the question is, what specifically isn't working?

#

like what exact problem are you having

subtle river
#

its saying

#

"invalid uri"

umbral zealot
#

well... it's invalid, to start with.

#

so, not a lie I guess

subtle river
#

wha-

earnest phoenix
prisma wren
#

yes in my main.js

subtle river
#

OH

#

I'm so sorry

#

for wasting your time