#development
1 messages · Page 1668 of 1
Make sure you changed the bot pfp, not the app one
Yea

nope
@quartz kindle moving forwards
had to delete and recreate the VM due let's say happy little accidents and noticed I didn't active AES ext for the processors
generating process time is now ~ 50% quicker 
human stupidness at it's finest
just to inform you about things nobody actually cares
im trying to console log a message collector i have set up, but when i try to, i get this error: TypeError: Cannot read property 'content' of undefined (there are 5 messages) and here is the code:
console.log(collected) delivers an object of messages
objects are not arrays lol
multiple messages, so i used [x] on each
im dumb
but how do i get multiple messages to work
it delivers this, to be exact
and scrolling down is more messages
using the same methods like in djs dealing with collections
a collection of channels, members etc.
so what would i need to get the content of each message
fofofo
I dunno all the utils of djs but you could create an array
collection.array();
then looping through it
I'm sure there's an easier method I'm not aware of lmao
ok i'll try converting it to an array
see if that fixes it
alright, that worked, thanks @boreal iron
my pleasure, but as I said they may is a more effient way
you're probably right but this worked anyways
yeah, it does
is there any way i can find bot analytics?
on top.gg?
or your bot
no on discord in general
discord doesnt track bot analytics
nope
ok
you have to track it yourself
I recommend using influxdb
you can easily visualize influx with grafana ( a web server that reads influx and creates graphs )
fancy graphs
is that for js?
yeah
oh i forgot to ask what lib are you
im py
oh
ok
yeah
please read the docs of the library you use instead
getting server count from your library should be common knowledge imo
I was originally talking about analytics
hm nvmd then
You need to install discord.py[voice]
Idk
The used by discord.py for voice is PyNaCl, this is in discord.py[voice] ¯_(ツ)_/¯
trying to use an economy npm package for my bot, it requires the user's ID to add to their balance
if (msg.content.toLowerCase().startsWith(',,add ')) {
if(msg.author.id != "240125631885606913") return;
let mention = msg.mentions.users.first();
if(mention) console.log(`ID IS ${mention.id}`);
person = mention || msg.author;
toAdd = Number(msg.content.substring(6));
if(toAdd === NaN) return;
var output = await eco.AddToBalance(person.id, toAdd);
console.log(person.id);
msg.channel.send(`Added ℭ${toAdd} to ${person.username}'s balance. You now have ℭ${output.newbalance}`);
}
if i do it without a mention it works fine, but if i mention someone it logs an error. i can get the person.id fine, so idk what's wrong
You need ffmpeg i think
Because in the library docs can use discord.FFmpegPCMAudio() but this raise this exception if this not found ffmpeg:
discord.errors.ClientException: ffmpeg was not found.
Is this correct?
If(command === "restart") {
if(message.author.id !== "OWNER") return;
message.channel.send(`Restarting...`);
process.exit()
}```
yeah, and will only restart if you use pm2
pm2?
yep. process manager https://www.npmjs.com/package/pm2
I also asked my friend.He did process.exit() & the bot restarted.
If he is using pm2 then it will be automatically restarted
but if you're not using pm2 then process.exit() will just close the process
Oh
ok
,kiss
,kiss @earnest phoenix
pls ue rob
pls use rob
@fair grail
pls beg
pls pm
i
pls hunt
pls fish
uhhhh I need help with something,
I want to make something that makes the bot leave the server if there is 30+ discord bots ||way more than a server would need|| and I don't really know how to do it, I know I need to use something like this
guild.fetchIntegrations({includeApplications :true})
.then(integrations => console.log(`Fetched ${integrations.size} integrations`))
.catch(console.error);
But I don't know what to do next
Why are you fetching integrations for that 
idk I was told to
I know a different way but I don't know how to use it that way
Do you want to do that everytime it joins a server or everytime a server reaches 30+ bots
every time it joins a server
Just filter the members that are bots and check size, if it's higher than 30 bots, leave, you can filter them by using <Collection>.filter() on <Guild>.members.cache, you can check if they're a bot by <GuildMember>.user.bot, and finally check size by <Collection>.size, remember that not all members are cached in a guild by default, so you have to fetch all members to get an accurate count of bots in that guild, you can fetch them by <Guild>.members.fetch(), this requires the GUILD_MEMBERS intent to work
Btw you can leave the guild by <Guild>.leave()
module.exports = {
name: "invite",
description: "Send bot invite link",
execute(message, args) {
return message.member
.send(
`https://discord.com/oauth2/authorize?client_id=${message.client.user.id}&permissions=70282305&scope=bot
also join in our server !
`
)
.catch(console.error)
return message.channel.send("Check Ur Dm !");
}
};``` its giving dm but not giving message in server channel
Remove the return on the first message
In fact you don't need to return either tbh
Return means if the code reaches that line (for example in an if statement) then it stops running the code at that line and won't run anything that comes after it. @dusty oracle
👍
how to use the plasma bot?
I use htaccess forwarding on my domain
oooo
But I'll probably change it to a page with forwarding so I can integrate Google Analytics
oh ok
what?
You need to install parse-ms to use it if that's what you mean. Are you getting a missing module error?
I want to make daily command
You don't really need parse-ms to do that. A simple function to convert ms to hours, minutes and seconds will do.
Why do you want to parse milliseconds in the first place
Probably because the last daily command message timestamp gets saved to the db in ms format. Then you check the last daily time against the current timestamp.
If you want an error message for the user showing the time left to wait before claiming again it's probably best to show in a readable format and not in ms 
¯_(ツ)_/¯
show in ms but ms/10000 joke
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports.run = async (client, message, args) => {
if(!message.content.startsWith('m!'))return;
let user = message.author;
let timeout = 86400000;
let amount = 200;
let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let timeEmbed = new Discord.RichEmbed()
.setColor("#FFFFFF")
.setDescription(`:Cross: You've already collected your daily reward\n\nCollect it again in ${time.hours}h ${time.minutes}m ${time.seconds}s `);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new Discord.RichEmbed()
.setColor("#FFFFFF")
.setDescription(`:Check: You've collected your daily reward of ${amount} coins`);
message.channel.send(moneyEmbed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`daily_${message.guild.id}_${user.id}`, Date.now())
}
};
module.exports.help = {
name:"daily",
aliases: ["day"]
}```
I found this in the internet so e
const Discord = require('discord.js')
module.exports = {
name: "uptime",
aliases: ["u"],
description: "Check the uptime",
execute(message) {
let seconds = Math.floor(message.client.uptime / 1000);
let minutes = Math.floor(seconds / 60);
let hours = Math.floor(minutes / 60);
let days = Math.floor(hours / 24);
seconds %= 60;
minutes %= 60;
hours %= 24;
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle("Bot Uptime")
.setDescription("Bot's Uptime from node.js is:")
.addField(`day(s):`, `${days}`)
.addField(`hour(s):`, `${hours}`)
.addField(`minute(s)`, `${minutes}`)
.addField(`second(s)`, `${seconds}`)
.setFooter(`Dr.Denzy Bot | >uptime`)
return message.channel.send(embed)
.catch(console.error);
}
};
I keep having erors with this code I'm not sure but I also think it's because my command handler not sure
Well that's D.JS V11 for a start...
What are you seeing in the console log?
It could be that days is returning as undefined or null and that's causing the embed field value to be empty which is causing the error. Try removing days. Days will never be higher than 0 anyway because each session lasts 24h max.
If you want to check days of uptime you could save the startup timestamp on the ready event to your db or something
this erorr
ow I see
sorry to bother you but I fixed my mistake
Well, you name the function there 'execute'
yea I used
execute(message) {
instead of
run(message) {
const memberCount = guild.members.cache.filter((member) => !member.user.bot).size;
const botCount = guild.members.cache.filter((member) => member.user.bot).size;
if (botCount > memberCount) {
guild.leave().catch((err) => {
console.log(`there was an error leaving the guild: \n ${err.message}`);
});
}
this look right?
why dont u just do guild.memberCount
they want to see if the server has more bots than members
memberCount just gives you the count of all members
install pynacı
Yeah
C:\xampp\htdocs\node_modules\mongodb\lib\core\topologies\server.js:438
new MongoNetworkError(
^
MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1138:16) {
name: 'MongoNetworkError'
}]```
Why am I getting this?
I'm connecting like: `mongoose.connect('mongodb://localhost/blog')`
this is the code where i'm doing anything with mongoose:
```js
const express = require('express')
const articleRouter = require("./routes/articles")
const mongoose = require('mongoose')
const app = express()
mongoose.connect('mongodb://localhost/blog')```
it can't?
yes
Guys how to make the bot send an error message if there is more than a mention?
not node.js
Someone know a daily code in js that is not need quick.db or parse-ms?
Oh my fucking god i cant do it
how do I get my bot to join a voice channel does it require me to make a new folder
it's just channel.join()
you obviously need to define which channel
yea but do I make a folder for it or add it in index.js or..
let mentions = message.mentions
if (message.content.toLowerCase().startsWith(config.prefix + "kick")) {
if(!args[0]) return message.channel.send('You must specify who you want to kick!') //Messaggio troppo piccolo
let kicked = message.mentions.members.first() //Persona da kickare
if(!kicked) return message.channel.send('You must specify who you want to kick!') //Persona da kickare mancante
if(mentions[0]) return message.channel.send('You can only kick one user per time!') //Troppi kick
if(!args[1]) return message.channel.send('You must specify the reason for the kick!') //Ragione mancante
NHIP.setDescription("You must have the `Kick Members` permission to use this command!") //cambio descrizione dell embed dei permessi mancanti con i kick
NHIP2.setDescription("I need the `Kick Members` permission to execute this command!") //cambio descrizione dell embed die permessi del bot mancanti con i ruoli
}```
What is wrong with this
depends how you do stuff
is there an error
you can do it as you wish really
whats the error?
i want it to NOT run when there is more than 1 mention
so I can make a file called vc.js and add the codes there
I tried with mentions[0], mentions[1], with ! or without but it never worked
i would make one file for each command. for example join.js and so on
k
thx
yw
Can someone help me?
that's a lazy thing to do
I normally put 5-8 commands per file
why tho?
how is that a lazy thing to do
its a lot cleaner to have seperate files
mentions.size returns the number of mentions
Yea Then I would have like 250 files per bot
so i do if(!mentions.size == 1) return message.channel.send('You can only kick 1 person!') ?
Why would I need to make a separate file for 10 lines of code ?
1
what
mentions.size > 1
oh k
because if its a seperate command, it’ll be a lot cleaner
lol Discord tricked me
<
lol. i have events. index. even my command handler is in a seperate file. all my mongodb handlers are in seperate files
crazy
yep
i have one command handler. multiple handlers for mongo because i have multiple collections in the db
how to setup my bot
What's wrong putting alike commands together ?
i never said i had multiple connections. i said i had different handlers
how to setup voicemaster
nothing. i just think it gets messy
With axios or node-fetch ??
each model handles the information it gets from the db. stop arguing
let me help you then
so...
schema is the setup in the collection. so kindof true
I had to get my code xd
lol ok
res.status(200).end()```
yw
This dude had `` in his username
@crystal wigeon did someone ping me for this issue?
Also anyone know how many nodes I can have with lavalink? It doesn't seem to be working with some servers. My bot is in 2.5k servers
It works in some but doesn't work in some
if I knew what a lavalink was
I see "no nodes available" error
@opal plank @cinder patio
Sorry for the pings
Heuheu
@near stratus
if(!args[0]) return message.channel.send('You must specify who you want to kick!') //Messaggio troppo piccolo
let kicked = message.mentions.members.first() //Persona da kickare
if(!kicked) return message.channel.send('You must specify who you want to kick!') //Persona da kickare mancante
if(!args[1]) return message.channel.send('You must specify the reason for the kick!') //Ragione mancante
if(!mentions.size > 1) return message.channel.send('You can only kick one user per time!') //Troppi kick
message.channel.send('lol') < i need to replace this with the rest of the code
}```
It should look like this?
message.mentions.size
i did let mentions = message.mentions.size
const member = message.mentions.members.first();
that will get the first mentioned user
ik im not trying to do that
No it'll sort according to ID
i want the bot to stop running the cmd if there is more than a mention
mmm
never use message.mentions.first() to ban or mute
!baan @solemn quartz cuz he humiliated @earnest phoenix
^^^
wat
I know
I dont want that
No
The one with lower ID
I want the command not to run if there is more than 2 fucking mentions
so
wait lemme get link
@earnest phoenix @silk ingot @solemn quartz https://discordjs.guide/miscellaneous/parsing-mention-arguments.html
so i do ?Kick @solemn quartz @solemn quartz
if this arg^ is a mention it doesnt
run
ty
using message.mentions can lead to a few problems.
For example you do not really know which mention belongs to which argument. Or if you are splitting the message's content by spaces to get the args, then the mentions will still take up space in your args array which can mess up the rest of your args parsing if you are not careful.
it can kick the last person if his id is lower than the first
it is what it is
They just sort it according to id
what the fuck
yea
i never thinked a moderation command could make me go crazy
have you done a mute command?
yep
oh
easy way : copy from someone's GitHub
but with the message.mentions.members.first
I thought that would be harder xD
so i think i need to change it
good idea 
why are yall making this more complicated than it needs to be
better safe than sorry
yeah
with reason @earnest phoenix
Wait
just strange how discord.js interprets .first() but ok 😐
Does discord.py exist?
yes
wow
It's not
I'm just gonna point out
What is better discord.js or eris client?
everything except Discord.cpp exists
(even Discord.php)
Detritus
that I had a lot more issues in discord.py than I've ever had with discord.js
wtf is that
Eris takes less ram
Yeah, but it's called aegis.cpp
wtf is php
like
and cpp
it just gives up
wat
lol
Google for php
olo
^
there
lol
if (message.mentions.users.size < 1) return message.reply('You must mention someone to kick them.').catch(console.error);
yep
found this on gitHub
you catch the method
why don't you do let target = message.mentions.users.first()
if(!target) return message.reply('You must mention someone to kick them.')
why not like this
this is correct
hmm
for me it always works
that is a function
you need to get that function
- this
function getUserFromMention(mention) {
if (!mention) return;
if (mention.startsWith('<@') && mention.endsWith('>')) {
mention = mention.slice(2, -1);
if (mention.startsWith('!')) {
mention = mention.slice(1);
}
return client.users.cache.get(mention);
}
}
I was literally reading that
function getUserFromMention(mention) {
if (!mention) return;
if (mention.startsWith('<@') && mention.endsWith('>')) {
mention = mention.slice(2, -1);
if (mention.startsWith('!')) {
mention = mention.slice(1);
}
return client.users.cache.get(mention);
}
}
Introducing code Block
dame dame darling

interesting
echo("o")
console.log('hello')
console.log('idk');
<html>
<h1 style="color:red;"> Stop Now </h1>
</html>
{
"question": "why?"
}
<html>
<h1> No you </h1>
</html>

wtf is happening
all good here?
fair
body {
background-image: what is up bois;
}
Imagine
I wouldn't care less
😐
Microsoft will ban NSFW from Discord
that wasn't really my worry, but sure
No more hentai for you I guess

Imagine Reddit banning nsfw
Please don't do it 😔😭

what is the presence intent and server members intent?
They need to be enabled for your bot to be able to see presences and server members
Keep in mind that both of those are privileged intents. So if your bot is in 100 servers or more, you'll need to apply to Discord to be able to enable them
I'm doing this right now
Hello! I'm going to add a vote command in my bot which will give reward to the user after the user voted my bot in top.gg, how can I do something like this in discord.py?
What code should I add, I need an example
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready' , () => {
console.log('Ready!');
});
client.login('Token-here'); ```
super simple basic code ;D
A Brainfuck editor & optimizing interpreter, written in JavaScript. It's pretty fast.
I was thinking of saying you would be one of the co-owners lol
yeah
i need some help with python and sqlite if anybody knows how to use them pls dm me 😄
Use #general-int for different languages please
@earnest phoenix
Make sure you have node-gyp globally installed, including all of its dependencies. On Windows you may need to configure some things manually.
If you're using Electron, try running electron-rebuild
If you're using Windows, follow these steps. Do them in this order, and don't skip steps.
- Install the latest of node 10, 12, or 14.
- Install latest Visual Studio Community and Desktop Development with C++ extension.
- Install latest Python.
- Run following commands:
npm config set msvs_version 2019
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
Run npm install
let kicked = getUserFromMention(args[0])
const memk = message.guild.member(kicked)
if (memk.hasPermission('ADMINISTRATOR')) || (memk.hasPermission('KICK_MEMBERS')) || (memk.hasPermission('BAN_MEMBERS')) || if (memk.hasPermission('MANAGE_MESSAGES')) || (memk.hasPermission('DEAFEN_MEMBERS')) ||
(memk.hasPermission('MUTE_MEMBERS')) || (memk.hasPermission('VIEW_AUDIT_LOG')) || (memk.hasPermission('MANAGE_SERVER')) || (memk.hasPermission('MANAGE_EMOJIS')) ||
(memk.hasPermission('MANAGE_ROLES')) || (memk.hasPermission('MANAGE_CHANNELS')) || (memk.hasPermission('ADMINISTRATOR')) || (memk.hasPermission('MANAGE_NICKNAMES')) || (memk.hasPermission('MANAGE_WEBHOOKS')) || (memk.hasPermission('MENTION_EVERYONE')) || (memk.hasPermission('PRIORTY_SPEAKER')) || (memk.hasPermission('MOVE_MEMBERS')) return message.channel.send('I cant ban another mod/admin!')
```Can someone help me do this but with another method and more simple?
what the
start by removing all the extra if mentions inside of it
tried that
if(first || second || third || fourth || fifth) return;
you also have, like, extra parentheses everywhere that don't work
if(a) || if(b) || if(c) return is what you have now
ooh
pay attention to your braces and parentheses.
oh about 20-25 years
I'm 40.
You said coding.
I've been using javascript, python, and other various programming languages, since I was 14 years old. And I was born in 1981. So, you do the math.
Evie is our cute boomer
Wow
You can also do something like this:
const cantBanMembersWithThesePerms = [...];
if (member.permissions.toArray().some(perm => cantBanMembersWithThesePerms.includes(perm))) return; // Cannot ban member
YOU HAVE BEEN CODING FOR 26 YEARS?!
what the actual fuck
i cant even code for 3 hours straight that i fall asleep
They haven't coded for 25 years straight
ty
@cinder patio Can you explain why i see a person with blonde hair when i first look at your pfp??
Can i send pictures here? I have a problem that I don't understand
Ok
Do it in code block
I can't I'm on mobile
A picture is fine too
wait
Ok
yeah but if someone needs to edit it they need to rewrite everything he writed
then just copy paste it
We're not really supposed to write code for people anyways. A picture is just fine
Like i want my bot verified but like it went threw but it says something that i don't understand, like i can read it I just don't understand.
That means your bot grew too fast, so Discord flagged it
So I have to wait?
Yes, just wait, and let your bot grow naturally
Ok thank you
can't it also mean that the same person has ownership of loads of servers your bot is in?
That can be one of the reasons, yes
cute passive aggresive
There is another way to do it, which is the most efficient, but also the most unreadable:
if (member.permissions.bitfield & sumOfBits !== 0) return; // Member doesn't have any of the permissions in the sum
where sumOfBits is the sum of the bits of the permissions (You can get that number here: https://discordapi.com/permissions.html#)
A small calculator that generates Discord OAuth invite links
what the fuck
what
i know DPC
but what
Wait does it do the same effect if the mentioned has only one of the permissions?
yes
You guys need to help me real quik what looks better in the way of how it looks and the information that it give
THIS
OR
2
why not include all the info?
why not have it all
The rating is useless
not really
people can like things that no other likes
still shows what other people think of it
i think maybe i should put the less usefull stuff as a footer like 💖83% | TV Show | 2007 - 2017 and try to add on top the duration and how many episodes
wait so i just go on DPC and select all that perms and then replace 0 with the id of the permissions?
no you replace sumOfBits with the number the website gave you
This one right here
!== 0 is a calculation so it wouldnt work if you replaced that with some words if im correct
actually !== means identical
i think
but im not sure
or same value
i dont really remember
Though I don't really recommend using that last method, it's unreadable
true
isnt that || and =
lets just use this
the more readable
wait
Hello
Actually I guess you can mix the two:
const {Permissions} = require("discord.js");
const cantBanMembersWithThesePerms = new Permissions(["YOUR_PERMS_HERE", "ANOTHER_PERM"]);
if (member.permissions.bitfield & cantBanMembersWithThesePerms.bitfield !== 0) return;
Please move to #general unless you have a development question
Oh hey @solemn quartz
@glossy bear if you're just here to talk go to #general btw
if theres an error in your code send it
Thank you i didn't notice that
np
There, both readable and efficient
const Discord = require('discord.js')
modules.exports {
name: 'join',
decription: 'joins a voice channel',
aliases: ['j'],
usage: '>join',
cooldown: 2,
run(message, args) {
voiceChannel.join() .then(connection => console.log('Connected!')) .catch(console.error);
}
});
will this work for my bot to join a voice channel
nope does not work
Ok so why are you asking will this work if you know it doesn't?
Skip to the part where you tell us what the problem is.
Lol
maybe someone could help me with the code
What exactly is the problem you're experiencing?
WHAT THE FUCK IS THE CONSOLE ERROR
Relax
iv been trying to get my bot join a voice channel
could you gently send it in this chat so people can help you? c:
Can you not be rude?
Ok and what, exactly, is the error you get or the problem that's happening?
we know you're trying to join a voice channel - that's literally the first thing you said.
now tell us what's wrong with it
@frigid mountain are you english?
You gotta learn how to be helpful when asking for help.
just to be sure
It doesn't matter what country they're from, just let them ask their question
Oooh
k idk how to start ppl say make a file called join.js and add the guild.VoiceChannelJoin()
lol
you already have a command. you've shown your code
Explain why that code isn't currently working.
If you feel like you don't understand what you're doing, that's probably a sign to learn some JavaScript before getting into making a bot.
I do know the codes and others but I dont know what I'm doing to make my bot join a voice channel
Gotta love the
"my car won't start!"
"ok what does it do?"
"It won't start!"
"ok but what happens when you try to start the car?"
"I'm trying to start my car, it won't start!"
type of conversation. It really puts into perspective the fact that people try to write articles like "How to write a question"
https://www.propublica.org/nerds/how-to-ask-programming-questions
If you knew how to code you'd understand at least that voiceChannels is undefined and you'd have known this code wouldn't work in the first place.
Ok how do I make my bot enter a voice channel does it require me to make files or
ok nvm it's fine I'll ask the other sever
A bold strategy, cotton, let's see if it pays off.
It's hard to get help with your car if you ride your bike to the mechanic
Typical Tyler behaviour, unfortunately.
lmao
Don't try to advertise your sever
And once again, this chat is for development related questions. Move to #general if you want to talk to people
Oh ok
And btw im 90% theres a rule that says u cant hire people to go in your server @glossy bear
You can always read the rules in #rules-and-info if you want to be 100% sure
Okok
Thank you!
Thank you!
wait if you want i can help you
just say what is the problem
why do you need people to join your server
Nothing but im just excited about this server
They're literally just trying to advertise, can we move on
Ok great it happened 10 minutes ago can we just stop the conversation now 😛
omg just stop
???
Spamming emotes will also get you punished brother
Ok
Move away from this chat unless you have a development related question, 3rd time I'm telling you now
Im moving away!!!

global emojis are no longer a thing
oh lol
For how much were there?
cuz i heard jet's world had them
but im not advertising and im not sure
it was a thing they were doing with twitch
global emojis use to be emojis you could use without nitro
yea
animated ones too?
no
money probably
hmm yeah
Guys btw if i remember i got muted for 1 month or 2 here
nitro === $$$
yep
This isn't #general
yep
Guys do you think these are All the moderation perms?
have a look here and take a guess https://discord.js.org/#/docs/main/stable/class/Permissions?scrollTo=s-FLAGS
Yea i think yes
Just Admin includes them all
Remove Priority Speaker
k
yea but if someone has ban members but not admin
thats just stupid
Manage_Nicknames also can be removed
https://sourceb.in/a9i1w1pC3N i would like to make the "readdirSync" not read my "developers" folder, how would i do that
right
check if the dir is equal to the folder you want to ignore, and if it is return
Also this is questionable
let data = new Object();
data = {
name: dir.toUpperCase(),
value,
}
what is toUpperCase? I know toLowerCase but wth is that
it... puts text to UPPER CASE
like this?
is it just the same thing?
Not quite
lowercase UPPERCASE
🆙
!dir this negates the expression after it - if dir is a string, it becomes false
It's only "the same" if you don't understand lowercase and UPPERCASE letters.
This regex for example: match(/dirname|dirname2|dev|src|img/gi)
You need to use !==
The former, and also just return after the if statement
do you wanna READ files only?
if (condition) return
If so use additional parameters for the function
readdirSync(<path>, { withFileTypes: true }); will not read directories
i just wanna read sub-folders, but skip the "developer" one
oh, alright, than filter is what u need, yeah
That doesn't ignore directories, just gives you more info on the file type
oh huh... didn't read carefully enough I guess lmao
this returns no dirs at all
Also why loop through the array twice, once with .filter, once with forEach, when you can just ignore the file when it comes time in the forEach loop
It is a boolean value which specifies whether the files would be returned as fs.Dirent objects. The default value is ‘false’.
my bad
You need to put your entire code that's in the forEach function inside the if statement body
Or you could do
if (dir !== "developer") return;
why would you wanna end foreach if the dir was found?
That doesn't end it
The forEach loop continues to iterate through the next element, it just exits the callback
np
You can do that yourself with a setInterval
You don't need a lib to do this. You can just chain setInterval to take advantage of the process's native ticks
If you need functions to execute in the order and they are async, you can just have 1 setInterval where it does all of the functions and awaits
hi
I want to create a BOT
i made one but currently its offline
I am trying to make it online but something is wrong?
https://images-ext-1.discordapp.net/external/EAz-E2NPgHAyCH2cJPNs8akiu5xzwbok8QoUbKR2TBQ/https/huh.why-am-i-he.re/f/sw5CRV.png?width=1440&height=27 has anyone a idea how i do exactly that request but in Axios? I know how to set the headers etc but i just dunno how to set that output thingy.
please ping me in the reply cuz i have that server muted due to its activity
Do you know how a discord bot works?
umm first create a app in the developer project
and then I have to code
in SHORT
and authorize it

yeah, so, show us your code
and then maybe using a visual studio CODE IT
and if there are any errors
wait. I am trying to use "sinusbot".Will that work,cuz I am not that familiar with coding.?
no clue what that is
You should ask in their support server if they have one
or create an issue on github
Sinusbot is an Selfhostable thingy
You need an Server or PC for that
Its like an WebPortal for Creating TS3 and Discord Bots for Music
Guys should i add anything else to my kick command?
if (message.content.toLowerCase().startsWith(config.prefix + "kick")) {
NHIP.setDescription("You must have the `Kick Members` permission to use this command!") //cambio descrizione dell embed dei permessi mancanti con i kick
if (message.member.hasPermission('KICK_MEMBERS')) {
let kicked = getUserFromMention(args[0])
if(!kicked) return message.channel.send('You must specify who you want to kick!')
const memk = message.guild.member(kicked)
const reason = args.join(" ").slice(22);
if (memk.permissions.toArray().some(perm => ModPerms.includes(perm))) return message.channel.send(`I can't kick another mod/admin!`)
if(!reason) return message.channel.send('You must specify the reason for the kick!')
let kickDM = new Discord.MessageEmbed() //Embed da mandare in DM al kicked
.setColor(colore)
.setTitle('You got kicked! :D')
.setDescription(`Kicked from: ${guild.name} \n Kicked by: <@${message.author.id}> \n Reason: ${reason}`)
mem.send(kickDM)
let kickE = new Discord.MessageEmbed() //embed da mandare nel canale dove è stato eseguito il comando
.setColor(colore)
.setTitle('User Kicked!')
.setDescription(`I succesfully kicked ${kicked.username}!`)
message.channel.send(kickE)
memk.kick({reason: reason})
} else { //Else dell'inizio, se non hai il permesso, manda l'embed che dice che devi avere il permesso di kickare i membri
message.channel.send(NHIP)
}
}```
Guilded.js is nice... it has cache control
too bad guilded is shit
Does anyone ever worked with the website scrapping program parsehub
if u wanna stick to djs but control caching, switch to djs-light
You don't need a service to scrape websites
no it make .json files for you
i know
yo, nobody actually cares, that's the wrong place for ads
but im asking if someone worked with it
probably no
Make a GET request to the site > use a HTML parser to traverse the document > Profit
if the content is is not static and the site uses a UI framework then it gets harder
you'd have to use puppeteer or something similar
the device it runs on has to be online 24/7
permanently
aye, either a PC in your local network or a server
bots have encryption the same way users have right? So it's safe to have a local pc running it?
Bots are connected to discord
bots have encryption the same way users have right?
what?
there's no need for encryption
okay
it's all based on websocket connections and cURL requests
I have a question,
How do you get you bot to play a game/have a rich presence?
I use python and I'm pretty sure all the code discord gives is java script.
So at all, no security issue if you run a bot from home, if that's your question
hi
thank you
thx
maybe check the latency
Seems they want a rich presence for their user account with a Python script
Yeah

How long do you usually wait until you get a response if your bot was declined or accepted?
1-2 weeks
Figured it out
const Discord = require('discord.js')
module.exports = {
name: "join",
aliases: ["j"],
description: "joins the bot to a voice channel",
run: async (message, args) => {
const connection = await
message.member.voice.channel.join();
}
}
made by myself and it worked
Master coder✅
Ayy, good job.
thx
almost 3 hours later
"Master Coder"
good job ig
lol
c:
I tried almost 100 different codes
btw are you english?
yes
lol
Lmao
k
mAsTeR cOdEr
Good for you that you got it working!
yea thx✅
The Partial<T> type annotation is so helpful. Why did I just find this
Can I get a link to docs for gojs
I'm trying to remake this https://gojs.net/latest/samples/genogram.html
A genogram is a family tree diagram for visualizing hereditary patterns.
Ok, I think I'm done.
All I have to do is waiting for the long approval, I hope they approve it.
is it worth it to make a bot on discord anymore
because i have a very cool idea buttttt
because i get manic sometimes and code for 48h straight

Can i have help? i am using discord.js and i am trying to send a msg when the bot is invited but this happens
the error is right there
ok i figureg it out
I'm using glitch to host my files and now I want to port it over to my raspberry pi, one problem is have is I dont have a actual link for external systems to get access to it, what should I do about it?
huh ?
You're hosting your bot on Glitch and now you wanna move on to Raspberry Pi ?
Get the pi's IP address and transfer the files via FileZilla
^
Yes but the problem I have is now I wont have a link for other modules to get access to the code?
If that makes sense
If i port it over I dont get a link like this
What should I do about it?
why would you need a link ?
yourIp:port/ is your link
You edit the files on your PC, transfer them using filezilla
For other external systems to send requests with it
Can anyone files access my code using that link?
You'll have to setup port forwarding for the pi
yea external requests will be sent there once set up properly
Ah thanks
Honestly you're better off just buying a VPS for a few bucks imo over having to setup port forwarding and all that jazz
You can use ngnix or Apache for better handling and Firezilla for editing remotely as fewd said
yea
firezilla
My ISP is officially angry at me for using like 5tb of transfer a month 🤡
Bruh
What did you host, a public storage ?
Speaking of high network usage
How do you guys deal with api rate limits
Or worse
Getting your IP banned
Most libraries will handle rate limits for you anyways. Just don't be a dumb dumb and spam stuff
Hm i'm not talking about the discord api
but APIs you might use for commands
let's say an API for image search
I usually skim through the docs, they should always tell you the limits
then set cooldowns accordingly
unfortunately I can't find the docs for the api I use, and I often get get 429'd because servers just keep spamming the same search
the rate limit seems very low
for the moment I'm caching repeat requests which seems to help but I was wondering if there are better ways
anyway thanks for the help!
what's the API
how do i get the number of all members in every server my bot is in
Are you sure that the api is public?
Yo
well now that you mention it, no lmao
Marco types slow
ok
i have a question abt statuses on discord bots
this is my bots status atm and i was wondering if it updates on its own with out me having to run my bot again this is discord.py btw
@client.event
async def on_ready():
print('We Have Logged In As {0.user}'.format(client))
game = discord.Game(f"In {len(client.guilds)} Servers | d/help")
await client.change_presence(status=discord.Status.idle, activity=game)```
Hey! Is there a way to log every API calls made by Discord.js? I need to investigate a bug and knowing what Discord.js is doing would be a great help!
I was thinking of outgoing traffic
oh, requests made by discord.js
yes
Try the debug event but I'm not sure if it emits API calls
I'll try that thx
I've ported over the files, for my glitch project the base URL is https://aeaw-eawe-game.glitch.me
How do I get the base url out of a raspberry pi
No it doesn't 😕
Hmm then you can modify the api call functions
like
console.log(data);
return client.api.someFn(...data);
}
How do I get a base url?
how can i write manage nick names in python, like (administrator=True)..???
?
wat
Yeah but I don't know what Discord.js function to modify. I want to monitor all API calls
it's manage_nicknames or something
listen to rest event
yes flaze ty
i mean how can i make smthg like:
@commands.has_permissions(administrator=True)
but instead of administrator, its manage nicknames
.memberCount or smth like that
you're repeating yourself here
me?
@earnest phoenix
okk
use collections.reduce() from your <client>.guilds.cache and accumulate all guild members by using the memberCount property of the guild
client.guilds.cache.map(g => g.memberCount || 0).reduce(( x, y) => x + y, 0)
here

yeah, <client>.guilds.cache.reduce((acc, cur) => acc + cur.memberCount, 0);
most efficient one
It is prob something dumb but I keep getting this error.
TypeError: (intermediate value).setTitle(...).setDescription(...).addFeild is not a function
This is the embed: https://i.imgur.com/Cj4kfpW.png
addField()
lol works too
typo yeah
Idk how I didn't see it before.
you're probably tired
is there a way to use canvas in node 14.x?
I don't know what this event do (not documented) but it's never fired in my case
with canvas package
canvas package does not support node 14.x
hmm
try rebuilding or reinstalling
ha my bad
whats your node version flaz
let me check
wow 10/10 website
How do I get the base url ex. https://aeaw-eawe-game.glitch.me using http://localhost/
ty
totally we can see it
It's 14.16.0
You need to set up portforwarding
and for that you need the pi's IP address
so go get that first
i've researched on it but how do I make it so that I dont have to mess up my router
Because they all want me to modify something on my router
Is that the only way?
k im gone install that version of node 14
i hope canvas works!
I think so
Alright
I dont got the money thats why I'm porting in the first place
you can use aws for ex.
pi's should be servers only
i use it
I'm using pm2
I've got my pis ip address
What should I do now?








