#development
1 messages · Page 2070 of 1
But the lib still receives the raw api response including all that new fields/informations etc
It’s just how you can access it using your lib
I don't believe I can access the raw object
And I noticed while djs development is as slowly as discord they still have native methods you can use to handle your raw api data
Yeah they parse the api data and if there’s a new field or key & value in an object it will be ignored
Instead of being accessible in a idk raw response property
Anyways I wasn’t even aware you can use them yet in a modal
You think there would be an easy way for me to add it in myself?
I don't really know what the api response looks like
Well the same as normal select menus?!
But as part of the modal fields
So the field value for field 2, for example would probably be the select menu response
Just an object including the data
Like the customId and value etc
That and I'm still not entirely sure how detritus parses the data into structures
At end you should probably wait until there’s an official announcement that it has been integrated
Instead of mixing some of your code handling raw data, some utilizing the existing methods etc
Since you will rework the shit later on once again anyways
Discord is fast with developing things
Expect it to be fully integrated soon

It's detritus
And cake is the sole maintainer at this point, so idk how long it would take for it to be added
Whatever same same

In terms of the development speed, yes, I agree 100%
I don't think they're fully supported yet, not a detritus issue afaik
Nevermind. I was told it all works fine on the api end
can someone help with css and transition xd
im trying to do a transition with both visibility and translateY
its working fine but the problem is, when visibility is none the element is still loaded and the screen just looks blank with scroll
You can't do transitions with none in terms of display. Assuming you're messing with display: none as well
no just visiblity none
.nav__menu {
visibility: hidden;
width: 100%;
bottom: 0;
z-index: 1;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
box-shadow: 12px 12px 12px 12px #000;
background: rgb(39 39 42 / var(--tw-bg-opacity));
transform: translateY(50rem);
transition: transform 0.5s ease-in-out, visibility 0.3s ease-in-out;
}
#hamburger:checked ~ div > ul.nav__menu {
visibility: visible;
transform: translateY(0rem);
}```
Here's the code
here's the behaviour
i was of the assumtption that the nav menu will be like hidden
but its just going to the bottom
and i can scroll to it
for whoever reads this, just wanted to ruin your day by posting this :)```cpp
#include <iostream>
void diffReturn(int t) {
if (t == 0) {
throw "hi";
} else {
throw 1;
}
}
int main() {
try {
diffReturn(1);
} catch (int result) {
std::cout << "int: " << result << std::endl;
} catch (const char* result) {
std::cout << "String: " << result << std::endl;
}
}
why
why bother using return types when you can just throw instead!
I'm more bothered by the space semicolon
when I'm visit http://localhost:5000/auth/discord/callback logs "asd", "b" and redirect "/auth" but it's not working
[object Object] appears on the website
Appears visually or...
doesn't look like it redirected to /auth
yes, that's the problem
oh lmao
normally it should
Doesn't log "asd" on line 557 either
you worded this so poorly at the start
Are you making a get request?
Presumably it does that automatically trying to go to the url
Are you using NextJs?
Do you need to setup the routing for /auth/callback?
yes, i use the same for twitch but only this part is the problem
is the callback_url_discord the correct string?
oh i think i figured it out
What was it?
i couldn't figure it out :D
yes
what ide do you recommend?
I still don't know what to do
Cannot read properties of null (reading 'addEventListener')
document.getElementById('success-btn').addEventListener('click', showNotification.bind(null, 'success', 'Success!', 'Your request was completed successfully.'), false);
what could be the issue?
Element with the ID could possibly not exist in the dom
i think i might have found out why
yeah i had the script tag on the head
💀
console.log(notification.querySelector('.notification-message'))
logs me the div with the message, i wanna get rid of the div tried innerHtml but it returns null
how do i approach this
try using jQuery
$("ID/Class").prepend(`<SOMEHTML`);
prepend doesn't override but it edits the class and prepends your own HTML, I asume that can work if you wanna edit it
jquery is bloat
modern day web development achieved everything jquery tried to polyfill back in the day
i mean yes, but they actually did a pretty good job regarding compatibility on each platform and browser, while web devs nowadays go with, fuck your browser doesn't support this tech- then fuck you
also "bloat" is a relative opinion
react, react-dom and a router on top comes close to jquery which is like 30kb gzipped
jquery is just as bad as vanilla js if you ask me
imperative is just not a pleasant paradigm to work with. Nothing to do with bloat
this
python:
does someone of you know how i could turn my discord.Client class into a discord.Bot class without rewriting my whole bot?
yeah, normally....
always getting this Error
File "D:/Thorbot/thor-bot.py", line 1569, in on_ready
await bot.register_commands()
File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\discord\bot.py", line 471, in register_commands
prefetched_commands = await self.http.get_global_commands(self.user.id)
AttributeError: 'NoneType' object has no attribute 'id'```
maybe because my whole code is build with client.run and not bot.run
then open all files and use search and replace to replace bot. by client.
but in py-cord client doesnt have the slash commands or register_commands functions
dont even understand why there has to be two differnt classes for the same stuff....
What's the discord webhook url made out of?
Talking about (webhooks/)bunchofnumbershere/token?
I would like names 
just the webhook id / token
can i use a "load" event listener on a button
explain what u wanna do, please
finished

so i was testing around some notification pop ups
and they were triggered by buttons which obv i don't want
so i put them on html and wanted to trigger them using another way
oh you mean js
yes
was already wondering
you can use the preventDefault() method on the triggered event
for example when hitting a button
to supress the default action
Probably because client is a superclass
they could turn bot into a superclass aswell 😉
They couldn't
Because q superclass needs to conform to its childs
Discord has 2 types of client: bot and user
yeah but selfbotting is not allowed, so client and bot is for bots
No, bot is for bot, client is for bots and users
It's not allowed by discord, but the api is there
but selfbotting is not allowed^^ and so client is also for bots as bot
...are u blind? It's not allowed, doesn't mean it doesn't exists
i know, it exists
That's why client is for both
but why are they creating it in the first place^^
Because it exists
When u create a wrapper u gotta cover all the endpoints
Mostly because discord uses some user endpoints for bots as well
still sad that i have to rewrite my bot because of that shit 😦
bruh discord still hasn't fully removed user endpoints from bot stuff
ngl thats just lazy
i also like they way they they made self bots againced tos but still havent implamented a way to actively break it
but then idk how you would implament that so I'll give the devs a bit of slack there
🤔 just set your type to module
Use typescript and let it handle everything
He’s trying to hot reload esm modules
I'm trying to hot reload esm modules, so I have to pass them through eval instead of the import statement because it has its own cache nobody can access
The only thing I can do now is follow imports recursively and manage references in the global scope
it will be so fucking jank
replacing strings is great
Somebody in the detritus server said they found a way to bust the cache
👀
Really? I need this info
would consider calling an async function without await bad behavior? idk need to await my sql action but wanna return a boolean instantly
if you don't need to wait, then don't
If you want the result of an async function, you need to await it
If you don’t need the result, there’s technically no need
But make sure you .catch it, if you don’t await a promise and it rejects then your program will crash as it’s not caught by try catch blocks
the function returns true if it finds and validates an element of a map
it will delete the element of the map if the validation fails and will also execute a sql query
but I don't actually need to await the sql action, no matter what the result is or it may fails
Then don't worry about async
and it doesn't return <promise pending> ?
if the function isn't async and doesn't return a Promise.resolve(item) or Promise.reject(item), then you should be good
alr, thanks
oh also can't return an async function call
hmm the thing is the query method actually returns a promise
hasTimeout(id)
{
if(this.timeouts.has(id))
{
const timeout = this.timeouts.get(id);
if(!timeout.timeout || Date.now() < timeout.timeout) return true;
else
{
this.timeouts.delete(id);
this.sql.Query("app", "DELETE FROM ...timeouts WHERE id = ?", [id]);
}
}
return false;
}
the Query() method returns a promise
so even then without async and awaiting it, the function will return false not <promise pending>?
Correct
the Query function will still execute normally, just you won't be waiting or handling anything from the result
you could also use .then and .catch and it won't affect anything
Ok after about 25 different answers, I have concluded that select menus within modals are not officially supported yet, and so it's not a detritus problem
I really, really, really hope other field types will be implemented to modals soon
Number fields would be really nice as well
Modals are really really really nice, since it's a visual method of user input
Makes it a lot easier to handle stupid users lol
as well as a datepicker and small QOL fields (like the today announces min_length and max_length field for components and command options)
What does min_length and max_length do?
lol
Oh for normal commands?
I thought you meant modals since those already existed for modals lol
But that's cool too
nope they didn't
ah hmm, seems like I missed that
hmm yeah the announcement says command options
I misread that probably
oh
select menus support multi selection
damn didn't see that, too
my gosh I'm not really up to date
My pain is immeasurable
/import (.+?) from (['"`])([^"'`]+)\2 ?a?s? ?([^ \/;]+)?/gsmu;
lmao
@lament rock would this work? I found some old messages from that guy that said he found a way to crack the file cache ```ts
export async function importCacheBuster (modulePath: string): Promise<any> {
const cacheBustingModulePath = ${modulePath}?update=${Date.now()};
return import(cacheBustingModulePath);
}
query strings work? wtf???
idk if it actually works or not ¯_(ツ)_/¯
I read something about using this method online, but I never bothered with actually trying it
I wonder if the cache gets duplicated or if it gets overwritten
Through my testing I'm failing to get this to work
Getting "Cannot find module" when it clearly exists, it just doesn't seem to like the "?update" thing
looks like the current dev build of v14 isn't only unable to set a client nickname, it's not possible to set the client presence, too
I like it
document.querySelector('#success-btn').addEventListener('load', showNotification.bind(null, 'success', 'Success!', 'Thank you!'), false);
alright so whenever i try to manually trigger
showNotification.bind()
it doesn't work, it only works with the event listener
yeah cuz .bind doesn't run the function, it binds a this context and arguments
you need
showNotification.bind(null, 'success', 'Success!', 'Thank you!')()
to run it "manually"
maybe you're confusing it with .call which works the way you expect
Yeah .call worked
Interactions don't have a separate permission to send LINKS or EMBEDS as reponse, have they?
can't actually find a detailed info about that
hmm nvm webhooks don't seem to require any permissions
how can i fix this
You can check if you can send messages to the user and then handle the error. This is caused because the user either has DMs closed or because they blocked you I believe. (you being the bot user)
ik the dms is closed but which code i need to add to tell in console
Let me check the documentation real quick :)
k
You can use a try/catch method. Like this:
user.send(/* message */)
.catch(() => console.log("Cannot send message to the user!"));
I believe this should work
@earnest phoenix did it work?
@proven escarp too cute to work
so it doesn't work?
that would work
await user.send("meow").catch(() => console.log("loomi too cute"));
works for me
yea thx
pog!
just a quick question regarding logical error handling
// app module
loadCommands()
{
try
{
...
}
catch(error)
{
...
}
}
// command module
try
{
loadCommands();
...
}
catch(error)
{
...
}
calling loadCommands() in my command module will not throw an error if the try/catch clause throws an error
what would you call the best way to check if executing loadCommands() in my command module fails?
let loadCommands() return a promise I resolve or reject?!
or simply let loadCommands() return true if no error occured and check what the function returns in my command module?
indentation works pretty well
When I load my commands, I just handle the error within the function. It reports that there was an error loading commands, then after that everything goes normally. It's probably not the best way, but still
You could throw an error within loadCommands if it fails though
You could just not handle the error and let it propagate up to where it was called
thing is load commands will be called when the client init begins
I have to throw an error if an error occurs
but when calling it in my command module I somehow need to check if it throws an error to respond with reloading error or success
well actually throwing an error inside the catch clause seems to be a valid solution
instead of logging the error using my log utils I just use throw
But that somehow feels like bad practise, idk why
as my client init doesn't require a try/catch clause, the next level of error handling is the process error handling
so throwing an error inside the catch will actually be caught by the top level process error handler
dunno if that's how it should be handled
I feel like that's not right
well I'm going with a different option
Just by letting loadCommands() return true or false
and by getting the returned value in my command module
like so
// app module
loadCommands()
{
try
{
...
}
catch(error)
{
...
return false;
}
return true;
}
// command module
let success = true;
try
{
success = otherFunction();
success = loadCommands();
...
}
catch(error)
{
...
}
(success) ? thumbs up : thumbs down
seems to be better than relying on the top level process handler to catch the error I throw
which I will do for all non-async functions
at least to check if any error occurs
could also just return a promise inside those functions
and reject it in the catch clause
but well... return a simple boolean somehow seems easier
would have been more helpful if functions return true by default (without returning a specific value inside)
but isn't a thing in JS as I see
the advantage of throwing errors around is having easy access to the stack trace
which you dont have if you swallow everything and turn it into bools
if you dont need them, then sure
true but the try/catch clause will catch the error anyways
in my example above I just wanna know if loadCommands() has thrown an error or not
don't need the error stacktrace a second time as the catch will log the error anyways
So i want to write a decorator for my commands that when applied, will check whether the command user is registered or not (registering is basically storing the username of the user in a database).
This is my decorator :
def validate_user(func):
async def predicate(user_class, ctx, *args):
command_user = ctx.author
print(args)
data = await mongo_manager.manager.get_user(str(command_user.id))
if data is None:
return await ctx.reply("You are not registered")
await func(user_class, ctx, *args)
return predicate
and I am using it like this :
@add_group.command(name="cmd")
@validate_user
async def cmd(self,ctx:commands.Context, target:Member, another_target:Member):
await ctx.send("This command was used by a registered user on " + target.name)
The main issue is with args. When I run this command, print(args) results in
('@tulip terrace', '@onyx socket')
and the error is
'str' object has no attribute 'name'
``` because the parameters are received as strings and not Member Objects. Is there a way to receive Object using args and not their string form.
yeah
you just put Member
i imported it from discord itself
from discord import Member```
so that i dont have to write discord.Member again and again
@add_group.command(name="cmd")
@validate_user
async def cmd(self,ctx:commands.Context, target:Member, another_target:Member):
await ctx.send("This command was used by a registered user on ")```
If i change the code to this. Then it works cz target and another_target are not getting used, they are still received as string
Uncaught Error Error: The module '\\?\\node_modules\canvas\build\Release\canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing``` I have fucking deleted the package.json files, deleted the node_modules folder, used npm install and npm rebuild and this is still occuring
How can i ever fix this?
Maybe npm i canvas@latest or whatever the package name is?
are you using pm2?
i can try that out again
I'd trust tim's advice more than mine, I'm just speculating tbh
just running on vsc for now
using vsc's run command, or typing node index.js in vsc's terminal?
did you also delete package-lock.json when you deleted package.json and node_modules?
i am using run > start debugging
Yeah
its possible that your vsc's run command is using the wrong node version. try running node -v in vsc's terminal, and also running console.log(process.version) in you index.js file
to see if they are the same version
Okay... i used the npm i canvas@latest and then, npm rebuild canvas --binary-update and it worked.
Sorry for wasting your time tim
👍
Thanks nontheless, waffles as well 🙂
ESM's module loader fucking sucks
I've been finding that out too!
literally produces garbage frames in Error stacks so I can't backtrack properly
C:\Users\papi\Documents\GitHub\HeatSync>node --experimental-specifier-resolution=node ./example/index.mjs
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: ENOENT: no such file or directory, scandir 'C:\Users\papi\Documents\GitHub\HeatSync\node:internal\modules\modules'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Users\\papi\\Documents\\GitHub\\HeatSync\\node:internal\\modules\\modules'
}
and there's no __filename
the module loader somehow causes Error frames to think the file that's calling a function is node internal
I had to make my own module resolver as well
I have a very annoying bug on my site.
I wanted it to be like this:
what actually happens:
how are you looping through the pictures?
I think so
how
oh wait lmao
info.members.slice(0, 2).map((i, m) => `<img class="w-10 h-10 border-2 border-slate-200 rounded-full dark:border-slate-600" src="${i.displayAvatarURL}" alt="Member">${info.members.length > 2?`<a class="flex items-center justify-center w-10 h-10 text-xs font-medium text-white bg-gray-700 border-2 border-slate-200 rounded-full hover:bg-gray-600 dark:border-slate-600" href="#">+${info.members.length - 2}</a>`: ""}`)```
just loop through the first three and display picture and then if it's more than three just show a div with the number of users - 3

yes, is confusing
that code block is unreadable :ded:
const seenUsers = users.slice(0, 3)
const extraUsers = users.length - seenUsers.length
if (extraUsers > 0) {
// add the number
}
if you have less than 3 users it won't do anything
This hurts my eyes
@oak cliff upvote and downvote emoji for code suggestions in #development would be a nice thing to add! :)
im dum it already exists
dont mind this sowwy :((
we have upvote and downvote emotes yeah
:(

#development new stack overflow 😳
I am doing a night/light mode system and I got a state in the NavBar component, is it possible to know if that state changed and the current state of darkmode in the App.js (main file)?
Is the first time i am doing this.
i dont think you can import states from other files… you can use a library named react-theme tho i believe…
next-theme*
for nextjs
is there any other way? I don't really want to use libraries...
it’s certain there are other ways. but i don’t know any sadly 🤷♂️
:(
i am using this example that i found https://levelup.gitconnected.com/dark-mode-in-react-533faaee3c6e
if helps
use react contexts
yes i am using that
I personally use https://mantine.dev/ for react, it has a nice way to do light and dark modes/color schemes
You could also just pass the state down as a parameter
?
Though I hear that can get messy quite quickly.
mantine kekw
I personally like it
It makes otherwise annoying parts of design pretty easy to manage on my end
Granted I don't like frontend a whole ton so I'd rather have a library to help me
tried it and spent my entire time fighting it because it doesn't allow easy customization
but I almost always have a custom design in mind so
I haven't ever really been artistically creative
Every time I have a design in mind it just ends up looking like shit so I just make it easier on myself by going with a modern look
the most recent thing I was working on
Activate Windows
I'd rather just not stylize the site at all and let it look like something from 1970
government sites be living your vibe
government sites have to look bad else residents complain that their nokia won't let them pay taxes
you pay taxes on your nokia? smh I do that through my nintendo 2ds
dutch government sites would like to have a word with u 👁️
request('https://thaqalayn.net/', (error, response, html) => {
if(!error && response.statusCode === 200){
const $ = cheerio.load(html);
const datarow = $(".library")
const output = datarow.find("col-4 col-lg-3 text-center").text();
console.log(output)
}```hey i am trying to access the data here but it isn't really working (outputting a blank line):
can i add a bot here?
also you're missing dots on all the other classes you're trying to find
that library looks awesome 😳
Yup it finally worked. It has hella white spaces tho. How could i remove that?
If they're on either side of the data, .trim()
If I build a software. Can I take any name I want or are there things I need to look at in particular? Something about copyright etc.?
Some names are trademarked. NPM doesn't allow duplicate names and "similar names" are also not allowed
Is there a website I can check some names?
just come up with an unique and recognizabme name for your project
Yeah, like lsaedmfkqwenfodkqhweiyhoi7wehfgiunweifhjnwe!
Be goofy with names tbh and see if its taken on npm. I came up with HeatSync for my module reloader. English can be haha funny sometimes
it's not just about npm it's in general a product name
sorry buddy, HeatSync Labs is gonna sue you now
Then just google what you come up with and see if its trade marked
Mesa Arizona

I could be in court tomorrow if they wanted
The likelihood that someone C&D's you is low if it's not related to what your package does
But still a google search can save some trouble if you were to pick a name that is trademarked
I had a name idea, searched it up, it's a fcking village in slovenia probably noone knows about xD
nah.. it's just an npm package
Yeah ik
what was that drama that someone on npm had their package name taken away from them because a company wanted it
idk 🤔
oh yeah. It was with kik
lol
@proven escarp it worked
congrats!
nice, I highly discourage templating <script> tags tho
like using files?
using a templating engine like ejs to change the content of the js you're running
it adds a ton of complexity to your js. If you need data available as soon as your js loads you should try rendering the days in a data-* attribute of a div and read it in the js code. That way you can keep your js organized, you can use build tools and allows for browsers and proxies like cloudflare to cache your js
oke
apparently app_commands doesn’t exist on discord property
I keep getting this error when trying to run my bot. No idea how to fix it, could anyone help?
Looks like a version mishap
Why do people use repl when they are on a pc
It can't be that hard to install their language/runtime of choice and vscode
for hosting "24/7" dummy
Yeah, with the discord version.
lmfao
It's very generic, and simple.
Yet it gets the job done well.
just get a vps or heroku or something
Sarcasm?
Ofc it is
ya think
No
Which version should I install?
I refuse to go near repl so I have no idea how it works
you use discord.py lib?
Appears so.
[[package]]
name = "discord"
version = "1.7.3"
description = "A mirror package for discord.py. Please install that instead."
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
"discord.py" = ">=1.7.3"
[[package]]
name = "discord.py"
version = "1.7.3"
description = "A Python wrapper for the Discord API"
category = "main"
optional = false
python-versions = ">=3.5.3"
That's the Discord package(s).
The main error is:
Because no versions of discord match >1.7.3,<2.0.0
and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
How would I fix?
I believe it is.
no, it's all on replit.
Nothing is on anything but replit
environment files
When the replit itself is the ide
Yeah
smh
well cant really help 
imagine if one day replit simply loses their projects or something happens to your account
always, always have backups
and at least one type of versioning
I know.
Sorry for the waste of time.
This is why most of my bots are in node.js
Fuck python, tbh
I've divorced python
wtf python pog
After 3 years of being married
Github
then the project isnt only on replit is it?
It's on github too.
I have the repo synced with the repl.
that's good
My dude
It’s probably not a good idea to check every time you search something
Imagine the latency it adds
cough pihole cough
pihole is a system not some hardware
You can install it on any Linux platform
If so this makes your statement above pointless
Bots already do that
No point cluttering up Alex’s API with browser requests
Plus safe browsing flags them up now
Just report them there ig
Sent in dms
It depends.
When creating slash commands globally, it can take up to an hour to be received by everyone.
When creating slash commands for a specific guild, it's instant.
So if you're testing your commands, for example, it's a good idea to create them locally, then publish them globally when finished.
nah they sync instant now
Not always.
They’re usually pretty fast globally, but it’s better to use guild specific commands for testing as you can guarantee they show up instantly
Global commands can also take up to an hour to update for Android users.
Must be sad to be an android user
not only because you’re using android

Okay at least we can download our own music
anyone good with css here? i have a verry simple question
Don't ask to ask
Just ask your question anyone who can answer will come along and do so
well, my idea was to make like blured linear-gradient background in the website, but dk what would be best practice for that
specialy for blur part
bcz use of backdrop-filter: blur(); is not really practical since its goona make website laggy
I don't know of any other way than to use backdrop-filter
hm i got idea to use like glass effect only instead of backfrop-filter
Very confused of why
I want to map the keys to its correct value type
create a div
And make if fixed
set z index to -6969
apply filter: blur()
done
wait fixed won't probably work with z index
that will only blur the div
not the things behind it
hence why backdrop-filter is named backdrop-filter
Anyone here can help me with jda?
Don't ask to ask
Ask your actual question and someone who knows the answer will eventually give it
Okayy
do you know what to do if I want a music bot to leave vc if it didn’t play any tracks for a specific time?
I code using java jda
he wanted a blurred "background" If I remember correctly
also Firefox doesn't support backdrop blur()
unless they charge it manually in setting
ah
yeah i know about the firefox issue struggled with it too
just dropped backdrop filter from my design altogether
Is there a way to test server level stuff without buying Nitro myself? That would be weird, paying Discord for Nitro so they can profit from our bots
Want to test a little bit with private threads
Does anyone know how gamedig accesses the player names and playtimes on the csgo server?
By using the Steam API and collecting informations about the Steam account
There are different endpoint you need to send requests to and combine the the data
The name is always the current Steam profile name as there’s no separate name selecting in csgo
cookie-parser probably
Pinger Bot work
I mean, headers are supposed to be unique, if you need to add more than one value separate with ;
actually they're not
yep
you should be able to represent repeated headers as comma separated values but duplicate keys are allowed. That's why the Header object in js isn't a map but a different data type that allows both .set and .append
But how do u retrieve them then?
Like, u can't retrieve by name if there are duplicates
they get combined with commas as per the spec
So in the end it still doesn't allow duplicates
Not talking abt language-specific choices
it definitely does
you can either have
Accept: application/json
Accept: text/html
or
Accept: application/json, text/html
they are interchangable
But it always end up merged into a single entry
iirc some node libraries keep headers as an array if there's more than 1 key
I think that's just a matter of convenience for string based indexing
Also OP is using C# not JS
yeah but you have the same problem in different languages
it's easier to use a hashmap with a combined value to represent repeated headers
I wouldn't be surprised if even nginx does the same thing
you can't mix the order of repeated headers but you can mix the order unique headers appear in so it's kinda the perfect data structure for representing that constraint
Is it normal that my Slash Commands arent registered yet? i ran the
Python3 with py-cord -->
await bot.register_commands()
24h ago..but the Slash commands arent and i invited the bot with scopes on my Testserver more then 26h ago....
Fetch all application commands to see if they’re registered
Are u creating the commands to begin with?
i have created them. in the docs it read like, if i keep the function emtpy it fetches it by itself and registers its....still dont know how register them....
Well, I can't comment much on pycord since I never used it, but it's probably not finding the commands
yeah and now i'm trying around to find something out...like the guild id's has to be snowflakes (didnt knew that from the docs)
in some parts of the api its okay if i just use the id as int...in other parts i need the snowflake
...as int?
and its just annoying if its not even written down as snowflake or int
await fetch_guild(guild_id, /, *, with_counts=True)
Ah yes, python uses int for all natural types
guild_id (int) – The guild’s ID to fetch from.
and its not written down in register_commands like that^^ just optional{int] but if i run it with an int..i get an Error because its not a Snowflake xD
ok so i have this
when it runs, it doesnt create the document in the database for some reason
anyone knows whats causing this
ahh its a file for mongodb
Did u check whether it's entering that if clause?
nope but i will
does anyone want to partner up to create a discord bot? If so DM me
Not the place to ask
What?
You could read how they do it and come with your own implementation
Shouldn't be too hard
ant phish advanced
You seems to be using mongoose, shouldn't you use new before creating a new document?
like new rpData?
What's the error btw
Its not anywhere on this line bruh
different error
What is getAuthor
message.mentions.users.forEach(async member => {
array.push(`**${member.username}**`)
idArray.push(`${member.id}`)
const checkUser = await rpData.findOne({user: member.id, type: commandName})
if(!checkUser) {
new rpData({
user: member.id,
type: commandName,
sent: 0,
recieved: 0
}).save()
}
const updateUser = await rpData.findOneAndUpdate({user: member.id, type: commandName}, {$inc: {recieved: 1}})
})
const getAuthor = await rpData.findOne({user: message.author.id, type: commandName})
let getUser = await rpData.findOne({user: idArray[0] , type: commandName})```
If its a function then you need to call it first
getAuthor is null
Or the author?
no getUSer is null
Its coming from <*>.sent but i don't know which one
From this error
Oh wait author.sent is a string, so i guess its getAuthor
ig? it could be user too
.setFooter(text.footer.other[0].replace('{username}', message.mentions.users.first().username).replace('{username.sent}', getUser.sent).replace('{username.recieved}', getUser.recieved).replace('{author}', message.author.username).replace('{author.recieved}', getAuthor.recieved).replace('{author.sent}', getAuthor.sent))
thats the whole line of code
well i don't know, i only see getAuthor.sent in here
Oh wait
Yea might be
How can I avoid this conflict?
lol what'ss going on here?
module.exports = {
name: "help",
inVc: true,
sameVc: true,
player: true,
run: async (client, message) => {
const embed = new MessageEmbed()
.setColor("#5D3FD3")
.setTitle('DroxZ Music Commands')
.setDescription(`p!join - joins vc
p!loop - loops song or queue
p!play - plays a song
p!queue shows queue
p!remove - removes song from queue
p!pause - pauses song
p!resume - resumes song
p!stop - stops music and clears queue
p!ping - checks ping
p!volume - changes volume`)
.setFooter(`${client.user.username} `, client.user.displayAvatarURL());
message.channel.send({ embeds: [ embed ] });
}
}```
no error my bot just isnt responding but it responds to other commands
any thoughts?
confirm that the command is getting executed
and await your async methods
you can't know if there's an error if you let it silently fail
console log throughout the command itself. Just see if it's stopping anywhere or if it's not seeing it at all 
im new with coding in general how do you do that
you could use something like https://www.npmjs.com/package/console-table-printer
ok
forgot to remove inVc: true, sameVc: true, player: true,
works now
use a modified nerd font for the icons 😔
:(
i don't recommend it
😔
also @spark flint did you get a macbook after all?
probably gonna try get hackintosh on my laptop lmao
i can't afford a macbook rn
why 
:pat:
boolean can be true, false or undefined
if (antiscam === true) {}
else if (antiscam === false) {}
else {}
I kinda hate the way js has undefined
Almost finished with adding esm support for my hot reloader. Been tricky since I have to update all of my Error stack frame regular expressions to support file:// urls. Then the magic gets to happen
Kinda painful tbh. I already had a really good base from cjs, so not too horrible, but this has been the first time I've ever used esm
you just need the antiscam data from the DB
I would have cried if I had to do jank stuff like wrapping it all through eval
After it’s released I could try to make a PR to detritus to get it to work with it hopefully 🙏
2 dependencies isn’t too bad
I mean. What they offer is kinda cool imo. I kinda feel like backtracker is underrated, but I made it so like. Kinda biased
null and undefined. because two bottom values are needed /s
js has some interesting choices
Rust is based with no null and no undefined
That’s one of my favorite things about rust
what is undefined then
Wdym
what would take its place
Oh None type
Very easy for pattern matching
well, the problem is that a json can include null and undefined
I believe that serde has its own undefined and null
And it converts to None (Maybe? No idea, never used it)
i just dont use null. js uses undefined so i use that too
That would kinda be dumb since you can't assume those things if the data is sensitive
Ah yes this is what serde does
i mean when i build something.
nope, you need to load the data from mongo db
look around the code to find where it's inserted
Hey, I would really love an answer so please answer this
So I have a chrome extension but I keep getting this error Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
and this
Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
How can I fix it?
This is the current content sec policy for manifest json. It's for version 3
"default-src": "'none'",
"script-src": "'self' 'unsafe-eval'",
"style-src": "'self' 'unsafe-inline'"
},```
I've been trying to work this for quite some time now so again, I would really love an answer
Hello, a simple question
anyone know how to edit the last message sent by the bot?
store the message in a variable and then use <Message>.edit()
how to store this specific message?
const myMessage = await message.channel.send('something'); or anything that returns a Message object
any idea why i cant ungzip these files with my node code?
const fs = require('fs');
const globby = require('globby');
const {ungzip} = require('node-gzip');
const {unmarshall} = require("@aws-sdk/util-dynamodb");
const migrateData = async () => {
const historyFilePaths = await globby('./data/history/*');
console.log(historyFilePaths);
const historyZipped = historyFilePaths.map(filePath => fs.readFileSync(filePath, 'utf-8'));
console.log(historyZipped[0].substring(0, 20))
const historyUnzippedData = await Promise.all(historyZipped.map(zippedData => ungzip(zippedData)));
console.log(historyUnzippedData[0])
const historyData = historyUnzippedData.reduce((acc, data) => [
...acc,
...data
.split("\n")
.map(line => unmarshall(line))
], []);
historyData.sort((a,b) => b.recordedAt - a.recordedAt);
console.log(historyData[0]);
}
migrateData();
wasnt talking to you
hi
Just add a field with that info in it
?
Just jsonResponse.matches[0].fieldName
i needed to change utf-8 to binary
What? That is literally the example of how to get those fields…
What
Why not just use data in the first place
I didn’t know what the name of your variable was so I just put that as a placeholder
ay stealin my code
oh and for that
const antiscamembed = new MessageEmbed()
.setTitle(`${<jsonobject>.matches[0].type} Link Deleted!`)
.setDescription(`${message.author}, you can't send ${<jsonobject>.matches[0].type} links!`)
.addField("Advanced - Matched domains", data.matches[0].domain)
message.channel.send({ embeds: [antiscamembed] });```
- its not just PHISHING its IP_LOGGER too
- its embeds not embed
you got a open source phishing thingy?
do you mind if I use it?
its not open source but https://anti.fish is great
smh thundxr
its really really fast
and most bots use the same database
I'm not quite sure if I can integrate it if I'm certain it won't just randomly rate limit / break / go down :/
or if you want to regex match or manually cache domains yourself, https://phish.sinking.yachts
oh dw about ratelimits
there are no ratelimits
and it is hosted on an edge network so won't go down
its hosted on 4/5 different vps servers
@spare karma uses it
infact its by the owner
so how does it work?
if ((?:[A-z0-9](?:[A-z0-9-]{0,61}[A-z0-9])?\.)+[A-z0-9][A-z0-9-]{0,61}[A-z0-9])
// do something?
can u send the index.js file of that package?
I'm not going to steal anything just wanna see how it works
Just look at the repository
lol love the class name
Oh God, it even uses Axios
is that good or bad?
volt you on phone?
dam
Axios is generally avoided by most projects, because it's not following our WHATWG fetch specification properly, and adds a shit ton of bloat
if someone has an android phone can they test responsiveness of this: https://beta.loom4k.me
(no ads it's complete garbage site don't go on it because i said so)
It's either recommended to use undici or node-fetch
antiFish
I'll rewrite the thing myself and I'll use node-fetch 
antiScam
also WHY are you using strings for true/false?????
thats so bad
false
"false"```
just do false
false!
Oh my God
it doesn't really matter I can do
true === "true" //true
that's what i needed... thanks <3
yo question
you can’t send PHISHING links! Stands out
What the hell is this button click aftereffect
I wonder how I'll code it
Why not make it lowercase
thats just the response from the API
i am running an interval function, it sends a message for multiple channels, how can i do that with storing channels id in a database and running just 1 line of code. (without running into errors if bot was removed from one of the servers)
Ik
PHISHING
IP_LOGGER
Why not lowercase it in the title 😦
I'll send the entire script after I finish
anyone know how i can do that?
Description*
whoaaaaaa
oh boy
What the heck do my eyes see
😹
wait until Thundxr adds phishgg and steals that embed too
Since you're sending the same message to the channels, you'd just need to store the channel IDs, pull them, then for each channel (in a loop) do that single send.
ran into problems with that
There's probably a way for you to send the message without fetching the channel beforehand as well (at least without touching the raw API).
@proven escarp the menu on the website also doesn't expand when you're not at the very top of the page, even if you scroll down a little bit
So I have a chrome extension but I keep getting this error Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
and this
Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
How can I fix it?
This is the current content sec policy for manifest json. It's for version 3
"default-src": "'none'",
"script-src": "'self' 'unsafe-eval'",
"style-src": "'self' 'unsafe-inline'"
},```
reposted this message since there are more people in this channel now
cuz atm lets say bot was removed from golden dao, bot wont send messages for the servers under
The message would fail to send and you'd get an error if that happened.
Makes sense to delete the link but still mention the invite code you can use in the embed 
You seem to already be handling errors, but not in a safe manner currently
i love how bad these domains are getting
trueee
i should remove from the public embed and keep in the logging embed
Imagine deleting someone’s graphic message attachment then publicly shaming him and telling him he’s not allowed to send this picture (attaching it to your message)
that is a good idea /j
automod that screams at you in all caps if you scream at it in all caps
use discords built in automod stuff yw
Or simply use moderators if things are escalating and let people fucking write what they want unless things aren’t escalating
AutoMod that moderates your grammar, if your grammar is incorrect even in the slightest, you get muted
Lmfao
almost finished
^ this though
Missed a dot at the end > muted!
I fucking hate automods
It’s so annoying to not know what I’m allowed to type or not
Just have it in the rules and then don’t use an automod
I’ve been in servers where you’re not allowed to type “stupid”
I don’t get this weird censor ship bullshit
I understand it for slurs and stuff but cmon
Swearing is perfectly fine as long as you’re not being derogatory
Trying to block bad words in discord then throwing them around in your school
Or daily life
True
It’s perfectly fine to have an automod to block extreme shit like slurs and such, but anything more than that and I start to wonder why you’re not just having a moderation team
I straight up got a 15 minute mute for typing “skill issue” one time
Lmfao
It’s called nonsense
It’s called venting
Funny thing is that I looked at the chat logs for a moderator and they said skill issue like 200 times
Have you vented before
@spark flint @covert gale can you help me with the embed?
how should I structure it?
I don't know how to grab the values can u show me how?
Y’all gotta start making your own things
i love how everyone is adding the same thing
If everyone has the same embed that’s just stupid
Nope have never being stuck in a vent so far 
literally this
i don't get why thundxr is copying my embeds
result.matches[0].type for the type btw
So how would you know about venting, if you never done it
I suppose they just don't know how to do it in a different way
I don’t see why people would be literally asking the creator of the original thing on how to completely copy their design for their own bot 💀
But you're FakE
Clearly you've vented before
educational purposes?
Is that an Among Us reference?
sus
You’re suspicious Sir, I’m not
Your name is
slim sussy
Fake is probably flying a plane rn
just wanna know how to get the trust rating etc.
No I’m parking at a gas station
I found FakE's motorcycle
correction: drunk flying a plane rn whilst texting
lol
throwback to when i owned anti.fish domain
Literally factual information (the motorcycles)

that's not a documentation but okay
https://pastebin.com/8TpbaEFr here is the code if anyone wants it (haven't tested)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
does anyone have a phishing URL I can test the thing on?
ERROR Unhandled rejection: FetchError: invalid json response body at https://anti-fish.bitflow.dev/check reason: Unexpected token < in JSON at position 1
seems like something is wrong?
can anyone take a look at the code?
hey, how can i not let the bot go offline if it cant find the channel?
you didnt include the user agent header
.get(x)?.send
I thought that was optional..
Headers: Please include a User-Agent header in format Application-Name (Application-Link)!
multiple channels ids stored in a var channels = []
?. is a shortcut for checking if the thing before exists and not proceed if it doesnt
ah, let me try it really quick
bruh I done it twice 😭
a.b = error if a doesnt exist
a?.b = does not error
I accidentally pasted messageCreate to messageDelete event and now I gotta rewrite everything
😭
@quartz kindle 🐐 thanks sir
at /home/container/node_modules/node-fetch/lib/index.js:273:32
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async module.exports (/home/container/events/messageCreate.js:36:28) {
type: 'invalid-json'
}
any ideas?
console.log tje response as text instead of json, that way you can see the problem
replace the .json() with .text()
then do I catch it or leave it like this?
the text version wont error
but its just for logging
well you can do json.parse manually afterwards
instead of using fetchs .json()
That’s called multi talented
are you sending application/json as content type
what do you mean?
const response = await fetch('https://anti-fish.bitflow.dev/check', {
method: 'POST',
body: JSON.stringify({ message: message.content }),
headers: {
"User-Agent":"Blacklister - https://blacklister.xyz",
'Content-Type': 'application/json'
}
});
const data = await response.json()```
thats what I do
TypeError: Cannot read properties of undefined (reading '0')
at module.exports (/home/container/events/messageCreate.js:76:76)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
``` @quartz kindle
let me try that instead then
then there was probably no match
if (!<response>.match) return
thanks. im going to fix that when i have some time
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
no error but the bot doesn't respond
whenever you get an invalid json response body, there is likely a text error the service is sending you as the response, so its very useful to log it ```js
const response = await fetch(...)
const text = await response.text()
let json;
try {
json = JSON.parse(text);
} catch(e) {
console.log(text);
return;
}
does that still apply in the updated code?
there is no error anymore
thats not what i said
i said using the text() method and a manual JSON.parse() is an alternative to using .json()
you cannot use both .text() and .json() at once
I'm not though??
yeah but I'm asking what the problem is, I fully understand what you're telling me
you asked if it does still apply to the code you sent
and i answered that is an alternative to what you did in your code
and that you cant use both methods at once, you have to chose one
if you have no response, console.log the json
for response var: [object Response]
for data var: [object Object]
you need to console.log them, not send them to discord
I am console logging them. lol
if you really want to send them to discord, you have to JSON.stringify
you cant do response + data lol
why is that?
that will try to use string concatenation, will convert both to string and then join them
like "a" + "b" = "ab"
oh ic
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: true,
error: null
},
[Symbol(Response internals)]: {
url: 'https://anti-fish.bitflow.dev/check',
status: 404,
statusText: 'Not Found',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
{ match: false }
sooo
also, the reason i mentioned the text() method, is for you to have access to the text response, the way you did it you are throwing it away
the response was match: false
so there was no match
yeah but they said discord.gg if flagged automatically
have they lied then?





