#development

1 messages · Page 2070 of 1

boreal iron
#

But at the end there are always methods around to get the raw data for example like in your case where methods or handlings for new features are missing

#

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

wheat mesa
#

I don't believe I can access the raw object

boreal iron
#

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

wheat mesa
#

I can find the components, but I can't seem to find the values

boreal iron
#

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

wheat mesa
#

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

boreal iron
#

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

wheat mesa
#

I'll look into it in a minute'

#

Never really worked with the raw api before

boreal iron
#

Like the customId and value etc

wheat mesa
#

That and I'm still not entirely sure how detritus parses the data into structures

boreal iron
#

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

wheat mesa
#

It's detritus

#

And cake is the sole maintainer at this point, so idk how long it would take for it to be added

boreal iron
#

Read carefully what I wrote dingus

#

I didn’t write djs

wheat mesa
#

Whatever same same

boreal iron
boreal iron
boreal iron
#

Time to switch to djs then, Waffle

#

Or better without lib directly to using php

wheat mesa
#

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

crystal wigeon
#

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

round cove
#

You can't do transitions with none in terms of display. Assuming you're messing with display: none as well

crystal wigeon
#
    .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

wheat mesa
#

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;
}
}

sick agate
#

why

wheat mesa
#

why bother using return types when you can just throw instead!

round cove
#

I'm more bothered by the space semicolon

wheat mesa
#

ignore that

#

it's 2am

rigid maple
#

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

round cove
#

Appears visually or...

rigid maple
round cove
#

doesn't look like it redirected to /auth

rigid maple
#

yes, that's the problem

round cove
#

oh lmao

rigid maple
#

normally it should

round cove
#

Is your mongo find not firing?

#

So you said it DOES log b?

rigid maple
#

Doesn't log "asd" on line 557 either

round cove
#

you worded this so poorly at the start

rigid maple
#

sorry

#

It doesn't even log "asd" on line 557 without going down to mongo side

round cove
#

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?

rigid maple
#

yes, i use the same for twitch but only this part is the problem

round cove
#

is the callback_url_discord the correct string?

rigid maple
#

oh i think i figured it out

round cove
#

What was it?

rigid maple
#

i couldn't figure it out :D

opaque acorn
#

what ide do you recommend?

slender wagon
#

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?

sudden geyser
#

Element with the ID could possibly not exist in the dom

slender wagon
#

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

ancient nova
#
$("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

vivid fulcrum
#

jquery is bloat

#

modern day web development achieved everything jquery tried to polyfill back in the day

boreal iron
#

also "bloat" is a relative opinion

woeful pike
#

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

foggy coral
#

python:

does someone of you know how i could turn my discord.Client class into a discord.Bot class without rewriting my whole bot?

boreal iron
#

discord.Bot = discord.Client

foggy coral
#

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
boreal iron
#

then open all files and use search and replace to replace bot. by client.

foggy coral
#

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....

surreal sage
#

What's the discord webhook url made out of?

#

Talking about (webhooks/)bunchofnumbershere/token?

#

I would like names smiledog

boreal iron
#

just the webhook id / token

slender wagon
#

can i use a "load" event listener on a button

boreal iron
#

explain what u wanna do, please

slender wagon
#

finished

boreal iron
slender wagon
#

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

boreal iron
#

oh you mean js

slender wagon
#

yes

boreal iron
#

was already wondering

#

you can use the preventDefault() method on the triggered event

#

for example when hitting a button

#

to supress the default action

lyric mountain
foggy coral
#

they could turn bot into a superclass aswell 😉

lyric mountain
#

They couldn't

#

Because q superclass needs to conform to its childs

#

Discord has 2 types of client: bot and user

foggy coral
#

yeah but selfbotting is not allowed, so client and bot is for bots

lyric mountain
#

No, bot is for bot, client is for bots and users

#

It's not allowed by discord, but the api is there

foggy coral
#

but selfbotting is not allowed^^ and so client is also for bots as bot

lyric mountain
#

...are u blind? It's not allowed, doesn't mean it doesn't exists

foggy coral
#

i know, it exists

lyric mountain
#

That's why client is for both

foggy coral
#

but why are they creating it in the first place^^

lyric mountain
#

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

foggy coral
#

still sad that i have to rewrite my bot because of that shit 😦

wooden ember
#

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

lament rock
#

My plan was perfect

solemn latch
#

🤔 just set your type to module

near stratus
#

Use typescript and let it handle everything

wheat mesa
#

He’s trying to hot reload esm modules

lament rock
#

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

wheat mesa
#

Somebody in the detritus server said they found a way to bust the cache

solemn latch
#

👀

lament rock
#

Really? I need this info

wheat mesa
boreal iron
#

would consider calling an async function without await bad behavior? idk need to await my sql action but wanna return a boolean instantly

lament rock
#

if you don't need to wait, then don't

wheat mesa
#

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

boreal iron
#

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

lament rock
#

Then don't worry about async

boreal iron
#

and it doesn't return <promise pending> ?

lament rock
#

if the function isn't async and doesn't return a Promise.resolve(item) or Promise.reject(item), then you should be good

boreal iron
#

alr, thanks

lament rock
#

oh also can't return an async function call

boreal iron
#

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>?

lament rock
#

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

boreal iron
#

because it's not an async function

#

got it

#

👍

wheat mesa
#

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

boreal iron
#

I really, really, really hope other field types will be implemented to modals soon

wheat mesa
#

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

boreal iron
#

as well as a datepicker and small QOL fields (like the today announces min_length and max_length field for components and command options)

wheat mesa
#

What does min_length and max_length do?

boreal iron
#

lol

wheat mesa
#

Oh for normal commands?

boreal iron
#

validating an inputs min and max length

#

for command options and components

wheat mesa
#

I thought you meant modals since those already existed for modals lol

#

But that's cool too

wheat mesa
#

I know that max_length exists for sure

#

Before then

boreal iron
#

wut really? got announced today

wheat mesa
#

100%, I have been using it for quite a while now

#

I was using it like 2 months ago

boreal iron
#

ah hmm, seems like I missed that

wheat mesa
#

this was committed February 14th

#

Worked perfectly fine for me

boreal iron
#

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

lament rock
#

My pain is immeasurable

/import (.+?) from (['"`])([^"'`]+)\2 ?a?s? ?([^ \/;]+)?/gsmu;
wheat mesa
#

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);
}

lament rock
#

query strings work? wtf???

wheat mesa
#

idk if it actually works or not ¯_(ツ)_/¯

lament rock
#

I'll stash my current changes and try that out

#

that way, I can avoid a TON of jank

wheat mesa
#

I read something about using this method online, but I never bothered with actually trying it

lament rock
#

I wonder if the cache gets duplicated or if it gets overwritten

wheat mesa
#

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

boreal iron
#

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

slender wagon
#
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

woeful pike
#

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

slender wagon
#

Yeah .call worked

boreal iron
#

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

earnest phoenix
#

how can i fix this

proven escarp
# earnest phoenix 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)

earnest phoenix
proven escarp
proven escarp
#

I believe this should work

#

@earnest phoenix did it work?

spark flint
#

@proven escarp too cute to work

proven escarp
spark flint
#

that would work

proven escarp
#

oh ok

#

:)

spark flint
#
await user.send("meow").catch(() => console.log("loomi too cute"));
earnest phoenix
proven escarp
boreal iron
#

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

wheat mesa
#

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

boreal iron
#

err like throwing an error inside catch?

#

sounds somehow weird to me, idk

wheat mesa
#

You could just not handle the error and let it propagate up to where it was called

boreal iron
#

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

quartz kindle
#

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

boreal iron
#

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

tulip terrace
#

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.
spark flint
#

iirc

#

isn't it target:discord.Member

#

or something

tulip terrace
#

yeah

spark flint
#

you just put Member

tulip terrace
#

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
eternal osprey
#
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?

wheat mesa
#

Maybe npm i canvas@latest or whatever the package name is?

eternal osprey
wheat mesa
#

I'd trust tim's advice more than mine, I'm just speculating tbh

eternal osprey
quartz kindle
#

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?

eternal osprey
quartz kindle
#

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

eternal osprey
#

Okay... i used the npm i canvas@latest and then, npm rebuild canvas --binary-update and it worked.

#

Sorry for wasting your time tim

quartz kindle
#

👍

eternal osprey
#

Thanks nontheless, waffles as well 🙂

lament rock
#

ESM's module loader fucking sucks

wheat mesa
#

I've been finding that out too!

lament rock
#

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

sharp saddle
#

I have a very annoying bug on my site.

I wanted it to be like this:

#

what actually happens:

proven escarp
sharp saddle
proven escarp
#

how

sharp saddle
#

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>`: ""}`)```
proven escarp
#

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

woeful pike
sharp saddle
proven escarp
woeful pike
#
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

proven escarp
#

@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 :((

oak cliff
#

we have upvote and downvote emotes yeah

proven escarp
#

:(

oak cliff
proven escarp
spark flint
#

Cat dance

stuck dawn
#

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.

proven escarp
#

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

stuck dawn
#

is there any other way? I don't really want to use libraries...

proven escarp
#

it’s certain there are other ways. but i don’t know any sadly 🤷‍♂️

stuck dawn
#

:(

#

if helps

woeful pike
#

use react contexts

stuck dawn
#

yes i am using that

wheat mesa
#

I personally use https://mantine.dev/ for react, it has a nice way to do light and dark modes/color schemes

sudden geyser
#

You could also just pass the state down as a parameter

stuck dawn
#

?

sudden geyser
#

Though I hear that can get messy quite quickly.

woeful pike
#

mantine kekw

wheat mesa
#

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

woeful pike
#

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

wheat mesa
#

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

lament rock
#

Activate Windows

wheat mesa
#

everybody says that

#

Never

sudden geyser
#

I'd rather just not stylize the site at all and let it look like something from 1970

rustic nova
#

government sites be living your vibe

sudden geyser
#

government sites have to look bad else residents complain that their nokia won't let them pay taxes

rustic nova
#

KEKW you pay taxes on your nokia? smh I do that through my nintendo 2ds

woeful pike
#

dutch government sites would like to have a word with u 👁️

eternal osprey
#
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):
woeful pike
#

id="library"

#

you're using a . for class

dense crescent
#

can i add a bot here?

woeful pike
#

also you're missing dots on all the other classes you're trying to find

dense crescent
#

invite to a bot ive made

#

can i?

#

😦

proven escarp
proven escarp
#

if so, no you cannot

eternal osprey
#

Yup it finally worked. It has hella white spaces tho. How could i remove that?

proven escarp
#

show some code maybe?

#

are you using <br />s?

wheat mesa
#

If they're on either side of the data, .trim()

raw nest
#

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.?

lament rock
#

Some names are trademarked. NPM doesn't allow duplicate names and "similar names" are also not allowed

raw nest
#

Is there a website I can check some names?

proven escarp
wheat mesa
#

Yeah, like lsaedmfkqwenfodkqhweiyhoi7wehfgiunweifhjnwe!

lament rock
#

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

raw nest
#

it's not just about npm it's in general a product name

wheat mesa
#

sorry buddy, HeatSync Labs is gonna sue you now

lament rock
#

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

wheat mesa
#

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

raw nest
#

I had a name idea, searched it up, it's a fcking village in slovenia probably noone knows about xD

lament rock
#

Welp

#

Run with it

raw nest
lament rock
#

Yeah ik

#

what was that drama that someone on npm had their package name taken away from them because a company wanted it

raw nest
#

idk 🤔

lament rock
#

oh yeah. It was with kik

raw nest
#

lol

sharp saddle
proven escarp
sharp saddle
#

thank you so much! @proven escarp

#

also @woeful pike

#

and i fixed the code

woeful pike
sharp saddle
woeful pike
#

using a templating engine like ejs to change the content of the js you're running

sharp saddle
#

oh

#

I do this a lot

woeful pike
#

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

sharp saddle
#

oke

outer zenith
#

im getting an error when im trying to import app_commands from discord.py :z

proven escarp
#

apparently app_commands doesn’t exist on discord property

dry imp
idle coral
#

I keep getting this error when trying to run my bot. No idea how to fix it, could anyone help?

sharp geyser
#

Looks like a version mishap

dry imp
#

replit sometimes does this kind of error for no reason

#

i forgot how i fixed it tho

sharp geyser
#

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

dry imp
#

for hosting "24/7" dummy

idle coral
idle coral
#

It's very generic, and simple.

#

Yet it gets the job done well.

sharp geyser
#

Oh yes sure looks like it does

proven escarp
idle coral
sharp geyser
#

Ofc it is

dry imp
#

ya think

idle coral
#

ya think

#

Well, could you help?

sharp geyser
#

No

idle coral
#

Which version should I install?

sharp geyser
#

I refuse to go near repl so I have no idea how it works

idle coral
#

Because no versions of discord match >1.7.3,<2.0.0

#

So..

dry imp
idle coral
#

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?

dry imp
#

does it work on your own ide?

#

if so then it is replit issue

idle coral
idle coral
#

Nothing is on anything but replit

#

environment files

pale vessel
#

When the replit itself is the ide

idle coral
#

Yeah

dry imp
#

smh

idle coral
#

Lmfao

#

I'll ask replit support

dry imp
#

well cant really help TE_Shrug

lyric mountain
#

always, always have backups

#

and at least one type of versioning

idle coral
#

Sorry for the waste of time.

#

This is why most of my bots are in node.js

#

Fuck python, tbh

#

I've divorced python

dry imp
#

wtf python pog

idle coral
#

After 3 years of being married

idle coral
lyric mountain
#

then the project isnt only on replit is it?

idle coral
#

I have the repo synced with the repl.

lyric mountain
#

that's good

spark flint
#

My dude

#

It’s probably not a good idea to check every time you search something

#

Imagine the latency it adds

boreal iron
#

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

spark flint
#

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

grim bear
#

does slash commands instantly load in?

#

or does it take time

sudden geyser
#

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.

earnest phoenix
#

nah they sync instant now

wheat mesa
#

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

boreal iron
#

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

sharp geyser
#

Okay at least we can download our own music

earnest phoenix
fathom sonnet
#

anyone good with css here? i have a verry simple question

sharp geyser
#

Just ask your question anyone who can answer will come along and do so

fathom sonnet
#

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

sharp geyser
#

I don't know of any other way than to use backdrop-filter

fathom sonnet
#

hm i got idea to use like glass effect only instead of backfrop-filter

sharp geyser
#

Very confused of why

rocky hearth
#

I want to map the keys to its correct value type

near stratus
#

wait fixed won't probably work with z index

vivid fulcrum
#

that will only blur the div

#

not the things behind it

#

hence why backdrop-filter is named backdrop-filter

dense crescent
#

Anyone here can help me with jda?

sharp geyser
#

Don't ask to ask

#

Ask your actual question and someone who knows the answer will eventually give it

dense crescent
#

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

near stratus
vivid fulcrum
#

ah

#

yeah i know about the firefox issue struggled with it too

#

just dropped backdrop filter from my design altogether

nocturne grove
#

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

rigid maple
#

Does anyone know how gamedig accesses the player names and playtimes on the csgo server?

boreal iron
#

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

woeful pike
#

cookie-parser probably

sick agate
#

i think you only need to get the whole cookie header

#

or nvm my bad

woeful pike
#

yea

#

wait is this C# or js lol

urban turret
#

Pinger Bot work

lyric mountain
#

I mean, headers are supposed to be unique, if you need to add more than one value separate with ;

woeful pike
#

actually they're not

near stratus
woeful pike
#

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

lyric mountain
#

Like, u can't retrieve by name if there are duplicates

woeful pike
#

they get combined with commas as per the spec

lyric mountain
#

So in the end it still doesn't allow duplicates

woeful pike
lyric mountain
#

Not talking abt language-specific choices

woeful pike
#

it definitely does

#

you can either have

Accept: application/json
Accept: text/html

or

Accept: application/json, text/html

they are interchangable

lyric mountain
#

But it always end up merged into a single entry

woeful pike
#

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

lyric mountain
#

Also OP is using C# not JS

woeful pike
#

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

foggy coral
#

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....

boreal iron
#

Fetch all application commands to see if they’re registered

foggy coral
#

okay, all of them returned "None"

#

now i'm trying to figure out why

lyric mountain
#

Are u creating the commands to begin with?

foggy coral
#

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....

lyric mountain
#

Well, I can't comment much on pycord since I never used it, but it's probably not finding the commands

foggy coral
#

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)

lyric mountain
#

All ids are snowflakes

#

At least regarding discord

foggy coral
#

in some parts of the api its okay if i just use the id as int...in other parts i need the snowflake

lyric mountain
#

...as int?

foggy coral
#

and its just annoying if its not even written down as snowflake or int

#

await fetch_guild(guild_id, /, *, with_counts=True)

lyric mountain
#

Ah yes, python uses int for all natural types

foggy coral
#

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

earnest phoenix
#

ok so i have this
when it runs, it doesnt create the document in the database for some reason

#

anyone knows whats causing this

lyric mountain
#

What is rpData?

#

Also, u don't need to check if null

#

Just if (!checkUser)

earnest phoenix
lyric mountain
#

Did u check whether it's entering that if clause?

earnest phoenix
#

nope but i will

tribal gazelle
#

does anyone want to partner up to create a discord bot? If so DM me

lyric mountain
#

Not the place to ask

earnest phoenix
#

but i cannot use it?

lyric mountain
#

You could read how they do it and come with your own implementation

#

Shouldn't be too hard

sick agate
#

ant phish advanced

earnest phoenix
#

idk

#

sorry i am tired

sacred aurora
earnest phoenix
#

like new rpData?

sacred aurora
#

new rpData({...})

#

Yeah

earnest phoenix
#

ohh alright

#

i forgot

#

i still got the same error

sacred aurora
#

What's the error btw

earnest phoenix
#

when its after new rpData...

sacred aurora
#

different error

#

What is getAuthor

earnest phoenix
#
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})```
sacred aurora
#

If its a function then you need to call it first

#

getAuthor is null

#

Or the author?

earnest phoenix
#

no getUSer is null

sacred aurora
#

Its coming from <*>.sent but i don't know which one

sacred aurora
#

Oh wait author.sent is a string, so i guess its getAuthor

earnest phoenix
#

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

sacred aurora
#

Oh wait

#

Yea might be

sharp saddle
sharp saddle
#

idfk

#

lmao

snow vector
#

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?

vivid fulcrum
#

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

snow vector
#

everything is working i think it sjust not responding

craggy pine
#

console log throughout the command itself. Just see if it's stopping anywhere or if it's not seeing it at all shrug

snow vector
#

im new with coding in general how do you do that

spark flint
#
snow vector
#

ok

spark flint
#

i just got it working

#

green if success, red if error

snow vector
#

works now

proven escarp
spark flint
#

smhh

#

i ditched that packag

#

broke my bot

proven escarp
#

:(

spark flint
#

i don't recommend it

proven escarp
#

😔

spark flint
proven escarp
#

also @spark flint did you get a macbook after all?

spark flint
#

not yet

#

i'm getting a new phone tho!

proven escarp
#

:(

#

eva on unix wen

#

:(

spark flint
#

probably gonna try get hackintosh on my laptop lmao

proven escarp
#

wtf

#

stinky!!!

spark flint
#

i can't afford a macbook rn

proven escarp
spark flint
#

why wah

proven escarp
proven lantern
#

boolean can be true, false or undefined

#
if (antiscam === true) {}
else if (antiscam === false) {}
else {}
wheat mesa
#

I kinda hate the way js has undefined

lament rock
#

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

wheat mesa
#

How’s it going?

#

Been hell?

lament rock
#

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

proven lantern
#

you just need the antiscam data from the DB

lament rock
#

I would have cried if I had to do jank stuff like wrapping it all through eval

wheat mesa
lament rock
#

2 new dependencies would be added. backtracker and heatsync

#

heatsync
L backtracker

wheat mesa
#

2 dependencies isn’t too bad

lament rock
#

I mean. What they offer is kinda cool imo. I kinda feel like backtracker is underrated, but I made it so like. Kinda biased

proven lantern
#

js has some interesting choices

wheat mesa
#

Rust is based with no null and no undefined

#

That’s one of my favorite things about rust

lament rock
#

what is undefined then

wheat mesa
#

Wdym

lament rock
#

what would take its place

wheat mesa
#

Rust has Option<T>

#

Aka Some(T) and None

lament rock
#

Oh None type

wheat mesa
#

Very easy for pattern matching

lament rock
#

Guess its JSON support will suck

#

custom types

#

or just None

wheat mesa
#

I’ve heard serde json is really easy to use

#

Macros are really powerful for rust

lament rock
#

well, the problem is that a json can include null and undefined

wheat mesa
#

I believe that serde has its own undefined and null

#

And it converts to None (Maybe? No idea, never used it)

proven lantern
lament rock
#

That would kinda be dumb since you can't assume those things if the data is sensitive

wheat mesa
#

Ah yes this is what serde does

proven lantern
proven lantern
#

nope, you need to load the data from mongo db

#

look around the code to find where it's inserted

earnest phoenix
#

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

dense crescent
#

Hello, a simple question

#

anyone know how to edit the last message sent by the bot?

wheat mesa
#

store the message in a variable and then use <Message>.edit()

dense crescent
#

how to store this specific message?

wheat mesa
#

const myMessage = await message.channel.send('something'); or anything that returns a Message object

dense crescent
#

in java please?

#

doesnt work like that in java

wheat mesa
#

Java? Never used JDA. Not sure

#

I'm sure it's a similar way though

dense crescent
#

im trying

#

thank you tho!

proven lantern
#

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();
lament rock
proven lantern
lament rock
#

hi

#

bye. Gotta get back to work

wheat mesa
#

Just add a field with that info in it

wheat mesa
#

Just jsonResponse.matches[0].fieldName

proven lantern
wheat mesa
#

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

spark flint
#

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] });```
#
  1. its not just PHISHING its IP_LOGGER too
  2. its embeds not embed
ancient nova
#

do you mind if I use it?

spark flint
#

smh thundxr

#

its really really fast

#

and most bots use the same database

ancient nova
#

I'm not quite sure if I can integrate it if I'm certain it won't just randomly rate limit / break / go down :/

spark flint
#

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

ancient nova
#

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

earnest phoenix
ancient nova
#

lol love the class name

earnest phoenix
#

Oh God, it even uses Axios

ancient nova
proven escarp
#

volt you on phone?

spark flint
#

no

proven escarp
#

dam

earnest phoenix
ancient nova
#

how would I name the feature

#

antiPhish seems kinda weird

proven escarp
#

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)

earnest phoenix
#

It's either recommended to use undici or node-fetch

spark flint
#

antiFish

ancient nova
spark flint
#

antiScam

proven escarp
spark flint
#

also WHY are you using strings for true/false?????

#

thats so bad

#
false
"false"```
#

just do false

proven escarp
#

lmao

#

faIse

#

tricked

spark flint
#

false!

ancient nova
#

it doesn't really matter I can do
true === "true" //true

proven escarp
winged linden
#

yo question

spark flint
#

LMAO thats just a copy of my embed??

wheat mesa
#

you can’t send PHISHING links! Stands out

earnest phoenix
ancient nova
#

I wonder how I'll code it

wheat mesa
#

Why not make it lowercase

spark flint
winged linden
#

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)

wheat mesa
#

Ik

spark flint
#

PHISHING
IP_LOGGER

wheat mesa
#

Why not lowercase it in the title 😦

ancient nova
#

I'll send the entire script after I finish

winged linden
wheat mesa
#

Description*

spark flint
boreal iron
#

What the heck do my eyes see

winged linden
spark flint
#

wait until Thundxr adds phishgg and steals that embed too

sudden geyser
sudden geyser
#

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).

earnest phoenix
#

@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

spark flint
#

yay

earnest phoenix
#

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
winged linden
sudden geyser
#

The message would fail to send and you'd get an error if that happened.

boreal iron
# spark flint

Makes sense to delete the link but still mention the invite code you can use in the embed notlikenoot

sudden geyser
#

You seem to already be handling errors, but not in a safe manner currently

spark flint
#

i love how bad these domains are getting

spark flint
#

i should remove from the public embed and keep in the logging embed

boreal iron
# spark flint trueee

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)

spark flint
#

that is a good idea /j

#

automod that screams at you in all caps if you scream at it in all caps

wheat mesa
#

use discords built in automod stuff yw

boreal iron
#

Or simply use moderators if things are escalating and let people fucking write what they want unless things aren’t escalating

earnest phoenix
#

AutoMod that moderates your grammar, if your grammar is incorrect even in the slightest, you get muted

wheat mesa
#

Lmfao

ancient nova
#

almost finished

spark flint
#

thanks for signing that off

#

-bun

boreal iron
wheat mesa
#

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

wheat mesa
#

I’ve been in servers where you’re not allowed to type “stupid”

boreal iron
wheat mesa
#

I understand it for slurs and stuff but cmon

#

Swearing is perfectly fine as long as you’re not being derogatory

boreal iron
#

Trying to block bad words in discord then throwing them around in your school

#

Or daily life

wheat mesa
#

It’s just a way to express yourself in a more exaggerated manner

#

It’s just annoying

boreal iron
#

True

wheat mesa
#

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

boreal iron
#

It’s called nonsense

fallen steppe
wheat mesa
#

Funny thing is that I looked at the chat logs for a moderator and they said skill issue like 200 times

fallen steppe
ancient nova
#

how should I structure it?

spark flint
#

however you want lmao

#

theres no specific way to structure the embed

ancient nova
#

I don't know how to grab the values can u show me how?

wheat mesa
#

Y’all gotta start making your own things

spark flint
#

i love how everyone is adding the same thing

wheat mesa
#

If everyone has the same embed that’s just stupid

boreal iron
spark flint
#

i don't get why thundxr is copying my embeds

#

result.matches[0].type for the type btw

fallen steppe
#

So how would you know about venting, if you never done it

earnest phoenix
spark flint
#

yeah

#

true

wheat mesa
#

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 💀

pale vessel
#

Clearly you've vented before

sudden geyser
#

educational purposes?

earnest phoenix
#

Is that an Among Us reference?

wheat mesa
#

sus

boreal iron
pale vessel
#

Your name is

wheat mesa
#

slim sussy

sudden geyser
#

dude will be showering and using discord at the same time

#

that's real suspect

wheat mesa
#

Fake is probably flying a plane rn

ancient nova
boreal iron
#

No I’m parking at a gas station

earnest phoenix
#

I found FakE's motorcycle

spark flint
#

correction: drunk flying a plane rn whilst texting

spark flint
boreal iron
spark flint
#

throwback to when i owned anti.fish domain

wheat mesa
#

Literally factual information (the motorcycles)

spark flint
ancient nova
#

.. where are the docs?

#

they aren't on the website

spark flint
#

they are

#

lmao

#

tells you what response stuff there is

ancient nova
#

where

#

either I'm blind or ur 🧢

spark flint
ancient nova
#

does anyone have a phishing URL I can test the thing on?

#

seems like something is wrong?

#

can anyone take a look at the code?

winged linden
#

hey, how can i not let the bot go offline if it cant find the channel?

quartz kindle
ancient nova
quartz kindle
winged linden
quartz kindle
winged linden
ancient nova
#

bruh I done it twice 😭

quartz kindle
#

a.b = error if a doesnt exist
a?.b = does not error

ancient nova
#

I accidentally pasted messageCreate to messageDelete event and now I gotta rewrite everything

#

😭

winged linden
#

@quartz kindle 🐐 thanks sir

ancient nova
#
    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?

quartz kindle
#

console.log tje response as text instead of json, that way you can see the problem

#

replace the .json() with .text()

ancient nova
quartz kindle
#

the text version wont error

#

but its just for logging

#

well you can do json.parse manually afterwards

#

instead of using fetchs .json()

boreal iron
spark flint
ancient nova
spark flint
#
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

ancient nova
#
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
ancient nova
spark flint
#

if (!<response>.match) return

proven escarp
ancient nova
#

no error but the bot doesn't respond

quartz kindle
# ancient nova let me try that instead then

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;
}

ancient nova
#

there is no error anymore

quartz kindle
#

its an alternative to using response.json

#

you cant use both at once

ancient nova
#

I'm not

#

notice what I'm doing

#

I'm fetching, THEN doing response.json

quartz kindle
#

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

ancient nova
#

I'm not though??

quartz kindle
#

im not saying you are

#

im saying that the text method is an alternative

ancient nova
#

yeah but I'm asking what the problem is, I fully understand what you're telling me

quartz kindle
#

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

ancient nova
#

oh I see

#

do you know the issue though?

quartz kindle
#

if you have no response, console.log the json

ancient nova
quartz kindle
#

you need to console.log them, not send them to discord

ancient nova
quartz kindle
#

if you really want to send them to discord, you have to JSON.stringify

ancient nova
quartz kindle
#

you cant do response + data lol

ancient nova
#

why is that?

quartz kindle
#

that will try to use string concatenation, will convert both to string and then join them

#

like "a" + "b" = "ab"

ancient nova
#

oh ic

quartz kindle
#

use a comma

#

response, data

#

to log both things separately

ancient nova
# quartz kindle to log both things separately
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

quartz kindle
#

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

quartz kindle
#

so there was no match

ancient nova
#

have they lied then?

quartz kindle
#

i guess? i dont know

#

they have a test button in their website

ancient nova
#

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings ?

#
antiFishLog.addField("Trust", data.matches[0].trust_rating || "None", true);
#

how????

boreal iron
#

Make sure it’s a string not a number

#

The type matters