#development
1 messages · Page 1724 of 1
how much? 
yeah sure
ok well

why wouldn't it
ok
but is there any way to do that pinging every minute thing
then i give it a try
don't
just don't do it
yeah there is
thats what he wants
but don't do it
look, I think you're misunderstanding things
Yeah it's easy, but it's discouraged so no
- its more practice
tell the man
Tell him to fuck off and you won't do things that break the terms of service
to not
thats against TOS?
yes
or tell the man "make your own bot"
very against tos
does he want to publish that bot to bot lists
yeah
Why are they making you do a bot anyways 😛
not on top.gg beacuse he can't
plot twist: his friend is himself
not appears, bot testers won't allow it
thanks for your time
anybody knows what that M char means?
modified
but i saved it
but you haven't pushed it
no you cant
what do u mean
just do git commit -m"added new files"
ok i know
you need to commit and push
🤨 why don't you want to push your changes to github
if you live with that M it's the same as not using git at all
non-committed files are still prone to being lost
because it isn't open source anymore because i don't know how to hide the token
as I said
ok it's okay for me
you can make the repo private
git commit -m"update"
then disable vcs
how
just make the repo private
I'm not english so it is a little bit hard to explain
that said, you SHOULD 1001% use git
You can delete the .git folder too if you don't want to bother
else your files are as fragile as a toast in a hurricane
make a config.json, add config.json to .gitignore, in index.js do const bottoken = require("./config.json").token. In config.json, put
{
"token":"iqurcynzoiludyfvzcknuidfxhnskjshdtgrfh,cfxnkgs"
}
did we mention we should use .gitignore to hide the config.json?
I don't think so
and make sure you hide the .gitignore by adding it to the config.json file
what did happen to replit hosting thing?
even i have console thing
the bot wont even launch
my discord bot
man it wont launch or give any log
u can see that in the code
I just told you, your app needs to be listening to a port afaik. Create a simple http server so your bot runs. you don't need to do anything with it
can i send you the repl link?
Hello guys, I have a music bot and it gives an error like how to fix it " TypeError [ERR_INVALID_ARG_TYPE]: The “listener” argument must be of type Function "
what's your code
discord js
I'm looking for a screenshot of the error pls wait just a sec
am using a npm called slappey to make it easier
why are you copypasting code
The Easy Way™️
also the product of copypasting
The Easy Pasta™️
take alook at ur dm
let 🌯 = 1;
Emojicode is a full-blown programming language consisting of emojis.
woo.eat(🌯);
console.log(🌯); // 0
how can i fix it
re-write your code in such a way that it's actually yours and in a way that you understand what it does
ur telling rewrite ur code
cant even mention them cause cancer username
mf u use eval in ur commands lol
what was the point of your message????
also what's up with eval cmds?
idk
???
i feel weird to re-write the code
u can say weird or lazy
i didn't tell you to re-write it
both works
uhh
i was referring to the person with the cancer username, not you
F
sorry then
but anyway, doesn't look like you have much code
Thanks man
a rewrite is still doable
am i the only one that rewrites code quite a lot? 👀
problem solved. but why is it giving such an error? Is there a document that explains this?
definitely not
I do that shit constantly
I just wrote a crap ton of code yesterday, planning on rewirting it next week because i am confident I can make it cleaner.
thats part of development imo.
yep, absolutely
I'm on my third rewrittten version
let's say I hope there isn't a fourth
i rewrote my entire database system yesterday to make it thread safe
oh pog
it was not fun i was about to rip my hair out
gotta say, that was more effective than I thought
maybe its just something that comes with experience, knowing and being willing to rewrite code?
he just burned u
code rewrites are something that come after you look at your code and think "damn that shit's disgusting"
then you suddenly get the urge to rewrite it
or FUCK my code is not working
nah, non-working codes are easily solvable
but not for me
proceeds to break the entire project off one simple edit
this is what I mean with "damn that shit's disgusting"
old - https://github.com/OtagamerZ/ShiroJBot/blob/c18d54620f9e2e6c5ba8219fc70b40f9387e91fa/src/main/java/com/kuuhaku/managers/CommandManager.java
new - https://github.com/OtagamerZ/ShiroJBot/blob/master/src/main/java/com/kuuhaku/managers/CommandManager.java
oml
hey at least its a zero cost abstraction
Atom added bot (7h ago)
im copying this
would it be bad to setup a selfbot to reply with that ? 
9 days to be exact, wait time is currently 2+ weeks
gl, you'll need the interfaces too
not like it would be that hard at all tbh
lol
xd
smh
and i think even detritus can do it
a bot gets declined in 6 days
my bot got declined 2 times(bcz of it being offline due to i didnt have vps, now i do)
each with 6d gap
;-;
i think
The wait time changes all the time, we don't decide the time it takes. That's just how it is
Not sure, probably in the hundreds
cause
I believe the accept rate is about 30%
thats one sketchy link
FUDGING BOT
botghost is fine, as long as they have 5+ custom commands
talk about freaking out
ik, but still one sketchy af link
Queue size
2.6K
do F
!fuck @lyric mountain
kinky
oh shit this aint general
fair assessment
my bot
i have a money or economy bot should i call it and my deposit and withdraw commands onlu work if you type how much you want to take in or put out instead is it possible to say "all"
What would i change on here to make it do that?
@client.command(aliases=['dep'])
async def deposit(ctx, amount=None):
await open_account(ctx.author)
if amount == None:
await ctx.send("Please enter the amount")
return
bal = await update_bank(ctx.author)
amount = int(amount)
if amount > bal[0]:
await ctx.send('You do not have sufficient balance')
return
if amount < 0:
await ctx.send('Amount must be positive!')
return
await update_bank(ctx.author, -1 * amount)
await update_bank(ctx.author, amount, 'bank')
await ctx.send(f'{ctx.author.mention} You deposited {amount} coins')
wouldnt this parse stuff like 000x or 0.4 for example?

dunno py, but usually people would account for decimals and other shit like that
i dont think it does
ok
A simple if amount.casefold() == "all" should do the trick, no?
it doesnt even respond if i put a decimal in the arg
ill try it
thank you
probably error'ing
Competing with Bing 👀
How to make a shown in {} guilds status
im sorry but where would i add this?
JS
a what?
yes
shown in 100 guilds
like how many servers its in on the status?
which library u using?
Yea
@twilit hemlock
read
I mean, wherever you want to really. I'd put it before the amount = int(amount)
JS
you're the one not reading
ok
Idk
of course you need something inside the if statement as well. I assume you know python
discord.js? eris.js? detritus.js? discordrose?
Discord.JS
<client>.setActivity()
I have it to set activity
use string templates to get how many guilds is in ur cache
I just need to shoe members
members or guilds?
<client>.guilds.cache.size
Sec
How can I change this to add that, I’ll just delete the randomizer
const activities = [
"Getting Created",
"Jack is good",
"OK",
];
bot.on('ready', () => {
setInterval(() => {
bot.user.setActivity(activities[Math.floor(Math.random() * activities.length - 1)], { type: 'PLAYING'})
.then(Presence => console.log(`Activity set to ${Presence.activities[0].name}`))
.catch(console.error);
}, 5 * 60 * 60); // 1000 ms = 1s, 1s * 60 = 60s (1m), 1m * 60 = 1h
});
it won’t colorize cause I’m on mobile
so what am i suppose to look?
how to add the guilds into that
onto ur activities
Yea
yea
i literally just gave u the answer
I literally just asked a question
Ok
oh, mine is just a genshin abomination
lol
like'
who needs
d!helpdm
or d!creditdm
lemme find out how many files only for commands
one second
43
43 FUDGING FILES
You what my boy?
use #general for normal chatting
good point
is using anything besides online illegal for bots?
e.g
client.user.setPresence({
status: "idle", // You can show online, idle... Do not disturb is dnd
activity: {
name: `v 1.2.3 | ${client.guilds.cache.size} servers | d!help`, // The message shown
type: "WATCHING" // PLAYING, WATCHING, LISTENING, STREAMING,
}
});```
or
```js
client.user.setPresence({
status: "dnd", // You can show online, idle... Do not disturb is dnd
activity: {
name: `v 1.2.3 | ${client.guilds.cache.size} servers | d!help`, // The message shown
type: "WATCHING" // PLAYING, WATCHING, LISTENING, STREAMING,
}
});```
not sure why it would be 🤔
String sql = "CREATE TABLE IF NOT EXISTS warehouses (\n"
+ " id integer PRIMARY KEY,\n"
+ " name text NOT NULL,\n"
+ " capacity real\n"
+ ");";
can someone help explain what this sql script does? from what I can tell it makes a table called warehouses, if there wasnt one, but idk how the \n and everything else works
@vagrant prairie the only thing thats TECHNICALYL not allowed is mobile status since its not shown in the documentation
but its rather easy to do
Oki
\n means a new line, it isn't necessary, it's just for styling ig
and the thing in the parentheses are column definitions
is that java?
if so, do yourself a favor and update to JDK 15 to use text blocks
Ok so I'm probably missing something stupid here, but I'm trying to convert youtube to mp4 files, then send them through a discord bot. How would I do this? I keep getting an error of FFmpeg/avconv not found!.
const fs = require('fs')
const ytdl = require('discord-ytdl-core')
const Discord = require('discord.js')
module.exports = {
name: 'download',
description: 'Downloads a specified youtube URL',
args: true,
usage: '[URL: Youtube]',
staffOnly: false,
CanMentionRole: false,
execute(message, args) {
let stream
let userArgs = args.slice(0).join(' ')
try {
stream = ytdl(userArgs, { fmt: 'mp4' })
} catch(e) { return console.log(e) }
stream.pipe(fs.createWriteStream('./download/DiscordVideo.mp4')).on('finish', () => {
try {
message.channel.send(new Discord.MessageAttachment(__dirname+'/download/DiscordVideo.mp4'))
} catch(e) { return console.log(e) }
})
}
}
String sql = """
CREATE TABLE IF NOT EXISTS warehouses (
id integer PRIMARY KEY,
name text NOT NULL,
capacity real
);
""";
way better
you need ffmpeg configured on your system
If you’ve installed Ffmpeg through their website and it still gives this error just do npm install ffmpeg-static
I get a ton of errors whenever I do npm install ffmpeg-static
Such as?
nvm, just uninstalled and reinstalled it
So close, yet so far. Anyone know what's going wrong here?
can't you directly pass the stream to send
What would I do instead?
im ngl
Yes its java, the dependencies im using have to use 8 I think, but ill check.
id like that bot
don't pipe the stream into a file
instead
just pass the stream to the MessageAttachment constructor
you'll have to provide the file name too
you can do that in the second argument of the MessageAttachment constructor
djs will automatically consume it
If I'm never saving the file, how am I supposed to provide the file name?
the file name is sent to discord
it's not for saving locally
it's just so discord knows what to name the file
you can't have nameless attachments
in every command?
just your handler lol
Now I have this code: ```js
const fs = require('fs')
const ytdl = require('discord-ytdl-core')
const Discord = require('discord.js')
const ffmpeg = require('ffmpeg')
module.exports = {
name: 'download',
description: 'Downloads a specified youtube URL',
args: true,
usage: '[URL: Youtube]',
staffOnly: false,
CanMentionRole: false,
execute(message, args) {
let stream
let userArgs = args.slice(0).join(' ')
try {
stream = ytdl(userArgs, { fmt: 'mp4' })
} catch(e) { return console.log(e) }
//stream.pipe(fs.createWriteStream('./download/DiscordVideo.mp4')).on('finish', () => {
try {
message.channel.send(new Discord.MessageAttachment(stream, 'DiscordVideoFile'))
} catch(e) { return console.log(e) }
//})
}
}
``` Is this what you meant? I'm not sure if something is going wrong with downloading the file or if I'm doing something wrong with the MessageAttachment, but it hangs for about 20 seconds, then throws (node:15480) UnhandledPromiseRejectionWarning: AbortError: The user aborted a request.
yeah, it's what i meant
that error is occuring at the ytdl line
try catch is useless at the send part because you aren't awaiting it
wait nvm
it's occuring at the send
just noticed the unhandled promise
side note, you should add .mp4 to the file name
anyway
have you tried a shorter video or something?
also
it'd be nice if you could provide the entire stacktrace
"have"?
Trying a 2 second video rn
WHAT kind of filthy dependencies are those that still require 2000's java?
UnhandledPromiseRejectionWarning: AbortError: The user aborted a request.
at RequestHandler.execute (C:\Users\jacks\node_modules\discord.js\src\rest\RequestHandler.js:93:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (C:\Users\jacks\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9656) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
like, java 1.8 is the reason java's reputation is so low among starters
yeah that stacktrace isn't detailed
make your execute method async
and await send
you should get a much more detailed stacktrace
I feel like something is going wrong with the ytdl line, I have no idea if I have to be using encoderArgs or something
new error is this
at RequestHandler.execute (C:\Users\jacks\node_modules\discord.js\src\rest\RequestHandler.js:93:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (C:\Users\jacks\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
at async Object.execute (C:\Users\jacks\Desktop\WaffleBot WIP\commands\download.js:21:17) {
code: 500,
method: 'post',
path: '/channels/748573140766031923/messages'
hm
code 500 means internal server error
which means the error isn't on your side
rather, it's on discord's
Perhaps something is going wrong with the ytdl line causing discord to not like it?
doubt it
it could be your internet speed hanging the connection for too long
but again
for a 2 second video
to hang it for so long
My internet speed should be plentiful for that haha
@vivid fulcrum can u tell me the code
no
pls?
how much are you willing to pay


you do know you can just you know... regenerate your bot token right if he has access to it 
If you're having trouble, a quick google search of "How to get a bot in discord.js/discord.py to ignore other bots" should answer it
big brain
ugh, discord-ytdl-core isn't very popular so there's not a lot of things out there surrounding it
Command is not defined. It's probably not in any of those maps you're trying to retrieve it from
it is..
log it and you'll see that it isn't
they use lambdas, and it got pissed off when it defaulted to 11
so idk
ill look
lmfao
np
discord-ytdl-core hasnt been updated for almost an entire year
nvm
i was looking at the wrong repo
Crap, it doesn't get sound though
yeah uh
From what I'm seeing 360p and above need to have sound grabbed separately
for higher quality videos, youtube doesn't return the video and the audio combined
yeah
you need to download separately and mux
client.on('messageDelete', async (message) => {
const logs = client.channels.cache.get('835389487134932992')
const entry = await message.guild.fetchAuditLogs({type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first())
let user = ""
if (entry.extra.channel.id === message.channel.id
&& (entry.target.id === message.author.id)
&& (entry.createdTimestamp > (Date.now() - 5000))
&& (entry.extra.count >= 1)) {
user = entry.executor.username
} else {
user = message.author.username
}
logs.send(`A message was deleted in ${message.channel.name} by ${user}`);
})
How can I show the message too?
message.content
message.content?
continent
meh, too lazy to do that rn, just gonna limit the quality option to 18 instead
18p
are you yet another speedrunner?
Okay this is gonna sound stupid but... How do I edit a message sent by my bot in discord.js?
Nevermind, I'm just stupid

Hey
does anyone know how i would create a math bot for discord.py?
im not sure how to get the bot to recognize certain things you say like a certain number
you should check out sympy for that
K ty
message.edit()
After about 2 hours of troubleshooting, I'm finally realizing that my package.json file did not have discord.js listed as a dependency, and that's why my host wasn't working. I hate life so much.
dont hate life, life is beautiful
i neeed meme api
like this
https://meme-api.herokuapp.com/gimme
but indian
need
I dont know any meme api's
use reddit if there is indian meme subreddits
@lean ivy If you want absolute permission/error handling then you could check for the permission every time you perform an action that would require a particular permission - but, a framework could make it a lot less code to write.
Most publicly available frameworks won't do that though. You could write it yourself easily.
i cnt know about this api i make newly
so
i need
how else you gonna do that
yeah sure I have the initial "hey I need these perms"
spoonfeeding is not allowed
but checking every action afterwards that yall call optional
soory my english is not good
and cancelling if it cant do it
Reddit gives you the best of the internet in one place. Get a constantly updating feed of breaking news, fun stories, pics, memes, and videos just for you. Passionate about something niche? Reddit has thousands of vibrant communities with people that share your interests. Alternatively, find out what’s trending across all of Reddit on r/popular....
what library are you using?
djs
I use Akairo (a framework for djs)
oh ezpz, one sec
I still dont even know what youre describing
Bot that snipe messages plz
What I'm describing is a way to check for permissions and perform certain actions without having to rewrite the same code hundreds of times.
I know what a command handler is
After all that's pretty much the purpose of functions.
How do we do a bot
No, not a command handler
youre calling the function anyway are you not
You're missing what I'm saying.
What I'm saying is that you could perform the permission checks and error handling in separate functions that you call in each command, rather than writing the code over and over again.
id rather just modify djs
You could do that. Or you could modify an existing framework.
Or, you could just build on top of your own bot, which may be the simplest way.
from a practical perspective thats what your doing.
you can easily add a method to djs reactions which does the check built in.
To a certain extent, Structures.extend exists for this purpose
^
does djs actually send the request before throwing an error or does it already do the check itself
depends afaik.
^
Well
If it's doing something that requires permission, obviously it needs to send a request
no clue what that is but thanks for trying to teach an idiot
From what I know it doesn't cache permissions or act on them if they exist
It'll send the request and if Discord's API says you have no access, it'll say so respectively
I thought you meant for permissions
There's a way to check permissions without having to send the request
I know
if(message.guild.me.has("manage_messages") reaction.delete();
^ this is all you realistically need to do to not require the permission.
this
I know
power might go out im scared
thats actually less effective
oh no fun
because the bot could have it in the channel
What I was talking about before, I actually have an idea to just shorten this
if you wanted to do it by channel that works too.
youre calling that a framework?
No
ok good
Wouldn't be a framework so much as just utility functions
I like your funny words magic man
What I'm saying is that if, in your commands, you run the same exact code for lots of commands, you can just move that code to a separate function, then just call it and pass the necessary parameters (channel perhaps, etc.). Then you can do that for every new command that you will need to use the same code in, without having to rewrite it all.
That, and if you end up changing it, you won't have to do it for every single command that uses it, it'll just be changed in the function.
something I would recommend you doing with your reaction menu actually since you seem to have quite a few.
Actually I'm gonna write this down for my next rewrite so I don't forget. I'm realizing how much code I reuse right now lol
👀 yeah rewirting some stuff currently due to this same issue.
id rather not have to require a new module each time and just check for the perm
i mean its a lot more than just that.
its a time saving measure for modifications down the line
Its more about maintainability
Easier to maintained code inferred on than reused numerous times
ill just modify djs
like, if you did this from the get go, it would be a literal 2 minute fix to solve this for all your commands
That's a valid way to do it, but those changes won't carry over to if you reinstall/update djs.
Ill just maintain my own fork if it comes to it kek
interfacing with Discord.js' Structures class is pretty cool, but internal stuff might change you override and stuff will break. What I've learned to do is to just make my own proprietary libs based on my needs which has worked out well for memory efficiency and being able to correctly infer types and such
More of an advanced topic though
Pain in the ass to offer feature parity when making modular interfaces such as a rest only lib and a gateway only lib. Writing a layer to merge the two would suck
hi
im using js
and the guy said to use <client>.guilds.cache.size
to display severs in my custom status.
idk how to implement it tho
const activities = [
"Getting Created",
"Jack is good",
"OK",
];
bot.on('ready', () => {
setInterval(() => {
bot.user.setActivity(activities[Math.floor(Math.random() * activities.length - 1)], { type: 'PLAYING'})
.then(Presence => console.log(`Activity set to ${Presence.activities[0].name}`))
.catch(console.error);
}, 5 * 60 * 60); // 1000 ms = 1s, 1s * 60 = 60s (1m), 1m * 60 = 1h
});```
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})```
?
ur asking a non API question on the discord?
well i guess this isn't the API channel just assumed my bad, i dont kode in JS so idk
soz
this isnt api chat
This is #development not #topgg-api
anyway
You'd have to put the activities Array within the ready event as guilds would be empty before ready and the value would be static as the context it's initialized in isn't being executed more than once
You don't have to
if you want to use bot.guilds.cache.size, just put the Array in the ready event and you can use it in one of the strings, although that will only get you the current value of the guilds cache size from when your client reaches the ready state. It won't update unless you declare a function or getter to get the current value of the guilds cache size
yea idk how to do that
You're telling me you don't know how to copy some lines of code and paste them somewhere else?
uh that sounds ez
That's literally all you have to do
ok well ill see
and then you can use the guilds cache size to get the number of guilds your bot is in when it reaches the ready state
and include that in one of the strings in the Array
how do i make it so when someone votes for my bot on top.gg my bot sends a message to a channel i picked

how do i update my code in github and heroku
i have new code i need to add
idk what to type in terminal tho
it says its up to date but it isnt
nvm i figured
ok working now
#topgg-api is regarding the TOPGG api, not discord, thats meant to be talked in here in #development

@twilit hemlock pretty sure i was fairly specific as to how you were suppose to add it
read these
https://www.w3schools.com/js/js_arrays.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Template literals are string literals allowing embedded
expressions. You can use multi-line strings and string interpolation features with
them.
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
@twilit hemlock read above ^^. EVERYTHING. otherwise you just gonna stay stuck here asking the same question over and over
np
any specific questions, just ask
but you need to know those basics to even understand the explanation for most of the stuff you need
lib: ["es2015"]
Hello
compilerOptions != complierOptions
smh, fucking typo
got a console error - can someone help (node:234) UnhandledPromiseRejectionWarning: VersionError: No matching document found for id "60881571964e0b0d32c71224" version 249 modifiedPaths "pokemon, time, pokemons" at generateVersionError (/home/runner/TrivialParallelYottabyte/node_modules/mongoose/lib/model.js:421:10) at model.Model.save (/home/runner/TrivialParallelYottabyte/node_modules/mongoose/lib/model.js:478:28) at module.exports (/home/runner/TrivialParallelYottabyte/events/message.js:147:19) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5)
when you finally make a bot for beta testing and realize how nice it is when you do it right
yeah
My bot is on over 500 servers and now it just seems to crash for no reason whatsoever. I get no traceback and it just seems to happen at random times
Is there any TS discord lib?
u use .save() for update documents?
I had this error before so you should use something like
const data = await Data.find({_id: 10}); // {_id: 10, value: 0}
data.value = 1;
// Normal (might catch error)
await data.save()
// Better one
await data.updateOne({value: data.value})
some more infos, looks like you use MongoDB, and the id you query for is not aviable
there are 2 of them watch out
there are 2 libs on npm called detritus, the one ive sended is the correct one
ok but the docs . . . smh
so there are no docs?
page works for me
or just ask @opal plank he will probably berade you using it for the next days if he need to
I got IP blocked?
bruhhh
@lusty quest wait send me the link?
myabe the url is wrong
ahh it is normal
wrong reply
.-.
oops
@pale vessel but any idea?
I wanna read the doc
The docs is not so great
The docs isn't that useful anyway
You're better off checking the source code and use intellisense
Not beginner friendly
bruh
It's true
The docs only show classes and their methods and properties
No examples either
ig I will stay with d.js
hey you said here that one can get 20 months on vultr if they have a card but it said that your credits will expire in a month , did i do something wrong or is it some type of limited offer
Cómo puedo tener la ID de un emoji
my bot suddenly goes offline while testing
this message not showing in console
just saying like this
you should resolve the pending promise
You get 50$ on Vultr if you sign up with credit card.Nowadays I see a lot of ppl saying that the The credit will expire in a month. But If I remember I used the 10$ VPS for 5 months that time.
also did you call your ready.js somewhere?
Are you repl.it premium or using UptimeRobot ?
bruh repl sleep if we dont watch it every 10 mins
Uptime
show where you're using the function
I mean like inside client.on("ready" or something
This ?
yea
if the ready event is not triggering that means the bot is not logging in
How to solve
const discord = require('discord.js');
const client = new discord.Client({ disableMentions: 'everyone' });
const { Player } = require('discord-player');
const keepAlive = require("./server");
client.player = new Player(client);
client.config = require('./config/bot');
client.emotes = client.config.emojis;
client.filters = client.config.filters;
client.commands = new discord.Collection();
fs.readdirSync('./commands').forEach(dirs => {
const commands = fs.readdirSync(`./commands/${dirs}`).filter(files => files.endsWith('.js'));
for (const file of commands) {
const command = require(`./commands/${dirs}/${file}`);
console.log(`Loading command ${file}`);
client.commands.set(command.name.toLowerCase(), command);
};
});
const events = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
const player = fs.readdirSync('./player').filter(file => file.endsWith('.js'));
for (const file of events) {
console.log(`Loading discord.js event ${file}`);
const event = require(`./events/${file}`);
client.on(file.split(".")[0], event.bind(null, client));
};
for (const file of player) {
console.log(`Loading discord-player event ${file}`);
const event = require(`./player/${file}`);
client.player.on(file.split(".")[0], event.bind(null, client));
};
keepAlive();
client.login(client.config.discord.token);```
index.js
introduction the right way to use code blocks ```js
const fs = require('fs');
const discord = require('discord.js');
const client = new discord.Client({ disableMentions: 'everyone' });
const { Player } = require('discord-player');
const keepAlive = require("./server");
client.player = new Player(client);
client.config = require('./config/bot');
client.emotes = client.config.emojis;
client.filters = client.config.filters;
client.commands = new discord.Collection();
fs.readdirSync('./commands').forEach(dirs => {
const commands = fs.readdirSync(./commands/${dirs}).filter(files => files.endsWith('.js'));
for (const file of commands) {
const command = require(`./commands/${dirs}/${file}`);
console.log(`Loading command ${file}`);
client.commands.set(command.name.toLowerCase(), command);
};
});
const events = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
const player = fs.readdirSync('./player').filter(file => file.endsWith('.js'));
for (const file of events) {
console.log(Loading discord.js event ${file});
const event = require(./events/${file});
client.on(file.split(".")[0], event.bind(null, client));
};
for (const file of player) {
console.log(Loading discord-player event ${file});
const event = require(./player/${file});
client.player.on(file.split(".")[0], event.bind(null, client));
};
keepAlive();
client.login(client.config.discord.token);
also I have no Idea what I'm looking at
why did you load player events?
In main file everything right then why not logging I don't know
where is the ./events/ready.js ?
Is any prblm
also its possible that something in your ready event causes it to not get executed
3 min I'm now eating
^^^
Ok
just comment out everything inside the function in your ready event and just make a simple console.log instead
Lemme check
alright thanks for confirming
y’all know bout the new voice chat stage, is there a way I can see if a voice channel is a stage or not
Check it's type 
Error: Client network socket disconnected before secure TLS connection was established
some context?
i can send the full error if you'll like me to
i will take it as a yes
well you just send in a error, with no explanation from where, and what you use
i did not use any command or anything
this error just randomly pops and sometimes make the bot crash
music bot?
nope
is there more to the stack above?
that is all
you run it on your pc right?
no
did you run it with nodemon in production?
it crashed so i contacted the host and they said that they downloaded it so it will turn online when it crash
never use nodemon for production, its not ment for it, use pm2 instead
also pm2 can restart the process if it crashes
what about the error tho?
so bcs of your error, i dont see from where it comes, looks like Discord, but i dont get it, does it happen all the time when it starts or just randomly?
@gilded plank
randomly
and sometimes it does not even crash it
did you run some sort of proxy for your connection?
wdym
How does user token work, anyone?
what token
I smell someone that's about to selfbot
If you mean the discord one, it only works from the client, don't try to get it or use it, ever.

pardon what more info will u need ? can u specify pls
at generateVersionError (/home/runner/TrivialParallelYottabyte/node_modules/mongoose/lib/model.js:421:10)
at model.Model.save (/home/runner/TrivialParallelYottabyte/node_modules/mongoose/lib/model.js:478:28)
at leveling (/home/runner/TrivialParallelYottabyte/events/message.js:250:16)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async module.exports (/home/runner/TrivialParallelYottabyte/events/message.js:47:5)```
A Message.js console error
how did you query your database?
it looks like the ID you want to query is not aviable
oo
i use mongoDB for database and at the line where it shows error is await user.save(); , idk what is wrong here
I don't know, I'm not learning it, but people say that got their discord token leaked, like what??
Probably they were stupid and used client mods that grabbed it
or installed shady software.
ok?

if i add monogo db to my bot, then bot will work faster ??
mongodb is a database
what are you using rn
bot will be more memory-friendly
o
databases if anything else would add more processing time, not remove it
So how can i make bot faster
with better and more efficient code
O
Ok got it
:)

dude
my bot is added into 100+ server
now
how much time discord will take to verify
About a month
WTF
can't blame them tho, although it was the decision of having a bizarrely small server cap
They've made some mistakes for sure. Right now it's just a question of pure volume
If you describe everything properly then a month
If you skipped some parts (eg Your bot has NSFW commands and you forgot to mention that it only works in NSFW channels) then it'll take twice the time
and It'll take 2months++ for intents verification
*whitelisting
mine took 1 month for guild_members + verification then 2 months for guild_presences (I forgot to ask for it during verif)
@earnest phoenix
hey guys!
so i have a question, is there any way to retrieve a deleted embed by id?
or any deleted embed by any chance
not particular id
client.channels.cache.get("735243676460253225").messages.fetch(queueMessageId).then(queueMessage => {
const userToRemove = user.userId;
const userRemoved = removeUserFromQueueByUserId(userToRemove);
assembleQueueMessage();
if (Config.useEmbeds) {
queueMessage.edit(embedQueue.setDescription(queueMessageText));
} else {
queueMessage.edit(queueMessageText);
}
})
);``` i am constantly editing the embed as you can see, but there are cases where the embed could be deleted.How would i ever retrieve that embed?
does anyone know why he kick an account older then 30 days?
he must kick members under the 30 days.
const status = new db.table(`protect_guild_${member.guild.id}`);
if (status.fetch(`status_${member.guild.id}`) === 'off' || status.fetch(`status_${member.guild.id}`) === null){
return;
}else{
member.guild.members.cache.each(async member => {
const date1 = new Date(member.joinedAt).getTime();
const date2 = new Date().getTime() - 30 * 24 * 60 * 60 * 1000; //30 is 30 days
if (date2 < date1) {
await member.kick();
}else{
return;
}
});
}```
did you mean to reply to someone else, because I'm already aware of what the channels are for. I was stating the difference to someone else who was questioning the validity of asking a discord.js question here and they suggested #topgg-api

no, what's deleted is deleted unless you store them in a cache
because you're specifying that all accounts older than 30 days must be kicked
no, wait
you changed that didn't u?
no that is the code i have not edit that
but he stay kick member older then 30 days
and idk whats wrong
const status = new db.table(`protect_guild_${member.guild.id}`);
if (!(status.fetch(`status_${member.guild.id}`) === 'off' || status.fetch(`status_${member.guild.id}`) === null)) {
member.guild.members.cache.each(async member => {
const date1 = new Date(member.joinedAt).getTime();
const date2 = new Date().getTime() - 30 * 24 * 60 * 60 * 1000; //30 is 30 days
if (date2 < date1) {
await member.kick();
}
});
}
there, much better to read
i will try the code 🙂
oh but whats wrong do you know that
oh okay
that code seems fine tho
member account was created 01/01/2021
mb2 account was created 01/04/2021
member will not be kicked, mb2 will
so i can try the code? if it now working
it's essentially the same code
all I did was this
flipped the first IF condition and removed the second
because the second would make the bot exit iteration if date was older than 30 days
not working he will kick me 2th account is older then 30 days
the issue ain't in the code you showed then
actually...
put this ```js
console.log("date1: " + date1)
console.log("date2: " + date2)
here
then show the output
@lusty quest @willow mirage
Yall need detritus help still?
How do I get a user by ID? I tried:
let user = client.users.cache.get("USERID");
But it only returns undefined
the user won't be cached depending on your client's intents. If you have GUILD_PRESENCES, they'll almost always be cached. If you have GUILD_MEMBERS, they'll show up in cache when their membership gets updated like join or update. If you have guild messages and/or DM messages, then they'll show up when they send a message. If you have voice states, then they'll show up when they join a voice channel iirc or on GUILD_CREATE when Discord sends all users already in a voice channel
what should I use instead?
clients.users.fetch()
fetch will check if the user is cached and if not, fetch it from Discord
be careful with fetch, though since it has a limit to how often you can use it
I use this code to get the user
let user = msg.mentions.users.first();
But want to get the user by ID now (args[0]) How do I do that?
I tried
let user = client.users.cache.get("USERID");,
Client.fetchUser(id) and this
client.users.fetch('IDHERE')
But this didnt work
var
v a r
doesn't most IDEs warn about var usage?
I mean, at least intellij does, it throws a big yellow waning whenever you try to use it
BROs I dont care about vars lets const etc, I can change it in the end, but thats not the point!!!
maybe that is exactly the point
you really don't know what's the issue with var do you?
i found the best free host: https://deno.com/deploy
(yes, deno has a .com domain too)
I do
then what's the issue with var?
so just tell me how I get the user by ID, please
var b = 10
console.log(b)
var b = 20
[log:20]
hoist
ok, nice, at least you're aware (btw that code wouldn't be runnable because u use var b twice)
And now tell me how I how I get user by ID please....
i get this
date1: 1617788408651
date2: 1617026275017
date1: 1619504147083
date2: 1617026275019
date1: 1619618274897
date2: 1617026275019```
wtf is Client.fetchUser
what did client.users.fetch(id) return?
from stackoverflow
also, console.log what's being passes as id
I searched for it in the internet
me and the bois copying code from a website that has an "intended feature" in it's name
what should I log? user = msg.mentions.user.first()?
who's the first user there?
that is me 2th account
console.log('IDHERE')
Bro, If you dont know sth, then you search for it in the internet. If you find sth, you try it. Got it?
hey! How do i add a role to a bot? I have this code but it gives me add of undefined error:
const botrole = client.users.fetch('745253908275920986') // this is my bot id
botrole.roles.add(vip)
i have the code in the guildMemberAdd.js event
you have to resolve the promise from fetch
aha
ok wth why are you fetching a user and applying the value to botrole
got m, thanks.
var role1 = member.guild.roles.cache.find(role2 => role2.id === "role id here");
member.roles.add(role1);```
you need to get a guildmember
Users don't have roles
you cant add roles to a user
somebody send 5head emoji
No it didn't what 
sorry, i was lookin wrong.
You can use <Guild>.members.fetch() to fetch the member and add the role
seems fine tho, first date (date1) is older than second date (date2)
do you know whats wrong
thank you!
i know but idk whats wrong
sorry that i am interrupting, but are you dutch?
ja ik ben nederlands
imagine debugging working code
you're kicking accounts newer than 29/Mar
dm me maar is denk makkelijker
the account is created in 2017 🤷♀️
wat leuk! Zie weinig nederlanders hier.
to make it easier to think logically, do this: const diff = new Date().getTime() - member.joinedAt
klopt
huh wdym
then if (diff < 30 * 24 * 60 * 60 * 1000) //kick
that'll get the difference between creation date and today
Who has a lot of knowledge of js?
I want to start learning it but I need a few links on where to start learning like a js learning website....
i don't get it now where i must put the 2 lines
Very much appreciated, thank 😋
inside your user iteration
where you check if date is bigger than the other
remove everything inside
i wok with date1 and date 2 not diff
and put this const diff = new Date().getTime() - member.joinedAt
that's the thing
diff is a better replacement
since you get the difference between two dates
it's way easier to check if account is older/newer than X days than checking two dates
so?
if (!(status.fetch(`status_${member.guild.id}`) === 'off' || status.fetch(`status_${member.guild.id}`) === null)) {
member.guild.members.cache.each(async member => {
const diff = new Date().getTime() - member.joinedAt();
if (diff < 30 * 24 * 60 * 60 * 1000){ //kick
await member.kick();
}
});
}```
you should dm them before da kick
no that is not required
its say
member.joinedAt is not a function
use member.joinedAt then
I gave an example
yes, that
just fix joinedAt
i have try it and he stay kick the account older then 30 days
can i send you a dm?
no
so you can join you will see that you will kicked out of the server. i don't know why 🤷♀️
then it's not older than 30 days
well account created in 2017
are you 100% sure?
yes
On my vps, I have a dashboard on my bot that I want to launch on a specific port and I can only launch it in port 80 (suddenly apache is turned off).
But how can I do so that when a person puts the link to the site, that his dashboard site loads with the port of the latter but that the port is not displayed in the url (it's in js and ejs the dashboard) and apache is started
idk
I tested for the first
ah, I know why
you're using joinedAt
joinedAt is the time which the user joined the server
not the time accout was created
have you tried reading the docs
ah dutch
yes i have read it, sometimes I also make a mistake.
so you never make a mistake? do you want to say?
ad
fuck off 🖕
no making ads
@rustic nova acc modding
nP
client.on("presenceUpdate", (oldMember, newMember) => {
if(oldMember.presence.status !== newMember.presence.status){
const channel = member.guild.channels.cache.find(ch => ch.id === '836250294480142366')
channel.send(`${newMember.user.username} is now ${newMember.presence.status}`);
}
});```
no error but bot is not sending message
I swear it's the simplest things sometimes. ```js
if(message.mentions.users.has(client.user.id)) {
message.reply(My prefix here is ${config.prefix})
return
}
Wait I'm so stupid
nvm fixed it
solved?
Yup





