#development
1 messages · Page 73 of 1
because if channelId is null/undefined, its still not equal to channel.id
so it still proceeds anyway
so you need something like if(state.channelId && state.channelId !== channel.id)
scratches head
I've just read the upcoming changes, last post in #discord-news , and my bot does use the guild members intend. It's also written in python.
at the moment the line according to the guild members intend looks something like this:
intents = discord.Intents.default() | discord.Intents.members
Does someone know how to adjust this part, so it keeps working at December 16th and into the future?
september 16th was 2 and a half months ago
what news are you talking about?
Also there's nothing to change there, it's correct
what time period are you from?
and who changed my name to development < football ??????
👀
delevopment
was it you
sorry, edit that
mod abuse
Amazing
Maybe
starting 16th next month ofc
gib back certified developer nickname powers
he meant 16th of december
But what news are actually talking about? I see nothing relevant in the channel you mentioned
i think he means these news :
#discord-news message
that has nothing to do with intents
lmao
maybe the language is in the way, i am not a native and.. well.. lets just say my English isn't exactly the finest in the world.
mind to enlighten me a little?
the changes talk specifically about the permission system used in slash commands
alright, thats something I use.
when you receive a slash command or interaction, it contains a set of permissions to help you determine if the person is allowed to use the command or not, without having to check the user's roles and permissions manually
i believe you can also specify some required permissions when you create the command
Anyone here ever worked with google oauth?
so it only appears for people who have the required permissions
Yes you can
default_member_permissions is the field name
Unfortunately the member requires to have exactly this permission(s)
at the moment my slash commands don't check for permissions in the code. instead people get told in the bot's video, that they should only allow slash commands for this bot to people/roles they trust (cause it can kick) and are also shown how to control this within Discord.
is there a need for me to implement changes to this design?
i believe you dont need to change anything
And thank you so much for simplifying the post for me!!
You can also send a default permission requirement for the commands but only once you register them
You can not update them later
It all doesn't really make much sense to me tbh
But it is how it is
btw, do I need to do anything to get the bot developer role?
mine got approved by top.gg just a day ago or so.
Our bot that gives the role keeps going down 😔
Let me rewrite it instead 
maybe he's just lazy 😄
Thanks for assigning me the role
Imagine declining bots on your completely bugged non working site for having issues or don't respond properly while your own bot doesn't do what it is supposed to

The irony is real
make me a mosquito killer bot
LMAO
we do that yeah
thankfully its our private bot that doesnt work
Caught in 1080p
I'm gonna make a bot that turns you into a catgirl, oh wait... You're already one
OwO?
lmao
Good girl Tim 
btw voltrex
Still funny tho
Does it? I've never seen it become slow in idle mode
i see it all the time
http responses are always much slower after idling for a while
like first request takes 1-2+ seconds
second request takes < 100ms
unless its nginx's fault?
x doubt
No idea, I haven't seen anybody else report that kind of issue either
It's probably something on your end but it's hard to know
its always been like this
i always assumed it was part of node's design
to conserve resources
Well Node.js does hibernate and do some resource-saving tactics when it becomes idle but I wouldn't expect it to become that slow, never seen it myself either
V8 itself also does it's own part of tactics when it's idle
yeah its not always as severe
but sometimes it makes my bot miss a discord webhook
and fail a command
Weird
What Node.js version do you use btw?
Did that also occur on v18?
yup
i remember this occurring since forever
since v8 v10 v12
i see it happen in my benchmarks too
sometimes i leave the node repl on idle for a while
then run a benchmark on it, and the first one is always slower than the second one
I assume this is something related to the Discord API or the client not being able to send the request properly, I've seen this exact issue reported by multiple people in various different programming languages across different Discord API libraries
yeah could also be
But moving Discord-related stuff aside, the performance part in idle mode in general is something interesting
Even though I've never seen it happen myself, could be that the idle tactics of Node.js and V8 are getting in each other's way and causing some sort of regression
People be using semver or other nice versioning schemes, like normal
Meanwhile "Speech Services by Google":
xDD
This combined with the fact that I have interactions piped down my ws leads to a lot of failed interactions as resume times take for-fucking-ever sometimes
rip
or maybe my code just sucks
nah delevopment is the correct one
yall gotta learn english better
Thanks I already found it though
client.on("messageCreate", message => {
if(message.author.bot) return;
if(message.content.startsWith("unusual")) {
message.channel.send("Hello!")
}
if(message.content.startsWith("Hi")) {
message.reply(`Hello ${message.author} How are you?`)
}
if(message.content.startsWith("Im good")) {
message.channel.send(`That's nice ${message.author} Im good too!`)
}
})
``` is not working and is supposed to send back a message but logs nothing and doesnt work at all
Also all intents are on and defined
bro yall made a typo or soemthing in the channel name?
One message removed from a suspended account.
i did
const Discord = require("discord.js");
const { Client, message } = require("discord.js");
const client = new Discord.Client({
intents: 32767,
});
const config = require("./config.json");
const logs = 888162129520230464
client.on("ready", async () => {
console.log(`Logged in as ${client.user.username}`)
console.log(`Guilds: ${client.guilds.cache.size}`)
console.log(`Users: ${client.users.cache.size}`)
client.user.setPresence({
activity: {
name: `Unusual V1`,
type: `WATCHING`
},
status: `idle`
}),
console.log("status set")
});
client.on("messageCreate", message => {
if(message.author.bot) return;
if(message.content.startsWith("unusual")) {
message.channel.send("Hello!")
console.log("test")
}
if(message.content.startsWith("Hi")) {
message.reply(`Hello ${message.author} How are you?`)
}
if(message.content.startsWith("Im good")) {
message.channel.send(`That's nice ${message.author} Im good too!`)
}
})
client.login(config.token)```
@sage bobcat
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
igor sent me the code
One message removed from a suspended account.
One message removed from a suspended account.
its also supposed to log the word test but it doesnt
yes
actually do you have message content intent enabled? log the message before you do anything with it to see if it actually has a content prop
ok
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
it's not
One message removed from a suspended account.
One message removed from a suspended account.
startsWith just checks if the first letters in the message are the argument given to it
theres no log
OHH
then you're not getting a messageCreate event
One message removed from a suspended account.
can you show your current code

const Discord = require("discord.js");
const { Client, message } = require("discord.js");
const client = new Discord.Client({
intents: 32767,
});
const config = require("./config.json");
const logs = require("./config.json")
client.on("ready", async () => {
console.log(`Logged in as ${client.user.username}`)
console.log(`Guilds: ${client.guilds.cache.size}`)
console.log(`Users: ${client.users.cache.size}`)
client.user.setPresence({
activity: {
name: `Unusual V1`,
type: `WATCHING`
},
status: `idle`
}),
console.log("status set")
});
client.on("messageCreate", message => {
console.log("test")
if(message.author.bot) return;
if(message.content.startsWith("unusual")) {
message.channel.send("Hello!")
}
if(message.content.startsWith("Hi")) {
message.reply(`Hello ${message.author} How are you?`)
}
if(message.content.startsWith("Im good")) {
message.channel.send(`That's nice ${message.author} Im good too!`)
}
})
client.login(config.token)```
thats it
@wheat mesa
and what are you typing
h
ok well it's going to log test every time you type a message
but when i remove the log nothing happens
I told you to log the message, not test
console.log(message)
<ref *1> Message { channelId: '888162129520230464', guildId: '888162129520230460', id: '1047725377189052527', createdTimestamp: 1669867595718, type: 0, system: false, content: '', author: User { id: '919674489581731842', bot: false, system: false, flags: UserFlagsBitField { bitfield: 4194432 }, username: 'TW rblx', discriminator: '0001', avatar: 'a_1c20c245c538d57634f25ba87b8a6654', banner: undefined, accentColor: undefined }, pinned: false, tts: false, nonce: '1047725374353440768', embeds: [], components: [], attachments: Collection(0) [Map] {}, stickers: Collection(0) [Map] {}, position: null, editedTimestamp: null, reactions: ReactionManager { message: [Circular *1] }, mentions: MessageMentions { everyone: false, users: Collection(0) [Map] {}, roles: Collection(0) [Map] {}, _members: null, _channels: null, _parsedUsers: null, crosspostedChannels: Collection(0) [Map] {}, repliedUser: null }, webhookId: null, groupActivityApplication: null, applicationId: null, activity: null, flags: MessageFlagsBitField { bitfield: 0 }, reference: null, interaction: null }
that uh happend
you'll see that content is an empty string
go enable message content intent and then retry
I did!
looks like you didn't
And did you reflect that change in your code with your intents flag?
i think soo
Use the enums, not a number please
i don’t remember anything rn
It is unreadable in that form because it's not meant to be understood in the context of a base 10 digit
?
i wannnna kill my bot
Do it
pull the plug
stop coding
save yourself the pain
There are heights in ux and performance you cannot attain
gm
Hey! Anything we can help with? 👀
gm Yohan
Gm to you too!
hi
..
can help me everyone with this error ???
whatever you're trying to access cache of, is undefined
in this case, channel.messages
ty
does anyone know why vscode screams me this?
Cannot find module '../config.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.ts(2732)
import config from "../config.json"
I already added "resolveJsonModule": true to my compilerconfig and when I compile and run everything works fine
aren't u supposed to use require(jsonfile) for json files?
...require is supposed to be used for non-code files
'require' call may be converted to an import.
did that appear as a warning?
no, neither does import
then where did u see it?
mouse-over
then it did appear as a warning
when I mean "warning" I mean the yellow highlighting
not runtime errors
but well, if the former works then use it, tho I'm skeptical whether it's the correct way of importing json files
it should work
resolveJsonModule:true is made exactly for importing json files using the import syntax
try reloading the vsc window
sometimes that fixes intellisense bugs
yup, works
Hi
wrong place to ask
@daring tapir hey! That’s great your looking for people. But please don’t advertise that here ☺️
Feel free to reach out to Xiuh or Mac if you want to have it posted in #434058442764714002
is it worth rewriting my bot with typescript?
I rewrote my api and it wasnt that big of a change
well, you're not going to find any meaningful performance change if that's what ur expecting
ts is still js, but typed
it'll be either as fast or slower than js
but it'll for sure be easier to debug and prevent a lot of bad habits when coding
ts takes more time to run since they need to be transpiled to js first
Does my bot have to be in Slash Commands to be accepted on your site?
yeah, I mainly want ts cuz of my code structure, it would save alot of trips to discord.js docs if they have an interface available, do they?
I uploaded my bot and you rejected it
And you told me
Your bot doesn't have any actual (functioning) features/commands.
perhaps, intellisense will be better than js since the editor knows what kind of value it's dealing with
won't be the same experience as a strictly-typed language tho
(disclaimer: it wasn't me that declined the bot, I don't represent topgg in any way)
did you test your commands to make sure they work without any perms?
yes
what permissions does it have?
what do you mean ?
role permissions, try removing all except "Send Messages" and "Read Messages"
yeah it wont work
bot reviewers invite bots without any permissions
aside from "Read/Write Messages"
yeah, how do I get discord.jsS ts interface? sicne I have each command in a different file so I want to do like
async execute(interaction: discord.interactioniInterface, ...)
or sum
what do I have to do now ?
can't answer since I don't use ts
properly test your bot and make sure it asks for permissions if a command needs it
then you can reapply and wait for review again
I didn't do it in all orders
Should it be a special language?
@ Tim
👀
not really, all languages are accepted in topgg
you just need to request permissions if a command requires it
found it
Laziness 
that's actually a pretty good idea
I assume there's a lib for that already but I should write one in rust for tons of the most common langs
It's also creating boilerplate code in the solving file
How can i use this?
Use .icon on a guild object
okay thanks
What do you mean with guild object?
If you have an interaction variable called interaction that gets passed to your event / command its under the guild property, aka interaction.guild. thats the guild object
thx
how can i export the Discord Bot Client? in Discordjs
I will import this in a event
🤔
All the events that get dispatched by the client should already have the client attached to one of the properties it returns
So I don't see why you or anyone else needs to pass this into an event
old laptop
that doesn't exist
whats the best way to get the commit count of a local dir in js?
I currently use this package but wanna do without it
import { default as commitCount } from "git-commit-count"
we'll all die one day
@harsh nova kindly
Behave.
NO YOU FUCKING SHIT HEAD
-b 969690723647623239 didn’t behave
Banned slidersocer531#2407
slidersocer531#2407 was successfully banned.
ty
what
doin const amount = interaction.options.get("amount").value
works but why doesnt getInteger?
"doesn't work"?
Just don't use this stupid guards
Djs tends to remove or rename them with every version however they like
the getter get() method is all you need
Once the option isn't a required option, just chain the getter optionally
...get("...")?.value
Almost guaranteed the next djs version doesn't fuck your code up again just by renaming or removing those guarded methods
@ivory siren remov
mf choose the wrong server to talk about nft
@visual dome please don't do self promotion here
ok nft user 
how can I fix this? preferrably without making a new variable
what's the rest of the error
because it's probably a getter and you need to use a method like setDisabled
because it is a read only property
ok then great. A variable isn't gonna help you there lmao. if there's a setDisabled method, use it
actually since it's a received item, it might be frozen
because js doesn't care about annotations or types
it lets you throw runtime errors
If something is annotated as readonly, then maybe the intended approach is to create another message component with the desired data
Is it possible and if so how would I add 2 server names without duplicating the site config in Nginx?
Not doing annotations can cause bugs 
this works
(interaction.message.components[0].components[1].disabled as any) = true
fuck I mean semi colons
This is cursed and unsafe
I wouldnt call it unsafe, im not accessing it ever after again
type casting to ignore compiler errors is literally unsafe 🤣
what else am I supposed to do then?
thats exactly what im trying to avoid
Your laziness may bite you in the ass when djs makes a breaking change and remakes builders for the 20th time
Jarvis, redesign the builders for the 50th time
literally
"Yes, sir."
djs advocates coping so fucking hard when they have to redesign their entire code base for the 5th time ever since v11
I'm glad I stepped away from that
it was hilarious when they removed all mentions and I had to pr it back in because nobody knows regular expressions
context: disableEveryone was yeeted
@gilded plank
a
sir use variables please
if the JIT judges them as redundant it'll inline them automatically
Deck the halls with bytes of joy
Fa la la la la, la la la la
Tis the season to code, oh boy
Fa la la la la, la la la la
Don your Santa hat, and grab your keyboard too
For it's time to create, and make our dreams come true
With C++ as our guide, we'll make our projects shine
And spread Christmas cheer, with each line of code divine
Oh, jingle bells, jingle bells
Coding all the way
Oh, what fun it is to code
A program on this day
Jingle all the way
Oh, what fun it is to code
A program on this day
So let us raise a glass, to C++ and its might
For it is the language, that makes our Christmas bright
Here's to a Merry C++ Christmas, and a Happy New Year
May your code always compile, without any fear!
gm
no null terminator, best I can do is SIGSEGV

classic #development

gm
Am helo , can i send massge to you if i have Some Err 💀
Im normal Codder i think you Have Veryfied Bot

send it here
Can anyone help me
it's coming up with an error and I don't know why
I have tried import I have no clue what to do
why does the error say you are using require?
this is the code
well whats the error when using import?
try
import { token } from './config.json' assert { type: 'json' }
well that error is obvious
you can just do
import config from './config.json' assert { type: 'json' }
and get values via
config.<key>, for example config.bottoken
ok thankyou
any bot idea ?
multipurpose bot with uhhh...music features
music and coin system (like poker)
DO NOT I REPEAT DO NOT TRY TO DO MUSIC
I mean, they asked for ideas, not sane/original ideas
fair enough
.
Wait until they find out its nearly impossible to use youtube without being api banned now
Papi is experiencing war flashbacks rn
yes
all of my problems require low level audio solutions like rust lib bindings for nodejs like songbird or symphonia
Why don’t we just make a website that rips videos from YouTube and allow people to stream it /s
that's the million dollar lawsuit question
sounds fun
in c++
how would i select a char character?
so '''?
(i basically input the ' as a character input), just like: '!'.
so you wanna take input from the console?
How can i create a Permission Handler in discordjs
check permissions before executing a command
How can i check this?
const { PermissionsBitField } = require('discord.js');
if (member.permissions.has(PermissionsBitField.Flags.KickMembers)) {
console.log('This member can kick');
}
if (member.permissions.has([PermissionsBitField.Flags.KickMembers, PermissionsBitField.Flags.BanMembers])) {
console.log('This member can kick and ban');
}
if (member.permissions.has(PermissionsBitField.Flags.KickMembers, false)) {
console.log('This member can kick without allowing admin to override');
}
This is not working
is anyone here good with databases?
i have a general question
imagine we would have to restrict the database constraints so that they are minimal, but we want to prevent dirty reads
could we first run a serializable isolation level, and then read uncomitted?
I mean, the whole read and write of the other transaction already passed so we will only get good data.
constraints dont help with dirty reads at all
they just enforce a certain data consistency
to prevent dirty reads you need to use some locking strategy
relying on uncommited state for data will only lead to race conditions
since the last to commit will always have the outdated version
I need help
rename the file to end in .cjs or use the proper esm syntax
How do I make the message(s) container scrollable instead of it being so long?
Message container CSS
Feel free to make improvements
Somebody?
Higher quality screenshot please
or copy paste lgs
nvm I can see it
Send full code
terror
loadFiles != loadEvents
what do you mean
OMFD I am sooo dumb
At a certain point when the content of #chats exceeds its size it should automatically kick in and become scrollable
Also it seems like chats might be above everything else so it won't "clip" into the backround
And how would I..
you could try messing with z-indices or positioning
I haven't messed too much with z-indices but you could try playing around with the position of the chat and the main container
Does Discord just do this automatically for some bots?
how can i make the message be only viewable by the author?
For verified bots, the most used commands are shown on the bot profile
You can only do this with interaction responses by sending a bit collection of flags that includes the ephemeral bit
F
I'm in V12 still
v12 is about to be unusable
it's time to upgrade or time to move libraries to something more low level instead of a library that monches ram for breakfast lunch and dinner

Should I learn directly v14?
If performance is of no concern then sure. If you want to make your app more scalable, then you should learn to use other libraries like SnowTransfer or other raw api libraries
Thanks.
the day msg commands get yeeted will be a sad one
I don't like slash commands
It's quite a mess when you have a lot of bots
from a developer stand point, they're amazing. From a user stand point, they suck
I think slash commands from a user perspective are really good, especially for the dev. When it comes to selecting roles, channels, users and other thinks like autocompleted stuff it's really nice.
inb4 there is a thing that splits up commands specific to the bot
💀
Also invalid argument
Why do you have so many bots to begin with?
Just invite the most needed for their topic
You dont need 15 different moderation bots
Game bots
Lock them to specific channels
5head
if you are going to have a fuck ton of game bots just make channels specific for those bots making it only so that bot can see it so no other bots interfere
true
People just try to find shit reasons to complain about something they don't understand instead of taking the time to see how they work
exactly like u
♻️
That already happened a while ago
also finish your site dummy
or what
or you must build it in django
I will make a deal with you
I will make a bot in python, if I don't finish it I will work on my site if I do leave me alone about it
send em
https://discordpy.readthedocs.io/en/stable/ this is it right?
I got like 3 results back
yea
Ight
Time to crank out the hours
Ima make a rpg bot or smth
I haven't decided yet
wake up topgg, we gotta crank those 90s
in discord.py?
yuh

Well idk what I am doing but hey
python is quite literally the easiest language to use
I have used lua and its essentially the same
The backend yt lib im using is drunk
This is why I tell people not to
I invest so much r&d into audio processing for node.js
java is easier
give it a try

wym cap
are you fucking high
Ok just no
I don't like using java it looks ugly syntactically though i do like how stuff works in it
dont tell null that I'm writing bindings for rust libs to process audio
Reflection in Java is much messier than js or python because it’s compiled to bytecode and run by the JVM as opposed to just a runtime JIT engine
use c++
I dont understand Reflection
I tried but I can't get D++ to work @green kestrel wont help me 
Reflection is just getting data about your code during runtime
objectdynamicProperty
Js excels in that
Java is statically typed and it’s compiled to bytecode AOT so it’s more difficult to do stuff like that
skill issue
Someone made a c++ reflection library called Archimedes
the Greek Mathematician ?
Archimedes principle probably the most popular thing he did
that guy who "hacked" the compiler, right?
🧌
Was wanting to attach the settings to the client but fuck it
Hi, I am using djs and for message commands like !avatar I want to also work with IDs to like !avatar 555688871023869952
now I want to know is there any better way than this or not
let member = message.mentions.members.first() || message.member;
if (args[0]) {
const fetchedMember = await message.guild.members.fetch(args[0]).catch(() => null);
if (fetchedMember) member = fetchedMember;
};
const member = message.mentions.members.first() || message.guiild.members.fetch(args[0]) || message.member;
that way if all else fails you just get the member that initiated the command
Don’t forget to await the fetch if you do that
right
.
I rewrite it
this is the fixed one:
const member = await message.guild.members.fetch(args[0] ? args[0] : "undefined").catch(() => null) || message.mentions.members.first() || message.member;
why?
- if it doesn't fetch then it just wont exist and move onto the next one so no need to catch
- Why the fuck are you using a ternary operator here
- no if it doesn't fetch anything and you didn't catch it, it will return you an err
my eyes
Then... give it a fucking snowflake
💀
If its a valid snowflake it won't error it will just return null if it doesn't exist on either cache or discord's servers
- because if someone use
!avatarthere isn't any args[0] and you can't fetch undefined so I just pass random string
how 0.0
by passing in an ID
not A
you can check if they are passing in a snowflake yourself
well what should I do if user use !avatar abcd
well this is what im doing 0.0
if argument != mention or user's id return their own avatar
there isn't issue I just fix your code :/
with this code if someone pass a random string it will return an err and if don't pass anything still return an err in fetch also need await
you keep fetching an user with the """id""" of undefined
why not just check if the first argument is an id
how can I check that first argument is an id ?
Is it a known issue that relative time stamps are inaccurate on mobile?
why fetching a forum channel says unknown channel
like the channel id is correct
but it still says that
ok not only forum channels but also text messages too
gm
You’ve got the wrong version of chalk installed for how your project is set up
Just go down 1 major version
idk how to do that
npm i chalk@x.x.x
chalk@4 should work
^^
by that im assuming files is empty
@earnest phoenix explain
That’s just a floating point momento
nice
I mean, if I can still use prefixcommand then it isn't yeeted yet. Eventually it'll only be slash commands.
Hi everyone, stupid question here: How do I add images on a bot's description page on top.gg? Thank you
the long desc support html and css, u can use <img> tag
Thank you kind sir
Don't think so, it'd kill a huge part of freedom about making bots
Mod bots, chatbots, leveling, stat bots, etc
From what I’ve heard itll be an intent and the way to get said intent is by convincing discord you MUST have the ability to see all messages
One message removed from a suspended account.
in typescript, do you always have to run the build and start?
and is there a better way to do both these steps?
no
you can use ts-node
it just runs your typescript files as is
idk what it does internally as I have never checked but it just allows you to skip the build step yourself
only use this for development purposes though, as in production you want js code over the ts code any day
Thank you
Discord won't stop giving developers access to messages intent, that's how those bots still have the messages prefixes
They can't however be verified without moving to slash commands.
unless you have a good enough reason to need access to messages
You gotta argue with the Institute of Electrical and Electronics Engineers that made the IEEE 754 standard for that 
I only access message content right now so I can sync my slash commands
I now prefer to manually sync my slash commands
tbh I still don't understand why trig functions take radians in js/other langs
I understand that math generally uses radians far more often than degrees, but there is a loss of precision with radians in computers just because the values for special angles are at decimal positions
Because doing cos(90) = 0 is a lot easier than doing cos(pi/2) = 0 in computers
Degrees define an angle using an arbitrary number, while radians correspond to the length of the arc subtended by the angle.
I know but you can convert between one or the other just fine
If you just think about it on the unit circle and just use degrees I see nothing wrong with it
But I'm not a mathematician I suppose
conversion requires more processing power
I know but I don't see why you would even need to do that
I don't know how the internal algorithm works but you can know special angles with degrees without conversion
Ah so it has to do with arc lengths
That cannot be calculated without radians
Damn that sucks
for loop but not async?
Or how would I do it in a diff way
Could do an array to forEach 
what for?
Making a threaded scraper rn
Not using cluster 😅
missed a semicolon 
Nvm I'm going to use cluster
or maybe not 😉
all g
a for loop is already sync
Yeah I know
by cluster you mean the node:cluster module?
yeah but it's all g
I'm going to assume you mean worker threads since js is a single threaded language lol
(Well, you have access to one thread within js that is, it uses more in the underlying process)
Just create more processes with slightly different tasks
you probably never call the execute function is my guess
Replace it with execute: (client) => {
- that
Or execute: function (client) {
not a major difference
Not even a difference to my knowledge (prove me wrong)

that dident work
What's the error?
no error
Are you even calling the function?
What line?
that's caliing the calling
you're going to want to do const execute = (...args) => event.execute(client, ...args) instead of the other way around
Otherwise your client will not be passed in a reliable order
Since the args will vary
what line
the one I literally typed out lol
still not saying test in the console
are you ever calling loadEvents()
also not quite sure what the point of calling client.events.set() is
nice
lol
lowered it's threads to 4 instead of 8 
dose anyone have a clue with my code
@limber siren
that dosent have anything to do with the problem tho
What we think is that you aren't calling the function at all
:)
..
at 8 mil now
why not use a language like C++ that's better suited for speed and threading
I am calling it
await that call
(async () => {
await loadEvents(client);
})();
dident work
ok well you're not really giving me any info to work with
have you tried actually debugging your issue
I am doing that now
what exactly?
Load Files is not defined
full file ss
nope looks fine
what do you think that function does?
for some reason I highly doubt he wrote that himself and knows what it does 😉
same
could someone hand me a script to keep my bot online hosting on uptimer?
if anyone can
nobody will, that's not how things work
nvm i did it
motivation.
motivation?
motivaison
just iterate over each pixel and replace those that match
less than you think
also it's the fastest possible solution - you gotta find the matching pixels anyway
anything else will either be slower or require preprocessing
Mind to elaborate?
That's just looping, but with functional interface
Run using regular for instead, not foreach
That's called foreach
"For each X in Y"
Doesn't python allow regular iterator loops?
while ++i < limit
Or smth
The thing is still using in
That'd work ig
I like cashews
Doesn't python have unary operators?
i++ for example
Sheesh
But oh well, there's probably a way to access the pixel array directly, so you don't need to have double loops
All buffered images are normal arrays of ints
You can also achieve a bidi access with a single loop, if the former fails
i = 0
while i += 1 < imgSize:
x = i % imgWidth
y = i / imgWidth
Idk if that while expression would work btw, it should
At least in the langs I use
I mean, python was supposed to be used for quick scripts and automation
Damn
can't you just add inside the loop?
Well yes, but having it in one line would be better
Yes well haku
python is not known for making your life better
it just makes it meh
Usually value assignments return the post-op value, I thought it worked in py too
py is odd
Hsv min max?
H doesn't have a "min" per se, it's a circle
That'll be extremely hard without applying sobel edge detecting
Well, the issue is that those pixels also exist outside the minimap
Yes, the only way to solve that is by using sobel or some other ED algorithm
My graduation project was making a texture generator, so I had to use it for generating normal maps
It'll probably be hard to implement it in py tho, especially if looping through pixels is slow
In a nutshell, you loop over each pixel, comparing with its neighbors, if the contrast between them and the central pixel is big enough, you have an edge
Ik people usually make it for shape detection with opencv + python
Well, cameras have to process it fast enough to be realtime so...I think yes
But lemme tell you, you're in for one hell of a rabbit hole
For reference, download GIMP and look at their sobel implementation
Gimp uses python (python-fu) for filters
So u already have a good reference
If I have a regex of /A-Za-z0-9/ and I want to make a 10 random letter code...
How does the math work on how many 10 random letter codes I can make?
Example, fIjeKofeiw or rweGjOpioh, and etc. How many can I do? Is there a math that can determine this?
We need to also consider having capital and lower case letters, especially when we have 26 alphabets, and 10 numbers, too. Yeah, I'm lost on how to calculate such so.
I’m pretty sure you’d do just do 62 (26 lowercase possibilities, 26 uppercase, 10 numbers) to the power of 10 since there’s 10 characters
So roughly 839,299,365,868,340,224.
Or about 839 quadrillion combinations
Sweet, that's pretty high, actually.
Yeah haha kinda wild.
Interesting stat:
If you generated 1 billion UUIDs every second for the next 100 years, the probability of creating a duplicate would be ~50%
(A UUID being in the form of 123e4567-e89b-12d3-a456-426655440000)
That's pretty wild, I've just wanted to know such calculations since I'm hosting a CDN, and I was curious how many pictures I could generate.
I know the math, but never was sure if it was the right formula or not. However, thank you for confirming me with such so.
You can definitely host a few pictures 😅
With the regex above?
839 quadrillion visuals, hopefully. 😂
Then you might want to rethink it
I'm starting to think whether storing all my CDNs on a VPS is worth it or not.
Hi Guys, I always get this error when I runed the app on a linux vps.
I don't know what is the problem with it, It's work when I try it on windows
And this is my code
what linux is it running?
Ubuntu 22
the crypto module relies on the system's installed cryptography libraries, on linux it uses openssl, no idea what it uses on windows
those libraries define what operations and algorithms are supported
its possible you're trying to use an algorithm that is not supported by your system's openssl
although ubuntu 22 should run everything out of the box
what algorithm are you trying to use there?
Hmm I know that for the first time from u 😅
Hmm 1m
I'm use aes-256-cbc-hmac-sha1
The name is long
its possible that specific variant is not supported by your openssl, try using a different algorithm
Hmm okay
Lol
Hi guys
What do you advise me to use instead of this algorithm
@lean pike hi
Hi bro
@lean pike pliz frend me
"aes-256-cbc" is fine
no need to specify hmac sha1
I'm working on big project and I want everything to be more secure
AES 256 is pretty much the standard
now there are many variants, each with pros and cons
for example
CBC is one of the safer ones, but its slower to encrypt than decrypt
so for example if you need very fast encryption, ECB would be better since it supports parallel encryption
Okay the user will wait for 2s
And he will be more safer
It will take time for one time only
Okay bro thank u for ur time
aes-256-cbc should be just fine, i believe thats what most people use
Okay bro 🙂
whats the best way to check if any possible winning tictactoe is achieved? I have a variable for each field with a userid if that helps
I currently have this horrible code
(ignore the evals, im replacing them currently)
you can check all the possible patterns and see if they match the current field
if(
(a1 === a2 && a1 === a3) ||
(b1 === b2 && b1 === b3) ||
(c1 === c2 && c1 === c3) ||
(a1 === b1 && a1 === c1) ||
(a2 === b2 && a2 === c2) ||
(a3 === b3 && a3 === c3) ||
(a1 === b2 && a1 === c3) ||
(a3 === b2 && a3 === c1)
) {
// someone wins
}
lmao
you can also narrow down those conditions by the last piece that was played, to only check those that are relevant
Any ideas how to make gradient shadow on object on canvas?
Seems gradient can't be applied to shadows directly
im so confused by that code, is "a" player one and the "1" in "a1" the field?
ah
so basically its just checking if the piece that exists in that place is equal to the pieces that exist in the required places to make a win
but I probably have to check everything instead of your solution if I want to know which fields won, right?
yeah, you will need to break it down some more
or use a switch statement
switch(true) {
case a1 === a2 && a1 === a3: { /* this line won */; break; }
case b1 === b2 && b1 === b3: { /* this line won */; break; }
}
ah
never seen code use a true in a switch, but smart
like this for the first one, right?
1 2 3
4 5 6
7 8 9
should be yes
technically speaking this is pretty much a terrible way of doing things, since its O(n), but since tick tack toe only has 8 possible win combinations, we can get away with it lmao
this should output me which fields won and more than 3 if there was like an x, right?
https://pastes.dev/DZ07lVbTUe
oh
it seems to react if the values are undefined
fixed that but somehow when winning with the right row it ends up like this
How to add cooldown command? Can anyone pls tell
I made it but its causing some errors
Js btw
what errors?
I set the cooldown to 25 seconds but it's going way faster than it should be
Like when I type command it says 25
Next second it goes to 20
Here code
Here issue
Will be very helpful if u guys give a lil guide
And sry if I m in wrong channel
Just base64 a random hash
And replace the extra 2 chars b64 uses
B64 is literally lowercase, uppercase, numbers, + and =
That's why "64" (26 + 26 + 10 + 2)
Or use a filter that can match hashes
Look up a permutation formula
For your case, n would be the number of characters you’re selecting from, and r would be the length of the string you’re creating
So the actual number of combinations you can make with this would be like so
390 quadrillion approximately
Can someone help me?
any reason you're dividing by 1000 twice?
also, are you properly identifying who sent the message? anonymous dm commands are a terrible thing
dm command by itself is pointless and annoying
Hmm.. well, what's the difference between just powering 62 to 10 and yours?
One is correct and the other is wrong
Yours is correct?
Yes
Ohh, fair enough. I've just researched this, by the way..
This'll be a fun topic to study about, actually. (and know how it works)
why does my bot randomly crash with this?
dose anyone know how to set a prefix for commands on the command folder in discord.js
You'd want to do that in your command handler
yh what would you have to write
Depends on the other code tbh
Looks like thats the command file loader, not the command handler.
client.on(Events.messageCreate, message => {
// this part
});
i was wondering how do i make a rps command Slash supported
Any of you doing the advent of code?
Yup
just like any other rps command
wow makes sense
MFW almost everyone used ||sets or ranges|| for day 4 instead of just ||simple math (or just conditionals)|| 
no, like, really, there's no difference between slashes and prefixed commands
I mean, there are some interaction-exclusive features, but the logic will be exactly the same
I think they're asking for the logic rather than that
i dont understand anything.
I'm on day 3
Well, then you need to learn how to program first
bro i code on java script ;-;
You code or copy code from the internet?

uh.
copy-
lols
Well, at least you are sincere
A good start would be running a few courses, to understand what programming is and how it's done
Forget about bots for now, start with something very simple
Then work your way upwards
i rather actually learn from other pepole and learn by my self
just like what i do usally
That's a poor excuse
its not an excuse at all
copying isn't going to help you learn, you should start off by following a couple tutorials (but don't do TOO many, leave room for your own creativity), and then start to create your own projects
For example?
A thing that helps to learn programming is following tutorials but adding your own twists to them, like extra features
console.log("hi")
that's... not really "a bit"
smaller than a bit.
takes 2 months to master coding ngl
I mean, it's a "bit" in the sense of a computer bit lol
unfortunately no
That's a joke right?
many of us in this channel have being doing this for several years and are still not considered "masters" by any means
i started 5 days ago-
like coding a bot
started off from tutorials
Cloning*
on yt
printing is the most basic thing you can do in pretty much any language tbh, with the exception of maybe assembly since it takes a little more knowledge
i use vsc to code my bot
I've been doing this for 6 years and now I'm considered one, and even beyond
6 damn years
bro i thought you were a bot for a sec-
I've been doing this for a little more than 2 years, I'm still a student
Center a div
Granted much of that time was consumed by school, so I didn't dedicate 2 full years to programming
impossible
Should I get into AI stuff? Seems fun but I'm not sure what I'd use it for
I want to learn a new field since my main "expertise" is in parsing atm
Such an impossible task, no developer has ever been able to do that
I plan on starting to research monte carlo to make an AI for my tcg
So people can play against the bot
Oh yeah I wanted to make a chess engine at some point
but that requires me to make a chess game
and that's not so fun
Lmao
I like low level stuff but I want to see high level results
Just make a plugin that controls your side on online chess
Which is a predicament that I've been in for a while
You were making an OS in Rust, how did that go?
Eh it's not really my thing





