#development

1 messages Β· Page 1041 of 1

earnest phoenix
#

i know what process.env does and i don't know anything other than that

#

and ditching school to listen to spotify and use discord

#

You writing smth long, I'll read it

quartz kindle
#
const input = process.stdin;
input.setEnconding("utf-8");

console.log("hello, type a name");

input.on("data", data => {
  console.log(`you chose ${data}`)
});
earnest phoenix
#

Thx

#

Love ya

#

Lol

#

Me to google assistantWRITE THAT DOWN!!!

topaz fjord
#

amazing how development has also turned into shitpost

sudden geyser
#

First time?

earnest phoenix
#

amazing how development has also turned into shitpost
@topaz fjord thats discord bot developers for you

topaz fjord
#

basically

#

@sudden geyser not the first time for me

#

it's just fun pointing it out

surreal notch
#

why spamming

#

Β―_(ツ)_/Β―

lusty quest
#

mutiple instances

sudden geyser
#

You probably have a loop running (or infinite loop). Do you know where the embed is coming from and being sent in your source code.

surreal notch
#

no

#
  if (message.content.startsWith(`${prefix}botinfo`)) {
if(message.author.bot)return
    const help = new Discord.MessageEmbed()
      .setFooter(
        `Requested by ${message.author.username}`)
      .setTimestamp()
      .setColor("#FF4500")
.addField("Servers:", client.guilds.cache.size + " guilds!", true)
  .addField("Users:", client.users.cache.size + " users", true)
   .addField("Channels:", client.channels.cache.size + " channels", true)
  .addField("Library:", "Discord.js", true)
  .addField("Node Version:", "12.2.0", true);


 return message.channel.send(help);
  }
});```
#

@sudden geyser

pure lion
#

Poobis

lost stone
#

hmm

opal plank
#

collect event is emitted

#

though remove nor dispose are

#

any clues?

compact echo
#

@surreal notch Probably because you didn't do if(!message.author.bot) return;

#

I think that's it

#

idk

quartz kindle
#

dispose events need to be enabled in the collector options

opal plank
#

what about remove tho?

quartz kindle
#

not sure, try it

opal plank
#

though i dont see anything regarding remove event

#

unless...

quartz kindle
#

but im pretty sure dispose:true works for both

opal plank
#

actually, no, it shouldnt matter here

#

not sure if the filter is different for removal

#

i would doubt that'd be the case

quartz kindle
#

just set dispose:true

#

and test again

opal plank
#

aight

#

up that was it

#

its really odd that you gotta enable it though

#

i assumed it'd be only used as handler for when the reaction doesnt exist anymore

#

ty Tim

quartz kindle
#

the dispose option is for all collectors, not only for reaction collectors. it also works for message collectors

compact echo
#

Hey, I want to connect my mongodb database but it always says that it can't. What is the right way to connect it?

quartz kindle
#

it basically defines if whateverDelete or whateverRemove events are to be ignored or not

opal plank
#

Thats what i think is strange, the option is called dispose, but it affects dispose AND remove

quartz kindle
#

because it works at the event level

#

not in the collector

opal plank
#

yeah it indeeds say's 'deleted'

#

that would include reactions being deleted

quartz kindle
#

yup

opal plank
#

a bit weird, but i get it

quartz kindle
#

if dispose is not enabled, nothing is removed from the collected items, so your collection will still return deleted items if they were deleted in the mean time

opal plank
#

that makes sense

quartz kindle
#

@compact echo show code

spare mirage
#

is there an easy way to make a bad word protection

compact echo
#

Probably

quartz kindle
#

there are so many variations of that, so not really easy

compact echo
#

@spare mirage Just do something like if(message.content === "badword"){

spare mirage
#

hmm

#

Thats what I mean

#

it will be like

#

2000000000 lines of code

#

lol

quartz kindle
#

computers dont understand your intentions behind those words, they just see words. so there are pretty much unlimited way of bypassing any word filter by conveying your bad intentions in different ways, ways that computers dont understand, but humans do

compact echo
#

Yea

#

But you can do like an array of bad words

meager jasper
#

lol

#

how can I be a bot developer?

solemn latch
#

Often, your looking at matching a word 70% anyway.
Like the f word someone much write
F*ck
You can catch that by matching the same structure, and whatnot

summer torrent
#

Make a bot

meager jasper
#

I already make a bot but the people by top.gg have to verify him...
Did I have to wait?

quartz kindle
#

yes

summer torrent
#

you will get a role when your bot is approved

meager jasper
#

OK thx for the support :3

compact echo
#

Hey, just asking but how do I connect a mongoose Database? If there is a video, please tell me

tulip ledge
solemn latch
#

i guarantee there are videos on youtube

tulip ledge
#

Woo u changed ur avatar

solemn latch
#

but typically, videos are not a great source for those needs

compact echo
#

Please help. I really want to

tulip ledge
#

Although I prefer docs over tutorials

#

I send u the docs

compact echo
#

ok

#

i'll try

#

Thanks

ruby talon
#

So ehm.

function parseData(message, type) {
  data = [];
  console.log(data);
} ``` ```bash
./src/components/DiscordMessage.js
  Line 38:3:   'data' is not defined  no-undef
  Line 39:15:  'data' is not defined  no-undef

Search for the keywords to learn more about each error.
#

(js obv)

tulip ledge
#

Ur not defining data

ruby talon
#

omg

compact echo
#

yea

#

lmao

ruby talon
#

welp

#

I'm stupid

tulip ledge
#

data = []; no let or var and you're also not passing it as an argument

ruby talon
#

happens when u come from python lmao

#

hahahha

#

omagawd

#

ty tho hahaha

tulip ledge
#

Np

#

Is that a custom error handler?

#

Cuz I haven't seen that

ruby talon
#

No

#

react x)

tulip ledge
#

Oh

ruby talon
tulip ledge
#

Same problem?

#

Code?

cobalt spruce
tulip ledge
#

This time it'(s different lines

cobalt spruce
#

why me

tulip ledge
#

Your message is empty

#

Like it sais

#

Can't do much without code

cobalt spruce
#

BRUH

ruby talon
#

It was example error

#

xD

cobalt spruce
#

is not

tulip ledge
#

Yes it is

#

Read the error

ruby talon
#

Same problem?
It was showing the fancyness of react error.

tulip ledge
#

You're trying to send an empty message

#

Alright

#

Add a catch

#

You're sending a user a DM with DM's disabled

#

You can prevent this by using a .catch()

quartz kindle
#

gotta catch em all

surreal notch
#

How to add blank field in discord.js v12

opal plank
#

you dont, use some unicode

surreal notch
opal plank
#

\u200B

#

for example

#

it'll error if its empty/null

surreal notch
#

ok sar

opal plank
#

i love catch blocks, its a lazy persons best way to cleanse your soul of guilt

#

just slap a .catch(() => {}) and all your problems are solved @quartz kindle

solemn latch
#

Best solution

quartz kindle
#

"my command doesnt work, no errors"

opal plank
#

^^

#

cant error if you void the errors

tulip ledge
#

@opal plank Don't ignore your errors handle them

opal plank
sudden geyser
#

.catch(() => { throw new Error("Oh, no!"); })

opal plank
#

not cursed enough
.catch((err) => {if(err) try { function errHandler(err) {throw (err)}}})

earnest phoenix
#

just don't look at the console and there will be no errors BigBrain

quartz kindle
#

.catch(e => throw e).catch(e => throw e).catch(e => throw e).catch(e => throw e)

opal plank
#

perfect

sudden geyser
#

error: syntax error

opal plank
#
a.catch((err) => {
if(err) 
try {
function errHandler(err) {
throw (err)
}
errHandler(err).catch (err => {})
}}
)```
solemn latch
#

this line is too straight

#

i think you got this online

sudden geyser
#

it's a commonly used image

opal plank
#

i wonder if that works

#

holdup

sudden geyser
#

trust me it won't

opal plank
#
somethingthatwillerror.catch((err) => {
  if (err) {
    try {
      function errHandler(err) {
        throw err;
      }
      errHandler(err).catch((err) => {});
    } catch (err) {
      throw err;
    }
  }
});```
#

just tried

#

this has to be some of the worst things ive done

tulip ledge
#

What did it do?

opal plank
#

nothing

#

voids the error

tulip ledge
#

Oh lol

#

Oh ur not throwing it?

opal plank
#

it wont pass there, it'll try the function first and error

#

the catch block onto errHandler will error and void it

tulip ledge
#

So I have this JSON file:

"potions": {
  "health": {
    "limitedtime": false
  },
  "strength": {
    "limitedtime": true
  },
  ...
}

Now I'm tryna get all the entries that have limitedtime set to true how would i do that?

#

Should I forloop the keys?

opal plank
#

are those always the same?

#

only changing their states?

tulip ledge
#

They never change

#

It's always true and false

opal plank
#

so tis always only strength and health?

tulip ledge
#

But some potions have different properties meaning some have health some have strength and speed etc

#

And these potions have limited effects

opal plank
#

so potions have different properties?

tulip ledge
#

Yes

opal plank
#

if so, yeah, loop for in

tulip ledge
#

Alright

compact echo
#

How would I make a login page on my website with MongoDB, node.js, and html?

gray zealot
#

Hi again πŸ˜„ So, I want to make a bot status command and this is what I have so far: ```css
if (message.content === ${prefix}botstats) {
message.channel.send(Total members: ${message.guild.memberCount} \n Total servers: ${botGuilds.toLocaleString()}\n Total channels: ${botChannels.toLocaleString()}\n\nUptime: ${Client.util.parseDur(Client.uptime)});
}

But I keep getting an error saying ``botGuilds is undefined``
compact echo
#

I think it is

lusty quest
#

bot.guilds

#

not botguilds

#

(total servers)

#

the same for channels

lusty quest
#

(if your client is named bot)

#

@compact echo yes

#

but how idk

#

i would open google and search for it

compact echo
#

O

misty sigil
#

oauth

compact echo
#

wdym?

gray zealot
#

bot.guilds
@lusty quest ok, ty

misty sigil
#

is it a discord thing?

compact echo
#

idk

misty sigil
#

what?

compact echo
#

Is it?

misty sigil
#

how do you not know what your logging into

#

I don't know

#

you tell me why you want them to login

compact echo
#

For my bot

#

Or for like a discord bot listing thing

misty sigil
#

well

#

discord oauth

compact echo
#

o

slender thistle
#

How do you keep the user logged in when they log in with Discord OAuth and close the tab? Are cookies an option in this case?

compact echo
#

Idk

#

Do you know?

gray zealot
#

bot.guilds
@lusty quest ok, so when I do the command it out puts Total servers: [object Object]
Tell me if you want the code again...

lusty quest
#

add .size

compact echo
#

It

gray zealot
#

add .size
@lusty quest ?

#

where...

#

πŸ˜„

compact echo
#

It's bot.guilds.cache.size

gray zealot
#

ok

earnest phoenix
#

Aja

gray zealot
#

ty

compact echo
#

np

gray zealot
#

πŸ™‚

#

um..

#

now it says size is undefined bot.channels.chache.size

#

like that?

#

@compact echo
(ping)

#

sorry 😬

compact echo
#

you spelled cache wrong lmao

gray zealot
#

opps

#

πŸ˜†

compact echo
#

lmao

gray zealot
#

lol

#

sorry

compact echo
#

it's ok

snow urchin
gray zealot
tulip ledge
#

Read it

vernal basin
#

any reason why my bot might be sending an Empty Character in place of an embed?

tulip ledge
#

Code?

#

@vernal basin

#

@snow urchin

npm i -g --add-python-to-path --vs2015 --production windows-build-tools
npm i better-sqlite3
snow urchin
#

and u presume im on windows?

compact echo
#

lmao

#

probably

tulip ledge
#

Then install the build tools for your OS

snow urchin
tulip ledge
#

Linux: sudo apt-get install build-essential
Mac: Install XCode -> Once XCode is installed, go to Preferences, Downloads, and install the Command Line Tools.

snow urchin
tulip ledge
#

Also this

snow urchin
#

thats not related

compact echo
#

Yes it is

#

Just install discord.js 12

snow urchin
tulip ledge
#

Install better-sqlite3 for enmap

#

And install the dependencies it's asking for

compact echo
#

Just asking but How do I integrate my discord bot into a website?

tulip ledge
#

Like a dashboard?

compact echo
#

Like Luca

#

Yea I guess

#

Dashboard

tulip ledge
#

Or if you're using mysql databases or external ones you can just make the users log into the website with oauth (also what u do when using express) and then use PHP to send MySQL queries

snow urchin
tulip ledge
#

Why are u doing npm i

#

And not the things I told u to do?

snow urchin
#

....

#

ive done does things

#

lol

tulip ledge
#

Oh ok

#

Mmmh

#

I've done a quick research

#

And as far as I've seen your node-gyp installed incorectly or one of the packages that has node-gyp as a dependency

#

There's 2 ways to solve it

quartz kindle
#

didnt better-sqlite3 stop using integer?

tulip ledge
#

Either by deleting package-lock.json and all the node modules and reinstalling them
Or by removing node-gyp and reinstalling it

#

I don't know

#

I can check

#

Is integer a dependency?

snow urchin
#

both of does have been done, this is the first install ive done, without a package.json and node_modules folder.

#

fails every time

tulip ledge
#

Try

#

rm -rf ~/.node-gyp
npm install

quartz kindle
#

is enmap still not using v7?

tulip ledge
#

I don't know

quartz kindle
#

it is

tulip ledge
#

Mmmh

quartz kindle
#

show your package.json

tulip ledge
#

Well seems like you have an outdated version then

snow urchin
#

its worked on previous host

#

as soon as I have moved to this server, it dont want to install

tulip ledge
#

Am I blind or do Inot see better sqlite3 there?

quartz kindle
#

why is node version 8?

snow urchin
#

quick.db required better-sqlite3

quartz kindle
#

you want to use enmap or quick.db?

#

they both do the same thing

snow urchin
#

im movin it all to quick.db at some point

tulip ledge
#

The nwhy bother installing enamp now?

#

enmap*

snow urchin
#

i have my reasons..

earnest phoenix
#

anyone has a bot that auto kicks/denies the alt [less than 14 days] to join the server?

quartz kindle
#

thats why

#

quick.db is still on v6

tulip ledge
#

No you're not able to find user's IP adress through a bot

#

@earnest phoenix

quartz kindle
#

anyway callum why are you using node 8?

tulip ledge
#

It's also against the ToS

earnest phoenix
#

how

tulip ledge
#

Thats hwat I was wondering too

snow urchin
#

dw i aint

tulip ledge
#

You aren't allowed to get any data from a user without there consent

quartz kindle
#

then remove engines from your package.json

snow urchin
#

av done

earnest phoenix
#

then invite manager also shows the creation date of account

#

@tulip ledge

tulip ledge
#

That's technically against the rules

earnest phoenix
#

i want to auto kick them

tulip ledge
#

Wait thats teh wrong one

#

Let me find it

#

1 sec

snow urchin
#

@earnest phoenix You want them to be autokicked if their account is under 14 days old?

earnest phoenix
#

ye

tulip ledge
#

Oh

snow urchin
#

<user>.createdAt

tulip ledge
#

i thought u wanted to see if the user was an alt

earnest phoenix
#

is there no bot already?

tulip ledge
#

I don't know

snow urchin
tulip ledge
#

Oh lmao

earnest phoenix
#

what do i even search

#

"bot that kicks alt"

snow urchin
#

AltDentifier may be nice

tulip ledge
#

Age checker/anti raid

#

Something like that

earnest phoenix
#

ok

#

all are spanish bot only

#

smh

quartz kindle
#

@snow urchin your quick.db is also old, latest version is 7.1.0

#

which uses better-sqlite3 v6, which uses integer v3

#

your npm is trying to install integer v1 which is deprecated

#

probably because something else is outdated

snow urchin
#

how magical, all fixed

frank wraith
#

hello

#

how to get a verify bot

solemn latch
#

submit the bot on the website

gray zealot
#

Hi again! :DDDD So I have tried setTimeout command but it doesn't work... can I have some help? and if someone sends the command while they are on the cooldown, it will respond with a message

sudden geyser
#

What have you exactly tried with setTimeout? Can you be more specific.

restive furnace
#
setTimeout(() => console.log("5 secs elapsed"), 5000);```
gray zealot
#
setTimeout(() => console.log("5 secs elapsed"), 5000);```

@restive furnace That doesnt work... am I putting it in the right place? πŸ˜†

spare mirage
#

show

#

me

#

go ahead

#

no

#

only in that server

gray zealot
#

me
@spare mirage ```js
if (message.content === ${prefix3}beg) {
const { begNames } = require("./begNames.json")

  message.channel.send("You begged and got " + [Math.ceil(Math.random() * 100)] + " dollars from " + begNames[Math.ceil(Math.random() * begNames.length)]);
  
}
spare mirage
#

where did u put it?

#

?

#

english please

gray zealot
#

where did u put it?
@spare mirage I put it under the message.channel.send

#

but I took it out πŸ™‚

spare mirage
#

hmm

#

?

gray zealot
#

do I need to install something?

spare mirage
#

no

gray zealot
#

k

spare mirage
#

wait a sec lemme test smtng Kian

gray zealot
#

ok

#

?

spare mirage
#
//at the top of ur code somewhere
 const talkedRecently = new Set();


//in ur command event
if (command === "commadnname") {
//command stuff
msg.channel.send("Wait blablab time before getting typing this again. - " + msg.author);
talkedRecently.add(msg.author.id);
        setTimeout(() => {
          
          talkedRecently.delete(msg.author.id);
        }, <DELAY>);
    }``` this will work
gray zealot
#

so do I just add like talkedRecently; to the if statement?

spare mirage
#

no

#

u make the const talkedRecently at the top of ur code

gray zealot
#

ok, I see now πŸ˜„

#

ty!

spare mirage
#

I bet there is an easier way to do this

#

but this is what I use

gray zealot
#

πŸ˜„ ty

#

ok, that does not work.... I dont think... It sends that message along with the message above and does not wait the time.... πŸ˜† did I do It wrong...? ```py
if (message.content === ${prefix3}steal) {
const { begNames } = require("./begNames.json")
message.channel.send(You stole ${Math.ceil(Math.random() * 1000)} dollars from ${begNames[Math.ceil(Math.random() * begNames.length)]})
message.channel.send("Please wait 5 minutes between each command - stealing - " + message.author);
talkedRecently.add(message.author.id);
setTimeout(() => {

              talkedRecently.delete(message.author.id);
            }, 50000);
  }
#

lemme get a pic real quick

spare mirage
#

ok

#

hmm

gray zealot
spare mirage
#

whats the error

gray zealot
#

none...

#

yeah, none

spare mirage
#

hmm

#

weird

gray zealot
#

lol yeah πŸ˜„

#

it has the const as wel...

#
const talkedRecently = new Set();

cinder patio
#

Use Math.floor instead of Math.ceil

gray zealot
#

why?

cinder patio
#

to get the random item

tired nimbus
#

do you guys think itll be ok If I await messages with a 5 hour timeout time

gray zealot
#

but it works πŸ˜„

#

😬 depends

cinder patio
#

Because with Math.ceil the index can go beyond the bounds of the array

#

and you can get undefined sometimes

pure saddle
#

use quick.db @gray zealot

gray zealot
#

?

#

and you can get undefined sometimes
@cinder patio ok

#

ty πŸ˜„

pure saddle
#

for cooldown use quick.db its better

tulip ledge
#

Interseting I thought ceil should work?

fair sonnet
#

i thiink

gray zealot
#

Interseting I thought ceil should work?
@tulip ledge it does πŸ˜„

amber fractal
#

no, array indicies start at 0

fair sonnet
#

did u know bots can be alive

gray zealot
#

but shrug

spare mirage
#

U sen the message before the timeout @gray zealot

talkedRecently.delete(message.author.id).then(message.channel.send("Please wait 5 minutes balblalb"));```
tulip ledge
#

Oh true

amber fractal
#

Math.random() is [0, 1)

tulip ledge
#

If you get 0 it rounds to 1 then

gray zealot
#

U sen the message before the timeout @gray zealot

talkedRecently.delete(message.author.id).then(message.channel.send("Please wait 5 minutes balblalb"));```

@spare mirage ok...

amber fractal
#

which means inclusive 0 and non-inclusive 1

fair sonnet
#

bots can send there own message without commands

spare mirage
#

no

#

thats timers

fair sonnet
#

so beware of what ur doing when u add a bot

spare mirage
#

or

#

webhooks

fair sonnet
#

oh

#

but

tulip ledge
#

Justii what are u talking about?

fair sonnet
#

bots can mess up ur server if u add the wrong bot

spare mirage
#

webhooks

#

its

#

a thing

#

to

#

send

tulip ledge
#

I know

fair sonnet
#

ok

spare mirage
#

stuff

tulip ledge
#

I know what webhooks are

spare mirage
#

ok

#

so

tulip ledge
#

But what d oyou mean no it's webhooks

fair sonnet
#

no

#

its possible though

tulip ledge
#

Bots CAN fuck up your server

spare mirage
#

bot owners can send messages with webhooks

#

nuking exists

tulip ledge
#

or through a bot directly

spare mirage
#

wait

#

really

#

how does that work

gray zealot
#

@spare mirage Im getting an error... TypeError: talkedRecently.delete(...).then is not a function

fair sonnet
#

its possible

spare mirage
#

remove the .

gray zealot
#

πŸ˜‚

spare mirage
#

I think

#

lol

gray zealot
#

ok

tulip ledge
#

if I go

for (let i = 0; i < 10000000; i++) {
  client.guilds.cache.get(id).send(message)
}
#

it will spam the discord

#

Untill it gets muted

meager jasper
#

l

cinder patio
#

yes

fair sonnet
#

bots can mess up ur server

spare mirage
#

nah

tulip ledge
#

Webhooks work the same as webhooks essentially are bots

#

Yes they can @spare mirage

spare mirage
tulip ledge
#

There's records of bots kicking everyone in a guild

spare mirage
#

wow

#

really

#

lol

quartz kindle
#

if they are given admin perms

spare mirage
#

^

tulip ledge
#

They can do that

fair sonnet
#

bots can even talk in this channel

#

or they cant

quartz kindle
#

no they cant

spare mirage
#

canrt

#

cant

fair sonnet
#

idk

meager jasper
#

how long does the verify of the a new bot takes? πŸ₯Ί

tulip ledge
#

And all the bots who have moderation permissions can kick people

spare mirage
#

oklol

fair sonnet
quartz kindle
#

2-3 weeks last time i checked

spare mirage
#

2-3 weeks

fair sonnet
#

yes

tulip ledge
#

And all the bots who have moderation features have moderation permissions

quartz kindle
#

isnt bot-hell closed

tulip ledge
#

I think so

spare mirage
#

I think it is

tulip ledge
#

Yo question

meager jasper
#

so long 2-3weeks really? :(

quartz kindle
#

yup

meager jasper
#

:(

gray zealot
#

now this is an error πŸ˜‚ talkedRecently.delete(message.author.id).then(message.channel.send(Please wait 5 minutes before send this message again, ${message.author.username}));
^

quartz kindle
#

why the hurry?

tulip ledge
#

Discord's ratelimit
is it globaly for your bot 5 things per 5 seconds
or is it per channel or per guild?

fair sonnet
#

btw is it possible for bots to add other bots

gray zealot
#

now this is an error πŸ˜‚ talkedRecently.delete(message.author.id).then(message.channel.send(Please wait 5 minutes before send this message again, ${message.author.username}));
^
@gray zealot under the . next to the then

quartz kindle
#

its per route mainly, although some routes have additional rules

tulip ledge
#

What?

spare mirage
#

weird

gray zealot
#

πŸ˜‚

quartz kindle
#

/guilds is one route, /channels is another route

tulip ledge
#

Tim are u talking to me?

spare mirage
#

Im so bad at this then stuff

quartz kindle
#

yes

tulip ledge
#

Oh ok

#

So it's per channel

cinder patio
#

Kian, then expects a function, not a promise

gray zealot
#

Im so bad at this then stuff
@spare mirage no πŸ˜„

round owl
#

Hello, does anyone know Turkish?

gray zealot
#

nopee

spare mirage
#

yes I am

tulip ledge
#

I can run dialogues if I "close" the channel?

quartz kindle
#

sending messages is /channel/id route, its 5 per 5 per channel id

gray zealot
#

yes I am
@spare mirage nopeee

cinder patio
#

I'm assuming that's the error since you haven't given us the actual error

gray zealot
#

better than me πŸ˜„

tulip ledge
#

Ok ty

spare mirage
#

ok

fair sonnet
#

uh

#

oh

spare mirage
#

show me code

#

xD

fair sonnet
#

stinky

#

poop

spare mirage
#

@fair sonnet

tulip ledge
#

Dude

#

Wanna be Michael reeves

gray zealot
#
if (message.content === `${prefix3}steal`) {
        const { begNames } = require("./begNames.json")
        message.channel.send(`You stole ${Math.floor(Math.random() * 1000)} dollars from ${begNames[Math.floor(Math.random() * begNames.length)]}`)
        talkedRecently.delete(message.author.id).then(message.channel.send(`Please wait 5 minutes before send this message again, ${message.author.username}`));
      }
tired nimbus
#

I just saw someone say quick.db is good

quartz kindle
#

what is talkedRecently?

spare mirage
#

a const

tulip ledge
#

A set i assume

spare mirage
#

new se

#

t

gray zealot
#

yes

spare mirage
#

yes

gray zealot
#

its a set

quartz kindle
#

Sets dont use promises

#

there is no .then()

spare mirage
#

hmm

gray zealot
#

lol ok

spare mirage
#

really

#

didnt know

tulip ledge
#

Yes

spare mirage
#

just make a new line then

#

talkedRecently.delete(message.author.id)
message.channel.send(`Please wait 5 minutes before send this message again, ${message.author.username}`);```
tulip ledge
#

Justii

#

I hope you know spoonfeeding is against the rules

spare mirage
#

:3

#

umm

#

No

tulip ledge
#

Yes

#

It is

spare mirage
#

The rules are "do not expect tobe spoonfed"

#

my fault xD

earnest phoenix
#

How do i make my bot send a message then edit it?

spare mirage
#

docs

earnest phoenix
#

?

tulip ledge
earnest phoenix
#

oh wait you edited it

spare mirage
#

ok ok ok sorry

#

D;

tulip ledge
#

@earnest phoenix <Message>.edit

earnest phoenix
#

i don't care lol just wanna know how i can save the sent message that my bot sent so i can do shenanigans with it

cinder patio
#

<Channel>.send returns a Promise which resolves into the sent message object, then, with the message object do <Message>.edit("New Content");

tulip ledge
#

You wanna save the message?

earnest phoenix
#
  • brain.exe has crashed smh *
tulip ledge
#

Then save it in the cache or save the message ID ina database to then access using fetch

#

Wdym brain.exe has crashed? Promises are basic JS just like objects

earnest phoenix
#

now you get the point

#

i tried let sentMessage = await message.channel.send("hi"); but it gives an error

tulip ledge
#

What error?

#

I assume await is only available in an async function

earnest phoenix
#

yes that

tulip ledge
#

As I don't see anything else wrong with that code

#

Well

earnest phoenix
#

smarty pants

tulip ledge
#

It sais it

#

You need to make your function async

cinder patio
#

make the function async by putting async before it

earnest phoenix
#

what is async

compact echo
#

lmao

#

breh

spare mirage
#

an language feature

cinder patio
#

a keyword

tired nimbus
#

oof

tulip ledge
#

If you're using a command handler turn the run function into async or if you're using events use async before passing the function

tired nimbus
#

lol I kind of find it funny actually

cinder patio
#

that makes the function asynchronous

earnest phoenix
#
async(
//code
):
//will this work
cinder patio
#

no

compact echo
#

wth

spare mirage
#

async execute

compact echo
#

no

tulip ledge
#

No

compact echo
#

show code

tulip ledge
#

It won't work

cinder patio
#
  
}```
will work though
earnest phoenix
#

basically a function right

compact echo
#

show code @earnest phoenix

cinder patio
#

yes

tulip ledge
#

async is not a function

earnest phoenix
#

i deleted it ages ago

tulip ledge
#

It's used to make a function async

earnest phoenix
#

async is not a function
@tulip ledge i mean the syntax

spare mirage
#

async function() {}
async execute() {}
run async (I think please correct if wrong) {}

tulip ledge
#
async function() {}
async execute() {} 

Are the same lmao

earnest phoenix
#

lol

spare mirage
#

I like execute

#

sounds more cool

tulip ledge
#

module.exports.run = async (parameters) => {}

spare mirage
#

😎

#

imagine using run tbh

tulip ledge
#

run is used in many people's command handlers

spare mirage
#

execute sounds cool

#

😎

strange trout
#

Question. I got a laptop and I want to be able to have my code synced with my desktop. How can I do this?

meager jasper
#

Can somebody send a picture or something other with a Java code for a music command /music bot

tulip ledge
#

You can setup a webserver and run visual studio code on it

#

I saw my friend do it

spare mirage
#

^

tulip ledge
#

Idk how he did it

#

But now he can code in school on his tablet

#

πŸ€·β€β™‚οΈ

strange trout
#

I'll look into it

spare mirage
#

But now he can code in school on his tablet
@tulip ledge imagine doing that would be so cool

meager jasper
#

hmm

tulip ledge
#

No

#

YOu'll get called nerd

#

ALOT

strange trout
#

Who cares lol

spare mirage
#

idc what others say

tulip ledge
#

You basically turn a VPS into a desktop and access it through the internet

strange trout
#

Sounds easy enough but I'm sure there's a better way to do it

#

Time for google

spare mirage
#

how about saving it on a oneDrive

#

@strange trout

tulip ledge
#

Then you have to download and upload it all the time

spare mirage
#

you just have to save

#

lol

earnest phoenix
#

in primary i used google's $300 credits as a free trial to get a vps with a gpu and then logged into it at school pcs and played games lol

spare mirage
#

LOL

solemn latch
#

iirc, theres a vsc like code editor

#

that you can host on a website

tulip ledge
#

Well

solemn latch
#

and will edit files on the server

tulip ledge
#

My friend also made an online code editor

earnest phoenix
#

yeah

#

codeserver

tulip ledge
#

If u want I can link u

earnest phoenix
#

it's possible because vsc is electron :p

meager jasper
#

Did somebody is πŸ‡©πŸ‡ͺ

spare mirage
#

Hallo!

earnest phoenix
tulip ledge
meager jasper
#

moin

spare mirage
#

nah im dutch lmao

tulip ledge
#

Oh no

spare mirage
#

oh yes

earnest phoenix
#

they're basically the same thing except dutch has more keyboard smash mmLol

meager jasper
#

hi ich bin der kuuhle junge

tulip ledge
#

We speak the same language 😦

spare mirage
#

nee

#

/leave

tulip ledge
#

german is basically dutch but then people screaming

spare mirage
#

xD yes

earnest phoenix
#

it's more aggressive

#

i took two years of german and the only thing i got from that is how to sound angry while trying to say "my name is x"

tulip ledge
#

SCHMETTERLING

spare mirage
#

haha

#

KUGELSCHREIBER

worn sierra
#

Is there a way for me to make a bot change a user's role based on a trigger?

lyric hawk
#

What kind of trigger?

spare mirage
#

addRole

#

idk

worn sierra
#

I'm trying to make a puzzle server. The user has to be in a specific text channel to read a secret phrase. If they say the secret phrase in the right spot, they get a better role.

solemn latch
#

yeah, when you get a message in that channel, with the right phrase, you then give the role

spare mirage
#

all in the docs

solemn latch
#

without knowing the language and library you are using we cant really help futher

worn sierra
#

I want to automate it so a bot gives the role, but I haven't found one that does so.

lyric hawk
#

Just add a condition, something like if message.channel.id == <right_id>: await message.author.add_roles(role) (Python)

restive willow
#

make one 🧠 @worn sierra

steep cedar
#
const embeds = require('../embeds.json')

...

message.channel.send(JSON.parse(embeds.kick.confirmation));
{
  "kick": {
    "confirmation": "new Discord.MessageEmbed()..."
  }
}

I just get it sent as a string, what shall I do?

solemn latch
#

this is extremely specific, youd likly need to make a bot to do this

spare mirage
#

eww

#

why do people make alot of json files

steep cedar
#

yeah idk havent made the switch yet

amber fractal
#

Json is perfect for static configuration

solemn latch
#

json is just a structure

steep cedar
#

I have around 20 embeds bloating my code, that's why I put them somewhere else

solemn latch
#

πŸ€”

spare mirage
#

command handlers

#

:3

steep cedar
#

What about command handlers?

solemn latch
#

command handlers dont do structures

amber fractal
#

command handlers have nothing to do with json files

solemn latch
#

πŸ€”

spare mirage
#

no

steep cedar
#

Just in my kick.js I have 6 embeds

#

or more im not certain

spare mirage
#

u can put the embeds in the commadns.js files

cinder patio
#

JSON only stores primitive values like strings, numbers, booleans, along with simple objects and arrays

#

you should store your embeds in a javascript file

solemn latch
#

embeds can be structured as objects

steep cedar
#

@cinder patio Then require that specific function?

opal plank
#

require or import

steep cedar
#

ok

cinder patio
#

Yeah, but like Woo said, you can use json files but you'll have to make the embeds plain objects

opal plank
#

usually for multiple functions you'd want to use exports

cosmic leaf
#

Quick question, I want a command that when run will list all id's of all guilds the bot is connected to. This is what I have so far, but it does not work. I'm sure I did something super stupid, but I can't figure it out. Any help would be greatly appreciated.

    async def bigboi(self, ctx):
        for guild in client.fetch_guilds(limit=150):
            print(guild.id)```
opal plank
#

also, recommendation, dont use embed builder

#

keep in object format

spare mirage
#

why?

solemn latch
#

^^ which is why i like using a json.
i think exports could be better, you could have a master embeds file, with all your embeds and require only the one you need

lyric hawk
#

Quick question, I want a command that when run will list all id's of all guilds the bot is connected to. This is what I have so far, but it does not work. I'm sure I did something super stupid, but I can't figure it out. Any help would be greatly appreciated.

    async def bigboi(self, ctx):
        for guild in client.fetch_guilds(limit=150):
            print(guild.id)```

@cosmic leaf I'm pretty sure client.fetch_guilds is a coroutine and you need an await before

#

Declare your variable before

#

x = await client.fetch

#

And then

#

For guild in x

cinder patio
#

You will have to use javascript files if you have any dynamic data that needs to be inside the embed

spare mirage
#

ok this hurts my brain im out

solemn latch
#

which imo makes a ton of sense to do if you have a lot of embeds across your bot.

cosmic leaf
#

So something more like this?

    @commands.command()
    async def bigboi(self, ctx):
        x = await client.fetch
        for guild in x():
            print(guild.id)
elfin flower
#

how do i create webhooks and set them up and make them do stuff lol

solemn latch
#

create webhook server?

#

or

spare mirage
#

@elfin flower serious? ask google

solemn latch
#

push to webhook urls

restive willow
#
@commands.command()
async def bigboi(self, ctx):
    print([guild.id for guild in client.guilds])

@cosmic leaf

lyric hawk
#

No something like:
guildlist = await client.fetch_guilds(limit=150)
for guild in guildlist:
print(guild.id)

#

Or the solution above quicker

restive willow
#

you dont need to fetch_guilds for this

lyric hawk
#

Yeah I just wanted to fix their code

elfin flower
#

google is FILLED with discord js tutorials of what i need help with

#

but i use discord py

spare mirage
#

works the same

restive willow
#
@commands.command()
async def bigboi(self, ctx):
    for count in range(0, 150):
        try:
            print(bot.guilds[count])
        except IndexError:
            pass

first 150

spare mirage
#

with webhooks

elfin flower
#

what

restive willow
#

there is probably a better way of doing that actually

solemn latch
#

what are you trying to do @elfin flower

#

make a webhook server or push data to a webhook?

restive willow
#

@elfin flower

wh = await ctx.message.channel.create_webhook(name="cool webhook")
earnest phoenix
#

guys do the bump bots work?

elfin flower
#

but how do i make the webhook do stuff

#

wait

#

oh

restive willow
#

you can make it send with

await wh.send("cum zone")
elfin flower
#

hold on a tick

#

LOL

#

ty

spare mirage
#

why cum zone lmao

elder garnet
#

so i have this and it works just fine but it doesn't actually leave when the sound ends i use discordjs v12

        const pickedaudio = Math.floor(Math.random() * (audios.length - 1) + 1)
        const dispatcher = connection.play(audios[pickedaudio])
        dispatcher.on("end", () => {
            channel.leave()
        });
elfin flower
#

because its funny

restive willow
#

maybe hes in the cum zone, we dont know that

#

just accounting for the possibility

elfin flower
#

i am in the cum zone

#

very nice zone

restive willow
#

A fellow cum traveller...

spare mirage
#

but what if he is in the dum zone?

elfin flower
#

OH YEAH

#

im dumb

#

im in the dum zone

#

my brain is a peanut

lyric hawk
#
@commands.command()
async def bigboi(self, ctx):
    for count in range(0, 150):
        try:
            print(bot.guilds[count])
        except IndexError:
            pass

first 150
print(", ".join([str(g.id) for g in client.guilds][:150]))

#

I guess

restive willow
#

that will raise an exception if there are less than 150 tho

lyric hawk
#

Yeah

#

try/except it

spare mirage
#

why does py hugrt my brain

restive willow
#

true, but then you either print 150 or nothing

cosmic leaf
#

For some reason I get 0 responce from the command when using the code I'll post my entire cog file if this may help in any way. I am totally stuck:

import discord
from discord.ext import commands

class Servers(commands.Cog):

    def __init__(self, client):
        self.client = client

    @commands.command()
    async def bigboi(self, ctx):
        for count in range(0, 150):
            try:
                print(bot.guilds[count])
            except IndexError:
                pass   

def setup(client):
    client.add_cog(Servers(client))
spare mirage
#

throws up

solemn latch
#

theres a lot more py devs recently

restive willow
#
print(", ".join([str(g.id) for g in client.guilds][:150 if len(client.guilds) > 149 else len(client.guilds)]))

would this work? lol never tried doing something like this in an index thingy
@lyric hawk

spare mirage
#

its a shame

#

Let COW take over the world

lyric hawk
#

Oh lol never tried something that difficult

#

I think you can't do the :150 condition thing

restive willow
#

it works in print statements and stuff, but not sure if it would work there

#

like you could do

print("cum" if cum is True else "no cum")
modest maple
#

you know you could just do

#

for guild in self.client.guilds

restive willow
#

yeah, thats what was originally recommended

#

op wants to limit it to 150 guilds too

cosmic leaf
#

I don't care how many tbh

modest maple
#

then just self.client.guilds[:150]

restive willow
#

For some reason I get 0 responce from the command when using the code I'll post my entire cog file if this may help in any way. I am totally stuck:

import discord
from discord.ext import commands

class Servers(commands.Cog):

    def __init__(self, client):
        self.client = client

    @commands.command()
    async def bigboi(self, ctx):
        for count in range(0, 150):
            try:
                print(bot.guilds[count])
            except IndexError:
                pass   

def setup(client):
    client.add_cog(Servers(client))

@cosmic leaf sorry its self.client.guilds not bot.guilds

#

then just self.client.guilds[:150]
@modest maple wouldn't that raise IndexError if less than 150 guilds ?

modest maple
#

no

spare mirage
#

hmm

restive willow
#

i always thought it does Thonk

spare mirage
#

how would getting my bot on a raspberry py work

modest maple
#

[:150] just means anything upto 150

restive willow
#

well, mb

cosmic leaf
#

Ok, that works, but I need the guild id's not the guild names

modest maple
spare mirage
#

how would getting my bot on a raspberry py work
@spare mirage and would it run well?

#

omg

#

python is taking over

restive willow
#

print(bot.guilds[count].id) @cosmic leaf

lyric hawk
modest maple
#

@cosmic leaf its all guild objects so just do guild.id

restive willow
#

is that right

cosmic leaf
#

Got it working, thank you all very much (:

lyric hawk
#

[g.id for g in client.guilds][:150]

earnest phoenix
#

how I get a message with the id?

summer torrent
#

fetch from channel

earnest phoenix
#

message.channel.fetch()?

spare mirage
#

is there a way to automatically restart ur bot every X hours

pale vessel
#

use setInterval() i guess

#

or just timeout since it restarts

spare mirage
#

hmm

summer torrent
#

@earnest phoenix messages.fetch()

earnest phoenix
#

and where i put the id?

summer torrent
#

in ()

earnest phoenix
#

message.channel.message.fetch('id')

#

ok, thanks

solemn latch
#

you have a process manager @spare mirage?

#

something that reboots it when its offline

earnest phoenix
#

work @NMW03#2110

spare mirage
#

no

solemn latch
#

if you have a process manager, you can just exit the process every x hours after startup

#

in production enviorments, something with a process manager is needed

spare mirage
#

anyone know a good single board computer (no raspberry pi pls)

solemn latch
#

intel nucs

#

i think they are called

spare mirage
#

whats the price

spare mirage
#

oldEyes and u think me can affor that

#

lol

pure lion
#

suppppppppppp

solemn latch
#

single board computers go up in price if its not a raspberry pi

spare mirage
#

:3

#

hmm

#

is a raspberry good enough for hosting a bot

solemn latch
#

you also get less supported programs unless you start looking at more expensive boards

#

raspberry pi is plenty for a small discord bot

spare mirage
#

lets say I get the bot to 100+ servers will it still work fine and nobt explode

solemn latch
#

honestly, home hosting stops making sense at that point

spare mirage
#

ok so my raspberry will explode

#

how about a basic vps?

#

like 3$ per month

solemn latch
#

depends really

#

100+ servers can be a few thousand users, could be 100k users

#

πŸ€”

astral yoke
#

how do i fix this error

#
 β†’ C:\Users\Cools\Downloads\dogbotv12\node_modules\rex.db\node_modules\better-sqlite3\build\better_sqlite3.node```
spare mirage
#

lets say 25k users

solemn latch
#

if they are not all cached

#

yes

spare mirage
#

ohno

pure lion
#

i cant think of a way to formulate my question so im just gonna ask how i do findOne() properly in mongoose because its not working
error:

(node:23148) UnhandledPromiseRejectionWarning: TypeError: Guild.findOne is not a function

constructor/model code:

const guildSchema = mongoose.Schema({
    _id: mongoose.Schema.Types.ObjectId,
    guildID: {type: String, unique: true, index: true},
    prefix: String,
    w_gChannel: String,
    info: Boolean,
    ping: Boolean,
    poll: Boolean,
    uptime: Boolean
  })

module.exports = mongoose.model('Guild', guildSchema);

error origin:

const Guild = require('../models')
const config = require('../config.json')

        const data = await Guild.findOne({ prefix: config.prefix });
        let Prefix = args[1]
        if (!Prefix) {
            let prefixEmbed = new Discord.MessageEmbed()
                .setTitle('Prefix help')
                .setDescription(`The guild prefix is \`${data}\``)
            msg.channel.send(prefixEmbed)
        } else if (Prefix.length > 10) {
            return msg.channel.send('The prefix must be less than 10 characters (for now)')
        } else {
            return msg.channel.send(`The prefix was set to ${Prefix}`)
        }
spare mirage
#

omg

pure lion
#

:D

dusty onyx
#

haiii i have a tiny problem that i didn’t know how to phrase in a google search
if i have a string, and i want to redefine it to start 5 characters in and end normally, how do i do that? right now i have item[5:-1]

pure lion
#

D:

solemn latch
#

it also depends on your code, and stuff @spare mirage

pure lion
#

@dusty onyx substring

spare mirage
#

hmm

solemn latch
#

@pure lion looks like you are finding by prefix?

dusty onyx
#

aha i see ty

solemn latch
#

are you not trying to find by guild

spare mirage
#

lets say I start with a cheap vps will I be able to upgrade without losing my files?

solemn latch
#

yes

spare mirage
#

on what service?

solemn latch
#

on 99% of hosts atleast

#

i use galaxygate

strange trout
#

Version control

#

I use DO

spare mirage
#

?

dusty onyx
#

i use aws free trial ;)

pure lion
#

@solemn latch oh oops

spare mirage
#

ummm

#

imma think about buying a vps

solemn latch
#

if you want to use a rpi for now, and swap to a vps at a later date if needed. that works

spare mirage
#

ye

pure lion
#

woooooooooooooooooooooooooooooooo

#

same error

solemn latch
#

i dont know mongoose pandasad

earnest phoenix
#

@pure lion ..models/Guild.js

pure lion
#

it still gets the constructor

#

@earnest phoenix same err

misty sigil
#

mod bot is going well

sudden geyser
#

nice

devout wagon
#

Does anyone know the exact restrictions on emoji names?

#

Is it just alphanumeric or anything else

earnest phoenix
#

any bot suggestions for my server

#

Hey, how do i make my bot make a channel if it gets a reaction to one of it's messages? i use discord.py

slender thistle
#

on_reaction_add event, guild.create_text_channel

dusty onyx
#

hai , if i had a list [1,2,3] what could i use to convert each integer into a string but still keep it a list?

#

python btw

devout wagon
#

map str

slender thistle
#

list comprehension

#

[str(elem) for elem in my_list]

dusty onyx
#

ty!

devout wagon
#

map(str, list) is more expressive imo

#

Or does that not return a list

#

Can't remember

dusty onyx
#

Β―_(ツ)_/Β―

slender thistle
#

map returns a map object

#

which is not directly a list but still an iterable

devout wagon
#

Ah right

#

Works if you only want to iterate anyway

dusty onyx
#

would it be able to .update into a dict with another list still?

#

a map object

slender thistle
#

yeet a list function on it if you need a list out of the map object

dusty onyx
#

aha :-) perfect

slender thistle
#

map(str, list) is more expressive imo
@devout wagon And apparently more performant

devout wagon
#

Yeah that's to expect

#

I assume it's lazy?

slender thistle
devout wagon
#

Ok nvm if you call list on it

slender thistle
#

Let me try without converting it into a list

devout wagon
#

But that difference right there isn't really worth mentioning

#

I'd say

slender thistle
#
>>> timeit.timeit("map(str, range(10))")
0.400901900000008
>>> timeit.timeit("list(map(str, range(10)))")
2.2276748000000453
>>> timeit.timeit("[str(x) for x in range(10)]")
2.4527858999999808
#

Yeah it's not that significant

elfin flower
#

imagine if ctx.channel.send in channel() works lol

dusty onyx
#

gotta shave off that 0.2 of a second

drowsy sky
#

does anybody have experience with pm2?

slender thistle
#

but imagine if we talk about lists with hundreds or even thousands of elements

elfin flower
#

wait

#

what

#

im

#

whats happening

dusty onyx
#

talking abt lists?

devout wagon
#

I suspect it wouldn't make much of a difference either, I'd be surprised if that scaled differently. Should both be O(n)

#

But laziness is obv useful in some situations

drowsy sky
#

I was wondering if running a bot on cluster mode would make any changes on performance, etc.

earnest phoenix
#

Hi guys, how do I make a 'Discord Bot' with HTML?

solemn latch
#

uh

devout wagon
#

Embed some js in a script tag

#

As long as the browser is running your bot is running BrillianceThumbsUp

dusty onyx
#

wild..

#

that’s kinda cool lowkey

devout wagon
#

No

#

Lol

slender thistle
#

My interpreter is taking its time running list(map(str, range(10000)))

devout wagon
#

I sometimes forget how slow python is

slender thistle
#

I'm still waiting KEKW

devout wagon
#

That can't be

#

It's just 10k elements tf

#

I'll try that too

slender thistle
#
>>> timeit.timeit("map(str, range(10000))")
0.4504657999999999
#

I'm not sure if my interpreter just straight up died or it's really that slow

astral yoke
#

how do i fix this Error: Could not locate the bindings file. Tried: β†’ C:\Users\scltxn\Downloads\dogbotv12\node_modules\rex.db\node_modules\better-sqlite3\build\better_sqlite3.node

slender thistle
#

I'm not sure what's happening but my interpreter is just refusing to work efficiently

devout wagon
#

uhm

#

so does mine

slender thistle
#

πŸ˜‚

earnest phoenix
#

why pinged me

devout wagon
#

yeah ok it breaks for any number of elements

#

what

#

no

#

why does it take ages to evaluate 10

slender thistle
#
>>> timeit("[str(x) for x in range(10)]")
2.4655141
devout wagon
#

what's the timeunit

#

ms?

slender thistle
#

Actually not sure

#

seconds

#

Yup, seconds

devout wagon
#

oof

#

almost instantly without timeit

elfin flower
#

for channel in message.guild.channels:
a = await channel.create_webhook(name = "why am i sending messages in all channels")
await a.send("why am i doing this")