#development
1 messages · Page 1827 of 1
ty
On replit, how do i make it where it "Auto Fills" to help me?
So I'm using nginx, cloudflare and flask, how do I add subdomains?
Just make a regular A record 
yeah but how do I add it
CF DNS settings 
bruh
I've tried that
But like with flask
and nginx
I know how to add it to the dns lmao
The framework you use doesn't change your server setup
Yeah but how do I implement it
is there any copyright on discord? Because i made a bot called Linkin Park 24/7 and it plays songs of the band 24/7. Am i allowed to publish such a bot?
You need to add new files in sites-available
There are tutorials on Internet about how to setup these files
https://hackprogramming.com/how-to-setup-subdomain-or-host-multiple-domains-using-nginx-in-linux-server/
First result of Google
Yeah but then how do I add them into flask
Dude I've googled this all like 100 times lol
Don’t ask me idk
You're responsible for the content you upload to Discord. If you play a song from a band and don't have the rights to, you're violating the ToS.
User content in the ToS:
Any data, text, graphics, photographs and their selection and arrangement, and any other materials uploaded to the Service by you is “Your Content.” You represent and warrant that Your Content is original to you and that you exclusively own the rights to such content, including the right to grant all of the rights and licenses in these Terms without the Company incurring any third party obligations or liability arising out of its exercise of such rights and licenses. All of Your Content is your sole responsibility and the Company is not responsible for any material that you upload, post, or otherwise make available.
Content as per the developer terms:
While we may sometimes review content to determine whether it is illegal or violates our policies or the Terms, and we may remove or refuse to display content, we make no representations or warranties about the content, its appropriateness, legality, pedigree or other details. Finally, content accessible through our APIs may be subject to intellectual property rights, and, if so, you may not use it unless you are licensed to do so by the owner of that content or are otherwise permitted by law.
ok thanks
obviously music bots are exempt since one of the largest bots are music bots/have some kind of music command
even though they stream copyrighted content regularly
my stance on such a topic is either remove that entire term or enforce it upon everything
how delete data
But people don't really care.
I failed
ss the json file
OK
You forgot a ","
"token":"ssss",
"sss":""
Also u just leaked your token
meanwhile create a new token
ok
Now my ping is broke
i already told you 3 times how to do it lol
azsrxdtcyvgu
but I could not
first of all, users.keys is an array
to remove an item from an array you have to use array.splice
google array.splice
second of all, you are reading from a json file
so every time you change, you have to write the json file again
Where did i mess up?
otherwise ihe change will not be saved
that code makes no sense, what are you even trying to do?
hey! Did the oauth2 uri change?
please learn some js
They do, but I YouTube doesn’t take action against people that run bots like that, probably either because they don’t want to spend the money on legal fees, or because it doesn’t make a noticeable hit to their revenue. (Plus other solutions like IP blocks are far cheaper than legal action)
make a bot..
const uri = `http://${hostName}:${port}/auth/discord/callback`;
Learn js before making a bot
Makes life a lot easier
you seem to have zero idea of what you are doing
Start the bot and do .ping
Also you might wanna regen your token after posting a screenshot of it
i already did
Alright good
Putting an Array
I could just do this:
anyone?
js
const Discord = require('discord.js')
const client = new Discord.Client()
const config = require('./config.json')
const command = require('./command')
client.on('ready', () => {
console.log('The client is ready!')
command(client, 'ping', message =>{
message.channel.send('Pong!')
})
})
client.login(config.token)
methinks, is posting the token a reliable way of force-resetting it?
it'd be a great way of emergency procedure let your token ever be stolen
since going through all the discord dev pages takes a lot of time
It didnt, no
Their IP blocks are actions against bots.
Can someone help me who is nice and not rude about me coding?
Why is this giving me the uri error then?
Well, I more or less meant any sort of legal action
Can some DM me to help me? I answer quicker in DM
It's better you ask your question here.
hihi
that code also makes no sense
pls learn some js
Hey, how can I make someone vote for my bot to send a notification?
normally "splice(1,1)"
did you forget a comma after the ] it has to be done ],
I looked but it's not exactly what I want
I learned to delete
TYSM! My ping is not working, do you have an idea why?
but i can only delete data in specific index
because everything about that code is wrong?
no idea.
yes, thats how arrays work
Stop. I will report you. I am using one of the best code places.
OOF ok
you have to find the index of the item you want to delte
one of the best code places?
you mean the video or what?
for example how can i get the index of the middle data
Video
you can use for example array.findIndex()
sorry, i dont agree with that statement. i dont think that video is one of the best code places
the best code places are the places where you learn how to code, for example codecademy, or udemy
I will learn slowly (I hope)
The video is the best
then why does your code not work?
the video does not teach you how to code
you're just copying stuff from the video
also, what you did to your code is not in that video
you're doing things that are not according to the video
and the video does not teach you how to do things that are not in the video
amd i wrong?
I am blocking you
@quartz kindle finish
If you want to learn programming, YouTube videos won't get you far.
i am trying to help lol
@quartz kindle thx
it's working fine now
what do you want me to say then? you're not doing what the video says, and then complaining that it doesnt work. well it doesnt work because you didnt do what the video says?
they hated him for he spoke the truth
you are a real savior Tim
😭
Does anyone know a good place to advertise a bot
i've been searching for a while now, and im unsure how i am supposed to get the clients users
can someone point me in the direction of this please, im not using a library
wdym client users?
You're interacting with the raw api, right?
yes
the users which share mutual guilds with the client
dont think u can do that with the api
wut
U can literally do that
Dafuq u talking about
i dont know ok 
Probably shouldn't say that if you don't know
thats why i said "dont think" but :thumbs_up:
i've even listened to all events, with every packet which is coming in. i've looked through all the data and i've not seen any users
maybe i missed it im not sure
there is no such thing
there is guild members
and members are linked to to users
users have no link to any guild
anyone else had issues using erlpack on worker threads? i keep getting this error:
Error: Module did not self-register: '\\?\C:[file path]\node_modules\erlpack\build\Release\erlpack.node'.
when trying to create multiple worker threads (one worker thread works fine tho)
i heard somewhere that NAN needs some special shit to work with threads, while N-API doesnt
erlpack uses NAN instead o N-API
ah ic
is this "special shit" difficult to add/use, or is there an alternative to worker threads which would make it work?
it would be something related to the C++ code in the lib
you can also try rebuilding
this error also happens when the build failed
yea gave that a go, didnt seem to make a difference
probably dont wanna touch the c++ code
the only alternative to worker threads is child process
is a child process more powerful than a worker thread?
"I will report you" for what given reason? trying to help you?
a child process is another node.js instance
has all the properties of a standalone node.js program
(and bloat)
weird that this doesnt seem to affect some people, im pretty sure people have used erlpack in threads before
could be also related to node.js version
NAN is whack

yeah i thought discord.js used worker threads and also allowed you to use erlpack? never tried it tho
I'm wanting to make a 10 second tag system to identify if my bot is online or not, but I'm not sure if I do this tag, how can I identify this tag and send the response to the api saying if the bot is online or not?
Another option is to use the macro NODE_MODULE_INIT(), which will also construct a context-aware addon. Unlike NODE_MODULE(), which is used to construct an addon around a given addon initializer function, NODE_MODULE_INIT() serves as the declaration of such an initializer to be followed by a function body.
In order to be loaded from multiple Node.js environments, such as a main thread and a Worker thread, an add-on needs to either:
Be an Node-API addon, or
Be declared as context-aware using NODE_MODULE_INIT() as described above
prefix saved in data but not working for all cmds ?
lemme take a look
this is supposed to be somewhere within the erlpack module code?
merged PR to another lib to enable worker thread support:
thats in /js/erlpack.cc
ah yeah got it
although this will only work if erlpack doesnt use global variables
did you rebuild?
fun

is tim breaking any more rules, Starman?
with context it isnt very funny but I think this will be super funny on starboard
xD
me when I realize discord.js-light is just prototype pollution
forge isnt a real thing???
djs dont like partials
if you can just be like
const maybeAGuildIDontKnow = client.guilds.forge({ id: "180112943612952577" })
maybeAGuildIDontKnow.leave().catch(() => { console.error("Not a guild!") })
ye
djs dont like possible api errors with invalid ids
also, i have a new type of pollution now
require cache pollution
:^)
what do you do there?
wait a fucking minute
wh
so basically
you said fuck you to Structures and did that shit?
yup
it has
so is djs-light reaching its end?
v13??
yes
so like 0 false 1 true?
uhh
ex MessageManager: 200
thats gonna cause issues when someone sets it to like GuildsManager: 5
yup
list the issues
even with partials enabled
djs really hates partials that much?
xD
yes really?
if they want they should be able to absolutely
people dont need that much babysitting
but no reason to code something if its already done for you
ever been in the djs help channels?
yes, fuck those people
ive never been there actually
lmao
I just assume its worse than here
but i mean
ever seen a webserver package with built in renderer or page handler?
there comes a point where you should probably stop making built in things
it just makes bloat
I think a command handler built in would still be nice
like not commando
that shitty help command
in DMS
WHY
WHY DMS
i think its still better done in a separate package
perhaps
or maybe like included but not forced
so you can do like js const { CommandClient } = require('discord.js') and it would have the command handler built in
but it would just be likejs class CommandClient extends Client { commands = new CommandHandler(this) }
what isnt too bloat for you?
a raw websocket :^)
ok
what in the world
basically customizable auto sweeping caches
so thats good?
looks way overcomplicated to use tbh
but yes, more options more good
now if only they would fix the events
djsl would be dead
but they dont fix
sure
anyway
nobody cares about any of this anymore
with the slash command thing
typescript would go crazy but it would work
oh right
its time for someone to create a new default shitty command handler for slash commands
or port over the old one
because thats what people do :)
im gonna make an interactions webhook server
and by new default I mean the first google search
I had to make a new command handler very cool 
I did not have to make a new command handler because I already had a slash command handler made
https://github.com/Million900o/terano-rose/blob/master/src/structures/SlashHandler.ts it works /shrug
Someone knows how to do this works?
megaConst = const;
what
explain?
Look
we are looking
what
oh reassigning
use let
let x;
console.log(x); // undefined
x = 1;
console.log(x); // 1
x = 2;
console.log(x); // 2```
hi, i'm making a programming language with @ruby vine. Just that i have a question, i would like to make a variable name like var or const, in the name that i want, example
Programming languaje original:
var variable = value
My programming language:
myname [variable] = [Value]
i just maked the rest of the language
but i just need to make that and i'll finish
oh
The annoying thing I'm trying to stop is whenever a guild hasn't invited my bot with bot and application.commands will give me a Missing Access error per guild so now i'm left with a messy terminal
idk anything about cpp but define maybe?
i know, but a little bit
How can i help someone
hi, i'm making a programming language with @ruby vine. Just that i have a question, i would like to make a variable name like var or const, in the name that i want, example
Programming languaje original:
var variable = value
My programming language:
myname [variable] = [Value]
i just maked the rest of the language
but i just need to make that and i'll finish
we already saw your message
If I shared my github repo for discord bot here, anyone willing to review it? Doubt it though
Are you wanting opinions or?
Uh, I can try but no promises. JS/TS?
js
Cool
Lemmie lookie
Glorious ping
what is p flag here, tsc -p?
When i connect a card to my heroku, will I have to pay anything (besides the verification fee) to claim the dyno hours? just making sure.
No
site showing 502 gateway error
hi
m = await ctx.send("<Poll Stuff...>")
if op1:
await m.add_reaction(resources.a_m)
if op2:
await m.add_reaction(resources.b_m)
if op3:
await m.add_reaction(resources.c_m)
if op4:
await m.add_reaction(resources.d_m)
if op5:
await m.add_reaction(resources.e_m)
print(m.reactions)
so i have this
and the reactions get added
but on printing the reactions i get an empty lis
*list
can someone help?
is there a way to get all the users from a server that the bot is in
ok thanks :D
no
wai
i think so
@wanton flicker
{sum(a.member_count for a in self.client.guilds)}
i use cogs
so i did self.client.guilds
but if you dont use cogs
i use cogs :D
{sum(a.member_count for a in client.guilds)} <- then do this
YES
yea
ah ok.
remove sum and use list
okok
also you don't wanna use member_count
a.members?
why l[1]?
also i dont get why my bot is in a server with 250 members 🤔
btw this prints out the server, not the members?
stuff like this:[<Member id=863419048041381920 name='MaxiGames' discriminator='6440' bot=True nick=None guild=<Guild id=867792589847396362 name='Limey Hub' shard_id=None chunked=False member_count=14>>]
hey like i have this code
app.post('/voted', webhook.listener(vote => {
let channel = client.channels.cache.get('870337356207648788') //vote log channel id
let user = client.users.cache.get(vote.user)
channel.send(`<@${user.id}> has Voted for ${client.user.username}!`)
}))
it doesnt mentions the user
i tried <@, <@!,<!@
all dont work
tried that also doesnt work
is just sends like this format
Does your bot have the ability to mention?
Also, it will always look like that if the user is not apart of the discord server the bot is posting that in.
actually thats a test webhook so it will mention its owner's id xd
yep
ik im just saying ig
once it's working and all.
We basically cached usernames for people who used the bot and if their ID matches just say <user> has voted.
db junk tho
brr okh
ayy youre PCGamerX
nice to meet you
i use your api for my bot
(if youre the real pcgamerx that is)
o, imagine me not knowing your name correctly 
hi
client.on('channelDelete', (channel) {
if (message.member.hasPermission("ADMINISTRATOR")) return console.log('THIS USER HAS ADMINISTRATOR PERMISSIONS!')
channel.clone()
.then((clone) => {
console.log(`Cloned ${channel.name} to make a channel called ${clone.name}`);
})
.catch(console.error);
});
how can I define message?
If they're deleting a channel, there is no message.
I want it not to copy if a adminstrator or the owner deletes it
I get that. But is this a command being ran or just the event of a channel being deleted? Reading the code, there is no indication of a sort of command running first.
sorry for the ping
just the event of a channel being deleted It will be connected to a command the command will grab the level the user is then let them use it or not
Gotcha. I'm not really the guy to assist with this but was wondering because in the context of the code block you sent, of course message would be undifined because just deleting a channel, there is no message.
Hello
Can I keep myself online using a VPS?
probably
what information are u taking from the message?
Not absolutely sure?
module.exports = {
type: "interaction",
run:async(client,i,cache)=>{
if (!i.isButton()) return
if (!i.customId.startsWith("ticket")) return
console.log("hello")
const schema = cache.schema.get("ticket.js")
const channelId = i.channelId
const data = await schema.findOne({channelId:channelId})
const channel = i.guild.channels.cache.get(data.channelId)
const members = data.members
if (!data) return
const split = i.customId.split("&").slice(1)
const action = split[0].slice(`act=`.length)
if (action==="lock") {
let val = split[1].slice("val=".length)
val==="true" ? val=true : val=false
let i = 1
if (val===true) {
const msg = await i.message.fetch()
unlockLoop(channel,members,i)
const components = msg.components
const btn = components[0].components[0]
btn.setCustomId("ticket&act=lock&val=false")
btn.setEmoji("🔒")
msg.edit({
components: components
})
} else {
const msg = await i.message.fetch()
lockLoop(channel,members,i)
const components = msg.components
const btn = components[0].components[0]
btn.setCustomId("ticket&act=lock&val=true")
btn.setEmoji("🔓")
msg.edit({
components: components
})
}
}
}
}

i is a number, and u dooing i.message
its huge but here it is
# resources.py
async def constructor(*args, **kwargs):
embed = discord.Embed(
title=clean_none(kwargs.get("title")),
description=clean_none(kwargs.get("description")),
color=kwargs.get("color"),
)
embed.set_thumbnail(url=clean_none(kwargs.get("thumbnail_url")))
embed.set_image(url=clean_none(kwargs.get("image_url")))
embed.set_author(name=clean_none(kwargs.get("author_name")), icon_url=clean_none(kwargs.get("author_icon_url")))
embed.set_footer(icon_url=icon, text="evil e-girl!")
if kwargs.get("field_names") is not None:
for name, value in zip(kwargs.get("field_names"), kwargs.get("field_values")):
embed.add_field(name=name, value=value, inline=kwargs.get("inline"))
return await kwargs.get("ctx").send(content=clean_none(kwargs.get("content")), embed=embed)
and also val==="true" ? val=true : val=false is equivalent to val = val === "true" @errant flax
or let val = split[1].slice("val=".length) === "true"
too lazy to change 
const color = cache.jsonFiles.get("colors.json").default
const emb = new MessageEmbed()
emb.setColor(color)
emb.setDescription("Support will be here shortly.")
const lockBtn = new MessageButton()
lockBtn.setStyle("SUCCESS")
lockBtn.setEmoji("🔒")
lockBtn.setCustomId("ticket&act=lock&val=false")
const unlockBtn = new MessageButton()
unlockBtn.setStyle("SUCCESS")
unlockBtn.setEmoji("🔓")
unlockBtn.setCustomId("ticket&act=lock&val=true")
const closeBtn = new MessageButton()
closeBtn.setStyle("DANGER")
closeBtn.setEmoji("🗑️")
closeBtn.setCustomId("ticket&act=close")
const openBtn = new MessageButton()
openBtn.setStyle("DANGER")
openBtn.setEmoji("📂️")
openBtn.setCustomId("ticket&act=open")
const row = new MessageActionRow().addComponents([lockBtn,unlockBtn,closeBtn,openBtn])
c.send({
content: `<@${msg.author.id}>`,
embeds: [emb],
components: [row]
})
??
The emoji field is only for custom emojis I believe
place the unicode emojis in the label
.setLabel("emoji");
You sure? I use this (for detritus, should still be the same though) for buttons:
new ComponentButton().setCustomId(':rewind:').setEmoji('⬅️').setLabel('Previous'),
new ComponentButton().setCustomId(':fast_forward:').setEmoji('➡️').setLabel('Next'),
etc etc
I think discord just doesn't recognize one of the emojis he's using
📂️ this one
Since there's nothing in the emoji selector associated with it
🔒
🔓
🗑️
📂️
I believe you can use this one instead @errant flax: https://emojipedia.org/open-file-folder/
label was a fix 
hi yall, so bot was running perfectly but today bot returned an error when i tested some commands, this is the error UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions i gave bot every permission it needs
the discord documentation says that the emoji field must be a partial emoji, so it's the libraries that allow strings and just concentrate them to the label text
Ah
I mean... It must not have the permissions it needs if it's returning that error
nvm it required administrator
i just use my bot myself and friends :))
i joined this server cuz sometimes i cant find my problem's answer on stackoverflow
anyone know how i could do this?
wdym?
the vote or the fun fact cmd?
if the vote thing #topgg-api
if the command they probably used an api
Using vote to content lock is so low
There's an npm package with hardcoded facts iirc
vote
then #topgg-api
use top.gg-api,they have a function for like hasVoted ..
message.channel.awaitMessages(filter, {
max: 1000,
time: 10000
}).then(collected => {
if(collected.content === `${array2[Random2]}`){
const damnlad = new Discord.MessageEmbed()
.setDescription(`${message.author} damn that was fast, ggs on getting that 7k`)
.setColor("GREEN")
db.add(`money_${message.author.id}`, 7000)
message.channel.send(damnlad)
return}
if(message.content !== `${array2[Random2]}`){
message.channel.send('e')
return}
i am trying to do that when a user sends the array2[Random2] it will send the damnlad embed but if he does not it wont do anything till he sends the right thing
you are waiting for a fixed 10 seconds, regardless if the user sent the right message
and collected is a collection
there is no collected.content
you have to find it in the collection
depends
if you need help with a specific part of it, maybe we can help
if you have no idea where to start, then no, we cant do it for you
that doesnt change what i said lol
OK
why did you delete the question lmao
day 2 of deciding what to use to make my documentation generator
I think I'll use handlebars tbh.
detritus
djs v13 as well
wait a min handlebars is 3MB unzipped. Ok. So it seems like I can't get away with the size
I'll have to make people download bloat
u mean master?
ye
At this point it's react vs handlebars and I think I'm gonna go with handlebars because the react ecosystem is... eh... in order to make react work I'll need webpack, babel, all that shit
you didnt like the razor thing?
It hasn't been updated in 3 years that's the only reason
the syntax is better than handlebar's
Is ther anyone that knows the answer btw?
yup
This is how I am trying to get to it: hostname= http://localhost port= 8080
try one of these other 17 alternatives lmao https://colorlib.com/wp/top-templating-engines-for-javascript/
they're all the same thing essentially
true
Request failed with status code 400 lavalink error with spotify playlist, is this because of the lavalink node or the bot's code?
this is probably false, but is it possable at all to track your console from code? Like to make it see that is something logs, it would do something with the data?
nope
aww
logs are send to stdout
once they are sent, they are gone from the program
what you can do is extend the log function
so that is saves somewhere before sending
indeed..
console.log(...things);
process.emit("log", ...things);
}```
that would kill it lol
oop
whats emit? does it save or something?
xD
process is an event emitter
you can emit stuff and listen to them with process.on("stuff")
yes
console.log = function(...things) {
process.stdout.write(things.join(" ") + "\n");
process.emit("log", ...things);
}
well, you could do that
but a better way would be to store the reference somehwere
like console.log2 = console.log;
then replace it and call log2 inside it
ye
Hey.
Is it only me who's experiencing trouble pressing enter when typing !help, it's like wanting me to press it 4 times for it to send, unlike normal messages requiring once.
Hello, I need help with an issue.
I want to enlarge/reduce the dimensions of a text as scaleX and scaleY or heigth and width
but I couldn't see anything like that in the ctx.fillText part of the canvas
What I want to do is:
ctx.fillText(text, height, width, x, y)
or
ctx.fillText(text, scaleX, scaleY, x, y)
their order may change, that's okay
used Translate
can some one help with the post stats
you have 2 options:
- calculate font size from scale
- fillText in another canvas, then ctx.drawImage(othercanvas) with all the scaling parameters
^
I adjust these dimensions manually, so it may not give a clear result, for example (18.3333333334)
and I don't know how to find the font size with these (scaleX, scaleY, width, height).
Secondly, since I send the text as ctx.fillText, I don't know how to turn it into a picture.
used Translate
you can draw one canvas inside another canvas
so canvas1 ctx.fillText()
canvas2 ctx.drawImage(canvas1)
with drawImage you can scale
are they all in different scales or the same scale?
Will this cause any performance loss?
Since the scales are set by the user, they can all be different or the same.
there is a bit of performance loss yes, but its not a lot
so you want the user to be able to increase font size?
cant you just do it with ctx.font = ${size}px?
so you can stretch and stuff?
yes
then no, you have to use the drawImage method
let guildMember = message.guild.members.find(guildmember => guildmember.id === user.id);
return new Player(board, user.id, guildMember.displayName, avatar, 2000, 0, 0, false, []);
```. TypeError: Cannot read property 'displayName' of null
check if guildMember is not null
cache.get() too
owh wait shit i ofc updated my djs
is there any other way to directly see my djs version instead of npm list
as i have lots of modules installed
discord.js@11.6.4
oh god
you know we have 13.0.0 right ?
mhmm, i am running on the latest version with all of my other bots. Just need to update this one.
Might do it now i guess.
Will talk to you guys once it's done
d.js v11
wait is that emoji not from the rain or something. uhhhm... that guy that was constantly yelling shaun. 
ive generated, tsdoc in doc folder. Do I hv to push this folder to github, in order to host the docs on github pages?
or github I can configure it so, it could be auto generated and hosted?
How do i get server invite with discord js
Like when i said server info it will create unlimited invite link and will add to embed (i need only create invite part)
- bot needs permission to create invites
Yes it has
and what programming language do you say?
Discord js
Okay
message.channel.createInvite({maxAge:0, maxUses:0}).then(iv => {
console.log(iv.url);
});```
I don't remember right, but I'm sure it's like that @earnest phoenix
Thanks
Im trying to get the webhook working, but i dont really understand how to get the domain... Im running this on my pc for now
const webhook = new Top.Webhook('hereThePsw');
webhook.login('what should i put here? /topggVote', '3000'); //you can edit the port (only numbers) NOTE: PUT .login METHOD BEFORE THE .on('vote') METHOD
webhook.on('vote', vote => {
console.log(`User id: ${vote.user}\nAll data: ${vote}`);
});
is this the right channel btw?
ok ty ill ask there

Anyone here hosting on ovh vps?
lmao
that's a hot take
google cloud
Can i use it without then function
It returns a promise, so whatever you want to do with it is up to you
You could use async/await, convert it to a callback, or not even bother to resolve it. But if you want the actual invite, you need to resolve it somehow.
depends on what you consider good
You can use HTML and CSS in the long description
I like bots that keep to using regular Markdown
something better than the normal backround and text because all the one i watch are out dated
What do you mean outdated?
they dont work for me so they might be to old
Can you show what you're doing
do you know css
no
then let's start there
and not much html
then learn the basics, dont just directly jump into the void
this is only for Discord bot development?
Nope. Can be other stuff too
I'm getting used to the new slash commands. I figured out how I can respond, but I want to respond with a deferred response. How can I do that? Discord.js
I've got this now, but that's not working:
client.ws.on('INTERACTION_CREATE', async interaction => {
client.api.interactions(interaction.id, interaction.token).callback.post({data: {
type: 5
}});
setTimeout(() => {
client.api.interactions(interaction.id, interaction.token).callback.patch({ data: {
type: 4,
embeds: [ new Discord.MessageEmbed().setTitle('hello world!')]
}
});
}, 5000);
});```
anyone has a good option for a CI that can automatically push from a GitHub repository and are free to run nunit tests from DotNet CLI?
oh my problem is solved. The deferred response is the same as a follow-up message:
setTimeout(() => {
new Discord.WebhookClient(client.user.id, interaction.token).send('hello world');
}, 5000);```
await category.AddPermissionOverwriteAsync(Context.Guild.Roles.First(xa => xa.Name == "ERP Bot"), OverwritePermissions.DenyAll(category).Modify(manageChannel: PermValue.Allow));
I get The server responded with error 403: Forbidden error but my bot has permissions. What's the problem in this situation, anybody can help me please?
wait, what is ERP Bot?
A role
Role Name yea
but, for what?
is this java or something
C#
I created a Category and i want to add this category my bot role. But i get it this error...
read this @carmine adder https://discordjs.guide/popular-topics/permissions-extended.html#limitations-and-oddities
Github actions would work, if the repo is public it's free unlimited
I never has used GitHub Actions but is good like Travis CI? (I have used Travis CI in some projects a time ago but I want know if has best options)
and I still curious to know what the abbreviation of ERP on the name of the bot thats mean
Eightborn Role Play, When I start to make this bot i did it for role play features for role players on discord text-based. Like throwing a dice or writing some sentences for trying somethings and the bot will retrieved via success or fail. But now, i'm still developing with new features not just rp. I'll change this name later.
This isn't Enterprise resource planning if you thinking like this 😄
In React, is it safe to render a webpage at the toplevel (via document.documentElement)? All the examples I've seen start at the body element (via document.body) and users recommend others use Helmet.
{
lvlDTdata: {
asd: "asdasdasd",
xd: "xdxdxd"
}
}
{
ttlDTdata: {
asd: "asdasd",
xd: "xdxd"
}
}
```I have such a data, but how can I get ttlDTdata and lvlDTdata from these data?
i just need to loop these two headers already the data values `(asd, xd, asd, xd)` inside are fixed
fs.readdir("./src/commands/", (err, files) => {
console.log(chalk.red('Loading Commands...'))
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./src/commands/${file}`);
let commandName = file.split(".")[0];
if (settings.includes(commandName)) return;
console.log(chalk.green(`[+] ${commandName}`));
client.commands.set(commandName, props);
});
});```Uncaught Error: Cannot find module './src/commands/8-ball.js'. Pretty sure that the file is there tho.
Does your data structure look more like this?
let objs = [
{
lvlDTdata: {...}
},
{
ttlDTdata: {...}
}
]
If so, you just need to find it by the key. For example, using .find to see if lvlDTdata exists as a key for one of the objects in an array.
where is the file that you are running fs.readdir in
It's better to render inside a <div id="root" />
But that's inside the body
¯\_(ツ)_/¯
it must be for a reason
example: chakra-ui has a Portal component which i forgot what it does but it uses a completely seperate div inside the body element for doing some shenanigans
my purpose is actually
Code: ```js
xpData.locations.forEach(x => {
console.log(x)
})
Output: ```js
{
lvlDTdata: {
asd: "asdasdasd",
xd: "xdxdxd"
}
}
{
ttlDTdata: {
asd: "asdasd",
xd: "xdxd"
}
}
loop headers and pull data for each variable. Ex:
xpData.locations.forEach(x => {
console.log(x.**variable**.asd)
}) // output: "asdasdasd", "asdasd"
That doesn't really make sense (Turan)
why
You shouldn't have two top-level objects in the same variable
It wouldn't make sense to do ```js
let x = {
lvlDTdata: {...}
},
{
ttlDTdata: {...}
}
this is the real output
{
lvlDTdata: {
x: 484.9999999999996,
y: 149.9999999999998,
scaleX: 2.7196793662000194,
scaleY: 2.719679366200019,
width: 872.9999768733978,
height: 269.9999928474426
}
}
{
ttlDTdata: {
x: 485.00000000000074,
y: 15,
scaleX: 2.634862774721654,
scaleY: 2.634862774721655,
width: 872.9999768733978,
height: 269.9999928474426
}
}
```I changed it because I didn't want to share
used Translate
Are you using visual studio code
i want to get x value in both headers with one code
If yes, hover over xpData.locations and send a screenshot
It will make it easier to see the data structure
1sec pls
I wasn't concerned with the inner parts. I was concerned with the outer parts. Anyway, you just want to check if lvlDTdata or ttlDTdata are properties. For example, you could use let data = (x.lvlDTdata || x.ttlDTdata).asd
really small :D
[{"lvlDTdata":{"x":484.9999999999996,"y":149.9999999999998,"scaleX":2.7196793662000194,"scaleY":2.719679366200019,"width":872.9999768733978,"height":269.9999928474426}},{"ttlDTdata":{"x":485.00000000000074,"y":15,"scaleX":2.634862774721654,"scaleY":2.634862774721655,"width":872.9999768733978,"height":269.9999928474426}}]
here my main goal is not to use lvlDTdata or ttlDTdata but to get the "x" value in all headers with a single code
any
It should say smth like { lvlData: {} }[] with number instead of 484.999999
Like Object.values(obj).map(({ x }) => x)?
yes i was definitely talking about that
That returns [484.9999999999996, 485.00000000000074]
thank you so much
Yeah
I just don't understand why people choose to render it only in the body or in a div in the body
Because that's where content should go
And if I wanted to add stuff to the head?
Imagine the react stripping out all the other script tags from the body
That'll be a pain to fix
Or even stuff to the <html>?
Isn't it for rendering?
useEffect with an empty array and then add stuff manually to the head with js
hmm
that'll run the js when the component is mounted
DONT put it anywhere other than your App or root component
man i need help
this thing fkin stupid
Unexpected end of multipart data i keep getting this error when im forwarding formdata to another service
and if you dont want to wait for the UI to render for your head stuff to happen just put a <script async src="./head.js">
my mind also fk because you gave no code/error for us to help you with
const files = req.files;
for (let i = 0; i < files.length; i++) {
fd.append("uploads", files[i].buffer, { filename: encodeURIComponent(`/${files[i].originalname}`) });
}
Object.keys(req.body).map((key) => {
fd.append(key, req.body[key]);
});
const resultStream = new stream.PassThrough();
try {
req.headers["content-type"] = `multipart/form-data; boundary=${fd.getBoundary()}`;
pump(fd, got.stream.post(`${USER_HOST_EXTERNAL_PROTOCOL}://${USER_HOST_EXTERNAL_DOMAIN}/files`,
{
headers: req.headers,
https: { rejectUnauthorized: false }
}),
resultStream, (err) => {
if (!err) {
resultStream.pipe(res);
}
resultStream.destroy();
});
} catch (err) {
resultStream.destroy();
}```
what's req
welp im just trying to pipe formdata to another service
it works fine on desktop
ayyo i didnt paste the whole function name and stuff
(req, res) => above content
please use triple ``` instead of double .
when i try to upload from mobile it keeps throwing unexpect end of multipart
const files = req.files;
for (let i = 0; i < files.length; i++) {
fd.append("uploads", files[i].buffer, { filename: encodeURIComponent(`/${files[i].originalname}`) });
}
Object.keys(req.body).map((key) => {
fd.append(key, req.body[key]);
});
const resultStream = new stream.PassThrough();
try {
req.headers["content-type"] = `multipart/form-data; boundary=${fd.getBoundary()}`;
pump(fd, got.stream.post(`${USER_HOST_EXTERNAL_PROTOCOL}://${USER_HOST_EXTERNAL_DOMAIN}/files`,
{
headers: req.headers,
https: { rejectUnauthorized: false }
}),
resultStream, (err) => {
if (!err) {
resultStream.pipe(res);
}
resultStream.destroy();
});
} catch (err) {
resultStream.destroy();
}```
i did use "```
Since I put it in a loop, it throws each one in another array. Is there a way to prevent this?
What do you mean?
Code: js xpData.locations.forEach(z => console.log(Object.values(z).map(({ x }) => x))) Output: ```js
[ 484.9999999999996 ]
[ 485.00000000000074 ]
TT
I have to loop them as they are inside the array
What do you want the output to be
just use .flat()
[ 484.9999999999996, 485.00000000000074 ]
You mean js [ [ 484.9999999999996 ] [ 485.00000000000074 ] ]right?
If so then yes flat()
no
Then no
onyl [ 484.9999999999996, 485.00000000000074 ]
lol
then wrap it in a spread operstor
there is no way i can do this without looping
[...Object.values(rest of the code)]
when I loop it, it throws them all in a separate array
no you cannot
we still dont understand what you mean by throws in another array
the output is just this
[ 484.99999999999996 ]
[ 485.00000000000074 ]
1sec pls
where the bois when you need em
Output:
Ok that's confusing just log xpData.locations
Output:
[{"lvlDTdata":{"x":484.9999999999996,"y":149.9999999999998,"scaleX":2.7196793662000194,"scaleY":2.719679366200019,"width":872.9999768733978,"height":269.9999928474426}},{"ttlDTdata":{"x":485.00000000000074,"y":15,"scaleX":2.634862774721654,"scaleY":2.634862774721655,"width":872.9999768733978,"height":269.9999928474426}}]
They're different entries
yeah flat should work
yes so I can't get it out without looping
I want this
codecodecode
// output: [484.9999999999996, 485.00000000000074]
yes
xpData.locations.map(x => Object.values(x)[0].x).flat()
HoaX and flazepe and others
oh yes
console.log(xpData.locations.map(x => Object.values(x)[0].x))
Output: [484.9999999999996,485.00000000000074]
Thanks
cool
now where my bois at
help me
;-;
or i might resort to fixing my issue with a dirty shortcut
@sudden geyser How would one spawn 2 simultaneous threads for a 1D Vec? 
Would it be in a while loop with an index being incremented by 2 once both threads are done?
Or is there another way in Rust?
I'm confused by your question.
You can spawn a thread with std::thread::spawn, but what you want to do with the thread is the confusing bit.
Is SQLite bad if you're using it with a sharded bot?
I want to run a selenium script in a separate thread
I want to spawn a thread per each element in my Vec
Optimally I want to do it in a bunch of two elements at once instead of just one
how do I fix this?
/*
Argument of type 'null' is not assignable to parameter of type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
-------
(parameter) fillWith: null
*/
function generate2DArray<T = null>(row: number, col: number, fillWith = null) {
return Array.from(Array(row), () => Array<T>(col).fill(fillWith))
}
Are you looking to make T a nullable type
yeah, the default
is it possible to take the type (T) from fillWith?
so we dont even hv to specify the generic?
I want to get the length of "a" letter in that list. How can I do this?
const list = ["a", "b", "a", "a", "c", "d"]
To count the amount of a specific element?
Yes
array.reduce((total, e) => (e === "a" ? total + 1 : total), 0);
You would use array reduce to add up the total every time the specific element is found, where e is the element, you can figure out the rest
What if I use this? Which one is the best
list.filter(item => item == "a").length
that's a more readable way but slower
since you'd be making a new array and throwing elements into it as opposed to just adding to a total
So, what is the best way to do it in that example
const json = {
"1": "a",
"2": "b",
"3": "a",
"4": "a",
"5": "c"
}
I want the count the amount of "a" element
is it?
Object.values(json).reduce((total, e) => (e == "a" : total + 1 ? total), 0)
yup 👍
Thank you
Can sorting a big list of dictionaries crash a bot ?
Or even .reduce((total, letter) => total + (letter === "a"), 0)
By crash I mean make it restart
nope
Yeah, but there are a lot of factors to consider
I'm sorting it by just one value
Around 300 dictionaries in that list
1 dictionary have 1 user's data
So you want to sort all users by some property
e.g. their level
But "big" is subjective
Most users don't have to worry about sorting large collections of data
yeah thats what i m doing it was working fine till 2 days ago but now it works sometimes and just end up restarting the bot i narrowed my search down to sorting if i reduce the number of users by filtering it works normally
That sounds like a bigger problem
It could be the result of something else
Because sorting a 300 element list is nothing
How do I cache/fetch all the members of a guild and execute a command on them like adding a role? Right now I use:
message.guild.members.cache.forEach(members => {
// code
})
But nothing happens on the accounts that haven't had any activity since the bot was turned on? Is there any way to force fetch all the members?
Do you have the intents enabled
you need the server members intent for that
I do have that I think
then you can do await message.guild.members.fetch()
Alright I'll try that
a.setName(`Members: ${member.guild.members.cache.filter(x => !x.user.bot).size}`)
b.setName(`Bots: ${member.guild.members.cache.filter(x => x.user.bot).size}`)
c.setName(`All: ${member.guild.memberCount}`)
Why it shows member count wrong
Not all members have been cached
It works on similar servers

thats what i am thinking too
but cant figure out i changed my token on the day this bug first showed up
users that are offline are not sent if you have presence intent iirc
if you want ALL members, use guild.memberCount
I want member count without bots
if you absolutely need to filter bots out, then you need to fetch all members
which requires the server members intent
and costs a lot of memory
Read it first
We're telling you the answer. We're not saying these things for no reason
He said that this isnt my answer?
That statement and the next three messages are one thought
why when i use this code, it doesnt console.log() (line 19) but all the other code works https://srcb.in/fdOXm6SQOH
because infractions is always 1
oh, why is that what did i do wrong?
you always create a new Collection
good point lmao
It would be advisable to store things in an actual database instead of in memory since memory is volatile
works now thx
i do it like this cuz i want to
Okay
is mongodb supports Map Object?
why would you store a map object in mongodb?
realistically should be putting each key in their own document instead.
I used json but I need functions like .filter() .has()
thats what mongodb does for you
I will change the question
My json object
const json = {
"1": "user",
"2": "role",
"3": "user",
"4": "user",
"5": "role"
}
What I need is
{
"1": "user",
"3": "user",
"4": "user"
}
How can I filter json object according to values
youll probably want to use an array instead for that, as it seems your just indexing them anyway.
does someone has solution for this?
so basically you want an array of keys, which has a certain value from that object?
yes
Hello general chat
Hey
hey
d o g
How's your day been
dog
are asleep
👀 you all are in the wrong channel
oh no woo
thats the point
wooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
dog party
This is general now
and #development is general

Object
.entries({ "1": "user", "2": "role", "3": "user", "4": "user", "5": "role" })
.flatMap(([key, val]) => (val == "user" ? key : []))
@quartz kindle pls rate my code on a 1-10 basis on how pissed off my code makes you
// HANDLE THE FUCKING SCORE
if (pongers.ball.x == g_desktopRect.left) {
pongers.opponent.score++;
resetGame();
}
else if (pongers.ball.x + pongers.ball.width == g_desktopRect.right - g_desktopRect.left) {
pongers.player.score++;
resetGame();
}
// HANDLE PLAYER-BALL COLLISIONS
if ((pongers.ball.x == g_desktopRect.left + pongers.opponent.x + pongers.opponent.width && (pongers.ball.y > pongers.opponent.y && pongers.ball.y < pongers.opponent.y + pongers.opponent.height)) || (pongers.ball.x == g_desktopRect.left + pongers.player.x && (pongers.ball.y > pongers.player.y && pongers.ball.y < pongers.player.y + pongers.player.height))) {pongers.ball.xforce *= -1;}
//bouncy ball hit ceiling/floor
if (pongers.ball.y == g_desktopRect.top || pongers.ball.y + pongers.ball.height == g_desktopRect.bottom - g_desktopRect.top) {
pongers.ball.yforce *= -1;
}
give line breaks for if
Make the entire thing a one liner
now im going to remove all line breaks when i finish
u hv to give line breaks, on every little code u write in ur entire life, from now on
u r cursed!!
no
// HANDLE THE FUCKING SCORE
if (pongers.ball.x == g_desktopRect.left) {pongers.opponent.score++;resetGame();}else if (pongers.ball.x + pongers.ball.width == g_desktopRect.right - g_desktopRect.left) {pongers.player.score++;resetGame();}
// HANDLE PLAYER-BALL COLLISIONS
if ((pongers.ball.x == g_desktopRect.left + pongers.opponent.x + pongers.opponent.width && (pongers.ball.y > pongers.opponent.y && pongers.ball.y < pongers.opponent.y + pongers.opponent.height)) || (pongers.ball.x == g_desktopRect.left + pongers.player.x && (pongers.ball.y > pongers.player.y && pongers.ball.y < pongers.player.y + pongers.player.height))) {pongers.ball.xforce *= -1;}
if (pongers.ball.y == g_desktopRect.top || pongers.ball.y + pongers.ball.height == g_desktopRect.bottom - g_desktopRect.top) {pongers.ball.yforce *= -1;}
He’s cursed to forever write one liners
*urself
if (pongers.ball.x == g_desktopRect.left) {pongers.opponent.score++;resetGame();}else if (pongers.ball.x + pongers.ball.width == g_desktopRect.right - g_desktopRect.left) {pongers.player.score++;resetGame();}if ((pongers.ball.x == g_desktopRect.left + pongers.opponent.x + pongers.opponent.width && (pongers.ball.y > pongers.opponent.y && pongers.ball.y < pongers.opponent.y + pongers.opponent.height)) || (pongers.ball.x == g_desktopRect.left + pongers.player.x && (pongers.ball.y > pongers.player.y && pongers.ball.y < pongers.player.y + pongers.player.height))) {pongers.ball.xforce *= -1;}if (pongers.ball.y == g_desktopRect.top || pongers.ball.y + pongers.ball.height == g_desktopRect.bottom - g_desktopRect.top) {pongers.ball.yforce *= -1;}
there is still some spacing left
make it look better
if(pongers.ball.x==g_desktopRect.left){pongers.opponent.score++;resetGame();}elseif(pongers.ball.x+pongers.ball.width==g_desktopRect.right-g_desktopRect.left){pongers.player.score++;resetGame();}if((pongers.ball.x==g_desktopRect.left+pongers.opponent.x+pongers.opponent.width&&(pongers.ball.y>pongers.opponent.y&&pongers.ball.y<pongers.opponent.y+pongers.opponent.height))||(pongers.ball.x==g_desktopRect.left+pongers.player.x&&(pongers.ball.y>pongers.player.y&&pongers.ball.y<pongers.player.y+pongers.player.height))){pongers.ball.xforce*=-1;}if(pongers.ball.y==g_desktopRect.top||pongers.ball.y+pongers.ball.height==g_desktopRect.bottom-g_desktopRect.top){pongers.ball.yforce*=-1;}
thats llike a good boy
i haven't tested it yet
so i sure do hope it fuckin works
at one portion of the project,
im just gonna make it assembly code
Does anyone care?

xD
Hellu
https://sourceb.in/pO1ZgTfjRa
Soo.. this command will randomly send the message like "first one to say hi wins"
but in my code even if i say the correct thing it says wrong
it is like dank memer.. it will send smth random for coins
how can i remove a role of a member without member intents?


