#development
1 messages Β· Page 2040 of 1
the request uses FormData, not json
topgg can't really confirm how many servers your bot is in so you can send whatever you want, that's not allowed though
oh yeah, totally possible. but we generally catch them quickly.
ohhh ic. tysm
bot invite urls include the estimated server count.
https://i.imgur.com/4cD0dP9.png
no, just manually checking works fine though
They should include a way to get the bots guilds tho I bet that'd be very resource intensive or just annoying to do
they should just expose the approximate count in the api
Ye
Got it to work! Tysm for your help:
let form = new URLSearchParams();
form.append('anime', query);
return axios.post(this.url + "/data/searchdata-test.php", form, { headers: { 'x-referer': this.url, 'user-agent': userAgent } }).then(res => {
return res;
}).catch(err => {
return err;
});
Even if they did that, I doubt we would use it, or only use it rarely.
that would be nice
currently they have no way of getting the count without connecting to the websocket
well they have a way
but its slow asf
Or at least not without breaking the TOS
Or just include a report button to report fake server count
@quartz kindle to make myself feel better about the email monopolies I will send all emails from gmail and outlook to spam
email spam is horrific though
the filters are so sensitive they block legitimate emails
google has a post on how to make your email not go to spam by doing some things such as setting up records which help to prove your domain is sending emails etc which does help
xD
at a point though I will run out of things to do because they are either paid or out of my control
there are also a shit ton of things Google tells you to do to "help" stop domain forgery
there is no set solution on stopping it
you can only try mitigate it
yall tried unreal engine 5? its dope!
discord needs to add a feature for embedding games in chat or something
like, they can already embed youtube videos, why not allow some specific game format to load as well π’
Correct SPF, DKIM, DMARC and RDNS records are essential to not be flagged as spam before any other filter
ue5 is indeed dope but my shitty mac wont be able to run it anyway
coding
HTTP requests to websites
What all should I include in my websocket stuff?
I am already handling errors, I am already doing heartbeat & identify
Can a Discord Bot create an invite link to a scheduled event?
resume?
already got resume as well
yes
they can create events too
Great!
I was able to find how to create an event eventually, but nowhere on how to get the bot to make a link for said event.
ah yes because an electron app that's already using way too many resources idling would definitely benefit from embedding a game engine π
even using something like webgl would definitely skyrocket the cpu usage beyond what would be considered acceptable
discord is more to blame than electron here tbh
the entirety of the client is heavily bloated and unoptimized
Sorry, what did you mean by this?
i mean i was gonna go check it out
Oh, okay. Thanks.
Discord uses a lot of high level and bloated libraries
my personal goal is to rid my bots' dependency tree of common bloat like lodash
every time i see lodash in a package: π
hey guys can someone help me with react i want to add js script for fetching json data in jsx component but i dont know how to do that
i have spf, dkim signatures and dmarc but not rdns
i contacted my hosting provider to see if they can do something
what kind of a script? what are you exactly trying to do
the question is too broad for you to get a concrete answer
fetch("./fotot.json")
.then((response) => response.json())
.then((data) => {
console.log(data.fotot.length);
for (let i = 0; i < data.fotot.length; i++) {
console.log([i]);```
I have never felt so satisfied
how many deps now?
just use it like you would normally, considering you're using react you're going to want to put that inside of the useEffect hook and create a state that gets updated when the fetch finishes
pass an empty array as the second argument to useEffect though
a few deps
otherwise the effect will re-run on every rerender
do you want to fetch while compiling the file? like in the server before the file is sent? or you want the fetch to work from the user's browser then the used loads the page?
I need to purge a few redundant deps
Almost all of them, I import and use though
i want to fetch to work from the users browsers used loads the page
i hate how complicated and annoying it is to setup api routes server-side and then implement handlers and requests client side
so unorganized
I need to learn how to routify
mvc in a nutshell
so it has to be inside a <script> tag and sent from the server as html
my website is static atm, so no need for routify yet, but will once I reimplement my bot's dashboard
so u mean i can put a script tag inside the jsx component
like in html
i dont see why not? doesnt jsx compile into html anyway?
the js in jsx is server side, used to help build the html
if you want browser side you need to put the code as a string in <script> tags
i dont even have a website
i need to make one tho
Github pages would be pretty easy
my bot's donation process is all done manually
and its such a hassle
i need to build a dashboard to handle payments and user customization
What's stopping me from doing that is simply; front end work sucks so badly
yup
it didnt work so painful
also my entire work is stuck while i dont finish my api
because everything depends on it
explain how it didnt work, like any error? logs? what is the behaviour you're seeing
https://github.com/AmandaDiscord/Amanda/tree/rewrite/source/website
this wasn't the most god awful thing to do. Can be seen here: https://amanda.moe
simple and straight to the point
oh and also
the domain i want for my bot
was taken
and expired on february
and its still not available for purchase
expired domains take like 3 months to return to the market
is giving me this error
put it all in one div or something
that's a heavy antipattern
you don't use script tags inside of react
the whole thing is a script already
rip

domain snipers
I guess the best thing to do is get a different tld
.moe was pretty cheap. $15 usd a year
import { useEffect } from 'react';
const useScript = url => {
useEffect(() => {
const script = document.createElement('script');
script.src = url;
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
}
}, [url]);
};
export default useScript;```
you mean like this
absolutely not
i mean
it's a way
however you should use the useEffect inside of your component
the actual one
and again
you don't use script tags
react is already a script
jsx compiles down to just javascript
everything in react is virtual
i know but this is what stack overflow gives me
im creating div's with images inside like instagram posts
they are file in site now
you can just require that then
there's absolutely no need to fetch something that exists locally already
require/import it and webpack will take care of it
but this fetch is creating div's by it self and creating posts with uniqe id and give links for every image
you don't mix and match vanilla js with react
pick one
using react you will have to follow react patterns
on what site? π
many online bidding services you can set a max bid, and it will auto bid above the next person below.
react has a virtual DOM, meaning you don't directly manipulate the contents of the website, react does beacause it programmatically stores what it needs to render
jsx is just an easier way to represent the virtual DOM
i understand but i still dont get it how i can fech json in react now
<Component /> is actually just React.createElement() under the hood
if it's a json file that's local, you just import it
sav.com
i dont see any option to do that
π someones cheating
can u give me a photo or part of code that can help me to understand more clearly that
i will not spoonfeed you
id give you a quick example but im on my phone
writing code is annoying on a mobile keyboard
oh i know that sorry i didnt know that
you might wanna read through this a bit though https://beta.reactjs.org/
the beta docs are extremely good
will definitely help you clear confusion about what react actually is
mmm thanks for that im going to see that thanks to much for your help
another tip i can give you is not to go hard on yourself with your first projects in react
you should start with something basic just to get the hang of it
doesn't matter if you'll use the thing you build or not
this is really my first project in react but i finish this project in html css and js and now i wanted to convert that in react
im more good in html css and js π π
i guessed so, you're shooting yourself in the foot by doing that though, react is definitely a feature rich framework that takes a bit of time to learn
you won't be able to port apps without knowing how react works first
also, here's a good video on how to avoid antipatterns once you familiarize yourself with state management and effects
π¨ IMPORTANT:
Learn React Today Course: https://courses.webdevsimplified.com/learn-react-today
Writing code is easy. Writing clean code, though, is much harder. In this video I take a look at three different React code examples from a beginner, intermediate, and advanced web developer. The goal of this is to show you how a senior developer will...
oh wow, the beta docs are really nice
I just started rewriting a site from scratch, might be a good time for me to learn myself.
thanks to much for all this stuff u gave to me i aprecciate that
π
im listening to your words nowπ
note to self, dont mess with tim
ah fuck wrong channel
my last bid was 12 bucks, which got insta-topped to 13 bucks by the same account as before
its just an empty threat tbh but it often works
xD
im glad! if you decide to continue using react you should definitely build more apps with it, it's a highly valuable skill in web development
i will learn to do that and im going to make that look easier for sure
ππ
sending this to the devs so they know that itβs an empty threat
C:<
i also have a friend who is my manager and im his manager π
i also have a restaurant and i can learn how to manage all work and peoples there so im still training for that
dick move
Circular dependency
lmao
Other than handling events fully I think I have done all I need with the gateway for now
user: {
verified: true,
username: 'Teamer',
mfa_enabled: true,
id: '961018771261231104',
flags: 0,
email: null,
discriminator: '1564',
bot: true,
avatar: null
}
Is this everything a user could have or is this just what discord can return for this user?
Cause discord's docs says a user object is a lot more than that
Unless there is only a certain amount you can get with the bot's token versus a bearers token
I am struggling what to add to my bot. I have a series of commands but feel like it needs more.
verified and email require oauth2 with the email scope
the rest is pretty much on a need to have basis, as they are all nullable
π€
ie banner will only be there if the user actually has a custom banner
Ah
I am wondering if I should set my author prop in the interface to be of type User (the class I made for users) or should i make an interface for the data it will have
Why is bot marked as nullable in the discord docs?
I thought it was sent no matter what
Ah this is helpful
well, its a boolean so, if its true its true, if anything else its implicitly false
in this case, if bot is false, its easier to simply not send it at all and save bandwidth
Mmm makes sense
but discord is known to be inconsistent
so you see things sometimes are null, other times are simply not sent
also avatar_decoration doesnt even exist in their docs
Yea
tf
export class Message extends BaseStructure {
public id: Snowflake;
public channelId: Snowflake;
public guildId?: Snowflake;
public author: User;
constructor(client: BaseClient, data: MessageDataOptions) {
super(client);
this.id = data.id;
this.channelId = data.channel_id;
this.guildId = data.guild_id;
this.author = new User(this.client, data.author);
}
}
export interface MessageDataOptions {
id: Snowflake;
channel_id: Snowflake;
guild_id?: Snowflake;
author: UserData;
content: string;
timestamp: string;
edited_timestamp: null | string;
tts: boolean;
mention_everyone: boolean;
embeds: [];
pinned: boolean;
type: MessageTypes;
}
Does this make sense to you tim? (Mainly talking about the user part)
My idea is, author would be of type UserData, and then i'd parse it into an actual user class instance when attaching it to the Message
yes thats that djs does
Mmm, I see
Message {
client: <ref *1> BaseClient {
_events: [Object: null prototype] {
ready: [Function: log],
debug: [Function: log],
messageCreate: [Function (anonymous)]
},
_eventsCount: 3,
_maxListeners: undefined,
token: 'asdasd',
properties: undefined,
presence: undefined,
compress: undefined,
large_threshold: undefined,
shard: undefined,
intents: [ 512 ],
rest: RestManager { _client: [Circular *1] },
ws: WebsocketManager { totalShards: [Array], _client: [Circular *1] },
[Symbol(kCapture)]: false
},
id: '976682394633510976',
channelId: '972342210685206569',
guildId: '957867801119449109',
author: User {
client: <ref *1> BaseClient {
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
token: 'asdasd',
properties: undefined,
presence: undefined,
compress: undefined,
large_threshold: undefined,
shard: undefined,
intents: [Array],
rest: [RestManager],
ws: [WebsocketManager],
[Symbol(kCapture)]: false
},
id: '957347862314905610',
username: 'Misty',
discriminator: '6666',
avatar: 'f0dbe90216d64cacf4c5fb14ae076d7a',
bot: undefined,
system: undefined,
mfaEnabled: undefined,
banner: undefined,
accent_color: undefined,
locale: undefined,
verified: undefined,
flags: undefined,
premiumType: undefined,
publicFlags: 0,
avatarDecoration: null
},
content: 'asdasd',
timestamp: '2022-05-19T03:07:08.762000+00:00',
editedTimestamp: null,
tts: false,
mentionEveryone: false,
embeds: [],
pinned: false,
type: 0
}
Do you think it is fine setting things like that?
I was thinking if discord didn't send it, then it shouldn't be displayed
so instead of it being undefined it should just not be there right?
whatever you prefer
from a performance standpoint, v8 likes fixed objects better so it can keep reusing the same structure
I kind of feel like if it wasn't provided why show it
from a memory efficiency perspective, not having the props when not needed is better
How do you suggest I remove them if they aren't provided
I could do something like a loop and del the undefined values from the object but
that is likely not wise
just dont add thm in the first place?
Mmm you make a fair point indeed
I think any language would like that
π
extremely stupid question: but what to do if you lost your api token?
I dont know of any services which dont allow you to regenerate your token.
π
you can either regenerate the token from dev portal or just create a new bot
solved it already thanks!

const mentionedChannel = !args[0] ? message.channel.id : args[0].replace(/\D/g,'');
so I'm trying to get the current channel ID if there aren't any args, and get a channel if there is args, how do I check whether the channe mentioned in args is actually valid?
I accidentally sent it before adding context and was editing the message
Ah
you could check for the channel inside cache or try to fetch it if you're not caching channels
is there a way to check it using a one liner?
also how do I get the name of the channel? message.channel.name?
djs documentation is very easy to read btw
also, can't you use message.mentions.channels.first() ?? message.channel?
assuming channel is the only argument for that command
wait so that works for channels too?
yeah
well I still want it to work when I give a bare ID though
ah true
then try to fetch the id
await message.guild.channels.fetch(mentionedChannel);```
I feel like that would be slower than just adding one more regex to check if the arg is a discord IP
I used to have a function to parse arbitrary user input that resolves to a Channel by searching by mention, name, or by ID
I would prolly just do something like args[0].match(/\d{17,18}/) maybe
Do not specify ID lengths since they will overflow
how? isn't the base ID length between 17 and 18 chars
and 1 is technically a valid ID
yeah that's why I'm checking the length
What I just said flew over your head
if the match returns true then it's the correct length
Oh no not the regex mentality again π
The IDs will reach the max number available in that range and then overflow into a longer range
well regex is gud 
I don't understand what you're trying to tell me
isn't max float range like 9999999999999999999999999
Just use the regex provided by discord.js ez
IDs are bigints arenβt they?
then it won't overlow since integers don't have a max renge
They specify the range
Yeah they have a Snowflake util for checking if something is a valid snowflake
lemme see
They are can only fit into BigInt, yes
why didn't you say that
π
what is it called
Overflow as in the integer will be longer than 18 characters
so your regex will cut off the id
The only way you can check invalid without fetching is if the timestamp is > the current date
then what should I do?
0 would be at Discord's epoch
I need to keep that check all in one line
why
to make it neat
Make a function for it
uhh i had this js export default function (text: string): boolean { try { const bigInt = BigInt(text); return bigInt >= 0n && bigInt <= 18446744073709551615n; } catch { return false; } }
how does dis work
It tries to convert the string to bigint, if it fails then returns false
If it doesnβt fail then it checks the value range
const checkValidID = function(text) {
try {
const bigInt = BigInt(text);
return bigInt >= 0n && bigInt <= 18446744073709551615n;
} catch {
return false;
}
}}
I see
what is that <=
literally just use what I provided
less or equal than?
maybe it's when the world's gonna end
max unsigned 64 bit integer
pretty sure BigInt can go over max unsigned 64bit int
but snowflakes can't
Alternatively, just check if the timestamp in the snowflake is > Date.now()
your function can return false positives for Dates 1 week from now
The spec of SnowFlakes might change once 128bit or > computing becomes commercial
Hopefully not the end of the world by then
but creating work for yourself down the line is unwise
anyone know how you can get the path in react SSR?
i tried window.location.pathname but its in a function and so it gets server rendered showing an error
and i cant throw it in useEffect
well i can it just wont look nice
i swear someone needs to come up with a framework which can actually detect client-side only code
all these frameworks but not one unique one
what is equivalent of import X, { Y } from "xyz" in commonjs
const X = require("xyz");
const { Y } = X;
X would be default import?
yeah
ohh ok thx
though commonjs doesnt really have a concept such as default imports
yeah that's what I asked, if X would be a object having default property
Either use useEffect or detect that the code is running in the browser yourself
if (typeof window !== "undefined") {
//...
}
Or even better, make it a function parameter so the function doesn't have to check that
and then pass whatever you want to it
i figured out i fricked up on my end
i tried calling a function that was supposed to be called only on load in the render function without useeffect
fixed it now though and now it only renders when its supposed to
y it is required to specify type of file in js imports?
I mean it'll always be .js, no?
according to a few stackoverflow answers, es6 doesnt need extensions either
it just needs to match the file name, extension included
yes I'm talking about file extension. Y to specify them?
meaning you can save your file as index.test and import "./index.test" and it will work
but that is not the case for cjs imports. Or is it?
require doesnt need file extension right?
CommonJS (CJS) is not part of the JavaScript standard and it's just a workaround as JavaScript didn't have modules back then, so it rather uses an algorithm to find files based on the file resolution, ECMAScript modules (ESM) is a part of the JavaScript standard and now officially supports modules and we require it because it doesn't really use an algorithm because we want to boost things up and force the developer to provide extensions instead of being lazy and not doing so, just as seen in many of the programming languages out there
Just to also avoid internal confusion
oh wow, good to know that
so that algorithms auto detects file extensions, I guess
each has different rules
Would it be possible to use JSDOM to execute external JavaScript? For example:
let stringToPrint = "hello";
Then a website having this function:
function printMessage(message) {
console.log(message);
}
Then using JSDOM:
dom.something.printMessage(stringToPrint); // returns "hello" from the virtual console
idk try attaching it to window
yes, window.printMessage = printMessage then dom.window.printMessage()
I'm trying to actually access a function within the website itself. printMessage isn't a function within the current file.
This sounds like a really bad idea
It is unfortunately. But I'm trying to deobfuscate a URL through a function from the website. The function itself can only be used from the min file
Use puppeteer
It takes forever to load though. I think this is possible via JSDOM since I could theoretically just inject a script:
let message = "hello";
let script = `
<script>
printMessage(${message});
</script>
`;
And then just use runScripts: "dangerously" for JSDOM. But yeah, this generally isn't a good idea. I wouldn't do this unless I really have to.
why is cloudflare refusing to update my dns records
added test.<domain>, doesn't work and dns checkers don't say its a valid record
It might has a large TTL value
oh
And or the zone at all
Means updates/pushes can take hours/days etc
i've not modified any of that which is why i'm confused
yoo nodejs crypto module has a reference to EDP445
docker: Error response from daemon: driver failed programming external connectivity on endpoint minio1 (7644e2e5e28773f0123b9bd54ca926a4198e4bd27e21925d1d825ccefbea0e33): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9001 -j DNAT --to-destination 172.17.0.2:9001 ! -i docker0: iptables: No chain/target/match by that name.
tf do i do lmao
quick google search
yeah fixed that
now minio is pissing me off
redirects to localhost when i nginx proxy
self hosted s3
is there a way to attach a string in a message (id) so it cannot be visible to clients but will be visible on fetched message? without using any database? or do I need to make some kind of discord powered database? or just a normal database using quickdb? kinda dumb question when I think about it...
Have a key-value association somewhere
Like a map or database
Does it need to stay valid after restarts?
yep
U can setup a sqlite db in minutes
Simple single-table structure
Programs do that all the time
tho if you wanna use arrays it will be a bitch in sqlite (unless they changed it)
yeah but dependencies, id rather use discord databse
Serialize it
Also he said string, so it'll be fine
I mean, u just need the connector
Which is like, kbs at most
This guy just said...discord database?
discord is like database.send() or data.edit() and database.fetch()
it works ive tried it
why not?
It is just not smart way to save data, at any point that could get deleted and poof gone
its not like its for a public bot that hundreds of servers gonna use
Jokes aside, if discord ever allows bots to edit user notes I bet people will use it as db
Time to edit ur user note
:)
Why use ur own database when you could use discord's?
Serialize an entire sqlite file and save inside notes 

Should I even worry about making a 'super' class for channels?
I myself don't see the benefit of having such a thing but i've been told it is probably a good idea. I just still somewhat doubt it (as they never really said why it'd be a good idea)
#include<stdlib.h>
#include<string.h>
#define str_size 2999
#define chr_no 255
int main()
{
char b[str_size], m;
int d[chr_no];
int i, max = 0, x;
printf("Input the string\n> ");
scanf("%[^\n]%*c", b);
for(i = 0; i < chr_no; i++)
{
d[i] = 0;
}
int c = strlen(b);
int l;
for(i = 0; i <c; i++)
{
l = (int)b[i];
d[l]++;
}
for(i = 0; i < chr_no; i++)
{
if(d[i] >= max)
max = i;
m = (char) i;
}
printf("The maximum occurring character is %c occurring %d times\n", l, max );
return 0;
}```
I don't know where I am doing wrong
{
l = (int)b[i];
d[l]++;
}
for(i = 0; i < chr_no; i++)
{
if(d[i] >= max)
max = i;
m = (char) i;
}```
probabaly here
sure?
it will make it quicker to add changes to the channels apis
as a lot of the channel apis are the same across multiple channels
so instead of duplicating code you can extend them
which is better approach to duplicate an array?
[...arr] or arr.slice()
Just to duplicate it?
new_array = old_array;

But I assume you wanna do it inline instead
That doesn't clone the array
I would say Array.prototype.slice(), as it's faster and more verbose
The reason it's faster is because it's a fixed method to only one type of object which are arrays, while the spread operator (...) is not a fixed operator and works for multiple types of primitives, which can slow it down, and it also depends on what wraps it
you know bro spends too much time with javascript when he calls array slice array.prototype.slice
aight so since the stack verse won't help because the question i wrote isn't "perfect" and has been closed (god I hate the stack community)
relating to SMTP what kind of measures should I employ to kind of perform a soft check on incoming emails? Emails can be easily spoofed so this needs to be done
What I do right now is check if the incoming email is valid and if it has a valid MX record but not sure if I should do more than that
correct
what measures have you taken to protect your source code (if closed source), to protect your token etc.
and obviously the server your bot is hosted at
does anyone know a regex that will extract subdomains from an email?
Anyone know of a regular expression that will only match emails that contain a sub-domain in them?
e.g.,
name@subdomain.domain.com or name@subdomain.domain.edu.au
Preferably to use in postgresql...
(\w+@[\w.]+\w)
doesnt work :c
π
wait
for regex
isn;t it <regex>.match("test@test.gmail.com")
wait thats probs not js
@split hazel
"test@test.gmail.com".match(/([^.@]+)/)
ah wait that doesn't work
fml
the webite i used to test worked tho
rip
Subdomain? So from foo@bar.baz.com, you want the bar?
Here's the regex: /[a-z1-9_.-]+@((?:[a-z1-9-]+\.)*)[a-z1-9-]+\.[a-z1-9-]+/i
The i flag included for case-insensitivity
let welcomeChannel = settings.welcomeChannel;
// here's some regex to remove both "<#" and ">" elements from it
member.guild.channels.cache.find(c => {
if (c.name === welcomeChannel) {
//return channe by name.
} else if (c.id === welcomeChannel.replace(/\D/g,'')) {
//return channel by ID
}
}).send(welcomeMessage);
you guys seem to be better at regex than me. I'm trying to make it find either by channel name or by ID, ID will work both in case mentions or just pasting plain ID
but something is wrong I keep getting random errors
can't figure out where because it doesn't exactly tell me
...and the error is?
there is a couple, I cleared the console already but from what I remember it was something along "couldn't get" and "couldn't cache"
basically a discord API error
We can't really help without an exact error, and the way you're trying to find the channel can be pretty slow as you keep replacing rather than replacing once
it happens in the guildMemberAdd event, I'm trying to make it as accesible as I can if many servers use that at the same time
Iβm still baffled by this obsession about regex you have
well one thing that is good about it, is that you can make complex functions be one liners so it's really good
basically you can make a library full of functions and it's only gonna be a couple of lines
why do u care about file size
// A regex to match IDs.
const channelIdReg = /^\d+$/;
// A regex to match channel mentions, and to also capture the ID if available.
const channelMentionReg = /^<#(\d+)>$/;
...
const { welcomeChannel } = settings;
// Declare variables with no value, we'll modify it later.
let channel, match;
if (channelIdReg.test(welcomeChannel))
channel = member.guild.channels.cache.get(welcomeChannel);
else if (
// Match against the channel regex.
(match = welcomeChannel.match(channelMentionReg)) !== null
)
// If it matched, get channel by ID.
channel = member.guild.channels.cache.get(match[1]);
else
// Otherwise find by channel name.
channel = member.guild.channels.cache.find(
(channel_) => channel_.name === welcomeChannel
);
// If the channel is not found, return.
if (channel === undefined) return;
// Otherwise send the message.
await channel.send(...);
settings.welcomeChannel will return the users choice of channel, whether it is an ID, channel mention or a channel name
And your point?
settings by itself won't really work as you think it does
it will return a map of settings
Sure, but youβre using it for basic things. Regex is slow. File size basically does not matter in this case. So many reasons to not use regex here :p
shouldn't you await cache.get and cache.find?
π
Anything from cache is stored in memory already
okay understood
well it's still useful in the the case which I've showed
checking for <# and > without regex would be a pain
Ever heard of .substring() π
π
@earnest phoenix it works with mentions but doesn't work with names
ERROR Uncaught Exception: TypeError: Cannot read properties of undefined (reading 'cache')
tried fixing it myself but nothing worked
I'll try ```js
if (channelIdReg.test(welcomeChannel)) {
channel = member.guild.channels.cache.get(welcomeChannel);
// Match against the channel regex.
} else if ((match = welcomeChannel.match(channelMentionReg)) !== null) else {
// If it matched, get channel by ID.
channel = member.guild.channels.cache.get(match[1]);
} else {
// Otherwise find by channel name.
channel = member.guild.channels.cache.find((channel_) => channel_.name === welcomeChannel);
}
Uh, you've got an extra else at almost the end of the second if statement
showing the list of guilds where the bot is, is against discord tos?
you Better fetch for Channel, instead of cache
no
topgg don't approve bots if anyone can run that command
only the developer should be able to run it
I've asked this question bcs I'm doing a partnership command where a partner is send in other servers, I have a counter that update the message, for example 'message send in 3 servers' => 'message send in 4 server' and for make the command more real I would like to change it in 'message send in Server A' => 'message send in server B' and at the end say like 'message send in 10 servers'
I wanted to know if this was against discord tos
I dont think its against the tos if the server owners can set the message sending channel
or can turn it on/off
many anime api's don't properly label series and can send nsfw, or even illegal content(in some countries) when filtering.
also, it seems the reason they gave is much more broad than just the api's you use. it could be any feature of your bot.
when they say "APIs" they are referring to the discord APIs
π where?
well, in the dev terms of service "APIs" always refers to the discord API's
as if Discord offers multiple
they do
Welcome to Discordβs APIs, software development kits (βSDKsβ), and associated documentation (collectively, "APIs").
Discord.js has examples you can comb through
that's dumb logic, but legal is dumb
So, you're basically telling us you're too lazy to look and possibly find other information you might find helpful
What did you expect that to do
so your question is fetching a dm channel?
nobody's here, try again next time
does the Button and SELECT_MENU Collectors work on discord.jsv12
just move to 13 lmao
alright when you alive tell me the answear
version 3 what???
on my bot on top.gg
so i can't make a collectors for select menu or button in v12 ?
not that i know of
when i try
const collector = msg.createMessageButtonCollector()
it say createMessageButtonCollector() is not a function
alright ty
I'm trying to run a script within JSDOM, however I get the error that imgReverser isn't defined. I'm attempting to access a function in read.min.js, but what's strange is that when running await imgReverser("a") in dev tools the code runs. It's just within NodeJS that I encounter the error that imgReverser isn't defined.
Code: https://sourceb.in/ZZ3bHp63fe
This is what I send into dev tools:
imgReverser("link_to_image").then(canvas => {
console.log(canvas.toDataURL('image/jpeg', 0.9));
});
The output is as expected which is data:image/jpeg;base64,/9j/.....
I have a couple messages that I return within the script but somehow multiple returns activate???
how is that even possible
code and example?
only one return can activate unless you're doing something wrong
is there a website that lists all the utf characters/emojis and lets you know which OSs they are available on?
yeah i think so
tho you generally shouldnt worry about that
if you really need an emoji to be shown everywhere you need to use your own emote pack
not sure about operating systems but this is as close as i found https://unicode.org/emoji/charts/full-emoji-list.html
i'm thinking about replacing -> and <- with something like this β β’
thanks, check this out
oh thats a character
oh nice
it should be supported pretty much everywhere
unicode characters are very widely supported
i guess i could look at the value of it. the higher it is the less it's supported probably
yeah
looks like it was myfault
does anyone have any idea how to use the .replace function on a json?
what are you trying to do?
what is response?
.json() can be a promise depending on what response is
response from a node-fetch call
I've awaited the function
not sure if that is enough?
you need to await the json() function too
how do I await a .then() func then?
you cant afaik
then(async (response) => {}) is what I've been trying to do
then how am I supposed to await the json function???
π
People that doesnt pay attension triggers me ngl
I've been trying to avoid doing just that
isn't .then supposed to magically resolve the json anyway
I dont see you use .then either
me 2
a double then will solve everything
cause I haven't shown it
then(response => response.json).then(result => result);; result being a json which I can work with
by replacing values?
thats kind of hard to read isnt it?
I find It useles, u r using replace()
problem is I'm trying to format the json within the .then func so I can callback into the variable the fetch is placed in the first place
and replacing the same values
just formating them. from true to True
y u don't Just pur toLowerCase() in the input?
and avoiding this
for True and False u can put toLowerCase () and replace only the undefined
imo working directly at the data input is easier than doing this
the ${}? I just wanted to make sure it's a string
wont that just turn it into [Object object]
it shouldn't
it does appear to work as a json normally and I can use it like response_.result
its not a json, its an object
then what is the point of .json()
what Is this console? π
that is why I used a double .then()...
inspect
f12 on chrome π
lol
is it even possible to keep it all inside the .then() func...
I need it to be like this otherwise the code will look bloated
is there no other way to do this?
sure, it just seems like you're trying to do random stuff until it works.
That will take days to get something kind of working
days if u are optimistic
so I'm gonna have to do response_.something.replace(...).replace(...) for every single string then?
whats the error?
send a beatufull code block with the err
forEach is not a function.. like I said I need to make it iterate somehow to format it
π
if you want to iterate over an object youll need to turn it into an array, then back into an object
so u want to loop all over the JSON and change the values?
toArray()?
https://www.javatpoint.com/javascript-object-entries-method#:~:text=JavaScript Object.entries () method is used to return,property [key%2C value] pair are to be returned.
^ will turn an object into an array of key value pairs.
JavaScript Object entries() Method with example on javascript, object, javascript assign(), create(), defineProperties(), defineProperty(), entries(), freeze(), javascript tutorial, javascript array etc.
What is a good way to execute code on a website and return the data using NodeJS? I'm trying to run a script with JSDOM, however I get the error that imgReverser isn't defined. I'm attempting to access a function in read.min.js, but what's strange is that when running await imgReverser("a") in dev tools the code runs. It's just within NodeJS that I encounter the error that imgReverser isn't defined.
Code: https://sourceb.in/ZZ3bHp63fe
However, despite these issues, I donβt want to use a headless browser like Puppeteer or Selenium. Using those tools are extremely resource intensive and take a while to load. Iβm hosting my web server on a 2 GB VPS, so unfortunately headless browsers arenβt a good option at the moment :/
This kind of looks like two questions right?
so imgReverser is a function ran on the website right?
Yeah it sort of is 2 questions.
#1: What is an alternative to JSDOM that isnβt a headless browser in the case I canβt get #2 solved?
#2: How can I execute functions in external scripts?
And imgReverser is a function ran on the website, yes. Itβs in the reader.min.js file.
for #2 its just
https://i.imgur.com/wUg5CFf.png
https://i.imgur.com/jfsfmv8.png
require the script containing the function in the head of the html, then run
I used window.document.createElement(βscriptβ); with the source being the min file, then did window.document.body.appendChild(), but for some reason when using console.log(imgReverser(βsome_urlβ); nothing got logged.
I think Iβm misunderstanding JSDOM a bit though lol. If it helps I can send the code I used when I get back on my laptop.
Iβll rq try this though. Ty for your help!
Yeah I just tried this:
https://sourceb.in/8RDXvEeSec
Nothing is logged or appended unfortunately.
I do get an error thrown from runScripts: "dangerously" so I'm trying to use outside-only instead of dangerously, but its the same result regardless.
Weird. I just created a basic test program which does something similar. Same result. Nothing gets appended. I included a test image and the actual min file if it's helpful to anyone.
test.js: https://sourceb.in/RQs5QK5Wv2
test.html: https://srcb.in/MmNtuVoZan
I may be wrong about this, but I think you want your <script src="https://mangareader.to/js/read.min.js?v=4.6"></script> in the head, not the body.
Need some help with making a bot on MacOS
Been trying to get everything to work but as soon as that happens, another issue comes along.
I am using Python to make a custom bot for my server and I can't seem to download the Discord library. I use the command pip install discord but it responds with pip: command not found
Any help would be appreciated.
in the head it should preload the data before anything else.
what I think is happening, since its not in the head its sending the request for https://mangareader.to/js/read.min.js?v=4.6 then instantly running the next part before read.min.js is loaded
(someone correct me if I'm wrong)
yes, woo is right, you cant run async code like that
check their example for how to use async loading again, everything that is async needs to be done like that
because jsdom is synchronous, it doesnt wait for any async code execution, hence why you only get empty data
did you install python? how did you install it?
some js pro in here?
tim is
@quartz kindle u here?
Just ask your question
ok so im comming from python learned some js not advanced tho basically im trying to
a = 5
b = "."
print(b*a)``` in js
im getting js NaN
That's not a thing in JS
b.repeat(a)
python result:
a = 5
b = "."
print(b*a)
=============
......```
ty
lol
yeah do what google said
ty lol
I'm a bit confused on how to use their example. I'm unfamiliar with using window.onModulesLoaded() since I get the error that the function isn't defined.
thats not the point
the example shows node.js creating a custom function and attaching it to window
onModulesLoaded would be this custom function
then the the script from inside jsdom will access this function to signal the node side
const dom = new JSDOM(...) // create the dom
dom.window.MYCUSTOMFUNCTION = (data) => { // attach a custom function to the window object
console.log(data) // this will be executed when this function is called
}
<script>
// do some async function or long running process
window.MYCUSTOMFUNCTION(result) // when done call the custom function with the result, to send the result back to node
</script>
Oh I see. I misinterpreted the documentation. Thank you! That's super helpful.
bomba
Alright I think I'm not doing this correctly haha. The documentation is a bit confusing to me unfortunately. This is what I have so far:
let d = "some_url";
script.textContent = `
// Added this, didn't work either unfortunately.
a().then(res => {
window.a(res);
});
async function a() {
let canvas = await imgReverser('${d}');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
return newP;
}
`;
newDOM.window.document.body.appendChild(script);
let dataa = await newDOM.window.a;
stuff.push(dataa);
Does JSDOM have a virtual canvas as well?? I doubt it does
Hey programmers! π
Thought I might try here
I am coding a Connect 4 game. I need to display a board image which updates after user input based on where they place the circle.
Now the problem is I have been trying to think of a way to pass in a two dimensional array representing the board state and this function returns an image of the board (basically visualizing the array).
Does anyone have an idea in mind on how to implement this function? Is it possible?
Here are some ideas that I have thought initially but are not efficient:
-
Have an images folder with every possible combination of board state and fetch the image based on the array. Can't do that since it will take a ton of time to create images of all possible states.
-
Call an API endpoint where I generate the image in HTML/CSS (DOM), then respond with an image of that. Scratched that too since I am not experienced with React/Angular/Vue or anything similar, will have to host that somehow too and lastly I am not certain if you can generate an image from HTML/CSS and respond with that.
what are you working with? node.js?
yes, specifically discord bot
you can always use canvas
is this a js feature/package?
or any image compositing library if you have the board components as images, like jimp, sharp, gm, etc
lets say you have an image of the empty board, and two images of the pieces, one for each player color. you can do basic image compositing, ie merge the background image with copies of the pieces images in specific x-y positions
oh wow
you can do that with sharp for example, a pretty popular image manipulation library
alternatively, you can fully draw the board and the pieces from scratch using geometric shapes and lines without needing any image, you can do that with canvas
appreciate it, did not know there were such libraries around
both of them require native code tho, so you will need to have your build tools in order
ie windows-build-tools on windows, or build-essential on linux
what is native code?
you dont need to
the libraries sharp and canvas are written in C/C++
you just need to have the tools to compile them before you can use them in node
npm does all of that for you, as long as you have the tools installed
if you have a vps running linux, just install the build tools there
if you're using something like heroku, you might need to search for specific build-packs
if you're using a cheap hosting that uses one of those pterodactyl control panels, you might need to ask support to help you if you get errors
i see, will ask the provider for info on this if they support it
im using sparkedhost
first try installing the library and see if you get any error
ie: npm install sharp
It does I believe. It works fine when I call a() in the dev tools console.
tomorrow hopefully! π bed time now
what does dataa log?
also you didnt do it right
undefined
yeah thats what i thought... sorry im kinda struggling to understand the docs lol
let d = "some_url";
script.textContent = `
window.a = async function {
let canvas = await imgReverser('${d}');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
return newP;
}
`;
newDOM.window.document.body.appendChild(script);
let dataa = await newDOM.window.a();
stuff.push(dataa);
``` does that work?
lemme try
Says it isn't a function. Hm.
const newDOM = await JSDOM.fromURL(requestChapter.url.href, { runScripts: "outside-only", resources: "usable", virtualConsole });
const script = newDOM.window.document.createElement('script');
script.textContent = `
window.a = async function {
let canvas = await imgReverser('${d}');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
return newP;
}
`;
newDOM.window.document.body.appendChild(script);
let dataa = await newDOM.window.a();
stuff.push(dataa);
I'll also try in the dev tools console
Yea just noticed haha.
Still says it isn't a function :/
trying in dev tools rn
Works fine in dev tools.
what about this? ```js
let d = "some_url";
script.textContent = async function a() { let canvas = await imgReverser('${d}'); const uri = canvas.toDataURL('image/jpeg', 0.9); let newP = document.createElement('img'); newP.src = uri; newP.classList.add('asdfasdf'); document.body.appendChild(newP); window.b(newP); } a();
newDOM.window.document.body.appendChild(script);
newDOM.window.b = (data) => {
console.log(data);
}
lemme try π
my function is setup weirdly lol so i cant log it for some reason. could i do let dataa = await newDOM.window.b();?
async getImages(requestChapter, id) {
const newDOM = await JSDOM.fromURL(requestChapter.url.href, { runScripts: "outside-only", resources: "usable", virtualConsole });
const script = newDOM.window.document.createElement('script');
script.textContent = `
async function a() {
let canvas = await imgReverser('${d}');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
window.b(newP);
}
a()
`;
let dataa = await newDOM.window.b;
newDOM.window.document.body.appendChild(script);
stuff.push(dataa);
return stuff[0];
}
no, let dataa = await newDOM.window.b makes no logical sense
okay thats what a thought rip. aight nvm lemme try smth else rq
Yeah idk whats going on with my functions it just isnt logging anything and res returns null
did you try my code example?
yea im trying rq.
it returns undefined
i think
function doSomething() {
return this.getImages(request, readingID).then(res => {
if (!res) {
return null;
} else {
return res.call();
}
});
}
async getImages(requestChapter, id) {
const newDOM = await JSDOM.fromURL(requestChapter.url.href, { runScripts: "outside-only", resources: "usable", virtualConsole });
const script = newDOM.window.document.createElement('script');
script.textContent = `
async function a() {
let canvas = await imgReverser('${d}');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
window.b(newP);
}
a()
`;
newDOM.window.document.body.appendChild(script);
return newDOM.window.b = (data) => {
console.log(data);
stuff.push(data);
//return stuff[0];
return data;
};
}
that will always return undefined, but does it log anything on the nodejs side?
what if you do window.b("abc");
i feel like im doin smth wrong tho
ill try that
just to see if any data can come accross
ah
also
newDOM.window.b = (data) => {
needs to be before appendchild
well actually it doesnt really matter, but its safer that way
aight ill try that. tysm for your help
it says it isnt a function
newDOM.window.b("something"); i mean
thats not what i meant
i meant replace this
window.b(newP);
for example ```js
let d = "some_url";
script.textContent = async function a() { window.b("abc"); } a();
newDOM.window.document.body.appendChild(script);
newDOM.window.b = (data) => {
console.log(data);
}
oh wait ic. mb.
it prints undefined
script.textContent = `
async function a() {
let canvas = await imgReverser('${d}');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
window.b("abc");
}
a()
`;
can you put together a very basic test to see if this even works?
will do π
just these two tests ```js
// test 1
const newDOM = await JSDOM.fromURL(requestChapter.url.href, { runScripts: "outside-only", resources: "usable" });
const script = newDOM.window.document.createElement('script');
script.textContent = window.a("test");
newDOM.window.a = (data) => console.log(data);
newDOM.window.document.body.appendChild(script);
// test 2
const newDOM = await JSDOM.fromURL(requestChapter.url.href, { runScripts: "outside-only", resources: "usable" });
const script = newDOM.window.document.createElement('script');
script.textContent = window.a = () => "test";
newDOM.window.document.body.appendChild(script);
console.log(newDOM.window.a());
if these dont work, try them again with runScripts: "dangerous"
So just window.a("test")? I don't need the await imgReverser?
no, remove everything else, just do the test
okay
Test 1 doesn't log anything.
Test 2 returns newDOM.window.a isn't a function.
Lemme try the runScripts thing
Same thing for test 2. Test 1 works actually and test is logged
Just taht I get a ton of errors saying, "MessageChannel isn't defined" and issues with grecaptcha lol
but ty this is super helpful
ok so based on that, this ^ should work in dangerous mode
but the question is whether the returned value will be what you expect
what exactly is the return value you want?
Sorry I had to go to my brother's recital lol. I want to return uri:
let canvas = await imgReverser('https://some_image.com');
const uri = canvas.toDataURL('image/jpeg', 0.9);
Just tried this. Doesn't seem to work for some reason. Tried running it from the website URL via fromURL but since I'm using runScripts: "dangerously" it threw a lot of errors and crashed the web server.
https://sourceb.in/b2tJG00mt7
Never mind. Just realized that the URL I inputted was wrong haha. When I use window.b though, I get the error saying it isn't a function.
async function a() {
let canvas = await imgReverser('imgurl');
const uri = canvas.toDataURL('image/jpeg', 0.9);
let newP = document.createElement('img');
newP.src = uri;
newP.classList.add('asdfasdf');
document.body.appendChild(newP);
window.b(uri);
}
a()
did you add the newDOM.window.b = (data) => console.log(data);?
Should I make it so the super class 'Channel' can accept any kind of channel data to make a basic channel?
or should i not bother with having any actual data with the Channel class and just have useful methods other classes that extend it should need so I dont gotta duplicate code yknow
Superclass should be just commonly shared methods and stuff like id
The child classes can then inherit it and have their specific methods and properties
Don't nest channels within channels, that'll just result in mess
I am trying to make any understanding of how djs does it but it is hard to even comprehend those mega brain people
One thing I did notice is that it seems like they have a static create method on the super class that converts the data given to their respective channel types
why they made it static tho I have no idea as it seems like they never actually use it like how you'd use a static method
what is this? window.b = (uri);
When using window.b("asdf") or window.b(uri) I get the error that window.b isn't a function.
that doesnt explain where that idea came from, window.b = (uri); makes no logical sense
Yeah I'm not sure what I'm doing tbh. I'm quite unfamiliar with DOM
try putting the ```js
newDOM.window.b = (data) => {
console.log(data);
}
ive been trying to do some reesearch and slowly learning how dom works
aight
Yeah nothing is logged.
This is why I love ts cause you can just overwrite types and tell it to fuck off
um wat
I tried replacing window.b = uri with window.b(uri) and I still get the error that window.b isn't a function (in the DOM not NodeJS)
Oh wait I forgot that I returned the HTML of the DOM and displayed it using ExpressJS
The image works
and loads
ts allows you to overwrite some stuff and basically tell it yes this does exist on it
its just that getting the data doesnt work
Tho it probably isn't a good idea to really do that as it has no actual value
using newDOM.window.b = ...
you said it like "being able to tell it to fuck off" is an advantage, while in js you dont need to tell it because it fucks off by default
lmao
Using Cheerio to fetch the HTML elements doesn't work etiher cause the image loads AFTER the page itself. one solution is to just use jsdom again for the actual html and then get the source but i feel thats inefficient
anyways i sorta got it to work so ty for your help. ill see if i can find smth more efficient rq
It isn't really an advantage just something you could do to make it shut up about it not existing, tho if you do it right you don't generally have to do that
ts is cool from what ic. i tried to get into it but stopped abt 5 min thru the docs
Ima be honest I haven't really read the documentation other then about decorators and generics
thats my approach to any language to π makes coding 10x harder sadly
tbh i didnt learn abt module.exports until 6 months ago
even tho ive been doing js for a while now
same
could you explain again what exactly you're trying to do? i have the feeling that you shouldnt be needing jsdom at all
Sorry I probably explained everything very poorly. Basically there's a website that has a read.min.js file. It has the function imgReverser that decrypts/decodes images and encrypts/encodes it. I want to call that function, but I can't just copy + paste it since it uses a lot of functions from the min file.
So my solution at the moment is to create an HTML file, require the min file using <script>, then using JSDOM add a script that has the image I'm trying to decode that I fetch on the node side and run it.
yea sec
const ytdl = require("ytdl-core");
const { MessageEmbed } = require("discord.js");
const { QUEUE_LIMIT, COLOR } = require("../config.json");
module.exports = {
async play(song, message) {
const queue = message.client.queue.get(message.guild.id);
let embed = new MessageEmbed().setColor(COLOR);
if (!song) {
message.client.queue.delete(message.guild.id);
embed.setAuthor("Dispatcher queue ended | Opus Returned a Queue End");
embed.setDescription(
`Ended without playing a song? DM 0_0#6666 for assistance!\n\n **Don't worry I won't leave ${queue.channel} Waiting There For More Music To Be Played!**`
);
return queue.textChannel.send(embed).catch(console.error);
}
try {
var stream = await ytdl(song.url, {
highWaterMark: 1 << 25
});
} catch (error) {
if (queue) {
queue.songs.shift();
module.exports.play(queue.songs[0], message);
}
if (error.message.includes === "copyright") {
return message.channel.send(
"Β© | Contents of this video are copyright protected."
);
} else {
console.error(error);
}
}
const dispatcher = queue.connection
.play(stream)
.on("finish", () => {
if (queue.loop) {
let lastsong = queue.songs.shift();
queue.songs.push(lastsong);
module.exports.play(queue.songs[0], message);
} else {
queue.songs.shift();
module.exports.play(queue.songs[0], message);
}
})
.on("error", console.error);
dispatcher.setVolumeLogarithmic(queue.volume / 100); //VOLUME
embed
.setAuthor(
"πΏ | Started Playing Your Song",```
It's not working π
and yea im making a web scraper π
wheres the part that needs decoding?
what isnt working? do you get any errors?
the images are all messed up if you can see. some parts of it are overlapped, some are misplaced, etc.
Yes it's shows null but sill not working
ill try to find the link to the website if it helps
what shows null? what isnt working?
This script
Don't know
And even the bots online too
if you can describe your error we can help you. idk what exactly is wrong since theres no error message you sent and you didn't paste all your code. also, in the future i suggest sending your code via paste bins like https://sourceb.in or https://pastebin.com
and you have to scrap this exact website? cant do it on any of the other dozens of manga websites out there?
i can. i got 7 other sites working. its just i already spent like 2 hours setting up the searching, image fetching, chapters, etc. and i dont want to quit now haha. i think its possible since i got this far already and have been able to pass other issues for other sites
but i see what u mean. it might be best to try a diff site. regardless, tysm for your help. i really appreciate it
i dont think i would even get the image displaying to work if it wasnt for your help so thank you
Loli didn't put const discord.js = require ("discord.js")
Anywhere
ah ic. well theres your fix π
mmm using dots in variable names what could go wrong
const discord.js uh oh
i diidnt see that whooops
Ah ur fine I am sure nothing could go wrong 
does vsc "organize imports" works for commonjs imports?
so i tested it a bit, and basically just copying and pasting the entire script was enough to make that particular function work
even though the script errors, the errors do not affect the parts needed for the reverser function
meaning if you work on deobfuscating and cleaning the script, you will eventually be able to isolate and extract the functions needed
tim has anyone told you how cute you are?
Oh wait fr? That's super helpful. Thank you i don't know why I didnt just do that. regardless tho im still having issues wth the async stuff but hopefully just using the min file will work
also what the fuck is this
function toFinite(_0xf384) {
return _0xf384 ? (_0xf384 = toNumber(_0xf384)) !== 0x1 / 0x0 && _0xf384 !== -0x1 / 0x0 ? _0xf384 == _0xf384 ? _0xf384 : 0x0 : 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 * (_0xf384 < 0x0 ? -0x1 : 0x1) : 0x0 === _0xf384 ? _0xf384 : 0x0;
}
lmfao
min file moment
its literally a hex representation of Number.MAX_VALUE
probably made by a transpiler set to lower versions of js where MAX_VALUE might not exist
lmao yea that would prob make sense
idk what sane person would actually type out that many 0's
||https://mangareader.to//js/read.js?v=4.6||
Oh i found the non-minified version. Only issue is that it doesn't have the imgReverser function π
I removed some unnecessary parts of the script but now am encountering some weird issues with functions
this worked for me on dev tools
try {
entire read.min.js code here
} catch(e) {}
imgReverser(...)
Thanks lemme try that out rq. I'm attempting to isolate the imgReverser function but deobfuscating min files is painful
best case scenario would include making it work on pure nodejs using the canvas library
Yeah probably. I'll see if I can deobfuscate the function from some online tool or smth and see if that works
well good luck, im gonna go sleep
gn tim
okay. ty i rlly appreciate all your help!
https://www.npmjs.com/package/is-number so many questions
Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.. Latest version: 7.0.0, last published: 4 years ago. Start using is-number in your project by running npm i is-number. There are 979 other projects in the npm registry using is-number.
Well obv it is for checking if it is a number
very useful
3.9 billion downloads
I thought that was a G
oop
potato potato
Infinity isn't a number?
message.usage = cmd.usage
AttributeError: 'Message' object has no attribute 'usage'
Why does python think im trying to use message.usage? I am setting it?
cmd is probably where the error is originating
I dealt with this earlier
Make sure cmd is a Command object and not a Message maybe 
Yoyo
You have mutual top-level imports, which is almost always a bad idea.
If you really must have mutual imports in Python, the way to do it is to import them within a function:
In b.py:
def cause_a_to_do_something():
import a
a.do_something()
Now a.py can safely do import b without causing problems.
(At first glance it might appear that cause_a_to_do_something() would be hugely inefficient because it does an import every time you call it, but in fact the import work only gets done the first time. The second and subsequent times you import a module, it's a quick operation.)
Found a fix for you bud
What imports lol
Plus I feel like it's pointless to do local imports unless you know what you're doing
So in react I have a select form input inside of a component but the problem is when that component re-renders fully, the select form loses its state going back to the default select, what is the best way to solve this?
I can make it stateful by adding a useState but dont know how I would preverse the state with a select
nevermind it was easier than i thought just add a value={state} to the select
very helpful thank you very much /s
How can I download a sent voice message using the WhatsApp API?
I have to download audio message and convert it to ogg format
that is a very broad question



