#development
1 messages · Page 1912 of 1
What do I do then?
check the documentation for @hapi/code
I did, it doesn't explain it.
¯_(ツ)_/¯
"have you tried reading docs"
const suggestontoken = code(10);
suggestions?
what is this supposed to do anyway
mhm?
read above
is that directed at me?
Its supposed to make a code
nope
Like a ebgeubgsygbsB code
👍
if only there was a website that let you see all discord servers for a specific topic
server discovery doesn't exist on mobile
tho tbh the search is kinda broken rn, we're fixing it tho 
something's wrong here
i cant seem to find what you are talking about in the code package
mhm
I noticed too
try uuid or randomBytes from crypto
For djs?
uuid is just a package to generate random ids
I've never used these "codes" or uuids before
your bot token is an example
Ah
const { v4: uuidv4 } = require('uuid');
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
Thats it?
yes
Its that simple?
yes
thats the point of npm packages
djs makes your code worse
true
I tried using that package @earnest phoenix - comes up with the same error.
Fixed it! Wow that does work!
Now I just needa find out how to make em smaller o-o
you can use hashids
though you kind of need an incrementing number for that
otherwise you get collisions very quickly
is there someone who knows sharding, and can help, please?
Why does this spam on bot restart
maybe tied to wrong event?
It works already on guild leave
but it just randomly spams on bot restart
we have the same destiny
lmao
I checked the IDs and it seems to be spewing out IDs of servers its already left
One of which we share oddly
The iD's seem to be ones that spam !help etc in general
This server deleted by discord bc of bot farming
Ah yep
Thats what I have
use guild.available
I had a bot leave a server for all of my bots at the same time
wtf this feature hasn't worked for like 3 months and just suddenly works today
Imagine discord.js
Idk then
But discordjs loves this
why is it not logging anything
var data = JSON.parse(fs.readFileSync("./shop/items.json", "utf-8"));
var dataColors = data["colors"];
Object.keys(dataColors).forEach((key) => {
console.log("key: " + key + ", Val: " + dataColors[key]);
});
created = member.created_at
now = datetime.now()
delta = (now - created).days
if delta < 10:
embed = discord.Embed(title="⚠️Possibly Suspicious User joined!⚠️")
embed.add_field(name="User:", value=member.mention)
embed.add_field(name="Reason:", value="Joined less than 10 days ago")
embed.add_field(name="Joined discord", value=f"{delta} days ago")
embed.set_footer(text="Bot by big.bun#6969 and Nekros#0492")
await channel.send(embed=embed)
await log("sus", member.guild.id, member.id, reason, "Blacklister")
await adminlog("user", member.guild.id, member.id, reason, "Blacklister")
return```
im quite new to sql, it this the best way to join 4 tables?
SELECT *
FROM user u
INNER JOIN alpaca a ON a.id = u.alpaca_id
INNER JOIN cooldown c ON c.id = u.cooldown_id
INNER JOIN inventory i ON i.id = u.inventory_id
WHERE user_id = ?
Do you necessary need all columns?
WHERE user_id = ? will only work if user_id is an unique column, if not specify the table
i mean the user table only stores the user discord id and the foreign key relations, but yes i need all the other columns from alpaca / cooldown / inv ..
its unique
You may wanna use LEFT JOIN here
colors was empty xd
If alpaca, cooldown or inventory doesn't match your ID, the statement will still return the whole user (left) table
an user has always an entry in all other tables
pretty sure the other kind of network is much more important for college
my school wifi is like 750mbps
you're probably more likely to meet people in the industry you can impress or get to know going to college than not
i have same issue 
It’s not the size of your network but how you use it. 😊
my school wifi is 0.2 mbps lmfao
My school doesn’t even have wifi yet e
my school wifi is about 100 mbps
my school internet is 1gbps
750mbps is not even realistically attainable on a single connection
its great for handling tons of clients at once tho
no you download big things
i used all my schools bandwidth and got my laptop banned from the network
usenet has so much bandwidth
thats with 500+ devices on the student network
the school laptop network with 250+ devices is 1gbps+
@jolly notch are you free to help with some code issues i have
I found this great content to watch but sure I think I can hold off for now
How can I get the "Ban speedrunning" bit (Aka the Reason) from this output?
[0][1]

I swear SQL error messages are the most unhelpful shit ever
Just use phpmyadmin
problem solved
I shouldn't have to use an external tool for a database to tell me what the fuck is wrong with my query
you don't need to use php lmao
oof
maybe write your queries better
what you using for sql?
this tbh
I have datagrip I don't need shit like phpmyadmin
ah
just write your queries better then 
but I shouldn't need to open it either
true
oh xetera, do you pay for a custom theme plugin for jetbrains stuff
no I have my own theme
So true…
what does yours look like
mhm
ours looks similar
I like paying for things I use, but paying for a theme just doesn't sit well with me. Only takes an afternoon to come up with your own stuff anyways
true
It’s the error that’s slightly better than ‘syntax error near your mistake’
what does your vs code theme look like?
Error: you made a mistake
when you have to use binary search to find errors in your query
Upgrade your node version
Its at 16

And then comes the porting….😅

Wellll I had it at 16, then I changed my package.json and I messed it up
Still says the same thing tho
36 million documents to go
lmao
how much ram do you have
Fixed that error and now:
const prefixModel = require("../database/guildData/welcome");
const data = await prefixModel.findOne({
GuildID: message.guild.id,
});```
TypeError: prefixModel.findOne is not a function
mongo?
heres the thing, thats alot of extra effort for testing
Im also not sure if I have a server which can do much better outside of upping the swap limit
the bottlekneck is the NVME drives and swap limit being 4GB
any support on my question?
use a function that exists 
it does.
clearly not
which means either a) you're miss reading / reading old docs
or b)
you're shadowing your varibles meaning stuff is getting overriden
if its not a then its b

or c) your npm version is really outdated
Im using djs. 12.5
use djs 13


([])*
the real pros don't even need djs
If im not mistaken v12 wont even work soon
Yeah it's about to reach it's EOL
Just use the http api
I would not wish that upon my worst enemy
do you code in py 2 or something
how I remove my name from here? wordpress
was it dbm?
how?
look by settings users
With djs v13 this always happens to me:
in account settings?
update your nodejs
I just did 
^
Do node --v
Bruh what the fuck
You need node v16 or higher
^^^
xd
lol
here?
Yeah
Yeah it's node js 12
You don't have latest node installed
yeah if im right
npm install node?
tnku bro
not sure how to upgrade nodejs on replit, I don't use replit
Replit sometimes bruh
@feral nexus nice
Whats the command you would use?
i dont use jt
np
yep
he didn't even read my reply to his reply on my post
@earnest phoenix just get a cheap vps
vps and vm
these are the same?
no
whats the lowest ram a bot should have
whats the differnce then
in operation or the server for the bot
the total vps ram
looking for cheap vps
google it
locally?
ah
no cheap xd
but i dont pay for it
so me happy
xd
My dad got it for free from his work
Look for a cloud server if you wanna scale it later
You should always go for 1 GB minimum, if you are developing bots that are in many guilds or require other things to run then 3 GB minimum
VPS doesn’t make much sense
why
i meant i'm looking for the other person
Oh 
what is a vps if not a cloud server
Most providers don’t migrate VPS to other servers
At least most I know
wdym migrate to other servers
👁️ interesting
like for downtime?
👀
Wtf is not understandable by scaling a server up or down?
£1.27 a month
Hot but plox has better specs
good point
A cloud server isn't a magic bullet 
brb ordering a £0.41 a month vps
That host is probably running ddr2
you're system has to already be highly scalable in order for it to actually be able to scale seamlessly, at which point you can do that with or without cloud
you can gradually increase server specs to a limit
but that doesnt save you from the catch of actually having to worry about state management, redundancy and high availability
so over priced
"Unkown Ghz" is of a slight concern
If you need to worry about high availability and etc then use kubernetes
you buy a vps... and then click upgrade and it moves you to better specs
Looking for someone familiar with sharding….anyone ?
That is not how that works
It's much easier on k8s
Well most providers split cloud and VPS by their scalability, where cloud servers can be scaled up or down and VPS not, you have to rent a "bigger" one and migrate your shit yourself
when is v12 going to be outdated
"Oh hey man we need to scale this" -> "oh just put it in kubernetes magic"
April 2022
I don't think anything is easier on kubernetes
how do u know?
There is a lot more steps
Because I learnt the secret art of googling
like now it is unsupporter
i googled it some time ago the nthing was said
idk about you but all of the providers we've used offer full migrations if we wanted to upgrade
V12 is supported. There’s a migration guide telling you how to move to v13 😅
not that its a big issue without because replication™️
on digitalocean upgrading your droplet/vps is as easy as pressing a button
yes
But not for VPS products, but for cloud servers
mmm not every one of our VPS providers have offered it
Where does the second but come from lol
imean the discord. js v12
also rip disks again
cus i got already v16 from node
should i move from a vps to a cloud server for my bot which also runs an API
You won't get much support for v12
the difference seems made up like difference between scripting and programming languages. Just seems like different words for the same thing
Do you need to?
So I can't update a node version on replit?
no clue

I've never head someone use vps and cloud server in a non-interchangable way
you don't need to
Nah I don’t know any provider who doesn’t split up non-scalable VPS and scalable cloud servers
unless you're talking about bare metal where you rent the physical machine directly
what about https://jelastic.com/
DevOps Platform-as-a-Service (PaaS) for running microservice and legacy applications in public, private and multi-cloud using Java, PHP, Node.js, Ruby, Python, Go, Docker & Kubernetes. Automated scaling and clustering, zero code change deploy, intuitive UI and flexible pricing. Best paas solutions and paas service for our clients.
That’s called dedicated server
both contabo and netcup have upgraded our VPS' to bigger systems several times without any pain
bare metal is regularly referred to
digitalocean, scaleway, vultr, all seem to refer to vps and cloud whatever as the same thing
never heard anyone make up a distinction between them
usually because providers like to get funky with doing "virtual dedicated servers" and confuse people
throw in those cool buzzwords
lol contabo is cheap but actually doesn’t even offer you the service to install your own OS
Doesn’t count as serious provider for me
usually you can't downgrade infrastructure but you can easily upgrade
there is a difference between the dedicated and private in that wording
Netcup provides an automated feature to scale up/down your server?
I used vultr first. Cheap, but had issues with connectivity and uptime. Just went to gcp and it’s been great.
You can as long as you don’t change the drive size usually
we can just ask them to migrate us to a new vps with bigger specs
you very rarely need to dynamically scale up and down instantly like with ec2 systems
which is how people get caught in traps where their databases suddenly cost them tens of thousands in a few days because stuff got stressed and spawned nodes like nothing
Yeah they setup a new system and move your ship over, that’s not assigning different hardware specs to your initial system
and most people dont care about that as long as it gets done
just stick your app in fargate brolo no scaling problems
Switching to a different system or assigning different hardware specs for your VM on the same node, automated is a difference
instant magic scaling, absolutely no problems at all
Oh also cloud servers being calculated per hour if im not wrong
are you guys still on this discussion about hosting
Sharding discussion? 😊
Somehow yes and no
I've been watching from the sidelines
and not paying attention to any of it at the same time
see this is the issue with cloud, expensive af
looks cheap
3 db nodes and suddenly you're fecked

I would go 3x reliable sites servers for that
"scale on demand" @ $0.50 an hour per node + network usage + additional storage
Rent your own dedicated ones in different regions and cluster it yourself
yes
thats what we do
for this very reason
but i was just demonstrating the issue
Yeah but doesn’t mean all providers are that expensive
even more scary is i clicked "add node" and it instantly filled in all my billing info and set it to be one click away from charging
mmmm aws and GCP are around that pricing
especially for DB work
OVH isn’t, Hetzner isn’t, Ionos isn’t and a few US ones aren’t, too
oh thats bas
ionos kinda breaks the law
so yeah
at $0.09 per GB network egress from AWS
OVH is bad, hetzner is expensive af for co location
never use ionos
15 nodes 
Sometimes you have better hardware
and it can be cheaper for a longer period of time
Hmm yeah ok good argument
I have yet to see a production ready rgb based rack server
You have to choose a cheap one then but suffer the consequences of a bad network or redundancy
true
Alright need to do some work unfortunately
Not sure how many different types of backups is good but I think 5 is good
why do u want every 24 hours a backup
just use a git repo to throw your shit in 😂
It's a database node
because this is a production world 
losing data = higher costs
u dont develop on a production server
Some of my client's client's discord servers make 30k a month
I do and that's why everyone hates me
pay ~$480k a year for globally distributed managed system vs paying many senior devs to manage nodes all over the world and maintain them
do i not?
i just have a dev bot
to test everything is working. just development
so u have development and the master divorced
I feel like you missed the point slightly
why
he did
I wasn't referring to the fact that we push changes to production, we're not Top.gg
ouch good burn
ty
I was referring to the fact that this is for production systems where millions of changes are made daily and backups are an absolute must
being able to select snapshots of db state from a specific day is an incredibly useful tool
Anything besides porn? 😅
🤣 they are like cook groups and that, membership for the end end user is $5 a month or something
ok
i mean what
bruh
Lol
too nsfw for here
FUCK we're at 11 million documents and the loader program has frozen
please no
ouch
i never had the reason to ever make a search engine
I would probably have to on my knowledgebase product release in 2024
we're okay the system was just computing changes
oh good good
I really need to remove this memmap setup though
how's the cpu doing so far
for big indexes it just sucksss
cpu is fine
this is not a CPU intensive operation compared to the IO time
like indexing large amounts of docs are by far IO intensive more than they're CPU bound
oh
there's only so fast the OS can page out data to and from memory to disk even with NVMes
which I partly blame on memmap
ouch
because it does alot of bottling on large writes
ah
Get a second NVMe and put it in raid 0 :]
speeeeeed
oh i do
^ was about to suggest that
however this comes around to the whole issue with memmap and buffer caches only going so fast to a point
I think doing word frequency analysis on things like author names was a bad idea
many many unique words making for a very big corpus
My bot isn't pinging here or roles, the bot has the correct perms in the server, is there something im missing? (Discord.js v13)
Server and channel perms both….overrides can bite ya
Yeah it has server and channel perms, still doesn’t ping someone though
For both roles and here it doesn’t give a ping, but when hosted on my pc it does. Could it be something to fix in the portal?
Did you globally disable mentions in your client options?
Do you have the bot on multiple servers? If so, does it ping on any?
It doesn't ping on any servers
Yeah I dont know, i cant figure out where i could've disabled them if I did at all
Intents or no?
It has server members and presence intents.
Try to use the message options, I think it’s called allowedMentions
Yeah that’s what I’m using
I’m doing
allowedMentions: {
parse: [“everyone”, “roles”]
}
Not sure if that’s wrong or not
Looks about right
Maybe it’s where I’m doing it? I’ll re check when I’m back at my computer
Well no it’s working on the computer host
Do you know if somebody else got pinged?
Did you may disable getting pinged b here or everyone in your server?
Just asked someone else and they said it didn't ping them. The picture is the whole reply that should be sent, anything wrong there?
I see where you are getting your support from 🤔
Do you use the same bot token for your local instance?
It’s similar code used on both bots, but two different application/bots.
So it has to do with permissions
Check global AND channels permission overwrites
You must missed something
The bot has admin and access to ping in channels and in the role
Did you try to kick the bot off your test guild and reinvite it with the required permissions?
No I’ll try it soon
Back to my question earlier: How can I update my node.js on replit? Just incase someone new might know how
Bit late and sorry for the ping but I re-added it and it didn't help
I remember Tim mentioned a method using nvm - guess it means node version manager
Search this channel for nvm
Doesn’t work well for me on mobile
Hmm well I’m clueless then 
^^
Do discord bots need some sort of extra thing before being allowed to do certain things in a server that requires 2FA?
The owner of the bot needs to have 2FA enabled so the bot can execute 2FA-tasks (like banning I think? Not sure what's a 2FA task anymore)
I actually found something to read tho:
https://github.com/discord/discord-api-docs/issues/69
I actually read the same thing right after sending that message, but i already have 2FA but my bot still seems to have issues
Then you have to log error messages and post them here
its this issue
No error logs, no nothing. I do believe though that its the server because the same exact bot, the same exact code, show different outputs in two different servers. The bot has all perms in the one server but its not able to ping so I don't know whats going on
Toggle = True
@client.command()
async def off(ctx):
global Toggle
# Toggles the variable.
Toggle = False
Imode = False
@client.command()
async def imode(ctx):
global Imode
global Toggle
Imode = True
Toggle = False
Toggle = True
@client.command()
async def off(ctx):
global Toggle
Toggle = False
@client.event
async def on_messages(message):
if Toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
is this correct
Anyone here can help me with my welcome command (aoi.js)
oh my bad
if Toggle == True:
Toggle = True
@client.command()
async def off(ctx):
global Toggle
Toggle = False
@client.event
async def on_messages(message):
if Toggle == True:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
@earnest phoenix
see
still not working
no errors
but ping is not coming
on_message, not on_messages
Also. You are not processing commands in your on_message. The off command will not work
still not working bro
Show your code now
Toggle = True
@client.command()
async def off(ctx):
global Toggle
Toggle = False
@client.event
async def on_messages(message):
if Toggle == True:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
see
put global Toggle below on_message, also it's on_message no "s"
it shows a error like green undreline
if i type
on_messages
ohk
done
Toggle = True
@client.command()
async def off(ctx):
global Toggle
Toggle = False
@client.event
async def on_message(message):
global Toggle
if Toggle == True:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
@earnest phoenix
correct
Imagine
my bad then
@earnest phoenix
?
@client.command()
async def on(ctx):
global Toggle
Toggle = True
@client.event
async def on_message(message):
global Toggle
if Toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
@earnest phoenix
correct
try it
not working
Your commands won't work unless you process commands. See more in discord.py commands extension documentation
Hi, anyone knows when exactly discord.js V12 is going to be outdated?
u dont need to do that in the new version of d.py
whats the error
Huh
If its going to be outdated soon then i need to hurry
not coming
well what exactly are u trying to do
I used it too and that would be the exact opposite of the design d.py followed before
What says that it works without processing commands manually? Is there anything within the docs or the source code that can confirm that?
If yes, could you show me?
theres nothing in the docs anymore idek if they still even update it, i currently am using this without the process_commands() so i know it works without it
Here are my files. When I try to use select menu I keep getting an error, which I've linked to aswell
can someone please help me figure out the error and how to fix it? I refereed to the docs and did exactly as they had mentioned but continued to get the error
deploy-commands.js
https://sourceb.in/ZqtlCeIvxy
select.js
https://sourceb.in/baWnKmkSwo
ERROR
https://sourceb.in/5oP2Dyw5Za
how to check if channel is in a category by ID
d.py or d.js?
djs
im gonna need to look up for that
hold on
Are you sure it wasn't a listener
it is a listener
try this mate channel.parent;
channel is the channel obj
keep that in mind before doing that
That's a whole different case
you should be good to go
oh is it
So shiv got a point there, you should process the commands
yep parentID exists, thanks
ywyw
interesting
event replaces the default on_message method, listener appends an event handler without replacing the default one
why do have two global variables Toggle, use the one you already declared before
I see
channel.type
@client.command()
async def off(ctx):
global Toggle
Toggle = False
@client.command()
async def on(ctx):
global Toggle
Toggle = True
@client.event
async def on_message(message):
global Toggle
if Toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
why ping is not coming
nah that only checks channel type, i needed category ID

@earnest phoenix
I'd recommend you using the client.command for your commands and not the on_message event
id understand
very well if you'd still like to procced with the on_message event, you're slightly gonna need to change your code
oh
wht change should i do?
toggle=False
@client.command()
async def off(ctx):
toggle=False
@client.command()
async def on(ctx):
toggle=True
@client.event
async def on_message(message):
await client.process_commands(message)
if toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
here try this code
here all of your commands will be disabled by default unless you execute the on command in your bot
not working
errors?
toggle=False
@client.command()
async def off(ctx):
toggle=False
@client.command()
async def on(ctx):
toggle=True
@client.event
async def on_message(message):
if toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
no errors
do you have your client defined?
here i edited this code a bit
try it now
client = commands.Bot(command_prefix=',')
client._skip_check = lambda x, y: False
You're just modifying the local variable, it won't change the toggle state whatsoever
what is ._skip_check here
where do u use it
Looks irrelevant
idont use it
well why do u have it then
i think it was a another bot called example my friend give it that time it was having that ig
he stoped py
did u try using this?
yes
^
What's not working doe, is it sending Function disabled?
Gotta be more specific
*^
not working
*^
toggle=False
@client.command()
async def off(ctx):
toggle=False
@client.command()
async def on(ctx):
toggle=True
@client.event
async def on_message(message):
await client.process_commands(message)
if toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
does it even say anything
nothing
cause im pretty sure theres no problem here
@earnest phoenix bro under toggle
it
showing
gree
underline
[pyflakes] local variable 'toggle' is assigned to but never used
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
@earnest phoenix
?
yeah hi
thats not an error
but I wonder why it shows that
try doing what he said
my bad didnt read it carefully
I thought I didn't repeat it enough
Just mark toggle as global and the lint warning will go away
toggle=False
@client.command()
async def off(ctx):
global toggle
toggle=False
@client.command()
async def on(ctx):
global toggle
toggle=True
@client.event
async def on_message(message):
await client.process_commands(message)
global toggle
if toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
The last global is kinda redundant, because you're not modifying toggle, but not a big of a deal
So what you expected and what you got?
no console error?
Do you by any chance have an error handler and not re-raising unhandled errors?
he must have pass
God knows
Even God sometimes doesn't, let's be fair

God can't save you from your shit code
why isnt it waiting 4 seconds, deletes it after 1 second
Message.delete() no longer accepts any parameters
interval it is
You have to create a Timeout yourself
works now 


client.user.setActivity({ buttons : [{label : "Test", url : "https://dsc.gg/haywire"}]})
is it correct?
test it 
Bots cannot set rich presences
they can...
buttons are only available through RPC calls
^
No. They cannot. I can guarantee you
dude...
you cant set it unless its user
Ask anyone else to give you a working example and they cannot because you can't

okay
so...
client.user.setPresence({ buttons : [{label : "Test", url : "https://dsc.gg/haywire"}]})
why is it not working...and not showing any errors too
because it cant
how do I get to know what went wrong
Are you trying to do this on a bot account?
nope on a testing id
What?
selfbot i guess
on my friend's acc 😂

Rich Presence can only be set by an RPC library and you should read the docs for whichever lib you decide to use. Discord.js offers one, but it's not through the main Discord.js library
I am able to set presence.....but I'm having problem with buttons
and idk what's wrong
coz it is not showing any err
Regular presences work just fine through the gateway, but RICH presences can only be set through an RPC lib.
the joy of making it ur way is different
ik
Buttons on your presence are through rich presences
waao
what all libs provide buttons?
ik only one
i don't even know how to code in c#
I don't mess with RPC. Like I mentioned, Discord.js offers an rpc lib, but it's not through the main Discord.js library
then this will work, https://github.com/BlobbyDev/Discord-Rich-Presence/blob/main/index.js
the rpc lib in documentation is useless
Well, then the best I can tell you is you're shit out of luck
ohh k...thanks man
i agree
thanks for ur time

waao
Is there a RPC library for Rust?
idk
P.S you can just carry on if you don't know lol, save yourself the effort of pinging me and telling me that you don't know
apparently, but seems outdated
Here's hoping it will work lol
can anyone help me make a name and pfp for my bot
Hey @quartz kindle I'm doing benchmarks for one of my libs comparing it to others and using the benchmark lib vs doing my own with for loops:
for (let i=0; i < 1000; i++) {
...
}
shows very different results. Which would you say is more accurate and how do you benchmark your libs
I'd probably try to write "real world tests" instead of synthetic tests unless you're just trying to get maximum throughput
other libraries might have some overhead
I don't think that's the case with the libs I'm testing though, they're template engine libs, I think synthetic tests for those are just as good
Then I suppose that's fine. You'd perhaps have to look at how the benchmarking libs operate since it really depends what you're trying to do. for let i = n; i< x; i++ and accessing the index of an Object or something will be faster than say for let in or for let of since internally, it would have to get all of the keys for the Object, allocating those keys to some sort of Array or FastMap or something related and then access the Object index
Micro optimizations can be made to reduce overhead and maximize synthetic test results
I see, thanks. I'm really curious how benchmark gets the ops/sec values, as you can see:
Compilation: Finch x 153,305 ops/sec ±2.67% (82 runs sampled)
Compilation: Handlebars x 105,612 ops/sec ±3.30% (86 runs sampled)
Compilation: Ejs x 274,618 ops/sec ±2.05% (86 runs sampled)
Makes it look like Ejs is a lot faster than Finch, but looking at the milliseconds from the benchmarking without benchmark shows otherwise:
Handlebars took: 189.3686999976635MS
Finch took: 62.197300016880035MS
Ejs took: 50.65160000324249MS
Makes it look like operations per second isn't an important metric
Probably just some simple Math from start time to end time and how many operations were completed in that time frame
Unless it wants to get fine measurements and sets up metrics per duration the test is running then get an avg
seems like benchmark took samples which means running the test multiple times to eliminate discrepancies as much as possible such as factors out of your control like cpu load or such and averages from those samples
multithreaded work loads may suffer from that the most when performing synthetic tests
ejs is cheating
what?
aren't you supposed to make a faulty calculator lol?
Someone sent me a vbs code with this.
Dim WShell
Set WShell = CreateObject("WScript.Shell")
WShell.Run "Notepad.exe", 0
Set WShell = Nothing
do
CreateObject("WScript.Shell").Run("https://www.youtube.com/watch?v=fn1BKvIFcbE")
CreateObject("WScript.Shell").Run("https://www.youtube.com/watch?v=cK7I0Pfm6x8")
CreateObject("WScript.Shell").Run("https://www.youtube.com/watch?v=fn1BKvIFcbE")
CreateObject("WScript.Shell").Run("https://www.youtube.com/watch?v=cK7I0Pfm6x8")
CreateObject("WScript.Shell").Run("https://www.youtube.com/watch?v=fn1BKvIFcbE")
CreateObject("WScript.Shell").Run("https://www.youtube.com/watch?v=cK7I0Pfm6x8")
CreateObject("WScript.Shell").Run"notepad"
CreateObject("WScript.Shell").Run"chrome"
CreateObject("WScript.Shell").Run"narrator.exe"
CreateObject("WScript.Shell").Run"magnify.exe"
CreateObject("WScript.Shell").Run"bsod.hta"
CreateObject("WScript.Shell").Run"naber.vbs"
loop
What the f.ck does it do since he's mad af.
anyone can help me in module error ?
i downloaded this module by pip install youtube_dl than also i m getting error
I would guess not running it.
anyone help me
The guy is legit so mad.. 😂
He wants the token of my bot or else he's loggin in using my token even though I have no relation with this guy or clicked a scam link.
It's a command line program
You're not supposed to import it
They are running the script in a loop.
Oh, I see.
how?
than i have to remove that ?
Opening the narrator,magnifer and chrome and the yt videoes in loop.
Probably a Script to troll on someone
function itp(data_, arr) {
Object.keys(data_).forEach((key) => {
arr[key] = data_[key];
});
}
why is it not setting it
nevermind it works perfectly fine
i just didnt pass arr

cant do shit, it just spam opens youtube and programs
Anyone here know about bot sharding?
lots of people

Lol
Hi
I try to detect vote
I use this code
from discord.commands import slash_command, Option, SlashCommandGroup
from googletrans import Translator
from discord.ext import commands
import discord
import topgg
class TOPGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)
@commands.Cog.listener()
async def on_dbl_vote(data):
"""An event that is called whenever someone votes for the bot on Top.gg."""
if data["type"] == "test":
# this is roughly equivalent to
# `return await on_dbl_test(data)` in this case
print("ok")
print(f"Received a vote:\n{data}")
@commands.Cog.listener()
async def on_dbl_test(data):
"""An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
print(f"Received a test vote:\n{data}")
def setup(bot):
bot.add_cog(TOPGG(bot))
```
but
in weebhooks ul
What I put ?
toggle=False
@client.command()
async def off(ctx):
global toggle
toggle=False
@client.command()
async def on(ctx):
global toggle
toggle=True
@client.event
async def on_message(message):
await client.process_commands(message)
global toggle
if toggle:
if message.content == "pong":
await message.channel.send('ping')
else:
await message.channel.send("Function disabled")
anyone
could help
still id understand
Neither do I
Cool. I posted yesterday but didn’t get any response, so was polling again.
Looking for help with this 👆🏻
well first off you dont use broadcastEval to fetch a guild
guilds.fetch can be done from any shard, so you dont need broadcastEval at all
broadcastEval is used to run code in other shards and access data from other shards, typically you use it to access cached objects
fetch functions are not shard bound because they send a request to the discord api
if you want to get data from a cached guild that is in another shard, you do it like this
So I thought that my guild desired might not be in my shard thus it required a cross shard query. At least that’s how I understood the concept
broadcastEval((client, id) => {
if(client.guilds.cache.has(id)) {
const guild = client.guilds.cache.get(id);
return { name: guild.name, memberCount: guild.memberCount }
}
}, { context: guildID })
because the function will be evaled in all shards, you need to check if the guild exists in the current shard first
this will return an array of undefineds along with one valid response
so you can do filter(Boolean) on the result, if you dont need to know which shard id it was from
So ultimately what i was trying to do was to get the server object, so then I could get the users because I need the nicknames. In your example I still get the array results, with the objects stripped.
I understand the Boolean check. And I have a server result now (guild)
But for step two I’m at a loss as to how to access the users when the server isn’t an object.
Do I have to construct one?
data has to be serialized in order to be transmitted
so you need to simplify the data and/or construct a simpler object
In that case, guild is an object and not an array of json’ed data?
you have to construct an object containing only the exact data you need and dump all the rest
I understand that for the return.
In between your const guild and return lines…I want to do a members.fetch call. Will this work?
yes it will
Hmm. Ok I tried this and it seemed to give me a non-guild object. I’ll try some more. Thanks so much!
fetch the members then construct a simple object or array of members
Right. My ending result is super simple. Just need to get there. 😅
ie: fetchedMembers.map(member => ({ name: member.displayName }))
One other question…I was trying to setup a test environment and put one server in a shard to verify the IPC. Is there a way to force this?
I really don’t want to test in prod… 😅
Hello how remove the subdomain www please ?
from a string?
perfect, got it....thanks again!
yes there is a way
but its not supported by the discord.js sharding manager
if you have your own ipc solution, you can do it
hmm...ok, so not from the discord.js env....I'd have to build something else to replace it
actually it might be
seems odd they wouldn't have this capability....I really don't want to setup a thousand servers just for a testing env.
let me check
thx much
i didn't see anything in the docs that allowed affinity, or max # per shard, etc.
Hey guys can i ask something?
it relies on tricking discord so most people dont even know its possible
Yes 👀
uhmm if bot needs my prefix how do i know my prefix?
Of your bot or on a different one?
You can add a message, where the prefix is mentioned, when you mention the bot.
I mean, i don't have any prefix, how should i make my own prefix on my bot?
what language?
Ah.
Which language?
😅
huh what do you guys mean?
When the message does not contains your prefix then return...
Coding language
const totalShards = 2147483648;
const guilds = ["534756934793846", "398457938479834", "345763476396346"]
const shardList = guilds.map(guild => Discord.ShardClientUtil.ShardIdForGuildId(guild, totalShards));
const manager = new Discord.ShardingManager(file, { totalShards, shardList });
manager.spawn();
ok thanks! does the total shards number matter? i.e. is that a magic #?
Yes
its the max 32 bit signed integer, from what i rememebr, any number bigger than that will cause an error in the discord api
its not collision-proof, in rare cases you will get an extra random guild in some shard
where can i start coding my prefix for my bot?
but thats the closest you can get to a dedicated shard for a single guild
ok thanks!
Start all Shards and get ratelimited 🔥
🙈
Wasn't the threshold 1000?
oh yeah, 2000 is for big bots
BBS has more than 1000 iirc
@bright talon btw, why do you need one guild in one shard?
for testing, i do it too
You test on your prod bot?
because I want to test my sharding code, without having to push it to prod and find my problesm
yeah, i just set it to only have my guild on the shard
my prod code has an env variable that if set only connects 1 shard with only my guild on it
How to make own prefix on my bot?
There will not be a difference when you use a testing bot
When you anwser our questions, then we could help you out ..
well, call me paranoid....but if i have only 1 shard....I'm likely to find a bug when I have 2 shards in prod. I'm just paranoid.
commands with prefixes will no longer work starting from april 2022
you still wanna do them anyway?
Genious, best anwser lol
i don't have any prefix yet on my bot
So how your bot work?
Coding i think?
wat
😀
how about you show your code?
i would suggest googling bots....you'll find examples with source code that can get you started.
oh okay sure
Thank you
it's not a good answer, but if you haven't started coding yet....then that's where I'd start.
yes you are right, i'm starting coding
W3schools is a good website for learning coding
Oh thank you so much
Also discord.js.org
sure, thank you guys
🤍
Hey guys, would you mind if i friend request? @earnest phoenix @tired panther
Sorry for pingg
Np
I do not accept friend requests :^)
Ohh okay
Np send
Thank you >.<
not from weebs at least
Lol
Just have 16 Friends
I have 25 friends I have never seen in real life
f r i e n d
Noice
Can i host my bot on rdp ?
can someone please do me a favour
visit https://dpp.brainbox.cc/ and tell me what you see there
perfect, thanks
when i tried to shut down that site 1.5 months ago, the browser ignored everything i did, i think it was a HSTS issue
this means i can now actually put my 301 redirects on it 😄
Wt who changed my name?
a mod, probably
Why ?
because it starts with a unicode or other character designed to put it at the top of the nick list
that isnt allowed here
how do I create an Embed with buttons that Change to a Different embed when clicked?
how do i make it so you can select a, and then select b after on the same message?
I'm using Discord.py (cringe i know)
and the package for components is discord-components
I need help
just ask ^^
add components to the message, an actionrow to the components, a button to the action row
when the button is clicked, you receive an interactionCreate event, on this event you check if the interaction is a button, and you check the message id of the button, and you send an interaction response of type update with a new message content
send an interaction response of type update with the same components
Any help?
what command did you run?
npm install
make sure your node gyp is up to date since it seems like that's what failed
just npm install?
How can i check it and update it ?
then show your package.json
ok
listen to tim first and then me :)
Before it i tried some commands to fix it ._.
like what
I can't remember it's from stack overflow XD
@quartz kindle
{
"name": "wolfy-bot",
"version": "1.0.0",
"main": "index.js",
"engines": { "node": "16.x" },
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "WOLF#1045",
"license": "ISC",
"description": "",
"dependencies": {
"@discordjs/builders": "^0.6.0",
"@discordjs/opus": "^0.4.0",
"@discordjs/rest": "^0.1.0-canary.0",
"@discordjs/voice": "^0.6.0",
"@top-gg/sdk": "^3.1.2",
"alexa-bot-api": "^0.2.1",
"alexa-bot-api-v3": "^3.0.7",
"ascii-table": "0.0.9",
"axios": "^0.21.1",
"canvacord": "^5.2.3",
"canvas": "^2.8.0",
"chatcord": "0.0.5",
"common-tags": "^1.8.0",
"covidapi": "^0.5.0",
"decode": "^0.3.0",
"discord-api-types": "^0.22.0",
"discord-canvas": "^1.4.1",
"discord-interface": "^2.0.6",
"discord-xp": "^1.1.16",
"discord.js": "^13.1.0",
"discord.js-commando": "^0.12.2",
"discord.js-slash-command": "^1.2.1",
"djs-buttons-pagination": "^1.6.2",
"djs-games": "^1.4.6",
"dsc-slash": "^2.0.2",
"event-target-shim": "^6.0.2",
"express": "^4.17.1",
"ffmpeg-static": "^4.2.7",
"fs-extra": "^10.0.0",
"gcommands": "^5.2.5",
"glob": "^7.1.7",
"got": "^11.8.1",
"html2markdown": "^1.1.0",
"humanize-duration": "^3.27.0",
"jsdom": "^16.4.0",
"lodash": "^4.17.21",
"lyrics-finder": "^21.7.0",
"mal-scraper": "^2.11.3",
"mathjs": "^9.2.0",
"mcapi": "^1.0.1",
"moment": "^2.29.1",
"mongoose": "^5.13.7",
"ms": "^2.1.3",
"node": "^16.6.1",
"node-superfetch": "^0.2.3",
"nuggies": "^1.0.9",
"parse-ms": "^2.1.0",
"simple-fortnite-api": "^0.1.9",
"snekfetch": "^4.0.4",
"sourcebin": "^4.2.5",
"topgg-autoposter": "^2.0.0",
"twitter-api.js": "0.0.12",
"txtgen": "^2.2.8",
"util": "^0.12.4",
"utils-discord": "^1.2.0",
"uuid": "^8.3.2",
"weather-js": "^2.0.0",
"ytdl-core": "^4.8.3"
}
}
ok
if(arrays.message.trigger[i].includes(";")){
Cannot read property 'includes' of undefined
I can't work out the issue with this line...
trigger[i] doesnt exist
the thing is the code works, it does the stuff within the if function, but after doing it it sends that message
There is another way i am lazy to do all of this?
that confuses me even more
cause console logging that trigger[i] gives the correct answer
delete the entire dependencies block and delete your node_modules folder, and your package-lock.json
ok
so how would i get it to exist?
i dont know what your code looks like, but assuming trigger is an array that you are looping over with a for(let i...)
then one of the items in the array is either undefined, or you are going too far with i
so it will work for most items until it reaches the one that doesnt exist
if(arrays.message.trigger[i].includes(";")){
console.log(arrays.message.trigger[i])
}
lemme try this rq
that will error anyway
lemme double check the array
"trigger": [
"fuck;fuk;fuc;fck",
"?;??;???;????;?????",
"hello;hi;ello;sup",
"cotton;melanie",
"im bored;i'm bored"
],
anything wrong here?
for(let i=0;i<=arrays.message.trigger.length;i++){
console.log[arrays.message.trigger[i])
});
gonna run this rq
you didnt delete your node_modules folder
Deleted it
thats the issue
wait
npm WARN reify so that the damage can be corrected, or perform
npm WARN reify a fresh install with no lockfile if the problem persists.
npm WARN reify invalid or damaged lockfile detected
npm WARN reify please re-try this operation once it completes
npm WARN reify so that the damage can be corrected, or perform
npm WARN reify a fresh install with no lockfile if the problem persists.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated gcommands@5.2.6: No loger supported
npm ERR! process terminated
npm ERR! signal SIGINT
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\WolfWolfy\AppData\Local\npm-cache_logs\2021-11-01T18_31_28_720Z-debug.log
V8’s Math.random implementation now uses an algorithm called xorshift128+, improving the randomness compared to the old MWC1616 implementation.




