#development
1 messages · Page 1710 of 1
nope you have to add it to get a API key
ok
but you could use the key on a different bot i guess to test stuff
What
you have a green name so you have a bot listed.
I have 2 bots. One that people use and another that only i use and i stop and start constantly. I am new to the top.gg api and so far i haven't gotten it to work yet
you could use the API key from the Bot on a Dev Bot to test stuff
but api questions go to #topgg-api
well this is APIs work usually, the key is for authentification
But the API can only check manually....This means I don’t get exactly that if someone is donating
i think there is also a webhook endpoint
setting it up should be similar to how top.gg Webhooks work
Puls I get Discord Account IDS over That?
Ever worked with that?
nope, but it should send Events like new patreon, subscription changes and if someone cancles the subscription
then you just have to listen for the stuff and work out what it sends
for discord IDs, you have to manage this yourself i guess
the API doesnt send them
what are some kind of encryption forms i could use in js browser other than base64
the node_modules is not installing on my linux ubuntu machine, it throws this error: Error: Missing required argument #1
idk why can anyone help im new to linux soo
did you have permissions to write into the folder?
yes
what command did you use?
did you ran npm init to generate the package.json?
what is the full stacktrace of the error
its already there
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
the debug log
i like that discord now offers previews of files
yeah
no more sketchy .txt files
and no more Trojans
well they still can be embeded. but you dont have to download it directly
has anyone done custom channels using mongo db here?
idk
explain
what you mean by custom channels?
umm like chatbot channels
Can somebody help me how to do economy in my python discord bot??
If you can help me with it ping me I will be back in 10 minutes
just store the channelIDs as string in mongodb
...
did that
database works fine
and?
i have a issue while using it with chatbot
check the code
if i do return after checking if the channel is there or not on the db
do you send the correct stuff to the api?
My bot is not starting and nothing error
it does not respond
yeah theres not a prob with the api
chatbot works fine
its not taking in the channel
yes but you have to get or fetch the channel object from it to be able to send stuff in the channel
i suggest the following:
fetch the channelid you have in the database.
then check if the message channel is the one you just fetched, if true send it to the api if not just silently return
Can someone help me with economy in my python bot I used every tutorial and every git hub code I saw and nothing happened
nothing? You used every tutorial and nothing happened?
I don t know how to make database and how to setup it because when I tryied to it doesn t wor
yeah - NOTHING
So you ran every code you could find, and you had no message, no error, no actual action happen in the face of many lines of code... ?
No because
I don t have database adn don t know how to create it in python to my bot because every tutorial was on .js

well i think i fixed the problem ubuntu comes with NodeJs 8.10.0 and im updating it rn
Your googling sucks ass, man.
Can you send me tutorial or soemthing to learn how to create database to my economy system
How the hell did you do that
Yes this tutorial I used to make it but It doesn t work
for me
Well ok that's a step above "nothing happened"
So how didn't it work?
would you mind maybe actually getting some of that code and, like, describing the problem, the errors, the difficulties you ran into?
I can t create and I don t know why I changed my computer language for that to english and again it doesn t worked
how the hell does your PC language have to do with coding a python bot?
No because I actually don t have any errors because I can t create database
I don t know
Well here's the thing though
You have the information you need
you just aren't making the effort to go through it
all economy bots will require a database. It's a requirement. you can't get around that.
yes I am know
but I can t creaet database and I don t know where is problem
Ok so, good. From "NOTHING HAPPENED", we've progressed to, you're having trouble setting up a database.
more progress
thanks, worked
What problem are you facing attempting to create a database?
I use command what he used in video and database didn t create
I going to watc that video again and try it again and I will be right back after test it
It sounds to me like you have no idea how to write python or code at all and you're hiding behind vague problem definitions to avoid admitting you don't actually know programming.
You might want to actually learn the language before attempting to make bots.
https://wiki.python.org/moin/BeginnersGuide/Programmers
Here. Go learn python first

There are tons of resources to help you learn
tons of damage
Thank you for this video it wasn t video that I ever seen it really helped me out - Thank You
i used to use py but i switched to js and its honestly easier
doing bitwise with bigint is so painfully slow its hilarious
you can literally make your own bitwising functions for numbers bigger than 32bit and its 50x faster
thanky
<3
js's bigint is arbitrary
int is 53 bit max because its based on 64bit double
but bitwise operations internally use int32
so numbers between 32bit and 53bit cannot use bitwise in js
but bigint can use arbitrary bitwise
so many people use bigint for 32-53 range
which is panifully slow and not needed
you can rollout your own functions for bitwise in the 32-53 range that dont require bigints
yikes
let arg = abcde
How to get the list of the number of times letters of arg return?
@zealous egret what is your problem?
example:
a: 1
b: 1
c: 1
d: 1
loop over the characters and add them into an object
@quartz kindle What time is that? ms, s?
ms
I already solf it
Ok 👍👍
imagine 600 seconds lmfao
it doesnt iirc
would be the sensible thing to do
@quartz kindle
for (const count in object) {
console.log(`${object[count]} : ${count}`);
}```
He log the place and not number of time
my console: a: 0
[1323333333333333333333333333333333333333333333333333333333333333333333333333333333 & 2342385223633333333333333333333333333333333 for _ in range(99992222222222222222222999)]

of
30ms
oh cool
undefined @quartz kindle
is Typescript good for functional programming?
just asking for researching purpose 🤔
for(const count of arg) {
console.log(`${count} : ${arg[count]}`);
}```
string = "weoughowuehgwu";
object = {};
for(let char of string) {
if(!object[char]) object[char] = 0;
object[char]++;
}
console.log(object)
thx
i run code just refuses to eval this
(a eval discord bot)
what lang?
py
rip
or did you mean the bot?
the eval
hi
the bot iself idk i didnt write it it uses some code execution engine
what lang is the interpreter trying to eval that with
but it tryed to eval it in py
so arbitrary ints in py are fast but cost tons of memory?
https://github.com/engineer-man/piston ran with this
god I wanna use that but it's a pain in the ass to setup
just use the API
I can't for performance reasons
well then rip
I mean it's also that the project I need this for isn't a thing I'd want to use an API for, with its limits
I haven't even looked at just getting a docker image I bet there's one 
docker is to slow for it, they use LXC container
no I mean, a docker image to run piston itself so it runs all its things
that thing needs a lot of dependencies >.<
virtualisation inside virtualisation?
i have try this:
function count(string,char) {
var re = new RegExp(char,"gi");
return string.match(re).length;
}
var str = 'ab';
console.log(count(str, "a"));```
but now how can i displays a and b times ?
do you really need regex for that
function count(string, char) {
return string.split("").filter(x => x === char).length;
}
console.log(count("ab", "a"));```
you can use array.filter()
for displays a and b times?
@command(description="Test command lol.")
async def test(self, ctx: CommandContext):
kwargs = {
"content" : "Message.",
"allowed_mentions": {"parse": []},
"embeds" : [
shortcuts.create_embed(title="Test", description="Test haha", footer={
"text": "My footer!"
}),
shortcuts.create_embed(title="My title.", description="This is a description.", fields=[
dict(name="Field name 1.", value="Field value 1.", inline=True),
dict(name="Field name 2.", value="Field value 2.", inline=True)
])]
}
print(await ctx.send(**kwargs))
Looks prettier, more or less
Oh yeah
@command(description="Test command lol.")
async def test(self, ctx: CommandContext):
kwargs = {
"content" : "Message.",
"allowed_mentions": {"parse": []},
"embeds" : [
shortcuts.create_embed(title="Test", description="Test haha", footer={
"text": "My footer!"
}),
shortcuts.create_embed(title="My title.", description="This is a description.", fields=[
{
'name' : "Field name 1.",
'value' : "Field value 1.",
'inline': True
},
{
"name" : "Field name 2.",
"value" : "Field value 2.",
"inline": True
}
])]
}
print(await ctx.send(**kwargs))
this looks more like it
better than this
client.on("message", async (message) => {
if(message.content === "!ruk") {
message.channel.send('Restarting...').then(m => {
client.destroy().then(() => {
client.login(client.config.discord.token);
});
})
}
})
My restart command is not working
I wouldn't rely on that working
just do process.exit() and have a process manager restart the app instead
Error:- then is not defined
Can he will login again?
you already do... in your main index file
process.exit(0) will just close the process, but if you have something like forever, nodemon or pm2 running it, it will restart it automatically
Its not restarting system again
module.exports = {
name: "restart",
run: async (client, message, args) => {
message.channel.send("ruk rha.... sabar kar!")
await process.exit(0)
}
}
did you need to run it async?
mesaage.member is returning undefined. Can anyone tell why
message is defined and looks like an ordinary message
message.user is also defined
was the message sent in a guild
it shouldn't be undefined
it should be null
are you sure message is valid
it could be something else
it's in a guild
yea message is valid I did console log
what discord.js version?
check Google API docs what 429 error code mean
Ok
This?
how can i chech if the vc the bot is in is empty?
if you're getting 429 on a play command, then you're being rate limited by youtube
imagine imagining an imagination
brain
heroku dont like Discord bots. and Music bots even less
even worse
Then what hosting?
Scaleway?
Ok
aws
but yeah the list is endless
too soon? exdee
also this is a thing now https://www.ibm.com/cloud/free
which seems interesting
ovh
Well ovh building burned
27 hours of cpu time per month?
lmao
where do you see that
their cloud foundry which seems like a heroku clone lets you use 256mb per month
oh u have to go on lite
how can i make a avatar url?
I think so. I haven't looked into it because I don't use free hosts obviously but it it looked like an alternative
yeah it's probably a heroku clone where they give you the generous free tier and hope you pay out the nose for the lowest paid tier
like drug dealers 
xd
these internet giants have very weird business models
google ibm and amazon
783653875 different services with fancy names and no information on what they actually do or offer
Ok NVM I fixed it by restarting all dynos
billed in ways that make them look cheap
but in the end its all expensive af
its one big marketing scam
User {
id: '683630053686378498',
username: 'RAKE',
bot: false,
discriminator: '6882',
avatar: 'a611246958d2280e501ee52c5cf8bf2f',
}```
How can i make avatar out of this
https://cdn.discordapp.com/avatars/<userid>/<avatarcode>.png
avatar is the user's avatar hash you have to fetch the actual image using it but idk the url
well there you go
i tried to do this for bots did not work
bots or users there's no difference in the URL
User {
id: '738797867321393263',
system: false,
locale: null,
flags: UserFlags { bitfield: 0 },
username: 'EnmapDocs',
bot: true,
discriminator: '2064',
avatar: 'a2c074a5d29efb3b12ef4ac4504b2878',
lastMessageID: '832732002880585738',
lastMessageChannelID: '473491355520204800'
}
https://cdn.discordapp.com/avatars/738797867321393263/a2c074a5d29efb3b12ef4ac4504b2878.png
okay
thx
i am trying to make my bot string a random server from all the servers its in but rn it only sends 'm', '=', 'd' and not a full name. how do i make it work?
You're turning the whole client.guilds collection into a string, and then random.choice picks a random letter from that string
yea thats what i thought happened
So move the string conversion to surround the random.choice(guilds) instead
Move that str() to ctx.send(str(guild))
Yeah, you're still converting the collection to a string
ohh
what did you think str() did?
Can someone help me by setting up the invite tracker bot in my server ?
how to make this good
This channel is for programming
Stop asking in EVERY channel
That ain't errors so it'll not pop in the console
Those are missing unicodes
check what you're trying to write and verify if the chosen font has matching chars
Could you show what that text was supposed to be?
The text not the code
No, that's the code retrieving some users username
I wanna see the username itself
Oh my
The error is not in the code for gods sake
Show tge actual text you're trying to print, not the code
Idk if you're joking or what
But I'm out
if(!message.member.voice.channelID !== '775589180654485504') return message.delete();
this doesn't work
e
help please
bruh chat ded
Do you guys know what is wrong? I can t use .lb command
@zealous egret add_field doesn't have a name attribute
it says
Try title
Oh wait no it isn't that, it's in the first for loop
So what to do with it
Debug it. There are a few places that could come from. But it seems like it's coming from line 372
yes help ples
Remove the leading !
That'll convert it to if (false !== 'id') {...}
thank you
get_user only works if the user is cached, otherwise you'll need to use fetch_user
ye tho it doesn't work in both cases i now got it thank you
whe i can make it with .invites?
Yes, it's supposed to be hex
What?
hi guys i have problom how i can fix it this my problom
That what?
so code
Read the docs for how to properly create a new mongo client
im make like that
how can i do that
if(!message.member.channelID !== '775589180654485504') return message.delete();
Code for what? You're not saying thing with thing
code for visual studio code for check invites
Vscode is a text editor
i will code for check invites
Fetch the invites from the guild object
https://paste.ee/p/RvQ0q someone help me with this one it doesn't work when i paste it on my console
You can't run jsfuck on the console
yes i can but i can't run this one
So, what do you expect for us to do?
see if it works
ok
mmm love that desktop, wouldn't you agree @vivid fulcrum
windows ooga booga edition
lol
lmao
long before time had a naame
Is json or csv better for storing stuff
What kind of stuff do you want to store?
Ohhhh. Windows 7 😩😩
Tbh most are really hard. I can help you in dms with mine but it’s not on top.gg rn so your just gonna have to trust me (if you wanna)
C# is pog
Hi!
Sorry for bothering you, I made a little script to retrieve the invitation used when a member joins my server, but it returns me undefined.
I tried other techniques but the same, undefined ...
If you could help me please?
module.exports = async (client, member) => {
const invites = {};
client.guilds.cache.forEach(g => {
g.fetchInvites().then(guildInvites => {
invites[g.id] = guildInvites;
})
});
member.guild.fetchInvites().then(guildInvites => {
const ei = invites[member.guild.id];
invites[member.guild.id] = guildInvites;
const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
console.log("Used invite :", invite)
});
};```
const vip = await guild.roles.create({
data: {
name: 'MB10',
color: 'BLUE',
},
reason: 'role for the game attenders',
})```so this first gave me a guild undefined error, so i defined it. Then it gave me the error(node:11064) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
why is that?
because it needs cache?
Is tsconfig.json available when downloading a ts npm package which compiles into js after install from github?
How long does it usually take for mods to approve/decline a bot? I have my bot on my local computer because I can't afford a VPS at the moment, but I still want to be sure my bot's online when it gets reviewed.
k
mine took 2-3 weeks but it was like 4 months ago
you need to use await here
also use a for loop
by the time the promises finish, that code is long gone
c++ is pogger
instead of forEach() use for( of)
instead of fetch.then()
use await fetch
same for the stuff below that
@earnest phoenix
smol ad dont kill me mods you could use my public bot that tracks invites
im too stupid to know what went wrong here as it looks apropriate for what i saw in online forums, but uh what is it trying to do?
try std::vector<int>
i keep forgetting that the linux compiler is diffrent than the windows compiler
ehhh i only need to use vector like twice i think so
vscode moment
eh true
yeah cuz then i have to go through it and remove them all XD
xD
help me out here @quartz kindle its erroring on a commented out line XD
lmao
honestly i still dont understand what exactly are you trying to do
why declare a function as a pointer?
so then i can make a list of options, take the integer straight from cin and not have a long chain of if else or switch statements
that error on the commented line made my day tho
so if the input is 1, run function1, if input is 2, run function2?
always different functions?
yes
calculate very diffrent things
also i used a while true loop so if you dont run it on cli it just sorta kills your pc and somehow writes random data to disk till its full?
Lol
yea shit dev moment
imma probs make it where if the first cin it recieves gets nothing it just backs out immediatley
return (0)```
stfu google
link please (dm)
if I have
client.on(eventName, event.bind(null, client));
how can do client.off() ?
I need refresh cache of event 'message'
wat
for oauth, how do we print the guilds the user's in
i already have the guild scope but idk how to print their guilds
ah you mean remove the event listener? client.removeAllListeners("message")
Uff man,thank you very very much!
hi
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];
console.log(a, b);
console.log(arr);
What does this mean As in, you cannot use the rest parameter to catch a subarray that leaves out the last element of the original array.
does it mean that you cannot do something like this?
[...arr, a, b]
Correct
^
oo, thanks
if you use a linter and put something after ...arr it will scream
and question
o wait nvm found it
my test says Use destructuring assignment with the rest parameter to perform an effective Array.prototype.slice() so that arr is a sub-array of the original array source with the first two elements omitted.
does it mean to do something just like this?
how do i use commands.BadArgument correctly? discord.py
2008 moment
lmao
yeah
you can just do [,, ...arr]
I think
TypeError: Class constructor Snekfetch cannot be invoked without 'new'
const get = require("snekfetch")
try it and tell me if it works
yes it does, thanks
alr
ngl all the really helpful forum posts seem to be from 2008
c++ mustve been the hot shit back then
xd
well most people weren't asking "why does my bot not work?!?" back in 2008
last 5 years the internet has seen a steep drop in quality
also probably only the people who wanted to delve deep into programming were asking for help online XD
why the heck are you being told to use the spread operator as a way to slice an array lmfao
the actual slice function is faster anyway
lmao the slice function is much simple
well if its an in depth lesson about the spread operator it makes sense i guess
to show all possibilities
true
yo nice you call a vector the same way as an array
XD
xd
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
im using array of pairs to store function error strings
help with what? what is the problem?
mmm yes the crisp of konqueror
at Object.run (/home/runner/Jester-Bot/commands/music/play.js:73:35)```
imagine being lazy enough to switch default browser to not konqueror
thats my code
var list = message.client.queue.get(message.guild.id);
message.client.queue is undefined
the error is there
how can i define it
you copied that code from somewhere?
when you look at that you see what line it says (73) and then you see the object right before cache and thats the issue
the code you copied depends on other things that are not in there, which are missing
in this case, a queue property is missing from the client
it should probably be a Map object
tim what is the sleep function in c++ again? (i can google i just thought you might know off the top of your head)
@near igloo can u help me out with this issue?
im not intelegent enough 
i dont get what your trying to get
tbh ive never heard of client.queue
Do I need Privileged Gateway Intents to use client.servers
I don't think so
Okay ty
i thought it was client.guilds 
but no you wouldnt
thats a necesary client thing
depends on the library, but it's probably guilds
I've never seen a library where they're called servers
It just posts how meany servers it is in right?
should've seen discord.py
same just saw it (on stack overflow lmfao) bc I could not find the library for it
that's a fucking crime
yo it’s voltrex 2

their pfp
ikr
so i am making this announcements command, but it says 'a Nonetype has no attribute to send'
how do i fix it?
I'm no expert but it sure as heck looks like channel1 is null because it wasn't found
hi guys anyone have good filters for music bot?
"filters"?
yes like bassboost , 8D
So you mean literally you want all the filters that 80% of the music bots I reviewed had?
all of 'em have them all. lol.
i mean like an npm package
they're not going to use npm packages.
oh ok
you need filters on the sound module you're using
which I presume is what they're all using
im using discord-ytdl-core
@earnest phoenix In your first loop, you iterate over the current user's guild's text channels to find the last channel where the names match. You then iterate over every guild's channels to find a channel that matches with the name and sending a message to channel1.
There are two issues in that logic:
channel.nameis going to be astr, but you're comparing it with aGuildChannel.- You're only sending it to
channel1rather than each channel. In fact, I don't think you should be doing this in general.
clearly what it's doing is what you want
ty dude i hav a look 🙂
so how what do i do?
You compare a string with a string (channel1.name) and you send it in the appropriate channel (so it isn't sending the same message in channel1 instead of the channels that should match).
Also, discord.py provides a decorator for labeling a command as owner-only (@commands.is_owner())
?
channel1 is a GuildChannel, but channel.name is a str. But you also need to handle cases where channel1 is None, which is the source of your error (Nonetype has no attribute to send).
a lot of people do (and most likely than not they have tons of issues because of it)
damn impressive tho
tbh phone screens make me claustrofobic
even my laptop screen is small
and the patience to type on a touch screen
i just use my laptop cuz windows on my desktop isnt as good as linux on c++ imo
autocorrect
autocowrecks
yes
i hate autocorrect
i always have mine disabled
but then when i type fast i type really funny things
lmao im too lazy ngl
xD
for me its hilarious when i type fast and autocorrect is having a bad day
i get things like (hold on imma go find it)
Ehhh temhey all way ting verification
thats me typing fast with autocorrect
lmao
alright its time to purposely try and brick my pc hoping that my code's error catching will catch it
this is me without autocorrect
Nginx rev?rse prpxy?
Im on the pgone without autocoreect
Phone
@quartz kindle no idea what its saying
You're missing a " before solution
ah, whoops, didn't catch that. Thanks
Also I'm not sure about the reliability of providing a raw string as JSON
Over JSON parsing an object to be converted to a string
oh its mad i didnt return anything
where are you defining strictProbabilty?
probabilityProcessor _probabilityFunctions [1] = {strictProbability};
^~~~~~~~~~~~~~~~~```yea thats a yikes
down in the bottom of my code
define it on the top maybe
btw you dont need the spaces around the <> anymore lmao
lmao is that just a 2008 thing? kek
uhhhhh vscode wyd
@quartz kindle lmfao i got a segmentation fault by putting fd into an int
lmao
Ooo Sounds interesting
i was installing kali on my ssd but it gave me this insatll errror
hi does anybody know how to make a youtube statistics bot? if you could sent a tut then that would b great!
anyone know how to host a js bot on a vps as my python bot runs fine on vps
aaah my laptop would b way to slow for kali linux
Look into the YouTube API to see if they have anything you're looking for
https://developers.google.com/youtube/v3
whats vps?
hosting?
100up
ok thanks
i got my python bot on there simple but it wont work with js
what do u wanna host ur bot 24/7?
@earnest phoenix uh so basically: git clone it, fill out env cars and install dependencies then run?
ok i shall try
They already have a vps though?
Yeah i got a 100up
whats vps???????
A virtual private server (https://en.wikipedia.org/wiki/Virtual_private_server)
A virtual private server (VPS) is a virtual machine sold as a service by an Internet hosting service. The virtual dedicated server (VDS) also has a similar meaning.
A virtual private server runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost an...
yh so baisically a hosting?
@earnest phoenix u can host with heroku
► [NEW] HOST YOUR OWN DISCORD.JS BOT 24/7! - 2021! (UPDATED)
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! https://dashcruft...
mkay
Heroku may not be a good service to host a Discord bot
its a bit complicated
i always use heroku
nah just make the procfile
add the folder to git hub
let invites = new Map();
module.exports = async (client, member) => {
member.guild.fetchInvites().then(guildInvites => {
const ei = invites.get(member.guild.id)
guildInvites = invites.set(guildInvites, member.guild.id);
console.log(guildInvites)
const invite = guildInvites.get(i => ei.get(i.code).uses < i.uses);
console.log("Used invite :", invite)
});
}; ```
why invite return undefined
yes but when i set .find he say me … is not a function
and then u have to make a heroku application. connect the main branch and deploy. boom your bot will be hosted! the vid explains everything a bit better though
heroku is "read only" as far i know
you may want to look into a process manager like pm2
You could use a raw loop and iterate over the map to find the invite, but I recommend you use Discord.js's Collection class, which has a number of useful methods for maps. But even then, you're handling your collection in a weird way.
You call .get with the guild ID for the ei variable, but you try setting guildInvites (which is definitely not a guild ID) as the key and the guild ID as a value.
How can I tell if a user is online in discord.js, and how can I send a dm to a specific user when that person comes online? My current code is as follows, but it doesn't work. It doesn't throw any errors, it just doesn't do anything and I'm not sure why
client.on('presenceUpdate', (oldPresence, newPresence) => {
let member = newPresence.member;
if (member.id === '173489654144696320') {
if (oldPresence.member.status !== newPresence.member.status) {
if (newPresence.member.status === "online" || newPresence.member.status === "dnd" || newPresence.member.status === "idle") {
let text = "User is online"
client.users.cache.get("173489654144696320").send("User is online, bot is working")
}
}
}
})
me just vibing here trying to segment fault my entire 8gb of ram
Have you enabled privileged intents for presence data?
uhhh, no... how would I go about doing that?
You also need to enable them on the dashboard like retro said
thank you, I'll try that now
Yes
does anyone know how can i solve this?
code: https://sourceb.in/I9tcyI6V1T
Alright, so I enabled privileged gateway intents, and it works now, but for some reason it's sending 4 dms
The error means a token isn't being provided when it's sent. Since you provide the token as process.env.TOPGG_API_TOKEN, you may want to check if a value is present (e.g. logging it)
how can i get the deleted message from the message delete event? (java (not script))
JDA?
4.2.1
It seems you can only get the message ID (not the contents of the message).
JDA does not have a cache for messages and is not able to provide previous information due to limitations by the Discord API!
Source https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/events/message/MessageDeleteEvent.html
its really easy in js with similar syntax if you wish to do that
nah
Java syntax is quite different.
Does anyone know how to use botghost to make a more anvanced commands like commands that do more then reply
I'm pretty sure the only way to do that is to actually pay for the premium whatever feature they have.
Ok
stupid question. can I still call await on something that I do .then on?
Does anyone code with bot designer?
no
that isn't "coding"
There is somewhat coding
that would pretty much await whats happening in the .then i believe
yah
client.on('presenceUpdate', (oldPresence, newPresence) => {
let member = newPresence.member;
if (member.id === '173489654144696320') {
if (oldPresence.status !== newPresence.status) {
if (newPresence.status === "online" || newPresence.status === "dnd" || newPresence.status === "idle") {
client.users.cache.get("173489654144696320").send("User is online, bot is working")
}
}
}
})
``` anyone know how to get this to not send 4 dms? not entirely sure why it's doing that
tryna make a leave logger, how can i get the time of an user leaving the guild? (java (not script))
that really isnt coding
It sort of is, but isn't held to a high enough standard to be considered coding/programming
||kinda offensive to us who do proper coding||
Lol
yeah I wouldn't call that coding by almost any means lol
Does anyone know how to check how many servers your bot is in
What library are you using?
I got it
const data = await fetch(url).then(res => res.json());
Is this what you mean?
Yes ma'am @umbral zealot
It's been a few seconds since I've used js so I wasn't sure
Thanks
you guys wanna see how to make a bitwise NOT operation (~) with pure math?
function not(n) {
return -n - 1;
}
:^)
doesnt that defeat the whole point of bitwise
Js moment
I just realized chrome allows redeclaration of let in the console
I don't think they allowed it before
still need to refresh to redeclare const though
wait wat
lmao redeclare it as require and then put on github so skids go brrr
since when does chrome allow that
i've been replacing all my lets with vars every time i copy code to test in the console
With the release of Chrome 80 version, now developers can redeclare with let and class in the console.
nice
ive read this as this ts console.log(let a = 1);
and thats a good indicator i shouldnt be awake rn[
Same @quartz kindle
client.users.cache.find(user => user.id === ID).permissions.has("ADMINISTRATOR")```
it says that it couldn't read the .permissions
and yes slash command interactions doesn't give me user's permissions so i can't do anything about changing it into message.author.perms
erm you gonna have to give more detail cuz author does not having permissions
the payload it sends is a member
not a user
<author>.perms doesnt exist natively
thats what im trying to say
author is a user
not a member
okay
how do i check if the person who typed the command has the perms. from slash commands?

ngl the 25 limit for slash commands kinda fucking me up

for choices i mean
oh yeah
also slash commands are really difficult to code on discord.js like omg
its quite easy in detritus
its basically 2 requests
1 to register the commands
and the other to run the execute/run() function with the payload
thats it
register
run command
thats it

it runs the commands like you would any other
also the member.permissions gave me this
fairly certain d.js has a toString() or toArray() method
i need help for that tho
;-;;
though it would probably be better to get the channel
dammit
Perms is member.permissions btw
do you mean channel as in channel id or the whole channel data?
i think d.js is <permissions>.toString()
here
welllll
TypeError: interaction.member.permissionsIn is not a function
im fairly certain thats a thing
oh my bad
other way around
no
nono
that shuold work
wtf
:/
you can try <channel>.permissionsFor(<member>)
ohhhh
<member>.hasPermission()
that doesnt check for overrides
hmm
Overrides shmoverhides
this returns "null"
they do
its a member
not a user
What is the current code they're using though
I'm using both traditional commands and slash commands
right ok but that wasn't my question lol
discord itself sends a member payload
which is the job of the lib to parse it
Right, but, are they actually using the branch of the library that supports slash commands? Because I don't recall that was actually released on master, no?
client.channels.cache.get(interaction.channel_id).permissionsFor(interaction.member)```
try interaction.member.id instead
It's asking for a RESOLVABLE
im tryna get if they have ADMIN permissions
which this custom interaction object is not
guild member resolvables are usually either a GuildMember object coming from discord.js, or an ID.
yes, Erwin, I know how to read the djs docs, I've been using the lib for 4 years
been using it for 4 months :/
So, actually it doesn't even say it takes IDs at all
then?
yeah that should work
do it here
(interaction.member.id).permissions?
just literally add .id
it returns "null"
Are you even sure that member has permissions in that channel
no I mean specific channel overrides
there are no channel overrides
^
this works fine here
d.js moment
ok actually hold up
it's member.user.id
obviously
smh people not understanding basic object structures and needing to be spoonfed exact code
it returns "null"
it's not a guildmember
if it were, it would be released already
wait they havent updated yet?
https://discord.js.org/#/docs/main/stable/class/Client doesn't show any interaction events, so no, it's not officially released yet
:/
no thanks, already ditched that a while ago lmao
Stage channels have been in Discord.js's master branch for 3 days now
yeah ok but isn't that like for v13 at this point
;-;
i keep telling people, nobody listens
A library ain't gonna implement itself :^)
i typed interaction.member and this happened
50? imagine the bickering
50????
Yes, YT. That's an object
do you know what an object is
yes
I thought djs had like fucking 400
do you know how to access the properties of an object?
Pog I know this one
im kinda surprised to see detritus ahead of d.js
Ok good so why are you showing us an object as if you were wondering what it was or expecting some answer from us?
with that little devs
;-;
idk why there's no perms list tho
@opal plank imagine using a library with voice support smfh
it has a formula
@crimson vapor also make ur name capital again
ok so completely ignore interactions for a second
Like, that object, it doesn't exist
okay
imagine using a library that doesnt properly parse interactions 
EZPZ
yes
How do you get permissions for a channel with only this information
we get the channel info?
are you saying you don't know?
Are you making fun of detritus I can’t tell since drose has no interactions support ish
"for a channel"
detritus added it quite a few days ago, like..... this long ago

yeah and drose has no interactions support tbh
:loli_dance:
for real tho
wasnt there a very lightweight lib for discord?
snow or something?
like
im talking REALLY crude barebones stuff
more than drose
how can you be supporting detritus and mushoku at the same time
show us the code you have now
Hi, so I'm making an api using nodejs and express, and every time they visit a certain URL, it gives them a json response. Anyone know any services, or method I can use to track the number of requests my api recieves daily?
umm
I putted a random thing here
But I am not sure what to put exactly
Idk the port
well, you could possibly use prometheus, or something as simple as adding +1 to the counter everytime they hit an endpoint
that it should run at..
its up to you hoister
where are you hosting?
you could run it at 9999 if you want to



