#development
1 messages ยท Page 1580 of 1
:)
show full error
Thank u
np
ITS FULL ERROR
show whats around that code then
is that python?
idk about discord.py but ic you can't literally write "MY TOKEN" inside the client.run
i assume he just removed it
oh
so he wouldnt leak it here
xD
SEE
i removed as you were not coming
@opal plank
๐
the issue is that i dont use py, so i dont really know whats wrong syntax wise in ur code
oh
hi guys how can i do my bot 7/24
vps
U didnt close brackets
buy a VPS
Saumil
where can i find free?
Question
In Discord.js how would you make a message that deletes and resends every 15 minutes?
seen it
most free VPS are kinda shit, but you could try repl or glitch
Np
lol
i have glitch but i cant do 7/24
you'll never find a decent free vps
Sometimes python says the error in on line x but its actually on the one above
is it possible?
auotmation is bad, but you can do a setTimeout(), such high time shouldnt be too bad
yeah but how would it resend
thats why i siad free vps are shit, they dont work all the time. its best to buy one for as cheap as 5 bucks a month
5 dolarrs in month
right?
setTimeout(
client.channel.fetch(id)
channel.messages.fetch(message)
message.delete()
channel.send(message)
)
something along those lines, that should give u a rough idea
ty
stuff like Digital Ocean or some other vps are super cheap, yes
Also, you can try repl or glitch and use UptimeRobot to maintain your bot 24/7 for free
@quartz kindle prob has some nice vps, i recall him using a nice and cheap VPS
glitch dont do ping services anymore
erwin is helping to everything that breathe in this channel @opal plank
heheh
tim uses galaxygate 2usd iirc
I can tell you he only has 1 vcore and im pretty sure he uses galaxy gate
that sounds about right
imagine pinging @quartz kindle multiple times, smh
Hi, i want to know how can i get just the Twitch connection username
Picking just the info underlined by yellow
yeah its not like @quartz kindle is idle or uses browser instead of app
yea imagine @quartz kindle getting pinged
you cant, thats only able to fetched by a user's account
lmao
@quartz kindle sorry for ping but how you got notable member role
bro
actually, i just had a brilliant idea
what about Erwin 
tim, you still there?
imagine @quartz kindle being happy by our pings
ye
heres the question
no he ded
lol
you ever gonna compile the list of cheap VPSs tim?
what happens if you try to login in browser with a bot token?
Oh Erwin, im sorry, i was think bot can get it cause is a public info in your profile
can you even render/login with one?
But ok
!?!?
Thank you, i think
np
you could, not sure if you still can
i dont wanna try because its likely instant ban
lmao true
you wouldnt recieve the data anyway most likely from the users
cuz gateway
the list i wanted to make would require buying them or people who actually have them to participate
i was wondering if you could bypass it by scraping the browser version
so idk
but i forgot you dont even get the info
good point
#development message was a ghost ping Tim
^^
lol
imagine ghost pinging
I do it on accident often tbh
@quartz kindle sorry ^^) TvT
like ill go to ping someone and a new username will come up and fuck everything up
lmao
discord caching
How do I get my bot to restart automatically?
how you have status like that ?
do only bot developer can do that ?
no, thats using Discord's SDK
ok
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
5dollar is 35,12 in my country turkey :c
i do it but its sometimes close .d
2.75 actually
if you have a credit card or a debit card, use google f1-micro, its free, you only pay for the excess bandwidth, which will be like a few cents per month
in turkey 1 dolar is=7,02
if you absolutely cannot pay and have no cards, your best option would be repl.it i guess
๐ค
hiiiiiiiiii
im new
im not a student
can someone give me an example
You need to use OAuth to get the user's connections
does setTimeout works that way?
dont work
You should use setInterval instead of setTimeout ig
gotta translate to js @compact prairie
what
Ok, i use the oAuth2 page on Discord Dev?
And i redirect for /users/@me/connections ?
Yes, make sure you have the connections scope
Have a read on https://discord.com/developers/docs/topics/oauth2
It's a little complicated if you never worked with OAuth before
but that's the only way
guys, do I need a VPS for my bot to be 24/7? So there are no different free things
Yes
pretty much yes
Yes, there is (for example) UptimeRobot to maintain it 24/7 on repl or glitch
.....ok
is there a way to make this repeat?
message.channel.send(embed).then(async m => {
await m.delete({timeout: 5000})
await message.channel.send(embed)
})```
oh i do the UptimeRobot but its down everytime .c
setInterval @compact prairie
yep, you shouldn't uptime your glitch project
i think you can get a free year on aws
Are you listening to the UptimeRobot's requests?
what the site name aws?
how do you set a time
use setInterval Function
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Toy vivo');
});
app.listen(3000, () => {
console.log('Barnie iniciado.');
});
amazon web services
oh ok sir ty
like setinterval has a callback
setInterval(function, time in ms)
is it need my card number or anything of my card?
Yes
believe so but you can just cancel after the trial ends
i dont get setInterval @crimson vapor
oh
both google and amazon offer a free vps for 12 months
but you do need a card to create an account
additionally, google has a vps called "f1-micro" which is still free after the 12 months expire
now its saying channel isnt defined
run: async function(client, message) {
setInterval(function(client, message){
const embed = new Discord.MessageEmbed()
.setTitle('hi')
.setDescription('hey')
message.channel.send(embed).then(m => m.delete({timeout: 5000}))
}, 5000);
}```
define it
how
channel or message.channel?
message.channel
are you sure you're showing the correct portion of the code
oh
make sure you provide the correct params
its not channel that is undefined
that dont make a difference
its "cannot read property channel OF undefined"
C:\Users\KPC\Desktop\Discord Bots\JavaScript\NitroBot\commands\information\ey.js:18
message.channel.send(embed).then(m => m.delete({timeout: 5000}))
^
TypeError: Cannot read property 'channel' of undefined
at Timeout._onTimeout (C:\Users\KPC\Desktop\Discord Bots\JavaScript\NitroBot\commands\information\ey.js:18:21)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
meaning whatever is BEFORE channel is what is undefined
check your handler ig
not channel itself
what
oh
but idk whats undefined
what is before channel?
setInterval(function(client, message, args){
const embed = new Discord.MessageEmbed()
.setTitle('hi')
.setDescription('hey')
message.channel.send(embed).then(m => m.delete({timeout: 5000}))
}, 5000);```
message
but
then message is undefined
it is
because setInterval doesnt give you any parameters
how do i define it
when you do setInterval((abc) => {})
that means you want to GET abc from the interval
but the interval doesnt give any values
oh
so you get undefined
how do i define it
you want to use the message that already exists outside the interval
so just dont define any arguments in the interval itself
plus wouldnt it be easier to just tell me that message is undefined than telling me the thing brfore channel is
๐คฆ
setInterval(() => {})
^ nothing here
k
thats how javascript works
ik
it doesnt have anything against undefined values, you can use undefined values anywhere you want
but its annoying
but you cant access something else from an undefined, thats why
oh
btw, i hope you dont run that command more than once in the same channel
is it against the tos to write anouncements like bot updates over the bot. with a command that is saved over a specifig users id?
if your user opted in to receive announcements, no
autoposting message without users concent is probably a bad idea. i recommend either making a command !news, setting an opt-in feature so people can recieve stuff, or instead have an ANnouncements channel where people can subscribe on your support server
i ment like for bot updates use anounce setup and then the bot will make a channel extra for it
make it opt-in, not opt-out, and it should be fine
ok thanks for your time ๐
np
is there a way to check the amount of messages in teh bot's cache
Use the reduce method on the client.channels.cache collection
make sure to filter out voice channels
no messages
yes... you can get the all the messages this way, channel.messages.cache.size
client.channel.messages.cache.size
no
how do you define channel
you run the code inside the reduce callback function
it's the second parameter of the callback function
yes
no... not at all
inside the reduce callback function.
channels.reduce((accumulator, channel) => /* You have access to channel */, 0);
oh okay ty!
Note that just by putting the code I gave you inside the callback function won't give you the total amount of messages
You have to add the amount of messages of the current channel with the accumulator. You also have to check if the channel is a voice channel, and in that case you should add 0
basically, there is no total number for all channels, but each channel has its own messages
so you need to go through all channels and count the messages for each channel
the reduce function is basically a simplified way to do this ```js
let total = 0;
for(let channel of client.channels.cache) {
total += channel.messages.cache.size;
}
but is it faster 
x doubt
benchmark time
on it
just another day in #development
ah yes
Ah no
fighting over code because one solution is 0.0001ms faster than the other

typical #development stuff
MY CODES BETTER.
not fighting
I'm just curious if the if one is fatser
My. Code. Is. Better!
damn
did i miss the day where array methods were made faster than for loops
discord.js uses a for loop internally for reduce
forEach = 3000ms
so in the case of collections, a regular for loop is probably a little faster than Collection#reduce
possibly
Collection#reduce also does a bunch of checks to check if the collection is empty etc
I won't cause I agree
no
TYSM
whats that splash image on the docs lol
it needs to be dumb-proof
:o
it's a language feature
how can i retrieve The user's name who voted from on_dbl_vote
from that data parameter
lib?
discord.py should have something like client.get_user(id_here)
well why not use that?
But How can i Pass The ID There
I Dont Know How to retrieve anything from That Data
data['user']
oh
Thx
you need to cast it as int though if you use get_user
Can it be used as a @client.event ?
you can use print(data) to view the data structure too
oh
bot.dispatch will dispatch the event to bot's attr and external listeners
Yeah but why check if initial value is undefined and run a different loop based on that?
let accumulator = initialValue;
if (!this.size && typeof accumulator === "undefined") // Reduce of empty collection with no initial value...
for (const [key, value] of this) accumulator = fn(accumulator, val, key, this);
return accumulator;
Doesn't this do the same thing, except it's more readable and simpler
can you put a link for another discord bot site (for voting) in my bot?
on_dbl_vote
I wasn't only asking that, I also gave an answer.
didnt understand
err
๐
๐
Thx For Help
But I Will need to pass that Token and other things
Yes, when instantiating the DBLClient object.
So WHere to pass that?
DO I Have to make Some cog thing?
not necessary
So In The event only ?
Hey how to make a leaderboard?
leaderboard for what?
It's pointless if you only setup the listener but not the webhook. Nothing is gonna fire the event itself.
Users account balance
ty for reminding me that I need to make a command
Most likely leveling, currency, etc
Yes
Users cash balance
I Dont Know About Webhooks And dblpy events
are you familiar with mongoose? @cinder patio
So I Came to ask here
Only mongodb
@client.event
async def on_dbl_vote(data):
print(data)
here is a big brain question, if someone does a leaderboard command, should you cache all of the responses from the db?
How Can I Connect that webhooks
or no
mmm I wouldn't
Sort the users based on their balance, get the first X, done
Sorting depends on which database you're using
quick.db
then you'll have to fetch all users in the database, another reason quick.db is garbage
how to fetch?
sorry, anyways yeah, get all users, use Array#sort to sort em, get the first X elements with slice
If you're planning to set it up on your main file, you can instantiate the DBLClient after the discord client instantiation.
client = discord.Client(...) # or its subclasses
dbl_client = DBLClient(client, dbl_token, ...) # read the documentation so that you know what to pass.
@client.event
async def on_dbl_vote(data):
# do something with it
All the users cash balance is stored in json.sqlite
tysm
yikers
I store all my data in mongodb with userID and guildID so I can ezpz grab the entire guild
Read the comment
Thx
I Didnt Notice that
I haven't really used quick.db, looks like you have to get all tables first, and then get the users table, then get all entries, not sure.
Thanks for help
ok
here are the docs
which are also pretty shit
I think db.all() should do it, and then use Array#sort, but the docs aren't clear at all so
Ohk
but I recommend switching databases when your bot gets bigger
or, switching ORMs - sqlite is fine for discord bots. If you want power and simplicity I recommend sequelize
idk
search in youtube or google
do you recommend AWS as a host? And they say you can use it for 12 months free?
ohv then? Cause contabo is like 15 euros a month
free trial on amazon or google is better than glitch/heroku/repl.it
you can find vps for $3 / month
ovh is like 3 dollars
Does anyone need help with discord.js
So I guess I will use that?
iโm using it rn and having no problems
HostGator is a couple of dollars a month, any reviews ?
stay away from them
Which one do you recommend then
how can i get client user's?
is there a way to send an embed and a message in the same message
lib discord.js
channel.send(content, embed)
If you want to edit a message to remove the content and only have an embed, do message.edit(null, embed)
believe me if you want to

Probably had it reversed
yeah
Hey, I hosted my code on heroku but after some time I'm getting the output 4-5 times, anyone knows how to fix?
You're probably adding a message listener inside of another listener
No , I didn't do that... when I run the code using localhost it works fine
The problems happens after some time, for an hour it works fine
How many instances of <Client>.on("message" are there
because users might do something you aren't doing
I found a nice VPS for cheap
shit pricing for specs. You can get similar spec for free
someone needs to start selling real vpss at 1 usd with like 1vcore and 512mb so people stop buying these shits
anyway
true. 256MB of storage is laughable as well
hey umm
sorry. 512
i get internal server error from discordjs...
It's the cheapest I found, most people don't recommend free servers
I mean ram
That's an Error on Discord's end
give like 10gb storage lol
why would that happen
back to my question
like i got like 5 such errors
Idk. I'm not a Discord engineer. Discord is gay sometimes and breaks
is there a way for me to fetch 10 specific guild members without fetching all or fetching them individually?
because spamming the api isnt good
and can I even fetch more than 1 without having the guild members intent?
Pretty sure there's a limit option
yes
max 100
can I specify like 10 of them that I need?
yes
mmm oh. 10 specifically
Is there an option to get within an Array
I don't remember seeing that in the docs
how would I do this flaze?
what are you using
raw api basically
ah
I got missing access error
check your payload
hmm
how can i make a leaderboard command? (quick.db)
@Eqtron by @GrizzShutsDown was approved by @nom.
https://top.gg/bot/798974624980271125
Pog
@cinder patio u helped alot
Hi there, how can i use this code in my bot?
Has a way to evict the redirect URL process?
Can Someone Tell me What Happend To Mongo?
can you elaborate? Are you working on an oauth2 app?
Ok, i want get user name of Twitch connection
Just this username
So some guys tell me to use oAuth2
But i don't know use it right
yeah you can only get those via oAuth2
you need to have a webserver in order to use oauth2
I've already think this...
So i made a website, the URL go to a JSON and it i use to verify?
You use the code that discord appends to the query params and exchange it for a user access token.
Which lib are you using for the server?
oh
you can get the code via req.query.code
first answer on google
Ok!
Oh, ok, im gonna try do this
Does works with Glitch?
yeah
Sorry for the inconvenience
if(message.mentions.members.first().id === '723081690792067143' || '798498750502928407') return message.reply("you cant rob them, lol you should have not tried that, now you got to wait 2h!")
it reply that to every user i ping, it should not
That's because the expression in the if statement boils down to false/true OR true, which is always true
That's not how you check if a value is either this or that
value === this || value === that
is the correct way
that reply gives me roblox feels
your might want to use ['id-1', 'id-2'].includes(thing)
big brain
but you might also just store the id in a variable and compare it two times
I am currently working on a lb
guildid: { type: String },
monthnumber: {type: Number}, ///?!?! Month starts on 0
week1: {type: Array},
week2: {type: Array},
week3: {type: Array},
week4: {type: Array}
How can I change or update week4 without making a case/if else condition to go on the object like
if (week ===1) guild.week1 = "100";
if(week === 2) guild.week2 = "100";
``` I do not want to make a case or a condition, is there a possiblity to go to the array object without checking for each 4 weeks
guild["week" + week] = "100" comes to mind
this will work lol, had this in my mind, but was not sure, thx
Hi guys
why when i try console.log(gld)
i get the whole thing
and when i try
console.log(gld.members)
i get Cannot read property 'members' of undefined
btw
gld is guild
Where do you run console.log(gld.members)? inside an event, or a command?
it works 
i named it in this way bc it was already used
show the full code xD
mm...
in a nodejs website
=)))
with ejs
console.log(guild.id)
const gld = bot.guilds.cache.get(guild.id)
console.log(gld)
const mbrs = gld.members
console.log(mbrs)
?
in first log i get the guild id
then i get members roles blah blah
and then i get this error
Cannot read property 'members' of undefined
that's really weird
may the members are not in the cache
log out .member lol
maybe it's got something to do with ejs
Are you using discord.js?
what other lib has cache.get()
<ref *1> Guild {
2|app | members: GuildMemberManager {
2|app | cacheType: [class Collection extends Collection],
2|app | cache: Collection(60) [Map] {
2|app | '735096468091961415' => [GuildMember],
2|app | '433699344399728642' => [GuildMember],
2|app | '429334867923173377' => [GuildMember],
2|app | '411130600188149765' => [GuildMember],
2|app | '272663855891742720' => [GuildMember],
2|app | '269095564317163520' => [GuildMember],
2|app | '605121899512594462' => [GuildMember],
2|app | '293468745593126913' => [GuildMember],
2|app | '354695071095848970' => [GuildMember],
2|app | '272996542821171200' => [GuildMember],
2|app | '755720074756751392' => [GuildMember],
2|app | '277486282542809088' => [GuildMember],
that s the logs from
gld
maybe he was using discord.js-light lol
still discord.js
yea
that looks good
but they do not cache anything lol
i tried .members.get(id)
I think ejs is definitely doing something here.
but I don't know much about ejs so I can't help
try create a function and then run it in ejs
one sec
the funtion should be outside of your ejs code lol
is bot.ws.ping the same as averaging the ping of every shard that is active
How can I define many variable in a row?
let week;
let week2
wanted
let week ; let week2
but this style is 
let week, week2; @tired panther
sometimes my bot starts, but it doesnt turn on
like it gets online
but it doesnt run
and it sometimes does too, so its not the code
and idk why its happening
ping me if anyone has any ideas
one problem...
<% guilds.forEach(guild => { %>
<%- include('partials/gld', { guild }) -%>
<% }) %>
i have this code in ejs
how am i supposed to run it outside?
what do you mean run it outside?
export the file lol
?
i mean connect 2 repls
@slim heart for command middleware you should require an absolute true to continue, so response === true
another question
how can I check if a user have a specific permission
?
i mean
something like this
if(guild.permissions === 2147483647)
๐ค
no don't use that
what the
Use &
like?
@earnest phoenix for example manage guild, it's like
if (<message>.author.hasPermission("MANAGE_GUILD"));
o
Can someone helpo me setup Express with TopGG voting webhooks?
i mean if(guild.permissions === 2147483647) is working, but it s checking if user has admin and i want to check if the user has manage guild permission
When the embed message is sent detects it as edited?
module.exports = async (bot, message, newMessage) => {
if (message.author.id === bot.user.id || message.attachments.first()) return;
const snipes = bot.editsnipes.get(message.channel.id) || [];
snipes.unshift({
old: message.embeds.length && message.content.length ? bot.functions.embedToMessage(message.embeds[0], message.content) : message.embeds.length ? bot.functions.embedToMessage(message.embeds[0]) : message.content,
new: newMessage.embeds.length && newMessage.content.length ? bot.functions.embedToMessage(newMessage.embeds[0], newMessage.content) : newMessage.embeds.length ? bot.functions.embedToMessage(newMessage.embeds[0]) : newMessage.content,
author: message.author,
channel: message.channel,
date: Date.now()
})
snipes.splice(10)
bot.editsnipes.set(message.channel.id, snipes)
};
messageUpdate event ^
yes, embeds trigger message updates
check if message.author exists
embed updates dont have an author
only a message id and the embed
using express?
no
discord.js embed updates parameters are the message before it was edited and after it was edited and updated, so both would contain the author
just so you know :^)
if you want to make a website, create a html repl, not a node one
i wanna make a backend
what if you want a backend
Use express or something similar
node.html
html.node
i should go check out fastify
I noticed when a bot is fully shut down, the user keeps online after some seconds. Is there any function to logoff when shutting down? ๐
not really, apart from just being creative and having the bot set itself to offline when shutting down 
(node:10476) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' of undefined how is message.guilds undefined
does it exist any better way I can make this?
const Discord = require('discord.js');
const webHookclient = new Discord.WebhookClient('No', 'sneakpeak')
exports.run = async(client, message, args) => {
const embed = new Discord.MessageEmbed()
.setTitle('Some Title')
.setColor('#0099ff');
webHookclient.send('A error happen', {
username: 'Command Errors',
avatarURL: 'PFP',
embeds: [embed],
})
};
exports.help = {
name: "webhook",
aliases: []
}```
'A error happen'
idk
like this
Youโd need routes
it s possible to check if a bitfield has a specific flag??
sure
that's the whole point of bitfields
how?
ohhhhh im a freaking idiot
read the docs
thx
can u give me a code example?
use bitwise AND
left hand side is your bitfield, right hand side is the flag you want to check
and then just check if the result of that equals to the flag
(node:3920) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, mkdir './db/data/guilds/731342408293285928/'
๐ฉ
o shite
my bad
i forgot to make that folder
i just spent 30 minutes trying to fix a bug, before i realized the bug didn't even exist
i love coding
Also me who has spent 1 hour trying to check if a oauth2 user has a specific permission
=)))
and still with no succes
how can i do that it will add , when needed in the number?

mm
how?
hold up
so discord oauth2 give a permissions number ( ex: 37080128 )
how can i check with this code if user has
a specific permission
?
:3

i still don t get it =)))
what don't you get about it
oki
oh i found it
yourNumber.toLocaleString('en-US', { style: 'currency', currency: 'USD'})
i tried nb = new Discord.Permissions('37080128') and i get RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
so yea

okay, so now how do i use it in my commands tho?
thats up to you
you could make a shorthand function
async resolveChannel(search, guild){
let channel = null;
if(!search || typeof search !== "string") return
if(search.match(/^<@&!?(\d+)>$/)){
const id = search.match(/^<@&!?(\d+)>$/)[1];
channel = guild.channel.cache.get(id);
if(channel) return channel;
}
channel = guild.channels.cache.find((c) => search === c.name);
if(channel) return channel;
channel = guild.roles.cache.get(search);
return channel;
}``` how would i make this work for #channel aswell
@earnest phoenix hahahahaha what are you doing here?
I do not undesrtand inglish
nvm
solved it


So why are you here if you doesn't understand
Any mod?
Not
This guy just called me bitch
It's funny for you?
Whats the going rate to make 3000 lines of Java code reactive and sharded in Discord4J?
I'm kidding, I will ask for help in the future - it's tough - I LOVE .blocking()
He just called me bitch, wouldn't you warn him or something like that?
@earnest phoenix Yeah please don't be rude to other people aswell
glad i never had to deal with sharding yet 
Yeah I think I kind of upset the Discord4J community when trying to show my failing at reactive - its so different from regular Java that I just can't. It's alright, I launched today and still have only two guilds, both of which I own ๐ so maybe I need to hold back my concerns and also my hopes.
let i = await message.channel.send(user1.toString(), embed2)
i.react('โ
').then(() => i.react('โ'));
const filter = (reaction, user1) => {
return ['โ
', 'โ'].includes(reaction.emoji.name) && user1.id === user1.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === 'โ
') {
message.reply('Accepted');
} else {
message.reply('Declined');
}
})
.catch(collected => {
message.channel.send('You did not in time.');
});``` how come the bot doesn't recognize that i added a reaction?
what the heck is that
^
let i = await message.channel.send(user1.toString(), embed2)
i.react('โ
').then(() => i.react('โ'));```
wtf
await reaction
ctrl+c and ctrl+v
let i = await message.channel.send(user1.toString(), embed2);
await i.react('โ
');
await i.react('โ');
this
hippity hoppity your code is now property
where did you copy that from boulevard?
the guide
WHICH guide?
i learn stuff here https://discordjs.guide/popular-topics/reactions.html#awaiting-reactions
okay good that you checking docs, but thats 100% not good practice you doing there with await and .then
oh
Lol
so i can just do js await i.react('โ');?
Erwing going rrrrrrrrr
oh, they dont want to async the snippets
it's the official docs
wont this wait for check and then only wait for x after it receives a check?
await i.react('โ
');
await i.react('โ');```
return ['โ
', 'โ'].includes(reaction.emoji.name) && user1.id === user1.id;
whats this suppose be doing there?
if apples === apples
make sure that it's the right user
@opal plank @slim heart needs help with declaring a namespace
sure
you need to use the .then so you are not blocking
can you use a collector for all the channels in the guild?
https://github.com/jpbberry/discord-rose @opal plank
wait
shit
there
yes you can, just make sure you don't filter it
oh wait
yes you still can ig, with the for loop maybe
you can make your own collector too
and use the message event to filter
My bot can't log in, like it turns on but it doesn't respond and the ready event is not called, and when it is, the web socket disconnects right after
ns
at RequestHandler.execute (C:\Users\Administrator\Desktop\app\node_modules\d
iscord.js\src\rest\RequestHandler.js:154:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (C:\Users\Administrator\Desktop\app\node_module
s\discord.js\src\rest\RequestHandler.js:39:14)
(node:3544) 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(). To termina
te the node process on unhandled promise rejection, use the CLI flag `--unhandle
d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio
ns_mode). (rejection id: 35)
Stats Command: 211841569676853248
(node:3544) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or dir
ectory, open '/app/userData/savedData/76561198201275157.json'
at Object.openSync (fs.js:476:3)
at Object.writeFileSync (fs.js:1467:35)
at Updater.update (C:\Users\Administrator\Desktop\app\classes\Updater.js:36:
10)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.module.exports.run (C:\Users\Administrator\Desktop\app\cmds\
istatistikler.js:25:7)
(node:3544) 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(). To termina
te the node process on unhandled promise rejection, use the CLI flag `--unhandle
d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio
ns_mode). (rejection id: 36)```
My discord bot works very well on glitch but in vds servers it gives errors.How can i solve this?
I want to remove my bot from servers with less than 200 members. What code can you help me?
read first line
also this
cannot find the dir
this is due to path
Odin Pls Dm
sure
works on glitch
I want to remove my bot from servers with less than 200 members. What code can you help me?
Please stop spamming this
find out how to leave a guild in whatever library you're using
very urgent
in which library
we arent going to spoonfeed you, we can lead you to the right path
discord.js
I tried but it failed
what DID you try?
odds are not many guilds you're in have < 5 members
I tried at 200 it gives an error again
what is that i?
it was written like that on google
is there any error? like i is not defined?
man but it gives an error I tried many times
can you show us the error?
and also you should remove that i, you don't even defined it
client: [Circular],
MessageCreate: MessageCreateAction { client: [Circular] },
MessageDelete: MessageDeleteAction { client: [Circular] },
MessageDeleteBulk: MessageDeleteBulkAction { client: [Circular] },
MessageUpdate: MessageUpdateAction { client: [Circular] },
MessageReactionAdd: MessageReactionAdd { client: [Circular] },
MessageReactionRemove: MessageReactionRemove { client: [Circular] },
MessageReactionRemoveAll: MessageReactionRemoveAll { client: [Circular] },
MessageReactionRemoveEmoji: MessageReactionRemoveEmoji { client: [Circular] },
ChannelCreate: ChannelCreateAction { client: [Circular] },
ChannelDelete: ChannelDeleteAction { client: [Circular], deleted: Map {} },
ChannelUpdate: ChannelUpdateAction { client: [Circular] },
GuildDelete: GuildDeleteAction { client: [Circular], deleted: Map {} },
GuildUpdate: GuildUpdateAction { client: [Circular] },
InviteCreate: InviteCreateAction { client: [Circular] },
InviteDelete: InviteDeleteAction { client: [Circular] },
GuildMemberRemove: GuildMemberRemoveAction { client: [Circular] },
GuildMemberUpdate: GuildMemberUpdateAction {
}```
I'm getting errors like this
I have this issue, it sais my node is v12 when I have v14.15.5 installed I deleted all modules and used "yarn" to rebuild them but I still get the error
I think this is not error message
just some logs
what's your discord.js version
ectory, open '/app/userData/savedData/76561198201275157.json'
at Object.openSync (fs.js:476:3)
at Object.writeFileSync (fs.js:1467:35)
at Updater.update (C:\Users\Administrator\Desktop\app\classes\Updater.js:36:
10)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.module.exports.run (C:\Users\Administrator\Desktop\app\cmds\
istatistikler.js:25:7)```
Although the file location is correct, it fails. only this error is happening on windows server
windows REEEEE
how do i change the buttons' colours for vote and invite and the other stuff ?
'use strict';
exports.onMessageDelete = async(botClient, network, channelsCache, msg) => {
if (!msg.author || msg.author.discriminator === '0000' || !msg.channel.guild) {
return;
}
const cur = network[msg.channel.id];
if (!cur) {
return;
}
if (msg.author.bot && cur.ignoreBots !== false) { // ignore bots by default (check for false specifically)
return;
}
if (cur.ignore) { // ignore channels if needed
return;
}
const messages = channelsCache[msg.channel.id].get(msg.id);
for (const m of messages) {
m.delete().catch();
}
channelsCache[msg.channel.id].delete(msg.id);
};
Eris.js webhook deletion
Works for a little bit but then crashes
config.path + `\userData\savedData\` + this.steamID + ".json",
^^^^^^
SyntaxError: Invalid Unicode escape sequence
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\Administrator\Desktop\app\cmds\istatistikler
.js:2:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
I tried it gave different error this time
tempchannel.setPosition(4)```
try two \\
it worked now thanks
don't think fs does though
yes it does
wack
(node:2352) TimeoutOverflowWarning: 5184000000 does not fit into a 32-bit signed integer.
```what
Integer is too big? ๐ค
fat int
The number is too big for a 32bit int
use cron probably
You could use a long, instead of an int
tell me more
cron jobs
you schedule a function to be executed at a certain point in time or something
omfg, ty
there's a package called node-cron
do you have a database that stores vip information?
I was using Date() to get the value in miliseconds
tecnically
how do you store the time period for which it is valid?
in Firebase, each document from the collection 'vip' has it's id set to the user's, and has a value called 'until' which is a timestamp
alright
so on bot start, begin an interval that fetches all documents whose "until" field is smaller than 1 day away
already have that
have the interval run every 24 hours or something
oh
and for each fetched document, begin a timeout for them
should I do that? I don't wanna exceed quotas
its one database operation per day, its not gonna matter
idk how firebase works as i've never used it, but you should be able to fetch multiple documents at once by a certain criteria
I got the timeouts right, but the miliseconds are huge
cron jobs 
they are not right
the idea is to create a timeout ONLY for the ones who will expire in less than one day
you're setting timeouts for 2 months
hmm true

well, I thought wrong
I need to think about these things better
or else I might do something huge, when I could do it little
its pretty simple
// bot start
setInterval(() => {
let data = firebase.fetch(documents WHERE until < Date.now() + 1 day in ms) // or whatever the api looks like
for(let doc of data) {
setTimeout(() => {
unvip(doc.id)
}, doc.until - Date.now())
}
}, 1 day in ms)
lul

wait WHAT
fetch? omfg I didn't find such thing anywhere
const refV = db.collection('vip');
const snapshot = await refV.where('until', '!=', 'forever').get();
if (!snapshot.empty) {
snapshot.forEach(doc => {
const until = doc.get('until');
const
if (until != 'forever') {
const ms = (until._seconds * 1000) - Date.now();
vip.add(doc.id);
setTimeout(() => {
vip.delete(doc.id);
doc.delete();
}, ms);
}
});
}
what I had xD
i never used firebase so idk what its api looks like
hence why i commented
// or whatever the api looks like
is there a way to add another condition to that where?
at least at where I looked
yeah, I have a 'forever' for me and my gf xDDD
gonna check the where usage
from the firebase docs
citiesRef.where("state", "==", "CO").where("name", "==", "Denver");
oh, weird way
You can chain multiple equality operators (== or array-contains) methods to create more specific queries (logical AND). However, you must create a composite index to combine equality operators with the inequality operators, <, <=, >, and !=.
don't need it
I was just skeptical
const snapshot = await refV.where('until', '!=', 'forever').where('until', '<', Date.now() + 86400000).get();
I guess it should be like this
i guess yeah
I learned a lot with this, ty @quartz kindle
gonna give a star like some other random guy did ๐
๐
lmao
save some stars for the rest of us
lol, Kirby talkin' ๐
const config = ConfigSchema.findOne({
guildID: message.guild.id
})
console.log(config.prefix)
it says undefined
but im looking in the collections
and prefix does exist
you have to await it
Does anyone have any suggestions on how to host their bot 24/7 with no crash's fre
Await or .then
e?
Only way to get reliable uptime is getting a vps
or go insane and buy a dedi
What's dedi?
Dedicated server
Is it better than vp
don't worry about them though, i was joking
Don't worry about dedicated servers they ain't worth it for small bots

I get an error "the user aborted a request" what is this i am using d.js v12
When we talk about size we mean more of server count
Does anyone have an idea
Nope....

Can you show the full error?
sure
You might want to provide some code as well, otherwise it's gonna be really hard to tell what's wrong
Is this (on the vds)
wow..
AbortError usually means that a request took too long or didn't finish at all
How do u make an embed if its not MessageEmbed?
how many servers do your bot have?
Possibly a network issue
embed = new Discord.MessageEmbed()
I think
probably because VDS in Turkey and far from Discord servers
idk.. I finished codig it minutes ago. Its only in 11 servers. I didn't even thought about advertising 'till now.
^^
hmm
wwaaiitt...
I forgot how to use d.js lol






