#development
1 messages · Page 1906 of 1
this is true if you somehow post your token on github with config files
idk if thats ur case
not mine
and yes talking about solve... got to discord dev portal --->bot and regenerate your token then use the new token in your system
oh ok
@swift umbra https://www.npmjs.com/package/dompurify thats one i know

youre welcome
so basically i have this code that makes a new loop every time a command is run, so i wanna make a command that cancels just one of the loops that is running depending on the server
show some of the loop creating code?
you should insert an object into the _tasks array which contains the loop and an id so you can easily locate that loop later
can you tell me how to do that
it puts some kind of id in there like this discord.ext.tasks.Loop object at 0x000002896B3D2970
that is a memory location not a unique identifier you can easily access anyways
yea now when there are multiple running and someone wants to cancel the one running on his server, how do i make a command that does that
do you know how to add things to an array?
Which language?
Python
Python I’m guessing
Yeah
Lemme take a quick look at the code
tasks.loop I’m guessing too
Yea
Pretty sure it’s startloop()
Lemme look rq
Nah ignore that
Where are you getting that object from?
This is when I start a loop it goes in the list self._loops

No
The only way of testing that is via manual requests
oh
or manipulating the source data
then i should wait till my bot get approved
how to convert big link to small
in python
i know in html only
like hyperlinks
in a embed message
Wait for a python Dev to come
The error is correct.
botFile is a var you defined not a function.
@client.command()
async def invite(ctx):
Text = 'HI'
Vote = 'https://discord.com/api/oauth2/authorize?client_id=899172541862641724&permissions=137439267904&redirect_uri=https%3A%2F%2Freplit.com%2F%40IthihasK%2FEncourage-Bot%23main.py&scope=bot'
embed=discord.Embed(title="Invite")
embed.add_field(name="prefix",value = [Text](Vote), inline=True)
await ctx.send(embed=embed)
@cinder patio
like this
@earnest phoenix
no, it must be in a string
Wrong channel dude
Mod role bhi nhi sed
@earnest phoenix koi bhi le skta
Issh
Mod role toh leleta
@earnest phoenix sed baccha
😂
@earnest phoenix #general-int
cringe belongs to #general-int
they're literally saying i don't have any roles LOL LOL LOL LOL
there's a reason I say unfortunately when saying I'm an indian
@earnest phoenix Don't ghost ping
I’m sure you’re working as tech support like any Indian

That's the least of my problems as an indian
lol

ty
@client.command()
async def roll(ctx):
user = ctx.author
await open_account(ctx.author)
users = await get_bank_data()
num = random.choice(range(1,100))
await ctx.send(f'{ctx.author.mention} rolls '+f'**{num}!!**')
amount = num
users[str(user.id)]['wallet'] += amount
with open('mainbank.json','w') as f:
json.dump(users,f)
what is the error in this code
You tell us.
Hi Who Support A Bot
`wdym
???
How could I check if a specific option has been clicked.
@client.command()
@commands.is_owner()
async def give(ctx, user:discord.User,amount: int):
user = ctx.author
await open_account(ctx.author)
users = await get_bank_data()
users[str(user.id)]['wallet'] += amount
with open('mainbank.json','w') as f:
json.dump(users,f)
print(amount)
i am recieving the amount
how to make to give to user:discord.User
async def give(ctx, user:discord.User,amount: int):
await open_account(user)
users = await get_bank_data()
users[str(user.id)]['wallet'] += amount
with open('mainbank.json','w') as f:
json.dump(users,f)
print(amount)```
@deft citrus
try it
@client.command()
async def give(ctx, user:discord.User=None,amount:int = None):
if not user and not amount:
await ctx.reply("You must provide a user and an amount!")
await open_account(user)
users = await get_bank_data()
users[str(user.id)]['wallet'] += amount
with open('mainbank.json','w') as f:
json.dump(users,f)
print(amount)
``` try that too (Just added a response if both user and amount aren't present)
nothing else changed from Diosis code
Hey, so apparently, when I created this message select menu, it can only be used once, and the second time it is used in the same message, it fails, how can I make it not fail and be able to use multiple times in a row?
Man
Yeah? (talking to me?)
The guy literally ignored all of us who told him to learn Python
bro it shows red under user
i'm only adding onto the code their sharing and not sending whole code blocks now
You don't wanna help yourself — I won't bother either
@client.command()
@commands.is_owner()
async def give(ctx, user:discord.User,amount: int):
user = ctx.author
await open_account(ctx.author)
users = await get_bank_data()
users[str(user.id)]['wallet'] += amount
with open('mainbank.json','w') as f:
json.dump(users,f)
print(amount)
@spark flint its not working
whats the error?
error?
File "main.py", line 223
await open_account(user)
^
IndentationError: unindent does not match any outer indentation level
indentation error
check out tabs
means
i think you should know first how python works
otherwise you will keep running through errors like this
**Other Commands**
${interaction.client.commands.filter(c => c.commandName != 'poll' && c.commandName != 'ynpoll').map(c => `\`${c.commandName}\``).join(' ')}```
Returns undefined for all commands
help me
find out what c is and why it doesn't have commandName
?
check again
Been at this shit already
As you can see, no result
He refuses to learn Python by himself
no u
i did
if you're getting
`undefined`
that means c doesn't have commandName on it
**Other Commands**
${interaction.client.commands.filter(c => c.commandName != 'poll' && c.commandName != 'ynpoll').map(c => `\`${c.commandName}\``).join(' ')}```
thats what i am asking why it dont have it?

because you made a mistake lol how are we supposed to know
How we can know
ah ok
Lamo
lemme check
if you don't want to waste time on these pointless bugs you can try using a better language like typescript
Lol
where the compiler will tell you if you're trying to access a key on an object that doesn't exist
${message.client.commands.filter(c => c.name != 'p').map(c => `\`${c.name}\``).join(' ')}```
this works if my commands files have a field called `name: xyz`
but now i am working with slash commands
then that means you're storing 2 incompatible types in your commands array/collection
you either have to normalize them so they both use name or commandName or you need to make a function that checks both
at the moment only commandname exists
so how does the code you sent above work
that was from my last version
i am upgrading to slash commands
and this is the last issue before i wrap up
right, so you either need to rename the name property on your existing commands to commandName or make a function that checks to see if either commandName or name exists on the command object
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('...'),
async execute(interaction) {
return interaction.reply(`s`)
.catch(err => console.log(err));
},
};```
my commandfiles structure
right, clearly you can't rename that one, so rename your existing commands
all are of same structure
then you should have commandName for everything no?
yes
ok so you don't have a problem then
I don't know what else to say like you still haven't console.logged c
like 99.9% of the people who ask questions in this channel yes

and btw c cant be console.logged
It can be logged
where ?
what is it, a keyword?
a temp var
where can i log it after that statement its scope ends
Dude
damn and this is the guy telling other people to learn python first
U simply can console log it right in filter in {}
please dont mislead
ah it works? ok imma try
message.client.commands.filter(c => {
console.log(c)
return c.name != 'p'
})
or better, just learn how to use a debugger
so you don't have to do this meme
put a breakpoint inside the filter without changing code and inspect the object directly
^^
ok thanks for help
hope this is a good lesson in not being judgmental towards other people not knowing certain concepts
bro why troll me
wtf i just told him to learn indentation because he was copy pasting
saying to ezgi
true I'm such a troll
thats fair
be co-operative thanks
Haven't I actually typed here about him
Like 2 days ago
But u still spoonfeeding him
you guys been saying me.....like why? if i dont know shouldnt i ask?
yes because i understood he was copy pasting
he was not upto learning

Not to 13 y.o. boy who don't want to learn anything by himself
No ty
That cringe

you can figure this one out on your own I believe in you
damn
gj
?
ok
thanks @native walrus @sterile brook
would've taken like 5 seconds to fix this with typescript
I don't think that logic checks out
still, you need to do digging to figure out what's what instead of just hovering over the variable
and having the language tell you what you're working with

Hello, I want to create an AFK page in my bot where every minute the user is on the site, he receives 200€ in cash from the bot (in quick.db)
Discord.JS
Website in HTML
Page, bot and site in one sentence
https://blackbot.cf (/afk). JavaScript (discord.js)
So set interval function for adding cash
On ur page
What's the problem
Or while + timeout func
As u wish
it's a terrible idea
because I can use puppeteer to open your website and leave it online 24/7
i really hope that's in game currency
or just use a VPS or RPI etc
24/7
let fakams1 = ["17000", "15000", "12000", "13000", "14000"]
var itemms1 = fakams1[Math.floor(Math.random()*fakams1.length)];
setTimeout(() => {
const embed4 = new Discord.MessageEmbed()
.setColor("#00FF00")
.setFooter("Provided by Gauntlet bot!")
.setTimestamp()
.setDescription("GREEN LIGHT!")
channelwise.send(embed4)
const filter4 = m => m.author.id != client.user.id;
const collector4 = channelwise.createMessageCollector(filter4, { time: itemms1, max: 2});
collector4.on("collect", m => {
console.log(m.content)
let nmamk = [...minigame1.members]
user1 = nmamk[0][0]
user2 = nmamk[1][0]
if(m.author.id === user1){
g1 += m.content
}
if(m.author.id === user2){
g2 += m.content
}
})
console.log(itemms1)
}, Number(itemms1));```why is my damn timeout not working?
itemms1 is showing a random number, i've logged it multtiple times. However this bitchass of a timeout doesn't want to work
parseInt(itemms1)
Or better just store not strings
Lol
And u won't need any parsing
Tbh that wont affect anything since everything inside the fakams1 are a string with just numbers. And the setTimeout works for me well and good
alrighty, that actually worked.
I can think of one problem
Ofc it worked
how would i stop a timeout while it's running?
Return

save it to a variable, then just cancel it
removeTimeout or something like that
Orrr nvm
that's why I said "or something like that"

Nice
I make a logoff ater 3h
and i make puppeteer refresh the site after 3h
When ever I start my laptop, some to the applications start automatically
How do I stop then from doing so whenever I start my laptop
?
which os
my god
you should seriously update
but anyway
go into task manager and startup tab
Windows 7 is perfecto for old laptops
Windows 10 is too heavy and stores too much in ram
win7 is perfecto when you want to get hit by a vulnerability that's never going to get fixed
Eek
Guys, I'm coding a HTML and CSS website, any guides about hosting it?
if it's a static website, you can use github pages
Websites for you and your projects, hosted directly from your GitHub repository. Just edit, push, and your changes are live.
clearTimeout(timeout)
clearInterval(interval);
you can use those modified ultralight versions of windows 10
they're pretty good
who cares about vulnerabilities
am I right
not me (uses win7)
The well known “if it works, don’t touch it” thinking. I support you cuz I do it too 
my array map function is named withMap
it would be fine if it was a higher order component
That’s literally fire
i got a love hate relationship with powershell
I would like to host on my vps, is that possible?
i mean sure but you're going to have to buy a domain and mess around with that
i have a string named test1.
How would i count the amount of words that are the same as: "klmk12k3j21opidjqwodjas09dm21em908da84*)@(n1290ind208)!(@DADDNMK)!@NID_SEMEM129MC(A(m121mik"
what
so for example test1 == klmk. It would return number 4
what
and 12k3j would return 6
can anyone help me with discord-xp
js
idk then
can u guys?
how does that return 6?
lol
test1 has 6 letters that are also in that string
"klmk12k3j21opidjqwodjas09dm21em908da84*)@(n1290ind208)!(@DADDNMK)!@NID_SEMEM129MC(A(m121mik"
12k3j
12k3j is 5 letters
if(string.includes(test1)) length = test1.length
I still have 90 $ credits on digital ocean
DO doesn't sell domains
if(string.includes(test1)).length = test1.length this right?
no?
it doesn't
otherwise i wouldn't be saying this lol
DO is a hosting provider, not a domain registrar
domains (1)
cristianstinga.xyz
you can register domains you own with digitalocean but they aren't a registrar themselves
not good
rip
just buy your domain from porkbun and set the nameserver as digitalocean. Same thing
probably much cheaper too
Can i do it with heroku?
an oddly satisfying experience
heroku doesn't have its own DNS service but you can resolve a custom domain to a heroku instance yes
this is cringe
if someone can buy a domain they probably won't be using heroku for bots lol
if(subcommand == 'mop'){
let d = "fsdfk3j2"
let m12 = "klmk12k3j21opidjqwodjas09dm21em908da84*)@(*n1290ind208)!(@*DADDNMK)!@NID_S*EM*EM129MC(A(m121mik"
if(m12.includes(d)){
length = d.length
console.log(length)
}
}```
this should return 4
i hope someone actually understands my knowledge XD
yes.
no why would it return 4?
i want to count the number of words that are in the same order as the string
as you see k3j2 are in both strings, in the same order
yes so it should return 4 instead of those 7 characters in d
you're copypasting code without understanding what it does
i know what it does
you don't
search for it
in google
read the description for includes
it only run if it's exacttly the string of d
I copied it w/o thinking. Ofc includes won't work
this actually worked!
ofc it worked
the question is how. Just a for loop?
wait why ddon't i justt for loop all strings and call a ++ on a variable?
nah
foreach works
with sets
also for of
u also can [...setName] and use set as array
[
{
emojis: ["🍳", "🎂"],
name: "Pancake",
},
{
emojis: ["🍓", "🥛", "🤝"],
name: "Straw Berry MilkShake",
},
{
emojis: ["🇫🇷", "🍟"],
name: "French Fries",
}
]```
unexpected token "e" in json at line 10
property names need to be in double quotes
STOP ADD commas to the last property AAAAASAARRRAHBBHAHHR
that tru
Ahahah
lmao dude
as u like
gross

Omg nooo

not even done correctly
now thats a completely different thing from what you said before
That’s like raping your code
unrape code when
Sorry need to eat some pills to get rid of the physical pain 

meh
why String for a date field
?
strings for dates = bad
[
{
"emojis": ["🍳", "🎂"],
"name": "Pancake",
},
{
"emojis": ["🍓", "🥛", "🤝"],
"name": "Straw Berry MilkShake",
},
{
"emojis": ["🇫🇷", "🍟"],
"name": "French Fries",
}
]```
unexpected token "}" in JSON at position 59

grab_time?
remove the last comma in each block
you cant have ,}
thnx sir
i though the last comma lol
cuz that just will be result of subtraction in ms and i wont need any other operations with it
if it's ms why not save it as a number instead
Maybe it’s larger than the 32 bit max
Where did my word value go wtf
_i hate auto correct _
nah its not, i just hadn't thought about it at that moment
Do you mean the Nullish coalescing operator?
hey
I'm getting this error when I'm trying discord-rpc
Could not connect
at Socket.onerror (/home/runner/RPC/node_modules/discord-rpc/src/transports/ipc.js:32:16
what to do bout it?
ye
go to the ipc.js file
I first tried the code in the guide but it was not working for me
and see the line 32 or 16
i can't
That's not how it works.

pls help
yea pls 😂
better go on the web and see whats wrong with the code, people in here prolly not gonna tell ya the reason (too dead af)
k
thanks
😐
Not sure why you asked in the first place. 

ikr
Huh?
(I'm an idiot too)
Okay?
cool
I guess you solved your issue? Great then.
What?
i just told you to go on the web and see whats wrong

or send yo code with the full error to see whats wrong
Can Discord.js run with node@17.0+
I believe so.
They uprading node version so rapidly
How I connect quick.db to a website in html?
You can’t "connect" anything to HTML but your backend
It’s just a markup language not more or less 
That stacktrace is in a node module, which you generally don’t want to edit on your own. It’s likely caused by his fault, but editing the code of a node module will not solve his issue
Oh he’s gone
Nice 👍
const appCmds = await client.guilds.cache.get(client.conf.guildId).commands.fetch()
for(const name of client.slashCommands) {
const app = appCmds.find(a => a.name === name)
if(app) {
console.log("Found "+name)
} else {
console.log("Error "+name)
}
I created them as guild commands but i get error every time
what error?
the else part?
try a.data.name === name
client.updatePresence({
state: 'slithering',
details: '🐍',
largeImageKey: 'snek_large',
smallImageKey: 'snek_small',
instance: true,
}).catch(console.error);
``` can anyone help....it is showing cannot connect to socket onerror
pls help
Error
Its module error prob
how have you defined your command files?
how to fix it?
With not using it
😑
client.slashCommands
try await with appCmds.find
Problem is it returns undefined
Is that the correct application ID?
Btw if you’re trying to set a rich presence for a bot you can’t do that
cant help seems fine to me
{
id: 37193838
guild: guild {
something
}
}
I cant reach the id
Its my problem's example
are your guilds different for every check?
No its the result when i console appCmds
i mean will interaction.guild.id work in your case>?
Yeah why not?
try it then
ah
I meant that
it is undefined right?
Nwm i did it
ok
btw say the solution to me too
for const id, command of appCmds
command.name returns true
Yes so freakin weird but yes
Yes it is correct...I have checked multiple times
{
"key" =>
{
"value": "something",
"value2": "something2"
...
}
}
(as well as a map)
As far as I knew, it was a server side error and there is nothing much we could do about it. Just wait and try after like an hour or so, i ran into those errors like a million times and that's what other people said me. I could still be wrong tho
man why do go devs do this shit I'm gonna cry https://github.com/dop251/goja they put all the source code at the root level and put the main.go inside a folder by itself like you can't make this stuff up it's so ridiculous
lmao 
Ok thanks a lot for help ☺️
anyone has an idea why intellij is marking this? I recently updated my IDE and I didn't have this before is I thought this might be a bug?
DiscordJS: What's the best way to disable a single button on it after being clicked/used on a message with multiple buttons?
Damn
Its ugly and beautiul at the same time but it works
edit the message and set the disabled property to true when you receive a button click event
Yeah but you actually just change the button locally with that so you need to send it back. Found a way now
umm you can just edit the message with the new buttons
pip install javascript
solves all your problems
Thats what I ended up with, this only changes that 1 button and keeps all other message components unchanged without having to make a completly new Action Row
You need to store which buttons are disabled somewhere
Dont currently need that information at a later point, can also be checked with interaction.component.disabled; But this is fine for my use case
In the end event check if the amount of collected components is 0
You can't?
It will only end if it has got 1 amount.
It'll also end when the time expires
Wait, really?
mhm
DiscordAPIError[20012]: You are not authorized to perform this action on this application
Discord API Error while trying to set up slash commands. I understand what it's saying but I don't know how I would fix it.
Did you invite your bot with the right scope (application.commands)?
Hey, so it works, but it seems to just end the collector and can't use the menu multiple times in a row, as in the help command.
That's the code.
.. and it usually ends after 3 seconds.
yeah because you've set it to end after 3 seconds
What could I do?
I know, but how can I use each interaction received?
you're already doing it? Set it to one minute and try it out
Interaction failed?
I will never get why you would use a collector for this.
You receive the event, check if the interaction author is the one using the select menu or pressing a button and if so do your action.
(edit the original interaction response, send a follow up message etc.)
Interacted. Failed.
No need of a collector, filter, timeout etc.
Ah.
Dude, I used it anyway. 😑
Yeah but still more useless code to use instead of comparing the interaction user and menu/button user
Also since it seems components have no known timeout the user can still use the buttons/menus later on
Instead of using a collector with a predefined timeout
Why disabling the components of a help command after whatever 30s, for example?
Doesn’t make sense to let the user use another slash command later on if the components are disabled
Just let it active
I'm guessing, not guessing, but believing all bots do this?
Do what?
They disable the menu after a set amount of time.
Which doesn’t make sense for a help command since why not letting the user calling the command use the menu later on?
It’s so easy…
- user uses a slash command, this creates an interaction
- your script receives the event and responds with the help embed, incl. a menu to select a category
- user uses the menu to select a different command category, this creates another interaction
- your script also receives that event
- check in the event if a component has been used, if it has your unique ID, for example help-select-menu and if the component.user is the same as the interaction.user, to prevent others from using the menu
If so edit your original interaction response to show the commands of the selected category
The user can always use that interaction
Doesn’t need to use the slash command again if your collector is timed out
To see another category
Less code, less work, less RAM, higher efficiency, more user friendly
Less command spam in a channel as well
my help menu can be used by multiple people at once
and still works even if its several days old
lmao
Hmm yeah i mean that’s an option, too
But can cause trolling

That’s at least what I would do
But it still doesn’t change the fact that using a collector is just nonsense and more code than actually needed
why not just display all the categories at once?
yeah i simply use the raw interaction event
the button custom ids contain all the necessary metadata to know how to edit the message
Well that’s not really the purpose of a select menu 
Not to say it looks really ugly as well
Absolutely, that’s why I mean by people over complicating things
Because they somehow didn’t really understand interactions and try to copy the way they collect reactions I guess
Which is totally unnecessary
So uhm, someone decided to make discord as a database solution
Look at it like google drive, except it's using discord.. AS THE STORAGE
That's not new

Never said it was
what's the purpose of a select menu? to use nesting?
this doesn't look too bad
Yes even select menus support nesting
But I’m not sure if discord already supports it
like this?
i think the only way to do it now is to update the component which changes it for everyone
so that doesn't work
Your category as non selectable option like in HTML
Hmm not sure about multi select but the rest yeah
optgroup
I think one action should always count as one (interaction)
Yeah options already an array if I’m not wrong
there should be a form concept copied from html
Guess it’s planned to be supported once a beautiful day
for now it's best to keep them separate
writing all the logic to do sub menus now might end up being a waste if they add optgroups
I mean you can already trick that by creating options with the same unique ID in upper case for example acting as group titles
If the user selects him respond with an ephemeral message to select another option
Looks more organized than multiple select menus above each other
In my opinion
it's more functional
but not as beauty
once they add optgroups i'll just need to update a json object without any code
Yeah I somehow don’t like more than one action row
Looks weird
Groups would be nice
Or even somehow options you can highlight but which aren’t selectable
Nah that’s still something I’m not sure about
Yeah even if I think finalizing the current components is already more than enough for most of the users
do you guys integration test your bots? and if so, then how? qualitatively speaking, of course
to be more specific, do you try to 100% test everything the bot will do in an automated way? for example, if my bot creates a post and then watches it for a MessageReactionAdd, is it even worth trying to mimic doing that?
Well being experienced enough doesn’t require to test each small portion of your code all the time
you could use something like nightwatch to automate some test of your bot
But it is generally not a bad idea tho regarding the fact to not build bugs in
And the fact getting feedback is hard
it's good if you are on a team
im on a team of me, myself and i
If a bot usually don’t works as supposed to people will just kick it off their guild
make sure people dont break your stuff
Without any feedback most likely
for the most part, i try and isolate as much as possible away from discord so i can unit test it, but otherwise, for fully testing commands from start to finish, i think integration testing is the only way, i would think
automation testing. you can write a script to automate the browser and run a bunch of tests against your bot
but if your commands require more than one discord account it can get tricky to write automation tests
That's like, selfbotting
it takes like 10 minutes to setup. but still not worth it
possibly unpopular opinion, unit testing is a waste of time
good idea. just create another bot that sends the commands
most of the time its a waste of time all the time
lmao
I agree
I've never once used it and said "oh wow this was totally worth my time"
well i never used it like at all
although i can see it being useful if you have something that absolutely cant break
something used by millions of people
You clearly never worked with gnu C
neither have most people here
just... dont write bugs in the first place :^)
so true
funny we call them bugs, they are more like brainfarts
btw, I don't write bugs, I write unexpected features
xD
i use unit tests to test code as i write it, but then i dont save the test once its working
i spend a month writing code without running it a single time
scary
then i see how much it breaks
I usually start coding from sratch, reading some manuals, then when I feel like it should work, I test it out, and start solving the issues
a prof once told me never to do that
the worst is when it runs without issues
And when I'm working with DC, I usually test everything before I add discord, so I can debug more easily
because you're petty sure somethign has to be wrong, but you dont know where
Usually you'll leave in exceptions that'll cause your program to crash
In python, it's not a big issue, but in JS, it is
i run it in production and look at logs a few days later :^)
in JS, I put everything in try except and write the error then pass the except
Jokes on you, my programs don't log
lmao
I have a dev and a release version. Dev version literally prints everything it's doing, production just prints if it started
Do you use python or JS for Discord bot development?
i make it print activity like when a command is run or when an api access happens
js
i only use languages with goto
I started with JS, but then transitioned to python
I miss the () and the ;
and the {}
xD
do you comment your code?
look at this code:
I started commenting in the beginning, then just went with the flow, and made 0 comments
Python's for is pretty epic tbh
if need be, i write jsdocs and typings in a separate file
keep code for code only
i have a lib with a 5k line .d.ts file
because of jsdoc
nice
for watch in current_watches: will go trough every element of current_watches, and have the current element as watch
pretty cool tbh
isnt that the same as for (item of array) ?
is that JS?
ye
and is that valid code?
i see what you did there
yes, basically the same
I didn't know JS had it
simpler in Python though
i guess
well, if you prefer using built in class methods, its easier
array.forEach(console.log)
thats the weirdest array construction I've ever seen
it tries its hardest to be cool
yeah, lmao
what version of java is that?
idk
cpp is kinda weird
for(const string &text : texts)
cout << "value of text: " << text << endl;
version 5
yummy
wut
version 5?
isnt the current version like 16 or 17?
or 8 for the oracle edition?
version 5 has enhance for loops
and in groovy: array.each { v -> println v }
lmao
i just used an online java compiler thingy
I really loved how groovy is just a DLC for java
ah lul
i wouldn't install java on my computer
isnt kotlin also a dlc for java?
plot twist: you probably already have it
nah, kotlin is more like a spinoff series
well, u said java so...
i like java syntax tbh
same with scala
feels easier to find stuff
but I also like groovy's QoL features
like times method
i've never coded a single line of java, not even for minecraft plugins
I tried minecraft plugins in scala once. Not a great experience
minecraft doesn't actually support mods, it's all just a big hack
when the api you're using isn't functional it just feels like you're writing java but with fewer parentheses and semicolons
minecraft is an old car in a tuner's shop
like, mojang could actually make an official modding api or at least have the source code open
mods are the only reason minecraft is still alive
what would an official api get you that the current mods don't?
proper integration ig, current modding community is divided into two sides
fabric -> lightweight, easy but considerably limited
forge -> complete, powerful but somewhat heavy and confusing
official stuff will never be as good as community stuff when the community decides to make it happen
ye, that's why I also said to at least make the source code open
everything is currently based on decompiled binaries
I thought microsoft would want to push bedrock edition + an official lua API but it never happened from what I know
the community has the advantage of being able to break and crash the game as much as they want while they experiment with it
the official devs cant ever do that, they cant risk releasing broken stuff
how so
seems fine to me
weird
tbh I don't understand the use of the ampersand before the variable in foreach loops in c++, but I'm guessing it has something to do with performance
since pretty sure using by reference and using by the direct variable achieve the same behavior
it depends on the content/context i guess
in some cases, the reference would be a pointer instead of the value
yeah
the & makes it a reference
in mongodb, should i store chat messages onto the channel collection, by making a property that is an array of (textmessage)objects or should i make a new collection only for textmessages with a reference to the channel? what is the better thing to do?
yes, but if i would, how would i do it?
what lang?
nodejs
js then
node is a framework
bro, that doesnt answer my question
it does
use that to store messages
and set an expiring time depending on how long you'll need the msgs
the messages i intend to store i need stored persistent, and i have every right to store them
are you planning to store only command messages or any message?
if i tell you the answer you will say "wrong channel"
why would I?
because its not discord related
this channel is development related, not necessarily just for discord related projects
that's an important detail, I was thinking you were talking abt discord messages
all that is important is
the messages i intend to store i need stored persistent, and i have every right to store them
as long as it's not a discord message, sure
mongodb records have a max size. Normally you want to denormalize data in mongo to get faster reads but if you have infinitely growing data like a comment feed it might be a better idea to add a "foreign key" in a separate collection instead
now thats an answer xD
mongodb is way more difficult than people think because of this. There's no single answer to anything
beginners use it because they see it as a json file but in reality it's much more complex to use correctly than relational databases with straightforward normalization rules
I mean, I had little info to work with
well thanks for the answer, i guess ill go for an extra collection
i am currently building a status page for my bot, does the website code be inside my bots website code?
Better not, no but you just frequently report your bots data to a database for example and use it to get the status and calculate statistics (if wanted)
so use the database to post stuff on to the website?
You query the database, it doesn’t post data but yeah
It’s simply the connection between your bot and your website storing the status history
ohh got it thank you!
👍
Does anyone know any js opus decoding and encoding libs that isn't prism-media
I really don't want to have to pipe literally everything through ffmpeg because the use case would lead to a lot of overhead costs
so i am working on a yt video downloader, in this case mp3. The issue is that with vids that are like 5 minutes it starts it at a few kb and then slowly goes to 0
i am currently using ytdl-core
res.setHeader("Content-Disposition", 'attachment;\ filename="'+filename+'"');
ytdl(videoURL, {
filter: format => format.itag == itag
}).pipe(res);
any reason this could be happening
let m12 = "klmk12k3j21opidjqwodjas09dm21em908da84*)@(*n1290ind208)!(@*DADDNMK)!@NID_S*EM*EM129MC(A(m121mik"
let a = new Set([...g1])
let b1 = new Set([...m12])
let intersect = new Set([...a].filter(i => b.has(i)));```i have this codde, that needs to check if the inputted string follows the m12 string.
It now only checks for characters. However how would i also check the word order?
idk about js but sets are inherently unordered
Also does Set not have . Intersection(S2) method?
nope, js sucks and does not have the only methods on sets that you'd ever want to use a set for in the first place
🤣
I once had to compare React components with component.constructor.toString
lmao
Good I don't use classes
Anyone facing issues logging into discord from mobile?
Like if I try to login via oauth from mobile it keeps redirecting back to login page on discord
But it works fine from lappy
Weird shit
I spent the whole day trying to debug my app
discord issue
Yes
I get that
How to fix: go to https://discord.com/app and then go back to oauth
Hello,
I want to do a upvote reward for my Python bot, but I don't know how to do it.
I've already checked the docs
Thank you
PS: I need to get the user id in the process
Ah yes, the python docs will tell you exactly how to implement X or Y
Oh nwm i forgot the put .commands.edit lol
with express, how can i change the sent file on a specific event? i tried with app.sendFile(filepath) but nothing changes, i keep seeing the previous page
alr is there any way to play music from an mp3 source on discord.py
I can't find a working example anywhere
const filter = (interaction) => {
return !interaction.user.bot && interaction.user.id == message.author.id
};```
How can i make this to message smth?
i tried many things but it did not work
banned
epic
For those who can help
my bot JOINS the vc but never actually plays
thats the error
You need a VoiceProtocol to play, not VoiceState https://discordpy.readthedocs.io/en/stable/api.html#discord.VoiceChannel.connect
I've managed to find a workaround
It doesn't use YTDL anymore
You using wavelink or something?
It streams from an MP3 stream
its not a music bot like normal ones
it has a set stream to play from
It still uses ffmpeg
Yep
And it works this time
I have a working test playing a file
yep it works
playing http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one live on the bot
👏 Im afraid i gotta report you now to the bbc
Lol my bot won’t actually use BBC radio 1
I just needed a working audio stream to test with
app.sendFile or res.sendFile??
res sorry lol
is there anyway to make scalable app using java spring boot or is the cold start time too long? i've seen a minimum of 30 seconds for a cold start with spring boot. is there some special type of hosting for java spring boot that deals with this?
How can I add my bot to these quick actions?
Aren't they just components or am I wrong?
Context menus
^^
Pretty sure they’re just components
Although it might require a different scope or something stupid in true discord fashion
Didn't use context menu components yet, also I wonder about the icons
i've made one of those. it's a slash command type
and the other should be bot.js
make a bot for each user
why are you spawning twice

