#development

1 messages · Page 1670 of 1

opal plank
#

70gb of ram used?

#

oof

boreal iron
#

it's working for 3 days now

#

continuesly

opal plank
#

last time i did that i destroyed all its 128gb with the twitch mass join

boreal iron
#

the RAM is full means I am limited to disk speed

#

yeah, the root has 128 ECC as well, but I'm unable to assign it to the VM

opal plank
#

ah i see

boreal iron
#

since there are other ones running may need a little RAM, too

#

just moving all the crap to the amd arch atm

#

better hardware prices and multicoring performance atm

#

Intel can't keep up with atm

quartz kindle
#

how the tables have turned

boreal iron
#

yeah

crimson vapor
boreal iron
#

if Intel is preparing anything big the next years, the will loose more and more market %

#

I mean the enterprise segment still works with Intels gold or platinum chips but that may change, too in the future

crimson vapor
#

LOL

tired panther
#

@quartz kindle in which cases are guilds not loaded in the cache?

quartz kindle
#

never

zenith terrace
earnest phoenix
#

How to write with bot the member count? e

tired panther
# quartz kindle never

a last question:
the thing with the timeout, when I pass setTimeout(client) and run it may times, will it save the client onetime in the map or a lot of times, even when the client is the same

tired panther
earnest phoenix
#

Brah

#

Thx

tired panther
quartz kindle
#

yes

slate oyster
#

That's what they all say.

ornate atlas
#

I was wondering if someone could help me make my first bot.

obtuse niche
ornate atlas
#

English

lament ruin
#

lmao

obtuse niche
#

Uuhm i mean code language weirdsip

lament ruin
#

hahah

ornate atlas
#

Ohh......... Lol i dont know any code

#

y am i even here

#

lololol

#

I have recoded a few links tho

obtuse niche
#

Maybe, its better to learn a language first before starting to code a bot.

lament ruin
#

Code your own Discord bot! Coding a discord bot isn't hard at all! with a couple of simple lines you can get a bot up and running on your server. Make sure to stay tuned for upcoming discord coding tutorials. Discord.js makes it very easy to code your own bot without having to write thousands of lines of code!

🡺 Discord Server: https://discord....

▶ Play video
#

Start with this

obtuse niche
#

Like python or javascript

ornate atlas
#

Ok. Thank you!

earnest phoenix
#

TypeError: server.createChannel is not a function

#

var server=message.guild;

var member=message.guild.memberCount;
server.createChannel("Server members: "+member, "voice")

message.reply("Channel created!")

nocturne dagger
#

It is prob something really simple with v12 but here is the error I am getting.

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined

https://i.imgur.com/094D0WH.png

cinder patio
#

roles.cache

earnest phoenix
nocturne dagger
#
TypeError: message.guild.roles.cache.exists is not a function
#

I got that back...

earnest phoenix
#

im stuck in nickname cmd pls help me

@client.command(aliases=['n','N'])
@commands.has_permissions(manage_nicknames=True)
async def nick(ctx, member: discord.Member=None, nick=None):
    if member == None:
        member = ctx.author
        await member.edit(nick=nick)
        await ctx.send(f":ballot_box_with_check: Succesfully changed your nickname!")
    else:
        await member.edit(nick=nick)
        await ctx.send(f":ballot_box_with_check: Succesfully changed {member.mention}'s nickname!")
    if nick == None:
        await ctx.send(":x: choose a new nickname...")

if member == None is not working but when i ping someone before nickname it works

dusky sundial
earnest phoenix
#

ooopsss

#

i think yeee

#

i will try

cinder patio
dusky sundial
#

Also, you can simplify if member != None: to just if member:

nocturne dagger
#

Ah, is there a alternative in v12?

cinder patio
#

some

#

but it's used differently

earnest phoenix
#

bruh

nocturne dagger
#

How so?

cinder patio
#

You have to pass a function

slender thistle
slender thistle
earnest phoenix
#

i will try again later

slender thistle
#

And what I mean by that is that you are checking if nick == None (which could just be shortened to if nick)

#

ONLY AFTER checking member

earnest phoenix
#

ik

slender thistle
#

Preferably you would do something like

if member:
    if nick:
        change_nick()
    else:
        no_nick_found()
else:
    no_member_found()
errant perch
#

my bot keeps going offline although in vscode it is still online

nocturne dagger
umbral zealot
errant perch
#

the process hasnt exited

umbral zealot
#

So the process is running you mean

errant perch
#

yes

umbral zealot
#

That doesn't mean it's online

earnest phoenix
#

if i used
//nick @!センク-ちゃん!#0374 something
it will change
and then if i used// something
it will change too

but if i directly used // something without
//nick @!センク-ちゃん!#0374 something before it, it won't change

umbral zealot
#

you can have custom bot status as offline if you want so

#

¯_(ツ)_/¯

#

Also maybe you're not even logging on the process? Can you show us your code from your index.js?

umbral zealot
errant perch
umbral zealot
#

What you want is message.guild.channels.create() I believe

errant perch
#

the command work for like 30 seconds then the bot turns off

#

no error

umbral zealot
#

Feels like if anything was happening to make the bot crash it would be captured by bot.logger.error

stoic viper
#

so uh I just finished making my basic bot and I was testing it to see if the command would work but uh it didn’t and idk what to do and google isn’t helping one bit-?

#

i'm also stupid so there's that-

earnest phoenix
#

h

umbral zealot
# stoic viper i'm also stupid so there's that-

Help me, I'm dumb!
Are you actually dumb, as in, lacking the mental fortitude to code, or are you just lacking the experience and knowledge to understand the code?
Because if you're actually just dumb, the only help we can provide in terms of bot coding is "don't code bots, use those that exist".
if you're just lacking experience, then there's a solution and it's "just take the time to learn javascript and you'll be fine".
Most people that say or think they're dumb, it's just because they're rushing into thinks head first and being overwhelmed by a lot of information all at once. Anyone would be!

umbral zealot
#

My suggestion: Take the time to leran javascript first. Here are some resources: #development message

umbral zealot
boreal iron
#

I wonder how that can't help, there are even examples if you would scroll down the site

umbral zealot
boreal iron
#

Opening the site, first look - "oh god too complicated", closing the site, beggin in Discord for code examples

#

Yeah what I said pogey

umbral zealot
#

And then our code example is the same as the site 😛

boreal iron
#

aye :D

earnest phoenix
#

-_-

boreal iron
#

That channel should be renamed to "entertainment" sometimes

earnest phoenix
#

i kill this js

umbral zealot
#

if you can't read property channels of undefined it means message.guild is undefined

#

which can either mean you're in a DM, or your message variable isn't a message at all

boreal iron
#

I guess he just copied the code on djs

#

guild.channels.create()

#

while being in a message event

umbral zealot
#

maybe?

#

@earnest phoenix show us your code

boreal iron
#

i kill this js
he probably did it

earnest phoenix
#

yes

#

i did

umbral zealot
#

Ah well, if giving up is your thing, sure. thumbs_up

earnest phoenix
#

No

#

i solved the problem so

#

😛

umbral zealot
#

Ah.

boreal iron
#

woop woop

earnest phoenix
#

and i kill who made that command handler because it didn't work in other js file

#

e

umbral zealot
#

I have a feeling the issue isn't the person that wrote the command handler....

boreal iron
#

that's the result of copy & paste without undestanding

earnest phoenix
#

other commands: simp etc. worked

umbral zealot
#

¯_(ツ)_/¯

slender thistle
#

PEBCAK

boreal iron
#

oh oh sombody opened up shivs cage

carmine summit
#
auctions.reduce((arr, cur) => arr.find(arr => arr.item_name === cur.item_name && arr.tier === cur.tier) ? arr.find(arr => arr.item_name === cur.item_name && arr.tier === cur.tier).popularity++ : arr.push(cur["popularity"] = 1), arr, [])
```arr is not defined?
umbral zealot
#

why do you have , arr, [] in there

#

the second argument of array.reduce is supposed to be the initial value

#

and there is no 3rd argument

carmine summit
umbral zealot
#

what are you trying to find, from what

#

I have a feeling this is an x/y problem

carmine summit
#

cur

boreal iron
#

Because arr isn't an object

#

nobody saw that

quartz kindle
#

you need to return arr

#

otherwise it doesnt exist anymore after the first iteration

umbral zealot
#

yeah that too

#
somearray.reduce( (accumulator, currentValueFromArray, Index, OriginalArray) -> {
  // do something with accumulator
  return accumulator;
}, initialValue)
#

I usually reduce that to ```js
someArray.reduce( (acc, curr) => {
return acc;
}, []);

#

though reduce actually works with any data type for the accumulator. can be a string, int, object, whatever

quartz kindle
#

i use (a,t,i,r)

#

xD

pale vessel
#

(accumulator, currentValueFromArray, Index, OriginalArray) consistency™️

umbral zealot
#

lol yes

#

of course

pale vessel
#

let's just use (accumulator, current_value_from_array, index, OriginalArray)

quartz kindle
#

lets just use (a,b,c,d)

carmine summit
#

im confused still

quartz kindle
#

well unconfuse yourself

#

do you know what is "implicit return" and "explicit return"?

carmine summit
#

nope

quartz kindle
#

() => 10

#

this is implicit return

#

() => { return 10 }

#

this is explicit return

#

they are both the same thing

#

you are using an arrow function without brackets, so you are doing implicit return

carmine summit
#

so you will only need return if it is in {}

quartz kindle
#

yes

#

implicit return automatically returns the thing inside your function

#

so you are automatically returning the result of your ternary

#

which is either popularity++ or arr.push()

#

you are returning that

#

and that return value overrides the accumulator

#

so on the second iteration, the accumulator is not an array anymore

#

its the value you implicitly returned

carmine summit
#

so I need to explicitly return it for it to work

quartz kindle
#

yes

#

you need to explicitly return the array again

carmine summit
#

so I need to use {}

quartz kindle
#

also, what is this supposed to do? arr.push(cur["popularity"] = 1)

nocturne dagger
#

Is there any way to upload a image as a emoji in discord.js?

carmine summit
#

add popularity to the end of the object with 1 as value?

quartz kindle
#

you are doing push(1) and at the same time setting cur.popularity to 1

#

you are changing the value of the original thing

#

is that what you want to do ?

umbral zealot
#

this is also doing arr.push(null)

carmine summit
#

nope

cinder patio
#

It's actually pushing 1 to the array

umbral zealot
#

actually not

#

javascript assignment returns null (or undefined I can't remember. probably undefined)

quartz kindle
cinder patio
umbral zealot
#

OH it's when you define a new variable it's undefined then

#

ok

#

Either way I'm guessing this is a learnjs moment tbh

cinder patio
#

I don't think it even allows you to use let and const where an expression is needed

umbral zealot
#

yeah it wouldn't let you use that here, no

carmine summit
#
auctions = auctions.reduce((arr, cur) => arr.find(arr => arr.item_name === cur.item_name && arr.tier === cur.tier) ? arr.find(arr => arr.item_name === cur.item_name && arr.tier === cur.tier).popularity++ : arr.push(cur["popularity"] = 1) && arr, [])

seems like I don't need {} after all...

umbral zealot
#

wow. that looks horrible.

quartz kindle
#

you can do global assignment expression

#

but not local

cinder patio
#

Honestly your logic inside that reduce is so convoluted that it's better to just use a loop

carmine summit
#

loops are too bulky

cinder patio
#

I know I told you to use reduce originally but this is too much

quartz kindle
#

your code makes even less sense right now

umbral zealot
#

"bulky"

tidal nymph
#

is heroku free hosting enough for crawling multi pages asynchronously ?

quartz kindle
#

yes

tidal nymph
#

my bot is working fine on my pc but it doesnt on heroku

#

like sometimes the crawling func just fails or sth

cinder patio
#

crawling how? By requesting the HTML and using a parser to traverse it?

tidal nymph
#

yea im using puppeteer

cinder patio
#

Tno

#

puppeteer is an entirely different thing

#

and requires a lot of resources

pale vessel
#

you need the puppeteer buildpack

quartz kindle
tidal nymph
#

you mean puppeteer-core?

cinder patio
#

I don't think heruko free plan can handle it

pale vessel
#

no, the heroku buildpack

#

unless you already got it working

tidal nymph
cinder patio
#

The free plan probably can't handle a lot of different pages / browsers

tidal nymph
#

and it runs fine for like once or more but then

cinder patio
#

Do you close the pages after you're done with them?

tidal nymph
#

yea

#

i also close the browser after done with that session

cinder patio
#

are you sure puppeteer is the right tool for the job here, which site are you crawling

tidal nymph
#

im crawling a youtube page

#

idk if its the right tool because i only know puppeteer

umbral zealot
#

please note that this is probably literally against the Youtube terms of service

#

you should consider not doing that

#

If Youtube wanted you to access something it would be in their API.

pale vessel
#

Music bots be like

cinder patio
#

for what are you crawling it? You can make a HTTP get request and use a HTML parser for most things

tidal nymph
#

im just crawling either "watching" or "waiting" text on a livestream/upcoming stream

pale vessel
umbral zealot
#

You should be using pubsubhub

cinder patio
tidal nymph
#

ok imma try doing a research on that

cinder patio
#

like the title of the video

pale vessel
#

yeah

cinder patio
#

that's why I asked what he's trying to get

tidal nymph
#

i just need to know if that channel having a livestream/upcoming so i dont have to use youtube search API

cinder patio
#

I dunno if that's in the html

quartz kindle
#

you need an explicit return, otherwise you're still overriding the accumulator with a number or a boolean. and you're still modifying the original items as well in the push() method. this is what you need: ```js
auctions.reduce((arr, cur) => { // you need an explicit return to not override the accumulator
let found = arr.find(arr => arr.item_name === cur.item_name && arr.tier === cur.tier);
if(found) { // dont use find twice
found.popularity++
} else {
let item = {...cur} // you need to create a duplicate of the original item if you dont want to modify the original. this method only creates duplicates of top-level properties, objects inside objects will still be linked by referece, but this is enough to prevent adding "popularity" to the original.
item.popularity = 1;
arr.push(item);
}
return arr; // return the accumulator to continue in the next loop
})

carmine summit
#

do I really need the curly brackets?

quartz kindle
#

yes

#

otherwise you are not returning the accumulator

#

which makes the next loop break

cinder patio
#

having curly brackets isn't a bad thing

quartz kindle
#

arr needs to be returned, and there is no way to implicitly return it at the same time as doing the other operations

#

because the other operations return other things

#

found.popularity++ returns a number

carmine summit
quartz kindle
#

arr.push() also returns a number

latent heron
#

question unrelated to this current topic

quartz kindle
#

arr.push() && arr returns true

latent heron
#

why does being a discord bot developer seem to be a personality trait now

quartz kindle
#

lmao

latent heron
#

its like going to a software firm for a job interview and in the coding practice when they ask you to give an example of a sorting algorithm, you go "don't worry, i've had years of experience in kindergarten putting blocks in holes! i can do this!"

carmine summit
#

but ok I guess I do need that curly brackets

livid carbon
#

typescript/js

#

mostly typescript now

cinder patio
#

aka arr

pale vessel
woeful pike
# latent heron its like going to a software firm for a job interview and in the coding practice...

Being so invested into the discord programming "sphere" you might be forgetting that majority of people who are in college or learning programming don't really go out of their way to do programming on their own time like with discord bots. Seeing applicants for junior positions who have experience writing and maintaining software with actual users regardless of how small it may be is pretty impressive for many companies

#

so it's definitely not putting blocks in holes

quartz kindle
#

how

#

dafuq is this sorcery

cinder patio
#

awesome right

quartz kindle
#

no its not awesome

#

its scary

#

lmao

woeful pike
#

that works the same way in python too sip

cinder patio
#

It's pog

pale vessel
#

because array.push() returns 1 which is truthy so it'll return arr

tidal nymph
latent heron
#

i could've put into better terms

carmine summit
#

Wait?!?! This exists?!?!{...cur}

woeful pike
#

so what? part of top down learning is starting at a hard problem and breaking it down into pieces

latent heron
#

that's

#

a little different than not only learning how the Bot API works

#

but also learning a programming language for the first time itself

woeful pike
#

yes, it's an exciting way of learning programming. Difficult but legitimate

latent heron
#

i will respectfully disagree

cinder patio
#

You don't have to know how everything works at first

woeful pike
#

why do bot devs constantly want to put other devs down

#

let people learn however they wanna learn

quartz kindle
#

ye i forgot

#

xd

latent heron
#

alright

carmine summit
#

not so "Tim", huh?

#

Tim would never forget something like that

quartz kindle
#

i've forgotten worse

#

proves that im not an AI

#

:^)

carmine summit
#

you can't fool us, Tim. We know you're an AI

lost mauve
#

You're all AIs

lost mauve
crimson vapor
#

Any experience is ok to put on a resume. Whether you want that to be something an employer to see I think is the real thing

restive furnace
livid carbon
#

thank

#

what do you use?

woeful pike
lost mauve
crimson vapor
#

as would anything

woeful pike
#

I put waifu-tierlist on my resume, it doesn't matter as much as you think it would

#

unless it's something like.. really weird

umbral zealot
#

lol I used the word "shit" 3x in my resume.

woeful pike
#

yo pog

umbral zealot
#

and "Speedwhoring"

lost mauve
#

???

woeful pike
umbral zealot
#

When you write your resume, be yourself, if your future employer doesn't like your honest resume they probably won't like you as a person....

lost mauve
#

man i've been making a super serious resume in latex, maybe the meta has changed

umbral zealot
#

This is from my own experience, at this point if your resume is "different" it gets more attention

lost mauve
#
# Experiences
- shitty internships no one cares about
- I've been making a heckin poggers Discord bot in Java, pls hire
woeful pike
#

I made mine in figma lol

quartz kindle
#

imagine having a 50 million downloads npm module in your resume

#

you check it out

#

its isThirteen

long crow
#

how does one export it to npm though, not really into publishing something to npm. just curious

quartz kindle
#

using npm publish

carmine summit
#
auctions.reduce((arr, cur) => {
    let found = arr.find(
      (arr) => arr.item_name === cur.item_name && arr.tier === cur.tier
    );
    if (found) {
      found.popularity++;
    } else {
      let item = { ...cur };
      item.popularity = 1;
      arr.push(item);
    }
    return arr;
  }, []);

This is too slow, anything I can do to optimize it?

fierce ether
#

const { Embed, FailureEmbed } = require('../../utils/');

#

works local but not on vps?

lusty quest
#

did you uploaded the file to the VPS?

fierce ether
#

yep

lusty quest
#

are you sure? bcs this is some common thing, you think you uploaded a file, try to fix an error for 2 hours just to find out you didnt uploaded the file

fierce ether
#

v14.15.4 btw

quartz kindle
#

its just adding a popularity property

fierce ether
carmine summit
lusty quest
#

where is the path relative of the file where you call it to the failureEmbed.js?

quartz kindle
carmine summit
#

yes

willow mirage
lusty quest
#

the path not the name

fierce ether
#

what path?

willow mirage
#

/var/etc/ is a path

lusty quest
#
|Root
|->Index.js
  |-> Some Folder
    |-> Some Folder
      |->Failure Embed.js
```like this
carmine summit
#

I think the only way to optimize it is by removing {...}

willow mirage
#

for eaxmple

fierce ether
#

its broken down from src/commands and src/utils/index.js

quartz kindle
#

you can use an object instead of an array

#

objects have direct access, array.find has to loop over the full array every time

lusty quest
#

where is Failure Embed? in utils or commands?

fierce ether
#

utils

lusty quest
#

then you call the path wrong, you only need to move up one folder not 2

fierce ether
#

so how would it work on my pc?

#

and

lusty quest
#

¯_(ツ)_/¯

fierce ether
#

its

#

src/commands/<category>/file

young adder
#

I couldn't add my bot to your site, I entered all the information, but I can't see my bot when I search instead

#

<@&304313580025544704>

modern sable
gilded plankBOT
#

@young adder

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
lusty quest
#

where did you call the failure embed? in your index file or command file?

flat pelican
#

pain.

young adder
#

help?

lusty quest
quartz kindle
#
auctions.reduce((arr, cur) => {
    if(!arr[cur.item_name + ":" + cur.tier]) {
      arr[cur.item_name + ":" + cur.tier] = 0;
    }
    arr[cur.item_name + ":" + cur.tier]++;
    return arr;
  }, {});
cinder patio
#

Your bot needs to get verified first

carmine summit
slender thistle
fierce ether
#

index but i dont go ../utils/index i use ../utils/

lusty quest
#

thats the same path?

fierce ether
#

meant that

#

soz

young adder
#

Gives 403 error @slender thistle

slender thistle
#

did you read the second message I linked

lusty quest
#

if both files are in the same folder you can just use ./file

quartz kindle
young adder
#

yes it's not about her, my problem

#

@slender thistle

slender thistle
#

Your bot was added to a queue

young adder
#

I have my boat attached and even voted myself but it doesn't show up when I throw it to others

slender thistle
#

and will have to be reviewed by bot reviewers

#

until then it's not available to be viewed by anyone who isn't listed as an owner of the bot

young adder
#

When will the review end?

slender thistle
#

if you read what the second message said...

young adder
#

How do I add coy to my bot after the review is over?

quartz kindle
#

coy?

slender thistle
#

code?

young adder
#

I am Turkish and it is a little late because I translate your messages

slender thistle
#

What do you mean by "coy"?

young adder
#

As I said I was going to write a code, not coy, I'm translating it

lost mauve
slender thistle
#

So go write your code just like you would without being approved on top.gg

#

Top.gg is a bot listing website

#

Bots on top.gg are supposed to work BEFORE being listed

blissful cliff
#

question, how do you update your bot without downtime?

#

is there a way to do blue-green deployment without having double responses from your bot?

woeful pike
carmine summit
lost mauve
#

aah, alright

quartz kindle
#

but not by much

carmine summit
#

I dont get it

#

should I use for loop instead for the loop mentioned above?

quartz kindle
#

not necessary

#

its fine to use reduce when it fits the situation

#

if you want to loop over an array and in some way combine everything into a single value, use reduce

#

reduce is different than other loops

#

find filter map forEach etc... all of them use for loops under the hood

#

but reduce doesnt

#

reduce uses a special Fold algorithm

#

In functional programming, fold (also termed reduce, accumulate, aggregate, compress, or inject) refers to a family of higher-order functions that analyze a recursive data structure and through use of a given combining operation, recombine the results of recursively processing its constituent parts, building up a return value. Typically, a fold ...

wraith minnow
#

hey

#

someone can help

#

me

#

with the bot MEE6

#

bro is lagging so much

pale vessel
wraith minnow
#

yes that one

pale vessel
#

ask there, not here

wraith minnow
#

thanls

#

thanks

lone nova
#

Does anyone know how to send random gifs according to us like

We will put the gifs 10 bot must randomly send 1 of them

thin echo
#

What code do you use

#

py or js

wraith minnow
#

he uses js

#

hey can someone can give

#

me dank memer

#

support server

#

thanks

tulip ledge
#

Can someone explain why when I call this command the first time it logs 9 in the recipe (as u need 9 to craft it, wich is right) but when I do the cmd a second time it sais 81?

    let mostSimilar = this.mostSimilarModule(item);
    let toCraft = this.CraftHandler.getRecipe(mostSimilar);
    let recipe = toCraft.recipe.map(item => { return { itemid: item.itemid, amount: item.amount * amount }});
    console.log(toCraft.recipe)
    toCraft.recipe = recipe;
    console.log(recipe)
thin echo
#

How many commands do your bots have

#

Or is that a bad question to ask

latent heron
#

@slender thistle reaction translations has proved to be a difficult task

#

Discord formats flag unicodes in such a painful manner

#

Theyre not regular UTF-8 support in d.py

earnest phoenix
#

I want a helping dev for my project

lament ruin
#

@wraith minnow man, you can literally search it in the dank memer top.gg main page. it is right there

latent heron
#

So I have to encode, then change into a string name convention, then I can translate and plug in

#

Then re encode to the original version

lament ruin
wraith minnow
#

thanks bro

tired panther
#

Does someone know hoow to turn a normal object in a mongoose object?

thin echo
#

no?

slender thistle
#

Poor you

tired panther
woeful pike
#

mongoose objects represent a document in a collection, you can't turn an object into a mongoose object without saving it through mongoose first

#

also just ditch mongoose in general, it's shit

tired panther
lament ruin
woeful pike
#

mongodb + class-validator

#

or well, preferably not even mongodb but if you're gonna use mongo just use the regular driver

lament stump
livid carbon
#

good job

#

did you try float:left;

woeful pike
#

don't use floats for layouts

livid carbon
#

hmm

#

grid?

#

flexbox?

woeful pike
#

flex here would work fine

livid carbon
#

imo css is just trying random crap until it works

woeful pike
#

yeah, if you don't know css lol

livid carbon
#

lol

tulip ledge
#

I don't like css tbh

livid carbon
#

use sass

#

ez fix

tulip ledge
#

it's a boring language

livid carbon
#

its a styling language!

rocky lake
#

Hello!
Quick question, my bot requires an admin ||person with administrator perms|| to set up some important variables to unlock the complete functionality for their server.
Will this effect my bot's verification time, or is there a chance by bot doesn't get verified at all?
PS: It is 809430343433453568

lament ruin
livid carbon
#

how interesting can it be!!

tired panther
woeful pike
#

no you just use Schema.create() on the object

rocky lake
#

Xetera, is your status a lyric from a song?

tired panther
pale vessel
latent heron
#

slightly, yes

livid carbon
#

i like how windows can't render flags

#

so annoying

lament ruin
tired panther
#

damn, I trashed my collection

#
MongoError: E11000 duplicate key error collection: mydb.data index: _id_ dup key: { _id: ObjectId('60153d6398c7b915fc29df62') }
#

lol

lament ruin
#

what

tired panther
lament ruin
#

i've never used that one

tired panther
woeful pike
#

yeah mongodb is just trash, use a real database

tired panther
woeful pike
#

postgres is excellent

#

I mean this isn't necessarily a problem of "mongo bad" I just don't know what the problem is off the top of my head and it's probably some dumb mongoose thing anyways

tired panther
woeful pike
#

you don't run into these issues with the regular mongodb driver

crimson vapor
#

its because they created a doc with the same ID on a unique: true field

woeful pike
#

yes relational databases are good

tulip ledge
#

Why does this not work?

woeful pike
#

mongodb has a fairly niche application idk why every beginner uses it to store highly relational data

crimson vapor
#

check if a document exists before you create it

pale vessel
woeful pike
#

or you can use upsert

crimson vapor
#

in your code

#

before you save it

tired panther
#

so It did not create anything?

crimson vapor
#

the first time it did, the second time it errored

tired panther
crimson vapor
#

yes

#

why would it show 2?

tired panther
crimson vapor
#

no it errored because you are trying to create a new document with a unique field

#

which it can't do

#

it will always error

#

the issue isn't mongodb or mongoose, you are creating a document when you shouldn't be

tired panther
cinder patio
#

you should check if it exits before that or you could use upsert

crimson vapor
#

what do you think?

lost wadi
#

Hello, does anyone handle the ytsr-core module?

pale vessel
#

they haven't updated that in ages

#

it throws json error

modest maple
pale vessel
#

you mean ytdl-core?

modest maple
#

That assumes it exists

crimson vapor
#

you should probably learn more about mongodb and mongoose

#

or even databases in general

modest maple
#

There is an upsert bool

lament ruin
#

I'm trying to make some href links on html to jump to specific parts on the page. I already got it working but instead on jumping to that part in the same tab it creates a new one.

crimson vapor
#

its literaly { upsert: true } as an option

lament ruin
#

Do you guys know the cause of this?

lament ruin
#

im already using the target="_self" attribute

lament ruin
quartz kindle
#

you cant

lost wadi
#

I have a question and I don't know how to download the video

const ytsr = require("ytsr");
const ytdl = require("ytdl-core")

let query = args.join(" ");
    
    const res = await ytsr(query);
    const video = res.items.filter(i => i.type === "video")[0];
    const link = video.url;
    const download = ytdl(link, { filter: format => format.container === 'mp4' && format.qualityLabel === '480p'})
    console.log(download)
tulip ledge
#

how do I remove the reaction of a specific user again?

modest maple
#

Well ya can

lament ruin
#

guess ill have to remove that

modest maple
#

My bot page is a great example of what you can do bloblul just gotta be determined enough

quartz kindle
#

for some reason top.gg adds target="_blank" to all <a> tags

lament ruin
lament ruin
quartz kindle
#

yes

lament ruin
#

bruh

quartz kindle
#

well the reason is obvious

modest maple
quartz kindle
#

they dont want people to leave the page

lament ruin
#

ah

pale vessel
#

he meant what he did with stars and stuff

crimson vapor
#

edit all of the html

#

ez

modest maple
#

Iframes, iframes everywhere bloblul

tired panther
crimson vapor
#

why would upsert do anything on a create?

quartz kindle
#

ah well you can with iframes of course

modest maple
#

Scroll to is still limited like that though

#

Requires more jank

tired panther
#

the error was caused in that line

crimson vapor
#

iirc upsert is for updating

tulip ledge
#

how do I remove the reaction of a specific user again on a specific message?

crimson vapor
#

I could be very wrong

pale vessel
#

wow they finally fixed the problem with typings on mongoose

crimson vapor
#

finally?

#

pog

quartz kindle
#

it sucks because my top.gg description is an 800 line markdown with an index at the top... it works fine on github but doesnt work at all on top.gg

pale vessel
crimson vapor
#

nice

tired panther
quartz kindle
#

lul

crimson vapor
#

can cert replace body with an iframe?

cinder patio
#

Don't expect your bot to get invited to any servers if your description is tash

quartz kindle
#

thresh description

quartz kindle
crimson vapor
#

but the entire site

#

not just the inside part

quartz kindle
#

nobody can do that

pale vessel
#

fuck mongoose

pale vessel
crimson vapor
#

LOL

quartz kindle
#

i mean you can, but you'll get kicked from top.gg

pale vessel
#

stop breaking on every update

#

fucking fuck

crimson vapor
#

discord cdn is slow for me

lament ruin
#

@modest maple i just saw you top.gg page

#

what the f

#

you even have some animations lmao

tired panther
#
  let guild = this.cache.get(guildid);
                schema.create(guild) 
                console.log(guild)
                guild.time = false;
                //guild.save( {upsert: true}).catch(e => console.log(`Could not update  ${e}`) );
                console.log(guild)
``` I did not even save it, but the error is coming
lament ruin
crimson vapor
#

yeah

tired panther
lament ruin
crimson vapor
pale vessel
#

why the fuck does model.find() returns any instead of Schema

#

????????????????

#

they fucked it up

crimson vapor
#

.find() without anything should be Schema[] LOL

modest maple
crimson vapor
#

right?

pale vessel
#

yeah

#

but no, it's any now

crimson vapor
#

thank you mongoose

pale vessel
#

what the fuck did they do

lament ruin
pale vessel
#

i'd have to cast my own

#

why

modest maple
#

bloblul i had some free time

lament ruin
#

hahah

pale vessel
#

do you have the same problem? @crimson vapor

crimson vapor
#

idk im on an old version of mongoose I think

#

sec

pale vessel
#

it broke since 5.12.0

#

now it's 5.12.2

crimson vapor
#

im onnnn\

#

umm

#

"mongoose": "^5.11.15",

#

yea

pale vessel
#

latest working for me is 5.11.18

crimson vapor
#

ok

#

I might update

#

but idk if its needed

pale vessel
#

check first

#

i wanna see if it's just me

crimson vapor
#

ok sedc

pale vessel
#

on their gh issues it seems to be for everyone else too

#

but apparently they "fixed" it in 5.12.2

lament ruin
pale vessel
#

but it doesn't seem like it

lost wadi
#

no one?

crimson vapor
#

I don't use find()

crimson vapor
#

@pale vessel ill check fully when I can but atm it looks like its fine

lament ruin
#

An example of what i was mentioning

crimson vapor
#

typed and shit

cinder patio
#

That's unreadable

#

also a review*

pale vessel
#

@crimson vapor fixed my issue. i had to do ts model<Doc>( name, new Schema() ) instead ofts model( name, new Schema<Doc>() )

crimson vapor
#

hmmmm

#

that seems kinda redundant

slender wagon
#

how do i make a buitiful embed for discord on my website

crimson vapor
#

meta tags

#

iirc

slender wagon
#

ightys

pale vessel
crimson vapor
#

ig

#

you do a find() for your reminds?

pale vessel
#

yuh

#

i cache them on startup

crimson vapor
#

do you do a timeout or something

pale vessel
#

that's for checking

crimson vapor
#

oh

pale vessel
#

well anyway I'm the retarded one the whole time

crimson vapor
#

lol

pale vessel
#

why did they change it just like that though

#

i have a love and hate relationship with ts

crimson vapor
#

lol

#

I know how you feel

opaque acorn
#

How do I mention someone in the avatar command?

lament ruin
#

what does that even mean? avatar command?

opaque acorn
#

when i mention someone to see their avatar

#

I don't know how to make it show the avatar of the mentioned person

obsidian anchor
#

hi guys

#

do you guys allow your bot being added here?

quartz kindle
#

right now only bots that are requested by the community are added

green kestrel
#

ive decided to do something really crazy!

quartz kindle
#

again?

green kestrel
#

aegis has some weird issues with its obtuse thread model that neither i or anyone else seems to be able to properly pin down

#

ive decided to make my own lightweight C++ discord lib instead

#

i want to keep the LOC way down... as few deps as possible... understand as much of it as possible

quartz kindle
#

ayy nice

green kestrel
#

and im going to make its native websocket speak erlpack

#

erlpack + c++ should be a sight to behold

#

plus discords already made a lib for processing erl in c++ 👍

lament ruin
#

big brain moment

green kestrel
quartz kindle
#

brain brain

green kestrel
#

im going to call it D++

#

the lib i mean

quartz kindle
#

if you're gonna use unordered maps anywhere i have a suggestion

green kestrel
#

im not sure if im going to have the time or ability to officially support it but i'll make all code open source

#

im listening @quartz kindle 😄

rose tartan
#

How do I make a per server reaction roles with mongodb(Im new to djs)

quartz kindle
#

this thing

green kestrel
#

hmm, is it just a hash function you drop into unordered_map?

quartz kindle
#

nah its the entire unordered map replacement

green kestrel
#

hmm

#

whats the gain

#

is it all about speed? or memory?

quartz kindle
#

robin_hood::unordered_map<int, int>

#

i've tested it with 10 million <int, int>

modest maple
#

textregexeq('\[email', description) Am i doing something stupidly wrong with this or smth? (PostgreSQL)

quartz kindle
#

used 5x less ram than std::unordered_map

modest maple
#

it works for textregexeq('\[email', title)

quartz kindle
#

and was 2-3x faster

modest maple
#

but not with description

green kestrel
#

hmm interesting

quartz kindle
#

the author made a huge ass benchmarking suite

#

comparing lots of mapping libs

#

let me show you

modest maple
#

google's swissmap is pretty cool

quartz kindle
#

there are like 20+ more efficient alternatives to std

#

its stupid

#

lmao

opaque acorn
#

How do I make when I mention someone with the avatar command it shows their avatar?

modest maple
#

usually though they come with a added cost

#

like some hashmaps like Fx are much faster but less cryptographically secure making them more prone to collisions and attacks

tired panther
modest maple
earnest phoenix
#

Error: Cannot find module './dist/main.js'

tired panther
earnest phoenix
#

rror: Cannot find module './dist/main.js'
Require stack:

  • C:\Users\creative infotech\Desktop\disc-11-main\start.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at start (C:\Users\creative infotech\Desktop\disc-11-main\start.js:30:5)
    at Object.<anonymous> (C:\Users\creative infotech\Desktop\disc-11-main\start.js:21:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ 'C:\Users\creative infotech\Desktop\disc-11-main\start.js' ]
    }
#

like this error

green kestrel
#

im trying to avoid pulling in deps

#

each dep is someone elses code i dont understand that may introduce issues, which is the problem ive had with websocketpp. although im still going to need nlohmann::json, for sending json to REST endpoints

earnest phoenix
#

help me weirdsip

empty hollow
#

hey

#

How do i make my discord bot run 24/7? (❌heroku)

rose warren
#

Use a cheap VPS or selfhost

green kestrel
#

get a vps

quartz kindle
green kestrel
#

i dont like rapidjson

#

it came with sleepy_discord

empty hollow
rose warren
#

Selfhost then

green kestrel
#

it does something really odd to the default new operator and allocator

#

probably to optimise speed

quartz kindle
#

there are a few other faster alternatives too apparently

green kestrel
#

speed isnt everything tbh

modest maple
#

often with hashmaps faster = less secure

green kestrel
#

when youre in C++ youll spend like 99.9% of your time waiting on i/o, no matter how crap your code is unless you do something really herp derp tastic

quartz kindle
#

for me performance is everything xd

green kestrel
#

the difference between two json libs probably wouldnt be noticable in speed until you get to like hundreds of millions of users

modest maple
opaque acorn
green kestrel
#

im very wary of premature optimisation

#

for now, pick the libs etc im comfortable with and trust

#

and then i can address issues if and when there are any

rose warren
green kestrel
#

lol

stoic viper
#

what do you guys think are the basics someone should know before building a bot ;-;

green kestrel
#

i also want to make a lib that means as little rewriting of my bot as possible

#

so im aiming for structs to have the same meber names etc as aegis

#

so i can just change namespaces, and some initilalisation code

slender wagon
#

is there a way you could change the embed color with meta tags

opaque acorn
#

ok

tired panther
opaque acorn
#

xdddd

#

TypeError: Cannot read property 'members' of undefined

tired panther
#
let target;
if(message.mentions.users.size){
target = message.mentions.users.first().user 
}else{
 target = message.author
}
#

@opaque acorn this should work

opaque acorn
#

I substitute the old thing for this?

pale vessel
#

one liner mMlOl

tired panther
pale vessel
#

I won't

tired panther
#

const target = message.mentions.users.first()? message.mentions.users.first().user : message.author

modest maple
#

Well, it was made for rust

pale vessel
modest maple
#

it does 8 Bytes at a time VS 1 Byte at a time which is the normal

#

which makes it incredibly quick

#

but at the cost of being not secure

quartz kindle
#

but is the algorithm an actual hashtable algorithm or is it just the hashing algorithm?

modest maple
#

It has a hashtable algo, but you'd need to hunt through the rust source todo that

#

or you can just call rust from C++ mmLol

quartz kindle
#

as far as hashing algorithms go, the playing field is pretty large

modest maple
#

yeah

quartz kindle
#

there's a lot of stuff out there

modest maple
#

overall i just Use google's swissmap

#

with ahash

quartz kindle
#

have you checked out xxHash?

pale vessel
#

Yeah

modest maple
#

The swish map is a great mix of speed while being secure

pale vessel
#

const target = message.mentions.users.first() || message.author;

quartz kindle
#

google swissmap === abseil's hash tables no?

modest maple
#

i believe it is yes

quartz kindle
#

they are tested in the benchmark link i posted before

slender wagon
#

color on embeds with metatags anyone has a clue?

quartz kindle
#

they are pretty good yes

modest maple
slender wagon
#
<meta name="theme-color" content="#03fcdf">
``` tried this but it doesn't work
opaque acorn
pale vessel
#

Then message might not be what you think it is

tired panther
pale vessel
#

Message should always have the mentions property

quartz kindle
#

i liked robin_hood::unordered_map the most for performance, and tsl::sparse_map for memory usage

quartz kindle
#

but it depends a lot on the data types you give it

opaque acorn
#

@tired panther
I give you the command?

quartz kindle
#

10 million <uint64, double> took 2 seconds to insert and used ~300mb ram with robin_hood
3-4 seconds and ~200mb ram with tsl,
~5 seconds and 1100mb ram with std

wheat valve
#

How would I be able to get the username of the server owner with the owner ID? I'm using Eris

quartz kindle
#

fetch it

#

i believe eris uses guild.fetchMember()?

green kestrel
#

yay, i have a connection! 😄

#

now just gotta figure out this rammel lol

opaque acorn
#

` const Discord = require("discord.js");
const client = new Discord.Client();

module.exports.run = (client, message, args) => {
const target = message.mentions.users.first() || message.author;
const embedavatar = new Discord.MessageEmbed()
.setTitle("Mostrando su avatar.")
.setImage(target.displayAvatarURL({ size: 4096, dynamic: true }))
.setColor("RANDOM")
.setTimestamp();

message.reply(embedavatar);
};

module.exports.help = {
name: "avatar",
aliases: ["av"]
};
`

quartz kindle
#

xD

#

which websockets lib are you using?

green kestrel
#

im not 😄

#

i rolled my own

#

thats what i mean about being able to understand it

quartz kindle
#

you're doing pure tcp?

earnest phoenix
#

All languages?

green kestrel
#

291 lines

#

yup

quartz kindle
#

amazing

green kestrel
#

well openssl, tcp

green kestrel
#

ofc my code is C++, im porting it as i learn it

quartz kindle
#

big brain

opaque acorn
earnest phoenix
#

in the discord developer portal

#

enable the guild members intent on your bot app

quartz kindle
opaque acorn
#

this ?

#

SERVER MEMBERS INTENT

cosmic forum
#

Hi, anyone know how I can get the url of a new Discord.MessageAttachment()? (discord.js)

quartz kindle
#

if your error is "cannot read property users of undefined"

#

then it has nothing to do with intents

thin echo
#

How do you do embeds on python?

cosmic forum
rose warren
thin echo
quartz kindle
#

you mean to add the attachment to an embed?

wheat valve
quartz kindle
cosmic forum
quartz kindle
#

you need to resolve it

cosmic forum
pale vessel
quartz kindle
earnest phoenix
#

oh wait nvm

rose warren
#

Tim beat me 😂

thin echo
#

What is the code for embeds on python?

earnest phoenix
modest maple
thin echo
#

thx

pale vessel
#

what if it's hikari doe

onyx hare
#

ive forgotten how timeout works
message.delete{timeout: 300} returns as "There but never declared"
forgot the brackets im dumb

rose warren
# cosmic forum Ah ok, thanks.

But that's not the "url" of the image once it's posted to Discord if that's what you're looking for. That's how to attach your canvas buffer to the embed but it won't give you the Discord CDN url if that's what you want. You have to get that after sending the embed in the channel.

cosmic forum
#

Oh ok

green kestrel
#

it connects and receives the first erlpack message

opaque acorn
green kestrel
#

the way i see it, the simpler it is the less there is to go wrong

earnest phoenix
lusty quest
opaque acorn
#

Then what do I do?

green kestrel
#

yeah @lusty quest i thought websocketpp was a proven concept. its full of thread safety issues

#

😦

#

and sometimes it just uh... forgets to reconnect

lusty quest
#

rip

thin echo
#

I need help with something in my code

#

embed = discord.Embed(title=random.choice(starter_hugtext), description=random.choice(hugoptions))

#

random.choice(hugoptions) <- this is my gif, but in the embed it just shows the link

#

how do I fix it so that it shows the gif

lusty quest
#

pls use codeblocks, it makes it easier to read

#

also what language did you use?

wheat valve
thin echo
#

ik

#

I could have used an api

lusty quest
#

i cant help with py sorry

thin echo
#

ok

lusty quest
#

but i could try, i guess the embed constructor works similar to JS

thin echo
#

no its ok

lusty quest
#

you probably dont want to use description for images

thin echo
#

I was just trying embeds out

thin echo
lusty quest
#

there should be probably a image propertie

thin echo
#

ok

lusty quest
#

but better look into the docs of the API wrapper you use

quartz kindle
green kestrel
#

its about as low level as you can get 😄

dusky lagoon
#

Ok so im trying to get data from a .json file from a website

const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
module.exports = {
  name: 'pokemon',
  
  run: async (message, args, client) => {
   const  content = await fetch('https://pickrandom.com/ajax/random-pokemon-generator/getdata/?duplicate=false&numbers=1&national_of_pokemon=national&type1_of_pokemon=any&type2_of_pokemon=any&legendary_of_pokemon=true&nfe_of_pokemon=true&pokemon_info=false&format=json')
    .then(res => res.json())
    .catch(() => null);

    if (!content){
      return message.channel.send(`Server Error 5xx: Advice .json is currently down!`);
    };
    let pokemon = content[0].list.name
    return message.channel.send(
        new MessageEmbed()
        .setColor('#EAA5EA')
        .setTitle(pokemon)
        .setImage(``)
        .setFooter(`Advice | \©️${new Date().getFullYear()} `)
      );
    
  }
};``` and the error is ```(node:58804) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'list' of undefined```

and this is how the .json file looks like ```js
{"list":[{"id":"765","name":"Florges","id_pokemon":"671","image":"Florges_01.png","type":"FAIRY","type2":"","species":"Garden"}],"list_to_save":"765","message":""}```
quartz kindle
#

maybe one day i'll experiment with that on node

#

since you can use raw tcp on node

#

abstracted to js of course

#

but still

green kestrel
#

yeah

#

might be interesting to embed this as a node lib using native code

quartz kindle
#

ye

#

i thought about using n-api to attach a native websocket to node instead of using the ws lib

quartz kindle
#

but idk if its worth it

#

one of the best websockets lib in c++ is server-only

#

they gave up on clients because client side is whatever

#

only server side matters for performance and efficiency

lusty quest
dusky lagoon
#

let me try

lusty quest
#

if you work with json i suggest to use something to visualize the path inside of it

dusky lagoon
#

ohw yeah thats smart

lusty quest
thin echo
#

is it this this

thin echo
#

ok

lusty quest
#

this is also the codeblock ive mentioned

thin echo
#

this

lusty quest
#

you can also define a syntax highlighting with it

rose warren
#
my.code():
earnest phoenix
#

mobile doesn't officially support syntax highlighting, if im not wrong

lusty quest
#

Mobile clients are a hot mess

rose warren
#

It doesn't yet. But you can still type using syntax highlighting to help those using PC.

earnest phoenix
#

@thin echo

#

@humble gyro

#

@spare goblet

#

@modern sable

modern sable
#

what's wrong?

earnest phoenix
#

i

#

have a prob

dense rune
#

you

#

yo

earnest phoenix
#

i submitted

#

my bot

#

and then no response

dense rune
#

anyone wanna join my new server

earnest phoenix
#

it is a moneth

modern sable
#

The process takes 2-3 weeks, check pins in #support

earnest phoenix
#

hey

#

a month

modern sable
#

Oh wait

earnest phoenix
#

ohhhh

#

ok

modern sable
#

You added it during our database migration which meant it never got actually added

#

Sorry about that

earnest phoenix
#

what the

#

ok

#

np

#

i will do it

#

agaian

crimson vapor
#

been there, done that

thin echo
#

It’s raining so hard

#

The rain is bouncing up like 2 feet in the air

#

Brb

earnest phoenix
#

oh

#

great

tired panther
#
``` The error is coming from mongo db
summer torrent
#

"duplicate key error"

tired panther
#

*any document

cinder patio
#

you definitely are

tired panther
#

hmmm.....okay fixed it.
I heard from something like Object.assign()
can I use this for converting a normal object in a mongoose object?

#

I just want to update one field with my given object "guild"

#
guild.time = false
guild.save()
#

but guild must be a mongoose object to use .save()
ping me when somebody has a idea

lyric mountain
#

like, sometimes codeblocks get highlighted on mobile

earnest phoenix