#development

1 messages · Page 1133 of 1

pure lion
#

ye

#

using it for my auth too

torn ravine
#

I'm setting up my cusom prefix command in my complete rewrite of my bot

pure lion
#

easy

#

need help?

torn ravine
#

yes please

split hazel
#

i use mongoose too, its pretty neat and simple

misty sigil
#

i use mongodb official because i find it easier imo

torn ravine
#

now what I plan to do use the guildCreate Event to get the message id and set the prefix as default

misty sigil
#

i don't store defaults myself

pure lion
#

oh my god i have asadgouihdsfoaihoisadfhj

torn ravine
#

what?

pure lion
#

how to make headers stay between redirects?

earnest phoenix
#

how to use google

eternal flame
#

ok so ive bought the vps
how do i connect it to my api

torn ravine
#

lol

#

you ssh into it

pure lion
#

b

eternal flame
#

lol

pure lion
#

ssh root@ip

torn ravine
#

you can use putty to do that

earnest phoenix
#

There's an extension on visual studio code for it

thorny ocean
#

idk if its just not loading for me but is there a reason why an emoji like this for a bot <a:Nitro:emoji id> turns into :Nitro:on the message and not the actual emote, from what i can tell bots can use animated emojis but it just doesnt seem to work.

#

it even works until i reload discord and it just turns into the text lol

earnest phoenix
#

The emoji ID is incorrect

pure lion
#

now im really confused wtf-

thorny ocean
#

huh

torn ravine
#

dude

thorny ocean
#

cheers ill look into it lol

#

even though it works on a channel topic?

earnest phoenix
#

I had the same issue before

pure lion
#

its always returning 'access denied' even though im a: not running it on post requests and b: its a different path all together

thorny ocean
#

alright

boreal condor
#

Dm me need Java devs. $

pure lion
#

im so confused

#

its not getting the body at all now

thick gull
#

this is not fiverr

pure lion
#

fuck this im going to sleep

#

byee

wheat temple
#

Bye

torn ravine
#

how do I add things using mongoose

pure lion
#

how do I add things using mongoose
updateOne

#

You can use this keyword that I can't remember to create a new doc if one doesn't exist

#

@flazepe

#

Weird

earnest phoenix
#

how i can get all the guilds name with py?

pure lion
#

@torn ravine updateOne with opt { upsert: true }

#

Upsert is a failsafe incase the thing doesn't have a document assigned to it

#

Creates a new doc*

torn ravine
#

specifically I want to get guildID from the guildCreate channel

pure lion
#

channel.guild

#

.id

torn ravine
#

wait I meant event not channel

pure lion
#

Yeah

#

The event returns a channel object

torn ravine
#

I'm confused now

#

I done this

earnest phoenix
#

The event returns a channel object
@pure lion No, guildCreate event returns a guild instance not a channel instance

pure lion
#

Okay cool

earnest phoenix
#

@torn ravine So you want to update the prefix for example or

#
let t = ['0', '1', '2', '3', '4']
const collector = msg.channel.createMessageCollector(x => {
                return x.author.id === msg.author.id && new RegExp(`^([1-${t.length}|cancel])$`, 'i').test(x.content);
            }, { time: 30 * 1000, max: 1});
#

Problem: a number from 1-5 works but "cancel" doesnt

torn ravine
#

yes

earnest phoenix
#

Why are you putting the cancel inside a category

#

category?

#

"]"

#

oh ofc

#

How do I print every emoji out that a guild has?

warm marsh
#

iterate over the guild's emojis?

earnest phoenix
#

message.guild.emojis.cache.forEach(e => {console.log(e)})

#

@torn ravine You gotta get the guild or the guild prefix model and use updateOne on it but it only works if you provide the document id

cold granite
#

how i can get all the guilds name with py?
@earnest phoenix iterate through all guilds bot is in and make sure to convert them to string using str()

earnest phoenix
#
<Mongoose model>.updateOne({ _id: <document id> }, { $set: { "prefix.type": <new prefix> } });``` for example @torn ravine
torn ravine
#

how would I get document id?

earnest phoenix
#

@cold granite

#

this work

cold granite
#

okay

earnest phoenix
#

Well if you want to find it you gotta use findOne() but instead of doing all this, there's a method combined
findOneAndUpdate() @torn ravine

#

how i can get the permissions of the member in array? (py)

jagged sun
#

I've got a question for discord.js: When using a message event, how does the bot need to get contacted on discord that msg.member (msg as result from event) does not exist?

torn ravine
#

okay thanks

earnest phoenix
#
<Mongoose model>.findOneAndUpdate({ "guildID": <guild id> }, { $set: { "prefix.type": <new prefix> });```
#

@torn ravine

#

@jagged sun Just check it with a boolean,

Boolean(<message>.member);```
Would return that if it exists, it's true, if not, it's false
jagged sun
#

Ok, but I want to understand why this happened? msg.member can't get created if it gets a message in a group or via a dm, so i added that it should return if msg.channel.type === 'dm' or msg.channel.type === 'group' but it somehow still crashed, because of not being able to get msg.member... Thats weird

#

But thank you

queen moss
#

you cant get a member object in a dm Thonk

#

If I'm reading that correctly @jagged sun

#

ooooh I see. Are you by chance using return; in a promise

jagged sun
#

?

queen moss
#

If you send over the code it would be helpful, kinda going off a hard to understand sentence

jagged sun
#
        return
    }``` When getting a DM msg.member is undefined, so I added this before using msg.member in the event, but it still crashed because it could somehow not get msg.member. So the bot must have activated the message event, even though not getting a message via guild, dm or group, and I don't think there is even another way on discord..?
#

It always worked fine, but some random dude got it to crash...

#
        return
    }
    if(!Boolean(msg.member)) {
        return
    }``` I was able to fix this with those two (i think), but I just wanna understand why this happened😆
queen moss
#

If the guild was unavailable at the time for some reason it is possible it didn't get the info from discord, and based on what you are saying... that may be the case - I know some guilds were offline earlier because the api is stupid

jagged sun
#

Ok, that might be the reason but thats weird

#

but nvm, then if(!Boolean(author)) return shall fix it...

quartz kindle
#

why not simply if(!msg.member) return

jagged sun
#

sure, also works

honest perch
#

Oo tim is here

#

Time to bombard him with 1000 questions

pale vessel
#

tim how do i code

misty sigil
#

tim spunfeed me inde.json

quartz kindle
#

@_@

honest perch
#

Ok then tim

earnest phoenix
#

im dead serious tim spunfeed

honest perch
#

How do i check if a user has 0 roles in eris

pale vessel
#

check member.roles

#

a user can't have roles, baka

earnest phoenix
#

lmao

honest perch
#

Ok

#

And another one

#

Actually

#

I dont have another one

earnest phoenix
#

u made my day

honest perch
#

Yes

quartz kindle
#
if(message.member.user.client.guilds.first().channels.first().client.channels.first().client.users.find(message.author.id).guild.members.find(message.author.id).guild.roles.filter(role => !message.member.roles.includes(role.id)).size) {
  return
}```
solemn latch
#

that doesnt seem correct

#

this channels.first() isnt needed

honest perch
#

That seems over complicated

quartz kindle
#

replace it with channels.guild.channels.guild.channels.guild.channels.guild.client

thorny ocean
#

Anyone know why my bot doesn't send custom emojis? The id and name are correct, and the first time the message is sent the emojis are there

#

When i reload discord though they just turn from the emoji into the :emoji:

honest perch
#

Is the bot in the server that the emoji originated from

thorny ocean
#

Yeah

quartz kindle
#

if the emoji is there then its working

#

sounds like a discord problem

thorny ocean
#

Yeah it might be

#

Definitely the right name and id it works as a channel topic

eternal flame
#

ok so i have a line of code that whenever the bot is mentioned it returns with the guilds prefix
```if (message.mentions.has(client.user.id) && message.content.length < 23) return message.channel.send(My prefix in this community is \${serverSettings.prefix}`\nUse ${serverSettings.prefix}help for help!`)

#

but

#

also this code was given to me by woo

#

and he says it doesnt give him this problem

#

when i start the bot

#

```if (message.mentions.has(client.user.id) && message.content.length < 23) return message.channel.send(My prefix in this community is \${client.prefix}`\nUse ${client.prefix}help for help!`)
^

TypeError: Cannot read property 'has' of undefined
at Object.<anonymous> (C:\Users\urmum\Desktop\Society Bot\index.js:54:22)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47```

sudden geyser
#

what is message

#

I recommend logging it, as it's probably not a Message instance.

eternal flame
#

woo gave me the code and he claims that this works perfectly fine for him

#

but ok

coral palm
#

discord removed the developer insign?

misty sigil
#

?

sudden geyser
#

what's an insign

coral palm
misty sigil
#

they didn't remove that

summer torrent
#

yes they didn't

solemn latch
#

no they didnt

amber fractal
#

You're saying that they did when you have it...

earnest phoenix
#

gaus , how can i connect between electron and my njs codes?

sudden geyser
#

wish they did tbh

earnest phoenix
#

woo gave me the code and he claims that this works perfectly fine for him
@eternal flame then don't copy code???

placid iron
#

Ok so I'm genuinely confused. Is it more efficient to see if you can perform the action then do it and get no errors or put in it a try catch

sudden geyser
#

I like to see if I have permission to perform an action, then try and catch.

#

In case it somehow does not work.

#

for what

placid iron
#

@sudden geyser ah ok

royal tapir
#

hey.... im trying to check if in mongo "lconfig" is set to false (ex. lconfig: false) and then disable leveling if it is... could anyone help me on that?
Edit: lconfig is a boolean.

torpid tiger
#

How can I get the bot to give an error message if the given role is above its role?

torn ravine
#

is it (link)[message] or link

sudden geyser
#

How can I get the bot to give an error message if the given role is above its role?
@torpid tiger check the bot's highest role and compare it's position with the other role

#

If the bot's position (a number usually, but varies on libraries) is greater than the other role, it's above it. Else, it's not.

torpid tiger
#

@sudden geyser No, how can I send an error message on the bot as the code

#

How can I get the bot to give an error message if the given role is above its role?
@torpid tiger for this reason

sudden geyser
#

Well if you tried to hit the API it would say Missing Permissions (I think), but really you'd just need to try it, then catch any error that may arise. What library are you using

torpid tiger
#

djs v12

sudden geyser
#

Here's an example: ```js
// Promise functions.
member.roles.add(someRole)
.then((role) => console.log(Added role: ${role}))
.catch((err) => console.error(Could not add role: ${err}))

// Or, try catch. Requires an async function.
try {
await member.roles.add(someRole)

console.log("Added role")
} catch (err) {
console.error(Could not add role: ${err})
}```

thick gull
#

hey.... im trying to check if in mongo "lconfig" is set to false (ex. lconfig: false) and then disable leveling if it is... could anyone help me on that?
Edit: lconfig is a boolean.
@royal tapir check message.guild.id then lconfig and if true/false, if disabled thendon't add XP or leveling or whatever

torpid tiger
#

I may have misunderstood so I'm sorry, I want the bot to say "This role is above my role, I can't add the role to you"

vivid plover
solemn latch
#

You can send a message, rather than logging

sudden geyser
#

Yeah, so like I said last time, you'd need to compare the role's position to the bot's highest role position.

#

Which is just <Role>.position and using > or < (the higher the number is, the higher it is on the side bar)

torpid tiger
#

Hmm, thanks

eternal flame
#

i need help

#

so

#

i have a custom prefix command

#

and for ever guild

#

every

#

guild that uses a cp command

#

it store it in the database (guild id, prefix)

#

so

#

what im trying to do

#

is make a command

#

where when the bot is pinged

#

it pulls that data out of the db

#

and replies with it

winter basalt
#

please make your question to one message

eternal flame
#

i have a habit of that sorry

daring warren
#

I need help with my index.js

winter basalt
#

let me read your mind and see what is wrong with your index file

daring warren
#

I wanna make another command

#

and I need to make code for it to work

mystic tundra
#

Hi, guys! Is there a difference between User.displayAvatarURL() and User.avatarURL()?

opal plank
#

@daring warren thats.... what is called.... erm... being a developer. you WRITE code 002_think

daring warren
#

I know

opal plank
#

then....?

daring warren
#

but I tried using a "else if" for mine

#

and it didnt work

opal plank
#

show what you go thus far

earnest phoenix
#

@mystic tundra
<User>.avatarURL()
Returns the url of the users avatar but if the user has a default discord avatar it will return null
<User>.displayAvatarURL()
Same as avatarURL() but this time it doesn't return null if the user has a default avatar url and returns both the display avatar url if exists, if not the url of the used default discord avatar

mystic tundra
#

thanksss bro

earnest phoenix
#

Np

daring warren
#
const token = 'token'

const Discord = require('discord.js');

const client = new Discord.Client();

const prefix = 'fp!'

const fs = require('fs');

client.commands = new Discord.Collection()

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'))
for(const file of commandFiles){
    const command = require(`./commands/${file}`);

    client.commands.set(command.name, command)
}


client.once('ready', () =>{
    console.log('This bot is online!');
});

client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(command === 'food'){
        client.commands.get('food').run(client, message, args)
        
    }
     else if (command === 'pasta'){
        client.commands.get('pasta').run(client, message, args)
    }



});

client.login(token)```
earnest phoenix
#

?

daring warren
#

@opal plank here ya go

opal plank
#

okay lets start with a couple things

#

since you already got your commands outside in different files

solemn latch
#

Your 90% of the way to dynamic execution

opal plank
#

you'd prob want a dynamic command handler

#

i'll link you one

#

take a look at that ^^

daring warren
#

k

sick cloud
#

could anyone send me some resources on oauth2?

#

not discords, the actual oauth spec

solemn latch
sick cloud
#

i need to build my own oauth2 api for a website but i have zero idea what it's like

#

ty

solemn latch
#

First result when you google "Oauth2"

sick cloud
#

interesting and complex

earnest phoenix
#

Hmm anyone know why events like guildMemberAdd and guildMemberRemove sometimes don't emit?

sick cloud
#

because of your internet

earnest phoenix
#

Discord api issues or they do but maybe you don't realize?

#

Idk

#

It can't be because of your internet connection bruh

#

This is an event

sick cloud
#

.... and how do these events get to your pc or server

#

via the internet

#

specifically the websocket / gateway, which maintains a real time connection, which due to the nature of the internet can drop out

#

discord can also never replay events

#

it happens sometimes

earnest phoenix
#

Bruh the websocket is bound to the events i know but they're aren't in real time connection are they

#

I've never seen them not emit

#

welp idk

sick cloud
#

are you a library developer

#

i assume no

#

because events are sent real time

#

when an event triggers, discord sends it as an OP 0 via the gateway websocket

#

sometimes, due to the nature of the internet, or maybe discord's servers being stressed, the event doesn't send, or doesn't get received

wooden ember
#

I mean if your internet is trash like mine then your bot could disconnect and reconnect and while it is disconnected is when the event happens sometimes

sick cloud
#

and in most cases its hard/impossible to detect that

#

@wooden ember if a bot disconnects and reconnects, events are "replayed"

wooden ember
#

are they

sick cloud
#

so when your bot comes back on, it gets all the events it missed

wooden ember
#

ah didnt know that

sick cloud
#

i've made my own library so i know how the gateway works

wooden ember
#

fair enough

red hemlock
#

What should I make for a game for my bot

sick cloud
#

is your bot purely a game bot

red hemlock
#

No not that much

sick cloud
#

then ask yourself if you really need a game in your bot

#

will it benefit it, will it improve it, will it make sense, and will users actually make use of it

red hemlock
#

Thx for the help

karmic compass
#

does anyone know how i can use digitalocean with github?
how do i set it up?

faint prism
#

Like what, pulling a repo or GitHub Actions deployment?

torn ravine
#

wise choice my friend

#

also I’ll be using digi ocean myself soon

karmic compass
#

same

#

i mean like

#

i use github desktop, so i'd put out the repository, then how do i get digitalocean to take that repository and run it

#

with heroku you just upload it, add in a few configs and add in Procfile with a node index.js in it and you're good

faint prism
#

use git clone https://github.com/yourrepolinkhere

#

That'll pull the code from the repo

torn ravine
#

I was thinking git clone

faint prism
#

That's how you pull a repo

#

Unless you use git init; git pull <repo link>

karmic compass
#

you can just use github desktop

#

also how do i use .gitignore

faint prism
#

look up docs for that

karmic compass
#

kk

prime fox
#

yo anyone good with ejs and can tell me why this doesnt work

#

whoops

faint prism
#

```

prime fox
#

wrong

faint prism
#

data is undefined

prime fox
#

be patient

#

smh

#

e x a c t l y

faint prism
#

Err

earnest phoenix
#

the script tags are isolated iirc

#

one may not access the variables of another

prime fox
#

no no

#

but it works if i set that to a string

#

and all <%- data %> is

#

is just like and object

faint prism
#

are you using a framework in your website..? like angular, vue, or react or something

prime fox
#

ejs

#

is all im using

faint prism
#

Oh right

prime fox
#

ping if someone has solution

strange trout
#

I dunno if they should be a different color

#

Or have some shadow

eternal flame
#

can someone give me quick code on how to get the invite url of the servers my bot is in

#

here

#

one sec

#
bot.on('ready', () => {
  bot.guilds.cache.forEach(guild => {
    console.log(" - " + guild.name, +guild.memberCount);
  })
}) 
#

this logs in the console the names of all servers and the member count of all the servers its in

#

can you maybe integrate it into that?

ancient nova
#

does anyone have flat gifs

sudden geyser
#

You could use the <Guild>.fetchInvites() method to fetch the invite from a guild, but you should typically avoid it. You probably don't need the invite in the first place and it's a breach of privacy.'

ancient nova
#

does anyone have flat gifs??

sudden geyser
#

Plus it requires you sending an HTTP request to the API since I don't think it's given to you

eternal flame
#

that is very true, but there is someone spamming the customcommand command and it is flooding the db, and on join my bot says the max custom commands for on server is 10 and this person has 47 and counting

#

i really wish to speak with them

sudden geyser
#

It would make a lot more sense to log who is running a command (or logging when written to a database) rather than fetching the invite to a guild.

eternal flame
#

hm

#

ytour right

#

ok

#

thx

thick gull
#

@eternal flame I recommend logging the channel ID and then sending a message to chat channel with the bot:)

#

if you must give them a warning

sand salmon
#

hi

thick gull
#

otherwise don't do it cause

#

yeah

eternal flame
#

oooh

#

good idea

#

im gonna call that command

#

crossserverwarn

eternal flame
#

also

#

with custom command

#

is it better to store the server for the custom command as the servers name or id?

thick gull
#

ID

#

Name can change

eternal flame
#

alr

earnest phoenix
#

would anyone know how to code a bot that says anything that you dm it?

#

and if you specify the channel and server

eternal flame
#

thats

#

just do a say command

#

have the bot delete the command message

#

so it goes

faint prism
#

would anyone know how to code a bot that says anything that you dm it?
and if you specify the channel and server
@earnest phoenix It would have to be already in said server for that to work

#

But that would not be hard at all the do

eternal flame
#

[prefix]say blah blah (pretend im deleted lol)

#

bot: blah blah

earnest phoenix
#

well, i have no experience with java script

faint prism
#

Well you'd have to pay someone to make it or learn JS then make a bot

earnest phoenix
#

^

#

ok

faint prism
eternal flame
#

yep

#

its how i got started

#

i made a bot called rat bot

earnest phoenix
#

ima do the latter

eternal flame
#

every time you said rat-rat he spat out random profanity

#

lol

earnest phoenix
#

sounds like u were either really young or....really young

#

also, is there a way to code a bot on a chromebook

#

KEKW
download an IDE

#

ok no then, im on a school chromebook and i cant install chrome applications

eternal flame
#

an ide

#

anyways

earnest phoenix
#

anyways

eternal flame
#

i need sum help

earnest phoenix
#

yes

eternal flame
#

so

earnest phoenix
#

don't ask to ask ty

eternal flame
#

im making a cross server warn command

#

its purpose

ancient falcon
earnest phoenix
#

tysm kyando

eternal flame
#

is if someone is spamming the custom command feature (which is stored in a mongodb) and is flooding our db and they are not in the server

#

we can do

#

society-cross-server-warn [channel id] you have been warned etc etc

#

but

#

im stuck

#

lemme get

#

screenshot real quick

ancient falcon
#

Next time, try to think about what you're gonna ask, before asking it to evitate this situation ^-^

earnest phoenix
#

^^^^

ancient falcon
eternal flame
#

I JUST READ THAT

#

LOL

#

when you make a custom command, it logs the channel that the command was made in the db

#

but right around the 2nd let MSG

#

the 2nd let msg is the issue

earnest phoenix
#

uh sorry

#

remove ()

torn ravine
#

how do I make conditional embed statements

eternal flame
#

ohh

earnest phoenix
#

if
else if
else if
else if
else if
else if
else if
else

torn ravine
#

I mean I didn't ask to be taught yandere dev code

eternal flame
#

still

earnest phoenix
#

you should learn JS syntax

#

@torn ravine you mean

#

uh

#

what?

#

i don't quite understand

eternal flame
#

i still need helep here

#

please

earnest phoenix
#

Gold

#

learn JS syntax

eternal flame
#

i

#

omg

#

im stupid

earnest phoenix
#

Not trying to be rude, but your code is a mess ;-;

eternal flame
#

yeah ik

earnest phoenix
#

my everything is a mess rn

torn ravine
#

@earnest phoenix I know syntax. I wanna use if statements to add stuff to embeds

earnest phoenix
#

i was talking to gold

#

not you

#

anyawys

#

uh

#

add stuff you mean

still badge
#

does heroku host forver?

#

forever*

earnest phoenix
#

add field?

torn ravine
#

oh

sudden geyser
#

sort of

torn ravine
#

@still badge more/less

#

if you’re running multiple bots on your account it won’t last

still badge
#

only 1

torn ravine
#

should be good

still badge
#

ok thanks

earnest phoenix
#

Anyways IF6

still badge
#

had to set everything up before it get reviews

earnest phoenix
#

If i understand correctly, you want to add something to embed inside if else statement?

torn ravine
#

yea

earnest phoenix
#

Alright

#

you need to make a variable of the embed

#

and then inside your if else statement, you can call the variable and modify it

#

and also edit the message to the new one

torn ravine
#

is it kinda like if if (x) { <embedName>#addField(`whatever`) }

earnest phoenix
#

embed variable

#

and yes

#

and also

#

edit the message

torn ravine
#

ah

earnest phoenix
#

why tf does discord bot maker cost money? i dont have that!

lusty quest
#

not everything can be free. Welcome to the Real World.

earnest phoenix
#

why do u think we have money

eternal flame
#

how do you check to see if the id of the author of a message matches up with the id given?

lusty quest
eternal flame
#

huh

#

ive been trying that and it isnt working

lusty quest
earnest phoenix
#

@lusty quest use ===

#

not ==

lusty quest
#

both work

earnest phoenix
#

=== is better

lusty quest
#

== will still compare them if one of them is a Bigint and the other one a String. === Will not

earnest phoenix
#

ik, anyways

ancient falcon
#

== is better here

#

since otherwise values that match might be seen as not matching

earnest phoenix
#

so uh, i have a question about bitshifting, how does it work?

ancient falcon
#

be more precise what do you not understand?

eternal flame
#

thx @lusty quest

earnest phoenix
#

I don't understand how it work, for example if i do 1000 << 1 what does it mean?

#

I did try google, but i don't understand it.

ancient falcon
#

the most left bit, here it's 1, will be lost and we add a zero on the other side

#

your basically pushing it towards the left

earnest phoenix
#

Ah, i see, thanks you

#

so it mean

ancient falcon
#

1000 >> 1 = 0000
0100 >> 1 = 1000

earnest phoenix
#

1000 << 1 === 000?

ancient falcon
#

0000

earnest phoenix
#

ah i seel, thanks

lusty spade
#

help, i want to filter multiple category of commands but i cant figure how.
code:

    if(!message.channel.nsfw && message.author.id !== BOT_OWNER) {
        categories = [...new Set(client.commands.filter(cmd => cmd.category !== ['NSFW', 'Owner']).map(cmd =>cmd.category))];
    }```
earnest phoenix
#

so

#

uh

#

zphon

#

basiclly

#

you don't do that

#

you do something like this

sick cloud
earnest phoenix
#

#Array.includes("sdfsdf");

#

@sick cloud beta when

lusty spade
#

so what do i do?

sick cloud
#

in a couple months

#

or so

earnest phoenix
#

#Array.includes("String"); //True if array have element

sick cloud
#

still a long way to go

earnest phoenix
#

for example

#

let x = ["TEST", "OWO"]
x.includes("TEST") //True
x.includes("OwO") //False

#

@lusty spade ^^

eternal flame
#

how do i send an embed to a specific channel?

earnest phoenix
#

uh

lusty spade
#

ok

earnest phoenix
#

#TextChannel.send(Embed)

#

you can pass embed data directly into it

eternal flame
#

where do i identify what channel to sne dto

earnest phoenix
#

you uh

#

get the channel use id?

eternal flame
#

where do i put it

earnest phoenix
#

uhh

#

.find() in cache manager...?

eternal flame
#

im

#

confused\

#

;-;

cunning gorge
#

Hello for anyone familiar with mongo db can you help?
In my insert function example:

collection.insertOne({ "userId": message.author.id, "here": color })

Instead of here I would like to use variables for that based on user input, however, when I use ${} in the here part it does not accept it, anyway around this?

I basically want it to be like this

collection.insertOne({ "userId": message.author.id, `${args[1}`: color })

However, right now it does not accept it

This is a mongo db field

eternal flame
#

my man

#

it has to be ${}

#

not "${}"

#

@cunning gorge

#

`

#

${}

#

`

cunning gorge
#

I did that

eternal flame
#

show me the error output

cunning gorge
#

sorry the `` turned into the discord markdown thing

ancient falcon
#

isn't it github flavoured markdown though thonk

cunning gorge
ancient falcon
#

nvm it's disc flavoured

sudden geyser
#

you can't really use template strings like that there

cunning gorge
#

this works...but

#

not what I want

#

you can't really use template strings like that there
@sudden geyser in mongo db?

lusty quest
#

make a value with the stuff you want to insert and then just pass the value

cunning gorge
#

So if I made a variable called example

#

does this work

lusty quest
#

try and see

cunning gorge
#

or will mongo db wont accept it

sudden geyser
#

in JavaScript in general, You can't have the key be a template string, but you could use it like "{ [${something}]: 5 }" However, I'm not experienced in MongoDB and probably can't help you there

cunning gorge
#

ohh ok thx

#

so [] should work for keys?

sudden geyser
#

If you need to use it that way, but do you really need it?

lusty quest
#

one question is color a value or a key?

cunning gorge
#

If you need to use it that way, but do you really need it?
@sudden geyser I do

hard pendant
#

it didnt give me discord bot dev rank

#

??

lusty quest
#

is your bot Approved?

hard pendant
#

yes

lusty quest
#

here on DBL?

hard pendant
#

it supost to be

lusty quest
#

what is the userid of your bot?

hard pendant
#

client id?

lusty quest
#

yes or run in #commands -bots your userid or mention

#

if no bot is listed its not added here

karmic compass
#

Not super urgent/serious, but I’ve always wondered how to add text onto an image with JavaScript, kind of like MEE6 leveling

lusty quest
#

use Canvas.

karmic compass
#

Oh

sinful crater
#

i need help ;-;

torn ravine
#

yea say what you need help with

sinful crater
#

so i made abot of myself and i was trying to do a custom command and i had it as !shigarakipat {user} and it wont work :/

torn ravine
#

language and error please?

sinful crater
#

huh?

torn ravine
#

what coding language do you use

winter basalt
#

what language

#

and does it give an error

torn ravine
#

and what is your error (if any)

sinful crater
#

wdym language and error? im sorry for asking these questions i just start making bots

#

um- botghost

torn ravine
#

oh boy

sinful crater
#

what ;-;

#

is it bad?

torn ravine
#

no. I just don’t know how to use it

sinful crater
#

oh

#

what do you use then

torn ravine
#

I use javascript

sinful crater
#

oh, i can't script ;-;

#

or code

#

or whatever you wanna call it

torn ravine
#

yes we code

sinful crater
#

i suck at coding

#

like if i even try i mess up instantly

torn ravine
#

there is no “messing up” in coding

lusty quest
#

it either work or doesnt work. there is no inbetween

prime fox
#

p!p look at me

#

p!!p look at me

#

wait

#

wrong channel

lusty quest
sinful crater
#

i like just started and id know to do anytthinnggg

earnest phoenix
#

I wanna setup mongo db

worn copper
#

Which language?

outer spruce
#

because what you typed counts to 15 characters
@earnest phoenix hi

strong tundra
#

is canvas like svg

#

cuase svg is cool

faint prism
#

I wanna setup mongo db
@earnest phoenix Did that recently with Discord.NET

strong tundra
#

mongoid db

thick gull
#

How would I call prefix outside of this if statement?
im 99% sure this is how you do it but idk what im doing anymore.. console.log() for debug, commented out database if that was the issue

#

but prefix still is the one outside

#

(i cleared the db and commented out the check if it exists)

vapid cosmos
#

Does anyone know to set a status on a bot? (it is discord.js)

strong tundra
#

no i dont sorry

thick gull
#

you would use the client.user.setPresence({})

vapid cosmos
#

ok

thick gull
strong tundra
#

why would you need to check the channel type?

thick gull
#

because im using server prefix

#

and if its in a DM it's not gonna be able to check message.guild

#

cause it's not a guild, it's a dm

faint prism
#

Does anyone know to set a status on a bot? (it is discord.js)
@vapid cosmos setGameStatus or something

thick gull
#

i literally just answered him

#

with a doc link

strong tundra
#

should i use postgresql

faint prism
#

My bad. Kinda intoxicated

thick gull
#

'tis ok

faint prism
#

should i use postgresql
@strong tundra SQLite and MongoDB are pretty good options as well. The only once I've used

delicate zephyr
#

SQLite is only use for quick development

#

its not easily scalable

strong tundra
#

xd

#

probably gonna use postgres then

#

what lmao

#

is cockroachdb compatible with postgres?

worn copper
#

Mongodbs quite good actually, the database is easy to set up, the API ehh it's intermediate

The only thing id say about mongodb is that queries take forever for me >:( (I'm using indexes)

karmic compass
#

Hey uh, was watching a tutorial, was wondering if this is supposed to be done:
The guy had all commands in separate files, I have 1 single file, am I supposed to use multiple?

thick gull
#

its better if you use multiple

strong tundra
#

i see code splitting being done for organization

#

most people split it but you can keep everything in the same file if your bot has a small featureset

stiff stream
karmic compass
#

Yeah it’s only maybe 50kb in total

strong tundra
#

are you planning for a lot of features?

karmic compass
#

No, I usually just look at things, think “I like that” and try to add it

stiff stream
#

someone

strong tundra
#

ah

karmic compass
#

Eventually though I might make like a “fun.js” and “mod.js”

thick gull
#

ron ahve you checked the docs

strong tundra
#

yeah you may as well split then

karmic compass
#

Also how do I split them? Have multiple client.logins?

thick gull
#

heck that wasnt edit

karmic compass
#

Lmfao

strong tundra
#

nah

thick gull
strong tundra
#

is this node.js?

thick gull
#

i recommend this if its node.js

#

sh

strong tundra
#

that can work yeah

thick gull
#

let him use his brain:)

golden condor
#

If it's djs

#

You can just send the object

#

msg.author

#

That wil mention them

thick gull
#

man ive been writing like 6 extra characters whenever i want to do that

#

:(

#

im probably gonna sleep,
tried multiple things for this, if there's an obvious solution just DM me..

-- I dont want it to try and get guild.id in a DM, and instead just use the default prefix.

#

so yeah DM me if you have a solution, gonna go sleep pce

stiff stream
coral trellis
#

What's the error?

stiff stream
coral trellis
#

Are you actually mentioning someone?

stiff stream
#

wait

#

ty lol

#

so @coral trellis

#

its working

#

but

#

its sending the id

thick gull
#

you can surround it in <@> if you want to show their ping

stiff stream
#

no i dont want it to ping them. only their name

coral trellis
#

Then do .username after .first()

stiff stream
#

thx

pale vessel
#

did you add a check to see if a user was mentioned

stiff stream
#

no i did

#

now*

stiff stream
#

@rocky hearth ask here

exotic prism
#

hello im migrating to discordjs v12 and i cant find how to check if a role exist in server or not

v11:
if (message.guild.roles.exists("text", "Support")) {}

#

i (probably) found a way:
array list

#

nope

#

lagged my bot out

tight plinth
#

read docs

earnest phoenix
#

Can i make bot in offline mode

#

????

exotic prism
#

what is offline mode

earnest phoenix
#

like no Wofi

#

wifi

#

and internet

exotic prism
#

i dont think

#

you can do that

#

**without a connection to discord api **

earnest phoenix
#

yes u can but i cant test it

exotic prism
#

ok?

thick gull
#

so you answered your own question

earnest phoenix
#

ye

#

:))

exotic prism
#

ima search in role's cache

#

does array method in role's cache returns arraylist of roles?

earnest phoenix
#
let role = message.guild.roles.cache.find(r => r.name === "name");
if(!role) return message.channel.send("role not found")
#

@exotic prism ^^^

exotic prism
#

oh ty

earnest phoenix
#

there is no docs for that

#

u have to use JS and Brain

#

or maybe YOUTUBE

#

:))

exotic prism
earnest phoenix
#

yed

#

yes

exotic prism
#

ty man

earnest phoenix
#

yo

#

how do i get discord's database?

#

@earnest phoenix hack it

#

;))

#

Ah thanks dude

#

np

exotic prism
#

LOL

oak cliff
#

Let's not be trolls in here guys

#

Serious dev questions

earnest phoenix
#

ok smh

#

how do i get discord's database?
@earnest phoenix u mean Discord API ??

#

A Public part from Discord Database

exotic prism
#

js?

earnest phoenix
#

ay my first starboard <3<3

#

message.member.roles smth

#

Idk

#

Ask someonw

#

Me never tried role stuff

exotic prism
#

guild member role manager

#

i think?

earnest phoenix
#

suchas People A type command !check if he in side support server mine guild bot will reply success if don't revoke

#

Fix your English first

#

Or speak another language

#

We have Googke Translate

oak cliff
#

Let's not be rude

earnest phoenix
#

Me not rude

oak cliff
#

The way you worded it was rude.

earnest phoenix
#

Me just saying that if he has some problems with English then he should ask in some other language/use grammarly

#

Also we getting off topic

#

How i check message.author.id includes in support guild?
@earnest phoenix do you want to check if the guy is in your guild?

#

yes

#

@earnest phoenix

oak cliff
#

Check to see if they are a member

#

You using discord.js?

earnest phoenix
#

yes

#

@earnest phoenix
@earnest phoenix don't ping me

#

Pretty sure you need to search for the user id X in guild Y

#

bot.guilds.cache.get("Y").members.cache.find("X");

#

@earnest phoenix

#

Try that

#

You need to get the guild ID of the support server

lethal pine
#

someone please help me how to add mongodb with discord.py

earnest phoenix
#

You can't

#

Mongodb is for JS

quick ginkgo
#

and alhassan's link ;-;

earnest phoenix
#

@earnest phoenix Please dont spread false information.

lethal pine
#

kk

earnest phoenix
#

Wait what

#

Lol

lethal pine
#

xD

earnest phoenix
#

lmao

quick ginkgo
#

make sure to store what you need, such as only storing guild id's, channel id's, and that kind of stuff
you can then use the ids and the discord.py lib to get the objects needed

earnest phoenix
#

Also if i make a syntax error in a try catch block will it still crash the js program

#

Really depends on the use case

#

@earnest phoenix What are you saying...

#

Lol

#

Me has gone nuts maybe

quick ginkgo
#

Also if i make a syntax error in a try catch block will it still crash the js program
@earnest phoenix

pretty sure it will just stop at the line of code, then exit the try-catch block and continue where it left off

earnest phoenix
#

what's the best IDE in the world

#

They support 50+ languages

quick ginkgo
#

hayper, really depends on your style of coding and which one suits your preferences

earnest phoenix
#

They have "code intelligence" for freaking discordjs

#

And a lot of other npm packages

#
function iCrashYou() {

  while(true) {
    iCrashYou()
  }
}
#

Lol

#

^ @earnest phoenix that will crash ur stuff

#

Why

quick ginkgo
#

if you use java, python, c++ or c#, then i can recommend my favorite ide's

earnest phoenix
#

Oh you mean my stuff

#

I thoughr it will burn my pc

#

Time to wreck windows by running it on startup

quick ginkgo
#
public static void crash(){
  while(true){
    system.out.println("why tho");
  }
}
crash();
earnest phoenix
#

if you use java, python, c++ or c#, then i can recommend my favorite ide's

ide's

Your ide's what

quick ginkgo
#

what language are you using?

earnest phoenix
#

QBasic

stable eagle
#
        let gayembed = new Discord.MessageEmbed()
            .setDescription(`${message.author}, you are ` + Math.floor(Math.random() * 100) + `% gay. :rainbow_flag:`)
            .setColor("#A4C9F6")
            if (!message.guild.me.hasPermission("EMBED_LINKS")) {
                return message.channel.send("Oh no! I don't have `EMBED_LINKS` permission! May I please have it?");
                message.channel.send(gayembed);
            }``` for some reason, this code doesnt seem to send the embed?? May someone help?
earnest phoenix
#

My skool sucks

quick ginkgo
#

then i can't recommend an IDE, never used QBasic, or heard of it

earnest phoenix
#
        let gayembed = new Discord.MessageEmbed()
            .setDescription(`${message.author}, you are ` + Math.floor(Math.random() * 100) + `% gay. 🏳️‍🌈`)
            .setColor("#A4C9F6")
            if (!message.guild.me.hasPermission("EMBED_LINKS")) {
                return message.channel.send("Oh no! I don't have `EMBED_LINKS` permission! May I please have it?");
                message.channel.send(gayembed);
            }``` for some reason, this code doesnt seem to send the embed?? May someone help?

@stable eagle there is a ` before case

stable eagle
#

there wasnt, accidentally typed 1 extra, but no

earnest phoenix
#

use hastebin

quick ginkgo
#

you need to queue the message if you're using JDA

earnest phoenix
#

No

#

He's using js

quick ginkgo
#

ah didn't notice the "let"

#

then no clue

earnest phoenix
#

Wait

#

You can't have embeds without a title

stable eagle
#

you can

earnest phoenix
#

Smh

#

I tried but it never worked unless i put a title

quick ginkgo
#

Milo, dont you need to put a ";" after the .setColor()?

stable eagle
#

imma try

earnest phoenix
#

Yep

#

What is better, Qbasic or freaking shell scripts

stable eagle
#

still doesnt work

earnest phoenix
#

Maybe

#

Try sending an embed object

#

Wait

#

You used a template string and a +

#

Was the template string terminated before the +

stable eagle
#

I somehow made it work,

earnest phoenix
#

What did you do

#

Pretty self explanatory

pure lion
#

Why is there a template string with +s

#

Oh fuck the download process on vs went from 45 to 44

stable eagle
#

ReferenceError: Cannot access 'target' before initialization

But I have declared it? let target = message.mentions.members.first();

pure lion
#

Yes

#

But

true flume
#

Dam boi dam boi he thicc

pure lion
#

Js is read
Line
By
Line
So you have to declare it higher

stable eagle
#

man I suck at js

#

ok ty

earnest phoenix
#

Does anybody know how's the magik images are actually created?

#

What's used to do the manipulation of this

pale vessel
#

you can use the imagemagick module

earnest phoenix
#

Is it an npm package

#

Maybe

#

imagemagick module
Well it probably should be

misty sigil
#

ban

#

mute

#

kick

#

purge

real niche
#

warn

analog kestrel
#

ohk

#

These are already there

#

more?

misty sigil
#

lock channel

analog kestrel
#

already there

real niche
#

You'll probably want to have some sort of antispam feature if your doing moderration.

#

Chat filter

analog kestrel
#

Hmm

small prairie
#

Um opus installing is spamming my console with pink warnings

#
../deps/opus/silk/macros.h:59:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
../deps/opus/silk/macros.h:69:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if OPUS_FAST_INT64
``` this is being spammed like a million times
analog kestrel
#

I want to add reset chat but i dont know a lot coding so i dont know the code for it i use d.js

earnest phoenix
#

Reset chat???

analog kestrel
#

Yes

earnest phoenix
#

Wdym

#

Also your name looks like you're from India

analog kestrel
#

by using that comamnd all the messages of a particular channel deletes can only be used by the admins

#

@earnest phoenix yes i m

earnest phoenix
#

Me too

#

Tumhari english mujhe samajh nahi aa rahi isliye aise baat karo

analog kestrel
#

But talk in english here if you wanna talk in hindi dm

earnest phoenix
#

Ok

#

You can just delete the channel

analog kestrel
#

Hmm

earnest phoenix
#

Or do message.channel.bulkDelete(100000008888034619154646491);

small prairie
#

Uh

#

bulkDelete() takes a collection

#

Nevermind

analog kestrel
#

Hmm

earnest phoenix
#

Ban

#

Kick

#

Warn

analog kestrel
#

Hmm

small prairie
#

ban kick purge warn mute?

earnest phoenix
#

Pretty easy

analog kestrel
#

i have these all

earnest phoenix
#

Except for mute

small prairie
#

Mute will get a lil complex

#

^^

analog kestrel
#

wait

earnest phoenix
#

Your bot goes down = the guy never gets unmuted

#

Some beginners use setTimeout

#

Like me

misty sigil
#

guy never gets unmuted? well, uh, deal with it

analog kestrel
#

My bot have these comamnds

earnest phoenix
#

SetTimeoir

#

*setTimeout

small prairie
#

Which lang?

analog kestrel
#

node.js

earnest phoenix
#

Nodejs is used to run javascript

analog kestrel
#

Wait a sec

earnest phoenix
#

Javascript is the langauge

small prairie
#

^

analog kestrel
#

I got a dm

earnest phoenix
#

Also what are promises in JavaScript

small prairie
#

you cant natively wait in js you can use async await or promises to "wait" for something

earnest phoenix
#

You can

#

setTimeout

#

the syntax:

#
setTimeout(function(){
//code
}, time in milliseconds);
small prairie
#

That doesnt wait for something
everything else will keep running
waiting is wait for that part to be done and then the other should start
in settimeout after the way only the function given in settimeout will run and anyone after it will keep running

#

^^

earnest phoenix
#

Put your other code in .then

small prairie
#

you cant natively wait in js you can use async await or promises to "wait" for something

earnest phoenix
#

.then will run after setTimeout has done doing stuff

small prairie
#

.then is a part of promises

#

and .then can make the code super messy i prefer using await

odd sun
#

can't you just use something like this:

const delay = (msec) => new Promise((resolve) => setTimeout(resolve, msec));
await delay(1000);
earnest phoenix
#

???

small prairie
#

ye that works

#

it should i never used it

odd sun
#

I use it in several commands, and it waits for time to run out

small prairie
#

great then

earnest phoenix
#

Cool

#

I just chain setTimeours

#

A setTimeout inside setTimeout works too

#

I used it for my hack command to edit the message after 2 second intervals then stop at the 7th

#

Api spam smh

small prairie
#

Lmao

#

Why cant i install OPUS ;-;

earnest phoenix
#

Why cant i install OPUS ;-;
@small prairie check dependencies

#

Leveldown has a weird installation

#

So i switched to levelup

pure lion
#

@discordjs/opus

#

@small prairie

earnest phoenix
#

Or do npm install opusscript

#

Both work

pure lion
#

opusscript is bad

small prairie
#

Aghhhh

#

I accidently was installing opus

#

just opsu

#

im dumb

#

i removed those from package.json and it worked

neat bolt
#

Hey I'm new in discord

misty sigil
#

Ok.

neat bolt
#

So I want to know that how to invite bots in servers

misty sigil
#

Ok.

#

So do you have a bot in mind?

neat bolt
#

Yeah like dank memer, rythm etc.

misty sigil
#

and search the bot's name

#

then you can tap view on the bot you want to invite

#

there should be an "invite" button

neat bolt
#

Ok

#

It is not working

misty sigil
#

What do you mean?

neat bolt
#

It says

#

That

misty sigil
#

Ah.

#

Try doing it in browser as OAuth is a bit broke in android

neat bolt
#

Ok

earnest phoenix
#

How is db.get(`test_${user.id}_{message.guild.id}`)but in json ?

#

don't do json

#

json is a bad drug

#

worse than meth

#

have you tried reading the error

#

Can anyone help?

#

have you tried reading the error
@earnest phoenix

#

The command "npm i quick.db" doesn't work

misty sigil
#

what error does it return.

#

doesn't work doesnt help

earnest phoenix
#

read instructions on the npm page on how to install quickdb

#

you could've done this yourself by just ✨ r e a d i n g ✨

#

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-08-09T10:42:31.785473+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-08-09T10:42:31.863830+00:00 heroku[web.1]: Process exited with status 137
2020-08-09T10:42:31.901715+00:00 heroku[web.1]: State changed from starting to crashed

#

error in heroku

#

stop using heroku as a bot hosting

#

problem solved

#

why

#

I didnt ask you

#

dont interupt if you are dumb

#

because they do not allow it and heroku is a WEBSITE host

#

nope

#

i mean you're the dumb one here but sure LMFAO

#

if it is possible then we can

#

fk

#

it is also possible to eat shit, doesn't mean you should do it

#

I am not like you

#

How is db.get(`test_${user.id}_{message.guild.id}`)but in json ?

#

does anyone know ?

#

oh you do eat shit? interesting

#

stop using json, yungspanac

#

tell me

#

a better db

#

lol

#

to script my mute command

#

he interupt everytime

#

any database, i personally suggest sqlite for small scale if you want to do sql

#

if not, there's mongodb for nosql

#

hmm

#

Ok

#

i want a

#

in hots db

#

@ember atlas

#

u understand ?

#

host*

#

i do understand

#

can you plz gift a mute to this guy

#

which one is good

misty sigil
#

any database

#

apart from json really

earnest phoenix
#

^

#

json isn't a database in the first place

#

k thx

light wolf
#

@earnest phoenix are u from?

near ether
#

holy shit im crying laughing from that convo

I didnt ask you
dont interupt if you are dumb

earnest phoenix
#

?