#development
1 messages · Page 45 of 1
well that might be true tho but ephermal messages just not showing up is something I've never heard of or read anywhere before
my handler gets the component in which the button is and then it response to it
makes me curious
it drives me crazy lol
is the response instantly?
how are u verifying that the eph doesn't show?
even more because i cant replicate it so no debugging possible 😦
you got only 3s to respond for non-deferred interactions
i know thats why i respond immediately with the please wait message
but the 3s timeout always return error
u should defer instead of "please wait"
yes it would return "unknown interaction webhook" or something similar
defer is saying "ok I got it, but it'll take some time" to discord
That means you respond instantly to the API telling the API your response will take longer than 3s
oh nice
any command that's not instantly replied must be deferred
You will then have another 15m to respond, until the webhook expires
nice at least something i learned 🙂
No message will be shown up in that moment but instead the discord client shows something like "The bot is thinking..."
nice will rework it in my bot
Until your deferred (2nd) response is ready to be send to the api
that still doesn't explain why the inital ephermal response wouldn't show up tho
still makes me curious
still makes me hit my head against the table lol
show the relevant part of the code
Did the bot reviewer incl. a link to a screenshot or similar in his description?
If no response would be recieved the discord client will show "Interaction failed"
well my button handler gets the component does some fast stuff passes the component to method and method first thing response to it
So... just a non-existing message going into the void can't really happen without an error on the client or api side
lol
yes the bot crashes after it tries to edit the non-existent reply
are you 100% sure?
oh well that's a different thing then
because the reply itself does not return error
what if the reviewer disposed of the message?
hmm
u can't trust any ephemeral be valid at any time
are you sure you're catching the errors correctly and awating the promises you get (if that's a thing in .net)?
if .net is like java, it doesn't use the concept of promises
move on java boy
but it does have exception handlers for async stuff

it should crash when sending the reply but it didnt
they "can"
of course
but u cant trust they'll be available
but he could dispose of the message that would do it i guess
since switching channels will delete it
as you said
no
no?
hm, nvm then
but well, simply change ur "please wait" message to be a defer instead
but he can't delete ephermal messages of course
but i dont see that he would every time he tried it always dispose the message
and let discord handle that
reviewers probably have muscle memory to close ephs asap
yes will do that
well just to remind you, the concept you're using replying with a "please wait" is wrong anyways
yes i didnt know about the defering stuff 🙂
Without replying with a deferred status the webhook will expire
so will defer it and resubmit and we will see
make sure to catch all async tasks
So the order to respect is:
Interaction event ->
Instant response (within 3s) **OR**
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE (ACK an interaction and edit a response later, the user sees a loading state) ->
respond later
hmm so i cant deffer it if i dont know if it will take longer or less than 3s ?
What you can do however is (when deferring a response):
Interaction event ->
Defer the response ->
Edit the response showing ("Please wait") ->
Edit the response (again) returning your result```
the rule is: if you're gonna do any processing, defer
But the "please await" message is obsolote since the loading state exists
ok nice
No, you must defer it if the estimated response time isn't within the 3s
Literally for any sort of async action
You have to perform before sending the reponse
I'd say more like 2s, to allow space for net latency
and eventual discord slowness
well even a defer response state can fail
that's why error handling should always be present
but I have to say I haven't seen that sort of error for a long time now
Ok thx to both of you, will change the bot and test it a bit after to make sure its working properly 🙂
alr
test as if you were the most idiot user to exist

that's a rule for debugging
that's not so easy to perform tbh
ik, that's why I have a testing team 
😄
after years of developing community panels I always found somebody who causes an error and I never understood how a "normal" human would have managed to do so
you should question their sanity
as the wise guard of yellowstone once said "There's a considerable overlap between the dumbest visitors and the smartest bears"
lots not to say many people using the internet who shouldn't
which isn't an assumption
I don't know if this is the correct place for this and please let me know where I should put it if not. I'd like to be able to create a role and add everyone from another discord server to it on my server. Or, better yet, create a role on my server and have them auto added to the role as soon as they connect to my server. Like from a list that I create.
Use https://dyno.gg for that
it has both mass roling (add role to everyone) and give set role(s) on join
oh wait
are you developing a bot
Great! I already have that one and I just put the mee6 bot on because I was going to check it out. Seems it will do it too.
👍
hey guys
i have a problem understanding the shift operator
5 << 3 for example.
So 5 is of course made by 2^0 and 2^2 right?
so we will have this:
2^0, 2^1, 2^2, 2^3, 2^4, 2^5, 2^6 with the marked spots being the current bits
what the fuck should i shift to where lmao
i mean, shifting a 8, or a 2 is ez but 5 is made out of 2 bit placeholders
hm...what
shift works like this
before: 0000 0101 = 5
after: 0010 1000 = 5 << 3 = 40
when you << 3 you move the bits 3 places to the left
no need to do...whatever math u did
simply use binary notation when using bitwise ops, you're not really meant to look at it in decimal
5 can be written as const val = 0b101 in most langs
also, u got this inverted
binary is always RTL, so << increases and >> decreases
a way to check active flags is like:
var arrayOfValues = {...};
for (int i = 0; flags != 0; i++, flags >>= 1) {
if ((flags & 1) == 1) {
// arrayOfValues[i] is enabled
}
}
i know i got it done already!
So apparently if you have a number like 3
it's consisted of 2^1 and 2^0, so you need to make each bit basically move individually and then sum up the total new value
stop thinking as 2^N
think as an array
also u don't need to sum anything
simply do bitwise OR
0b1 | 0b100 = 0b101 = 5
my university tells me to
hey guys,
I am using discord.js and I added bot to the server but it is not showing in server settings>integrations. Any idea what I did wrong?
did u add application scope to the invite?
does ur bot have any slashes?
yes
if u type / does it appear in the menu?
no, it do not appear
hm, are ur commands registered as global commands?
it might take a while to update
Anyone know any good website commission servers?
"commission servers"?
do u mean hiring?
Yes
no, its a guild command
const rest = new REST({ version: '10' }).setToken(process.env.BOT_TOKEN);
rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID,GUILDS), { body: getCommands() })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);
here is I am registering me commands
did u register it after joining?
Cheers. but I would prefer It on discord
I dont know any
yes, its already join to my server
no, I mean, did u register the commands after joining the server?
guild slashes are per-server and wont be added automatically
for that u need global slashes
I didn't understood, do I need to join the server first before the bot ?
...guild commands are guild-specific
yes
they're local, not global
correct!
they wont be added automatically on-join
to have commands added when joining u must register global commands
OR register the guild commands on-join
I am registering the commands before call of "ready" function
const GUILDS = '844603478436479047' //'787957265462067221'
const rest = new REST({ version: '10' }).setToken(process.env.BOT_TOKEN);
rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID,GUILDS), { body: getCommands() })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);
client.on("ready", async(): Promise<void> => {
const commands = await client.application.commands.fetch();
//Returns a collection of application commands
console.log(commands);
console.log(client.guilds)
console.log("Bot Online")
})
like this
it wont work
as I said, guild commands DO NOT apply to all guilds
they only apply to a single, specific guild
I want it to work for my only
then register for your, specific server
I am registering to "844603478436479047" this my server
the problem is when I am fetching guild commands, it shows that commands are registered and list all my commands , it is showing no errors but the when I try use it, it is not working
this is what I am getting, that means command is registering
that doesn't guarantee anything
it just means it didn't error in the previous step
what does getCommands() return?
it is a user built function to get the array of SlashcommandBuilder objects
it is working fine, I check all those
try printing what it's returning
Is it possible that the bot is in the server and it is not listed in bots & apps in server settings > interactions?
[
{
options: [ [Object], [Object] ],
name: 'addfeed',
name_localizations: undefined,
description: 'Add new feed webhook',
description_localizations: undefined,
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined
},
{
options: [ [Object], [Object], [Object] ],
name: 'delfeed',
name_localizations: undefined,
description: 'Add new feed webhook',
description_localizations: undefined,
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined
}
]
I also tried adding bot and removing 2-3 time from the server
ah, wait, just noticed
that wont work
you're registering outside of the ready event
it might be running before your bot is ready, or even started at all
registration is a one time thing tho, it should work on the next try then
I tried adding that method inside the ready event not working there too
it's within guild scope, is it the same?
yeah
also the fact that this didn't execute makes me think the bot isn't finishing to start at all
let me share you whole, I removed from parts from it
ah wait, it executed before that line
nvm then
anyway, tim's more fit to help u, I dont know much about d.js
here is the whole console
client.on("ready", async(): Promise<void> => {
const commands = await client.application.commands.fetch();
//Returns a collection of application commands
console.log(commands);
console.log(client.guilds)
console.log("Bot Online")
const GUILDS = '844603478436479047' //'787957265462067221'
const rest = new REST({ version: '10' }).setToken(process.env.BOT_TOKEN);
rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID,GUILDS), { body: getCommands() })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);
console.log(getCommands())
})
Here is "ready" event after some changes
sure, thx for your help. @quartz kindle did you find anything that I am doing wrong?
is that some discord issue or its on my end only
My bot is not even listed in bots and apps list.
Mori commented on the site I dev'd for her 
is this a vtuber
yes
[JavaScript]
Lets say I have a function, when its being called with something like function() it will echo something in the console, can I somehow block the function from sending stuff in the console? (no I cant edit the function, its from a package)
theres loggers
you want to make a logger
loggers
what exactly does that mean in this case?
basically use loggers that have different loglevels
but then
no I cant edit the function, its from a package
it wont do much
what are u trying to block?
unnessesary logs from a package, aka it spams like 40lines of junk every time I start up
most loggers (or at least the good ones) allow u to filter what packages are allowed to log or not, but take my advise, logs are supposed to be very verbose so u can solve related errors later on
You still can
I was only addressing what they mentioned
Yeah I didn't see the message they sent so I quoted yours instead lul
if I wanted a clean console for manual input I'd just open a child console and listen to it instead
instead of muting the logs
Anyone know good image enhancers?
waifu2x
Thank you
quick tip: do not upscale unless that's your purpose
upscalling images, although w2x does a great job, still significantly decreate its details
so u end up with an "oil painting" aspect if your image was very detailed
also dont be afraid to crank the denoiser to the maximum, unless ur image is supposed to have noisy parts
what would be a good way of dealing with payment requests when using PayPal, since the onApprove function is all front end I don't wanna handle it directly on the front end cuz that's stupid, could someone with more knowledge on this stuff than me tell me what may be a good way of dealing with the request?
depending on what u doing, wouldn't it be better to use another payment service with a better api?
like kofi
I'm integrating a 1 time payment for a lifetime subscription but im planning on adding monthly subscriptions to it too
I just need to fix these pixelated logos ;-;
waifu2x is awesome but it cant do miracles
it's a denoiser/upscaler, not a depixelizer
Can I make it better like in anyways-
"pixaleted" is not necessarily worse, it's just an image with low resolution
what image are u trying?
Yeah its because I downlaoded in low quality
Its bad when uploaded as an emote
You wanna provide reoccurring and single payments?
that's not low quality
that's actually a pretty high quality icon
note the emphasis on icon
quality != resolution
ayy tyyy, just looked weird on emoji but then again it shrinks down on the bot because there is text
that said, that image is pretty simple, u could attempt to draw it yourself using vectors
Tyyyy
this is all i've done so far but then i thought what if someone were to make a post request to that end point them selves with the same body of information the api provides, since there's no like auth key to verify the payment is "legit" or anything I'm quite lost for ideas, would there be any way to perhaps verify that the local fetch request originated from the localhost if so how can i do it 😭
I am a horrible drawer-
using vectors is literally just moving lines around
ooooo is there a thing I can try it on?
simply upscale that image without interpolation and contour it
well yes, any image editor
except paint
Okay thank you so much
nvm just had a big brain idea 
There kinda is an auth key
there is?
The transaction ID
U can use it to fetch the transaction info from paypal
But...well...more api to deal with

ape and i = ape i = api = paypal api

i think i've found a way to do it without having to interact with the api 
it works 
wait no it doesnt
i give up
paypal sucks

what were u doing with the ape, tim?
Bandcamp sucks
added support for track info and streaming and it was the worst
their html is so bad
It's also hilarious that they just have a JSON of just about everything you need in the head of the html
idk
Spotify used to do the same thing
Then they removed the JSON and just have everything in the head in the form of og meta tags
on another note, I hate minified JS
back tracking in that shit to find where track info came from sucks
Minified code fans when they realize it practically doesn't make anything better
on very large scales, I can see the data savings being huge, but like lol
also I guess makes reverse engineering the api harder
It only makes the parser parse the code faster and that's it, which the parser is already fast enough that no form of minification is even needed
the main draw is data savings and user experience when it comes down to load times
I mean yeah but the minification doesn't save much data honestly 
on a scale of Spotify, I can see the savings being real
for small startups or just small sites in general, useless
unless your host/isp limits your data
Yeah, for extremely large applications it's kinda good, but I've seen a lot of applications that use minification for no reason
the furthest I go is just webp images
The good ol' webp

I think Discord invalidates the token for the interaction response if the user didn't submit the modal
The timer has nothing to do with this, just the modal in general
It’s actually really funny since closing the modal ends the interaction then in my case after 45s a response appears in the chat
It’s funny tho
I meant responding in the timer works always
I send the modal as response then create the 45s timeout which sends a follow up
When submitting the modal the timeout will not send the follow up
So not submitting always sends the follow up message
But it failed in that case and the error message is weird
And you said sending the follow-up causes that error, and I came up with a possible theory of why
Only in this one case
It happened only once is what you mean?
But the webhook can’t be invalid when responding with a modal
Or just keeps happening when you try to send the follow-up?
Yeah ik I shouldn’t really think about it
But the error message is really weird in that case
Nah just happened once
Until now
That's pretty weird, I would really recommend asking that in the Discord Developers server if you haven't done so already
They might actually know what causes it
But if you don't mind it then ¯_(ツ)_/¯
Yeah it’s really weird
I mean I can not defer the response when responding with a modal
So the webhook ID can’t become invalid
At least not after 45s
I’m sure there is a timeout somewhere
Maybe my app is broken
I can not send DMs to my bot
Idk what’s going on tbh
they blocked you
Shhhh Java boy

Will just live with the fact the api returns weird stuff for my app and my client is broken
lol
they blocked u

They? The mysterious bot Illuminati group? Bots speaking to each other and tell each other which user to ignore?

lol
using your hosting lol
The submission has nothing to do with the follow up and once the submission of the modal happens the follow up won’t be send
match Entity::insert(new_message).exec(connection).await {
Ok(_) => (StatusCode::CREATED, "Record was created.".to_string()),
Err(err) => {
println!("{:#?}", err);
(
StatusCode::INTERNAL_SERVER_ERROR,
"Record was not created.".to_string(),
)
}
}
@wheat mesa is this not correct?
When you do Err(err) => { /* something */ } you'll need to explicitly return if the other one doesn't
I see
gimme a sec to work up an example
okay
Actually hold on I'm wrong
I don't think that's the part that's wrong
@sharp geyser can you show more? Do cargo check and send the error here
```error[E0308]: match arms have incompatible types
--> src\main.rs:85:21
|
80 | Ok(parsed) => match parsed {
| ______________-
81 | | WebMessage::MessageCreate(message) => {
82 | | message_create(message, &mut socket, connection).await
| | ------------------------------------------------------ this is found to be of type (StatusCode, std::string::String)
83 | | }
84 | | WebMessage::MessageDelete(message) => {
85 | | message_delete(message, &mut socket, connection).await
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found ()
86 | | }
87 | | },
| |- match arms have incompatible types
|
= note: expected tuple (StatusCode, std::string::String)
found unit type ()
so it was somewhere else
nice
match serde_json::from_slice::<WebMessage>(&msg.into_data()) {
Ok(parsed) => match parsed {
WebMessage::MessageCreate(message) => {
message_create(message, &mut socket, connection).await
}
WebMessage::MessageDelete(message) => {
message_delete(message, &mut socket, connection).await
}
},
Err(error) => {
if socket.send(Message::Text(error.to_string())).await.is_err() {
return;
};
socket.close().await.unwrap();
return;
}
};
Ok. So discord added forum channels. How do I check the name of one when it is created?
CHANNEL_CREATE if the client didn't create the channel or if you are creating the channel, you can get the response of the create request
The inner payload of CHANNEL_CREATE is an object that has a name property
is a forum post a channel or thread?
oh I see
It's all the same POST /channels/:channel_id/messages
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Oh I may have interpreted your question wrong
for posts created in forum channels, THREAD_CREATE is fired
for when a forum channel is created though, CHANNEL_CREATE
THREAD_CREATE is essentially the same as CHANNEL_CREATE though, just the channel type is limited to 10, 11 or 12
Why discord gotta be so weird with their api
Who knows
What's bizarre to me is that Discord has API versions for a reason, but they're scared shitless to make actual breaking changes
The only breaking changes they have is when they discontinue a version
like, THREAD_CREATE is useless. Just put it all in CHANNEL_CREATE
I know a friend still using discord.js v11
How
v11 was really rigid
I couldn't sanely use djs let alone v11
I liked v11 only for structures
that was v12
oh ok
V12 removed structures no?
that was v13
got it
either way
After they removed structures I couldn't use it anymore
It was too much of a hassle to extend a class and get it working in ts
I always had some weird typing errors that even djs support couldn't fix
I abused Structures by making optimized class structures
Also I feel threads are useless now
What's the point of a thread when you can make a forum post
assuming there are forums
I mean yes
rn, forums are only available in community servers
But if it's important enough I'd assume a forum would exist
At this point majority of servers are community servers
At least they have it enabled

ok night night
ok
so
how do I check if the bot can delete one of the posts?
because thread.manageable returns false. even when the bot has admin
nvm
how can i send more button in unique line?
interaction.channel.send({ content: `<@&1018078468686233650>`, embeds: [embed], components: [row1, row] });
ah, ok, thanks
client.on('interactionCreate', async interaction => {
if (!interaction.isSelectMenu()) return;
if (interaction.customId == "SupportSelect") {
//interaction.deferUpdate();
if (interaction.values[0] === "minecraft") {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Danger)
.setEmoji("🔒")
.setLabel('Close')
.setCustomId("ticket-close")
)
.addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Secondary)
.setEmoji("👥")
.setLabel('Claim')
.setCustomId("ticket-claim")
);
const embed = new EmbedBuilder()
.setTitle("Categoria: Minecraft")
.setDescription(`<@!${interaction.user.id}> ha creato un **Ticket**!\n\nLo staff è già stato avvisato del tuo ticket!\n\nPremi il bottone 🔒 per chiudere il ticket!\n\n**Per favore, non pingare nessuno staffer!**`)
.setColor(client.config.embedColor)
.setFooter({ text: `${client.config.embedfooterText}`, iconURL: `${client.user.displayAvatarURL()}` });
interaction.channel.messages.cache.first().delete()
10000,
interaction.channel.send({ content: `<@&1018078468686233650>`, embeds: [embed], components: [row] });
}
}
})
it spam message
<rejected> DiscordAPIError[10008]: Unknown Message
at SequentialHandler.runRequest (/home/bot/Shark/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:287:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (/home/bot/Shark/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:99:14)
at async REST.request (/home/bot/Shark/node_modules/@discordjs/rest/dist/lib/REST.cjs:52:22)
at async MessageManager.delete (/home/bot/Shark/node_modules/discord.js/src/managers/MessageManager.js:245:5)
at async Message.delete (/home/bot/Shark/node_modules/discord.js/src/structures/Message.js:767:5) {
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'DELETE',
url: 'https://discord.com/api/v10/channels/1019890810155696138/messages/1019890811388821534',
requestBody: { files: undefined, json: undefined }
}
} reason: Unknown Message
i resolve it
why?
Uncaught Exception: TypeError: Cannot read properties of undefined (reading 'user')
(node:379757) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 interactionCreate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
[FATAL] Possibly Unhandled Rejection at: Promise Promise {
<rejected> TypeError [InvalidType]: Supplied parameter is not a User nor a Role.
at PermissionOverwrites.resolve (/home/bot/Shark/node_modules/discord.js/src/structures/PermissionOverwrites.js:184:28)
at /home/bot/Shark/node_modules/discord.js/src/managers/GuildChannelManager.js:245:90
at Array.map (<anonymous>)
at GuildChannelManager.edit (/home/bot/Shark/node_modules/discord.js/src/managers/GuildChannelManager.js:245:60)
at TextChannel.edit (/home/bot/Shark/node_modules/discord.js/src/structures/GuildChannel.js:279:32)
at PermissionOverwriteManager.set (/home/bot/Shark/node_modules/discord.js/src/managers/PermissionOverwriteManager.js:71:25)
at Object.execute (/home/bot/Shark/events/tickets/claimTicket.js:31:54)
at Client.<anonymous> (/home/bot/Shark/handler/index.js:27:58)
at Client.emit (node:events:525:35)
at InteractionCreateAction.handle (/home/bot/Shark/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12) {
code: 'InvalidType'
}
} reason: Supplied parameter is not a User nor a Role.````
interaction.channel.permissionOverwrites.set([
{
id: interaction.user.id,
allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages, PermissionFlagsBits.AttachFiles, PermissionFlagsBits.EmbedLinks],
},
{
id: client.ticketsSupportRoles,
deny: PermissionFlagsBits.ViewChannel,
},
]);````
Your error messages reveals that you’re creating multiple event listeners for the interactionCreate event
You’re only supposed to create one not multiple
making a class, js constructor(options) { super(); this.options.debugging = options?.debugging || false; }
constructor(options) {
super();
this.options = {
debugging: !!options?.debugging
}
}
you can't make object on a var by just set the key
[FATAL] Possibly Unhandled Rejection at: Promise Promise { <rejected> DiscordAPIError[10008]: Unknown Message at SequentialHandler.runRequest (/home/bot/Shark/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:287:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.queueRequest (/home/bot/Shark/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:99:14) at async REST.request (/home/bot/Shark/node_modules/@discordjs/rest/dist/lib/REST.cjs:52:22) at async MessageManager.delete (/home/bot/Shark/node_modules/discord.js/src/managers/MessageManager.js:245:5) at async Message.delete (/home/bot/Shark/node_modules/discord.js/src/structures/Message.js:767:5) { rawError: { message: 'Unknown Message', code: 10008 }, code: 10008, status: 404, method: 'DELETE', url: 'https://discord.com/api/v10/channels/1019890810155696138/messages/1019890811388821534', requestBody: { files: undefined, json: undefined } } } reason: Unknown Message
oh yee
await your promises and catch errors
also the message you wanna delete simply doesn't exist anymore
if you try to do delete an ephermal message, that ain't gonna work
My bot can delete messages in a thread but not a thread from a forum. Its using the same code.
const bloxyClass = class Bloxy extends EventEmitter {
constructor(options) {
super();
this.options.debugging = options?.debugging || false;
}
issueEvent(event, ...args) {
if (this.options?.debugging) console.log(`[Bloxy] Event emitted: ${event}`);
this.emit(event, ...args);
}
}
module.exports.Bloxy = bloxyClass;```
```js
new Bloxy({ debugging: true });```
you cant add something to this.options because this.options doesnt exist
TF
yes
lmao
if (bloxyClass?.options?.debugging) issueEvent("debug", "Loading methods...");
for (file of fs.readdirSync("./methods").filter(f => f.endsWith(".js"))) {
module.exports[file] = require(`./methods/${file}`);
if (bloxyClass?.options?.debugging) issueEvent("debug", `Loaded method: ${file}`)
}
const { getAvatar } = require('./index.js');
(async () => {
console.log(await getAvatar("1"))
})()```
im trying to make my life easier but its not working 
dont u wanna show us how you export it?
2 secs
2 secks
anything takes 2 sneks
module.exports = async (userid) => {
if (!userid) return null;
const req = await http(`https://thumbnails.roblox.com/v1/users/avatar?userIds=${userid}&size=720x720&format=Png&isCircular=false`).json()
if (req?.errors) return null;
return req?.data[0]?.imageUrl || null;
}```
thats getAvatar.js
because its going to be a package 
const fs = require('fs');
const { EventEmitter } = require('events');
const bloxyClass = class Bloxy extends EventEmitter {
constructor(options) {
super();
this.options = {
debugging: !!options?.debugging
}
}
issueEvent(event, ...args) {
if (this.options?.debugging) console.log(`[Bloxy] Event emitted: ${event}`);
this.emit(event, ...args);
}
}
module.exports.Bloxy = bloxyClass;
if (bloxyClass?.options?.debugging) issueEvent("debug", "Loading methods...");
for (file of fs.readdirSync("./methods").filter(f => f.endsWith(".js"))) {
module.exports[file] = require(`./methods/${file}`);
if (bloxyClass?.options?.debugging) issueEvent("debug", `Loaded method: ${file}`)
}
module.exports.version = require("./package.json").version```
Is if (req?.errors) return null; necessary
well its how the roblox API returns things
Wouldn't data not exist anyway if there's an error?
you already return null if no data or imageURL is available
true
req?.data?.[0]?.imageUrl || null;
that debugging wont work lol
do console.log(require(index))
{
Bloxy: [class Bloxy extends EventEmitter],
'getAvatar.js': [AsyncFunction (anonymous)],
'getPreviousUsernames.js': [AsyncFunction (anonymous)],
'getUserFromID.js': [AsyncFunction (anonymous)],
'getUsersFromSearch.js': [AsyncFunction (anonymous)],
'getUsersFromUsernames.js': [AsyncFunction (anonymous)],
version: '1.0.0'
}```
you set the entire filename as keys
remove the .js
now for the debugger, that wont work because the bloxyClass object doesnt have .options
So? many? question? marks?
ah
typeof bloxyClass // "function"
typeof bloxyClass.options // "undefined"
const instance = new bloxyClass()
typeof instance // "object - Bloxy"
typeof instance.options // "object"
hmm
everything that uses this only exists after you use new
Also having every method in a separate file especially for a library is kinda silly
So I cant think how would I go about str.replaceAll(str, newstr) but I want unique values for each str it replaces, Any easy ways of completing such?
a loop, using replace not replaceAll
once the first "needle" has been replaced it will jump to the next one in the iteration
I guess im brain dead
an endless loop incl a statement if your string (still) includes your "needle", if not return - for example
replace can accept a function as the second parameter
replaceAll can as well iirc
How can I fix it
Yes i have done but still
There that error
Cough python -> indentations
Take a look at line 11 and 12
You will notice a difference
You will soon run into the same error again for line 15 and 16
Use the indentation to move em into on_message event scope
I don't understand
Why do you even use python in the first place?
Those are the fundamental fundamentally fundamentals
… to know
python is extremely sensitive to indentation, do you know what indentation means?
Yes
That's my old file i was just trying to remake it
check the indentation of those lines and its easy to see what the problem is
Which lines ?
Oh I see
python is just a turing-complete yaml
I have 5 rows,
In total there can only be 5 of "some character here"
The rest has to be "some other character here"
How to
Randomly choose the rows the first character would be in?
I know how now 😃
what
Yes.
are u trying to make a hangman game?
Nah
Don't worry about that just help 😄
5 rows and 5 columns
Maximum of 5 "yada" in it (see it as 5 arrays with length of 5)
The index of "yada" is random within the length of 5
I think I have something in mind
Again
I can't "just help" if you don't give a coherent context
No worries then
void path_agent() {
int initiator = -1;
int tiles_with_no_balls = 0;
while(initiator == -1){
if(!on_ball()){
tiles_with_no_balls = tiles_with_no_balls + 1;
cout << tiles_with_no_balls;
}
if(on_ball()){
tiles_with_no_balls = 0;
}
if(tiles_with_no_balls > 3){
initiator = 0;
bot_quit();
}
if(on_ball() && !in_front_of_wall()){
step();
}else{
bot_check_corner_angle(true);
}
}
}```hey does anyone know why my variable titles_with_no_balls doesn't work? For some reason it literally surpasses the number 3, but the if statement never fires. The out doesn't even fire as well, even if i put it right after the while loop. The code is in c++
lemme re-format that for better reading
void path_agent() {
int initiator = -1;
int tiles_with_no_balls = 0;
while (initiator == -1) {
if (!on_ball()) {
tiles_with_no_balls = tiles_with_no_balls + 1;
cout << tiles_with_no_balls;
}
if (on_ball()) {
tiles_with_no_balls = 0;
}
if (tiles_with_no_balls > 3) {
initiator = 0;
bot_quit();
}
if (on_ball() && !in_front_of_wall()) {
step();
} else {
bot_check_corner_angle(true);
}
}
}
while (initiator == -1) could be replaced with while (true) + break; after bot_quit();
if (!on_ball()) and if (on_ball()) could be replaced with if (...) { } else { }
yeah
also, your error is there
and a lot of the flow can be simplified
because the second block literally invalidates what u did on the first
void path_agent() {
int no_balls = 0;
while (no_balls < 3) {
if (on_ball()) {
no_balls = 0;
if (!in_front_of_wall()) {
step();
}
} else {
no_balls++;
cout << no_balls;
bot_check_corner_angle(true);
}
}
bot_quit();
}
void path_agent() {
int tiles_with_no_balls = 0;
while (true) {
if (tiles_with_no_balls > 3) {
bot_quit();
break;
}
if (on_ball()) {
tiles_with_no_balls = 0;
if(in_front_of_wall()) {
bot_check_corner_angle(true);
} else {
step();
}
} else {
tiles_with_no_balls++;
cout << tiles_with_no_balls;
bot_check_corner_angle(true);
}
}
}
lmao
but this has nothing to do with my issue ?
it does
^
meaning it'll never be higher than 0
so it can never enter the if (no_balls > 3)
but that int tiles_with_no_balls = 0; only is defined at the begin of the function
and inside the while loop we are adding a 1 to the integer
or am i doing something stupid rn
It's a school assignment
let me bin my ode
code*
it basically needs to follow this trail
it works, however at the end of the trial it is not stopping
honestly, that'd be easier to accomplish with arrays
i am not allowed to use that yet
a
else i would have finished it a bit easier
hm, u can use a proxy actor to check the next step
basically at the end it walks at the 3 marked empty tiles
so then i am using the variable++
and checking what the variable is
if it's 3 it should return but it doesn;t
so well, if u were to use a second actor it'd be simpler to check
what's a second actor
like, have the second one always be 1 step ahead of the actual actor (red arrow)
@drowsy crag
so, if the second actor (invisible arrow) isn't in a ball tile anymore, u simply exit
@oak cliff please
as of now js if (on_ball()) { tiles_with_no_balls = 0;is resetting it
even at thend
the end** while it isn't on a ball
and for some reason the cout doesn't even work lmao
i need a good interview question for a javascript developer, anyone have any good ideas?
Is that a question
"If you were to write a calculator, how would you do it?"
Mf gonna speak the entire code
lmao
Just listen for a "var"
var, forEach, many unnecessary comments, waaaay too long/short variables, too few/many variables, etc
oh and whether they keep everything in a single file or spread among specialized ones
and how often a piece of code appears across the codebase
the last one is a serious sign of poorly written code (single-responsability rule)
Would anyone know why my bot is basically not stopping after having 3 blank tile steps?
you’ve never been in a tech job interview before have you lol
I have, that's how I work as a programmer today
but most of the usual "tech" questions are superfluous and/or don't represent how good the coder is
"Invert a binary tree" ok, when was the last time u applied such knowledge?
I mean it's an interview? I thought it'd be more of a question abt experiences n stuff
imo having good habits is way more valuable than something you could google for
Okay guys
i have changed my code but i still can't get it right
void path_agent() {
bool para = false;
while (initiator == -1) {
if(on_ball()){
step();
tiles_with_no_balls = 0;
}
if(!on_ball()){
tiles_with_no_balls = tiles_with_no_balls + 1;
para = true;
}
while(para){
turn_right();
turn_right();
step();
turn_right();
if(on_ball()){
para = false;
}
}
if(tiles_with_no_balls >= 3){
initiator = 0;
para = false;
}
}
initiator = -1;
para = false;
}
```So my code works now.. however at the end i can't stop it
now u have an infinite loop
just use while (tiles_with_no_balls < 3)
that should solve the problem
this is what happens
your previous code was mostly right, the issue were that u checked > 3, which can never be true
the code still thinks that it's not on a ball of course
and tries to initiialize that search ball function
however that's the end of the line so it should stop there
try this code
I can't as bot check angle was a long function that didn't want to wor
work
it wasn't already in the program
hm
So everything works great the only issue is that i can't let this fucking bot stop walking at the end
as it tries to initialize another search for balls function
did u change >= 3 to > 3?
or use while (no_balls < 3)?
but it would still not work right?
because the code is only running once
all codes run only once
its still giving me this
< 2 then
have you seen that video?
yes
If it isn't standing on a ball, it will check it's environment**
yes
the loop will exit when no_balls reach 3 or more
since u said it still does the same, reduce to 2
void path_agent() {
bool para = false;
while (initiator == -1) {
if(on_ball()){
step();
tiles_with_no_balls = 0;
}
if(!on_ball()){
tiles_with_no_balls = tiles_with_no_balls + 1;
para = true;
}
while(para){
turn_right();
turn_right();
step();
turn_right();
if(on_ball()){
para = false;
}
}
if(tiles_with_no_balls > 3){
initiator = 0;
para = false;
}
}
initiator = -1;
para = false;
}
void cave_agent() {
}```
...no
remove this entirely ```cpp
if(tiles_with_no_balls > 3){
initiator = 0;
para = false;
}
okay
change while (initiator == -1) to while (tiles_with_no_balls < 3)
see it it solves the issue, if it doesn't, change to while (tiles_with_no_balls < 2)
even with both changes?
yes and i will explain why
So if the bot is on a ball, it will reset the balls okay. If it isn't on a ball, it will take 1 step max and increment the tilewithnoballs with 1. This means that at the end of the path, the bot will try to take another step.
as it will try to search for another ball,
yes
And it will find it, and reset the count again
so it will get onto an infinite loop
not if u changed the while as I said
i did
void path_agent() {
bool para = false;
while ((tiles_with_no_balls < 2)) {
if(on_ball()){
step();
tiles_with_no_balls = 0;
}
if(!on_ball()){
tiles_with_no_balls = tiles_with_no_balls + 1;
para = true;
}
while(para){
turn_right();
turn_right();
step();
turn_right();
if(on_ball()){
para = false;
}
}
}
initiator = -1;
para = false;
}```
no u literally didn't
oowh i did
compare what u have with what I wrote
i just changed it for another test
^
like right now
this is the order of events
while (no_balls < 3) means the last try will be at tile 3
next iteration will quit
those are the tiles ur checking (in green)
now lemme rotate it and you'll see the issue
from what I saw in ur video, the check is being done one step ahead
the check at step 1
the check at step 2
see how it finds there's an available path to the left?
yeah
we cannot that's the catch
our school gave us a step(); function and that's it
do you want my whole code rn?
nope
the simple solution: count the number of rotations
not the number of tiles
Another problem.
We cannot
...how so?
It must work for all path variations
we could have lots of paths so this alghoritm must work for all contagious paths
a variant for example
while (!on_ball) {
step();
if (on_ball) break;
undo();
rotateLeft();
step();
if (on_ball) break;
undo();
rotateRight();
rotateRight();
step();
if (on_ball) break;
stop_bot();
}
...
function void undo() {
rotateLeft();
rotateLeft();
step();
rotateLeft();
rotateLeft();
}
it'll check forwards, left then right, if neither find a ball tile, quit
undo will simply move backwards so u can start again from the original tile
i am not allowed to use break iirc
they are really making it fucking hard for no reason
use nested ifs then
step();
if (!on_ball) {
undo();
rotateLeft();
step();
if (!on_ball) {
undo();
rotateRight();
rotateRight();
step();
if (!on_ball) {
stop_bot();
}
}
}
ugly yes, but the same as if using break
that code is far from working
i will send a gif in a sec
will technically it did work
but it did some crazy things at the end
it kept looping again
then ur doing something else, this literally cant loop
unless the map is a literal loop (like a circle)
hardcode?
it's because the code MUST run for like 100 variations or something
...but this will run in any variation as long as the map isn't a loop
this looks like we are first implementing a left, an then a right etc etc
yes, but ur missing what it's really doing
it isn't moving left, then right, then forwards, etc
it is checking for available paths in one of the 3 directions
THEN proceeding to check again after going to the next tile
if u change anything in that code I sent it'll no longer work
Okay i will try it out again
do make sure to have that while inside the main loop
else it'll check once and quit even if there's a valid path
bool stop = false;
while (!stop) {
...
while (!on_ball) {
// the code I sent
}
if (!on_ball) stop = true;
}
before the inner while
Because right now the bot will be on a ball, and the whole while function won't even run
I see
I believe all variations of the map have steps > 1 right?
like, no single-tile maps
yup
actually, u don't even need to move beforehand
the code will step for itself, only calling undo() if it resulted in an empty tile
this will make sure it works even in single-tile maps
okay wow this atually worked
it's a basic pathfinder algorithmn, there was a game similar to what ur doing (used to play it a lot)
it was a robot that needed light all blue tiles
lightbot was its name
So what this does, correct me if i am wrong pls, it steps and if it isn't on a ball it will check the environments around it. If it still can't find a ball it will check the right side of his environment.
ooowhh i see
note the panel to the right
it'll do 3 attempts:
- move forward
- move to the left
- move to the right
if all 3 fail, exit because there's no available path other than backwards
the undo() method is simply rotating the actor 180°, moving one tile then rotating 180° again, thus ending at the same state as it was before moving
undo() can be replaced if ur teacher added a function to move backwards
but given they didn't allow break, I find it unlikely
this is so cool
really convenient
so basically it first steps, then it checks the right, then it checks the left. If it still didn't find a fucking ball it will return
bro this is majestic
give that game a try, it's good to understanding how to optimize ur code and think with states
(if flash still runs)
I will definitely do!
I will just optimize this code with a parameter to check walls and i should be done!
there seems to be one big issue with the code tho
which is my fault for not letting you know
there are some variations
that have the balls next to a wall
right now the bot tries to go throught it XD
does step() still move or does it block?
also is there anyway for u to know there's a wall ahead? like a getPos() or an exception being thrown
in_front_of_wall()
will return a boolean value
It will crash if you hit the wall
also not allowed whahaha
use this then
i know, but then it stops the code for the other variations as well
void check_for_path_angle() {
if(!in_front_of_wall()){
turn_left();
turn_left();
step();
turn_left();
turn_left();
}
}
void path_agent() {
bool stop = false;
while (!stop) {
if(!in_front_of_wall()){
step();
}```
bool moved = move();
if (!moved || !on_ball) {
undo();
moved = false;
rotateLeft();
moved = move();
if (!moved || !on_ball) {
undo();
rotateRight();
moved = false;
rotateRight();
moved = move();
if (!moved || !on_ball) {
stop_bot();
}
}
}
function bool move() {
if (!in_front_of_wall() {
step();
return true;
}
return false;
}
what's this?
the same code but added wall checking
the function move() will check if it's not in front of a wall, if it isn't then move and return true, else return false
if the actor didn't move OR isn't in a ball, retry on another direction
truth table:
moved | on_ball | retry? (if not on last try)
----------------------------
Y | Y | No
Y | N | Yes
N | Y | Yes
N | N | Yes
can someone help me with my shooter game pls dm me so i know when someone wants to help me
why don't u ask here instead?
Bc it is hard to explain
it'll also be hard on dms
lmao
i really have a hard time understanding the code
so we are basically checking if it's in front of the wall, and assigning that to a moved bool?
However, isn't the in_front_of_wall() funtion already doing that?
So why are we overcomplicating it?
it's not overcomplicating, it's actually the total opposite
you're not checking if there's a wall, you're checking if you moved at all
you need to move to know if the next tile has a ball, but u cant if there's a wall, so you must first check if you can move
it should only retry if there's a wall in front of the actor or the next tile doesn't have a ball
you have no way to know the next tile before moving, that's why I assign the result of move() to a variable (else it'll crash as u said)
you can actually remove the variable althogether and use move() inside the check
if (!move() || !on_ball) {
undo();
rotateLeft();
moved = move();
if (!move() || !on_ball) {
undo();
rotateRight();
rotateRight();
moved = move();
if (!move() || !on_ball) {
stop_bot();
}
}
}
function bool move() {
if (!in_front_of_wall() {
step();
return true;
}
return false;
}
does it make more sense now?
ah yeah i see now!
i am also now allowed to use a bool function
i can only provide a bool as a parameter
like: void name (bool test)
12th
so yeah sadly can't use this
due to that function bool
full word
what could i use instead?
Tf is up with ur teacher
Well, simply place whatever is inside the function where the calls are
You'll need to use the previous variable method tho
Since it's cpp, u can also pass the variable as reference to not have to type the same thing everytime
so place the intents of the current function into the 3 if statements?
i've tried doing that but it doesn't work lmao
nah but this fuking program is so dumb
i tried dodging that wall but it's still trying to fucking penetrate it
bool moved = false;
if (!in_front_of_wall() {
step();
moved = true;
}
before each if, then set moved = false after undo
teacher conditions:
- cannot use
break - cannot use value-returning functions
- cannot use try-catch
- cannot use arrays
- cannot check surrounding tiles, only the current one
I'd hate to have such teacher
its because it's the 4th class of the year so they made their own environment with lots of restrictions
we can only use what we learned so far
Just obfuscate your code and tell him you fulfill all conditions
really annoying but yeah

do_stuff() and call it magic lmao
aye
or compile into a dll and call it a day
nobody is gonna read the asm instructions
void check_for_path_angle() {
turn_left();
turn_left();
step();
turn_left();
turn_left();
}
bool passed_wall_check = false;
void check_front_wall(){
if (!in_front_of_wall()) {
step();
passed_wall_check = true;
}
}
void path_agent() {
bool stop = false;
while (!stop) {
step();
check_front_wall();
if (!on_ball()) {
check_for_path_angle();
passed_wall_check = false;
turn_left();
step();
check_front_wall();
if (!on_ball()) {
check_for_path_angle();
passed_wall_check = false;
turn_right();
turn_right();
step();
if (!on_ball()) stop = true;
}
}
}```i might be ugly but it doesn't want to run anymore
why do u hate formatting
why would i format while still not having the code finished
imo formatting is an end job
formatting is as important as coding
because many bugs become evident on a properly formatted code
also it wont run obv, u didn't check if there's a wall before stepping
u changed my code so much that idk exactly what I'm looking at
the code is basically the same
only the function names are different
yeah that's the thing, i am not sure what's wrong with it either
alrighty i fixed it
and it works now
however the only issue is that it doesn't stop anynore wahhaha
nevermind
i fixed it
i am so damn smart
nevermind
it still doesn't work
@lyric mountain so apparentely the code cannot run when there's a wall right next to the balls
it tries to enter the wall
I lowkey like this result, it's goofy
does anyone know a good way to accept payment through discord? previously, i used donatebot, but its been down all of today and honestly the devs dont seem to care much anymore, so im looking to switch
ideally:
- users would be able to make one-time purchases by logging in with discord and then paying through paypal/stripe/whatever. they would then receive rewards in my bot
- users can also sign up for a recurring monthly subscription through the same method above
Discord is implementing an upgrade feature for bots so users can pay to unlock certain features, and the developers can easily work with it
If that's really what you're looking for... Although it's still in development, so you would have to wait
https://upgrade.chat is cool
Yeah but k don’t unfortjanlry
And my teacher neither
I will just wait on kuukahu then
u need java help?
currently farming in poe, I'll be back in around 1h
i have two github accounts (also generated two ssh keys), and i want to use them both on one computer. is it possible to set git config differently for each repo i clone?
oh nice! thats exactly what i need, i guess ill have to wait for that then
i was checking this out earlier and it looked pretty good
Technically you just need a single payment and reoccurring payment system and add the discord auth flow in front of it to get the user ID which you add together with the payment data into your database
It’s not like you need a bot or third party service for this
Yea I was thinking about doing this but I had no idea how to set it up lmao
i have a custom ngrok subdomain if thats what you mean
if you have a website already built i'd recommend integrating either stripe or paypal, if not then check out things like patreon or upgrade.chat which allow you to just handle the requests in the backend without having to have a frontend setup to create payments etc...
gotcha, ty!

Well most payment providers provide a restful api like discord does, too
That’s your way into managing payments
Does anyone know why this fails on build for opus? https://img.sticks.ovh/BcXqtUM5_
Might be that the code is an ES Module, but trying to run CJS only code
If you literally mean disable them you'd have to do that in settings yourself
The bot can't do it
My friend is asking how you import discord on discord.py and Idk because I use discord.js
pip install discord.py
import discord
# more ugly python code here
import discord from 'discord';

C**
Sure sounds good
try pip install npm
it fixes everything

Let me quickly upload a backup of my node_modules on GitHub before
Alright
So I’ve tried this but the problem is that it’s still stepping into the wall
Helloo
Good morning, so I'm using wordpress to create a website, there is a plugin called WooCommerce, which you can sell things on the website with it.
So I wanted to put it in my bot for when someone buys the bot to receive a signal and send a message, but I have no idea how to make a WooCommerce api keep checking every hr, it would be like the messageCreate event, that when someone sends a message the bot automatically identifies that someone sent it, but I don't know how to make this system keep checking if someone bought it, could someone help me?
the documentation is this: woocommerce.github.io/woocommerce-rest-api-docs
I don't speak English, so if the translator made a mistake, I'm sorry
Just create a custom PHP webhook that is getting triggered upon purchase, you won't need to make any requests from any bot
k, did u try with the exact code I wrote?
@rustic nova gaming?
gaming.
const Discord = required ('discord.js')
const client = new Discord.Client()
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on("message", msg => {
if (msg.context === "!hello") {
msg.reply("Hello")
}
})
client.login(process.env.TOKEN)```
I need help ^
How to
bruh mr doge did you really move from python to js
you still need to learn the language
🥲
Yes my friend told me that's a easier way
not really
discord.py is pretty much all prebuilt for you, discord.js is more like a jigsaw puzzle as you have to build command handlers etc
yes
https://www.markdownguide.org/getting-started/ just follow this
And in python that discord. Ext is kind of difficult
can you join the bot developers vc
i haven't made a py bot in like 6 months but im pretty sure its ```py
from discord.ext import commands
client = commands.bot(prefix="!")
@client.event
async def on_message(message):
print(message)
client.login("TOKEN")```




