#development

1 messages · Page 1788 of 1

flat copper
#

Where can I host my web for free

proven lantern
#

vercel

flat copper
#

domain?

proven lantern
#

.com

flat copper
#

Thats not freesadlife

proven lantern
#

i cant fix my css bug

flat copper
#

Anything else?

proven lantern
#

aws

#

firebase

#

gae

#

heroku

tender raft
#

So I code in python on replit what code do I need to put in to set my bots status to watching xamout of servers that its in

slender thistle
#

Is there any way I can apply a JS function to all td elements on my HTML page?

unkempt wedge
#

is there a way to generate a new bot invite link through code? discord.js

#

instead of in the website

tender raft
#

No there is not

unkempt wedge
#

sad

tender raft
#

That is discord api sadly

pale vessel
lusty quest
#

like you just need to fill a patter in a URL

tender raft
lusty quest
#

how?

#

like you just add your bots client id in a url

tender raft
#

I dont know that's why I said COULD

lusty quest
#

there is a generator website that does exactly the same

tender raft
#

Me personally people can invite mine from top.gg

lusty quest
#

and its there for a few years now

#

i dont know why he wants the ability to "generate" a invite link throu code, but he probably got his reasons, maybe he wants to make it so that it will work for all bot accounts (for a bot invite command)

pale vessel
tender raft
#

He probably wants it so he can get more people to add his bot

slender thistle
pale vessel
#

Err

#

If it works, sure, why not?

slender thistle
#

🤷‍♂️ Wondering if there's a better way to do it

lusty quest
unkempt wedge
#

yeah you're right

#

i will

#

go do that

lusty quest
#
string = `https://discord.com/oauth2/authorize?client_id=${botid}&permissions=537159744&scope=applications.commands%20bot`
``` like this would just work
#

maybe edit the permissions

slender thistle
#

yeehee my double click doesn't work apparently

tender raft
#

So I read the docs they are confusing so I know to change the presence its something like this.
[await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening,name="CursedBotsDev#4324 type :help for commands"))]
Just take away the brackets

#

How do I change it to watching ×amount of servers it is apart of

slender thistle
#

guess

proven lantern
#

anyone here a pro at nextjs?

proven lantern
#

and material-ui

#

this is my footer element

import {makeStyles} from "@material-ui/core/styles";

const useStyles = makeStyles(theme => ({
    root: {
        display: "flex",
        flexFlow: "row",
        flexWrap: "wrap",
        alignItems: "center",
        justifyContent: "space-around",
        marginTop: 25,
        "& > div": {
            margin: "0 7px"
        }
    },
}));

const Footer = ({children}) => {
    const classes = useStyles();
    return (
        <div className={classes.root}>
            {children}
        </div>
    )
}

export default Footer;```
#

the styles const classes = useStyles(); are not applied on initial loading of the website, but if i navigate to another page the styles show up

#

actually the className is there, but the css styles for the class are not there

pale vessel
#

@slender thistle Maybe? js document.addEventListener( "dblclick", ({ toElement }) => toElement.classList.includes("dash-cell") && (document.getElementById("info").innerText = toElement.toString()) );

slender thistle
#

for some reason my JS script worked in browser, so there's something going on

proven lantern
#

implement your own double click handler using only single click and let the user be able to change the double click speed

pale vessel
proven lantern
#

if(lastClickTime < userDoubleClickWaitTime) {doubleClickAction()}

slender thistle
#

LMAO

slender thistle
#

My JS just doesn't work altogether

#

So it does load, but doesn't work

proven lantern
#

where are the nextjs people at?

slender thistle
#

Ah my loop doesn't even fucking run

#

HAHAHAHAHA I see what's happening

#

My table isn't created at the time of running the JS

crimson vapor
#

you ok? @slender thistle

slender thistle
#

Not exactly

#

My Dash DataTable gets loaded after my JS

#

which is an issue

#

... I don't need JS for this, apparently

earnest phoenix
#

How can i provide bot to join a stage channel

sinful thistle
#

me rn on repl:

earnest phoenix
#

paste first line

sinful thistle
#

alr

#

that worked

earnest phoenix
#

thats weird

#

yes

#

but i don't understand what you are talking about here

#

and you were??

#

Nwm bummer_ElonLaugh

onyx hare
pale vessel
lyric mountain
#

didn't notice that pastebin link

#

ok, so....wtf?

earnest phoenix
#

lmao

lyric mountain
#

first and second cancel eachother

#

var everywhere

#

yancode

#

also half of that code is inside that string

earnest phoenix
sudden geyser
#

terror

proven lantern
proven lantern
lyric mountain
#

tbf it doesn't even need to have a notified field

#

just send levelup messages when an actual levelup happens

#

instead of checking old level X new level

proven lantern
#

like if (msgs === await db.fetch(`level0`)) instead of if (msgs > await db.fetch(`level0`))

#

that would probably be better

#

change all of these

vivid fulcrum
#

scalable

#

very scalable

proven lantern
#

perfect

lyric mountain
#

that part alone is a sacrilege against programming

proven lantern
#

yep, never use switch statements or if/else statements like switch statements

#

object lookup checks are better

#
  0:10,
  1:50,
  2:170
  ...
}```
onyx hare
lyric mountain
#

he ignored my previous warnings didn't he?

#

start here

proven lantern
prime mist
#

Wow that is definitely database abuse okeh

vivid fulcrum
#

no that's abuse in general

#

that code needs a good ctrl+a del

#

and a rewrite

proven lantern
#

@onyx hare might want to refactor some of the if statements into object lookupsconst levels = { 10:0, 50:1, 170:2 ... }

  0:(message) => (`Well Done ${message.author} You have`),
  1:(message) => (`Sweet ${message.author} Has Leveled Up`)
  ...
}```
earnest phoenix
#
const string = "hello world";
module.exports.string = string;

Is there a way to more efficiently export variables in nodejs?

proven lantern
#

you can do this module.exports = { decode(str) { return unescape(Buffer.from(str, 'base64').toString('binary')); }, encode(str) { return Buffer.from(escape(str).toString(), 'binary').toString('base64'); } }

and then do this to import it ```const {encode, decode} = require('');

#
    string: "hello world",
    anotherString: "goodbye world"
}```
earnest phoenix
#

I was just wondering if it could be more compact, because I typescript you can just do:

export const string = "hello world";
proven lantern
#

module.exports = "hello world"

restive furnace
#

module.exports.string = "hello world"; works, no?

#

yeah

onyx hare
earnest phoenix
#

aight aight

#

thanks

proven lantern
restive furnace
#

i haven't tested

proven lantern
#

wouldn't you need to do module.exports = {string:"hello world"}

restive furnace
#

but according to logic and common sense it should work

proven lantern
#

but module.exports is undefined until it's defined

restive furnace
#

atleast works in my node cli intepreter

proven lantern
#

so module.exports.anything should complain about exports being undefined

#

maybe module.exports is {} by default

onyx hare
#

also is this right?

restive furnace
proven lantern
#

i guess that's good

#

maybe

onyx hare
#

everything went to hell in the editor when i did this for the level message

if (msgs === await db.fetch(`level0`)){rank = 1} reqXP = (await db.fetch(`level1`)), message.guild.channels.cache.get(levelUpChannel).send(`${levelingMessages:1}`)
proven lantern
#

things after the comma need to go inside the if statement

#

the {}

onyx hare
#

it started shooting red links when i added ${levelingMessages:1}

#

lines*

proven lantern
#

oh yeah

#

that doesn't make sense

#

oh

#

${levelingMessages[1](message)}

#

are you trying to use this?

  0:(message) => (`Well Done ${message.author} You have`),
  1:(message) => (`Sweet ${message.author} Has Leveled Up`)
  ...
}```
onyx hare
#

ya

proven lantern
#

might as well pass the rank variable to that to that

#

${levelingMessages[rank](message)}

onyx hare
#

and for the levels section where do i add ${levels}?

proven lantern
#

replace the database stuff with something like this const levels = { 10:0, 50:1, 170:2 ... }

#

get the message count like you are doing

onyx hare
#

i change
.setLevel(rank, 'Level: ', true)
to
.setLevel(levels, 'Level: ', true)
right?

proven lantern
#

you'll need to write some logic to find the rank when. that levels object is just to see if the have leveled on that message

onyx hare
proven lantern
#
const levelValues = Object.values(levels).concat(messageCount);
levelValues.sort();
const currentLevel = levelValues.lastIndexOf(messageCount);
#

that should get you the level

#

messageCount being the count from the db for that user

onyx hare
#

oki where would i place that, near the levles or else where

#

levels-

proven lantern
#

right after you get the message count from the DB

proven lantern
#
        10:0,
        50:1,
        170:2,
        ...
      }```
#

and this should change to

const levelValues = Object.keys(levels).concat(messageCount);
levelValues.sort(); // might need to sort like this .sort((a,b)=>(a-b))
const currentLevel = levelValues.lastIndexOf(messageCount); // might need to -1 here```
onyx hare
#

i just remembered this would nullify
if (msgs === await db.fetch(`level0`)){rank = 1} reqXP = (await db.fetch(`level1`)) as they linked to
```db.set(level0, 10)
db.set(level1, 50)
etc

proven lantern
#

yeah, you can get that rank without the db

#

use levels like this when checking to see if they just leveled and need a message sent. if (typeof levels[messageCount] !== "undefined") { //send you have just leveled message ${levelingMessages[levels[messageCount]](message)} }

#

you can replace all the if/else statements for different messages with if (typeof levels[messageCount] !== "undefined") { //send you have just leveled message message.channel.send(${levelingMessages[levels[messageCount]](message)}); }

onyx hare
#

its the message count im iffy about how would i count em

proven lantern
#

this part? ```db.add(messages_${message.guild.id}_${message.author.id}, 1)

#

seems okay if the db support a count feature like this

onyx hare
#

yea that part

proven lantern
#

did you write the add function?

#

i'd make a for loop that goes to 100 and do db.add(`messages_test`, 1) and see if it gets all the counts

onyx hare
proven lantern
#

what is let rank = 0 doing?

onyx hare
#

that was setting the user rank when the bot is invited to 0

proven lantern
#

also what is var reqXP = 10 for?

#

i dont see rank used anywhere

#

before getting the levelUpChannel you should check to see if they have leveled up

#
  //send you have just leveled message 
  message.channel.send(${levelingMessages[levels[messageCount]](message)});
}```
onyx hare
#

is*

proven lantern
#

0:(message) => (`${emoji} Welcome To our Leveling ${emoji}`) level 0 doesn't happen until after 10 messages so they wont get this message until then

crimson vapor
#

why are you not just using a formula

#

or a map

#

or an array

#

this seems like a stupid way to do it

proven lantern
crimson vapor
#

I can see why

proven lantern
#

maybe you have a string "0"

proven lantern
onyx hare
#

o

odd sapphire
#

Heyo
What do you guys use to get your bot stats?

proven lantern
odd sapphire
proven lantern
#

oh, i thought you meant if the bot was online or offline

odd sapphire
#

nope

proven lantern
onyx hare
#

i now remember why i gave up trying to do a leveling system in the past lol the stress i got from it

proven lantern
#

use this with google analytics to get some metrics

odd sapphire
#

thx

proven lantern
#

just work on one part at a time

onyx hare
#

i think so
(node:8576) UnhandledPromiseRejectionWarning: ReferenceError: messageCount is not defined

proven lantern
#

does db.add(`messages_${message.guild.id}_${message.author.id}`, 1) return the count?

#

maybe get the count like this const messageCount = db.add(`messages_${message.guild.id}_${message.author.id}`, 1)

onyx hare
#

oki

proven lantern
#

otherwise do a db.fetch

#

```db.add(messages_${message.guild.id}_${message.author.id}, 1)
const messageCount = db.fetch(messages_${message.guild.id}_${message.author.id}1)

#

some of the db.fetch calls are missing await

onyx hare
#

its to much to try n process god i hate being autistic ._.

proven lantern
#

just get one part working at a time

#

where does emoji come from?

#

update thisconst levelingMessages = { 0:({message, emoji}) => (`${emoji} Welcome To our Leveling ${emoji}`), 1:({message, emoji}) => (`${emoji} Well Done ${message.author} You have Reached Level 1 Our First level! ${emoji}`), 2:({message, emoji}) => (`${emoji} Sweet ${message.author} Has Leveled Up To Level 2, You Are Becoming A Pro Chatter! ${emoji}`),

#
    10:0,
    50:1,
    170:2,
    400:3,
    500:4,
    750:5,
    850:6,
    950:7,
    1000:8,
    1250:9,
    15000:10
};
const levelingMessages = {
    0:({message, emoji}) => (`${emoji} Welcome To our Leveling ${emoji}`),
    1:({message, emoji}) => (`${emoji} Well Done ${message.author} You have Reached Level 1 Our First level! ${emoji}`),
    2:({message, emoji}) => (`${emoji} Sweet ${message.author} Has Leveled Up To Level 2, You Are Becoming A Pro Chatter! ${emoji}`),
}

db.add(`messages_${message.guild.id}_${message.author.id}`, 1);
const messageCount = db.fetch(`messages_${message.guild.id}_${message.author.id}`);

if (typeof levels[messageCount] !== "undefined") {
    //send you have just leveled message
    message.reply.send(${levelingMessages[levels[messageCount]]({message, emoji});
}
vivid fulcrum
#

what

vivid fulcrum
#

oh they deleted the message

#

lmfao

copper cradle
#

someone should teach these js kids how to use codeblocks

lyric mountain
#

idk why but I'm gonna be so satisfied when uncaught promises kill the process

woeful pike
#

you can already opt into that with a flag and you should be by default

blissful trench
#

well im more confused by this alien language

solemn latch
#

does anyone know how discord embeds urls?
oembed? open graph tags?

summer torrent
#

og:

solemn latch
#

pog ok

solemn latch
#

cant get it to work, even changing the url to deal with discord cache

lyric mountain
#

my site's og tags work fine

#

also yes, you'll need to fight against discord caching

solemn latch
#

👀 turns out i was not returning any data to users who where not signed in.

stuck spire
#

hello you all

#

could anyone teach me a better way for my idea ?

#

i need to make a border check room, for new members joinning my discord game channel, only after they type role and choose a class like ( warrior, trojan, taoist, or archer ).

#

they will be able to see all channels

#

like this: Membros 4 members
MEE6 1 members
ProBot ✨ 1 members
Gold Role 0 members
carl-bot 1 members
^Archers 🏹 2 members
Trojan ⚔ 1 members
Warrior 🗡 1 members
Reaction Roles 1 members
Taoist 🧙‍♂️ 2 members
9 members

#

@everyone

#

@earnest phoenix

wheat mesa
#

Lol

errant perch
#

is it possible to get server insight data from discord.js

earnest phoenix
#

wdym

#

like which event triggers it?

errant perch
#

just get this

#

i dont think there is just wondering lol

sudden geyser
#

While you can try to aggregate the data to build a summary, the methods of doing so are infeasible, so no.

queen hemlock
#

help how do you change the library of the bot

#

it says undifined in luca

#

ok owo

flat copper
#

Can I use multiple mongo clusters at one time

#

In my bot?

prime mist
#

Yes, you can have more than one mongodb client.

flat copper
sinful thistle
#

Jesus christ

queen hemlock
earnest phoenix
#

How do I make it so my command can only be used in a Guild ID That is in a array, what I have:

 const servers = ['839704922248577054', '793938706549309500']
    if(!servers === message.guild.id) return message.channel.send(`**__Premium Server Bumped!__**`) 
cinder patio
#

use servers.includes

earnest phoenix
#

I'm having trouble resizing my ubuntu partition
I created the ubuntu partition in windows disk manager and used unetbootin to install ubuntu, but I can't figure out how to resize the partition directly from ubuntu

austere delta
#

can i make it so slash command option choices update dynamatically

mental furnace
austere delta
#

depending on the channel they are running on

mental furnace
#

depends on the library you use

#

if you parse the arguments yourself, you can definitely make them different for each channel

austere delta
#

slash commands...

mental furnace
#

oh

austere delta
#

i already can do that with normal messagaes lmao

mental furnace
#

i feel like discord-devs could help better on that

#

how tf do slash commands even work

slender thistle
#

Nah not possible I believe

austere delta
#

thats a bruh

#

then i have to make a prompt again

#

can you respond to ephemeral messages, like not send, yknow as a prompt

mental furnace
#

i was gonna say "just dont use slash commands" but i realized that i was the one who recommended using slash commands

mental furnace
#

it should work, but i think buttons would be better for doing that since you dont have to delete anything

slender thistle
#

You can reply to ephemeral messages

mental furnace
#

or this

slender thistle
#

Yes like that

mental furnace
#

WHICH ONE

slender thistle
#

Via the reply feature

austere delta
#

not sent: /move
not sent: move list
user sends answer
delete answer
send new message so everyone sees

2 messages gone..?

mental furnace
#

oh cool

austere delta
mental furnace
#

thats a thing?

slender thistle
#

Nah the referenced message won't be available for anyone but you lol

#

Your reply will still be seen by everyone

austere delta
#

. _.

mental furnace
#

kekw

austere delta
#

thats another message to delete

slender thistle
#

You can send a followup message, can't you

mental furnace
#

i mean as i said again, you can also use buttons

austere delta
#

smh

slender thistle
#

Why not use buttons?

austere delta
#

buttons...

#

hmm

mental furnace
#

use c# lmao

#

d.js doesnt support it great

#

wait erwin has buttons and he uses javascrip

austere delta
slender thistle
#

d.js doesn't support anything good well

austere delta
#

lmao

slender thistle
#

change my mind

austere delta
#

i installed dev branch yesterdaey

slender thistle
#

Oh yeah good luck I'll be praying for you ma'am

mental furnace
#

turns out detritus supports buttons AND slash commands

austere delta
slender thistle
#

Because Detritus > d.js

mental furnace
#

he also proved that detritus had less ram usage by showing his magical graph page shit

#

stop KEKWing my messages im not the one doing it

austere delta
#

lmao

#

ok so

time to suffer with buttons

mental furnace
#

im gonna cry

#

buttons arent that hard

#

as weeb erwin once said:

austere delta
#

lol

mental furnace
#

or as ive once said

#

use c# and d#+ nightlies

slender thistle
#

Use Detritus

spare badger
mental furnace
#

what the fuck

spare badger
#

I guess detritus == trash?

near stratus
slender thistle
#

They intentionally call it trash so that only pros who actually want to spend their time using real stuff will use it

#

It's reverse psychology, you see

spare badger
#

Ah I see

austere delta
#

wait a second...

spare badger
#

Smort

austere delta
#

you can have buttons with ephemeral messages right?

mental furnace
#

yes

slender thistle
#

Yeah

#

Fun shit

austere delta
#

that leaves message count to... 1.

#

Perfect

mental furnace
#

i am so smart for recommending that

#

WHAT THE FUC-

austere delta
#

LMAO

slender thistle
#

Erwin

mental furnace
#

erwin i knew that you were a weeb

#

BUT

#

HOLY FUCK

opal plank
royal herald
#

LMAO

mental furnace
#

ou deleteed it

austere delta
#

HWWWEEZE

slender thistle
#

We've been over this for a while.

mental furnace
#

you fucking deleted it

royal herald
#

this is an epic dev moment

opal plank
#

never happened

austere delta
mental furnace
slender thistle
#

Keep your kinks in my DMs. 😉

mental furnace
opal plank
#

everyone recommending detritus

mental furnace
#

use c#

opal plank
#

glad to see people finally recognize it

mental furnace
#

fuck interpreted languages

#

compiler gang rise up

slender thistle
#

Fuck you

mental furnace
royal herald
austere delta
#

smh just use npm discord-bot-lib

spare badger
#

<t:1624261008>

#

Am I cool now?

slender thistle
#

Now here hoe

royal herald
mental furnace
austere delta
mental furnace
royal herald
opal plank
mental furnace
opal plank
#

cuz lazy shitty devs

mental furnace
slender thistle
#

KEKW

mental furnace
#

only available on canary

opal plank
#

bruh

royal herald
#

im on ptb

opal plank
#

ive said this before

mental furnace
opal plank
#

they have MONTHS before the feature comes out

austere delta
opal plank
#

i personally used buttons about a month and a half before theyw ere out

slender thistle
mental furnace
opal plank
#

they do this for lib devs to have everything ready for when the update comes

mental furnace
#

break me daddy 😩 ~~

opal plank
#

and those fuckers are 4 months in

#

and yet dont have support

slender thistle
#

Ok too far Plus wrong channel

royal herald
mental furnace
slender thistle
#

I'll break you apart if you keep this up bitch

austere delta
#

yall are goign to hornyjail (adn't)

#

rofl

mental furnace
#

🙂 please refer to [removed]

#

actually dont

slender thistle
#

I'll have you know I'm a Python pro

mental furnace
#

EW PYTHON

slender thistle
#

I break shit on a daily basis

near stratus
mental furnace
opal plank
#

you did NOT make an emoji with me saying detritus

slender thistle
#

Yeah that's what I fucking thought, filthy weeb trying to play tough.

near stratus
mental furnace
#

WHATS THAT NAME

opal plank
#

im speechless

near stratus
#

wait why is it Lerwin ?

mental furnace
austere delta
#

SUSSY

earnest phoenix
#

Hey if i change the name of the bot in the dev portal it will be changed in the gg dashboard know?

near stratus
#

not ERwin

mental furnace
near stratus
#

f

opal plank
#

Lerwin is nickname for close friends, specially IRL

near stratus
#

@opal plank say Use Detritus again so I can get the right nickname

mental furnace
#

so

#

your close friends

#

get the L

near stratus
opal plank
#

fml

earnest phoenix
#

Don’t use detritus

mental furnace
#

OH BOY

opal plank
#

Use Detritus.js

mental furnace
#

TIME FOR A FIGHT

near stratus
earnest phoenix
#

I’m just trolling Erwin

opal plank
mental furnace
#

guys shut the fuck up

#

fuck detritus

#

fuck discord.js

earnest phoenix
#

I know how to use for

mental furnace
#

fuck programming

earnest phoenix
#

Git*

mental furnace
#

fucking use an automated chromium

#

to make a bot

#

its that easy

opal plank
earnest phoenix
#

Git just doesn’t know how to use me

mental furnace
#

waht-

earnest phoenix
#

I prefer desktop anyway I like to visually see my mistakes as I make them

opal plank
#

still trying to fix this shit

earnest phoenix
#

What the hell does that mean

#

What went wrong

opal plank
#

it means it error'd

earnest phoenix
#

Yea I know that just never seen that error before

mental furnace
# opal plank

ooooOOOOOoooooOOOooooOOOooOOOoo beee keybOOOOOAAAAaaAaAArd

opal plank
#

its usually when you install shit on VM

earnest phoenix
#

Erwin makes me tired

#

how to make 2 status and chaging in 10 sec

opal plank
#

just use detritus then

earnest phoenix
#

With how much he advertises detritus

#
    client.Ready = true, 
    client.user.setPresence({
      status: "online",  // You can show online, idle, and dnd
      activity: {
          name: `g?help | ${client.guilds.cache.size} Servers`,  
          // The message shown
          type: "LISTENING", // PLAYING, WATCHING, LISTENING, STREAMING,
      }
  });
      client.Manager.init(client.user.id);
      client.log("Successfully Logged in as " + client.user.tag); // You can change the text if you want, but DO NOT REMOVE "client.user.tag"
  client.RegisterSlashCommands();
  };```
#

plz help

opal plank
earnest phoenix
#

give

#

reply.

#

Making your status change every 10s not a good idea

earnest phoenix
#

plz help

#

That’s way too fast

#

or 30s

#

or etc

earnest phoenix
opal plank
#

, yeah, you were asking for spoonfeed yesterday here

earnest phoenix
#

ping

#

the code

#

If at all it’s recommended to do it every 20-30s

opal plank
#

same asnwer as yesterday

earnest phoenix
#

ok

opal plank
#

we are NOT giving you pre-made code btw

earnest phoenix
#

put where

#

show me

#

plz

#

the code

#

No thanks

#

put where

earnest phoenix
#

what

#

didnt ask u

#

Didn’t ask anyone specific

slender thistle
#

Oh boy

earnest phoenix
#

If you’re going to ask for code begone

opal plank
#

we are not spoonfeeding code leeches

#

learn javascript

earnest phoenix
#

We’ll help you but we won’t give you the code

opal plank
#

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

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

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

Here are good resources to learn both Javascript and NodeJS:

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

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

near stratus
opal plank
#

the spaces tilt me a bit, but good job

earnest phoenix
#

Lol

#

Gives Erwin an easier way to advertise now

opal plank
#

i dont quite like where this is going, me and tim are being meme'd hard

earnest phoenix
#

Kekw

opal plank
#

tim has a gif saying "Go back to development" and now i got emotes

near stratus
earnest phoenix
#

Erwin you brought it upon yourself

near stratus
earnest phoenix
#

Oh good

opal plank
near stratus
opal plank
austere delta
#

bruh

#

i cant change global command descriptions etc on the fly

opal plank
#

you can

austere delta
#

all my commands are going to be guild based i guess

opal plank
#

why not make them global instead?

austere delta
opal plank
#

what?

#

no

austere delta
slender thistle
#

Up to 1 hour it says

opal plank
#

its client cache

#

just use dms instead

#

it updates instantly

slender thistle
#

Then again I never used global commands

austere delta
#

my bot has 2 languages

opal plank
#

if you are testing stuff, use it on dms

#

it updates instantly

austere delta
#

oh

opal plank
#

no need to wait up to 1h

austere delta
#

ok but my bots commands are guild related

slender thistle
#

L

opal plank
#

fat rip then

#

gonna have to wait

austere delta
#

yeah + 2 languages

mental furnace
#

just fake the guild variable

opal plank
#

but if u only changing description

austere delta
#

so not using global commands

mental furnace
#

then you can just unfake it

opal plank
#

if you're only updating description, you can see them in dms

austere delta
#

ok but

#

sigh

mental furnace
#

bruh just make your prefix "/"

#

it worked for me 👍

austere delta
#

my bot has 2 languages

i want to show english desc on english servers, and turkish desc on turkish servers

#

so im gonna have to use guild commands right

mental furnace
#

just dont have multiple languages boom problem solved

opal plank
austere delta
#

would i get rate limited if i do guild commands lo

mental furnace
#

just check for rate limits

#

@opal plank does d.js check for rate limits

#

yo guild commands update instantly

opal plank
#

thats how shit it is

mental furnace
lusty quest
#

@rustic nova

mental furnace
#

wait what

#

why are you here

#

also why do people leave csgo smh

rustic nova
#

Smh

austere delta
#

just discovered we can edit/delete webhook messages now

austere delta
#

help

#

interaction.reply() is give Promise<v o i d>

lusty quest
#

await it

austere delta
#

how to listen for butotn evnetn??nsk

austere delta
pale vessel
#

It can still error, no?

austere delta
#

wait buttons can emit interaction event right

lusty quest
#

what did you expect to get from a reply?

pale vessel
#

Just await it to be safe

austere delta
austere delta
#

how can i convert [0,1,2,3,4,5,6,7,8,9,10,11,12]
to
[[0,1,2,3,4],[5,6,7,8,9],[10,11,12]]

#

for buttons f

long crow
#

Any idea if I want to benchmark the cpu usage in nodejs?

lusty quest
#

so you want to know how hard you can hit the CPU? or just want to know the usage?

humble gyro
#

_.chunk([...]);

pale vessel
#

Python has lodash?

humble gyro
#

oh i dont do python

pale vessel
#

Wait no I'm the dumb one

#

for some reason I thought they were using python so I sent a python answer oop

humble gyro
#

its pog

rocky hearth
#

for react useReducer's 3rd param, can I use a async function??

marble juniper
#

hi hi

trail finch
#

um I have a problem with the discord-xp package, um so the deleteGuild function is not working...

trail finch
errant flax
sly sierra
#

v13 is coming out

#

ya dumbass

void matrix
#

Wtf

tacit sequoia
sly sierra
#

My PoInT stAnDs

#

no it fell dumbass

tacit sequoia
#

But it isnt out yet

#

Lol

#

Rip my spelling

sly sierra
tacit sequoia
#

Oh really, lol

sly sierra
#

its coming out end of june

#

and dev version is out

tacit sequoia
#

But it hasnt been released for everyone to use yet, right

#

Sooooo

long crow
#

As it now it stable enough to be used. I meant the slash/button in djs

slender thistle
#

d.js had months to implement them

flat copper
#
const {client, Discord, MessageEmbed } = require("discord.js");

module.exports = {
    name: "ping",
    aliases: ["pong"],
    category: "Utility",
    usage: "ping",
    description: "Get the bot's ping!",
    async execute(client, message, args) {

     let start = Date.now();
  
  message.channel.send({embed: {description: "Looks like the bot is slow.", color: "RANDOM"}}).then(m => {
    let end = Date.now();
    
    let embed = new MessageEmbed()
    .setAuthor("Ping!", message.author.avatarURL())
    .addField("API Latency", Math.round(client.ws.ping) + "ms", true)
    .addField("Message Latency", end - start + "ms", true)
    .setColor("RANDOM");
    message.Reply(embed)
    m.delete()
  })

    }
}```
#

Its working good but then

#

Idk

brave tendon
#

How it comes that the bot even tho that it has administrator rights is not able to delete the channel and is giving me the failed embed?

#

What does define if a channel is deleteable or not?

long crow
flat copper
earnest phoenix
#

hi

long crow
#

Version 12 dont even have inline reply

flat copper
#
const { APIMessage, Structures } = require("discord.js");

class ExtAPIMessage extends APIMessage {
    resolveData() {
        if (this.data) return this;
        super.resolveData();
        const allowedMentions = this.options.allowedMentions || this.target.client.options.allowedMentions || {};
        if (allowedMentions.repliedUser !== undefined) {
            if (this.data.allowed_mentions === undefined) this.data.allowed_mentions = {};
            Object.assign(this.data.allowed_mentions, { replied_user: allowedMentions.repliedUser });
        }
        if (this.options.replyTo !== undefined) {
            Object.assign(this.data, { message_reference: { message_id: this.options.replyTo.id } });
        }
        return this;
    }
}

class Message extends Structures.get("Message") {
    Reply(content, options) {
        return this.channel.send(ExtAPIMessage.create(this, content, options, { replyTo: this }).resolveData());
    }

    edit(content, options) {
        return super.edit(ExtAPIMessage.create(this, content, options).resolveData());
    }
}

Structures.extend("Message", () => Message);```
#

@long crow

slender thistle
#

the previous reply d.js had was literally just-

#

@scenic kelp scam link

slender thistle
flat copper
#

Ic

slender thistle
#

You honestly don't need an extra method for it. Just do ${message.author} Your message here and you get the same functionality

earnest phoenix
#

how i like this

#

you can help me xd

slender thistle
#

You force yourself to like it if you don't already

earnest phoenix
#

you can help me

#

wanna edit bot

slender thistle
#

If you're asking how to do something like that, top.gg allows Markdown, which supports HTML's <code> tags via the backtick character

earnest phoenix
#

tell plz

#

give example that

slender thistle
#

I'm not sure which part exactly you need help with.

earnest phoenix
#

the black

#

this red

deft plank
#

how can i give the upvoters a reward in my discord bot

slender thistle
earnest phoenix
#

yeah

slender thistle
#

That's a code tag

#

Markdown supports that. Use Google to find out

earnest phoenix
#

how?

#

just give me

slender thistle
#

How about no lol

deft plank
slender thistle
#

Get your lazy ass to research stuff yourself

#

All you have to search is Markdown cheatsheet

earnest phoenix
#

..

slender thistle
#

Even my 6 years old brother can do that

deft plank
#

:/

slender thistle
#

An HTTP listener receiving POST requests with vote data

west spoke
#

hey kirai there's something called google, you should really use it

quartz kindle
#

that red text is literally just this like in discord lmao

slender thistle
deft plank
west spoke
slender thistle
#

Then that guy did some weird ass shit and you shouldn't refer to that tutorial

deft plank
#

ok

vivid fulcrum
#

are you sure you're not confusing discord webhooks with topgg webhooks

lean bobcat
#

Hey anyone here can help me in AES decryption

#

258EAFA5-E914-47DA-95CA-C5AB0DC85B11

quartz kindle
#

lol

slender thistle
#

All you need is a machine running with 24/7 access to Internet, a webserver running on it (some popular top.gg SDKs provide them for you), which then will handle the incoming requests

deft plank
vivid fulcrum
#

you cannot decrypt it unless you have the key

west spoke
slender thistle
#

They're webservers

#

And those are just HTTP listeners on your machine

#

basically a website

vivid fulcrum
#

in a nutshell, reverse APIs
instead of you making a request to the website, the website makes a request to you

deft plank
#

webhooks are websites

earnest phoenix
#

not found

#

i like that black red

slender thistle
quartz kindle
deft plank
#

alright, so what i need to do is, set up a webhook that sends request to my bot?

earnest phoenix
slender thistle
#

top.gg provides a CSS that changes the color of the <code> tags so that's why it's red-ish

earnest phoenix
#

this

quartz kindle
deft plank
#

also, how are discord webhooks different than webhooks

vivid fulcrum
#

you can just open up the webhook in the same apl where the bot is running

quartz kindle
#

because they decided to make it red

earnest phoenix
#

oo

quartz kindle
#

thats all

earnest phoenix
#

oke

vivid fulcrum
#

since a webhook is essentially a simple webserver

west spoke
slender thistle
deft plank
#

right

slender thistle
#

Correct

solemn elk
#

I'm trying to get data from a collection in my mongodb, I used this code

const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true });
client.connect(err => {
    const collection = client.db("Main").collection("bots");
    client.close();
});

And faced no problems. However, when I actually try to get the data with this code

client.connect(err => {
    const collection = client.db("Main").collection("bots");
    var data = collection.findOne({ "_id": 0 })
    console.log(data)
    client.close();
});

I get UnhandledPromiseRejectionWarning: MongoError: Cannot use a session that has end . I tried remove the client.close(); but it then got stuck on Promise { <pending> }

slender thistle
#

Sounds reasonable, right?

quartz kindle
deft plank
#

i see, could you suggest me a tutorial pls

deft plank
slender thistle
#

I'm not familiar with any specific tutorials, since all I used was documentations from my packages about HTTP webservers

quartz kindle
#

yes they are

slender thistle
#

Which library do you use

quartz kindle
#

you configure discord webhooks to receive them and post them in a channel

slender thistle
#

ooooooooooo

quartz kindle
#

top.gg webhooks are sender webhooks, not receiver like discord

slender thistle
#

topggpy intensifies

west spoke
slender thistle
#

speak of the devil, I should push an update to fix the last issue

deft plank
#

i didnt get what you mean

quartz kindle
#

top.gg sends webhooks. discord receives webhooks

slender thistle
deft plank
quartz kindle
#

you could make discord receive top.gg webhooks directly

west spoke
#

then read the docs

quartz kindle
#

but they are not compatible in their formats

west spoke
#

We aren't going to spoon-feed you, you gotta do this yourself.

deft plank
quartz kindle
#

yes

west spoke
#

yes

quartz kindle
#

you just need a small webserver so you can receive requests from top.gg

west spoke
deft plank
#

i mean

west spoke
#

literally google "webhook python"

slender thistle
#

in this case it has to be asynchoronous, like aiohttp.web (which topggpy uses to run a webserver) or Quart

west spoke
#

not that hard

quartz kindle
#

where do you want to get webhooks from?

deft plank
slender thistle
#

top.gg have a Python SDK, correct

quartz kindle
#

what data are you looking to get?

#

votes?

slender thistle
#

it's officially called topggpy so don't bother with the dots

deft plank
quartz kindle
#

so top.gg will send a request to the URL that you put in your top.gg settings

west spoke
#

tfw using raw requests to see if a user votes

quartz kindle
#

for that your bot needs to be approved

deft plank
west spoke
deft plank
west spoke
#

you'd need to find my long since deleted /bot/votes endpoint

earnest phoenix
#

bruh not like my desc

#

that my bot

#

that

#

lol

#

weird

west spoke
earnest phoenix
#

ok

west spoke
#

In between each line

earnest phoenix
#

lemme do

#

wait

austere delta
#

how to acknowledge a messagebutton interaction

slender thistle
#

ALL THEN NUTS WERE ON THE BOTTOM OF THIS CUP ISTG I'VE BEEN BACKSTABBED BY A YOGURT

#

ok who pinged me

west spoke
slender thistle
west spoke
#

oh no

slender thistle
#

unless I'm wrong

#

sec

deft plank
#

:/

austere delta
#

how do i not respond to it then

#

i dont want it to say "interaction failed"

slender thistle
#

oh wait I'm dumb

signal estuary
#

Is there an event, which is called when the bot joins a server?

slender thistle
#

have you tried responding with callback type 6?

slender thistle
#

may be different in your library

signal estuary
signal estuary
slender thistle
austere delta
slender thistle
#

Don't ask me I don't use trash

austere delta
#

okay maam

slender thistle
#

mmLol seriously though idk I don't use JS

west spoke
#

(shiv calmeth)

signal estuary
slender thistle
#

Which some libraries had support for way before

signal estuary
earnest phoenix
#

@zinc wharf hey

zinc wharf
slender thistle
#

The fact that there had to be a completely different package that modified the original lib's behavior kinda says something

earnest phoenix
zinc wharf
earnest phoenix
#

ehh

#

@west spoke

slender thistle
#

I'm just shittalking d.js for the weird fuckery it is

earnest phoenix
#

this

#

not u

#

tf

slender thistle
#

lmao

earnest phoenix
#

bruh srry

#

just typo

#

srry

zinc wharf
slender thistle
#

bro why are these nuts at the bottom who tried to hide them there

earnest phoenix
slender thistle
lean bobcat
slender thistle
#

Why did you decompile an apk

signal estuary
#

How can I use async methods for using await in the current context:

var Discord = require('discord.js');
const client = new Discord.Client()
module.exports =  {
    name: 'message',
    execute(message) {
        // console.log(`${message.author.tag} in #${message.channel.name} sent: ${message.content}`);
        if (!client.application?.owner) await client.application?.fetch();

        if (message.content.toLowerCase() === '!deploy' && message.author.id === client.application?.owner.id) {
            const data = {
                name: 'ping',
                description: 'Replies with Pong!',
            };

            const command = await client.application?.commands.create(data);
            console.log(command);
        }
    },
};
vivid fulcrum
#

are you still trying to get through that quiz app

earnest phoenix
slender thistle
#

Why do I feel like that's recreatng a client object

vivid fulcrum
#

it would've been smarter to do what we advised you, emulate the app and then analyze what's on the screen

earnest phoenix
#

help why i like this

#

but other bot i like this tf

slender thistle
#

show your description

earnest phoenix
#

ok

earnest phoenix
vivid fulcrum
#

in markdown you need to go two lines down to enter a new line

#

instead of one

earnest phoenix
#

<br> or 2 new lines

vivid fulcrum
#

🤦‍♂️

west spoke
#

I literally

#

told you what you need to do

#

like 20 minutes ago

slender thistle
#

Go down two lines

#

instead of one

west spoke
slender thistle
#

so
not
like
this

#

but

like

this

earnest phoenix
#

f

#

put <br> where

slender thistle
#

don't use those if you're gonna add one blank line

#

it's EITHER:
a) add one blank line between your text to actually add the newline
or
b) add <br> in-between the text lines

earnest phoenix
#

i like this

#

hi - bla bla bla <br>

earnest phoenix
#

shivaco

slender thistle
#

I'm alive hi

earnest phoenix
#

y

slender thistle
#

Regretfully

earnest phoenix
#

im alive hi <br>

west spoke
#

@earnest phoenix just <br>
do it like <br>
this

earnest phoenix
#

that?

vivid fulcrum
#

if i may ask, how old are you lan?

earnest phoenix
#

ok

slender thistle
#

Yes

zinc wharf
#

I love watching this just to do a new line kek2

earnest phoenix
vivid fulcrum
#

just want to see if we're the same age

earnest phoenix
zinc wharf
#

Simple search on google

slender thistle
#

Rhys what do you expect when I literally told the guy to Google something and he said "can't you just tell me"

earnest phoenix
#

Gotta love saying the exact same thing in 3 different ways for a beginner in #development to understand something

zinc wharf
#

I'm just waiting till Lan decided to do a new line in javascript, or C# for example

vivid fulcrum
#

im convinced they're underage

slender thistle
#
console.log("my text
woohoo")

y no work

west spoke
#

they use python so

earnest phoenix
west spoke
#

eof error

vivid fulcrum
#

what the fuck is this new font for members

slender thistle
#

Force them to use multiline strings always ezpz

west spoke
#

"""smh"""

slender thistle
#

my_dict['''key''']

west spoke
#

BLEH

vivid fulcrum
#

it looks like something out of a minecraft cheat client

slender thistle
#

my_list[int('''0''')]

west spoke
#

fuck it I'm overriding the default font

vivid fulcrum
#

discord uses like 6 different fonts right now??

earnest phoenix
west spoke
#

Much better

earnest phoenix
#

Discord just trying to use as much scuffed fonts as possible

vivid fulcrum
#

accessibility 100

slender thistle
#

inb4 Discord employees either on crack or with ADHD

vivid fulcrum
#

i struggle reading the new font, can't imagine how it's like for people with reading imperities like dyslexia

earnest phoenix
#

I bet the one who chose the new Discord fonts was that Discord employee who implemented light theme

#

how like that the pic have link invite bot

#

By using CSS

#

ye

#

You can customize the bot page

#

example?

#

give plz

#

i like that

#

example

west spoke
#

oh my god

#

please, google "html basics"

slender thistle
#

ho boy this is gonna be fun

west spoke
#

I am not making a 3 hour lesson that you'll end up ignoring

vivid fulcrum
#

why are they talking about examples like it's their fetish lmfao

slender thistle
#

What if some devs here act stupid just to be talked shit upon because it's their kink

zinc wharf
earnest phoenix
#

The word "Example" in beginner dev language actually means "Spoon-feed?"

slender thistle
#

HOW THE FUCK DO YOU ADD A NEWLINE- oh wait I can't do that in a paragraph element

sage bobcat
#

One message removed from a suspended account.

west spoke
sage bobcat
#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
slender thistle
#

Doesn't work when I do return [html.P(f"Value: {active_cell}\n\n{data}")]

#

neither with \n nor with <br>

vivid fulcrum
sage bobcat
#

One message removed from a suspended account.

vivid fulcrum
#

oh mygod wrong messaqge

slender thistle
#

ew C#

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
slender thistle
#

So this works

#

That's something

zinc wharf
# slender thistle So this works

Don't show that, Lan will ask you how it works. And you'd give him a 500 page document about it, and he still wont understand it

silk ridge
#

hi i m new to js

slender thistle
#

pfft

#

I'll just tell him it's made in Dash (which it is)

silk ridge
#

i m trying to do command handler but some errors

slender thistle
#

my codebase is a clusterfuck as-is so he won't be able to re-do it the way I do it

#

The pros of writing stupid code (:

silk ridge
#
const client = new Discord.Client()

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);
}

const prefix = process.env.PREFIX

client.on("ready", () =>
{
  console.log("Bot is Ready!")
})

client.on("message", message =>
{
  const args = message.content.slice(prefix.length).trim().split(/ +/);
    const command = args.shift().toLowerCase();

  if (command === 'ping')
  {
    client.commands.get(command).execute(message, args);
  }
 
})

client.login(process.env.TOKEN)```
#
const Discord = require('discord.js');
module.exports = {
    name: 'add',
    description: 'adds money to an admin',
    execute( message, args) {
      message.channel.send('pong')
    },
}```
#

i followed discord.js guide

#

and got error

zinc wharf
#

What is the error

west spoke
#

do you have discord.js installed

#

hell, do you have node.js installed

silk ridge
#

yes

west spoke
#

then what's the error

zinc wharf
silk ridge
#

error is on index.js like there undefined execute

earnest phoenix
#

When someone shows their code saying they got an error but you have to additionally ask for them to show the error

west spoke
#

smh

slender thistle
#

Doesn't hurt to ask twice

zinc wharf
lean bobcat
#

@vivid fulcrum sir I have decomplied the apk the key will be in that ?

west spoke
#

bruh

vivid fulcrum
#

maybe

west spoke
#

Keys probably obfuscated but good luck

vivid fulcrum
#

maybe the key is sent through the api

#

i dont know

west spoke
earnest phoenix
west spoke
#

The onmessage event should do just fine

#

unless my understanding of discord.js is wild

#

Which it may be

silk ridge
slender thistle
#

Throwback to me yelling at Epic to add client.event

earnest phoenix
#

Ready event just indicates that the client is ready, nothing relating to the error; seems like they don't have a ping command in the collection

west spoke
#

what the hell

earnest phoenix
#

@silk ridge try executing commands dynamically

silk ridge
#

client.commands.get('ping').execute(message, args);