#development
1 messages · Page 1730 of 1
I'm using both eris and discord.js
you don't mean exports then you mean function arguments
ok but you can't
you can't mix two libraries
that's... just wrong.
Well I am
imagine
eris and discord.js aren't compatible
using both eris and discord.js
Well how on earth am I successfully doing it?
;-;
I don't know but it must be a random-ass convergence of stars
mixing two libs is bad
end of conversation
because that's just bad, wrong, don't do it.
Yes. End of conversation. Choose one.
Period
.
haha luca you cant delete my dot post
I'm using discord.js to use embeds, etc.
Ok so use discord.js fully
wtf
You can't send an embed from discord.js into eris and expect this to always work
that's just randomly stupid
And that is precisely the problem you're having right now
const Discord = require('discord.js')
Successfully? If so, then how come you're looking for help, because something is not working. 
Ok so here's the deal though
discord.js and eris both HAVE CHANGED
just because it randomly worked in 2019, doesn't mean it will continue to work
because neither Abal or Hydrabolt have made any effort to make their libraries work together since then or before then
So the fact that it worked? Completely random.
The fact it broke now? probs because of an update
The solution? Choose one.
I am not saying that you're lying
I did not claim it never worked
I'm telling you it stopped working and will probably never work again
and the solution is to stop being an idiot and choose ONE.
But like
That's your problem, now, ain't it?
You chose to make a Frankenstein-esque monster, now deal with it.
Of course, you can stick to using two libs, but then you can be sure, that you will encounter even more issues.
Me reading my bots code ^
same, tbh
lol
It's a rat nest and I love it
Me reading old code to be precise.
node_modules of create-react-app has left the chat
hey evie, i was wondering whether i can use the delete operator to delete the specific element.
it is so thicc it crashed my repl
Nah that's not frankenstein-esque. What would be though, is to try to mix a React app with Vue components and Angular logic, and then go "But it worked and now it doesn't!"
hhhh
Unfortunately not, using delete on an array leaves a null value behind.
you can splice it out
array.splice(index of element, 1)
really though the easiest way to remove an array element is myArray = myArray.filter(e => e === 'my value to remove')
¯_(ツ)_/¯
No because that gives me problems with my link values
as i would only be searching for name
*!==
I'm talking about your link array
Reminds me of when my bot got api banned for some reason
yes, links
there is a trick to make item removal 5x faster, but it only works if your array is unordered
correct, yes.
... an... unordered array?.... ... that sounds like a joke, ngl.
yeah, but names is linked to links (well the length)
at least you know the reason
unordered as in the user not caring about the order
wait so your name is linked to your URL???
Tbh I dont, I sent some emails and it was unbanned when I went to restart it some hours later
not really, i just put them in the same array.length
that doesn't make sense
as you have to add a link + name to save
ok
well time to go write some code for me lib
¯_(ツ)_/¯
I should be working on my damned Juhachiban project too tbh
I wrote one line today.
I'm here helping noobs instead because I'm obsessed
you should contribute to this:
https://npm.im/jason.db
lmao
smh
One message removed from a suspended account.
help me with writing 1000 typedefs because discord api uses too many
i feel you
so if i have 3 links set, my array.length = 2. Can i do this then: array.splice(2, 1)
haha oaky.
woah auntie stop with the caps
no, please continue with the caps :^)
One message removed from a suspended account.
good luck
const links = [
{
name: 'google',
url: 'https://www.google.com',
}, {
name: 'yahoo',
url: 'https://www.yahoo.com',
}
];
Here @eternal osprey this is what you need to do
This Is The Way ™
this is the way
One message removed from a suspended account.
One message removed from a suspended account.
framework for djs
ah yes the air here is made out of air
mhm yeah i get that
One message removed from a suspended account.
just need to find a way on how to get to that way
... well ... not to be a condescending cunt but the answer to that is : with code

Since I've only seen the data I Can't tell you what code you need
but definitely, the structure you need is that one above
To be perfectly fair though
the actual answer is
STOP USING JSON
is there a way to use my Snowflake typedef without having to import it from the module in every file
Well clearly command.name is undefined
"converting"?
changing format
well it seems like you're trying to read Y/d/m
but...
uhm...
2021-03-19
that's... not slashes, those are dashes.
not the same character 😉
directory structure btw:
src/
typedefs/
Snowflake.ts
structures/
other stuff
other stuff
i want to use the snowflake typedef in all those without importing it from a long path everytime
I don't think you can without importing
wt
but don't worry importing is cached so it doesn't affect your performance.
DRY - Dont repeat yourself
yeah I understand the concept, but either you repeatedly send that structure throug function arguments, or repeatedly import it where you need it
both ways are correct
but importing is cleaner
k
DRY isn't a universal global rule that means "never ever have the same code". It means don't re-do the same code more than once, re-use it instead. and that's what imports are
and also what functions and loops do, too 😛
okie
for (const file of commands) {
const command = require(`./commands/${dirs}/${file}`);
console.log(`✔️ Ready ${file}`);
client.commands.set(command.name.toLowerCase(), command);
};```
toLowerCase is undefined why
command.name is undefined
you forgot to export .name in one command
which command
how would i know

[PostgreSQL] Is it possible to create a table where a column references another table? For example, I have a users table and want the avatar column to point to a row from the images table (which could have information like the id, url, dominant color, and description).
You can look up how foreign keys are used, pretty sure that's what you're looking for
how do you loop over an object
for..in or Object.keys/values/entries
I recommend you use one of the Object methods since for in will also factor in the prototype (which can be manipulated)
im using it to assign properties in my constructor
constructor(info: {
content: string,
options: OptionList | null
user: User,
channel: GuildChannel | DMChannel,
member?: Member,
guild?: Guild,
}) {
for (let k in info) {
this[k] = info[k];
}
}
What about Object.assign
but there are probably better ways of assigning properties given the props are static
how about for k of Object.keys()
in the above case, you can simply use Object.assign
but yes, for of Object.keys() also works
how
Object.assign(target, source)
for example
a = {};
Object.assign(a, {f:10})
console.log(a) // {f:10}
ok
but how would i explain typescript that the property is already assigned in the constructor
you can do Object.assign(this, info), which will copy all poperties of info into this
for typescript you prpbably need to give your class an interface that has the properties already
?
In what lang?
Cannot find module '../build/Release/canvas.node'
i've typed npm i canvas for a trazillion times by now
npm i canvas returns me:
function s(e,l){
g=e.length%2==0?g=e.length/2:e.length/2,
h=l.length%2==0?h=l.length/2:l.length/2,
x=e.slice(0,g),y=l.slice(h,l.length),
console.log(x+y)}
s(process.argv[2],process.argv[3]);```
possible to make this script shorter or not?
assign process to variable p, remove any extra whitespace you can
declare global {
...
}
more letters so..
probably some challenge
anyone that please can help me with this
still at this issue for 2 hours already
uhhm
follow the instructions at the url
okay i am trying
so should i remove my current vs and download the 2k17 one?
wait why do i even need vs for vsc to work?
it doesn't make sense to me
its a Build Tool
I have a function I created for my bot called endGame() which takes the parameters of the database then deletes the database table so that the next game can continue, for some reason, when I sent ended = true after doing this and run my later statement if(!ended) board.save() to save the db if the game was not ended I am getting a error telling me that it can't save a deleted board
on linux its g++ and the other you need, its needed for compiling some binaries
so which one should i install
looks like mongodb right?.
did you fetch the dataset again after it got deleted?
not this this is Visual Studio not the stuff you need
No @lusty quest
yeah the link told me to do that
are you sure?
https://www.npmjs.com/package/windows-build-tools look into this
yea you delete the document and then still reference to save it
you told me that you delete the Document when the Round ends right?
after this you run the if(!ended) stuff
well ended is true, and you try to save a non existing document
koding
you delete the Document inside the Board collection at some point when the round ends right? before the if (!ended) statement
yes

if(!ended)
means if ended = false
ended is false unless I set it to true after ending game right there
something executes and try to save it, but it cant save it bcs the document is already deleted.
trying to install using: npm i windows-build-tools gave me the exact same issue
how i check a account if he alt
he crated before 100 days
did you deleted the node_modules folder and rebuilded the modules?
oowh no
?
would help if we would know what language/ api wrapper you use
You're at most inferring.
what you say
Do you want to check if the account was created before 100 days? What library are you using?
I already checked
the user created 100 days ago
delete the folder and run npm i (this usually helps more than npm rebuild)
still got the same error
we cant help you if we dont know what lib / language you use
are you sure?
yeah definitely sure
Then what are you asking for?
Do you think he is ALT?
Who though?
english
The person who's account is under 100 days old?
PROGRAMMING LANGUAGE ffs
its 101
omg i still get the same shitty error
It's hard to interpret what you're saying, but assuming you're talking about the user's account age, I would use it as an indicating factor but not as confirmation (e.g. making a note to users about the account's age).
did you still cant figure it out? are you 100% sure its still the same error?
You can't determine whether an account is an alt just using the account's age...
installing them takes a while
my alt account is from 2016, my second alt is 2019.
age means nothing for alts.
install build tools
i have no clue
i am just trying to intall canvas
i once installed vc for c++
and from that day i just can't install canvas nor node-gyp
you have to install the build tools or Visual studio
@eternal osprey try running npm i -g windows-build-tools from an admin cmd or powershell
ive sended him the instruction for this already, but once again people here refuse to read stuff
They're probably just new to this and confused
the canvas install guide is really easy to understand
assuming that was the one that was sent
The join logs on my bot only work on half of the shards, and i dont even have privileged gategay on, someone knows?
the one for installing build tools, and he got the instruction for this already send earlyre
what did you mean with Join Logs?
ah yeah
the guildMemberAdd and remove
need priviliges, its possible that you still query the V7 API
now is v8?
ye
when?
V7 is a bit strange with the enforcing of the new Gateway intends
v9 is about to come out 👀
why is my bot stopping at this line of code:
let members = (await msg.member.guild.members.fetch()).array()
It doesnt throw an error. It just doesnt run the code further at this point
i dont think you can call array on this
I believe fetch is just a slow operation (not recommended).
If you want to fetch the member list, you should use intents instead.
honestly, not sure why fetch(for all members) even exists.
why is my bot stopping at this line of code:
let members = (await msg.member.guild.members.fetch()).array()
It doesnt throw an error. It just doesnt run the code further at this point
EDIT: An error ist arriving 4 hours later
Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
at C:\Users\Flo\Desktop\Discord_Bot\node_modules\discord.js\src\managers\GuildMemberManager.js:317:16
at Timeout._onTimeout (C:\Users\Flo\Desktop\Discord_Bot\node_modules\discord.js\src\client\BaseClient.js:83:7)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7) {
[Symbol(code)]: 'GUILD_MEMBERS_TIMEOUT'
}
@signal estuary
its not really the way to fetch memebers
what should I use instead?
const dbresult = await GuildSchema.findOne({guildId: message.guild.id})```
await only the async function why?
^
and how?
await can only be used in async functions.
Go to the dashboard and enable the server member list intent
? example
linked above
already active
Now check where you initialize the client that you're asking for the member list
where do i check that?
e.g.
const Discord = require("discord.js");
const client = new Discord.Client({
ws: {
intents: [Discord.Intents.GUILD_MEMBERS]
}
})
You may need to enable some other intents, like GUILD_MESSAGES
For a full list of intents see https://discord.js.org/#/docs/main/stable/class/Intents?scrollTo=s-FLAGS
like that?
yah
Try running your bot, but instead of fetching the members with .members.fetch(), rely on the cache for the member list (.members.cache). It should be populated with the member list.
Like I said, you may need to enable other intents.
when I do this it says: Guild_MESSAGES is not defined
oh waiut
Because it's not a variable; it's a property.
That may be due to another intent (e.g. GUILD_MESSAGE_REACTIONS). I encourage you to review the docs and how intents work.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
List of all intents
Realistically unless your bot is quite big, intents wont cause much of a footprint
Bandwidth wise
At higher scale, yeah, specially presences
anyone know how to download songs from newgrounds?
class Test {
constructor (val) {
this.number = val;
};
};
const number = new Test(14);
console.log(number)
Is the class Test an object or a function, I'm confused.
class Text is a CLASS
@blazing sentinel hi. please show code here so we can help you
Ok so just to be clear this only specifically runs whenever you want to check if a user voted, right? For particular, exact commands that are vote-locked?
DAMN, thanks though
all my commands are vote-locked for now? except help and prefix change
Ah I see. So, you don't necessarily need a database tbh, but you certainly would benefit from caching the data
like not query it every single command, but just every... say every hour for example
or every 6 hours
Calling an external API every single command is what's making this slow, not the fact that it's the top.gg api specifically
but when a user votes when it sees he/she have to vote?
then he/she has to wait until next caching?
capture incoming votes with the #topgg-api webhooks and store that then
you can do both
how can i use webhooks?
#topgg-api , check the docs in the topic title, there's event coming in for votes, which tell you what user it is
should be simple enough (I don't use it, and don't use python, but I know it's possible)
thanks, i didn't know there is a webhook api. i dont know much about webhooks but suppose it isnt that hard
https://docs.top.gg/libraries/python/#examples , webhook section
it's pretty straightforward actually
i don't use the library. library is more complex and less understandable than sending get/post requests for me.
how though

What kind of authorization I need to fetch data from this API route?
Hello, How can I make the replit page have my bot on 24/7 without me turning it on every 1 hour?
@rustic nova
Hello, How can I make the replit page have my bot on 24/7 without me turning it on every 1 hour?
repl.it is not a reliable hosting service if you want your bot running persistently.
Like what ping? At what time did I do that and also what is that until I understand the ping is the speed of the internet
A ping is when you mention someone (e.g. @pine pasture)
Umm, can you help me with another page?
What do you mean?
Aaaa But in South America the ping is the speed of the internet but hey everything is different
A word can have multiple meanings.
Do you recommend a specific page for me?
What is a "page"?
: O Well, I understand ...
guys any ideas for a fun category command? (no economy)
A page is a google web
I recommend you add commands that are useful to your bot's purpose; not to add a command just because it's a command.
So you want a "page"/website for hosting your bot?
You're right xD But programming a bot is a bit tedious.
No, not a free service to host my bot And that this 24/7
Try asking the users of your bot what they want. A "fun" command could be a tic-tac-toe game.
ty
what is "ty" is that I live in Colombia
acronym for thank you
That being using a translator is very difficult V:
realistically you shouldnt be making muti-purpose bots, which is what the majority will recommend
that, at least, if you plan to grow your bot
they said it's private
then its completely fine
thats why i said the second part
is there a way i can send some text in discord as .txt file with discord.js?
anyone an idea, what this regex mean?
global.regexEscape = string => string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
It replaces a set of special characters with the same character but escaped.
Though I doubt it's actually useful.
An eightball is a common one but always a fun one :)
interesting
very interesting
@sudden geyser ahhh, I get it..replace function => the thing after the comma will replace it?
I see
$& is a special replacement pattern. It inserts the matched substring (which is any special character in the regex).
ok, I think I see, thanks for the help
You can read more about it here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
The replace() method returns a
new string with some or all matches of a pattern replaced by a
replacement. The pattern can be a string or a
RegExp, and the replacement can be a string or a function to
be called for each match. If pattern is a string, only the first occurrence
will be replaced.
yes, the replace thing is ok, but I was more interested in the regex 😛
I see there is an or within the regex
the second option seems easy to understand
[]{}
Anyone knows how to use environment variables in npm script? I tried different ways but npm takes it as text
"scripts": {
...
"server:start": "npx serve -l $CLIENT_PORT",
...
},
@still sky https://devconnected.com/set-environment-variable-bash-how-to/ maybe this helps?
I don't believe it's possible to pass environment variables within the script.
You can set it, but not pass it.
Thx, but its basics
There are probably ways to dance around the restriction
Gonna try via .js file somehow
Can anyone please help me make a eval command i use python
What are you getting stuck on?
Use the eval function or Jishaku
i am like brand new to using python/making a discord bot with python i have everything else ready and i just need an eval command
So you know how to create a command?
yes
So just make a command that runs the eval method
probably a good idea to lock the command to bot owners only too
Can you please show a example
if ctx.message.author.id == "your-discord-id":
eval(expression)
Should do the trick
ty
what's the best way to see how many emojis a server is allowed to have
and how would i make what i type a var to put in the expression part?
i was planning on making it a embed
Actually your id is an int, not a string sorry
It's a pain in the ass to do in a clean way
long depending on lang
Yeah, it's int in python
Please, any solution ?
uh, transpile it?
guild.owner.send("test")
}``` why is send null
because the owner isn't cached
guild.owner.cache.send? cache is null?
well it still doesnt work tho
do you know about infailedsqltransaction: sql transaction is aborted, command are ignored until ... error? i use postgresql with psycopg2
using guild.members.fetch(guild.ownerID) where guild is the guild
- make sure the file exists
- make sure your require paths are correct
I think it should be command_handler.js
But you should also be aware of the path from the file you're searching for the path from
show your index.js
remove the prefixed spacing

lmao
?
the void
...
THE SPACE
my b
lmao
lol
const fs = require('fs');
module.exports = (client, Discord) =>{
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const command = require(`./commands/${file}`);
if(command.name){
client.commands.set(command.name, command);
} else{
continue;
}
}
}```
i am setting up a new cmd handler
So, fs is relative to the root.
require is relative to the current file
i have not put in any commands
So, if you're loading something with fs and you're in /folder/file.js , another file called /other/thing.js will be loaded with ./other/thing.js whereas you need to require it using ../other/thing.js because you're in another folder already
confusion
./ is the current folder
sorry im switching from BDFD
../ is up a folder
I... don't care actually what you're switching from I'm trying to explain operating system paths
a thing that's been around since longer than both of us have been alive 
do you understand what a folder is
no
oh yeah
./file.js
means look where i am for file.js
../file.js
means look up a directory for file.js
the bottom arrow is where ./file.js would look
the top arrow is where ../file.js would look
https://i.woo.pics/9d5d54045f.webp
so in a sub folder
I hate python becuase of how picky they are about indentation
sub folder is the other way around
yeah
It's so annoying
great so you should understand
../ is one level higher or in the parent
./ is the current folder
now, your fs is relative to the root of your project
that is to say, this folder
BUT
but so index is in DroxZ-Bot folder in that folder is handlers and in handlers are the js files
require() is relative to the current folder of the file
So for require, ./ is this folder.
but for FS it's other one around
see what I mean?
OneDrive... witch found - burn it!
shhhh
i followed a video on how to setup discord.js they just told me to add the fs
idk what it does
so no i dont rlly understand
OH yes i do
no
Hello, I have a canvas element:
<canvas class="background" style="position: absolute; display: block; top: 0; left: 0; z-index: -1;"></canvas>
That sets its height to fill the whole screen. However, whenever I scroll down on the page, the canvas element gets scrolled away as well. How would I make it stay fixed in the background without it scrolling along? I tried position: fixed, but it broke the js animation that plays on the canvas.
Do you know how to send a link that is a download as an attachment?
like the image location of an image sent through a channel?
Ngl, that's weird af
module.exports = (client, Discord) =>{
const load_dir = (dir) =>{
const event_files = fs.readdirSync(`./events/${dirs}`).filter(file => file.endsWith('.js'));```
anyone have any idea whats wrong
@umbral zealot your smart
you omitted the error
but dirs probably doesn't exist
notice how you do have a variable named dir
yeah we have no idea what's wrong either.
We're very smart, but we're not mind readers.
dw I am a mind reader, you problem is on your main.c file, on line 503, I know your file is only 15 lines but trust me, it's on line 503
teach me your ways
the uzbek ways
He now da wae
what is your current discord.js version
12.5.3
ok try "message.member.permissions.has"
how do i webscrape a table and get specific data in a specific row (python)
How can do vote required command please tell me
That wont work since message.member seems to be undefined
Please 🙏
Can anyone guide me that how exactly I can connect to discord gateway
I am new to Websocket thing
looks average
idk how to do the logo
Yellow thunder
👀 i didnt know thunder looked like that
And move the logo a bit closer to the top-left corner
It's too near the chaotic pattern with too much empty space to the corner
oh no
wait should i make it yellow?
keep the thunder the dark color
align them so they don't spaz around
maybe make the giant one smaller and farther away
The smaller lightning bolts all pointing in one direction (like downwards)
I think the chaotic pattern is fine, it's just that the logo is too near them
Like, it's the logo that should capture the attention
Not the bg
that ?
tried moving them away from big logo...
wdym far away?
should i also decrease the amount of small logos i got
or increase maybe
@fiery stream bhn k lode
lun ta baj
@fiery stream means?
What does this mean?
Meansyou are madarchod
Teri budi madarchod salya
🤣

Teri budi da lun a chung la

Smd
@fiery stream kya hua randi k bache
Teri ma randi salya
Tera khandan randi madarchod
<@&304313580025544704> ^^ feel free to mute this kid
-atmods
@fiery stream
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
He bullying me in other langs tho
He bulling me tho... 🥲
not a valid reason to ping mods, sorry
not repeating myself, please don't ping mods for something that only requires one person to handle
use your head
please dont bully users.

now you gonna bully me too 
never said anything bad
just bruh for that modping
also just realized this is development
#general for conversation
class Form {
constructor (name, email, age, ID) {
this.name = name;
this.email = email;
this.age = age;
this.ID = ID;
};
};
const student = new Form("Jack", "Jack@jack.com", 24, "LOL");
console.log(student.name, student.email, student.age, student.ID )
I'm having this class, and I'm trying to check that if ID is not a number then it would return a console.log("ID not a number."), but I am not sure how I can do that.
I added this before this.ID = ID which is if (isNaN(this.ID)) return console.log("NO"), but it logs ```js
NO
Jack,"Jack@jack.com",24,undefined
you could try using typeof operator. check it before assigning into the value.
example:
if (typeof this.thing !== "number")
// throw some error here
sql noob here, what does the "UNIQUE" constraint do
can someone tell me what is the name of the route that i can put a user ID or product on?
as the word says, unique, it queries with only unique(non repeated) columns
it can be handy instead of AGGREP or GROUP clauses

imagine this
oki
==========================
id | name | role
1 | lerwin | dev
2 | lerwin | dev
3 | Nekomaki | dev
4 | Nekomaki | dev
Each of the ID's are unique
oh
however the names or the roles arent
i see
meaning if i try to make the role collumn unique
so i can't have two id -> 1s
correct
if you have a column with UNIQUE you cant insert the same value twice
that ensures its actually only that one occurance
and no more
so if i have a table that takes into account people's discord IDs, i should probably set it to unique? (even if there probably won't be any conflict given how discord uids are made)
or something of the same concept
correct
you using postgres?
sqlite
dunno if that's a proper answer to your question
all i know is i'm using some sql and the sqlite3 lib in python lol
postgres, like sqlite, is another db
its SQL based tho
but postgres usually offers a shitton more stuff, but its also heavier
can someone tell me what is the name of the route that i can put a user ID or product on?
what?
you mean the api?
for a GET request?
Exemple: ('/user/[:id]')
just ask which endpoint
but yeah, thats the one for user
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
and for product...
do you guys only help discord.js or also discord.py
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this would likely be the one for store
@thorny flume
nah, but py and js are the major ones used
no man, it is express, I want to create a route with a user id or product
Lol
cause iv learner js so I want to learn py
Ok
fair enough
well it is what it is
@opal plank
.get('/user/${user.id}')
?
Okay, but I can create a const containing the information I want to pass on, for example:
const userId = '90';
.get('/users/${userId}')
?
well, its a server, yeah, you can send whatever you want to whoever does the GET request
So I have a struct, which owns an object let's say A, is it any way to transfer the ownership of that object to the current scope, and then return it once the scope is over, I don't wanna borrow because I'll need to borrow again later on
@opal plank
@commands.command()
async def dbtest(self, ctx, currency: int):
conn = sqlite3.connect(some database path)
c = conn.cursor()
c.execute("SELECT ID FROM UserCurrency WHERE ID=?", (ctx.author.id,))
if c.fetchone():
await ctx.send("Found!")
else:
await ctx.send("Not found.")
c.execute("INSERT INTO UserCurrency VALUES (?, ?)", (ctx.author.id, currency,))
conn.commit()
conn.close()```
i did a thing
and it works
but is there anything i can prolly do better
(all command is supposed to do is just check if uid exists when running the cmd, then if it doesn't, just put the uid in and add the currency value)
also, is there a way to get like, ID, as an actual value that i can use in code 
nvm got it pogu
And if I want to get this information, I can do it like this:
.get('/users/${userId}')
console.log(`${userId}`)
I'd suggest you do a connection pooling, idk if sqlite3 has it. Also, ig sqlite has similar syntax as postgre for upsert clause
i dont think it does (from searching it up)
yeah ig, there's sqlalchemy afaik. I haven't tried sqlite though
Oh, forgot to mention, you should be using aiosqlite instead as sqlite3 is blocking
not sure if it has connection pooling though
what code should i use i want that bot say something when it is pinged (node js)
What is the opposite of guildCreate
guildDelete
which library?
not how that works with routers, no, you'd get which endpoint they touched with the url in the request
??
use websocket ping or make a simple request to see how long it took
oh
nvm im stupid
you mean when you MENTION the bot?
lik @<botname>?
@earnest phoenix
listen to messageCreate event, then just check if the <message>.content includes the bot id or mention
🤔
discord.js should ship mentions wth it
<message>.mentions.first()?.id === client.me.id
something long those lines
you havent used djs in so long you forgot how it works?
xd
i assume it has your own users/@me payload attached to the client somewhere, no?
message.mentions.users.has(client.user.id)
:^)
What is the opposite of message.mentions.users.first()
message.mentions.users.last()
Thnx
69?
69th(), yes
.first(10).last() is a real thing tho :^)
nothing beats for loops
also object > map if your keys are strings
map is only good for non-string keys
except detritus. detritus beats everything *
||this opinion may or may not be biased||
bias king :^)
ask the owner to document it properly,it cancer to read the docs
Ok
(╯°□°)╯︵ ┻━┻
imagine reading docs and not using intellisense

ts gang
the docs are there, in intellisense format

also also
@long crow pls cake-san dont bonk me for exposing dms
cake definitively has plans to improving the docs
i've talked to him before, im willing to give some help too
might write a base clone-ready bot for new people full of comments
I'm looking forward to it, sure it handy for intellisense, but as now I dont want to rely fully on automatic pops without knowing what it does
i mean, in all honesty most of the is kinda intuitive
also biased opinion, cuz you need to know a bit of how discord api works beforehand
for new users, without intellisense its a nightmare
when I active here, most feedback I see is about documentation, so yeah. looking forward to it.
those 3 he says are the feedback im bringing from what i hear
voice support
better docs
message collectors
and seemless scale
though he did point out not having much interest in the latter
already supporting / command?
dunno if i should actually say much about it since most of it was spoken in dms, and he's traveling rn
dont wanna put unwanted pressure
but yeah, he is doing something about slash commands, possibly a slashCommands client
dunno exactly what he's doing, i havent asked much
but im already using slash commands and some newer stuff
his lib has no problem whatsoever interacting with it
button?
I'll just wait it out, btw we stray out of #development topics. kekw
not really, this is dev talk
talking about a library and its capabilities is well within topic
but the new stuff is looking hella sweet
threads and buttons are pog
its been talked about quite a while in the past
not sure if i can comment about anything in details tho
they specifically asked not to share it
I'll take a stand wait and see
fair enough
not rushing stuff till it ready
indeed
though im going the other way around
i may already be porting my commands to use it

like, almost all of them
of course, gonna leave the old ones as is, but i'll clone them to be able to use the newer stuff too
im probably not gonna do shit
im 100% using it
too pog to pass by without really any drawbacks
specially for ratelimits
this will massively decrease some ratelimits
how make an api in heroku
@earnest phoenix Learn how program
i mean i want make a meme api link
but my cnt workk
you get the first half of the first string, second half of the second string, and you add them
What language are you using and if I understand correctly, you are trying to combine two string variables?
I'm using javascript
And trying to make a ship command
A ship command?
Yup
Don't judge me I'm mostly just a web dev getting into bot development lol. So what do you mean with a ship command?
What is it supposed to do?
basically fusion names if you ever watched dbz
Idk
you get the first half of the first string, second half of the second string, and you add them
isnt this self explanatory?
python maybe, js not so
its the concept
A lot of people can't be bothered to use their brain
yeah yeah ,you're the smart ass
🙄
post your command and we will help you fix it. cant really spoonfeed
Oksir
@earnest phoenix do U understand urdu
correct
pub fn peek(&mut self) -> Option<&Token> {
if self.current.is_some() {
return self.current.as_ref();
}
self.current = self.consume();
self.current.as_ref()
}
Any rust pros here know how can I make it so the function doesn't return a reference to Token without cloning it, or maybe return a reference to token which isn't tied to self's lifetime
let token = self.tokens.peek()?;
match &token.val {
...
self.tokens.next(); // cannot borrow `self.tokens` as mutable more than once at a time
}
That's why I'm asking ^^
i am trying to install windows build tools
and it has been stuck on this page for like 30 minutes or so
its normal, keep waiting
sure
saw this taking 1-2 hours on low powered Devices
i've got a pc that is running on 850 watt psu. Has quite some strength too.
still at the same page lmao
same problem
my Microwave can also pull 850 Watts, wont be this much faster. you could even run a RPI off a 850 Watts PSU and it will still work at the same speed.
installing stuff is more network and disk dependent than cpu and ram
or just gets limited by your OS, but for this you have to run funny stuff like a Raid 0 array of mutiple NVME SSDs. then windows starts to limit speeds to the array bcs it cant handle it.
but this again is not really something that a normal person will encounter
Hey why this is not working for me?
message.guild.me.voiceChannel.join()
you call the voiceChannel property from a member object
like message.member.voiceChannel.join()?
me gives you the member object of the bot, you probably want to get or fetch the voicechannel and then get the bot to join it
Oh ok
<GuildMember>.voiceChannel is v11 which is deprecated, use <GuildMember>.voice.channel
I am using v12
Then do what I said
ok
How can I make my bot send his stats every 5min in a specific channel?
DJS
Set an interval using setInterval(), get a specific channel from cache by using <Collection>.get() on <Client>.channels.cache and call <TextChannel>.send() with the stats
Assuming you're using the std::iter::Peekable struct, I don't believe there's any way to get around returning an Option<&T> as the method signature requires it. As for borrowing multiple mutables, .peek() works on its mutable self and .next() does the same thing (though .next() returns an owned value).
Thanks for the answer but I already solved it 😅
ah, alright
i am still at the same page with my download
wtf is it doing
still waiting for installer log
How long did you actually let it run? because I've seen this take, like, 45 minutes.
depending on the machine
are you using cmd or powershell? try installing with the other one
you could also try installing chocolatey and installing through there
for like a hour or more
i tried cmd with admin perms
chocolatey is already installed
alright well try using it to install those
seems like it won't work
It takes a long time.
Leave the command running
whats the regex to match everything except of undefined?
leave it running for like an hour, then open task manager and kill any installer.msi thingy (make sure cpu usage is 0%)
sometimes works

string.replace(/undefined/g, "")?
Model.find({'guild.test' : idk})
fetch all documents with a defined value on the field
You can just fetch all and filter the results
fetchAll is too much, a lot of documents xD
guilds.find({ test: { $ne: undefined } })```
$ne would be not equals
test is the property
oh,
, did not thought about reversing it , thx
How do I know where this error came from?
E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:154
throw new DiscordAPIError(request.path, data, request.method, res.status);
^
DiscordAPIError: Unknown Channel
at RequestHandler.execute (E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async RequestHandler.push (E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:39:14) {
method: 'post',
path: '/channels/825367843355885608/messages',
code: 10003,
httpStatus: 404
}```
What command did you just execute?
e.g. ```js
try {
something()
} catch (err) {
handle(err);
}
surrounding the command. Logging stuff like what command was used can help as well.
Make sure to await it
if it returns a promise of course ^
well tbh, Hoister just wants to know where the error came from, although yes exception handling is a good thing.
Handling the exception will allow the error stacktrace to point to where it came from (I believe)
Plus you should have the info on what command it was by doing so.
[PostgreSQL] I have a media and tags table. I want the media table to have a tags column that should be a collection of references pointing to some row in the tags table. PostgreSQL has an array type, but I don't believe it's appropriate for this as I don't think you can store arrays with references (foreign keys). How would I accomplish something like this?
Hey Guys, In Dicord.py I coded
async def on_member_join(member):
em = discord.Embed(title=f"Welcome {member.name}!!", color=0xd24dff)
em.add_field(name=f'Welcome to my World Baby {member.name}!', value=member.mention)
em.set_footer(text="Hope you will have Fun with me here!!!")
await client.get_channel(799980929056768003).send(f'{member.mention} has Joined.')
await client.get_channel(799980929056768003).send(embed=em)```
this for the welcome sys for only my support server, it will welcome new joiners on this channel, but the bot is welcoming every new member which joins in any server where the bot is. how to make it for my my support server, i tried adding
```if dicord.Guild.id(696969696969): ```
but it didn't helped.....
That if condition doesn't make sense.
You should check what guild the member is from.
I think you can do if member.guild.id == ...: pass
ohhh, thanks, let me try it
so basically what I understood is that you want the media table to have, specific instances from the tags table right?
like getting row data from another table
You're on the right track. The tags column would hold some collection of references pointing to some row on the tags table. But it won't hold an "instance" of a row (since that's not possible). The foreign key will instead hold a primary key (in my case an ID) that's sure to exist on the tags table (e.g. e577c582-6537-4b1f-ac8d-5dc8a64bbf30).
But I'm not sure how you'd have a collection of references work with a database
An ORM to interact with the database, but I'm creating the table from SQL.
ye well that can help
lemmi give you an example
SELECT data1 data2 INTO TABLE subtable FROM supertable
should work like a charm
WHAT THE..
huh
I'll look into SELECT INTO, thanks :)
np
I didnt, someone else..
empty response from the server I guess,






