#development
1 messages Ā· Page 11 of 1
This just seems like they wanna make your life hell depending on the project
inb4 they ask you to use the native modules to make an api
is this some programmer meme I do not understand 
It's a http status code
But in the form of a cat
Also isn't capy a valid tld? I thought I saw someone talking about it
I know
I was wondering if capy was a valid tld
nah sadly
Make it become a valid tld
yues
Start a go fund me
i'll pay 100k
Why is console.log(data) returning undefined if when I console.log(returned) in checkImage it returns a json object?
you're returning inside the event listener
I dont think you're returning "returned", you're returning returned in the callback
Yeah
Also please use descriptive variable names, naming something returned in a return in a callback is awfully hard to explain(and read).
I need the data pushed outside of the event listener...
async function run() {
let data = await checkImage('', '', '');
console.log(data);
// console.log(`Adult: ${isAdult(data)}`);
// console.log(`Racy: ${isRacy(data)}`);
};
// function isAdult(data) {
// return data.IsImageAdultClassified;
// }
// function isRacy(data) {
// return data.IsImageRacyClassified;
// }
async function checkImage(endpoint, auth, image) {
const https = require('https');
const data = JSON.stringify({
"DataRepresentation":"URL",
"Value":`${image}`
});
const options = {
hostname: `${endpoint}`,
port: 443,
path: '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
'Ocp-Apim-Subscription-Key': `${auth}`
},
};
const req = https.request(options, res => {
res.on('data', d => {
return JSON.parse(d.toString());
});
});
req.on('error', error => {
console.error(error);
});
req.write(data);
req.end();
}
run();```
Personally, I'd create a promise and return that
^
Tim to the rescue.
Thank god, the docs about promises are full of jargon.
return new Promise((resolve, reject) => {
const req = https.request(...);
req.on("end", () => {
resolve()
});
req.on("error", () => {
reject()
})
})
add a data event
collect the data
then resolve the data from the end event
here: ```js
return new Promise((resolve, reject) => {
const req = https.request(...);
const data = [];
req.on("data", d => data.push(d));
req.on("end", () => {
resolve(Buffer.concat(data).toString());
});
req.on("error", () => {
reject()
});
})
This?
the data event can be emitted multiple times, for example when you receive a chunked response
so you have to collect it as many times as it takes, until the end event is emitted
They say they just push a json object back...
chunking happens at the tcp layer
IDK why its becoming a buffer
damn its not working
actually this code shold be applied to res, not req
mb
async function checkImage(endpoint, auth, image) {
return new Promise((resolve, reject) => {
const https = require('https');
const data = JSON.stringify({
"DataRepresentation":"URL",
"Value":`${image}`
});
const options = {
hostname: `${endpoint}`,
port: 443,
path: '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
'Ocp-Apim-Subscription-Key': `${auth}`
},
};
let azureResponse;
const req = https.request(options, res => {
res.on('data', d => {
azureResponse = JSON.parse(d.toString());
});
});
req.write(data);
req.end();
req.on("end", () => {
resolve(azureResponse);
});
req.on("error", (error) => {
reject(error);
})
});
}
this isnt returning anything.
const req = https.request(options, res => {
const azureResponse = [];
res.on('data', d => {
azureResponse.push(d);
});
res.on("end", () => {
resolve(JSON.parse(Buffer.concat(azureResponse).toString()));
})
});
req.write(data);
req.end();
req.on("error", (error) => {
reject(error);
})
I did it different but it worked.
Thanks
I can test this with filters on text too.
This seems weird but accurate
At least I know azure is handling itself lol
Imagine Tim asking a question instead of answering ^_^.
Scary.
making good progress on the parser today
I like this...
I need to make sure it sleeps for 1 second between requests however.
Content filtering.
Love it.
i do ask questions, but usually i find the answer myself before i find someone who can help me lol
my last 3 questions in the typescript server went unanswered lol
just spent 20 minutes debugging an error just to find out that a really basic function that I let copilot write for me fucked everything up
fn matches_one<Item: IntoIterator<Item = TokenType>>(&mut self, items: Item) -> bool {
for item in items {
if self.check(item) {
return true;
}
}
false
}
``` should've been ```rs
fn matches_one<Item: IntoIterator<Item = TokenType>>(&mut self, items: Item) -> bool {
for item in items {
if self.match_token(item) {
return true;
}
}
false
}
fuck you copilot
It was close
close isn't close enough!
check does the same thing as match_token, except match_token advances the current token by 1 if it matches the current token, whereas check just returns true
So my parser was infinitely stuck on a star and trying to parse it as if it was a literal
good thing I tested... 700 lines in
This is why you stop relying on co pilot
I've written the exact same function before, I figured it understood considering the scale of other things its written for me
I'm broke so I don't use copilot
I have it active but don't bother using it anymore
don't want to get locked in/closely tied when it expires anyway
Nice ^_^
Yeah testing it now lol
Ideally you'd test first, publish later
oh I tested that. I just wanna make sure I can use it after installing the package into another project.
its a private package for that reason.
what's the package?
its a content moderation package
Boom
This means I can now use this on my discord bot safely without worrying about google lol.
So time for bed lol.
š¤ if its private why not make a module instead?
Because it will be public š
This is just the one that the company paid for, and as Iām also adding it to their apps for them, it has 0 error handling. The public one needs to return errors and things. I just donāt know how to do that unless I try the methods and throw err in the catchā¦
Idk Iāll look into it in the morning.
Like I was paid to make it by the company I work for. So like yeah. I just⦠need to make it better for public š
Make your own error class ez
Make the errors look better with a custom name space;)
Ok but hereās the thing if I have a function that calls another function and inside the second function part of it errors and I make it throw an error⦠will that stop all other code from executing?
Cool Iāll have to add try and catch to everything that executes so I can make it throw an error for the specific part.

Maybe⦠idk Iām too tired to think about this š
I mean my promise rejects on error so thatās sort of error handlingā¦
This is this overkill?
or is the reject(error) good enough? to fail a try catch when this is called?
You donāt need to throw, that code will never be reached
Reject is essentially āthrowingā in a promise
right so I don't need it here either?
you don't, no
if checkText throws, so will validateText
if anything you'd be messing around with the stacktrace iirc
I'm not an expert on this, maybe @quartz kindle can look at it when he inevitably wakes up tomorrow (I hope he's asleep by now, I think it's late where he is)
Yeah sure, I will let him have access to the repo and he can look fully.
This is the exports for the project. So I hope the error handling is ok.
I might need to change the validate ones as they just return the data for isAdult, isRacy, containsProfanity and correctText in one response⦠so isnāt actually validationā¦
ok so, ultra optimization time:
Consider the following:
- The input is
- A string of size higher than 3, but with arbitrary upper size
- Guaranteed to be lowercase, UTF-8 and not containing accents
- The list is
- A file containing a moderately high amount of lines (100k+)
- Guaranteed to be lowercase, UTF-8, not containing accents and exactly one word per line
- The exact contents and format can be altered to be optimized enough for searching a specific match
what would be the best approach for both sides? (input and file)
I thought about converting the input to bytes and searching for the sequence in a file stream, but maybe there's a better approach as to not have array accesses all the time
you need to open port 80 (or 443 if you have ssl) and use a webserver like apache or nginx
I'm pretty sure there are a ton of tutorials
I think I could write a lookup table on the header of the file to indicate where each initial begins
that way I can jump to the important part
well, it kinda works
just need to get the pad size from the first line, offset by the initial letter and grab the starting index
Hey, anyone know how to execute code sent from the client on the server?
Without using eval or new Function
In nodejs
Hmm
the stigma "never use eval, it's unsafe" is true only if you're allowing anyone to use it
I mean, it can if you start a new process
Yeah
but you'll have no control over it
just open a new process
Open a new process and then what? How do I execute the code sent from client
once you open a new process it'll do it by itself
you cannot control the code in another process
Hmm but like how do I pass the code to the process? Any docs I can check?
Thanks
you can also simply save the string to a file and call node <name of file>
Just fucking made a legit 100% automated 21+ verification using OpenCV, google vision and facial matching software to check selfies, IDs and other stuff. also uses text detection for paper verification
works fucking great
no human/mod needed to verify members who are 21+
Automated it completely. With a 78% threshold for "this person is the same person as on the ID" matching capability. I can raise it to whatever. It creates a new channel JUST for that user and admins and starts the process. its 100% auto. once the 2 photos are uploaded it checks for matches online and then scans the face for probability of a match. if its high enough it will add a role to that person and delete the channel.
Works amazingly fucking well i love it
The only thing i keep thinking is faking IDs and selfies, how hard/easy would that be? you have to take a selfie when you upload the paper verification. and your image on your ID has to match your selife.
thoughts?
Türk varsa bana özelden yazabilirmi ?
fyi you can replace your code here with
let profane = data.Terms.length > 0;
quick js question
if (...) {
const x = 5;
} else {
const x = 6;
console.log(x);
};
this will log 6, right
also, should i define it as y instead?
How to i export my .java into a .jar
i'm using intellij
but like idk how to actually do it 
i'm at the point where I've gone Project Structure --> Artifacts --> done all of that
but theres no .jar šæ
That depends on your condition
You either create x being 5 or 6 depending on your condition
And no⦠if x is supposed to represent the same then calling the var y in your else clause wouldnāt make much sense
Since you will probably need to use the var after your statement
let content = object.members.cache
.filter(user => user.permissions.has('ADMINISTRATOR') && !user.bot)
doesnt seem to filter out the bots
you wanna filter bots?
yes I dont want to include them when mapping
13
const { spawn } = require('child_process');
const child = spawn('node', ['temp.js']);
child.unref()``
Im trying to execute "temp.js"
but it just exists
no errors
console.log("temp file executed...")```
am i doing something wrong?
object is a guild?
Ok well not all members are cached at any time anyways
help bois
If you have the privileged intent then fetching all members is required as first
Without that you wonāt be able to fetch āem all
well I have added await object.members.fetch() before doing the filtering and mapping
but doesn't seem to change a thing
the bots with administrator are still included when mapping
Well because youāre confusing yourself
let content = object.members.cache
.filter(member => member.permissions.has('ADMINISTRATOR') && !member.user.bot)
!user.bot doesnāt exist as property
itās literally a guild member object

oh yeah I figured that out just rn
And user is a property of it and bot a property of user
yeah got myself confused
So when naming your var properly you donāt confuse yourself
fair enoughš

I would also rename object to guild
Makes more sense in that context
Since the parameter is an object but represents a guild (object)
well my object is dynamic and I'll just do a condition to see if property exists to ensure I can reuse my function for not only guilds
( unless I should use separate functions for each case instead, idkk )
But your function returns that object you can actually name whatever you like?!
Since you said itās inside the guild create event what else it is supposed to be?
displayName
@lyric mountain sorry for ping, am i doing it right
object sounds good, I don't wanna name it like "guildMessageInviteChannel...", I use my function for various events etc and the function sends a message to a log channel

Members only have a nickname (which can be null if not)
You wanna get the userās name
.displayName
why the fuck is it not named username/name like in other objects
they make it so complicated by addressing the name differently in every object
can't even test my bot properly because of those retarded captchas I get every time I do something
captchas?
Because in this context itās a nickname not a username
The nickname can be set differently for each guild
It will be null if unset
displayname as property in other objects actually guarantees you to return the currently shown name of the user in that context
Either itās a nickname if set or the username
It can not be null
Then again it's a guild member instance, and that's the reason why it's not named that, and it's better to name things more specific than to name them generally because doing that will just confused things at the end
alright
so why is there no username property that isnt overwritten by nickname
The username exists in the user instance, which is <GuildMember>.user, and for the nickname you can just access the nickname property
when I do .user it shows something like <@userid>, and in my guild it will just display something like invalid user
Because that's the user instance, not the username
oh alright
<GuildMember>.user.username
ic
mb
I tried clicking on .user to see where it leads me to
had to click on ?User instead to see those properties
Thatās what the property user returns
when I type out the thing
it did not display username ( the preview thingy where u see properties when u type them out )
so I assumed there wasnt one existing
An user always has an username
But itās not guaranteed he has a custom nickname in that guild
By preview do you mean the IntelliSense?
If so, those won't show if the type of the value you're using is not defined, or not defined properly at least
oh yeah
ic thanks for clearing up my confusion then
Apparently, the button isn't disabling once the condition is met.
After some testing, the entire disabling isn't working.
Did I do something wrong? I followed the documentation, as well.
Did you log to see if the condition was met?
Lemme double check, once again.
Yes, it is. It returned true.
Wooot?
Water on screen 
Lmaooo.
Pass your row when editing the message again but replace your button builder shit by row.components[1].data.disabled = true;
Oh, the row alone?
You can also log row after trying to disable the button to see if the property disabled applies on the button
When editing the message do you pass row as message component?
You can not edit a single button without sending the entire row again as message component
So⦠show me the .edit(ā¦) line
Yes, I do.
Alright, so I've noticed that if (...) row.components[1].setDisabled(true); worked.
So I'm confused, when am I supposed to use the .from() method and when am I supposed to use the above?
Yeah you can use this method on any action row component
row.components represents an array of action row components
Indeed, but what about this?
Why donāt u just log it?
Without using the setDusabled method
To see what it returns
Moment.
I donāt like or work with the builders so..
Returns the Button Builder class.
ButtonBuilder {
data: {
type: 2,
custom_id: 'reset',
label: 'Cancel Subscription',
style: 4,
emoji: undefined
}
}
ButtonBuilder.from(row.components[2])
My bad, that.
one second
Ah you didnāt read the docs carefully
from()
Creates a new button builder from JSON data
It doesnāt overwrite your existing builder
It creates a new instance
hey guys, why is it impossible to create a channel with these parameters: js let pointchannel = message.guild.channels.cache.find( (channel) => channel.name === "š¦ | UE Modz Traffic" );for some reason my channels can't contain spaces, only - marks
Oh, wat.
So, wait, I need to re-define or something?
Why would you use that method at all?
row.components[i] returns your button builder as well
Oh, wait, so hold on. It's like defining a new Button Builder when using such method?
Yea
I mean, my bad, I looked at docs and applied the changes.
It creates a new button builder
Means you would then need to replace the old
row.components[2] = ButtonBuilder.from(row.components[2]).setDisabled(true);
But this looks so awful
Extremely, back to plan A.
And this works same way as .fetch() as you're getting from the API.
No need to use button builder from here as row.components[2] is your button builder already
For sure, and I mis-understood the changes.
Yeah tbh itās a little bit confusing
ok so I need to make a global queue of interactions that rotates through every second... However I need it to push to the queue from inside a command then trigger outside of that command in a queue handler to complete the interaction... Is this possible in node?
I donāt understand the use case but as long as your queue is in a global scope you can access it anywhere
Would it be best to make something like client.queue = [] then push to that in the command?
Rate limits on an api I use
I can only do X interactions a second.
But youāre aware interactions have a timeout?
Yes but as itās most likely never going to be more than 20 seconds queue time it wonāt matter
And if it stops working⦠Iāll just swap to the paid api version that lets me pass in 10x the interactions at a time.
Well then yes a queue makes sense
Iām just trying to make sure the command doesnāt error because of the limitations of the api.
Itās azure⦠unlimited free requests to the api as long as itās 1 interaction a second.
I think that my subscription covers up to 15000 a second but thatās at Ā£20 per X interactions š
Companies love charging to use their machine learning š
More easier than creating a queue here would be to create a global var representing the last execution of the an api request (timestamp), as soon as the current time is > 1s you at first update the global var with the current timestamp then await the api request
What you said still creates a queue⦠but it has every pending interaction fighting to be next in a clusterfuck fightā¦
I mean you can increase the timeout to two seconds too, to be safe
The queue makes it orderly and you never have two commands fighting to be first as itās first come first served.
I had this conversation with people smarter than use at work when making the build service for our apps. The best solution was a queue
I prefer a chaotic system awaiting the right moment than a continuous interval checking your queue
But all up to you
Itās not continuous intervals⦠the command pushes to the queue and it has an event listener to trigger it. If the queue has items in it⦠then yes⦠it starts an interval. Otherwise it wonāt.
And what do you think an event listener is?
I see your point.
Checking for an event on each tick is literally the same
But tbh it would be overkill to optimize this down to the smallest level
Triggering an event by pushing items to an array representing your queue might be the best solution for your use case
Not sure tho if a simple interval per second checking your array (queue) length and taking action, then slicing the item wouldnāt be more efficient
Probably the same efficiency as the interval will also be checked on an process tick
Good question for @earnest phoenix
Or our benchmarking god Tim
hey in djs v13, is it reaction.message.guild or reaction.guild
soo it's message, thanks fake!
Also hasnāt changed in v14
The class simply represents the reaction (object) like you get it from the api
Which will most likely not change, I guess
I see, awesome!
What about choices, because the guide only covers addChoice, but it's changed to addChoices right?
This for slash command options?
Look at the slash command builder to see the structure of it⦠and then decide if you want to convert it to a pure object without using the builder or use the builder.
const { SlashCommandBuilder } = require('discord.js');
const data = new SlashCommandBuilder()
.setName('gif')
.setDescription('Sends a random gif!')
.addStringOption(option =>
option.setName('category')
.setDescription('The gif category')
.setRequired(true)
.addChoices(
{ name: 'Funny', value: 'gif_funny' },
{ name: 'Meme', value: 'gif_meme' },
{ name: 'Movie', value: 'gif_movie' },
));```
Dunno about builders, I donāt use āem and never will 
how can I a close my Modal in the component himself and set the open state in the other component that is using it?
tried this way and it doesn't work..
You need to pass setOpen down there
Though I don't know if the preferred way in React is to pass state down as parameters
how can i do that?
ah i think i understand
i will try
but there's other way?
if you were the one to do it, how you do it?
ok i did it ty
let server = result.fields.getTextInputValue('serverInput'); // It's logged as "wpojrng".
if (...) {} else {
server = await bot.shard.broadcastEval(client => client.guilds.cache.get(server))?.then(x => x.find(x => x));
}
Apparently, the server inside .get(server) is not defined even though it is.
Error [ReferenceError]: server is not defined
anyone know why my bot is multiplying?
if i leave it for a while and use alot of commands eventually i will start getting double responces
this is without restarting or reconnecting
and now its started to get worse
i know but ive not started another
i tryed to reload the connection with my new command
but now theres 4 instances running
lol
but its not consistant
it works90% ofthe time
Do you happen to use a process manager?
nope
anyone good at nuxt js?
this is the only code other than the index file that has the client.login
== true :C
?
start awaiting your promises sir
truthy >
what prommises?
I want my div to listen to changes to my alertText variable, how do I do that in nuxt3?
<template>
<div>
<div v-if="alertText !== null">
{{ alertText }}
</div>
<button @click="changeData">Just do it</button>
</div>
</template>
<script setup>
let alertText = null
const changeData = async () => {
alertText = "Some random text"
}
</script>
other than the msg send ones
anything is a promise, send returns a promise, destroy(), login() etc.
this will most likely try to login before the client is destroyed
whatever is faster
how though?
since you don't await things it will be fired immediately
guess thats why i should await it
you should await any promise
there are only a few use cases you don't need to
this one isn't one
is there a way to check if the bot is logged on already? like if(bot.connected) or somthing else
I was sleeping
you see, there's a thing about child processes: they won't show errors or logs in your console
because they have their own console (which isn't attached to your current's)
that's why it exits immediately, not because it errors but because it has nothing more than a console.log
ah sweet thx
also, how does .then work?
i have it used in my ping command
but when using it like await bot.destroy().then(()=>{} it says cannot read properties of undefined
thats exactly how its used on the ping command exept thats on a msg send event
and it works fine there
could some one enlighten me on why im wrong?
...do you have a variable named bot?
Why are you using await and .then
you can promise chain like that
In this case, useless, but you can do processing in .thens and the await will return the value of all the chains
cuz thats how it is in the other command
Not to mention, destroy isnāt even a promise
there's the problem
bruh someone said it was like 10 minutes ago
why is components.push(new MessageButton().setLabel("Invite Link").setURL(client.getInvite()).setStyle("LINK"));
deosnt work?
You should read documentation and not rely entirely on what someone says all the time
true
the someone
MessageComponents needs an action row

bruh its edited now
you have to have at least one action row with at least one component
it was a trap
but anyway back to finding a way to make sure that the bot only starts back up when its been destroyed and not at the same time
Await your login call
Destroy is a synchronous operation, login however is not and relies on information sent by the gateway
bruh but how would i make it so that i know the bot has been for sure disconnected befor reconnecting
I donāt know exactly whatās causing you to have multiple instances but thatās a possibility
its the bot just not disconnecting
The gateway connection is destroyed nearly instantly
when u finish ur process, do u close all clients?
Heās trying to make a relog command
a
for some reason if the bot is doing anything whilst i fire disconnect() it wont
That calls client.destroy and then client.login
Just try what I suggested
Ah wait client.destroy might be destroying the client entirely
Iāll look at the source rq, in the meantime just try what I said to do
bruh didnt even see it tbh
what await the login thing?
Yes
Ok from looking at the source code you should be able to just call destroy and then login again
spammed a whole bunch of commands at it and it seems to be not multiplying anymore
let components = [];
components.push(new MessageButton().setLabel("Invite Link").setURL(client.getInvite()).setStyle("LINK"));
if (SUPPORT_SERVER) {
components.push(new MessageButton().setLabel("Support Server").setURL(SUPPORT_SERVER).setStyle("LINK"));
}
if (DASHBOARD.enabled) {
components.push(new MessageButton().setLabel("Dashboard Link").setURL(DASHBOARD.baseURL).setStyle("LINK"));
}
let buttonsRow = new MessageActionRow().addComponents(components);
return { embeds: [embed], components: [buttonsRow] };
}
Any ideas? components[0].components[1].url: Scheme "1000421766751072296" is not supported. Scheme must be one of ('http', 'https', 'discord').
well your first component has no valid URL
Also which djs version do you use?
client.getInvite() can't seem to find getInvite() as method in any of them
no response means everything works as intended, everything is nice
Appreciate your help @boreal iron Thanks!!1!
Np 
huh, js Uncaught DiscordjsError RangeError [EMBED_FOOTER_TEXT]: MessageEmbed footer text must be a string.
Hello! Can anyone read through my code and see if there is anything wrong? I'm trying to make a command that sends a message to every guild the bot is in, but sometimes it works and sometimes it doesn't, and I don't see why it doesn't
let embed1 = new MessageEmbed()
.setTitle(`Ticket System`)
.setColor("GREEN")
.setFooter({content: 'UE Modz | Tickets'})
.setTimestamp()
.setDescription(`React with š© to create a ticket. The staff team will answer as soon as possible!`)```
oopsie, it's text
inb4 fake suggests using no builders
Why did they change the footers to only contain a text property while all embeds etc etc use contents?
ok this is the appropriate time to suggest not using builders
The developers are honestly fucking this api and making it harder for no reason
Waffle u free?
That would still require to pass the right option name, or property name in case it isnāt the builder 
Bad idea
y?
That's called a ratelimit
^
Make a command, let em show details about the progress if they want to
Again, still not recommended. Put a link to your support server in the bot's about me, and then if people care, they'll join. Or that too ^^
Nothing technically, but ratelimits will stop you
And people do not like unsolicited messages they did not sign up for in their servers
As well as the api guidelines and rules
^
but what if you send one every minute or smth?
will that be rate limited?
i wont do it, just trying to understand
sounds like you wanna do it :^)
just curious :p
Well⦠you gotta figure it out, it doesnāt take much long until a bot gets flagged, I heard
When continuously sending messages to users or guilds
Like I said make it a command OR attach some info like a button, quote etc. to other command responses
Like
thereās some progress, execute /info to see details
After a regular response text, embed etc
discord reserves the right to monitor their api usage, and if it's deemed to be against the rules (Which spam is potentially one of those), they can block you from the api
but the way dank does it is allowed right
like notifs when sending messages
alertbox or whatever its called
I don't know of such feature
If it's opt-in, then it's likely allowed
But sending messages to all of your servers without their knowledge of your intent to do so can definitely be deemed as spam
^^
I think he means something like this
yeah
Which is part of a regular response you sent if somebody executes a command
alr
No random message to a guild or user
What does this mean? I don't understand what the mistake is.
let components = [];
components.push(new MessageButton().setLabel("Invite Link").setURL(client.getInvite()).setStyle("LINK"));
if (SUPPORT_SERVER) {
components.push(new MessageButton().setLabel("Support Server").setURL(SUPPORT_SERVER).setStyle("LINK"));
}
if (DASHBOARD.enabled) {
components.push(new MessageButton().setLabel("Dashboard Link").setURL(DASHBOARD.baseURL).setStyle("LINK"));
}
let buttonsRow = new MessageActionRow().addComponents(components);
return { embeds: [embed], components: [buttonsRow] };
}
DiscordAPIError: Invalid Form Body
components[0].components[1].url: Scheme "1000421766751072296" is not supported. Scheme must be one of ('http', 'https', 'discord').
they answered u already
I know but I have used all possibilities nevertheless comes the error š
no you didn't
oh
u didn't even try the suggested solution
^
no
I'm 101% you haven't, else you wouldn't paste the very same message
the issue is that you are sending the server ID
where it's expecting an url
no it isn't
Scheme "1000421766751072296" is not supported
else it wouldn't show the id
Letās make it easy
Log all 3 vars youāre using as URLs
And you will see whatās wrong
inb4: "how"

I have hope!
setTimeout(() => {
channel1.messages.fetch().then(async messages => {
console.log(`${messages.size} messages.`);
let finalArray = [];
const putInArray = async (data) => finalArray.push(data);
const handleTime = (timestamp) => moment(timestamp).format("DD/MM/YYYY - hh:mm:ss a").replace("pm", "PM").replace("am", "AM");
for (const message of messages.array().reverse()) await putInArray(`${handleTime(message.timestamp)} ${message.author.username} : ${message.content}\n`);
});
}, 20000);``` why is messages.array not a function?
you really really shouldn't do that inside the condition of the for loop
messages is Collection<Snowflake, Message> which has no function .array()
You can just do messages.reverse() https://discord.js.org/#/docs/collection/main/class/Collection?scrollTo=reverse
documentation is useful, make sure to use it
Also why is putInArray an async function if you're not using any sort of async stuff in it?
Same thing with the anon function in the .then callback, you don't need the async if you remove the async from putInArray

what do you guys think of the name "Milkshake" for abot?
boring, too common
"Anonymous Hater" makes literally 0 sense for a bot name tbh, anything is better
I took that name from my old bot that didn't work out
it was a bot that used AI to annoy people
like someone said "bruh" and the bot would respond with ""bruh" what are you an idiot?"
so I just took that name thinking it was good
that's not an ai but ok lol
Artificial intelligence:
if
elseif
elseif
elseif
ā¦
lol
saw someone that claimed they were using ai but when you looked at their repo it was just a bunch of if statements
it was writter slightly better and it saved texts other people said in chat
saved messages from a chat... š¤Ø
but it got barely to like 20 guilds
yeah to reuse them
anyway what would be a good name then š I want to verify my bot but I don't have a good name
Maybe you should do something people need, which is unique and isnāt annoying at all
inb4 someone spams racial slurs and your bot gets terminated
that's why the bot didn't work out too well
perhaps you should think of a name that is at least remotely related to what your bot does
and when you come up with a name, search to see if it's on top.gg before you decide on that name
otherwise the more popular bot will forever overshadow you
well my bot is a multipurpose bot
hey is there a bulkDelete() method to delete a cetrain amount of messages
so I don't think any name would fit it?
YAMPB
Or you choose some random anime name all the nerds out there know
it takes in a variable
bulkDelete(amount)
much love Bae
yet another multipurpose discord bot
isn't this already taken?
wot
I was making a comment, not a name suggestion
oh 
you should probably make a feature that isn't offered by 10 thousand other bots and market off of that
my bot has original commands though 

Well, if you're marketing as multipurpose then nobody is going to care

Focus more on one thing
giant multipurpose bots like YAGPDB and MEE6 and Dyno already dominate that space
??? would that not be better if a bot has good commands in every theme?
yes it is, I personally think my bot has better moderation that dyno and definitely better welcome messages than mee6
I forgot what YAGPDB did
Unfortunately nobody is going to care because those options already exist and are known to be reliable
okay first I need to think of a name
Nobody is going to want to use your bot if it doesn't have many servers and it does the same things as existing giants in the space
then I'll properly brand it as something
You need to offer more unique features
A name isn't going to have THAT much of an effect on your growth
I think I do
What do you offer
well I can't tell you much from the top of my head, but many plugins, anti spam, anti malware, afk and working on a anti raid system. Couple unique commands paired with those not so unique, lots of games and fun commands, lots of utility commands as well
you would have to either take my word for it being unique or join my server to see for yourself
sounds like it exists in 20 million other bots
:^)
every general purpose moderation bot has anti raid, afk, and anti spam
I don't see many bots that have anti raid
Which from that whole list sounds like the most important features of your bot considering you didn't mention any others, other than the malware
Which I suppose you could expand on what you mean by "anti malware"
Yes, and wick already dominates that space
Well known for being the best option
it's using virustotal to scan people's attachments that they send to a discord server to see if they have any malcious detection and/or have any hash that's recognized as malicious by virustotal
Didn't we already go over that previously? I thought it marks all discord files as malicious
no no I don't use discord cdn to upload that
I get the hash from the attachment then send it over to the virustotal API
The... hash...?
the unique key any file has
Which is from what property of it exactly
let me google rq
Hashing is a process that transforms arbitrary-length data into a small, fixed-length string of characters called a digest or message digest. Malware hashes are used by virus protection systems to identify viruses. They consist of calculated numerical values of code unique to the virus.
and virustotal has an API to check for that hash and if an user uploads any malware that's been scanned with virustotal previously it will check for the detections
if it has over 3 it will flag it as malicious and delete the message
simple
Ok
The problem is that at a glance your bot is not unique
You need something to make it stand out
^^
Don't market under "multipurpose", find something specific
yeah 90% of all discord bots are mostly the same some one that doent know the first thing about bots is just gonna use one of the populare ones and wont sirch for anything else
yeah but to do that I need to find a matching name with the thing I wanna go for
I literally have negative ideas right now
my brain empty
bruh
I had 2 suggestions from other people but u guys said it's bad and generic
so help me find something good enough š
idk name it after som obscure medicine
You should not be focused on the name, focus on what features you want to market under. THEN, you can pick a name
those have pretty whacky names
just call it jeoff
Perhaps you'll come up with something after thinking of features
I'll call the bot Paracetamol 
lol
ngl that actually sounds kinda mad
i mean i called my test bot uganden hank hill
but I still want to make it general use bot
since it does have commands from most generes
only missing music and economy commands
i mean you can add the general use commands but if this isnt the only bot in a server then i doubt they will get used
I had a couple big servers add my bot
a 1k a 25k and 7k servers and they use it as their default bot
also a 3k server added it today
member count doesn't matter
server count and usage is what matters
my bot is in a 25k server, they have never used a single command
If you insist on making it a general purpose bot, then have fun. The chances are that you will not succeed in that space
same
they give me good stats idc if they acc use it 
okay okay I'll brand it as something
my bot is only really used in small servers
but it will truly be easier if I had a name first
it literally wont lmao
think about what you're going to market it as then come up with a name
litterally just call it Paracetamol
you think that burger king came up with their name before coming up with the idea to make burgers? Cmon, common sense here
at this point
@wheat mesa I just thought of a name whilst looking at my fridge
electrolux
this sounds weird
but the bot is literally general purpose right now no matter what I do, I don't have a unique aspect I want to go for
and if I have name corresponding to some theme I can then make commands more based on that theme
My man you should come up with something of actual substance before you come up with a name
I can't
I donāt know how many times I have to say it
my brain is legit empty I don't even have an actual command idea
if I have a name, I can think of a theme and if I have a theme I can think of commands that work with the theme
:/
š please
Make super auto pets in a discord bot.
Make it seasonally themed.
Name it super auto bots.
its the make of fridge i have
I have no idea what to even do with the bot anymore
bruh
i just game up and made a bunch of shitpost commands
like open the dvd drive
beep the server bios buzzer
if you want to make a bot for it be popular and successful, good luck lol, if you want to make a bot to practice coding, than just make anything
dont try to force something to happen if it doesnt need to happen or youll just be disappointed
One of the issues with asking us what you want is we don't know what you want(the weird phrasing is intentional).
If your goal is a multipurpose bot the name wont likely matter much though.
I just need a name, literally any that sounds mildly ok will do
For real⦠who tf wants to play a game in a chat
I like how you ignored the last 15 messages that told you to figure out a gimmick and then name your bot, and instead keep asking for a name
āInsanity is doing the same thing over and over again and expecting a different resultā
since your bot is general purpose most anything will work as a name.
Eli, Kist, Glob, anything will do. I don't think till affect your bots growth much at all, as long as the name is short and easy to say/remember.
but those are generic names, as you guys said earlier. And you guys say every name I come up with is also bad, forgettable or generic
Are you trying to determine the name for your bot?
I think thats the issue you're missing, if your bots generic then whatever you name it doesn't matter.
If you dont want to pick something specific about your bot you want to be the focus then every name will be generic too.
Multi purpose bot problems
I need a name that does not sound boring as you guys said
Name it a random german word.
German is an interesting language, so itll sound non boring ^_^
If your bot is just a multi purpose general bot it will be forgettable regardless
anyone know - char but the circle one?
panzerfaust

At least those names make it look interesting
Tim being afk the entire day, as soon as the trolling begins heās here to participate
:^)

Ehrmantraut š
I'm making a quite weird server setup command will any actual dev be able to test it? I don't know if asking people who don't know how bots work to test it yet
if you have a moment dm me your server invite so I can join
Im having alot of issues getting passed a point in my bots features.
the bot scans your ID for text and your face on the ID, then you send a selfie and if the ID and the selfie match it does paper verification. if that matches too you get verified. the issue is people can just add say 01/01/2004 to their ID, overtop their DOB and the bot will think theyre 18 and they will pass.
currently, if the image isnt messed with, it works SUPER well. its great! but people can just use paint to add 1/1/2004 to their DOB and they'd be 18 according to the server.
How can i stop that?
trying to remove humans from ID verification
this looks promising https://i.imgur.com/h0CovGM.png
Literally why I named my bot after someone I miss every day.
Didnāt have anything specific about it I wanted to highlight⦠so dead friend became who it was named after
I also solved this with stripe age verification using machine learning. Or you could use the semi-free azure option that does the same thing.
stripe age verification using machine learning?
Itās not āage verificationā itās just their identity platform.
doesnt stripe use humans, not machine learning?
Nope
Itās machine learning.
Thatās why I use stripe for payments and identity verification.
it gets your databirth from the ID and the photo from it
I was already going to respond earlier but didnāt, obviously but providing any personal information especially an ID to a discord bot is one of the most terrifying ideas ever
While it will be impossible for you to verify those ID cards/papers anyway, I canāt actually think of a bigger privacy concern
the bot will be 100% open source š
And it makes you take a photo using your camera live and tells you that they are who is in the id document. And can verify that the document is a legitimate document from a government.
Meaning that other than the azure alternative⦠it is the best and most accurate way to verify age and identity.
ok, i think i may have a solution for live camera
ok, i think i may have a solution for live camera
I doubt a free bot can really use stripe though
That my 5 months of researching came up with once I removed humanās.
can go to my website -> verify live -> return
Thereās a reason companies exist doing live video checks to verify you while holding your ID card in your hands
ah, that formula reminds me of my graduation project
Thatās why you use the azure alternative that is free with a rate limit.
any insight here?
I got around it by creating a digital ID platform that other bots can ping a discord ID to and get if the person is āverifiedā and if they are over 18.
The user can choose to get verified. But they have to pay the stripe fee to do so.
tbh, idk if you REALLY want to handle such things
You donāt. Thatās why you pay others to for you.
not about that, but dealing with personal documents at all
especially in discord
I just store discord id, over 18 confirmed. Identity confirmed. Free of liabilities.
the law is reeeeeeeally stict regarding handling IDs and other stuff on the internet
same here, just ID of user
Yepā¦
especially after GDPL
I donāt see any use case except payments requiring a reason for such a verification
Fuck GDPR is making me create automated systems for users to request all their data from me and my third party providers that handle their payments etc⦠and request deletion.
its a good thing though
what bout dong this, sorta
PHP 7 Script to Take Photos From Webcam and Download it as PNG Image in Local Disk Using Webcam.js
Download the full source code of application here:
#php #coding #pro...
live capture of ID
yes? no?
This, this is why I have my platform. I am creating a content creator platform where they can sell all sorts except pornography or drugs etc⦠as long as it complies with laws etc. but some products do require age verification due to there being 0 restriction other than ensuring users are over 18 for alcohol.
Plus⦠itās a cool gimmick to sell to onlyfans creators that you can automatically verify the ages of their users at a 90% accuracy for a set cost per X users š
tbh, it probably makes more sense to limit alcohol or anything that requires 18+ until later when you have a larger team.
This.
Just assuming user do even have a web browser it doesnāt change anything, makes things even worse
youll want a legal team to even begin selling alcohol.
Iām not selling it. Iām just the one hosting their website š
But yes, I checked with lawyers⦠and then created my platform to cover age verification to a legally protected state.
Thatās why it took over 6 months to make.
I wouldnāt recommend going down that route unless you have a specific product you need it for.
still you're handling the data, you're responsible.
Are you handling it based on the shipping address? my state doesn't allow shipping of alcohol to home addresses, 25 minute drive and you can have it delivered, unless you're in the city then you cant again.
cough megaupload cough
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
any way to do this better?
I receive data, I check against the data recieved and itās not logged, stored, cached or anything. My creators are UK based with a limit to UK shipping only until my platform is cleared for EU shipping. We only cover digital product sales internationally.
I have very strict rules on what I can sell and where due to the UK and brexit and stuff.
š¤ it seems you need a license to sell alcohol online in the UK.
And if you check my website payment support itās GBP, USD and CAD.
Which is why itās not done yet and Iām not the one selling it how many damn times do I have to say that?
For the one company in talks with me to create a webstore for home brew⦠I am just handling the site hosting and age verification. They are the one needing the license not me.
can anyone check the code out???
Tf am I locking at again
my first attempt at a server setup command
never done this before no idea what to actually do
Your replying like 100 times to a message?
yeah but it's asking different question each time
Not quite but it is a lot.
about what to setup and how to set up
I'm tired lol this took about 40 minutes of copy pasting and typing different thing for each prompt

Guided or not just use a select menu 
Your enemy - I know
you are selling it though, is a grocery store not selling alcohol because they have a cashier?
If you're handling data your need to comply with the laws, the same as any other business or person.
You dont have to be the one shipping something to be part of the sale process.
I wanted to but I wasn't sure how to actually implement a select menu into that
No I am not selling it⦠Iām selling the age verification and the website hosting serverā¦
can anyone test the server setup command in their server? I wanna see if there is any errors or problems or anything
You respond with a select menu to your command, then as you still donāt seem to use the event, use a collector to collect the selections
I literally have 3 months of conversations with lawyers about this⦠you have like 10 minutes of rudimentary information about the most thought out product I have.
I know I am covered. And what I need. And I got it.
so you're saying that the user would have to pick what to edit? that's pointless because it's not a settings command rather an setup command
So you wanna enforce em to set the settings
look at my code, if they don't reply the value remains at default
Setup commands are tricky⦠as not all things should be required to be configured out the gates. My setup command is to register your server so that it works with the api I use to link them to the dashboard. Meaning they canāt use the dashboard or support if they donāt run the setup command. I donāt force them to enable or configure anything.
Tbh I donāt know what you need to take as input but a mix of modals and messages components might be neat
oh I forgot about modals...
Shhhh donāt give a great idea away for free š
ah I can't use modals because they're exclusive to PC
Buttons like previous and next step make things easier
No modals arenāt exclusive to PC
They do
Already since they got officially released
They made it official? Or still ātext input onlyā?
yeah I thought they weren't even announced yet and someone just discovered that feature
Nah Iāve been using them with unsupported components on my test bot version of my bot for a support ticket command.
What you mean is a select menu inside a modal, not the modals itself my gosh
And no they arenāt released yet
Since v14 was in dev version only.
Iām waiting on them to officially support select menus.
It will probably be released with more field types
Thank fuck⦠I want radio buttons.
Select menus are great for a lot of data inputs. But sometimes you just want agree, disagree.
Thatās not a āwe need you to agree to us processing this data under GDPRā select buttons.
Like select menus for that are great but⦠not really.
Radio buttons work better.
Well providing a modular and dynamic way to build the modal with their action rows especially combining elements is very tricky
Especially when you enable multichoice. Modals here should work like modals in html. And those contain forms. Forms take all sorts of easy to implement features from html such as radio buttons select menus text input sliders etc.
š¤¦
Lookup what discord is developed inā¦
my guess, attachment processing
š¤·āāļø
Elixir makes sense
All support form inputs equal to html forms and are therefore easy to implement into their methods
Its a good API language
Yep.
Learn python then itās just a smaller jump to cā¦
No one's even talking about python
Python is basically a simpler C at its coreā¦
It's not even in the conversation
Nowhere even close
python is nothing like c
I'd only ever use python for ml
literally
The issue is not the implementation, the issue is to make it a modular and user friendly system.
For example your radio buttonsā¦
One per action row, maybe two maybe three?
What if a label is added to them?
Then one per action row?
What if you wanna combine it with a āsmallā text field per line
Etc.
Itās not html, itās an API which needs to register anything and an UI which has lots of restrictions need to be enforced to prevent things get messed up
it's like saying html similar syntax to brainfuck
written in c
I'm not going to read all of what fake said as I'm not part of the conversation
but not based on c
how do I create a channel with preset permissions in discord.js?
Written in C does not mean based on c
you don't
Lmao
huh?
waffle is hecking right
A lot of languages are written in C, doesnāt mean itās based in C
Define it's permission overwrites
kinda stole my thing but still right
The radio buttons are a collection of buttons under one object.
But the first google match says so. So it@must be true!
Like a select menu.
Like Iām writing my language in rust, doesnāt mean it has anything similar to rust
fr?
send repo pls
i wanna see š³
When Iām done
Waffle would never
This the breakfast language?
I donāt have a repo yet
Can I code with pancakes yet?
No, they can be labeled or not labeled leading to a different width which would again require a text limitation since the Ui has its limits, like for names and descriptions
Also waffle is pancake a valid keyword in your language?
client.user.id to get the bots ID?
Yes
Yes it is
Why
And waffle is not valid
very nice
WHY



