#development
1 messages · Page 88 of 1
Doing something wrong then
obviously, do you want to know the details?
I tried something like this but it doesn't work
const generateString = (x) => {
let string = "";
while (string.length < x) {
let num = list[Math.floor(Math.random() * list.length)];
string += num;
if (string.length === x) return string;
else if (string.length > x) {
string = string.substring(0, string.length - (num.length))
} else string += " ";
}
}
Nvm got it to workµ
Friends server + music/minigame bot is a thing
Not all servers want to be a big community, some just want to chill with friends
Yea but 1 server doesn't effect a verification.
There're also testing servers to check if a bot is dangerous or not before adding to a big server
Bots aren't dangerous, permissions are.
One could say 75 wouldn't also, the important part is that discord team perceives your growth as genuine
Not exactly
You choose the permissions you give a bot when you invite it.
A bot can't raid a server if it doesn't have permissions.
A bot with just send messages permission could wreck havoc in a server
Or mass dm everyone
Raid isn't the only dangerous thing
it can severely impact a small community
Yea which is why people go with verified bots. Anyways, my point being back on subject is that a bot requesting verification would have no reason to be in 20+ servers of less than 10 people. That itself just yells botting.
honestly, most my servers have less than 30 people 👀
and have bots ranging from small and unverified to huge
having a limit of 10 severely limits a bots potential growth imo
For example, some bots we've had in this community only got invited here due to being in our staffs small servers.
If a small bot gets invited to a large community its probably because some staff member had it in a smaller community first.
Honestly, my bot is in 5 servers currently and has a member count of 1700. It's all just about the contacts.
I was going to make a point, but I don't know where I'm going with this lol
Congratulations
👀 maybe topgg has changed my perspective a bit, but it sounds like your bot targets small communities right now.
Which it sounds silly to cut off a portion of your target audience.
I just don't understand why people set some limit of users on the server so that the bot can be added there
It's you as the developer who is trying to get users and the user will find another bot if he can't add yours
A limit of 1 user okay, maybe?
But I setup bots when creating a server.
Like, me a dev creating a support server before that is sent I'll make sure to have all the important bots first.
Yes, but I mainly mean cases that require, for example, 10 users or 50 in some cases. This is pretty stupid to me
I don't set a limit on user count. With my bot being multi purpose, it usually only gets added to bigger servers.
Maybe so, but I've always wondered what such people think when they require a certain number of users on the server
Because apart from the desire to have the right number of users on average per server and limitations, e.g. database, I see no point in doing something like that
I've only ever encountered one bot with a user count requirement
don't know where you're finding them
ive encountered some bot owner that does that, they said its to prevent sus and inorganic growth
idk if thats true or not
one of my bots got fucked because of that
got denied verification for suspicious activity or whatever
L kid
elk kid
inorganic growth is based on how many unique server owners your bot has not member counts
and suspicious growth is based on how fast your bot grew
well thats funny because i added my bot to like 10 testing servers and its still verified xf
🤷
bots dont get unverified for inorganic growth after it gets verified already
its only important before verification
I've encountered several ones during bot reviewing
yea but i added mine before verification
idk how that works
probably when discord barely cared about that yet
or their verification team is overloaded again
yeah
hey anyone use python here?
def main() -> str:
print(type("backend service"), "here")
return "Backend service"```
This keeps returning a class type 'byte' in the @after_request decorator
but the type being printed here is str
any idea whats happening? how do i fix this
Getting this for MongoDB with Next.js
It is from an import
this is the part of the code where the function is called
I have this really weird issue. I just made a vite react site and am deploying it to netlify. I noticed that it was a blank page. So I built it on my pc and previewed it and it was also blank! Even though when I run npm run dev it shows the page like it should, but when building it shows a blank page with nothing. When inspecting the page the root element is empty and there are 2 errors in the console TypeError: Go is not a function and TypeError: Go is not a function
Verifications are quite slow. I don't see enough activity for it to take that long. Please check the requests.
I am trying to generate content for your page but if the process is this slow, unfortunately if this continues we will have to move with competitors.
it is because there are hundreds of bots in queue
and only so many people to review them
today along there are at least 50 new
(looking at logs)
why won't they just get more reviewers
they just got more
also because it is 18+ for reviewers
and most adults aren't on discord
ask for support or artificial intelligence to handle this. We are already in 2023, are we going to depend on 3 people verifying?
they already just brought some more reviewers on in the last week
they are working on it, its clear that they are
Thank you, see you soon I hope this lack improves.
^^^
How would you verify bots, automatically, especially interactions which only clients can use?
^^^
was gonna reply with that
you can't use AI to review bots, it would also be selfbotting
you ask bots to whitelist your bot
oh interactions
yeah good luck
pray to discord gods
bro has a god complex, this process is run by volunteers
It’s not fair to expect them to review your bot or you’re going to have to “go to other competitors”
You’re in line just like everyone else
Karen spotted
contributing with a bit of reality.
iframe
The possibilities are endless my friend. The last few days I have seen impossible things in discord with AI.
While the first part might be true, the terms of service will block you from doing what u want.
this
AI is useful, but not good in decision-making as a human with common sense
take that twitch AI bot for example, that anime girl called Neuro AI
got banned for speaking about a certain topic referring to past history
And I can heavily tell you, AI will not be able to review bots
It probably won't make final approval, but you will have a large percentage of the work done for your 3 reviewers.
Then have a site bloated with bots that barely:
- function
- follow our rules
- fail to get stopped during review as it didnt pass common sense related things

AI is not able to interpret common sense
It knows facts, it tries to apply these facts to prompts, that fails miserably if it uses the wrong facts
and you end up with a bot that gets approved, even though it shouldn't be
why am I even here talking about it lol
until they manage to give AI conscience most HR jobs are pretty safe
also most bots are using slash
you can't just make an http request to execute a slash command
thats just the technical limitations on AI
on the "interface" its talking through
unless you let it view a display, control a mouse, control a keyboard
then we're back at ethics, understanding and tos
AI (or general automation) would more likely be useful as a means of filtering bad bots
So verification is faster
but that may just result in more bots getting submitted
pen drop
also
efficiently < accuracy
just to put that in here too
^^^
I got a question about the HTML video player.
I have a simple webserver and it serves a mkv file.
I have enabled "Experimental Web Platform features", so that I can change the language of my vid.
When I skip to 1 hour it loads the whole movie (So it loads the first 500mb. How to stop that. I does not want to load the whole vid when I skip part of the video.
Someone any idea?
(I do not want to change any movie file to another type)
the default html player is very crude
True, so not possible with the default player one?
don't think so, it works by reading the file, when u "skip" ur not really skipping, just telling the player to load to where u placed the seeker
players like youtube's work by loading only around the seeker
Thank you
the typical solution is to use a library such as HLS.js or DASH
and convert your videos to a fragmented format like m3u8
thats what streaming services use
or you can do it yourself using some special browser APIs like MediaSource extensions and SourceBuffers
I do not want to convert 400 movies.
But thanks for the help
the way it usually works is that seeking on the video would send a request with a range header, and the server should respond with the data for said range only
however not all video formats support that without breaking the video without having to create fragments or breakpoints beforehand
and the html5 video player does not load video chunks by default, hence the need for advanced control with MediaSource extensions
another thing you can look into is the webtorrent protocol, which does support streaming many video formats over torrent
any one used https://github.com/Platane/snk or https://github.com/yoshi389111/github-profile-3d-contrib before? I need help with these
https://top.gg/api/bots/stats broken?
How can i fetch a url in html and displayed in a div?
pwetty sure you gotta use JS and some DOM method sounds about right
iframe is the element you're looking for
nah iframe
I think he means like fetching stats from an api and displaying them
Oh I see
there is XMLHttpRequest in JS you can use 😏
element.innerHTML = data
i recommend using axios to fetch an api
Why recommend Axios over Undici or Node-Fetch?
cause axios isnt bad
isnt fetch built in
and its easier to use for someone thats not experienced like this guy
Thank you very much for this suggestion
then why recommend axios 
I don't get it, Axios is literal bloat and doesn't comply with the Fetch API standards well
fetch api is simple
wdym
Yeah
well if the guy knew how the fetch an api, he wouldn't ask
maybe he knows but doesnt know how to display it?
axios shid
fetch best
axios is an horribly bloated lib
node http best lib
For neovim users, is it normal for nvim to not take up the entire terminal screen (i.e. the borders)
Can you show an screenshot of that behavior?
Terminals usually have some padding no?
maybe
Probably just padding
That's normal
ah
any one used https://github.com/Platane/snk or https://github.com/yoshi389111/github-profile-3d-contrib before?
It's better to just ask your question rather than asking if someone has used those
Well I want to use the snake one in my github profile
I follow the guide
I have a respotory with my name created a readme.md file put that 5 line in .md and also in actions created a workflow and paste the snipet in guide but I dont know why when I run the actions I got an err
That means that the github-actions[bot] user which performs the actions in your GitHub workflows doesn't have the permission to push to that repository of yours, you need to provide a GitHub token for it to be able to push those changes
So last line of this code
But how can I put my github token??
I cant put it just there
I have to use env variables
i love it when node.js just randomly stops for no reason
There must be a reason
If you run it on a vps and want the bot to run 24/7, you must probably use a screen
errors were swallowed/hidden and the socket connection disconnected, so node exited because it had nothing else to do
That means there's nothing else for Node.js to do, the event loop is no longer alive as there's nothing to do, it can be due to faulty code of yours or you using a bugged version of a library or something like that
ill look into that, ty
been using a screen as demonstrated in the screenshot, it just stopped
I do not understand a thing anymore about dns.
Why does every dns provider see my website, except google?
https://dnschecker.org/#A/videosnl.ga
Anyone an idea?
dns propagation takes time
different resolvers have different cache timings
a dns entry is only refreshed when the cache expires
But I cant connect to my website through google dns, but I can through cloudflare. Even when waiting 5 min for google dns, it does not work
https://dns.google/query?name=videosnl.ga&rr_type=A&ecs= Doesnt do things either
I am using cloudflare dns, but I can not ask every user on the internet to use a specific dns
when did you update the domain's dns?
A couple of hours ago, but only changed the AAAA record
wait until tomorrow
Ok
ah, I though it was server -> user the issue, not user -> server
that's weird then
hello
?
how are you ?
How would I be able to access the "quote" property? I can't to do response.1.quote so I am kinda stuck. Ping in replies.
have you tried response[0].quote
oh yeah thank you I forgot about that..
np
Am I dumb or what? I have console.log(user.displayedGuilds), which logs an array of each server I'm in including Id, name, Icon, settingsUrl, etc... If I put console.log(user.displayedGuilds.settingsUrl) or anything I just mentioned, it returns undefined when its clearly defined.
Here is an example of what is in user.displayedGuilds
and with user.displayedGuilds.settingsUrl, I get this
you probably want to map over it
Possibly. I did it like 2 days ago and it just spam listed each settingsUrl.
well it would get the settingsUrl for each item in the array
is there an exact thing you need to do?
Well not exactly, I'm just wondering why its returning undefined. I just wanted to check all the settingsUrl's for something
Looking for a way to sort them by servers the bot is in first.
And the settingsUrl should have /manage/:serverId for servers the bot is in and https://discordapp.com/blahblahblah for servers the bot isn't.
I've already tried using user.displayedGuilds.sort(), but it will only let me sort servers the bot is NOT in first. If I try the other way, it just ignores the sort.
👀 displayedGuilds sounds like an array, arrays dont have properties.
or well, that property
it is indeed an array from the screenshot provided
ry
Yea but I can't map something that's undefined.
Figured it out. Just added a sort: 0 for servers the bot is in and sort: 1 for servers the bot isn't.
well I can't create a secret with name GITHUB_TOKEN
return new Models[category](result);
logging this normally returns the class as it should but if I return it in a function and then log the result of that function it logs as a newline
why not?
because github envs shouldn't start with GITHUB
then give it a different name
also, just saw this
Hey I'm having trouble with slashcommands rn
Can someone help?
So when I try then command it says application did not respond
So what do I do
But that doesn't mean anything, there could be more than one reason for this. It may be the fault of the bot itself, which is not online, for example, or it may be the fault of your command code
const { readdirSync } = require("fs");
const Discord = require("discord.js")
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = process.env.token;
const clientId = "992806051806191626";
const ascii = require("ascii-table");
const client = require("discord.js");
let table = new ascii("SlashCommands");
table.setHeading("SlashCommand Name", "Loaded Status");
module.exports = (client) => {
const slashCommands = [];
readdirSync("./SlashCommands/").forEach(dir => {
const commands = readdirSync(`./SlashCommands/${dir}/`).filter((file) =>
file.endsWith(".js")
);
for (const file of commands) {
const pull = require(`../SlashCommands/${dir}/${file}`);
slashCommands.push(pull.data.toJSON());
if (pull.data.name) {
client.slashCommands.set(pull.name, pull);
table.addRow(pull.data.name, "✅");
} else {
table.addRow(
pull.data.name,
`❌`
);
}
}
console.log(table.toString());
});
const rest = new REST({ version: '9' }).setToken(process.env.token);
(async () => {
try {
console.log('Started refreshing application (/) commands.')
await rest.put(
Routes.applicationCommands(clientId),
{ body: slashCommands },
);
console.log('Successfully reloaded application (/) commands.')
} catch(error) {
console.log(error)
}
});
}
Do u think anything is wrong??
If the command is displayed in the bot commands and can be used, then this part works as it should. I think so
It's probably more about the command and how it is executed
Yes the bot displays that there's a ping command in my bot
But issue comes when running it
Then you have to give us the code of the command itself that is executed when the command is used
const {MessageEmbed, Collection } = require("discord.js");
const { readdirSync } = require("fs");
const Discord = require("discord.js")
const client = require("../../index")
const fetch = require("node-fetch");
const { QuickDB } = require("quick.db")
const db = new QuickDB();
client.on("interactionCreate", async interaction => {
if(!interaction.isCommand()) return;
const slashCommand = client.slashCommands
console.log(slashCommand)
if(!slashCommand) return;
try {
if(slashCommand)
await slashCommand.execute(interaction);
} catch(err) {
console.log(err)
await interaction.reply({content: "An Error Occured!", ephemeral: true})
}
})```
So this interaction create file
So do u see anything wrong
It depends, it will most likely only work with one command because you don't extract the command from the collection in any way. Just to be sure, if console.log(slashCommand) is working, that part of your bot is working for now
Most likely because you didn't select a command from the collection
slashCommand is a collection, not a command data
You need to do something like this so that your bot selects the appropriate command from the collection and executes its code
command = client.slashCommands.get(interaction.commandName)
This code is missing from your interaction create handler
@deft wolf now command says same and when i logged slashCommand,it says undefined
Because you don't have a client value in your handler
whre?
You have access to interaction. You need to get the client out of this
There
All your client in it doesn't exist because you don't have it defined in any way
so i hve 2 do client = require("discord.js")?
Wait, that's so weirdly written
This is index.js right?
Okay, where do you log into the bot then?
index.js
Okay but here you are defining a brand new client that is not that you did before
You create the client once, you don't have to create it in every file
So what is client = require("discord.js")?
i m just defining bruh
I don't know, I'm so lost honestly
Either I don't understand "your programming style" or I don't know
You can ask on other servers or wait for others on this server to read these messages and maybe they will know what to do about it
Any way to change the ip/port in ubuntu using console commands?
what ip/port?
actually my bot isn't replying so i guess the possible reason for that would be that it got rate limit. So to fix it the only way is to change the ip address of host
What you can do however is make a ticket to your VPS to request a change of IP which some do allow for good reasons.
yeah you can request a change that is true
you can purchase another IP too
but you cant just tell linux to "change my ip"
unless you were provided an ip then you can change that in the networking config
try sending a request via curl and see the info
how
e.g. curl -H "Authorization: Bearer <...>" -H "User-Agent: DiscordBot(..., ...)" https://discord.com/api/v10/users/@me
<...> is your bot token
and DiscordBot(..., ...)?
it's a user agent discord likes you to attach
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
so do I've to put something between ()
where to find the library you're using and the version being used
e.g. where to find your bot and whatever version
probably doesn't matter much here
{"code": 0, "message": "You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward."}```💀
👀 what in the world are you doing to get ratelimited frequently.
lol
try running it again with the -I flag
it should display some info about how long in the headers
💀 I've my bot's join logs using webhook, and my bot was added in 200 servers within 5 mins, so you know what would have happened
webhooks have their own ratelimits separate from the bot.
I'm trying to get a user from a database using Next.js and getServerSideProps, but session is being returned as null even though the user is logged in
curl: (3) URL using bad/illegal format or missing URL
HTTP/2 429
date: Sat, 21 Jan 2023 15:43:02 GMT
content-type: application/json
retry-after: 1907
cache-control: no-cache
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=QpjNfRZ3B75oRIAvhASqlU0EMV0IFgigbPof6celRBQELZayQvRuqm1%2BvYoeBQ1emAlfE1Og2IQ8K7ecXYVRkbd0vyC6neWuFvAW1zq%2FNjZC6vFkPUv87fSFxZw4"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
server: cloudflare
cf-ray: 78d129c6d83381d5-IAD
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
then how come the host got ratelimit, and it's been 3 hours it got ratelimit
actually, i did console.log(user) after fetching with session.user.id and its returning the database user
but when I pass through props, it returns as undefined or null
so like 30 minutes
what
until it expires
you mean after 30 mins it will be fixed?
it should be
but you may just get rate limited again if whatever caused it isn't fixed
nvm fixed, i was doing Onboarding({ props}) not Onboarding(props)
but how did you come to know that it'll be all right in 30 mins?
ok
since it's just an hour, I have a feeling that you're spamming the api somewhere in a loop, since the rate limit for that is like 10,000 requests in 10 minutes
I've some high loads command, like lockall, hideall which updates all the channels in the server. It's possible that someone would have spammed it in a server where there's a lot of channels
though I've used delay after every channel update
it updates channel at a speed of 1.75 second/channel
response.body can be null which seems to be what it's complaining about, assert that it's not null/undefined with the ! operator after the value: response.body!
that only solved one issue
Is that response from Undici or?
Oh, are you using the built-in fetch() method or?
yup
easier than node-fetch
i am aware it's not stable yet so that might be an issue?
let url = "";
url = req.query.url as typeof url
const response = await fetch(url);
if (!response.ok) throw new Error(`unexpected response ${response.statusText}`);
res.setHeader('Content-Type', 'application/zip');
res.setHeader('Content-Disposition', 'attachment; filename=demofile.zip');
await pipeline(response.body!, res);
here
The Fetch API is generally stable at the moment
this is typescript btw, pretty sure u are already aware
I know, the ReadableStream instance you currently have is different from Node.js' common streams, because the one you have is a readable web stream, it has a pipeTo() method you can use
Here's something that can help you
https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams
@sudden geyser bro I thought my bot was added in 200-300 servers, but now I came to see that it's added in 4.3k new servers 💀
bot died while processing 4.3k webhook messages
how'd that happen
I don't even know
looking into it but it's really not helping
The pipeTo doesn't accept a node common stream as a param, only another web stream. If someone wanted to convert it to a readable, they'd have to do Readable.fromWeb(<undici stream>);
I know, but we don't know what their res variable is so that's why I brought that up
👍
What exactly are you trying to pipe response.body to?
i am downloading a file
Okay but what is res?
What library is that from?
I got that, Next in there goes with the other words so it's not obvious
everything i am using is
import stream from 'stream';
import { promisify } from 'util';
import type { NextApiRequest, NextApiResponse } from 'next'
const pipeline = promisify(stream.pipeline);
So you're piping the readable web stream to a Next.js response object, you can either convert the readable web stream to a Node.js common stream by stream.Readable.fromWeb(), and use that, or you can get the reader of the readable web stream and write (?) to the Next.js response object
const reader = response.body.getReader();
let data = null;
while (!(data = await reader.read()).done)
// Write to response object with the value of `data.value`
I don't use Next.js so I'm not sure if that's feasible or not
Not exactly development related, but what's the purpose of these "Hoarding bots" servers? I just got a 15k server and I was like
until I ran an eval to see who was a bot and who wasn't and 12 people are users 
The purpose is to mostly test them and break them to either report the bugs to the developers or for malicious intents
They probably plan to do that later, I mean there's 15k bots as you mentioned there
my bot is added to those all the time
Flashback to this server having every approved bots here, !help and boom
i call them "API fuckery" servers
they add thousands of bots to spam commands and get bots, channels and servers ratelimited
When my bot was still alive I made it leave every server that had a lot of bots on join
It's a nice way to prevent them from breaking anything or getting the bot ratelimited
What was the threshhold you used? Like 75% of users are bots?
65%
Ok.
Although 70% is also good
What would the math to that look like
For example, for 70% you would have to divide the member count by 10 and multiply it by 7, and compare the number of bots in the server to the member count, if the number of bots is greater than or equal to the 70% of the total member count, leave the server
Does anyone use oh my zsh here? Any recommended plugins?
Plugins or themes?
The only plugin I can recommend (and also the only plugin I use) is https://github.com/zsh-users/zsh-syntax-highlighting
But here's a huge list of all the useful plugins here
https://github.com/unixorn/awesome-zsh-plugins#plugins
@drowsy crag hi
hey
swag
anything to remove that form the number type for inputs?
try opening the inspector and seeing what properties is making that show up
or dont use type number
use textfield instead and just dynamically check if it is a number
an input with a number here is probably better semantically
you cant remove it unless you make it appear as a textbox on mozilla for example
also generally probably better to handle the ID as an string imo
why?
its inconsistent across browsers and has a lot of weird quirks
most standard input types have similar issues
thats why its usually preferred to use regular inputs and control them with js
the only advantage is that pn mobile it shows the numeric keyboad onstead of default
but i think that can also be forced using some html attributes
Is a global ban list where I can add raider/bot accounts to against TopGG tos? Servers would have to manually enable it in their servers, not on by default.
Global ban list are fine.
What do you mean by "text votes"?
You can listen to bot votes on Top.gg via it's API which you can get help for in #topgg-api
Additionally you can check if someone voted for your bot with this Top.gg API endpoint:
https://docs.top.gg/api/bot/#individual-user-vote
Anyone else have this server add their bot? Seems suspicious, in less than 8 hours their guild member count has increased by nearly 2000 members
probably a bot farm
That’s what I’m thinking, haven’t updated my bot to be able to look at bot to member ratio since I haven’t touched the code in nearly 2 years
Not this server but the name is similar so it's possible it's their server
That’s the same server, they update the member count in the server name
Pretty sure it’s a bot farm, this is odd:
Though I believe memberCount in my lib is only for cached users
Indeed, it's the same server
Definitely suspicious if they’ve grown 20k members in that short of a time period
Might be scraping top.gg and adding every bot that they can
3 days
Yeah
20k legitimate members in 3 days is also a lot
Either way I doubt it’s legit
Hmm seems like there are a whole bunch of them
It’s the same server, they change the name to update with the server count
But wait, a server made in 2016?
I would have thought they would do something like this on some new servers/accounts
How to change stuff of npm package we are using in our discord bot??
Why would you do that?
Plz tell dudes
This is an XY problem
Tell us why you would want to do that first
Because you almost never want to do that to solve a problem
"i have this error and I want to remove the error message"
Thats what I’m thinking
In which case the error is 99.9% probably from your code, not the package’s
Clone the library and add to the project
Worth to note, you won't receive any more updates if u do this
And you're very likely to wreck something up
I very highly doubt that his issue is from the library
That's the server I was added too recently. Like 20k
At least now we know where "60,000 bot users" come from
and not support from the developers either

Sometimes all u need is to suffer a little to see why people tell u not to do something
They never listen otherwise
How can i fix this?
node:events:491
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:102:46)
at Client.<anonymous> (C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\index.js:68:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionAlreadyReplied'
}
Node.js v18.12.0
by reading the error
The reply to this interaction has already been sent or deferred.
Can anyone help me fix this intellisense issue with vscode. I'm learning go and have declared a type deck in a file called deck.go but when using the type deck in my main.go file vscode gives me this error but I can run the code fine like it should, it's just really annoying.
have you installed the recommended extensions for go?
I can't get files to upload with Chakra + Next.js
the file is not included in the body
you need to add the boundary to the header
is that browser side? why not use fetch?
would you be able to use axios client side?
i think axios works on both node and browser

yesµ
yes, they do
Could there be a Pokemon Trade feature for Mudae?
ive got my website up on my vps with nginx and shit and locally, my api works, but when it try to do it on the vps, i get this:
[blocked] The page at https://domain.com/ was not allowed to display insecure content from http://ip:port/get_sections. (a42c66d.js, line 2)
Not allowed to request resource
Fetch API cannot load http://ip:port/get_sections due to access control checks.
TypeError: Load failed
and btw i do do this:
app = Quart(__name__)
app=cors(app)
app.config['CORS_HEADERS'] = 'Content-Type' # i use cors...
# and
@route_cors()```
but it works when i do ip:port/get_sections just in my search bar...
domain.com tries to reach out to ip:port, which fails due to cors not matching ip:port
You need to set your cors headers to allow domain.com
also, https is needed according to the message?
which, if its an api it should have https
yeah i fixed that
for some reason when i run my project locally for a specific file my style is correctly opacity: 75% and when i run it on my server, and npm run build and npm run start it is opacity: 1
Can't u just use 0.75?
ya ill try that
Listen here you little shit
/imagine
banned for ads
indeed
ADVERTISEMENT 
do you know a way on how to compare two binary files? @earnest phoenix
like is there a hash file command in linux or something
top.gg -> top.journey
Use the sha256sum command
It'll show the SHA256 hash of the binary file, which you can use to compare them

@earnest phoenix how
You're most likely trying to run a 32-bit executable on a 64-bit environment, or vice-versa
which? node?
If that's what's causing the error
Try running node -v and see if it causes that error
You shouldn't use the Node.js binaries provided by those repositories, they can be outdated or not work at all, use https://nvm.sh/
bruh
After installing nvm, run nvm install --lts to install the latest LTS release
damn 😔
at this point i think i'm over-engineering my library
too much scripts and CI-related things
Nah it's fine
like your country?
Tried something like this, but doesn't work if the number is higher
(([\0-1][0])|[1-9])[a-c-A-C]
I don't know a lot about regex so yeah :<
what is and ?
([1-9]|[0-1]{1,2})[a-c-A-C]
that should fix ur
no 100% if it works but it works for me for my cases
regex makes me want to die tbh
Can you tell me what exactly are you trying to match?
I want to match
1a
1b
1c
to
10a
10b
10c
other cases 11b or 23b won't work
So the first part should only be 1 through 10?
Then you can just do /(?:(?<!\d)[0-9]|10)[a-cA-C]/
Hi, I want to add music feature into my bot is there any better package than https://distube.js.org/#/ ??
Note: my bot isn't Just Music Bot I want to add music as a feature
I use https://www.npmjs.com/package/discord-player with no issues.
What that does is that if it's a 10, just take that, if not then match through 0 to 9 but ignore the ones that have a digit before it, and then match a through c and A through C
Woah, thank you so much
You're welcome
Major parsing issue
👀
/[1-9][0-9]?[a-cA-C]/
u don't want 22b?
then that'll work
voltrex's is probably slower since it uses lookbehind
mine simply uses optional digits
yes
alr
mhmm, I think I don't care a lot about perfomance issues, cause I do it on client (ikk, but my website, doesn't need backend server)

it is school project
performance is still a concern on clientside
even more than performance on backend
yeah.. but I don't have other option
a backend server is too expensive for a school project
that's not what I said
performance is more noticeable on frontend than on backend
because a slow backend will just make processing take more time, a slow frontend will freeze the app/site
and users tend to panic when something freezes
yeah, the user's experience is the most importain
That won't work
why?
Yours does not filter out numbers larger than 10
?
Which is what they want
it'll work from 1a to 99c
They only want it to work from 1 to 10, nothing larger
Told ya
yeah that'll require lookbehind
however, I don't see why would they process that through regex and not simply check the input
@compact pier so yeah, you can keep using mine which is correct, but you can also do it without regex
Either by parsing or something similar
to do it through code simply strip anything that isn't a letter and check if the number is > 10
or get a substring of the first (if length == 2) or first 2 (if length == 3) digits
Parse it as hexadecimal 🧌
@wheat mesa do u have any idea how to check if a bunch of bytes is a webp image?
like, png and jpeg have a specific sequence of bytes at the start of the array
google docs don't help much
nvm, found something in wikipedia
Yeah isn't there a filetype definition on the beginning of the file?
there is, I just need to figure out how to properly read it
https://en.m.wikipedia.org/wiki/List_of_file_signatures will help a fuck ton
This is a list of file signatures, data used to identify or verify the content of a file. Such signatures are also known as magic numbers or Magic Bytes.
Many file formats are not intended to be read as text. If such a file is accidentally viewed as a text file, its contents will be unintelligible. However, sometimes the file signature can be re...
or just use the filetype to differentiate
There's no filetype in a byte sequence
Experimenting with 0AUTH2, how can I make it so if they're banned from the server then they can't use the 0auth2?
Haven't been able to find a response.
Can you elaborate "banning from oauth2"?
You have control over the callback Webserver that receives the oauth, you could do anything: either compare their User ID with your banlist or ban the IP that made the oauth
First one allowing use on a different account, second one entirely disallow on IP
Second one being the requirement that they have authorized on oauth2 at least once, dont forget to declare that on your privacy policy though
I want to do the first one; not sure how to implement it though. Couldn't find a docs or tutorial on it.
you can't prevent the user from acessing the oauth2 screen since that's on discord's side
but you can simply refuse to do something once they accept it
if it's for inviting the bot simply make it leave the servers right away
Yeah that
Get user to authorize, once authorize obtain the user id through the users endpoint, check banlist for that user id, deny access or whatever once that match comes back true
There isn't much docs needed, fetch the user, fetch your servers banlist and done
nope, takes them back to the site with their name on the navbar for now
Or whats your general goal? Deny access to your dashboard?
They can always use the oauth2 endpoint, but its up to you what you do after them authorizing
well, you need to refuse access after you get the response
oauth2 is nothing more than "you want this data? sure, let me ask them first"
alright, so I'll just make it so that it logs them out and then redirects them to a /banned page
oauth -> user authorizes
- fetch userid from the token, fetch your servers banlist, if user is on banlist, redirect to /banned
- if not, allow access
Just remember to still do that on any dashboard usage, unless you're not even going to give them a session
Which is probably easier
AttributeError: 'Member' object has no attribute 'role'
And it indeed doesn't
fact checked: TRUE!
uploading code one second
Me when I keep coming back to the same discord channel for the same error at least once a week for the last 2 years
if user.role(whitelisted_humans):
return;```
the humans role is an id
whitelisted_humans = [849479291111866380]```
Ok TIFU more than I thought
what
Are you sure that's how ur supposed to check for roles?
i dont ever try this lol
Then read docs
Hm
Oops, reply went automatically
Tifu means "this is fucked up" btw
Naming a Member variable user is the recipe for chaos
To check for roles you need to get the roles of a member and check if it contains the desired role
U can't simply call functions that don't exist, always check the docs or at least use ctrl + space
if member.guild.get_role(849479291111866380) ^ SyntaxError: invalid syntax
That's somehow worse than it was
ive used it before
Sometimes I wonder if you’ve tried solving the issue or if you’re just looking up a ton of things and copy pasting the code…
nope
Just look at the docs
i try it makes no sense
Isn't ur editor telling u it's wrong?
Like, even the most basic code editors have some kind of autocomplete
Anyway, you need to learn how to read documentations
That's part of being a programmer
TypeError: on_message() missing 1 required positional argument: 'member'
Ignoring exception in on_message```
@commands.Cog.listener()
async def on_message(self, message, member):
user = message.author
if message.author.bot:
return
whitelisted_channels = [978933824241147904]
whitelisted_humans = [849479291111866380] # 131920731490615296 bit.ly in own server.
I need help trying to upload an image to a webhook. The image is in HTML Canvas
they're probably using a custom class
on_message does not have a second, or member argument iirc
yea
I can't understand where I went wrong
unfortunately there is no solution posted here
the error states that the sourceEnd value is out of range and must be between 0 and 3, but the value of 8 was received
try seeing if the code that is trying to access the array/string is properly checking and enforcing the range of the index being accessed, in this case between 0 and 3
also in ur code at line 334, it's saying DiscoidVoice
not sure if u spelled it wrong
i think it should be DiscordVoice
no its true
there is a possible fix in a PR request, but it was not merged, you can however try installing the PR version instead of the npm version:
https://github.com/dzlandis/prism-media
Easily transcode media using Node.js 🎶. Contribute to dzlandis/prism-media development by creating an account on GitHub.
from looking at their code, the fix is not quite correct
but it might work
Tim if u don't mind, could u give me some performance advice?
so, let's say I have a huge array (raster data from image) and want to edit some pixels
what'd be the optimal way to edit said pixels?
like, the specific pixels will be supplied by a mask
the specific pixels are matched by color?
so they can be anywhere in the image, right?
you dont know their position beforehand
yes
the issue being that a linear array iteration is too painfully slow
the raster is a width * height * channels sized array
is it rgb or rgba?
rgba, but it can be anything
perhaps I could split the array into chunks and process each separately
if there is no hint about the possible pixel position, there is no other way besides iteration, but you dont need to match the entire mask at once for each pixel
you can match each rgba byte separately
so if the first byte doesnt match you dont need to check the others
like
if you want to change all pixels with a specific color into a different color
you dont need to check if the pixel matches all channels with something like buffer compare
actually, how are the pixels stored in the first place?
2d array?
1d array
so all pixels are merged in the same array, in groups of 4
I believe so
ah wait, I just noticed that I can just offset the iterator by the desired channel number
then you can iterate and skip
exactly
if the first byte doesnt match, skip the next 3
if the first matches, but the second doesnt, skip the next 2
etc
ic, ty tim
what lang btw?
java
another thing you can try is using array indexOf, or equivalent
trying to optimize my renderer, it's taking too long for some pixel ops
in my experience that function is faster than if you were to iterate yourself
at least it is in js lol
btw, I ran a benchmark on some webp vs png
5 warmups for each iteration
I didn't expect webp to be half as fast as png
I could run a bigger sample, but the step results were way too consistent
for example
half as fast? isnt the score 1887 vs 1742?
xD
well, 0.1 ops/s diff isn't that bad then
webp is lossy compressed isnt it?
png is usually losless or at least color indexed
both were compressed at 80% quality
webp lossy yes
I don't really mind the loss, I just need transparency
im gonna get my groceries off the car lol
ain't done yet, but I think it'll be like fishing with a cannon
btw, it's a 1000x1000 image with randomly rolled pixels
the image is created for each iteration
too bad I cant use jpeg
png and webp gave bigger results for some reason
maybe it's because of cpu load
jpeg is basically the UDP of image formats
unified department of police?
xD
btw
that benchmark is basically encoding performance no?
time taken to generate said pixels and encode them into the format
what about a decoding benchmark?
time taken to actually read and decode the pixels
ay I thought you hated benchmarks
I hate wrongly done benchmarks
this one is using the openjdk benchmark lib
which makes sure all runs are done equally
I’ve been trying to find something about this but anyone know a resource on how to do a video pop out like this in html?
Quesiton: Is 50 servers a cap of some sort for unverified slash commands? I woke up today to not being able to run slash commands in my own server. Also noticed my little description I have for my bot where you can click commands to autofill them are no longer highlighted.
Nope, discord slash commands are down right now
make a modal overlay with a video player
when the user clicks on it, make the modal visible
Thanks
mfw I misread it with "measurePog
lmao
Does anyone know how to avoid hundreds of setTimeout, I am trying to create a remindme system. I was actually going to use Cron, but you can't choose the number of iterations with node-cron. Because I think that having hundreds of setTimeout in progress is not incredible no?
I had seen Agenda but it only uses Mongodb I think and I use Mysql
how about one setTimeout that processes through a list instead? Perhaps adding a expire timeout along with the remindme entry
then that setTimeout executing every second
though theres also the cons about setTimeout, since your reminders will get lost on a restart. So a repeating setTimeout that goes through a list might also allow you to store the reminders in a database
yes that's why i store them in my database to re-add them on restart (endDate-startDate)
yeah then load your reminders into a list and have the setTimeout iterate through the list and do the reminders etc
The problem is that my reminders do not have the same expiration date
you might also be able to have other bot instances that are specifically for working through the reminders, might help with processing
store the expiry time in the database aswell, so that the setTimeout can iterate through it and compare the current time with the one on the entry
thats at least how I would do it
what do you mean by a repeating setTimeout 
one single setTimeout that goes forever, that processes the reminders
aka a setInterval
oh yeah forgot that exists too
you wont be able to reliably store reminders without some missing if your bot restarts if theres some that expire during the restart
though it really sounds like you want some persistent queue
aahh I understand yes, i was going on recursive function
I forgot setInterval
In an old Discord bot I made I had a sort of Interval for short reminders and I would cache the longer ones in redis and check them every minute.
Even tho I think there are much better stream / event options for that
I have the code here https://github.com/Giuliopime/Todo-Reminder/tree/main/src/main/java/me/todoReminder/bot/core/reminders (java)
NodeJS.Timeouts are actually pretty light on the process and a ton of them already get used to handle rate limits to Discord depending on how big your bot is. Reminders should be stored in some form of storage in case your process crashes
Oh fuck thats actually smart, to redis the longer ones
There has to be a more precise system tho
Yeah was about to say, judging from the code, yours are on the minute, hour, week etc
Only way to make a precise way is to have another instance of the bot deal with it
the best system i can think of is store them in a database, then use an interval to check the database every 5-10 minutes for any timer that will expire in less than 5-10 minutes, and for each one found, create a timeout for it
True
Yeah mine are minute precise
Not seconds
Unless it's a short reminder
Which is generally fine I guess
So your border on a short and long reminder is seconds and minutes
with the above method i mentioned, everything is millisecond precision
Anyone else getting a decent amount of "unknown intereaction" errors since the slash commands came back from being disabled temporarily? I'm getting one from just doing interaction.reply() which shouldn't throw that because it's the first thing it runs on that specific slash command ran
my buttons respond pretty slow too
Its probably api issues still
No, everything works as it should for me
my errors seemed to have chilled out.
But for a good 30 minutes all I got were theses
https://scs.twilightgamez.net/5f5mb.png
Which 51 is
await interaction.reply({content: `Attempting to queue: \`${interaction.options.getString('song')}\``, ephemeral: true})
It must have been related to those api issues
yeah I just now had a realization that maybe I forgot to make 'song' required, but no, it is lol.
So ya api related likely.
That or the interaction is non existent.
I mean, how would that happen?
You could be completing the interaction already.
Well no, djs tells you if you deferred a reply or smth like that
ya it does.
unknown interaction is likely from the API errors earlier
Ya it only started to happen after the slash commands came back so I was just curious if anyone else was experiencing the spam on unknown interactions on simple interaciton.replys but I haven't had one for almost an hr now so ya. Probably just api recovering from its stroke it had.
@craggy pine Are you receiving interactions via http or over the gateway
because Discord can tell your client to resume and during that window, your interactions can expire

basically it's almost every other interaction it becomes really really slow.
unfortunately that didn't work 😞
the short one is milliseconds precise
I think I solved it somehow, but this time, when calculating the talk time, I have it calculated as buffer.length / 48000 / 4, which gives me a very low value. like; 0.07417708333333334
Has anyone worked with millions of rows in db?
It takes quite a bit of time to retrieve 500k data. Even with all the indexing
500k lines?
500k data?*
like rows?
or
yeah
lines
500k rows
from postgres
its also a select query select * from x where x.uid = xx
x.uid is indexed and stuff
still takes about 30sec
why are you trying to select every single data
consider optimizing your queries and moving over to a faster database system
postgres is probably the fastest free option
never use * unless u strictly need it
also is uid a primary key?
All columns are needed
Nop
It’s like 1 uid can have multiple rows
One to many relationship
what's the table used for?
also, there's no "one to many table"
1-N is a relationship, not a table structure
@crystal wigeon come back
brb
ah ok
So it’s like this, let’s say a user has bunch of posts, user table has the primary key and these posts will have the uid has foreign key and indexed
It’s mostly the pagination total count that’s costing time
Using count(id) to get total rows
why dont u paginate through postgres directly?
do u need the total of posts?
yeah
can posts be edited or deleted?
Yep both
hm, are u getting the count together with the regular sql?
like SELECT *, COUNT(id) FROM ...
or in a separate query?
Yeah along with it
btw, u can use COUNT(1) instead, it's faster sometimes
do it separately
reason being COUNT() will fetch all rows, so it might be fetching the other fields too which, if you have very large values, will affect execution time
also u dont need to do any join for the count
just count directly from the table, filtering by id
what u could also do, is disallow editing/deleting posts older than X days
then make a periodic procedure that counts archived posts and save to an aux table
then u can just filter posts where age < X and count them, appending the saved count
this is actually why most forums archive posts after some time
Well it’s not exactly posts, posts was just as an example haha, everything is active here.
but if ur dealing with massive amounts of data you should consider something like that
Yeah, inactive data mmm but since it’s actively used it’s a pain with slow performance speeds
Alright so it’s kinda slow even without the count ()
execute a PLAN EXPLAIN query and show the result please
redact the names if u must
I can't understand where I went wrong
the first buffer in the console is stereo, the second buffer is mono
When I convert the buffer to audio, I can listen to it, but when wit.ai converts it to text, it's empty.
okay so, this is the query i ran, and it took about 20secs
id asc) from "collections" where
"collections"."user_id" = 1 and "collections"."is_item" = false)
as "collectionalias" where "collectionalias"."row_number" = 1```
this is for the user with more than 500k rows. its super fast for users with less data
lemme format that first
EXPLAIN ANALYZE
SELECT x.*
FROM (
SELECT *
, row_number() OVER (ORDER BY rank_id DESC, id ASC) AS row
FROM collections
WHERE user_id = 1
AND is_item = FALSE
) AS x
WHERE x.row = 1
much better
ctrl + alt + L on intellij
hey
how do i access this count(*) variable?
like i am using it like: result[0].(property here)
however result[0].COUNT(*) will behave like an actual function...
rename the object property,
how? It's a pulled variable from sqlite
SELECT COUNT(*) FROM table;
or you can try result[0]["COUNT(()"]
ok, now it's better yet
okii will try thanks!
its not good practice tho
ok so, first of all u never need = BOOLEAN since it's a boolean already
you can do select count(1) as total from table
no the value is either true or false
so it has to filter through rows that are false
yes, u don't need that
otherwise row number gonna mess up
i see
u also dont need to spam " everywhere, only for stuff using keywords as names
why do u need row_number?
so the rows have to be ordered and the user would choose something like the nth row
if you want to choose the 5th item
they type select 5
the order by is an addon for them to sort it by asc or desc
or based on a rank_id
EXPLAIN ANALYZE
SELECT *
FROM collections
WHERE user_id = 1
AND NOT is_item
ORDER BY rank_id DESC, id
OFFSET :row_n LIMIT 1
u dont need row_number for that, simply use offset
yeah
like, I dont think the user would need to see is_item column
so it's one less column in the resultset
mmm makes sense ye, but will need other columns i have
so it should be offset - 1 btw right? cause i select 1 it should not skip anything
offset 1 would skip the first row
damnnn that was fast
20k ms to 50ms
yes
reason is, offset requires no processing at all, it simply ignore N rows and limit to X lines
cause if they search for something with name, need to show on what row the item is on
yep
alr lemme solve 1 problem at a time
precomputed, but need to do this everytime collections are consumed etc
use a trigger for that, leave the work to the database
mmmm
like, when deleting, update all rows with number higher than the deleted row
u wont sort the actual data, you'll sort the resultset
Simple logic yet effective, thanks
I’ll brb
while at that, having a row number column also speeds up count
