#development

1 messages · Page 1668 of 1

smoky quartz
#

its not changing Kek

#

i wouldnt ask here if it was

earnest phoenix
#

Make sure you changed the bot pfp, not the app one

old cliff
#

Yea

smoky quartz
#

ah so theres the issue Run

#

thanks

old cliff
smoky quartz
#

yayyyy

old cliff
#

Ah yes

#

Make a support ticket to change the pfp

#

Discord™️

earnest phoenix
#

that was username no?

#

or it applies on pfp as well?

pale vessel
#

nope

blissful coral
#

this feels amazing

#

not a single bit of js

boreal iron
#

@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 KEKW

#

human stupidness at it's finest

#

just to inform you about things nobody actually cares

earnest phoenix
#

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:

boreal iron
#

No item actually exists

#

Is collected even an array?

earnest phoenix
#

console.log(collected) delivers an object of messages

boreal iron
#

objects are not arrays lol

earnest phoenix
#

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

boreal iron
#

using the same methods like in djs dealing with collections

#

a collection of channels, members etc.

earnest phoenix
#

so what would i need to get the content of each message

inland pulsar
#

fofofo

boreal iron
#

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

earnest phoenix
#

ok i'll try converting it to an array

#

see if that fixes it

#

alright, that worked, thanks @boreal iron

boreal iron
#

my pleasure, but as I said they may is a more effient way

earnest phoenix
#

you're probably right but this worked anyways

boreal iron
#

yeah, it does

earnest phoenix
#

is there any way i can find bot analytics?

#

or your bot

#

no on discord in general

inland pulsar
#

discord doesnt track bot analytics

boreal iron
#

nope

earnest phoenix
#

ok

inland pulsar
#

you have to track it yourself

earnest phoenix
#

alright

#

bot.guilds.cache.size is a way to go

inland pulsar
#

I recommend using influxdb

#

you can easily visualize influx with grafana ( a web server that reads influx and creates graphs )

#

fancy graphs

earnest phoenix
#

yeah

#

oh i forgot to ask what lib are you

#

im py

#

oh

#

ok

#

yeah

inland pulsar
#

please read the docs of the library you use instead

#

getting server count from your library should be common knowledge imo

earnest phoenix
#

I was originally talking about analytics

inland pulsar
#

hm nvmd then

sick fable
#

discord.client:PyNaCl is not installed , voice will not be supported

opal plank
#

isnt that sodium?

#

or kitchen salt?

ripe shadow
sick fable
sick fable
#

is*

ripe shadow
sick fable
#

oh

#

so can we play music with pynacl and youtube-dl?

#

No need of ffmpeg

spare portal
#

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

ripe shadow
#

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.

earnest phoenix
#

Is this correct?

If(command === "restart") {
if(message.author.id !== "OWNER") return;
message.channel.send(`Restarting...`);
process.exit()
}```
cinder patio
#

process.exit exits the process

#

so it just stops your bot

#

it doesn't restart it

pearl trail
#

yeah, and will only restart if you use pm2

earnest phoenix
#

Oh

#

what i have to replace for restarting the bot?

earnest phoenix
pearl trail
earnest phoenix
#

Ok

#

OhOk

earnest phoenix
cinder patio
#

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

earnest phoenix
#

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 pepehmmNoBG

#

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()

dusty oracle
#
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
rose warren
#

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

dusty oracle
#

ok

#

thanks !

#

yea now its working @rose warren thanks

rose warren
#

👍

dusty oracle
#

hey mac !

#

ho u do that

earnest phoenix
#

how to use the plasma bot?

dusty oracle
#

but how ?

rose warren
#

I use htaccess forwarding on my domain

dusty oracle
#

oooo

rose warren
#

But I'll probably change it to a page with forwarding so I can integrate Google Analytics

dusty oracle
#

oh ok

earnest phoenix
#

hi

#

ms constant is exist or i need to download something?

cinder patio
#

what?

earnest phoenix
#

const ms = require("parse-ms");

#

this

rose warren
#

You need to install parse-ms to use it if that's what you mean. Are you getting a missing module error?

earnest phoenix
#

I want to make daily command

rose warren
#

You don't really need parse-ms to do that. A simple function to convert ms to hours, minutes and seconds will do.

cinder patio
#

Why do you want to parse milliseconds in the first place

rose warren
#

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 KEKW

earnest phoenix
#

¯_(ツ)_/¯

earnest phoenix
#
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
frigid mountain
#
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

rose warren
rose warren
rose warren
#

If you want to check days of uptime you could save the startup timestamp on the ready event to your db or something

frigid mountain
#

ow I see

#

sorry to bother you but I fixed my mistake

long crow
#

Well, you name the function there 'execute'

frigid mountain
#

yea I used

execute(message) {

instead of

run(message) {
earnest phoenix
unreal estuary
#

why dont u just do guild.memberCount

cinder patio
#

they want to see if the server has more bots than members

#

memberCount just gives you the count of all members

unreal estuary
#

ohhhhh

#

lol right

#

it looks right then

earnest phoenix
sick fable
#

Done

#

And worked

earnest phoenix
#

and it install all of them

ripe shadow
earnest phoenix
#
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')```
cinder patio
#

xampp and node.js?

#

also xamppdoesn't use mongo

earnest phoenix
#

it can't?

earnest phoenix
cinder patio
#

xampp uses very different tech

#

php is used server-side

solemn quartz
#

Guys how to make the bot send an error message if there is more than a mention?

cinder patio
#

not node.js

earnest phoenix
#

Someone know a daily code in js that is not need quick.db or parse-ms?

solemn quartz
long crow
#

Maybe use set or map

#

Well if you using javascript

frigid mountain
#

how do I get my bot to join a voice channel does it require me to make a new folder

lost heath
#

you obviously need to define which channel

frigid mountain
#

yea but do I make a folder for it or add it in index.js or..

solemn quartz
# solemn quartz Oh my fucking god i cant do it
  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

lost heath
wheat jewel
lost heath
#

you can do it as you wish really

solemn quartz
#

yeah

#

so

wheat jewel
#

whats the error?

solemn quartz
#

i want it to NOT run when there is more than 1 mention

frigid mountain
solemn quartz
#

I tried with mentions[0], mentions[1], with ! or without but it never worked

lost heath
lost heath
solemn quartz
near stratus
lost heath
#

why tho?

wheat jewel
#

how is that a lazy thing to do

lost heath
#

its a lot cleaner to have seperate files

near stratus
near stratus
lost heath
#

so?

#

i have almost 1000 files

solemn quartz
near stratus
#

Why would I need to make a separate file for 10 lines of code ?

wheat jewel
#

does that mean almost 1000 commands?

#

lol

solemn quartz
#

what

wheat jewel
#

mentions.size > 1

solemn quartz
#

oh k

lost heath
near stratus
wheat jewel
#

Python<nodejs

lost heath
wheat jewel
#

crazy

lost heath
#

i have one command handler. multiple handlers for mongo because i have multiple collections in the db

tardy crow
#

how to setup my bot

lost heath
#

i have one connection obviously

#

lmao

near stratus
lost heath
#

i never said i had multiple connections. i said i had different handlers

tardy crow
#

how to setup voicemaster

lost heath
near stratus
#

With axios or node-fetch ??

lost heath
#

each model handles the information it gets from the db. stop arguing

indigo cobalt
#

still need help?

#

You're using express right?

wheat jewel
#

yea idk how

#

yes

indigo cobalt
#

let me help you then

wheat jewel
#

alright

#

thanks

wheat jewel
lost heath
#

schema is the setup in the collection. so kindof true

indigo cobalt
wheat jewel
#

lol ok

indigo cobalt
#
res.status(200).end()```
wheat jewel
#

simple

#

thanks

indigo cobalt
#

yw

crystal wigeon
#

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

crystal wigeon
#

I see "no nodes available" error

#

@opal plank @cinder patio

#

Sorry for the pings

#

Heuheu

solemn quartz
#

@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?

cinder patio
#

I've never used lavalink

#

but maybe Erwin can answer that

solemn quartz
#

i did let mentions = message.mentions.size

silk ingot
#

that will get the first mentioned user

solemn quartz
#

ik im not trying to do that

near stratus
solemn quartz
#

i want the bot to stop running the cmd if there is more than a mention

silk ingot
#

mmm

near stratus
#

never use message.mentions.first() to ban or mute

solemn quartz
#

why?

#

Are you fucking joking

near stratus
#

!baan @solemn quartz cuz he humiliated @earnest phoenix

solemn quartz
#

I know

#

I dont want that

near stratus
#

No
The one with lower ID

solemn quartz
#

I want the command not to run if there is more than 2 fucking mentions

silk ingot
#

so

near stratus
#

wait lemme get link

solemn quartz
#

Wait

#

Lets just do something else, how to check if an arg is a mention?

near stratus
solemn quartz
#

so i do ?Kick @solemn quartz @solemn quartz
if this arg^ is a mention it doesnt

#

run

near stratus
#
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.
silk ingot
#

:/

#

still

#

look what akio linked

near stratus
#

it can kick the last person if his id is lower than the first

silk ingot
#

it is what it is

near stratus
#

They just sort it according to id

solemn quartz
#

what the fuck

near stratus
#

yea

solemn quartz
#

i never thinked a moderation command could make me go crazy

silk ingot
solemn quartz
#

yep

silk ingot
#

oh

near stratus
solemn quartz
#

but with the message.mentions.members.first

silk ingot
#

I thought that would be harder xD

solemn quartz
#

so i think i need to change it

solemn quartz
zenith terrace
#

why are yall making this more complicated than it needs to be

near stratus
silk ingot
#

yeah

indigo cobalt
#

with reason @earnest phoenix

solemn quartz
#

Wait

silk ingot
#

just strange how discord.js interprets .first() but ok 😐

solemn quartz
indigo cobalt
solemn quartz
#

wow

pale vessel
#

It's not

solemn quartz
#

i never knew that there was

#

lol

#

but i knew there was devs making bots with py

silk ingot
#

I'm just gonna point out

indigo cobalt
#

What is better discord.js or eris client?

near stratus
pale vessel
silk ingot
#

that I had a lot more issues in discord.py than I've ever had with discord.js

indigo cobalt
near stratus
pale vessel
solemn quartz
silk ingot
#

like

solemn quartz
#

and cpp

silk ingot
#

it just gives up

solemn quartz
#

wat

indigo cobalt
#

if you go to discord api server it apears

#

lol

solemn quartz
#

lol

near stratus
solemn quartz
#

olo

indigo cobalt
#

oops

#

lol

#

idk

pale vessel
indigo cobalt
#

^

silk ingot
#

there

indigo cobalt
#

since when someone takes api -w-

#

smh

near stratus
#

lol

indigo cobalt
#

So much librarys

solemn quartz
#

if (message.mentions.users.size < 1) return message.reply('You must mention someone to kick them.').catch(console.error);

indigo cobalt
#

yep

solemn quartz
#

found this on gitHub

pale vessel
#

you catch the method

indigo cobalt
#

why not like this

indigo cobalt
#

hmm

solemn quartz
#

Found this

#

const user = getUserFromMention(args[0]);

indigo cobalt
#

for me it always works

indigo cobalt
#

you need to get that function

solemn quartz
# solemn quartz const user = getUserFromMention(args[0]);
  • 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

near stratus
solemn quartz
#

oh

#

lol

near stratus
#

dame dame darling

silk ingot
indigo cobalt
#

interesting

near stratus
#

it was an expression from zero two

#

cries in Discord mobile

indigo cobalt
#

runs

near stratus
#

Syntax is not higjlited in mobile except php and html

#
print("Don't")
solemn quartz
#

why .slice(22)

#

k

indigo cobalt
#
echo("o")

silk ingot
#
console.log('hello')
indigo cobalt
#
console.log('idk');
near stratus
#
<html>
    <h1 style="color:red;"> Stop Now </h1>
</html>
indigo cobalt
#
{
"question": "why?"
}
silk ingot
#
<html>
    <h1> No you </h1>
</html>
rustic nova
zenith terrace
#

wtf is happening

rustic nova
#

all good here?

near stratus
rustic nova
#

fair

silk ingot
#
body {
  background-image: what is up bois;
}
near stratus
#

not supported on mobile (sed) use ```xml (It's the same)

#

F I am

#

ios or android ?

indigo cobalt
#

if this happens

#

👏

silk ingot
#

insta

near stratus
pale vessel
#

I wouldn't care less

silk ingot
#

😐

near stratus
#

Microsoft will ban NSFW from Discord

indigo cobalt
#

I'll leave

silk ingot
#

that wasn't really my worry, but sure

indigo cobalt
#

and create a new brand

#

lol

pale vessel
#

No more hentai for you I guess

silk ingot
near stratus
#

Imagine Reddit banning nsfw

indigo cobalt
silk ingot
full pelican
#

what is the presence intent and server members intent?

dusky sundial
full pelican
#

oh ok

#

thx

dusky sundial
#

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

full pelican
#

I'm doing this right now

rotund trellis
#

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

earnest phoenix
#
+[-[<<[+[--->]-[<<<]]]>>>-]>-.---.>..>.<<<<-.<+.>>>>>.>.<<.<-.```
dusty oracle
#
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

earnest phoenix
indigo cobalt
#

lol

#

everyone will be co owner

solemn quartz
#

what

#

I literally copy pasted your code

#

what the actual fuck

indigo cobalt
#

I was thinking of saying you would be one of the co-owners lol

solemn quartz
#

yeah

wheat zealot
#

i need some help with python and sqlite if anybody knows how to use them pls dm me 😄

earnest phoenix
#

I have problems

#

I can't download Sqlite 3 and quick.db

near stratus
#

huh ?

earnest phoenix
#

10

dusky sundial
near stratus
#

@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
solemn quartz
#
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?
cinder patio
#

what the

solemn quartz
#

well that doesnt work either

#

so i think im just bad

umbral zealot
#

start by removing all the extra if mentions inside of it

solemn quartz
#

tried that

umbral zealot
#

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

umbral zealot
#

pay attention to your braces and parentheses.

solemn quartz
#

ty

#

Hindsight

#

1 question

#

For how long have you been coding?

umbral zealot
#

oh about 20-25 years

solemn quartz
#

What the-

#

No

umbral zealot
#

I'm 40.

solemn quartz
#

thats not possible

#

no.

#

discord.js?

umbral zealot
#

You said coding.

solemn quartz
#

yeah

#

have you been coding Pac-man or something?

umbral zealot
#

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.

slender thistle
#

Evie is our cute boomer

cinder patio
solemn quartz
#

what the actual fuck

#

i cant even code for 3 hours straight that i fall asleep

cinder patio
#

They haven't coded for 25 years straight

solemn quartz
#

@cinder patio Can you explain why i see a person with blonde hair when i first look at your pfp??

slender dove
#

Can i send pictures here? I have a problem that I don't understand

solemn quartz
#

Yeah you can

#

but wait

slender dove
#

Ok

solemn quartz
#

Do it in code block

slender dove
#

I can't I'm on mobile

solemn quartz
dusky sundial
#

A picture is fine too

solemn quartz
#

wait

slender dove
#

Ok

solemn quartz
solemn quartz
dusky sundial
slender dove
#

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.

dusky sundial
slender dove
#

So I have to wait?

dusky sundial
#

Yes, just wait, and let your bot grow naturally

slender dove
#

Ok thank you

silk ingot
#

can't it also mean that the same person has ownership of loads of servers your bot is in?

dusky sundial
zenith terrace
cinder patio
# solemn quartz ty

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#)

solemn quartz
#

what

#

i know DPC

#

but what

#

Wait does it do the same effect if the mentioned has only one of the permissions?

cinder patio
#

yes

solemn quartz
#

oh cool

#

definetely gonna copy paste it

dusky lagoon
#

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

solemn quartz
#

2

cinder patio
#

why not include all the info?

zenith terrace
#

why not have it all

solemn quartz
#

The rating is useless

cinder patio
#

not really

solemn quartz
#

people can like things that no other likes

cinder patio
#

still shows what other people think of it

solemn quartz
#

i just vote

#

2

#

then idk

dusky lagoon
#

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

solemn quartz
cinder patio
#

no you replace sumOfBits with the number the website gave you

solemn quartz
#

oh k

#

just that?

cinder patio
#

This one right here

dusky lagoon
#

!== 0 is a calculation so it wouldnt work if you replaced that with some words if im correct

solemn quartz
#

actually !== means identical

#

i think

#

but im not sure

#

or same value

#

i dont really remember

cinder patio
#

Though I don't really recommend using that last method, it's unreadable

dusky lagoon
#

isnt that || and =

solemn quartz
#

the more readable

dusky lagoon
#

idk you can have

==
+==
<==
!== and they all have different meanings

#

our outcomes

cinder patio
#

!== - not equal to

#

the rest don't exist

solemn quartz
#

wait

glossy bear
#

Hi

#

Hi

solemn quartz
#

i have some photo that says them all

#

yo

glossy bear
#

Hello everyone

#

Hello?

solemn quartz
#

Hello

cinder patio
# solemn quartz lets just use this

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;
dusky sundial
glossy bear
#

Oh hey @solemn quartz

solemn quartz
#

@glossy bear if you're just here to talk go to #general btw

#

if theres an error in your code send it

glossy bear
#

Thank you i didn't notice that

solemn quartz
#

np

cinder patio
frigid mountain
#
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

umbral zealot
#

does it work?

#

Like, did you try it?

frigid mountain
#

nope does not work

umbral zealot
#

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.

solemn quartz
#

Lol

frigid mountain
umbral zealot
#

What exactly is the problem you're experiencing?

solemn quartz
dusky sundial
frigid mountain
solemn quartz
#

could you gently send it in this chat so people can help you? c:

glossy bear
umbral zealot
#

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

solemn quartz
#

@frigid mountain are you english?

umbral zealot
#

You gotta learn how to be helpful when asking for help.

solemn quartz
#

just to be sure

dusky sundial
solemn quartz
#

yea ik

#

just because we could use google translate

glossy bear
#

Oooh

frigid mountain
#

k idk how to start ppl say make a file called join.js and add the guild.VoiceChannelJoin()

solemn quartz
#

lol

glossy bear
#

ppl?

#

Lol

umbral zealot
#

Explain why that code isn't currently working.

dusky sundial
frigid mountain
umbral zealot
#

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

umbral zealot
frigid mountain
umbral zealot
#

yeah read that link I just sent.

frigid mountain
#

ok nvm it's fine I'll ask the other sever

umbral zealot
#

A bold strategy, cotton, let's see if it pays off.

solemn quartz
#

lol

#

imagine he just does the same thing over there

dusky sundial
#

It's hard to get help with your car if you ride your bike to the mechanic

umbral zealot
#

Typical Tyler behaviour, unfortunately.

glossy bear
#

Can someone join my server

#

What!!! Hell?

dusky sundial
glossy bear
#

Fine

#

Sorry

#

But I need some peoples!!!

dusky sundial
#

And once again, this chat is for development related questions. Move to #general if you want to talk to people

glossy bear
#

Oh ok

solemn quartz
#

And btw im 90% theres a rule that says u cant hire people to go in your server @glossy bear

dusky sundial
#

You can always read the rules in #rules-and-info if you want to be 100% sure

glossy bear
#

Okok

solemn quartz
#

just say what is the problem

#

why do you need people to join your server

glossy bear
#

Nothing but im just excited about this server

solemn quartz
#

oh

umbral zealot
#

They're literally just trying to advertise, can we move on

glossy bear
#

Sorry

solemn quartz
#

Just don't do this again

#

you could be muted,kicked,etc.

umbral zealot
#

Ok great it happened 10 minutes ago can we just stop the conversation now 😛

solemn quartz
#

yep

#

best 40 year old i ever knew

glossy bear
#

Ok

#

I will never try to do that again

#

Thank you for reminding me

umbral zealot
#

omg just stop

glossy bear
#

???

dusky sundial
#

Spamming emotes will also get you punished brother

umbral zealot
glossy bear
#

Ok

dusky sundial
#

Move away from this chat unless you have a development related question, 3rd time I'm telling you now

glossy bear
#

Im moving away!!!

umbral zealot
solemn quartz
#

Guys can you explain me what global emojis are?

#

is this like a new thing?

zenith terrace
#

global emojis are no longer a thing

solemn quartz
#

oh lol

#

For how much were there?

#

cuz i heard jet's world had them

#

but im not advertising and im not sure

umbral zealot
#

it was a thing they were doing with twitch

zenith terrace
#

global emojis use to be emojis you could use without nitro

solemn quartz
#

in all servers

#

?

zenith terrace
#

yea

quaint fjord
#

oh cool

#

why did they stop with it?

solemn quartz
#

animated ones too?

zenith terrace
#

no

solemn quartz
quaint fjord
#

hmm yeah

solemn quartz
#

Guys btw if i remember i got muted for 1 month or 2 here

umbral zealot
#

nitro === $$$

zenith terrace
solemn quartz
quaint fjord
#

understandable

solemn quartz
#

Guys do you think these are All the moderation perms?

zenith terrace
solemn quartz
#

Yea i think yes

near stratus
cinder patio
#

Remove Priority Speaker

solemn quartz
#

k

solemn quartz
#

thats just stupid

cinder patio
#

Manage_Nicknames also can be removed

lament stump
solemn quartz
cinder patio
#

Also this is questionable

        let data = new Object();

        data = {
            name: dir.toUpperCase(),
            value,
        }
solemn quartz
#

what is toUpperCase? I know toLowerCase but wth is that

umbral zealot
#

it... puts text to UPPER CASE

boreal iron
#

or using filter()

.filter((file) =>
{
    if(!file.match(regex)) ...
}
#

on readdir

solemn quartz
#

is it just the same thing?

cinder patio
umbral zealot
#

lowercase UPPERCASE

solemn quartz
cinder patio
umbral zealot
#

It's only "the same" if you don't understand lowercase and UPPERCASE letters.

boreal iron
#

This regex for example: match(/dirname|dirname2|dev|src|img/gi)

cinder patio
#

You need to use !==

lament stump
#

so dir !== developer

#

or !dir

#

._.

cinder patio
#

The former, and also just return after the if statement

boreal iron
#

do you wanna READ files only?

cinder patio
#

if (condition) return

boreal iron
#

If so use additional parameters for the function
readdirSync(<path>, { withFileTypes: true }); will not read directories

lament stump
#

i just wanna read sub-folders, but skip the "developer" one

boreal iron
#

oh, alright, than filter is what u need, yeah

cinder patio
boreal iron
#

oh huh... didn't read carefully enough I guess lmao

lament stump
#

this returns no dirs at all

cinder patio
#

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

boreal iron
#

It is a boolean value which specifies whether the files would be returned as fs.Dirent objects. The default value is ‘false’.

#

my bad

cinder patio
#

Or you could do
if (dir !== "developer") return;

boreal iron
#

why would you wanna end foreach if the dir was found?

cinder patio
#

That doesn't end it

#

The forEach loop continues to iterate through the next element, it just exits the callback

lament stump
#

it worked

#

thank u

cinder patio
#

np

boreal iron
#

yeah it's a callback I see

#

what a terrible morning KEKW

cinder patio
#

You can do that yourself with a setInterval

lament rock
#

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

teal parcel
#

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?

sterile minnow
#

please ping me in the reply cuz i have that server muted due to its activity

cinder patio
teal parcel
#

umm first create a app in the developer project

#

and then I have to code

#

in SHORT

#

and authorize it

bleak crag
cinder patio
#

yeah, so, show us your code

teal parcel
#

and then maybe using a visual studio CODE IT

cinder patio
#

and if there are any errors

quaint fjord
#

but remove the token before you show the code

#

because otherwise it won't be good

teal parcel
#

wait. I am trying to use "sinusbot".Will that work,cuz I am not that familiar with coding.?

cinder patio
#

no clue what that is

quaint fjord
#

I searched it, some music listening thing

#

A discord music bot from the looks of it

cinder patio
#

You should ask in their support server if they have one

#

or create an issue on github

sterile minnow
#

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

solemn quartz
#

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)
  }
  
}```
cinder patio
#

You could improve the formatting

#

use a linter

#

.slice(22) isn't a good practice

old cliff
#

Guilded.js is nice... it has cache control

cinder patio
#

too bad guilded is shit

old cliff
#

it isn't

#

Tried it today

dusky lagoon
#

Does anyone ever worked with the website scrapping program parsehub

boreal iron
#

if u wanna stick to djs but control caching, switch to djs-light

cinder patio
dusky lagoon
#

Wha??

#

service

dusky lagoon
cinder patio
#

a service

dusky lagoon
#

i know

boreal iron
#

yo, nobody actually cares, that's the wrong place for ads

dusky lagoon
#

but im asking if someone worked with it

cinder patio
#

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

boreal iron
#

the device it runs on has to be online 24/7

cinder patio
boreal iron
#

permanently

thin echo
boreal iron
#

aye, either a PC in your local network or a server

cinder patio
thin echo
cinder patio
#

There also cheap VPS' but you should start out with Repl.it

#

doesn't matter

quaint fjord
cinder patio
#

Bots are connected to discord

boreal iron
#

bots have encryption the same way users have right?
what?

cinder patio
#

there's no need for encryption

quaint fjord
#

okay

boreal iron
#

it's all based on websocket connections and cURL requests

thin echo
#

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.

boreal iron
#

So at all, no security issue if you run a bot from home, if that's your question

earnest phoenix
#

hi

thin echo
#

thx

median moss
#

discord api is laggy?

#

my bot is unresponsive

boreal iron
#

maybe check the latency

thin echo
#

tysm

#

it works

median moss
#

the host is normal

slender thistle
thin echo
#

Yeah

cinder patio
#

ah

#

but they said it works

boreal iron
thin echo
#

How long do you usually wait until you get a response if your bot was declined or accepted?

cinder patio
#

1-2 weeks

thin echo
#

ok

#

At least I have my anime

#

Imma add more fun commands to my bot

frigid mountain
#

made by myself and it worked

#

Master coder✅

feral aspen
#

Ayy, good job.

frigid mountain
#

thx

solemn quartz
#

"Master Coder"

#

good job ig

frigid mountain
#

lol

solemn quartz
#

c:

frigid mountain
#

I tried almost 100 different codes

solemn quartz
#

btw are you english?

frigid mountain
solemn quartz
#

lol

feral aspen
#

Lmao

solemn quartz
#

k

solemn quartz
solemn quartz
#

im italian

frigid mountain
#

oo fancy

#

:dab:

#

ow wait my nitro expired today lol

umbral zealot
#

Good for you that you got it working!

frigid mountain
lament rock
#

The Partial<T> type annotation is so helpful. Why did I just find this

solemn leaf
#

Can I get a link to docs for gojs

lusty atlas
#

Ok, I think I'm done.

#

All I have to do is waiting for the long approval, I hope they approve it.

grave haven
#

How do i send a user a DM with my bot?

#

ok ty

restive night
#

How do you link your bots server count to top.gg

grave haven
#

How do i make a msg send when the bot is invited?

#

ok

#

discord.js

grave haven
#

thaks

queen moss
#

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

grave haven
#

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

cinder patio
#

the error is right there

grave haven
#

ok i figureg it out

stray sinew
#

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?

near stratus
#

huh ?

#

You're hosting your bot on Glitch and now you wanna move on to Raspberry Pi ?

cinder patio
#

Get the pi's IP address and transfer the files via FileZilla

near stratus
#

^

stray sinew
#

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?

cinder patio
#

why would you need a link ?

near stratus
cinder patio
#

You edit the files on your PC, transfer them using filezilla

stray sinew
#

For other external systems to send requests with it

stray sinew
cinder patio
#

You'll have to setup port forwarding for the pi

near stratus
stray sinew
#

Ah thanks

cinder patio
#

Honestly you're better off just buying a VPS for a few bucks imo over having to setup port forwarding and all that jazz

near stratus
#

You can use ngnix or Apache for better handling and Firezilla for editing remotely as fewd said

stray sinew
#

ah thanks

#

Can you use Firezilla on a raspberry pi?

#

I did not know that

near stratus
earnest phoenix
#

firezilla

queen moss
#

My ISP is officially angry at me for using like 5tb of transfer a month 🤡

near stratus
queen moss
#

Hm? Oh, no I am currently hosting a radio relay for a friend on my machine

lost mauve
#

Speaking of high network usage

#

How do you guys deal with api rate limits

#

Or worse

#

Getting your IP banned

dusky sundial
#

Most libraries will handle rate limits for you anyways. Just don't be a dumb dumb and spam stuff

lost mauve
#

Hm i'm not talking about the discord api

#

but APIs you might use for commands

#

let's say an API for image search

dusky sundial
#

I usually skim through the docs, they should always tell you the limits

#

then set cooldowns accordingly

lost mauve
#

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!

cinder patio
#

what's the API

lost mauve
#

Qwant

thick nexus
#

how do i get the number of all members in every server my bot is in

cinder patio
rocky pulsar
#

Yo

lost mauve
rocky pulsar
#

Marco types slow

lost mauve
#

that would explain the lack of docs

#

and low rate limit

rocky pulsar
#

"Meantion"

#

That explains why you type so slow

lost mauve
#

ok

rocky pulsar
#

Not ok

#

I like your status doe cos it relatable af

soft glade
#

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)```
subtle kiln
#

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!

cinder patio
#

Use the raw event

#
client.on("raw", data => {
  console.log(data)
});
subtle kiln
#

I was thinking of outgoing traffic

cinder patio
#

oh, requests made by discord.js

subtle kiln
#

yes

cinder patio
#

Try the debug event but I'm not sure if it emits API calls

subtle kiln
#

I'll try that thx

stray sinew
#

How do I get the base url out of a raspberry pi

subtle kiln
cinder patio
#

Hmm then you can modify the api call functions

#

like

  console.log(data);
  return client.api.someFn(...data);
}
stray sinew
#

How do I get a base url?

earnest phoenix
#

how can i write manage nick names in python, like (administrator=True)..???

opal plank
subtle kiln
slender thistle
#

wut

#

what

pale vessel
#

it's manage_nicknames or something

pale vessel
#

you should read docs

#

r t f d

slender thistle
#

yes flaze ty

earnest phoenix
# slender thistle wat

i mean how can i make smthg like:

@commands.has_permissions(administrator=True)

but instead of administrator, its manage nicknames

earnest phoenix
pale vessel
#

you're repeating yourself here

earnest phoenix
#

me?

slender thistle
earnest phoenix
#

okk

pale vessel
earnest phoenix
#

client.guilds.cache.map(g => g.memberCount || 0).reduce(( x, y) => x + y, 0)

#

here

pale vessel
#

yeah, <client>.guilds.cache.reduce((acc, cur) => acc + cur.memberCount, 0);

#

most efficient one

nocturne dagger
#

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

pale vessel
#

addField()

nocturne dagger
#

I see it now

#

Thanks

pale vessel
#

typo yeah

nocturne dagger
#

Idk how I didn't see it before.

earnest phoenix
#

lol

#

english :c

pale vessel
#

you're probably tired

royal herald
#

is there a way to use canvas in node 14.x?

subtle kiln
subtle kiln
royal herald
#

canvas package does not support node 14.x

pale vessel
#

yeah, should work fine

#

works for me

royal herald
#

hmm

stray sinew
pale vessel
#

try rebuilding or reinstalling

subtle kiln
#

ha my bad

royal herald
#

whats your node version flaz

pale vessel
#

let me check

royal herald
stray sinew
stray sinew
royal herald
#

totally we can see it

pale vessel
#

It's 14.16.0

cinder patio
#

and for that you need the pi's IP address

#

so go get that first

stray sinew
#

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?

royal herald
#

i hope canvas works!

cinder patio
stray sinew
#

Alright

cinder patio
#

That's why I said that buying a VPS is a better option

#

if you need a dashboard

stray sinew
#

I dont got the money thats why I'm porting in the first place

royal herald
#

you can use aws for ex.

cinder patio
#

pi's should be servers only

royal herald
#

i use it

stray sinew
#

I'm using pm2

stray sinew
#

What should I do now?

earnest phoenix
#

i strongly recommend an Ubuntu VPS with Pterodactyl Panel

#

Best choice of my life