#development
1 messages Β· Page 2012 of 1
and you are giving it this { client_id: string | boolean; client_secret: string | boolean; grant_type: string; redirect_uri: string | boolean; code: string; scope: string; }
can client secrets/ids be bools ?
no idea
I think not?
the error you showed should have information about what file and what line that happened on
you didnt show that part
man gave boolean on string

@quartz kindle i love it when people don't understand type errors
All he really needs to do is not have client_id and secret be of type boolean by the looks of it as that makes no sense anyways
i dont think thats it
i think hes trying to pass a full object to a function thats expecting a string
Well the error states it can take more than a string by the looks of it unless I am reading it wrong which I very well could be as the error looks weird on my device
yeah it can, but by the looks of it its expecting some kind of url thing
url search params, query params, record<string,string> looks like it
Well he can pass in an object but the key and values MUST be strings
I might be reading the error wrong but I think all he needs to do is not set client_id and client_secret to be of type string | boolean and just be string
~ just seen the trailer/gameplay footage for the new harry potter game 'hogwarts legacy'. ngl, kinda hype for that! I didnt even know they were making such a game! π
One message removed from a suspended account.
One message removed from a suspended account.
Stop, don't do it
they are developing it rn...
I fixed this error
Didn't u learn from the past hypes?
tbh, I wish I did. lol
I was fortunate to avoid the cyperpunk hype, but that seemed like a rough one if you got caught in it
The only game that survived the hype recently was elden ring
also escaped the ff7 remake hype lol
Every other hyped game failed miserably
yea that seems to be holding up ~ not played it myself, but my young brother loves it
It's an open world dark souls
i quite enjoyed legends arceus, until there was no story left lol π
have you need the footage for the new hp game though? it looks really nice. if it can do half of what they boast well, it should be a good game
The only games I'm hyping but with a layer of guarantee are ksp 2 and poe 2
but ofc, they can ruin it just as easily
elder ring sounded interesting but was too expensive for me at the time
Br?
I mean, I thought u were cuz elden's price here is awfully expensive
It was 60$ when it first hit the steam market idk what it is now
Now imagine here where our currency is $5 per R$
That's like 1/5 base salary
did u buy elden ring?
why not pirate 
Where home gas is R$100, gasoline hitting $4/l
Everything heavily taxed
Our president doing coin devaluation speedrun any%
i live in the uk - here they tax our tax π
Nope, gotta wait for discount
I only condone pirating when the game is good but not good enough to make you wanna pay for it
fair
sems fair
Fallout 3 is good
I pirated those two just to see what it was like
it was pain
I didn't like the mechanics they had
Pirating is only okay from big corporations on overpriced shit
Like any ea game
Correct
So almost every game out there?
Ima pirate among us /s
a lot but not all
last ea game i pirated was some need for speed game, it was not worth pirating nvm buying π
Among us is ok to pirate
og most wanted was nice
I miss times when you bought the game and received the whole game
tbh, yea. companies are way too happy to ship barely coded proof of concepts to customers and call it a beta
But damn fuck lootboxes and ingame purchases
I like games where they give you the full game but make addons to make it a bit more fun
I like what poe did
Everything is only obtainable ingame
Micros are only cosmetic
And u can't buy any kind of advantage
Didn't microsoft recently acquire Bethesda?
best that way
Nor trade skins for items
Plus they give skins if u hit certain achievements during challenge leagues
ye microsoft did acquire bethesda
welp say good bye to any good games π
I wonder what a game from elon musk would look like
Very development
lmao
I am unsure if the game is breaking or if that is meantt to be a thunder storm
Can we all agree subnatica is a good game tho?
It takes the fear of the sea with open world + a damn good plot
π π΅ smile and wave
That's the game saying "fuck I'm out"
i tried noita but didnt really got into it
Context: I shot 18 nukes at the same time
lmao
Once u learn wand building it gets really interesting
It's almost like coding, but with spells
Wine
mac catalina also cant use wine
so I am good with just not playing games for now as I don't even have any games I wanna play anyway
If I can get roblox to work on linux i'd be happy
there is this one game on roblox I play sometimes when im bored
There's also proton
tf is proton
i pirate crossover cus its 20 dollhair and im broke
you mean that steam play stuff?
Steam proton
Weird
Something bout DirectX 11 not being installed
Did ya install dx11?
Idfk how
f
play roblox then
Didn't save recovery keys?
I did but misplaced them sadly
Tf
I can't get roblox to work on linux I am too dumb to setup the way how
this i swhy you keep multiple copies
Make a private repo and store them there
buggy
wine is always buggy
yes
never heard of crossover
60$ what a rip off
i pirate 
nice
why even use crossover for mac
easier aswell
a lot of games support mac now a days
catalina
sucks ass
most app dont have 64 bit, while catalina only support 64bit now
like i dont want to use my other laptop just for a simple editing task
I almost asked what is catalina but forgot apple likes to name their os versions weird shit
yea
Well idek where I would pirate crossover if I wanted to so π€·ββοΈ
i dont even know if it runs well on linux, try the trial version ig
I would but I gotta give em info I don't want to give
Yes
same problem as wine?
I could really just swap back to windows there is no practical reason for me tot use linux
I just find linux nicer
yea
i use crossover cuz my windows laptop loads hella fkin slow, like i might die first before opening the app
Should I swap back to windows π€
mabe
I think I might
then u should
Where does windows store ssh keys?
does Windows even have a built in ssh client
I think it has one built in ye
it do
it do
never knew that
It uses openssh iirc
is there any point in ssh to windows
Wdym?
what can you do in the windows command prompt
I mean dont you need it to ssh into other things?
Yeah WinRS/WinRM
Hello everyone
opensheesh
Itβs usually being used in subnets only but editing a firewall rule and adding the remote system to the trusted host list allows you external access to the remote command prompt which actually is full access.
bruh you are a likely scammer go away
Hello, so i want to make a error_handler file that handles the error that are not handled by local error handlers. ||so many handle|| Like i have a command called do_the_thing and it has a local error_handler to handle an error specific to that command. And i have a error handler file that handles more generic errors that may cause during the command execution. But the thing is i want global error_handler to only run for those error that are not handled by local handler.
For example error A is specific to do_the_thing command so its handled by its local handler. But DisabledCommand error is also possible. So i want if error A is raised, its handled only by local handler and if DisabledCommand error is raised then its handled by global error_handler.
Ik there is a way to check if local handler if present then don't executed the global handler but thats not what i want, cz then it will then don't handle the unhandled exceptions by the local_handler.
Here in the cry command, if any argument is missing then i want to send an embed explaining about the error. This explanation is different for each command. But there are some errors like DisabledCommand, NotOnwer that i want to be handled by the global handler cz adding those to every local handler feels odd.
Guys guys how do I check if a category exists in discord js ?
well
hm?
I've been looking right now, and I haven't found anything about it.
Yeah lmao
Google has about channels
wait a sec
Oki
var category = message.guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").get("<category_id>")
if(!category) return console.log("category does not exist");
console.log("category exists")```
I think it works, I haven't tested it, and I won't test it   π
Hm I think in type we only use category
Nvm I will try both
Oh um
Nvm
Did not work ooff
Β―_(γ)_/Β―
console.log the category
if(!category.size){ return console.log("oof") }
?????
I didn't see a difference
I always did this
I don't trust Boolean with JavaScript
it might return true to anything
browser compatibility

Could someone help me with this and explain what's wrong please? New to Py and trynna do a project for my uni
I am trying to install pystan pip intsall pystan and I am facing this error
install cython first
every single time something appears here you need to install it first
true
idk if there's an automatic way, but may odin save you should you need to install a lib with many dependencies
wait i thought pystan is for linux and macos
Ookay that makes sense. Yeah my bad I should have guessed it, was self explanatory π
One message removed from a suspended account.
How can I stop a map?? I thought it work if I just return if true but the map keeps still going.
in JS*
can you send context and the code for it?
reload website mostly
do i need to sign out?
perms.map(perm => {
if (getUserPermission & parseInt(perm)) {
return setValid(true)
}
})
But if it's true (it is at some point!) it keeps going and at the end its false...
you mapped to void
that means?
the predicate function didn't return anything
how to fix it then?
consider using a loop for this instead
aight
how many times do i reload?
yeah
ah bitwise?
yes
you use AND?
exactly
yes it works now! Thanks alot <3
yw :)
array methods (such as map filter forEach reduce) can only be canceled by throwing an error inside them
hello! does anyone know why my for loop doesnt change the original array?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
please, send the whole thing
blue = data.players.blue.sort((a, b) => a.party_id.localeCompare(b.party_id));
for (let i = 0; i < blue.length; i++) {
player = blue[i];
party = seenParties.find((a) => a.party_id == player.party_id);
if (party != undefined) {
player = { username: `${player.name}${player.tag}`, party: seenParties.indexOf(party) };
oldplayer = blue[i - 1];
oldplayer = { username: `${oldplayer.username}`, party: seenParties.indexOf(party) };
} else {
seenParties.push({ party_id: player.party_id });
player = { username: `${player.name}${player.tag}` };
}
console.log(player);
}
console.log(blue[0]);
man lemme format that because reasons
Hey goys
Doing this here, is it legit?
const message = JSON.parse(d.config.welcome.message);
message.split("{user.username}", member.username)```
blue = data.players.blue.sort((a, b) => a.party_id.localeCompare(b.party_id));
for (let i = 0; i < blue.length; i++) {
player = blue[i];
party = seenParties.find((a) => a.party_id === player.party_id);
if (party) {
player = {
username: `${player.name}${player.tag}`,
party: seenParties.indexOf(party)
};
oldplayer = blue[i - 1];
oldplayer = {
username: `${oldplayer.username}`,
party: seenParties.indexOf(party)
};
} else {
seenParties.push({
party_id: player.party_id
});
player = {
username: `${player.name}${player.tag}`
};
}
console.log(player);
}
console.log(blue[0]);
way better
One message removed from a suspended account.
ok so, I don't see you updating the array anywhere
array contains objects
shouldnt it be a reference?
thanks
not really the way you think
this isn't "valid" in the way you expect
when u do that ur just replacing the variable
One message removed from a suspended account.
you didn't reassign to array
i mean @carmine summit
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
blue[i - 1] = ...
One message removed from a suspended account.
One message removed from a suspended account.
kekw, she mentioned mine cuz I reformatted it
i'm ytounger than you
One message removed from a suspended account.
One message removed from a suspended account.
is there any reason it copied instead of referencing?
because arrays are...well...arrays
you tryna modify the array or what
by changing one variable you don't change the whole codebase
One message removed from a suspended account.
yeah im tryna modify the array
One message removed from a suspended account.
it's like doing ```js
let a = 50
let b = a
b = 20
console.log(a) // will output 50 not 20
then
blue[i - 1] = {
username: `${oldplayer.username}`,
party: seenParties.indexOf(party)
};
ok.......
grats
One message removed from a suspended account.
One message removed from a suspended account.
arrays hold references, but (ik this is a thing in C++ tho) you can't replace the reference with a new reference
that's something to be done with pointers
One message removed from a suspended account.
ππ
final code, with optimisations
blue = data.players.blue.sort((a, b) => a.party_id.localeCompare(b.party_id));
for (let i = 0; i < blue.length; i++) {
const { party_id, name, tag } = blue[i];
party = seenParties.find((a) => a.party_id === player.party_id);
if (party) {
const party_index = seenParties.indexOf(party);
player = {
username: `${name}${tag}`,
party: party_index
};
blue[i - 1] = {
username: `${blue[i - 1].username}`,
party: party_index
};
} else {
seenParties.push({
party_id,
});
player = {
username: `${name}${tag}`
};
}
console.log(player);
}
console.log(blue[0]);
@carmine summit
bro tip: use and abuse formatting, longer (as in, more tabs and newlines) code won't make it slower
source code is for humans to read, computer will see only bytes anyway
Better to use findIndex instead of find first and then indexOf
Anyways anyone knows why this doesn't work:
readline.cursorTo(process.stdout, 0, -lines, () => {
readline.clearLine(process.stdout, 1, () => {
res();
});
It's supposed to clear the last lines lines but it's not doing anything
do you have autocommit?
Call rl.commit() to see the effect of this method, unless autoCommit: true was passed to the constructor.
I haven't passed it, no
but what constructor is it talking about π€
oh that's for the promise API only
and I'm not using it cause it's experimental
ah
hi can someone help me to use the top.gg api for a "premium" command im trying to make
in discord.py
Lol
Imagine if you send your phone to a repair service, tell them explicitly only to change to display and when issue occurs, contact me.
With some notes, the private and business data on that phone is fucking important - why I can't send an unlock code tho - which isn't needed to replace a screen.
And the stupid repair service happily annouces your phone is on it's way back to you...
You open the box and see the note, "Your phone got replaced and your new phone get successfully tested"
And imagine the service provider tells you, "We're sorry but it's how it is, now - your data is gone, your old phone got reset already"
Well it's not, it's not really an issue to replace parts, at least in older phones, which is one I have
It's because it's easier to automate and manage
For the company
They don't give a shit about you or your data
Dude you don't seem to get the issue, the old phone got reset
It got reset to get repaired and/or use the parts in other phone
It's literally a contract we made and the provider agreed to my conditions
That's just breaking the law, not more or less
I do... but that's just an ongoing process which can take years in my country
ffs
I could cry...

well at least Samsung tells you to backup your data before sending it to repair
I haven't send the phone to a manufacture
But to a repair service station which means we actually had a contract about what to do and what not
I wasn't able to backup some data encrypted in specific apps due an app issue
ff
most phones are impossible to backup with a broken screen
because they require you to unlock it to allow usb connections for example
and sometimes you cant unlock it if screen doesnt work
nah that wasn't the issue
The app had an internal issue
The encrypted data in the app can only be transfered to a different phone directly, not through clouds etc.
And it was literally 22GB of data
dafuq kind of app is that lol
a specific app respecting privacy and important data to not be shared anywhere
I mean I've got a 2nd phone here laying around and whenever and issue happens with phone nr. 1 I always transfer the current data
didn't really have an issue the last 10y or more I can think of
phones don't actually die instant if you don't drop them from floor 15 to the ground
man lost 22GB of porn
true pain
Anyone on this? ^
that's so annoyint
ok so I kinda like the way C is structured
I feel like itβs a lot easier to pass data around for certain things (in this case chunks of opcodes) and see the flow
(Donβt judge replit, I took the screenshot from my phone and I only use it so I could work on it everywhere)
Although C seems to let you get away with things that you probably shouldnβt be allowed to get away with, and only gives a warning for it
Looks like standard C-like syntax to me Β―_(γ)_/Β―
I meant more or less passing the Chunk to the functions instead of instantiating it like a traditional object and using accessor/mutator methods on it
Something about it just feels kinda nice
But itβs more standard when you donβt have the option to use OOP
In most languages that have the ability to do OOP, I choose that
Iβm not really used to writing functional
But I kinda like it
I fixed the issue by using moveCursor instead of the other method but now it's really buggy
A cool project idea generator that gives you cool project ideas
write a complete Rust compiler faster than the current one
This is a very small but cool project to do @ancient nova
I meaannnnn
I could but I think that's way too much work lol
Nah itβs probably like 10 lines of code tbh
for an entire compiler?
An entire rust compiler
whaaat
:troll:
Thatβs not even the compiler, thatβs just the grammar
Create your own programming language
Itβll require quite a bit of research depending on how complex you want to make it but I would highly recommend it
It can be either really easy or really hard deoending on how far you want to go with it
interpreted language? Pretty easy
interpreted language + JIT? Yeah this is hard.
compiled? Even harder
https://craftinginterpreters.com
This is an amazing resource for creating either a real time interpreter in Java or a bytecode compiler in C
And if you want to delve really deep into the concept, the Dragon Book is a classic resource for doing so
Make a lisp 
ew :c
Is there a way to sync permissions with the parent category when using https://discord.com/developers/docs/resources/guild#create-guild-channel ? I am passing the permissions overwrite for the user permissions I want applied which is working but the permissions are not synced with the parent.
Essentially doing exactly what the Sync Now button does. https://chicksgold.gyazo.com/9a3fb6b60a8fd29d8e654a5d5c289100 but with the API request , or a subsequent one if needed.
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
I'm guessing based on https://discord.com/developers/docs/topics/permissions#permission-syncing it's not something you can do programmatically but rather it's just an indicator to reflect if they are the same or not.
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Has someone made a tool that registers and updates slash commands in bulk? I have a json file for each slash command grouping. Whenever I make a change to the json files I manually do a GET of my commands to find the current ID for that command. Then I do a PATCH to that command with the new json for that command. I'm thinking about building a tool that will read all my json files and synchronize them with discord using the above method. Has someone already made this?
Sounds like that would be heavy towards rate limit buckets if you have to restart multiple times
Also, that code could run on each shard/cluster which can overlap
I just have a REPL function that PUTs all of the commands
I'm thinking about making it part of the pipeline so it only happens when i release a new change. maybe i can do a fancy diff to make sure there is a change
just create a new command with the same name
It updates automatically, no need to get id stuff
https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
you talking about this?
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Possible to edit a response to an interaction?
yes
doesn't this take around 2 hours to update? the patch way is immediate
Do you need it to be instant?
if i update my code to expect a new value and it takes 2 hours for discord to update then my bot is broken for two hours
thats what i like about it
sometimes there are some things you need to do that you cant do in higher level languages like c++
Tough I guess
Like what
i was afraid you'd ask that
i dont have an example rn
but i ran into that situation once
i had to use hacky c++ syntax to be able to do something where the alternative was worse performance
such as transforming pointers multiple times in a line so the language still compiles
I think you should ask yourself if you should do something like this in the first place
99% of times you don't
i'll try find it tho
i dont usually run into situations like this
i think it was with templates
ah i found it
the alternative was another similar class but i got lazy
basically theres a template which takes in either primitive types or pointers
if its a pointer, do something special with it
I see
but templating doesnt really discriminate
you could use a std::variant
you could write an implementation for a type-safe union yourself then
yeah i could
i'll add that to my list
Though there's always a little memory overhead when using those. Depends on the types stored in it really
But if it's only primitive and pointers then it should be minimal
Like setting and retrieving the value? I wouldn't worry about that
i worry about that kind of stuff especially if it can be called many times in a single second
yeah function calls are very optimized and have virtually no overhead but still something to think about
it all adds up
though i can imagine that is something you can inline easily
not if they're inlined and the compiler is more likely to inline them if they're short + get called a ton
yeah
can i just vent something
i hate looking up support for problems with windows on google
ye
you either get people who dont know what they're talking about offering help and/or get directed to a massive article that might as well be its own book
have you tried installing linux
^ much easier than fixing windows
or mac if you're rich
and on my laptop i need windows because of various features + office
the surface pro was kinda designed to run on windows
so features such as infrared face ID probably wont work
not as important but an example
yes and touch id + touch bar on my machine won't work if I install any linux distro
kind of a known price you pay for running other os's
drivers not being standardized really sucks
don't ever look at unicode table
why am i getting this error when connecting with topggpy?
File "main.py", line 3, in <module>
from helpers import constants, embeds, helper
File "/home/runner/scare151/helpers/embeds.py", line 1, in <module>
import discord, time, datetime, main
File "/home/runner/scare151/main.py", line 28, in <module>
client.topgg_webhook.run(4355)
File "/home/runner/scare151/venv/lib/python3.8/site-packages/topgg/webhook.py", line 161, in run
return self.bot.loop.create_task(self._run(port))
File "/home/runner/scare151/discord/client.py", line 110, in __getattr__
raise AttributeError(msg)
AttributeError: loop attribute cannot be accessed in non-async contexts. Consider using either an asynchronous main function and passing it to asyncio.run or using asynchronous initialisation hooks such as Client.setup_hook```
code?
client = commands.Bot(intents=discord.Intents.all(), help_command = None, command_prefix = get_prefix, case_insensitive = True)
topgg.DBLClient(token=os.environ.get("DBL_TOKEN"), bot=client).set_data(client)
async def load_cogs(cogs):
for cog in cogs.items():
await client.load_extension(cog[1])
@client.event
async def on_dbl_vote(data):
user = await client.get_user(data['user'])
embed = discord.Embed(color=color.color, description=f"new vote from **{user}**")
send_to_webhook(embed, ping=False, webhook_url=os.getenv('VOTE_LOG_WEBHOOK'))
try:
await user.send('thanks for voting for **scare**, you recived `25,000 π΅`')
mongo.update_coins(user.id, mongo.get_bal(user.id) + 25000)
except:
pass```
I'm using discord-rpc to try and connect to a local device with rpc, but it keeps giving an error: connection closed. Any ideas? I tried bot of these:
const rpc = require('discord-rpc');
// I tried this
const client = new rpc.client({transport:'ipc'});
// And I tried this
const client = new rpc.client({transport:'websocket'});
``` Any ideas?
speaking of rpc...
I'm trying to pick a license for my rpc app project so i can upload/release it
but idk which license i should pick π¦
which license would be: do what you want except sell the software, and keep original copyright notice and attribution in tact?
~ ended up just adding a 'dont sell' clause to the bsd 3 clause license π
can you even call it bsd by including that?
i dont have to call it anything, its the license. now, weather it would stand up in court is another story. idk, im not the best with license type things π
you can just roll your own if you want
but it may not be as legally binding as you hoped
yeah, rolling / including your own clause in there was the best option
given there's no oss license that actually prohibits commercial use
at least commonly used
yea lol. like, im more than happy for someone to download the code, edit, use it, whatever, ilearn from it idk, just dont try sell it as your own app π
then again, I've seen people flat out alter their licenses to exclude certain individuals/companies from using their software
imo a lot of people assume open source = free to use commercially
lmao yea, i have heard of such. specifically large companies freeloading from open source community ran projects
the one I have in mind included microsoft
later that day or a few days later someone from microsoft actually pulls up an issue on the repo since they use it
lmao nice
didn't microsoft edit someone's copyright out of their code lol
the only change in a pull request
how can i make my node-fetch requests faster?
Use https://undici.nodejs.org instead 
A HTTP/1.1 client, written from scratch for Node.js.
alright thank you ill try it
and ill let you know
What an unlucky name they did choose
https://sourceb.in/y5LUONSDpO little need help, why it keeps creating new data instead of pushing it to the exisiting array? Aaaaand its not returning when role.id detected?
I'm bored. whats folks upto? π
crying over university tuition
want some help? I can hold the tissues! π
sniffs
AMONG US
never tried that game π
i did however code a js lighting system exactly like the one they use π
halp
if(!data == β¦)
Try to think of what that would mean
As long as data exists and isnβt 0 youβre always creating a new array
See line 10
Could try === if they correct
Really depends what data is meant for
But the ! Indicates itβs bool
So false data == item literal
Idk
Gl
its not bool
if(!data == `${item.id}`)
This line doesn't make a lot of sense to me.
The ! Confusing
His database result
Yea itβs weird to me too
if(data !== `${item.id}`)
^
ill clean it up a tad just because idk ur code 100%
Doesnβt make sense regarding his message
If his database result == his item that message would make sense
Should check if data has val && same
===
Respect his message
ah i see now.
!== doesnβt make any sense regarding that message
ya i see his return msg
uhh
Yea I agree he saying if they same already have
So I also agree here too
Each time data exists, it creates a whole new array each time.
^
data.items needs to be above the code if you don't want it to be always empty atleast in the beginning of the code
Probably wanna declare above thatβs good assessment too not in loop
Been min since use JS the arrays dynamic right ?
economy.findOne({
guildID: message.guild.id,
items: {
item: item
}
}, async(err, data) => {
if(data && data === `${item.id}`) {
return message.reply("This item already exists!")
}
if(data) {
data.items = []
data.items.push()
data.save()
} else {
new economy({
guildID: message.guild.id,
items: {
item: item,
itemName: itemName,
itemPrice: itemPrice,
itemDescription: itemDescription
}
}).save()
}
})
best that I can do since idk how ur code works 100%
Was about to cough
Beautiful
since you return in your first check you don't need to do an else if
it'll just ignore the rest of the code below it if it gets that check and is true
data.items = []``` why this line is outside of ```async(err, data)```?
im confused
bec each time it runs that line of code...
it'll set that array to be empty each time
wasn't that another question you had
why it keeps creating new data instead of pushing it to the exisiting array?
wait
It canβt be outsite
It reinstates array each time enter the if
Itβs part of the callback
And the parameter data being defined inside
Pass it in?
ye
Why do you even fetch items and push an empty array into the database?
it will always be that way it's set up
Not pushing anything
Also because it's kinda triggering me, I went ahead and changed his first return msg
pat pat
Iβve been workin in c++ all day
I donβt know why Iβm still here
π€£
lol
uhh
Is it necessary for you the database contains an empty array when no items exist?
nope
Ok and when fetching any guild from your database, data contains a property items (if it exists)?
data.items
Means your first check should be if(!data) return new economy(β¦);
Second statement would be a check if that item already exists in that guild
im listening
if(data.items && data.items.includes(item.id)) return reply(item exists already);
this means to avoid creating new array?
Thatβs it
Didnβt you say you donβt need an empty array if the guild has no items?
yep
im avoiding confusion so yea
If you do need it why not creating the array when adding the record into the database?
i see i see
new economy creates a new record in your database when that guild doesnβt exist already
When creating that new record for the guild then push an empty array to the database
ohhh okok thanks!
Wouldnβt make sense to add a new record to the database for the guild without any data
I mean even an empty array is data
so i dont need to add this js data.items = [] to push an array?
what you just said is the complete opposite of this. If u were to add that, you are creating a new array
...
You donβt wanna push a empty array to the database
This is correct
okok thanks
It does if you do consistently rely on the same structure expecting an array
Maybe I miss understood ur response
But Im not helpful with that sort of database anyways
Maybe safer to check if data present and not empty
Better practices if need to do
Expecting and getting not always the case
Can see what saying tho
it works
but the thing is, this code if(data.items && data.items.includes(item.id)) { return message.reply("This item already exist!") } didnt response
Hrm
At the moment he checks if a document for this guild already exists in his database, which isnβt the case, heβs creating a new document with the guild ID and the items structure
Thatβs the moment he needs to push an empty array to items when later expecting in his code items always is an array
Maybe we mess it up with checking data.items &&
First check in the if conditional should be one that errors out if has no value
Not read after &&
So if data not empty
&&
They the same
Then run if brackets
Itβs not required to repeat anything 10x times, he really needs to read answers carefully
Also do us a favor please and log data so we can see itβs exact structure
Dunno that database type, so wildly guessing around is just⦠eww
Im new here but saw the discussion
I was excited to try to help xD probably added to confusion
whats good folks π
lol, is it that bad? π
oh yea, i seen that code earlier and just nawwd tf outta here π
i couldnt even begin to describe the things that confuzed me about it π
Need to .get from object??
Thatβs for maps
what is this mongoose code actually trying to do?
We could be respectful here I think
π
This time with ping
if(data.items && data.items.length && data.items.find((i) => i.item === item.id.toString())) return exists already
π
i wrote this alr but shuffled some stuff xd
thanks for fixing it
lmaoo
and its working 100% now
thanks!
can you show your schema object for your economy object please
Shower good way to decompress when stuck
English very gooood today
yep fake literally say it all
wait what its only 2 items
const ShopSchema = new mongoose.Schema({
guildID: { type: String },
items: { type: Array, default: [] }
})```
My gosh if you would have shared this 30 mins ago
data.items will always exist and be an array, you dont need to check that, or its length in your if statement
you should make guildID both required: true, unique: true
Yea thatβs my bad I didnβt know what was passing for data
I default to check val before comparing
@bright hornet here is some item type code mongoose/mongodb objects that may be useful to you.
Thatβs what I meant with consistency regarding expecting what type of this var is
i'd recommend learning from it, not trying to copy paste it (the code there i mean)
Oooo hasItem()
Is some actually faster than find here?
honestly havent checked performance on that, probably should π
Makes sense tho if you use two different methods to perform the same action
potentially different return value though
Whereβs Tim
i c him type!
pretty sure there is no performance difference, only different return value
π
we summoned the almighty!
sounds about right π
i bet he woke from his slumber ~ his benchmarking sense a tingling ~ just to tell us there was no difference π
I should probably eat π¬
Thanks for the learning
skipped dinner to work on getting my app out lol
Nice to meet yβall briefly
you too! π
Need food Yus go eat
is this kind of an rpg?
the code is a snippet from an rpg like discord bot π
i remember when
i see, i only doing casino sooo
not gonna expand more
Pretty sure meant that as saying if take a look at the functions maybe good idea to make some so donβt have to figure out the if conditionals repeatedly
hey, is there an guide or an example for creating a command which requires a user to vote in-order to use it?
I am using discord.js v13
||simple explanation i think||
if you have a database you can store bot related user information along with if they have voted and check for if they have voted when they want to use a restricted command
how can i store if a user has voted or not? is there a snippet that we can see?
i dont know how the top.gg voting system works but i believe theres packages and explanations there
Can someone look at this? https://sourceb.in/YxeYhzhcks the bot not responding to the command
i bet the exist does not actually returning the user ID
it returns something like this {guildID, userID} depend on how you make the schema
exist != userID && member != memberID``` just like this?
wait
ew java
how to add a text to the middle of this image in html
Image
i want the home thingy to come down
you could use margin-top, or even position-y
wuts the code?
in ur css
.home-thingy-class {
margin-top: 20px;
}
(this makes the margin at the top bigger)
or:
.home-thingy-class {
position-y: 50px;
}
(i dont remember if this is in pixels, check on the internet, this brings down at the position specified)
I tried that too, but that gave the same error. What could cause that?
please do not use 'uwu' in your error response. π
uwu
morning tim π
i finally released my rpc app yesterday ~ if your seeking some code to critique, it'd be appreciated π
fair enough π
I'm happy I can actually get back to creating my bot. stupid app was such a distraction, but I really needed the ability to poll a url so I can set the activity details to be the number of players/servers my bot is in π
needed π
Using the wrong application ID? It doesnβt just magically work
oh, that dude is still struggling with rpc? use my app π
I fixed it, I left the config.id string empty :/ Only it has been working several hours, but now I get an unfixable error: could not connect. I tried everything but it just doesn't work.
And you need to be running the code on the same machine you have discord open on
and you cant be invisible/offline, and need to enable activity status in user settings on discord
Yes I have.
I do.
From what Iβve seen, you havenβt sent pretty much any code or any errors, so everything Iβm saying is speculation
It was working perfectly, until it just randomly stopped gave an error and never worked again.
I could send code.
were you logging in a bunch?
Then do
Or switching statuses a bunch ^
Yeah I was testing and often running it again, ratelimits?
rpc will time you out if you login too squickly too many times
Probaly, how long will they last?
at least a few minutes if you open like 3 times within 30 seconds
And wouldn't it give an error specifying ratelimits?
Oh, it gives a could not connect error. Also, it does the same for my vsc RPC extension (from crawl).
Again, no code, just speculation
maybe your app id got temp banned or something?
i'd make a new app and be more cautious with the connections π
Can't be the app id, cause the error occurs with the extension too, wich should be a different app.
dunno, maybe the discord application itself has imposed connection restrictions
rather than like, the application id having a restriction
(It would be useful to see some code!)
π
Sorry, almost forgot that.
Console: ```PS C:\Users\Luckie\Desktop\presence\sb> node .\index.js
Client is ready.
C:\Users\Luckie\Desktop\presence\sb\node_modules\discord-rpc\src\transports\ipc.js:32
reject(new Error('Could not connect'));
^
Error: Could not connect
at Socket.onerror (C:\Users\Luckie\Desktop\presence\sb\node_modules\discord-rpc\src\transports\ipc.js:32:16)
at Object.onceWrapper (node:events:514:26)
at Socket.emit (node:events:394:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)Code:js
// start.js
const RPC = require('discord-rpc');
const config = require('../config.json');
module.exports = {
start: async function () {
const client = await new RPC.Client({ transport: 'ipc' });
await client.login({ clientId: config.id });
return client;
}
const Discord = require('discord.js');
const rpc = "./presence/";
let rpcClient;
const songjs = require(rpc + "song.js");
const startjs = require(rpc + "start.js");
//login stuff and client ready event
client.on("messageCreate", async message => {
if(!rpcClient) {
rpcClient = startjs.start();
}
//other irrelevant code
});```
Uh... what on earth
?
Iβve never used RPC for anything other than status, not sure why youβd have an entire messageCreate event on it
beautiful π
It's for an input, irrelevant.
Is that sarcastic?
Itβs relevant if itβs related to your RPC
But this is everything for the connection.
Thereβs several questions I have
1, await does nothing on a constructor, so why are you using it?
^ this
A constructor can never be a promise
Though it would be interesting to see
Although Iβm sure thereβs several reasons for that not being a thing
I mean, iirc await has something to do with promises?
Yeah, so that's what I meant.
I donβt see how that still means anything when youβre calling a ctor though
Alright, but can we stick to the problem?
Alright.
Ok, I don't really see anything wrong with your code, but try putting a .catch() on your client.login() so you can log the error if one occurs
Alright.
Tested it, gave the exact same error :/
I'm thinking that you're either banned by discord for some reason, or your application id is incorrect
Probaly the first, cause the second can't be. Weird that it doesn't notice in any way if so. Would I get unbanned soon?
Wdym "the second can't be"?
Try logging your config.id
it might not be what you think it is
I'll try, but it worked fine before didn't change anything.
Logged it, it's exactly what it should be.
i think the main reason is purely because the constructor has to 'immediately' return the object.
are you trying to change your status quickly?
No.
Well yeah, but there's probably some behind-the-scenes reason for it too
You mean, quickly after the login or quickly change status and again and again?
can you show what you're trying to do with the client after it's connected?
just because it's not directly related doesn't mean it's not useful to the problem
Wait for a message, if the message has the correct input it should be it will update the status.
ok, that doesn't help me
No, but it won't even log in so it's not useful.
Cause the error occurs at the login
okay, so now I have a working API, how would I make something to check how many active programs are opened?
want to make something along the lines of a statistics, to check how many users currently have my program opened
seems like it connects then dies after connecting, it might be related to some sort of invalid api operation you're trying to do
it seems possible in my head but I have no idea how to actually go about this
what's discord rpc?
Well, the only thing I do is what I showed to you, the connection.
I haven't made a bot in ages so idk
and your dev portal application looks like this?
client id is potentially sharable info
yeah, just didn't want to
fair π
No, why should the link be added if I may ask?
don't know, when I was learning how to use rpc that's what I was told needed to be set
But other than that it looks the same/
try setting that, idk
Also I just tried with a different application, same error.
do you have a bot on either of those apps?
Didn't help.
I don't think you can use an application that has a bot
Why would you need to enter an redirection URL in here anyways?
Is this used for OAUTH?
you can π
Yeah, as I said it worked completely fine earlier today.
can you show your code?
Everything? Cause I showed some before.
only the code you'd like help with π
Well, guess that's here.
you havent changed anything from this code?
No.
Well, assuming this is all one file as you have not said otherwise...
you are exporting a module that is never used.
You should define all requirements at the top of your file
You cannot await a constructor. (ie, await new ~ wont work)
You never create a discord.js client, so you cannot listen to its events
There is no need to include '.js' in your require's, it assumes its a js file already.
Theres probably more, but i gotta go out now π
oh nvm you did indicate them as separate files ~ my bad
still though, your not requiring your rpc client file, and then again, you cannot await a constructor.
you can await a constructor but it doesnβt do anything
i mean, ok, it wont kill everything, but it doesnt do anything except confuse people trying to understand how promises/async works π
Sorry but this is 2 different files.
anyway, i actually gotta run π
should I use local database? Is it a good idea to store some basic information in a json file? Or should I use db for everything
You can use localhost mongodb
what's the best option. mongodb or Mysql. I wanted to use local database, sqlite
i am using localhost mongodb
mongodb is easier if you don't know sql
umm, cloud is better or local?
I mean the free version of the mongodb cloud
yeah I need tbh
mongodb free version gives 512MB so you can use mongodb atlas
Or localhost
Β―_(γ)_/Β―
hmm, maybe I'll store cooldowns in the cloud. I'm upto buy this one from namecheap. anyone knows if it's good or not
i buy server from here it is very cheap and good https://clients.advinservers.com/store/high-performance-vps
I want to pay with crypto and found that only namecheap have the best offer so far that accepts crypto
I know this place agrees too

that looks like it's trash for the price you're paying
i agree
I pay nothing per month and I get more storage, bandwidth, and 1gb ram 1 cpu core
i pay 8 dollars per month and i get R9 5900X cpu 8gb ram 120gb ssd vps lol
where?
oracle
everything is going to require a card
except few which accepts crypto 
but yeah, oracle is epic :)
const something = await fetch(website); sometimes get's stuck on certain websites and never returns
how do I fix it?
Starts easier
But quicky becomes a snowball unless you invest time into properly learning it
Never say that again
As someone who use Java everyday, you don't know how twisted oracle business is
yeah so no fix then?
need more context
Can somebody help me``` <p class="card-title" style="font-size: 50px !important;line-height: 15px !important;letter-spacing: -0.06em !important;font-weight: bold !important;" data-target="<%= client.guilds.cache.size %>">0</h1>
Means not all the guilds are cached
how to cache it all
already fixed it
looks like using await actually broke it rather than fixing it for some reason
instead I've added an async delay
it look like this
ignore how massive this is
would also be nice if I could just grab the first 3 results but it's difficult if all of them have the same name
No problem, one sec.
really?
Ah yes
thanks I couldn't figure it out
Lol
So, this is the schema of your JSON object.



