#development
1 messages · Page 1223 of 1
You can do that with one collector
All collectors are collecting at the same time
Just because one is after the other doesn't mean it will be collected after
Also, your filter only accepts messages by the one doing the intial command
wait whatttt
how do i define it as the person who says ready
cuz i thought message.author was the author of the message collected
m is the author of the collected message, message would be the author of the command message
what
sell your soul to discord js gods and they’ll do it for you
You don't have to do anything. Just remove 3 of the collectors, and now you are collecting messages from one collector
i use await messages 
like how do i make it not collect more than 4
Where do you keep your players?
omg wtf
wdym where
You can do max: 4 in the options
Also your filter should accept only messages which have the content "ready"
Already went over that
aight
thxx a lot
why aren’t you a discord staff member atThunder
even though im at 54 guilds rn
How do you get the verified dev badge?
you dont
you got your bot verified, have u not?

no clue how i got green role i didn't resubmit
im not sure then
ok what did i do
idk, what did u do?
const filter = m => m.author.id === message.author.id
const collector = message.channel.createMessageCollector(filter, { time: 15000, max: 4 });
message.channel.send("Type `ready` to enter the game");
collector.on('collect', m => {
if (m.content == "ready" && m.author.id) {
m.author.send("test")
}})
collector.on('end', collected => {
message.channel.send("Collected messages from all 4 players")
});
lol
so i reduced my code to this
but now it is only dming the message.author
Your filter
I meant
Only accepts messages from the message author
check if they already have been chosen
don’t limit to one person
Also yeah, multple people can do ready and get in, so you should keep people who are in in a map or an array
just make sure I can't join twice
oh kk
wait but making an array wont fix that
right
lol
cuz it would just display same guy 4 times
let users = []
// collector
// check users for author
users.push(author)
kk
lol ok
A Set would be better in this case, or a map
make a map or an array, then add any user that joins to the array, but before that check if the user is already in the list, if they are then send an error message, if they're not then add them
use a hashmap

lmao
lol
@misty sigil add a clarification that mongo is Bson vs Json
cause it’s a common thing
that people say

look we aren’t comparing types of db
no shush
just saying which is better
quick.db uses sqlite3
whats wrong here ? 👀
hi im back
let users = new Map();
const filter = m => m.author.id
const collector = message.channel.createMessageCollector(filter, { time: 15000, max: 4 });
message.channel.send("Type `ready` to enter the game");
collector.on('collect', m => {
if (m.content == "ready" && m.author.id) {
m.author.send("test")
}})
collector.on('end', collected => {
message.channel.send("Collected messages from all 4 players")
});
users.set(m.author.username, 1)
users.set(m.author.username, 2)
users.set(m.author.username, 3)
users.set(m.author.username, 4)
console.log(users)
this might be wrong
../../ iirc
@cerulean salmon its not a combination, you gotta learn relative path
@cerulean salmon funfact, this is a thing if you dont know
You should set the user in the map inside the collect event, inside the if statement
@cerulean salmon again, its 2 ../
../ is parent folder
./ is working dir
none is also targeting same dir
though require looks for module without it
🤦
it’s ../../
Someone knows how make a 404 screen?
@misty sigil ty
Well actually how make if the page dont exist shows the custom 404 error page
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
nice
Can anyone help me, my bot wont login into discord and I have no idea of what it could be...
It was fine until today, it just launches the first shard and then it fails at client.login()
errors?
just the shard error: Shard 0's Client took too long to become ready.
are you on v11?
no v12
hm
try another token, idk it happened to someone else earlier
they said it was only for that one token
I thought I was short on ram so I even added ram to the vps lol
lol
one sec
hi
Launched shard 0
0|index | Provided token: NzM5Nzk2NjI3NjgxODM3MDY3.XyfrTA.***************************
0|index | Preparing to connect to the gateway...
0|index | Mongoose connection successfully opened!
0|index | [WS => Manager] Fetched Gateway Information
0|index | URL: wss://gateway.discord.gg
0|index | Recommended Shards: 1
0|index | [WS => Manager] Session Limit Information
0|index | Total: 1000
0|index | Remaining: 0
0|index | [WS => Manager] Spawning shards: 0
0|index | [WS => Manager] Exceeded identify threshold. Will attempt a connection in 66446972ms```
@misty sigil
how could I possibly get rate limited
My bot doesn't do much and it has all the needed cooldowns
restarting too much is one way
let users = new Map();
const filter = m => m.author.id
const collector = message.channel.createMessageCollector(filter, { time: 15000, max: 4 });
message.channel.send("Type `ready` to enter the game");
collector.on('collect', m => {
if (m.content === "ready" && m.author.id) {
m.author.send("test")
users.set(m.author.username, 1)
users.set(m.author.username, 2)
users.set(m.author.username, 3)
users.set(m.author.username, 4)
}})
collector.on('end', collected => {
message.channel.send("Collected messages from all 4 players")
});
console.log(users)
ok now why is this not working
i actually dont get it
the map is empty
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.
hey what is wrong with my bot here
for some reason i cannot use $po sunny
and if i type $po weather types it returns me the embed and lots of error codes with it.
no-one that could help?
that feeling when you finally figure out how to use canvas:





||nitro flex
||
lol my bot db was just held for btc ransom
Bruh
hello
i accidently commited creds to private repo...thats only way i can think...but how did they get info from private repo
module.exports = {
name: 'cards',
description: "still under constuction",
async execute(message, args) {
let users = new Map();
const filter = m => m.author.id
const collector = message.channel.createMessageCollector(filter, { time: 15000, max: 4 });
message.channel.send("Type `ready` to enter the game");
collector.on('collect', m => {
if (m.content === "ready" && m.author.id) {
m.author.send("test")
console.log(m.author.username)
/*users.set(m.author.username, 1)
.then(() => users.set(m.author.username, 2))
.then(() => users.set(m.author.username, 3))
.then(() => users.set(m.author.username, 4))*/
await users.set(m.author.username, 1)
await users.set(m.author.username, 2)
await users.set(m.author.username, 3)
await users.set(m.author.username, 4)
}})
collector.on('end', collected => {
message.channel.send("Collected messages from all 4 players")
});
console.log(users)
}
}
how
is this
bruh
it says await is only valid in async function
wtfff
Yeah
Youre not in async context
This needs to be asynced
^
Also use tabs/spaces to format your code
ohhhhhhhhhh
I'm trying to get my code to detect if a number (any length) is provided for a command, here is my current code:
const server = args[0];
const text = args.slice(1).join(' ');
if(!server || server != Number){
const embed = new MessageEmbed()
.setAuthor(message.member.displayName, message.author.displayAvatarURL())
.setTitle(":warning: Error in: Server Number :warning:")
server is a string
you need to turn it into a Number
isNaN() also works too
Multi, why are you setting it 4 times? Completely pointless, also, Map.set does not return a promise so no point using async/await
I want to add an embed that says ping: and memory used:
In Python
Help me
Please
@gentle oxide search google
and then you can convert it using
I can't find it anywhere that's why I'm writing it here in case you can help me
you can convert it using this code
import math
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
p = math.pow(1024, i)
s = round(size_bytes / p, 2)
return "%s %s" % (s, size_name[i])
@chilly bison and what would it say where is the emoji 👀
Ping🏓
Latency:
100ms
Memory Ram:
👀mb
what command?
idk
u decide
I have a easy-to-use dahboard for my bots
https://catnip.games/stats @gentle oxide
What is?
can someone help me with this..
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://discord.com/channels/237367938242445322/237367938242445322
// @grant none
// ==/UserScript==
(function() {
'use strict';
//class="username-1A8OIy clickable-1bVtEA focusable-1YV_-H"
(function() {
'use strict';
//class="username-1A8OIy clickable-1bVtEA focusable-1YV_-H"
for (var i = 0; i < document.getElementsByClassName("username-1A8OIy clickable-1bVtEA focusable-1YV_-H").length; i++) {
if (document.getElementsByClassName("username-1A8OIy clickable-1bVtEA focusable-1YV_-H")[i].textContent == "Obliterous") {
document.getElementsByClassName("username-1A8OIy clickable-1bVtEA focusable-1YV_-H")[i].textContent == "blocked"
}
}
})();
I am still not able to replace the name of someone
with tampermonkey
Is Python?
@midnight blaze try .innerText instead
didnt work
then I don't know xD would you tell me what command I can put with the python language to know the memory used by my bot in an embed message
try
if(item[i].innerText.trim().toLowerCase() == "name of blocked person"){
item[i].innerText = "blocked";
}
thanks, let me try it out
then I don't know xD would you tell me what command I can put with the python language to know the memory used by my bot in an embed message
@gentle oxide be creative lol
<prefix>botstats maybe?
Yes
k
doesnt work as well
but to tell me the memory used and the latency of the bot when I press <prefix>botstats
@quartz kindle pls help man xD
?
but to tell me the memory used and the latency of the bot when I press <prefix>botstats
then I don't know xD would you tell me what command I can put with the python language to know the memory used by my bot in an embed message
Please help me
In python language
@quartz kindle
don't ping random people except tim
What's the issue you are facing
I thought you were given code to enter to implement your requested feature
the \n doesnt work on iphone devices as it doent display text in next line or is it iphones discord apps fault
on andriod and pc \n displays in next line
but in ios app it doesnt
Ya boy got approved!
Also, I've hit an issue with the massive amount of people on this server.
Sorting through 100k people makes for at least one of my commands to have a 40s response time
my problem was not solved
im trying to find out how to send a DM using discord.js 🤣
i had created application bot i want to do if someone attach picture in bot's dm bot send it to (MENTIONED channell) channel
Like a "RAM" database
@opaque seal I use a map
Matthew here to delete you
im trying to find out how to send a DM using discord.js 🤣
@rare gale <user>.send
any ideas on how to send a DM using discord.js?
above you
@thick gull they say it’s caching some stuff from main db
thanks mathew
it’s fine, I do that
@opaque seal I use a map
@misty sigil I'm using discord.js Collection but I think it's not quite the best option
map is basically the same
server is a string
@misty sigil The reason why I sayserveris because that links to a number needed for command output. I made a roleplay bot for GTAV and RDR2 roleplay.
@misty sigil how make json
I gave u the

I know I just wanted to mention that.
map is basically the same
@misty sigil one guy told me to use redis
// ==UserScript==
// @name Leon macht sachen mit discordusern
// @namespace http://tampermonkey.net/
// @version 0.1
// @description niemand mag tsumo
// @author Pauli
// @match https://discord.com/channels/237367938242445322/237367938242445322
// @match https://discord.com/channels/@me
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(() => {
let search = 'Noel';
let epple = Array.from(document.querySelectorAll('div')).find(el => el.innerText === 'Noel');
epple.setAttribute("style", "background-color: gold");
console.log("this is epple", epple);
}, 5000);
})();
this worked, but when I change div to span to access this in the chat, it still doesnt work
Has anyone here some experience with html?
kind of yeah @midnight blaze
have you ever worked with tampermonkey? And idea why this doesnt work on the normal chat?
are u kidding me?
yes
I do how to use js
anyone here who has some serious experience?
i dont even know how to send messages to dm's. been trying to find that out for 2 hours 🤣
user.send ?
^
I've used tampermonkey but idk how it works lol
rip xd
I never touched it.
I just copied stuff from other people
user.send ?
@oak cliff i tried that, it said invalid something
no im trying to do like -help
then it sends a message to dm
spammer!1!1!1!
How did you define user.send?
no im trying to do like -help
then it sends a message to dm
@rare gale <message>.author.send()
Let me try that again
did you just write user.send without thinking
Hello i dont know htm or css... I want create a description can someone help me out?
@rare gale <message>.author.send()
@misty sigil thanks, ill try
How did you define user?
user should be the target
<message>.author replaces <user>
That too.
Hello i dont know htm or css... I want create a description can someone help me out?
@rough lodge i even dont know basics
I mean, that's how you learn
Ok ;-; i guess it will take time so yeah thanks
It took me a long time to learn the basics man, I know what its like.
TypeError: client.send is not a function
thats what it says
Code?
wym?
Whats your code?
u mean like what is it meant to be doing
sorry im a noob
Show me the code you wrote for the command.
ok it may be incorrect so dont make fun
.setAuthor(message.member.displayName, message.author.displayAvatarURL())
.setTitle(`:warning: Error in: Server Number :warning:`)
.setColor(0xFFD700)
.setDescription(`Hey <@${message.author.id}>! I see you're trying to dispatch !`)
.setFooter(copyright.copyright);
message.delete();
message.channel.send(`Hey <@${message.author.id}>`)
Could look something like that.
oh no...
Show me you're code bud, I promise I won't make fun. I was just as new as you a few months ago.
f(message.content.startsWith(${prefix}help)) {
client.send("{prefix}help -- gives this message")
("{prefix}kick @mention -- kicks the mentioned person (have to have kick permission")
("prefix}ban @mention -- bans the mentioned person (have to have the ban permission")
}
})
LOL
Okay, I see where you're at. You'll need to do message.author.send or you need to define a user which is a boolean, you'll need that if you need to prevent things happening to bots like I. Easy to define user.
ok, ill try it, thanks for helping 😄
Don't forget you need to use dollar sign when defining prefix so it calls back to your config.json if thats where you have it stored.
yes
So yeah
like (${prefix}help)
yes exactly what i did with kick 🙂
Good boy.
thanks bro
Any progress @rare gale?
Hey, what methods can I use to restart my Discord Bot in Discord.js with a command? Somehow client.destroy(), then client.login(token) does not work...
process.exit()
Use something to auto-restart your bot (while-true loopscript, or pm2 I think), and use that what Alina posted + a client.destroy() above it
Any progress @rare gale?
@stable nimbus not really....
i may just send an embed message to the channel instead, but then again i dont know how to do a new line in an embed
im using pm2, it just restart my Bot after process.exit()
DM me I'll happily help.
im using pm2, it just restart my Bot after process.exit()
@molten yarrow Yeah nono, a process.exit() will restart with pm2 - But I'd add a client.destroy() above it to log out the bot properly 🙂
i had created application bot i want to do if someone attach picture in bot's dm bot send it to (MENTIONED channell) channel
@prime glacier
yeah true :3 im using it like once a month, its kinda enough xD
process.exit()
@molten yarrow This just exits the whole code, but I want to restart it...
Like we said, use pm2 or a while(true)-script
yeah read some lines above
Aaah, srryy
when your bot crash loops with pm2 😩
when your bot crash loops with pm2 😩
Oh yeah.
@jagged sun You have to watch out for that. If your bot restarts 1000 times within 24hrs the token will reset automatically
oof
just be a big boy like me and test on prod
Where else do you test stuff?
oof
@jagged sun If you're using discord.js you can useclient.on('debug', e => console.log(e))to see how many restarts you have left, but it will spam your console with Heartbeat responses
Would it also be a good alternative to just restart it every 24 hours with chrontab?
It will output it after you start your bot
Hello
Would it also be a good alternative to just restart it every 24 hours with chrontab?
Do you have a problem with your bot that requires restarting constantly? It shouldn't need that
Can someone tell me how can I make my discord bot announce when I am live on twitch?
No not really, just for RAM freeing purposes...
discord.js has .clear() functions to clear out cached stuff - Or maybe that's JS in general, not sure
what if your bot dies at like
@thick gull Then I would also have to restart it manually w/o chrontab
discord.js has .clear() functions to clear out cached stuff
@nimble kiln How do you use .clear()?
I'm trying to find it rn 😄
@nimble kiln how can I make my discord bot announce when I am live on twitch?
Think u need a Twitch API for Events...
@nimble kiln How do you use .clear()?
@jagged sun Appears to be a javascript thing.
client.users.cache.clear()empties the user cache - Same can be done with client.guilds.cache, etc.
But then you can't use/get those cleared elements in other commands, can you?
If your bot fetches something from that cache then it wont find it, yes
You'll have to fetch it again
In my opinion a reboot would be way better than that
You'll have to fetch it again
You have to test that tho, I'm not 100% sure what will happen when you do this:
client.guilds.cache.clear();
client.guilds.cache.get('guildid');
Maybe discord.js will automatically fetch it, idk
discord.js auto fetches iirc
didnt fetched for me, get undefined after .clear()
bot.guilds.cache.clear()
console.log(bot.guilds.cache.get(message.guild.id))
client.guilds.fetch('guildid');
console.log(client.guilds.cache.get('guildid'));```
Then this should work 😄
Does pm2 also start the bot after server reboot?
dont think so
if u do pm2 enable it does iirc
that moment when you just want to visit the API docs 😦
Ok, but I guess crontab can start a file pm2 @reboot so that is also not a problem...
Yes crontab can do that
If you have RAM issues you should look for some other library tbh, so you have more fine control over cached stuff -> and have less ram usage
Can it also start in another user in another screen, without changing into those users session?
Just access crontab -e from that user directly and it'll run with the user
Ah, I thought there would just be one crontab for all users
https://hasteb.in/papuyate.coffeescript - I am trying to make an application bot but it gets stuck and no errors [ Discord.js v12 ]
you need something to await a message from user and collect it
https://discordjs.guide/popular-topics/collectors.html
Alright, im having a little trouble. Anyone know what the create channel function is for Discord.JS v12?
I swear im doing it right
its guild.channels.create() in v12 i think
<guild>.channels.create()
true xD
guild.channels.create('new-channel', { type: 'text', permissionOverwrites: permissionOverwriteArray, reason: 'New channel added for fun!' });
So I have this after I try to login with discord on my page but IDK why. He just should redirect
do you have a "/redirect" router?
Is there a way to read the content of a MessageEmbed in Discord.js?
@fringe axle are you using express?
What are you using to route and stuff
ejs
How can I calculate the bytes size of a js object?
Wait you can use ejs as a server? I thought it was just a view engine
no
you need a redirect after successfull authentication
router.get("/redirect", passport.authenticate("discord", {
failureRedirect: "/auth/autherror",
successRedirect: "/"
}))
me nether
Okay
this is a callback where discord redirects you
I try it
I love how in Discord.NET you can type for the scope of a using statement
using (Context.Message.Channel.EnterTypingState())
{
// Some command
}
like localhost:port/auth/redirect
i hope u dont have over 1k lines in it xDD
@fringe axle
on line 120 is your callback
add after 122 successRedirect: "/"
after failureRedirect: "/",
hi
passport.authenticate('discord', {
failureRedirect: '/',
successRedirect: "/"
})
);
Like this?
yeah and remove " , (req, res) => res.redirect('/') "
I edited it. Correct?
try it :3 should be okay i think xD
what callback did you add into your devportal?
if (message.guild.members <= 5) {
message.channel.send('Your Server Has Under 5 Members And Therefore Is Recognized As A Dummy/Fake server, Bot Will Now Leave')
await message.guild.leave();
}
will this work?
Try and see
if (message.guild.members <= 5) {
message.channel.send('Your Server Has Under 5 Members And Therefore Is Recognized As A Dummy/Fake server, Bot Will Now Leave')
await message.guild.leave();
}
no
I don't wanna until I'm sure
it wont work
@earnest phoenix what's wrong with it?
its ```js
guild.memberCount()
which djs version?
@molten yarrow you saw my image?
newest
message.guild.members.cache.size
vale the /auth/callback should work tho
if (guild.memberCount() <= 5) {
message.channel.send('Your Server Has Under 5 Members And Therefore Is Recognized As A Dummy/Fake server, Bot Will Now Leave')
await message.guild.leave();
}
this will work
alright, better?
Did someone say oauth 😧
vale the /auth/callback should work tho
@molten yarrow should
@molten yarrow by the way he tried to redirect to || o.zwolfy.tech:3000/redirect?code=Tzml5THpL3yn7NWptiFCxBd9QDpTm8|| after the login...
IDK why
can u remove the other two
can u remove the other two
@molten yarrow the other two? Only the auth/callback should stay?
I store all the oauth info on my webserver
yeah
Behind a session ID
Which is stored in a cookie
So if you want security then do something like that
yeah
both looks like this, but with /auth/callback ??
yeah its right with /auth/callback
maybe its your login route?
Hm
Should I try auth/redirect?
@molten yarrow by the way he tried to redirect to || o.zwolfy.tech:3000/redirect?code=Tzml5THpL3yn7NWptiFCxBd9QDpTm8|| after the login...
You saw this?
Why he‘s writing redirect?code= ?
it’s /redirect
what redirect do you have in your ```client.config.bot.redirect
yeah but is it the right redirect?
thats the error xD
need to be the full redirect url
Uh
OH NO
XD
But this?
It‘s with auth/callback
What I need to write instead of it
redirect: "http://o.zwolfy.tech:3000/auth/callback"
its still the wrong redirect
Can someone help me define messageReminderModel?
mongoose.connect('mongodb+srv://sbss1111:Samiam1234@remindme.1q91f.mongodb.net/RemindMe?retryWrites=true&w=majority', {useNewUrlParser: true});
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'Connection Error:'));
db.once('open', function() {
const messageReminderSchema = new mongoose.Schema({
user: String,
messageLink: String,
time: String
});
global.messageReminderModel = mongoose.model('messageReminder', messageReminderSchema);
global.messageReminder = new messageReminder({user: user, messageLink: messageLink, time: time});
messageReminder.save(function(err) {
console.log(err);
console.log("Successfully saved reminder." + messageReminder);
});
});
}
});
} catch (err) {
console.log(err);
}
}
//Node-Scheduler Function
nodeSchedule: async function scheduler() {
try {
(await messageReminderModel.find({}).forEach(data => {
let currentUnix = Date.now()
if(data.time <= currentUnix) remindUser()
schedule.scheduleJob(data.time, remindUser);
console.log("Scheduled a reminder.");
}))
} catch (err) {
console.log(err);
}
}
}```
did you restart your server? xD
https://discord.com/oauth2/authorize?client_id=746014727544766565&redirect_uri=http%3A%2F%2Fo.zwolfy.tech%3A3000%2Fredirect&response_type=code&scope=identify guilds.join (that‘s the URL by the way)
Of course I did
116 - 118
Okay, you think then it‘s working? xD
Same
@molten yarrow
Still the same...
Any idea?
its still the redirect
if i look on my ws, its shows the right redirect in the link xD
@gritty bolt i believe i told you already, if you define it on global, then you have to use it with global every time as well
You don‘t have a „code“ in your URL
Any other idea @molten yarrow
global.messageReminderModel
ah ok
thanks
still undefined
i will note that they are both seperate functions that I am exporting into my index file
but i have no idea how to define it then
@molten yarrow I restarted it again. Same thing
how can i check if my bot is the only one in a vc?
@gritty bolt are you trying to use it immediately or only on message events or some other events?
did you change your "/login" route?
I did
is there a way I can require it in my index as well?
without it being in a function?
Afaik you dont need to wait for mongo to connect to create models
You can create all models immediately and then connect later
@molten yarrow any other idea?
can u try changing the scopes on line 104 to
scope: ["identify", "guilds.join"]
Okay
how do I require variables though from this file tok my index file?
give them to module.exports
Now my friend with the access to restart the server went offline... XD
xD
He‘s back
create a local express server, to test stuff
@molten yarrow invalid...
And I changed all
And the server is changing i
it*
but its telling in the link "o.zwolfy.tech%3A3000%2Fredirect" that your redirect is wrong
this one works fine if i edit it myself
Tim
app.get('/auth/callback',
passport.authenticate('discord', {
failureRedirect: '/',
successRedirect: "/"
})
);
@fringe axle did you add the redirect url to your oauth2 in your discord developers page?
Yes
can u make a screen?
how do I make my bot leave fake servers while someone invites it? (d.js)
from developer portal
How I can to do status with that 1,400 Users
@quartz kindle
@molten yarrow
Is there a good way to make the bot auto remove a vote role after being added after 12 hours? (using discord.js)
without using setTimeout/databases or something
well if i have to i can use a database but not a timer because the bot might restart
how do i check if my bot is alone in a vc
and how do i send an image from my pc??
looks fine tho
I know...
maybe config?
config.yaml?
@ancient nova
bot.guilds.cache.get(guildid).leave()
where you saved your stuff for DiscordStrategy
@molten yarrow should I send you the config.yaml?
yeah in dm
redirect: "http://o.zwolfy.tech:3000/auth/callback"
scopes:
- identify
- guilds.join
still this is it
you can log all your servers and find the IDs
if usercount in that server is below 5 then make bot leave. will that work?
@molten yarrow you see?
:/
edit line 103 to callbackURL: "http://o.zwolfy.tech:3000/auth/callback",
some dude has been inviting my bot to fake servers
I just want my bot to stop joining them
Okay
please help me
loop over all server and leave if memberCount <= 5
show your code :3
if (bot.guild.memberCount() <= 5) {
message.channel.send('Your Server Has Under 5 Members And Therefore Is Recognized As A Dummy/Fake server, Bot Will Now Leave')
await message.guild.leave();
}
module.exports.messageReminderSchema = new mongoose.Schema({
user: String,
messageLink: String,
time: String
});
module.exports.messageReminderModel = mongoose.model('messageReminder', module.exports.messageReminderSchema);
//This is in a function
(await module.exports.messageReminderModel.find({}).forEach(data => {
let currentUnix = Date.now()
if(data.time <= currentUnix) remindUser()
schedule.scheduleJob(data.time, remindUser);
console.log("Scheduled a reminder.");
}))```
I keep getting that messageReminderModel is undefined
@molten yarrow I want onBotJoined
@molten yarrow still invalid...
How I can to do status with that 1,400 Users
when someone invites my bot to their server
With the ,
this executes
Help
@molten yarrow the link is still invalid... ;__;
@low shard
your number.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
yeah
@molten yarrow any idea now?
could you write me a code to do that, please?
@molten yarrow still this link and I changed everything: https://discord.com/oauth2/authorize?client_id=746014727544766565&redirect_uri=http%3A%2F%2Fo.zwolfy.tech%3A3000%2Fredirect&response_type=code&scope=identify guilds.join
@fringe axle like i sayed its something with your redirect url
@ancient nova add it to your guildCreate event
Huh?
..
how do i send an image from my pc?
Attachment?
@molten yarrow can you write a script to do that though, I have no clue how to make that
no
Attachment?
@low shard yea
not allowed to spoonfeed here 
@molten yarrow any idea to fix it now?
I have no clue on go HOW even make a leaving command, I made the one I've sent you but it didn't work.
bruh
I mean I can make a leaving command
const attachment = new Attachment(“”)
message.channel.send(attachment)
I think this
Try
<guild>.leave() is already a command
but not on joined leave
D:
client.on("guildCreate", guild => {
// put stuff here
)}
guild is a guild object
so it has .memberCount
onServerJoin?
@drifting wedge work?
are you d.JS
so I do guild.membetCount inside that?
yes
alright.
@drifting wedge work?
@low shard ill try
if(memberCount < desired count)return guild.leave()
ty
K tell me
@molten yarrow should I remove this part?:
redirect: "http://o.zwolfy.tech:3000/auth/callback"
scopes:
- identify
- guilds.join
@fringe axle do u have any other config files?
Uh, no
client.on("guildCreate", guild => {
if (guild.memberCount < 5) { message.channel.send('Fake server detected, leaving server')
guild.leave()
}
)}
@misty sigil
message.channel doesn’t exist
Give me the image name
lolmao
how do i make my bot repeat a message every 5 mins
message.channel.send("here the message", {
files: [{
attachment:"path",
name: 'name.png'
}]
})
@drifting wedge
Give me the image name
@low shard 1.png
you need to get the channel and send it
@misty sigil what do you mean?
its using pil
Lmao
u can’t have message.channel in a guildCreate event
it doesn’t provide a message payload
@gentle talon setInterval()
@molten yarrow Any other idea?
alright, thanks for your help, I'll just keep my bot unprotected. eventually I'll lose aspiration to continue developing my bot and it'll be a time wasted anyways
ok thanks
you can just remove the message.channel.send @ancient nova
@misty sigil I want an message to test it with before putting bot.leave I don't have any testing bots to test it with
please give me !leave {serverid} command


Nope
i will leave my bot in blank servers
You need to make one
..I'll just go
I don’t because server is server
lmfao ikr
storing end user data that isnt cached
seems a bit
nor encrypted

@misty sigil bruh I don't wanna get wrong groth thingie or whatever some dude has been adding my bot to fake servers
I just wanna prevent that from happening in the future
though you could get harmed if you are lower than 100 servers
imagine a guy adds you on 100 servers, now what? you got inorganic growth and you cant verify, and now every guild that try to your bot wont be able to
¯_(ツ)_/¯
if you get too much fake servers discord will block you from verification.
Yep
@gentle talon setInterval()
@molten yarrow but how do you type it in?
doesnt matter
THATS WHAT IM TRYING TO PREVENT HERE
we’re doing it to grow over 100 servers
I'm doing it not to lose my months of work bruh

client.on("guildCreate", guild => { if(guild.memberCount < 5)return guild.leave() )}
you sure this will work?
yea it should
100% sure?
thats bad design though
right click it then click copy image adress
@gentle talon
const interval = setInterval(() => {
//your code
}, 300000); //5min
//clearInterval(interval); to stop it
right click it then click copy image adress
@gentle talon its in my pc
100% sure?
@ancient nova yes
:<
ah ok thanks @molten yarrow
alright.
within the idle timer, if server doesnt send 20 messages AND doesnt use 5+ commands AND has less than 10 members, it leaves
im not interested in dead servers
¯_(ツ)_/¯
just saturates the bot statistics
should I change client to bot?

yea but
should I change client to bot?
@ancient nova if ur client instance is called bot, yes
some bots even have clients named after themselves
and its using PIL
why not?
bc im using heroku

😩

yes
alright then I'm refreshing my bot
but yeah matt, as i said, rn there isnt much need for me personally to get a lot of dead servers just to say 'hey my bot has x servers!" mainly cuz there isnt a need to rush verification
that didn't make sense
thats why i made the auto leave so strict
those are ANDS, not ORS
to make sure it has a little false positives as possible
damn strict as FUCK
while still leaving bad servers
iiirc
holdup
thats the auto leave kicking in
24 guilds down the drain
sad
@misty sigil alright it worked more or less
not much actually, its just inflating server stats
is it possible to add an message before the bot leaves?
bot.on("guildCreate", guild => {
if (guild.memberCount < 5) { guild.leave() }
})
to this
there aint much really stopping anyone from going make 20 accounts and adding the bot in one or two servers

stop making me feel more sad please
this dude tried to ruin my bot
howcome?
so yeah I'll get that growth thingie for sure
and leave all fake servers
run a global thing to leave then
do u have an eval command?
loop channels cache
yes
do u know his ID?
his ID or his servers
his ID
I can go and copy it
Nice
for(let g of client.guilds.cache.values()) {
if( g.memberCount >= 5 /*Check other stuff here like owner ids*/) g.leave();
}
Do not run that without knowing what it does
but thats the gist
bot.on("guildCreate", guild => {
if (guild.memberCount < 5) { guild.leave() }
}) <- bot how can I add a message before bot leaves to this
dont do that
that'll just run on guildCreate
aka when the guild is added
blacklist the onwer id
and clean your cache
get the owner of those bad guilds and whenever they try to add it to a guild, auto leave
likely will make alts, take taht into account
makes sense
store the owner id's who add your bot
if they start adding more than 3 servers, auto leave them the 4th
ah alright
let users= new Map();
on('botJoin', (g:Discord.Guild) => {
if(users.has(g.owner)) user.set(users.get(g.owner) + 1);
else users.set(g.owner , 1);
if(users.get(g.owner) > threshhold) g.leave();
})
of course, thats bad way of doing it cuz you'll lose all the values on bot restart
so you'll need a database to keep track of those values, so they persist
@ancient nova
seems neat












