#development
1 messages · Page 1670 of 1
last time i did that i destroyed all its 128gb with the twitch mass join
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
ah i see
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
how the tables have turned
yeah
@quartz kindle what the fuck #starboard message
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
yes
LOL
@quartz kindle in which cases are guilds not loaded in the cache?
never

How to write with bot the member count? e
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
message.guild.memberCount
only once
but when the client content changes them, will it change too?
yes
That's what they all say.
I was wondering if someone could help me make my first bot.
what language you want to use?
English
lmao
Uuhm i mean code language 
hahah
Ohh......... Lol i dont know any code
y am i even here
lololol
I have recoded a few links tho
Maybe, its better to learn a language first before starting to code a bot.
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....
Start with this
Like python or javascript
Ok. Thank you!
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!")
It is prob something really simple with v12 but here is the error I am getting.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
roles.cache
why not make a channel?
TypeError: message.guild.roles.cache.exists is not a function
I got that back...
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
channels.create
Is it not supposed to be ctx.message.author?
exists is v11 and below
Also, you can simplify if member != None: to just if member:
Ah, is there a alternative in v12?
How so?
You have to pass a function
doesn't matter
Perform a check for nick or don't give it a default value at all
it will cause an error
i will try again later
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
ik
Preferably you would do something like
if member:
if nick:
change_nick()
else:
no_nick_found()
else:
no_member_found()
my bot keeps going offline although in vscode it is still online
I hate v12
(node:136156) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'createChannel' of undefined
how does it "say it's online" in vscode
the process hasnt exited
So the process is running you mean
yes
That doesn't mean it's online
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
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?
There is no message.guild.cache. It's message.guild. caches are for collections.
Well then use the correct method #development message
What you want is message.guild.channels.create() I believe
can you upload your entire index.js to https://paste.gg/ maybe
A sensible, modern pastebin. Share text and source code snippets with no hassle.
Feels like if anything was happening to make the bot crash it would be captured by bot.logger.error
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-
h
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!
oh-
well that's reassuring
My suggestion: Take the time to leran javascript first. Here are some resources: #development message
not helped to me
:l
tyty
Well, it's how you create channels. message.guild.channels.create
I wonder how that can't help, there are even examples if you would scroll down the site
"it didn't help" usually means "I didn't bother reading but I remember trying to use something like that and it broke so I'm going to not try again"
Opening the site, first look - "oh god too complicated", closing the site, beggin in Discord for code examples
Yeah what I said 
And then our code example is the same as the site 😛
aye :D
TypeError: Cannot read property 'channels' of undefined
-_-
That channel should be renamed to "entertainment" sometimes
i kill this js
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
I guess he just copied the code on djs
guild.channels.create()
while being in a message event
i kill this js
he probably did it
Ah well, if giving up is your thing, sure. 
Ah.
woop woop
and i kill who made that command handler because it didn't work in other js file
e
I have a feeling the issue isn't the person that wrote the command handler....
that's the result of copy & paste without undestanding
why
other commands: simp etc. worked
¯_(ツ)_/¯
PEBCAK
oh oh sombody opened up shivs cage
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?
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
because
cur
you need to return arr
otherwise it doesnt exist anymore after the first iteration
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
(accumulator, currentValueFromArray, Index, OriginalArray) consistency™️
let's just use (accumulator, current_value_from_array, index, OriginalArray)
lets just use (a,b,c,d)
im confused still
well unconfuse yourself
do you know what is "implicit return" and "explicit return"?
nope
() => 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
so you will only need return if it is in {}
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
so I need to explicitly return it for it to work
so I need to use {}
also, what is this supposed to do? arr.push(cur["popularity"] = 1)
Is there any way to upload a image as a emoji in discord.js?
add popularity to the end of the object with 1 as value?
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 ?
this is also doing arr.push(null)
nope
It's actually pushing 1 to the array
actually not
javascript assignment returns null (or undefined I can't remember. probably undefined)
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
I don't think it even allows you to use let and const where an expression is needed
yeah it wouldn't let you use that here, no
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...
wow. that looks horrible.
Honestly your logic inside that reduce is so convoluted that it's better to just use a loop
loops are too bulky
I know I told you to use reduce originally but this is too much
your code makes even less sense right now
"bulky"
is heroku free hosting enough for crawling multi pages asynchronously ?
yes
my bot is working fine on my pc but it doesnt on heroku
like sometimes the crawling func just fails or sth
crawling how? By requesting the HTML and using a parser to traverse it?
yea im using puppeteer
you need the puppeteer buildpack
from what i understand you want to either increase the popularity of an existing item or add the non existing item and set popularity to 1, right? so your code is still very wrong
you mean puppeteer-core?
I don't think heruko free plan can handle it
i alr got that
The free plan probably can't handle a lot of different pages / browsers
and it runs fine for like once or more but then
Do you close the pages after you're done with them?
are you sure puppeteer is the right tool for the job here, which site are you crawling
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.
Music bots be like
for what are you crawling it? You can make a HTTP get request and use a HTML parser for most things
im just crawling either "watching" or "waiting" text on a livestream/upcoming stream
How are you gonna load the js though
You should be using pubsubhub
Some data is already in the HTML
ok imma try doing a research on that
like the title of the video
yeah
that's why I asked what he's trying to get
i just need to know if that channel having a livestream/upcoming so i dont have to use youtube search API
I dunno if that's in the html
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
})
do I really need the curly brackets?
yes
otherwise you are not returning the accumulator
which makes the next loop break
having curly brackets isn't a bad thing
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
it looks ugly 
arr.push() also returns a number
question unrelated to this current topic
arr.push() && arr returns true
why does being a discord bot developer seem to be a personality trait now
loockdoown
lmao
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!"
but ok I guess I do need that curly brackets
arr.push() && arr returns the array
aka arr
If you go to https://www.youtube.com/channel/<id>/live and if the channel is live/scheduled to be live, it will redirect to the live video URL. If not, it will redirect to the channel URL instead. You can use ytInitialPlayerResponse from the HTML and scrape the player data (title, description, etc.)
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
wait what
how
dafuq is this sorcery
awesome right
that works the same way in python too 
It's pog
because array.push() returns 1 which is truthy so it'll return arr
whats ytInitialPlayerResponse ? I've been doing the first part plus crawling "waiting" or "watching now" text
thats mainly me referring to people who have no coding experience and they take on a discord bot as their first project
i could've put into better terms
Wait?!?! This exists?!?!{...cur}
so what? part of top down learning is starting at a hard problem and breaking it down into pieces
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
yes, it's an exciting way of learning programming. Difficult but legitimate
i will respectfully disagree
You don't have to know how everything works at first
why do bot devs constantly want to put other devs down
let people learn however they wanna learn
no initial value 
alright
you can't fool us, Tim. We know you're an AI
You're all AIs
Huh, would it be a good idea to put it on a résumé, then?
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
oh nice
yes absolutely
yeah, it's def going to be a case by case basis
as would anything
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
lol I used the word "shit" 3x in my resume.
yo pog
and "Speedwhoring"
???

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....
man i've been making a super serious resume in latex, maybe the meta has changed
This is from my own experience, at this point if your resume is "different" it gets more attention
# Experiences
- shitty internships no one cares about
- I've been making a heckin poggers Discord bot in Java, pls hire
I made mine in figma lol
that's life
imagine having a 50 million downloads npm module in your resume
you check it out
its isThirteen
how does one export it to npm though, not really into publishing something to npm. just curious
using npm publish
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?
const { Embed, FailureEmbed } = require('../../utils/');
works local but not on vps?
did you uploaded the file to the VPS?
yep
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
v14.15.4 btw
well you could always not duplicate the items and modify the originals instead. any reason why you dont want to modify the originals?
its just adding a popularity property
I dont have any reason to not modify the originals
where is the path relative of the file where you call it to the failureEmbed.js?
are names and tiers duplicated? like you have the same name in multiple tiers and the same tier in multiple names?
index.js
yes
is that a ftp thingy
the path not the name
what path?
/var/etc/ is a path
|Root
|->Index.js
|-> Some Folder
|-> Some Folder
|->Failure Embed.js
```like this
I think the only way to optimize it is by removing {...}
for eaxmple
its broken down from src/commands and src/utils/index.js
you can use an object instead of an array
objects have direct access, array.find has to loop over the full array every time
where is Failure Embed? in utils or commands?
utils
then you call the path wrong, you only need to move up one folder not 2
¯_(ツ)_/¯
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>
-atmods
@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.
where did you call the failure embed? in your index file or command file?
pain.
help?
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;
}, {});
Your bot needs to get verified first
I heard that for loops are faster than reduce
index but i dont go ../utils/index i use ../utils/
thats the same path?
Gives 403 error @slender thistle
if both files are in the same folder you can just use ./file
a for loop is the fastest loop there is, but reduce is very fast too, its the fastest of all array loops like find filter map forEach etc
Your bot was added to a queue
I have my boat attached and even voted myself but it doesn't show up when I throw it to others
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
When will the review end?
if you read what the second message said...
See pins in #support
#support message this one specifically
How do I add coy to my bot after the review is over?
coy?
code?
I am Turkish and it is a little late because I translate your messages
What do you mean by "coy"?
As I said I was going to write a code, not coy, I'm translating it
wait isn't that used for making app UI/UX? is your resume interactive? haha
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
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?
it's used for prototyping designs, you don't use figma to make apps
do you have any idea which is faster?
aah, alright
reduce can be faster, depending on the situation
but not by much
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 ...
yes that one
ask there, not here
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
I do that for my bot
What code do you use
py or js
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)
@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
I want a helping dev for my project
@wraith minnow man, you can literally search it in the dank memer top.gg main page. it is right there
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
yes yes sorry i alredy did
you have it right there
thanks bro
Does someone know hoow to turn a normal object in a mongoose object?
no?
what do you mean?
a mongoose object has in their objects, soem functions like .save()
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
let guild = this.cache.get(guildid);
guild.time = false;
guild.save().catch(e => console.log(`Could not update ${e}`) );
``` I was trying this
what would you recommend instead of mongo?
mongodb + class-validator
or well, preferably not even mongodb but if you're gonna use mongo just use the regular driver
https://sourceb.in/2NqNkvch93 if someone knows html, please help.
what i wanted to do:
https://imgur.com/a/90pPU1Y
what i did:
https://imgur.com/a/fIDhA43
don't use floats for layouts
flex here would work fine
imo css is just trying random crap until it works
yeah, if you don't know css lol
lol
I don't like css tbh
it's a boring language
its a styling language!
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
i think you need to create a schema of the object before hand
how interesting can it be!!
😦 , then I have to fetch it again and save it ?
already have
no you just use Schema.create() on the object
Xetera, is your status a lyric from a song?
thats what I meant 
would this help?
use that function, pass in there the variables you want to update
damn, I trashed my collection
MongoError: E11000 duplicate key error collection: mydb.data index: _id_ dup key: { _id: ObjectId('60153d6398c7b915fc29df62') }
lol
what
thats the same <schema>.create()
i've never used that one
this created new documents with the same Objectidkey and now I have the error lol
#development message
yeah mongodb is just trash, use a real database
what would you recommend?
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
does it work it with mongodbatlas ? isnt it sql?
you don't run into these issues with the regular mongodb driver
its because they created a doc with the same ID on a unique: true field
yes relational databases are good
Why does this not work?
mongodb has a fairly niche application idk why every beginner uses it to store highly relational data
how can I fix it?
check if a document exists before you create it
0⃣
or you can use upsert
so It did not create anything?
the first time it did, the second time it errored
this
when searching , it just give me one value
document already exist + "the first time it did" = 2
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
schema.create(guild) is it bc of this? guild is already a document
you should check if it exits before that or you could use upsert
what do you think?
Hello, does anyone handle the ytsr-core module?
Can i tempt you to a cassandra insert?
you mean ytdl-core?
with $set?
That assumes it exists
you should probably learn more about mongodb and mongoose
or even databases in general
There is an upsert bool
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.
its literaly { upsert: true } as an option
Do you guys know the cause of this?
in top.gg?
im already using the target="_self" attribute
yup
you cant
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)
how do I remove the reaction of a specific user again?
ah... welp.
Well ya can
guess ill have to remove that
My bot page is a great example of what you can do
just gotta be determined enough
i replied to an unrelated message xd
even if i specify target="_self"?
yes
bruh
well the reason is obvious
Because it would make sense if they didn't do that
they dont want people to leave the page
ah
how did you do it?
he meant what he did with stars and stuff
Iframes, iframes everywhere 
I know how to use them on find but on schema.create() ?
this schema.create(guild, {upsert: true})
why would upsert do anything on a create?
ah well you can with iframes of course
where should I do it , in the schema?
the error was caused in that line
iirc upsert is for updating
how do I remove the reaction of a specific user again on a specific message?
I could be very wrong
wow they finally fixed the problem with typings on mongoose
yes
nice
People: Paste Random Trash in their Desc to fullfill the minimum requirement
Tim: Why do I have just 800 lines?
lul
can cert replace body with an iframe?
Don't expect your bot to get invited to any servers if your description is tash
thresh description
anyone can use iframes
nobody can do that
fuck mongoose
no
LOL
discord cdn is slow for me
@modest maple i just saw you top.gg page
what the f
you even have some animations lmao
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
Are you hosting this?
https://topgg.crunchy-bot.live/home
Web site created using create-react-app
yeah
@crimson vapor isnt this weird?
@modest maple
yeah your code kinda seems useless
why the fuck does model.find() returns any instead of Schema
????????????????
they fucked it up
.find() without anything should be Schema[] LOL
Its on cloudflare but yeau
right?
thank you mongoose
what the fuck did they do
that's some dedication man
i had some free time
hahah
do you have the same problem? @crimson vapor
latest working for me is 5.11.18
ok sedc
on their gh issues it seems to be for everyone else too
but apparently they "fixed" it in 5.12.2
It looks great! I would just change the background image or something. The white text is hard to read over some parts of the image
but it doesn't seem like it
no one?
I don't use find()
Yeah... Its on a todo list
@pale vessel ill check fully when I can but atm it looks like its fine
An example of what i was mentioning
typed and shit
@crimson vapor fixed my issue. i had to do ts model<Doc>( name, new Schema() ) instead ofts model( name, new Schema<Doc>() )
how do i make a buitiful embed for discord on my website
ightys
otherwise it would say <prop> is does not exist on type Document<any>
do you do a timeout or something
that's for checking
oh
well anyway I'm the retarded one the whole time
lol
why did they change it just like that though
i have a love and hate relationship with ts
How do I mention someone in the avatar command?
what does that even mean? avatar command?
when i mention someone to see their avatar
I don't know how to make it show the avatar of the mentioned person
right now only bots that are requested by the community are added
you can see in #site-status the form for suggesting a bot
ive decided to do something really crazy!
again?
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
ayy nice
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++ 👍
big brain moment

brain brain
if you're gonna use unordered maps anywhere i have a suggestion
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 😄
How do I make a per server reaction roles with mongodb(Im new to djs)
this thing
hmm, is it just a hash function you drop into unordered_map?
nah its the entire unordered map replacement
textregexeq('\[email', description) Am i doing something stupidly wrong with this or smth? (PostgreSQL)
used 5x less ram than std::unordered_map
it works for textregexeq('\[email', title)
and was 2-3x faster
hmm interesting
the author made a huge ass benchmarking suite
comparing lots of mapping libs
let me show you
google's swissmap is pretty cool
How do I make when I mention someone with the avatar command it shows their avatar?
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
const target = message.mentions.users.first() || message.author
target.avatarURL()
never mind with this, i had the args the wrong way around lol
Error: Cannot find module './dist/main.js'
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
true, but the hint about why to use std is in the name... its STanDard
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
thanks
help me 
Use a cheap VPS or selfhost
get a vps
why not something like rapidjson?
no money
Selfhost then
it does something really odd to the default new operator and allocator
probably to optimise speed
there are a few other faster alternatives too apparently
speed isnt everything tbh
often with hashmaps faster = less secure
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
for me performance is everything xd
the difference between two json libs probably wouldnt be noticable in speed until you get to like hundreds of millions of users
FxHashmaps for you then if you got em 
TypeError: Cannot read property 'users' of undefined
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
Spoken like a true developer of a cache-free Discord lib 😂
lol
what do you guys think are the basics someone should know before building a bot ;-;
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
is that rust?
its
is there a way you could change the embed color with meta tags
ok
no it is not
let target;
if(message.mentions.users.size){
target = message.mentions.users.first().user
}else{
target = message.author
}
@opaque acorn this should work
I substitute the old thing for this?
one liner 
you can make it, but they wont understand it
I won't
const target = message.mentions.users.first()? message.mentions.users.first().user : message.author
Well Its a map in rust but the hashing algo isnt rust specific
Well, it was made for rust
Never mind
const target = message.mentions.users.first() ?? message.author;
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
but is the algorithm an actual hashtable algorithm or is it just the hashing algorithm?
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++ 
as far as hashing algorithms go, the playing field is pretty large
yeah
there's a lot of stuff out there
have you checked out xxHash?
isnt this node 14?
Yeah
I havent no, dont really need that much speed tbh
The swish map is a great mix of speed while being secure
const target = message.mentions.users.first() || message.author;
google swissmap === abseil's hash tables no?
i believe it is yes
they are tested in the benchmark link i posted before
color on embeds with metatags anyone has a clue?
they are pretty good yes
An open-source collection of core C++ library code
<meta name="theme-color" content="#03fcdf">
``` tried this but it doesn't work
i always get TypeError: Cannot read property 'users' of undefined
Then message might not be what you think it is
thats what I suggested.
first option needs .user.avatarURl()
Message should always have the mentions property
i liked robin_hood::unordered_map the most for performance, and tsl::sparse_map for memory usage
What are you trying to do?
but it depends a lot on the data types you give it
@tired panther
I give you the command?
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
How would I be able to get the username of the server owner with the owner ID? I'm using Eris
` 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"]
};
`
you're doing pure tcp?
All languages?
amazing
well openssl, tcp
might be an intents issue
and on top of that, i looked at this bare bones php webscoket, to see how to talk to the socket, plus read the RFC https://github.com/paragi/PHP-websocket-client/blob/master/websocket_client.php
ofc my code is C++, im porting it as i learn it
big brain
?
what is the issue
Hi, anyone know how I can get the url of a new Discord.MessageAttachment()? (discord.js)
if your error is "cannot read property users of undefined"
then it has nothing to do with intents
How do you do embeds on python?
wdym
after sending it?
before
You can get it if you attach it to an embed, then send the embed with a .then() to get the url but I can't remember off the top of my head the exact code.
What is the code?
you mean to add the attachment to an embed?
In the docs it only has fetchMembers, using it I get object Promise
yes its a promise
Ah ok, I have a canvas buffer, and I want to attach it as a .setImage() option.
you need to resolve it
yes
make sure you use fetchMembers({ userIDs: ["id"] }) or it'll fetch the whole member list
embed.attachFiles([{attachment: canvasBuffer, name: "image.png"}]).setImage("attachment://image.png")
Tim beat me 😂
What is the code for embeds on python?
tim answered correctly, didn't know
Ah ok, thanks.
if it's d.py its a discord.Embed class
thx
what if it's hikari doe
ive forgotten how timeout works
message.delete{timeout: 300} returns as "There but never declared"
forgot the brackets im dumb
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.
Oh ok
@quartz kindle https://github.com/brainboxdotcc/DPP
heres what ive done so far
it connects and receives the first erlpack message
i activate it?
the way i see it, the simpler it is the less there is to go wrong
na found out it has nothing to do with members intents
its a proven concept tho,
look at the AK-47 its super simple, and it just works
Then what do I do?
yeah @lusty quest i thought websocketpp was a proven concept. its full of thread safety issues
😦
and sometimes it just uh... forgets to reconnect
rip
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
Thanks
Thanks
i cant help with py sorry
ok
but i could try, i guess the embed constructor works similar to JS
no its ok
you probably dont want to use description for images
I was just trying embeds out
what should I use then
there should be probably a image propertie
ok
but better look into the docs of the API wrapper you use
i dont understand most of that but looks nice xD
its about as low level as you can get 😄
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":""}```
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
ye
i thought about using n-api to attach a native websocket to node instead of using the ws lib
is this any good yet?
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
should be content.list[0].name
let me try
if you work with json i suggest to use something to visualize the path inside of it
ohw yeah thats smart
https://jsonpathfinder.com/ this site helped me a lot with finding the path
JSON Path Finder
How do you do the cool thing where you put your code in a box like this
is it this this
3x `
ok
this is also the codeblock ive mentioned
this
you can also define a syntax highlighting with it
my.code():
mobile doesn't officially support syntax highlighting, if im not wrong
Mobile clients are a hot mess
It doesn't yet. But you can still type using syntax highlighting to help those using PC.
what's wrong?
anyone wanna join my new server
it is a moneth
Oh wait
@earnest phoenix You need to add your bot again at https://top.gg/bot/new
You added it during our database migration which meant it never got actually added
Sorry about that
been there, done that
Yes?
It’s raining so hard
The rain is bouncing up like 2 feet in the air
Brb
``` The error is coming from mongo db
"duplicate key error"
I am not inserting anything lul
*any document
you definitely are
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
some do
like, sometimes codeblocks get highlighted on mobile
Discord mobile supports syntax highlighting for a few languages


