#development

1 messages · Page 857 of 1

golden condor
#

@earnest phoenix what is your issue?

earnest phoenix
#

What issue ?

golden condor
#

You seem to have an error

#

Scroll up

earnest phoenix
#

.addField

elder vine
#

lol

#

Where is guild defined??

golden condor
#

The command handler?

earnest phoenix
#

module.exports.run

elder vine
#

you defined guild in your exports.run

earnest phoenix
#

Yes

elder vine
#

why?

golden condor
#

Maybe that's just what he/she wants to do

earnest phoenix
#

If i use guild for an other field

elder vine
#

well, it might be an mistake in the cmd handler then

golden condor
#

What is the error you are getting?

elder vine
#

filter of undefined

golden condor
#

Where is filter?

elder vine
#

.addField("Utilisateurs 👶 ", ${guild.members.filter(member => !member.user.bot).size}, true)

#

yea

golden condor
#

That's guild members

#

Surely he wants bot users?

elder vine
#

No

#

well

#

oh

earnest phoenix
#

I want all members

#

Is she trying to filter the function to only show bots?

#

Oh i see

golden condor
#

@earnest phoenix client.users.cache.size

elder vine
#

client.members

#

v11 or v12

earnest phoenix
#

@golden condor
Not for v11

golden condor
#

oj

opaque kite
#

It will returned number of members not the bots

earnest phoenix
#

Im on v11

elder vine
#

client.members.filter

golden condor
#

Okc

earnest phoenix
#

@earnest phoenix all users of the bot or guild?

golden condor
#

client.users.size

earnest phoenix
#

@earnest phoenix all users

elder vine
#
let members = 0
client.guilds.forEach(g => {
    members += g.memberCount;
});
members
earnest phoenix
#

@golden condor
Client.users.size not showing the correct numbers

golden condor
#

Ik

earnest phoenix
#

Hmm...
CLIENT_NAME.users.cache.size

golden condor
#

you gotta do this

elder vine
#

that's v12

earnest phoenix
#

@elder vine
I have test and its undefined

elder vine
#

It's not

#

eval it

golden condor
#

Do what leny said

#

Yeah

#

We know that

elder vine
#

Still not correct numbers Ryan

quartz kindle
#
let totalUsers = client.guilds.reduce((a,b) => a + b.memberCount, 0)
golden condor
#

What

earnest phoenix
#

And i can add the first code of leny

elder vine
#

What?

earnest phoenix
#

?

golden condor
#

What does the reduce function do again, remind me

quartz kindle
#

reduces an array into a single value

elder vine
#

just gave me undefined

golden condor
#

Ok

quartz kindle
#

you cant

#

unless you cache all members

earnest phoenix
#

For me filter is undefined on my console and my bot crash

elder vine
#
let totalV = client.guilds.map(g=>g.memberCount).reduce((a,b) => a + b, 0)
quartz kindle
#

you cant use .map

#

map returns an array

elder vine
quartz kindle
#

i mean, you can do it like that

#

but thats double the work

#

you can use .reduce directly

elder vine
#

gave me undefined

earnest phoenix
#

Hello

quartz kindle
#

it works for me lol

elder vine
#

weird..

quartz kindle
elder vine
#

Well, tf

#

xD

#

I know why now tho

quartz kindle
#

you didnt return it lul

earnest phoenix
#

@quartz kindle it work for me thx you

elder vine
#

yea

#

xD

golden condor
#

Why won't this work

#
//command handler
try{
    command.run(client, message, args, queue)
    const cnl = client.channels.cache.get("697061184708280350")
    const Embed = new Discord.MessageEmbed()
      .setTitle("Command Run")
      .setDescription(`The command **${command.category}/${command.name}** was run by **${message.author.username}** in **${message.guild.name}**`)
      .setColor(0x00aaff)
    cnl.send(Embed)
  } catch(e){
    const {ownerid} = require('../config.json')
    message.channel.send("Unfortunately, there was an error executing that command and I will inform the developer so he can fix it.")
 client.users.cache.get(ownerid).send(`There has been an error executing ${command.name}\n\`\`\`js${e}\`\`\``)
  }```
#

It still shows an error

#

in conosole

hardy fiber
#

what's the error?

golden condor
#

The issue is

#

It's supposed to catch the errors

#

But doesn't

hardy fiber
#

It should still be logging something to the console though

late hill
#

that send method is async

quartz kindle
#

try/catch doesnt catch errors in promises

#

unless you await them

late hill
#

^^

quartz kindle
#
try {
  await send()
} catch(error) {
  console.log(error)
}

or

send().catch(error => console.log(error))
earnest phoenix
#

how can I get my bot hir on the server?

elder vine
#

then wait for it to get approved.

crude imp
#

hey

snow urchin
quartz kindle
#

remove .format

#

just do moment.utc(User.createdAt).fromNow(true)

#

and see what it returns

golden condor
#

@quartz kindle thx

earnest phoenix
#

in

#

w h i c h

#

l i b r a r y

astral yoke
#

In one of my packages it says TypeError: client.users.get is not a function.. But, it's a index package and not like my main folder.

cinder patio
#

It's likely outdated if you are using the latest version if discord.js

astral yoke
#

yeah I am

#

whats the update verison for it?

#

of client.users.get

cinder patio
#

client.users.cache.get

astral yoke
#

Thanks.

timid blade
#

i am using JSHINT for part of my bot, and i cant get the esversion option to work (need it for await so it doesnt throw errors)
i assume i am using the options correctly because i can get the unused option to work (as shown in image) but no matter what i put in esversion (have tried 8 9 10 '8' '9' and '10') which according to JSHINT docs and stack overflow should make it respect async/await, i cant get it to work. anyone have any experience getting JSHINT to work with async/await?

earnest phoenix
#

So i have a meme command that randomly fetches memes from the stored subreddits using the random-puppy module... But when i tested it to pull and fetch nsfw from nsfw subreddits it outputed an error saying imgur.com's api has blocked the nsfw subreddits... (Imgur.com is the host where it gets the images)... So...
Can it also pull and fetch nsfw images from non-fully-nsfw subreddits? As the subreddits are meme subreddits...

#

(few of the stored subreddits:
Memes
Dankmemes
ComedyCemetery)

#

Lol

#

(also I'm asking that because i want it to be free-of-nsfw meme command and to be used publicly without only being able to use it in nsfw channels...)

pale vessel
#

you can filter them nsfw memes

earnest phoenix
#

@pale vessel how do i do it with random-puppy module that fetches them?

pale vessel
#

i can't help you with that unfortunately since i used the official reddit api

earnest phoenix
#

Yo

crimson vapor
#

why does it use imgur?

earnest phoenix
#

Idk

#

🤡

crimson vapor
#

@twilit rapids

earnest phoenix
#

@crimson vapor i literally have no clue...

#

Same

astral yoke
#

hi again

#

so like

#

i have the error

#

that

elder vine
#

What error?

astral yoke
#

TypeError: message.guild.members.get is not a function

#

with the new package

#

so whats the new one?

elder vine
#

v12?

astral yoke
#

mhm

#

12.1.1

earnest phoenix
#

@astral yoke message.guild.members.cache.get

astral yoke
#

ty

earnest phoenix
#

Np

elder vine
astral yoke
#

ty

vapid knoll
#

ryan

#

@earnest phoenix

#

so u can help me

#

wym?

earnest phoenix
#

Guys i have a question...
In my guildCreate event on discord.js...
Is it possible to get an invite link of the server that it joins?
(I can get the name and id but idk how to get that)

vapid knoll
#

im confused

earnest phoenix
#

@earnest phoenix if it does have it... What's the code for it?

vapid knoll
#

so idk how to use dyno and stuff

#

pls help

earnest phoenix
#

Oh ok... Thx... I'll read that...

vapid knoll
#

0k siorry

summer torrent
earnest phoenix
#

Hi

quartz goblet
#

why don't work my bot

#

?

#

help

summer torrent
#

you do not have bot on website

quartz goblet
#

i have

summer torrent
#

-bots @quartz goblet

gilded plankBOT
summer torrent
#

not approved yet

quartz goblet
#

ok

crimson vapor
#

Ur NoT SuPpOsEd To Do ThAt HeRe

lean pike
#

Guys i need edit the embed and I do not know how

summer torrent
#

which lib

lean pike
#

Discord.js

#

I not know how. I make Suggestion code

#

With a response to the suggestion

quartz kindle
#

do you know how to use message.edit()?

true ravine
#

My bot has that, you have to create a whole new embed you can't edit just one field I think

#

(then use message.edit())

quartz kindle
#

you can clone the existing embed and edit it

true ravine
#

Woah didn't know that

#

Guess you helped me too lol

timid blade
#

i am using JSHINT for part of my bot, and i cant get the esversion option to work (need it for await so it doesnt throw errors)
i assume i am using the options correctly because i can get the unused option to work (as shown in image) but no matter what i put in esversion (have tried 8 9 10 '8' '9' and '10') which according to JSHINT docs and stack overflow should make it respect async/await, i cant get it to work. anyone have any experience getting JSHINT to work with async/await?
https://cdn.discordapp.com/attachments/272764566411149314/697170463918391306/unknown.png
(i hath been buried with no replies o.0)

heavy marsh
#

My bot is on v12 - discord.js
I am trying to send a message to a channel on a different shard

My Code:

    let premiumadd = new discord.MessageEmbed();
      premiumadd.setTitle('Premium Added');

bot.shard.broadcastEval(`
const channel = this.channels.cache.get('679079839466127390');
if (channel) {
channel.send(premiumadd);
true;
} else {
false;
}`).then(sentArray => {
if (!sentArray.includes(true)) {
return message.channel.send('I could not find such a channel!');
}
return message.channel.send(embed);
});```

Error:
```js
[07/04/20 22:00:20] [ERROR] (node:24) UnhandledPromiseRejectionWarning: ReferenceError: premiumadd is not defined
quartz kindle
#

that code is looking for a premiumadd variable in the target shard

#

that variable doesnt exist there

heavy marsh
#

How many I fix the issue

cause

bot.shard.broadcastEval(`
const channel = this.channels.cache.get('679079839466127390');
if (channel) {

let premiumadd = new discord.MessageEmbed();
    premiumadd.setTitle('Premium Added');

channel.send(premiumadd);
true;
} else {
false;
}`).then(sentArray => {
if (!sentArray.includes(true)) {
return message.channel.send('I could not find such a channel!');
}
return message.channel.send(embed);
});```
Even this doesnt work
#

Or am I doing it in a wrong way?

#

Or is there a diffrent way to do it?

mystic violet
#

I keep getting js (node:1160) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Channel even when I eval message.channel.send()

#

No idea why lol

heavy marsh
#

May be your eval command is made wrongly

raven urchin
#

I need help with the status. Is it possible to show what server it's watching?

mystic violet
#

Actually no, it isnt working wrong, cause it works in other channels

#

even when I get the channel with the ID

#

it gives the same error

heavy marsh
#
<Prefix>eval message.channel.send(`x`)```
#

Did you try it like this?

earnest phoenix
#

Lol

heavy marsh
raven urchin
#

Is it possible to show that it's watching a individual server it's in? Like it'll be watching each one

quartz kindle
#

@heavy marsh does your broadcastEval thrown an error?

heavy marsh
#

When I do it how?

#
[07/04/20 22:00:20] [ERROR] (node:24) UnhandledPromiseRejectionWarning: ReferenceError: premiumadd is not defined
at eval (eval at _eval (/home/container/node_modules/discord.js/src/client/Client.js:376:12), <anonymous>:4:14)
at Client._eval (/home/container/node_modules/discord.js/src/client/Client.js:376:12)
at ShardClientUtil._handleMessage (/home/container/node_modules/discord.js/src/sharding/ShardClientUtil.js:184:82)
at process.emit (events.js:323:22)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
[07/04/20 22:00:20] [ERROR] (node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
#

This is my full error

quartz kindle
heavy marsh
#

Hold

quartz kindle
#

@raven urchin no, its not possible. its only possible per shard

valid frigate
#

how can i encrypt plaintext in node via rsa keypair instead of a plaintext key? e.g.

let crypto = require('crypto');
let assert = require('assert');

let algorithm = 'aes256'; // or any other algorithm supported by OpenSSL
let text = 'this needs to be encrypted';

let privateKey = "private key"
let publicKey = "public key"

let cipher = crypto.createCipher(algorithm, privateKey);  
let encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex');
let decipher = crypto.createDecipher(algorithm, publicKey);
let decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');

assert.equal(decrypted, text);

.createCipher() second parameter only allows text afaik

heavy marsh
#

I dont get it cause It closes all

quartz kindle
#

you're breaking your string

heavy marsh
#

OOh so I have to use \

raven urchin
#

@quartz kindle for like the status it would say Watching server name

#

But only possible with shards right?

heavy marsh
#

I dont think You can have a status change for each guild

earnest phoenix
#

Can someone help me?

#

@earnest phoenix what's the issue?

quartz kindle
#

@valid frigate are you trying to create a new pair or use an existing one?

valid frigate
#

i'm using an existing pair

#

that's my problem

#

i don't know how to import an existing keypair

earnest phoenix
#

So there are 2 things one it won’t let me access your guy’s website and 2 every time I try to put the prefix and then say kick and I say @ the person it doesn’t kick them it just says error

#

@earnest phoenix wdym it doesn't let you access the website?

quartz kindle
#

createCypher has been deprecated in favor of createCypheriv

earnest phoenix
#

Can I send a screenshot?

#

So you can see

valid frigate
#

and also i just checked node docs, .createCipheriv() is apparently used over .createCipher()

quartz kindle
#

the docs mention key can be <string> | <Buffer> | <TypedArray> | <DataView> | <KeyObject>

earnest phoenix
#

@earnest phoenix sure

heavy marsh
#
bot.shard.broadcastEval(`
const channel = this.channels.cache.get('679079839466127390');
if (channel) {

    let premiumadd = new discord.MessageEmbed();
      premiumadd.setTitle('Premium Added');
      premiumadd.setDescription(
        \`**User ID:** ${UserID.id}\n**User Name:** ${UserID.tag}\n**User Created:** \`${bot.users.cache.get(UserID.id).createdAt.toUTCString().substr(0, 16)}\`\`
      );
      premiumadd.setThumbnail(UserID.displayAvatarURL({dynamic:true}));
      premiumadd.setTimestamp();
      premiumadd.setColor('#2ACC76');
      premiumadd.setFooter(\`Command Run By: ${message.author.tag}\`);

channel.send(premiumadd);

Should This be correct?

valid frigate
#

the problem is

#

i think what im going for is KeyObject type

quartz kindle
#

i saw some SO answers saying the keys need to include the "BEGIN KEY" and "END KEY" parts

valid frigate
#

oh yeah that's already there

#

so it should just work if i read the keys from my filesystem i guess

#

brb

earnest phoenix
#

Here

#

See

elder vine
#

This is dyno

earnest phoenix
#

So idk if it’s my internet or what it is

valid frigate
#

either dyno's site is down or cloudflare thinks you're a bot

earnest phoenix
#

crimson vapor
#

ummm

elder vine
#

Yea, it's down

quartz kindle
#

btw this server is not dyno's support server

earnest phoenix
#

Sorry I just joined cause at this rate I’m very confused

quartz kindle
#

this server is the official server for TOP.GG

earnest phoenix
#

Ok well the website is down right?

elder vine
#

Yes, it's down.

digital ibex
#

hiya

earnest phoenix
#

Well then why does it redirect me to that :/

digital ibex
#

i am trying to set a custom rps

earnest phoenix
#

@earnest phoenix also can i see your code... (Kick command code)

digital ibex
earnest phoenix
#

Wdym code

digital ibex
#

where can i put details?

earnest phoenix
#

You mean the code I got when I joined

digital ibex
#

i think that makes sense

earnest phoenix
#

@earnest phoenix wait... Are you using the dyno bot to use the kick command to kick someone or wdym?

crimson vapor
#

@digital ibex you put details in details: ""

earnest phoenix
#

Yes I tried to kick someone from my server using the bot but it just kept saying error

elder vine
#

This is not Dyno bot support.

digital ibex
#

oh, sorry my bad

quartz kindle
#

@heavy marsh you cant use ` both for the inner code and the eval code, else your variables will get all confused. you should use " for the eval instead and use regular string concatenation if you need it

heavy marsh
#

Join Dyno support server and ask there

digital ibex
#

i was meant to show that as well

earnest phoenix
#

@earnest phoenix hmm... The bot has Overloaded or there's an error going on...
You have to wait...
Also this server is not a dyno bot support server

#

Well thanks anyway guys you’ve been helpful

#

Np

crimson vapor
#

@digital ibex what are you confused on?

digital ibex
#

how i would get the details

#

show details

crimson vapor
#

details: "whatever you want"

digital ibex
#

oh

crimson vapor
#

you have it there

#

just set to math.something

heavy marsh
#
bot.shard.broadcastEval("
const channel = this.channels.cache.get(`679079839466127390`);
if (channel) {

    let premiumadd = new discord.MessageEmbed();
      premiumadd.setTitle(`Premium Added`);
      premiumadd.setDescription(
        `**User ID:** ${UserID.id}\n**User Name:** ${UserID.tag}\n**User Created:** \`${bot.users.cache.get(UserID.id).createdAt.toUTCString().substr(0, 16)}\``
      );
      premiumadd.setThumbnail(UserID.displayAvatarURL({dynamic:true}));
      premiumadd.setTimestamp();
      premiumadd.setColor('#2ACC76');
      premiumadd.setFooter(`Command Run By: ${message.author.tag}`);

channel.send(premiumadd);
true;
} else {
false;
}")

Or am I still mixing this up?

quartz kindle
#

what is UserID?

heavy marsh
#

Users ID

quartz kindle
#

but from where are you getting it?

#

is this user ID gonna be available in that shard?

heavy marsh
#

const UserID = message.mentions.users.first() || bot.users.cache.get(args[1]);

#

The user is going to be on the same shard

quartz kindle
#

because you are sending a piece of code to be evaled in a target shard. you need to know what is in the current shard that you want to send to the target shard, and what is available in the target shard

#

in your code, there is no UserID in the target shard

#

the same way there was no premiumadd before

heavy marsh
#

thonkku ...

quartz kindle
#

you need to use concatenation to avoid this problem

#

this will also make it easier to identify what comes from where

digital ibex
quartz kindle
#
let outside = "test";
shard.eval("
  if(true) {
    let fromOutside = " + outside + ";
    let embed = new Discord.MessageEmbed()
    .setTitle(`title: ${fromOutside}`)
  } else {
    return false;
  }
");```
digital ibex
#
const discord = require('discord-rich-presence')('685544642934341695');
let starttime = Date.now();
console.log("Started!")
discord.updatePresence({
        details: details[Math.round(Math.random() * (details.length - 1))],
        startTimestamp: starttime,
        largeImageKey: "https://cdn.discordapp.com/avatars/650136984211292180/3dbcf8a2f49c193cd460eb441c7856a0.png?size=512",
        smallImageKey: "https://cdn.discordapp.com/avatars/650136984211292180/3dbcf8a2f49c193cd460eb441c7856a0.png?size=512",
        largeImageText: "Lost",
        smallImageText: "hiya person",
        details: "Running in a robot world",
        state: "Walking in a robot world",
        instance: true
})
heavy marsh
#

ooh

digital ibex
#

and uh, thats it?

quartz kindle
#

you see the difference between variable that comes from outside, and variable that is available inside?

heavy marsh
#

Yes

#

So ... should I use
bot.shard.broadcastEval()
or
bot.shard.eval()

quartz kindle
#

broadcastEval() sends the code to all shards

#

shard.eval() sends to a specific shard and can only be used from the manager i think

heavy marsh
#

OOr

#

But if I want to send that message always to message id = xxx

quartz kindle
#

so in your case, use broadcastEval

heavy marsh
#

OOk

quartz kindle
#

the channel is not guaranteed to be always in the same shard

#

when you change the number of shards, which server goes to which shard also changes

#

unless the channel is a DM channel

heavy marsh
#

DM channel = Private message right?

quartz kindle
#

ye

heavy marsh
#

Ahh nope its going to xxx channel with that id always

#

Is there no simple way to use broadcastEval()

quartz kindle
#

the best way is to create a function

#

in your shards

#

and run the function with broadcastEval

#

ie ```js
// main.js
async function premium(channel,user) {
let user = await client.users.fetch(user);
let embed = new Discord.MessageEmbed().bla().bla().bla();
client.channels.cache.get(id).send(embed);
}

// manager.js
....broadcastEval(if(client.channels.cache.has(${channelID})) { premium(${channelID,userID}) })

heavy marsh
#

ooh ok thanks

muted ridge
#

does anybody know why my bot constantly disconnects and reconnects

#

it happens too often

quartz kindle
#

are you failing to acknowledge heartbeat packets?

#

what library are you using?

elder vine
#
const manager = new ShardingManager('./bot.js', {
    token: config.token,
    totalShards: 2
 });

manager.on("launch", shard => {
    console.log(`Shard [${shard.id}] launched`);
    shard.on("death", () => console.log(`Shard [${shard.id}] died`))
      .on("ready", () => console.log(`Shard [${shard.id}] ready`))
      .on("disconnect", () => console.log(`Shard [${shard.id}] disconnected`))
      .on("reconnecting", () => console.log(`Shard [${shard.id}] reconnecting`));
});
  
manager.spawn().catch((err) => {
    console.log(err);
});

I'm having issues with "launch" not working at all (no logs what so ever)

The bot.js (ready event) fires twice tho.

crimson vapor
#

bot.js is the ready event or the file that boots the bot?

lone spire
#

Hey there! is there any way for the cache for a user on the site can be refreshed? I am attempting to add one of my co owners to my listing, but they aren't currently in the server. The name cached by the site is their deadname, so it would be really helpful if that could be changed in some way.

elder vine
#

bot.js is the bot

crimson vapor
#

wait so I dont understand why you pass token through

#

why not just set it to boot normally

#

and just shard it like that

faint hare
elder vine
#

Still didn't fix.

crimson vapor
#

that was kinda a question that I just wanted answered

#

gimme one sec to look through your code

#

alright

#

I dont understand

#

doesnt bot.js start your bot

#

if it does, you should get logs

elder vine
#

bot.js is the place where events/command handler etc. are

crimson vapor
#

so does that work?

#

does the bot go online?

elder vine
#

Yea

crimson vapor
#

ok

#

one sec

#

ok do you use d.js

elder vine
#

I don't get reply from it tho.

#

Yea

crimson vapor
#

ok

elder vine
#

v12.1.1

crimson vapor
#

I dont think manager.on('launch ') is a thing

#

try shardCreate

elder vine
#

omh

#

:lmao:

crimson vapor
#

you can also use the bot.on('shardReady') I think

#

bot || client

#

I assumed you used bot

elder vine
#

Well

#

no

#

it's not bot

crimson vapor
#

client then?

elder vine
#

no

#

manager

crimson vapor
#

no

#

in your bot.js

elder vine
#

but shardReady worked

crimson vapor
#

ok good

uneven monolith
#

I have tried making my own code and taking code from online and it always does this

#

I’ll send screenshots of the code in a min

muted ridge
#

@quartz kindle Yikes, sorry for no response. Maybe I should've asked to ping. I use d.js and.. heartbeat packets? Elaborate, please?

#

If it helps, this only started occurring recently.

earnest phoenix
#

which discord.js ver are you on

#

wait

#

im dumb

#

i dont even know if you're using d.js

#

tldr check if there are any updates for your library

#

this is most likely due to recent gateway changes

#

I have a problem, I have this command, but it doesn't run unless you have money with money.db:

const db = require("megadb");
const dinero = new db.crearDB("dinero");
module.exports = {
  nombre: "inv",
  alias: [],
  categoria: 'Bot',
  run: async (client, message, args) => {
   
    
  const user = message.mentions.users.first() || message.author;
  let cantidad = await dinero.obtener(`${user.id}`);   
      
  const embed = new Discord.RichEmbed()
  .setTitle(`Inventario de ${user.username}`)
  .setColor('90EE90')
  .setThumbnail("https://cdn.discordapp.com/attachments/696127264915587093/697245085066199040/mochila.png")
  .addField("Escudo:", "``0``", true)
  .addField("Poder:", "``0``",true)         
  .addField("Dinero:", "``"+ cantidad +"``",true) 
  .addField("Nivel:", "``0``",true)
  .addField("Rango:", "``Cadete``", true)   
  .addField("Puntos:", "``0``", true)
  message.channel.send(embed)

}
  }
copper cradle
#

...

#

because the first thing it does is to get the money from the """""database"""""

#

@earnest phoenix

#

I hate megadb it doesn't even follow naming convetions

#

crearDB and it's sooo redundant, like srsly, should be Crear and that's it.

#

I'm not saying the code is wrong, alright?

pallid vector
#

I've been getting this error recently, I have a feeling it's something to do with the voting system

copper cradle
#

you used https

#

show your code

#

smh

pallid vector
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("voted")
        logger.info('Received an upvote')
        print(data['user'])
        user = self.bot.get_user(int(data['user']))
        print(user)
        try:
            await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote/daily again in 12 hours!")
        except:
            pass

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("voted")
        logger.info('Received an upvote')
        print(data['user'])
        user = self.bot.get_user(data['user'])
        print(user)
        try:
            await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote again in 12 hours!")
        except:
            pass

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))
#

init and class on top

copper cradle
#

you sure that's where it originated?

#

are you using aiohttp? or maybe it comes from dblpy

pallid vector
#

I'm not using anything http or aiohttp related besides dblpy

copper cradle
#

hmm

#

show more code

#

the code you showed isn't the origin of the err

pallid vector
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token'
        self.dblpy = dbl.DBLClient(stuff here)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("voted")
        logger.info('Received an upvote')
        print(data['user'])
        user = self.bot.get_user(int(data['user']))
        print(user)
        try:

            await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote/daily again in 12 hours!")
        except:
            pass

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("voted")
        logger.info('Received an upvote')
        print(data['user'])
        user = self.bot.get_user(data['user'])
        print(user)
        try:
            await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote again in 12 hours!")
        except:
            pass

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))
#

that's the entire cog

copper cradle
#

weird

#

the error shouldn't be originating in the first place

pallid vector
#

idk, it just recently started appearing

copper cradle
#

check dblpy

#

you should be able to check it and modify it in your modules folder

earnest phoenix
#
            listofem.forEach((groups) => {
                var date = groups[0]
                groups = groups.shift() 
                str = groups.Id  + " ("+ date +"), " + str
                
            })
                
                
            })```
#

P.A.E.T. has hit an error!: TypeError: Cannot read property 'forEach' of undefined

#

huh

copper cradle
#

what is json

earnest phoenix
#

"JavaScript Object Notation is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types. Wikipedia"

#

🙂

#

oh wait

#

i found issue

#

ur so smart zsnails

#

i forgot to change where it gets json

#

LOL

summer torrent
#

"JavaScript Object Notation is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types. Wikipedia"
@earnest phoenix are you kidding

earnest phoenix
#

it was a joke

copper cradle
#

lmao

#

I hope you were joking lol

#

my quesion actually sounded kind of stupid tho

queen needle
#

is it possible to actually @ the user javascript let person = message.guild.member( message.mentions.users.first() || message.guild.members.get(args[1]) ); @${person.user.tag}

#

that writes their name as text

summer torrent
#

just ${person}

queen needle
#

thank you

queen needle
#
  if(michelle = true){
    
  
          if(message.content.startsWith(PREFIX + "ship-candle")){
            message.channel.send(
            message.author + ' candles' + ' have a ' + '100% ship rate ' + 'no relationship is better then theres'
            )
}
  }else{
    message.channel.send("You're not " + michelle)
  }
          });```
slender thistle
#

@pallid vector Does that error appear by itself?

pallid vector
#

I have a feeling it does, don't quote me on this; but I feel like it happens when someone votes?

#

Not too sure when it occurs

slender thistle
queen needle
#

so i assigned the var michelle and equaled it to a person's id but any person can use that command not just they can anyone help so its just thwm

earnest phoenix
#

how can i make my nodejs wait for a foreach to finish

#

before going on

scenic kelp
#

basically that says to wrap it in a promise

earnest phoenix
#

I have this as my prefix RegEx, it functions well with special characters but breaks if the prefix is a letter like ABC. Can someone tell me how can I make this RegEx compatible with prefixes like b! and stuff?

const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|\\${prefix})\\s*`);
if (!prefixRegex.test(message.content)) return;
digital ibex
#

hi

earnest phoenix
#

Yes

#

it means your calling a module (look at require statements) that doesn't exists

#

check line 976

digital ibex
#

uh

#

oka

#

@earnest phoenix line 976 where?

earnest phoenix
#

I'm not gonna read the whole error for u man

#

I already did most of it for i

#

u

#

cough maybe look up the module cough

#

I'd you didn't write the code then it's in an installed module, see the error for which one cough

copper cradle
#

@queen needle you're using an assign operator, are you like, blind?

queen needle
#

yeah

#

i didn't even relize that im dumb sorry

copper cradle
#

hmCharles you also don't know how to read errors as I can see

muted ridge
#

Anybody have a clue as to why my bot keeps disconnecting and reconnecting? Someone mentioned heartbeat packets but I don't have any clue as to what they mean.

earnest phoenix
#

yes,

#

and imma assume this is js, so imma mostly stay out of it, but how's your internet/cpu? is there anything blocking the main thread?

muted ridge
#

CPU is sitting at a low 18%, nobody is using the internet except me, I'm sitting at a hot and spicy 160Mb/s. (16MB/s)

#

Nothing is blocking anything.

earnest phoenix
#

did you just compare 160Mb/s to 16MB/s D:

#

8Mb = 1MB

#

but yea after that my knowledge of the topic is zero

muted ridge
#

o-o

#

Oops, my Bad 😆

earnest phoenix
#

no its fine :p

muted ridge
#

Anyways, thanks for the attempt. Cheers.

#

If anybody else has an idea, please let me know.

digital ibex
#

hi

#
TypeError: db.fetch is not a function
``` with quickdb, does anyone know how to fix it? i am new to databases
#

and i've tried with db.get()

muted ridge
#

Ah, yikes, I haven't seen that. Sorry.

#

But is it really meant to reconnect every few seconds?

earnest phoenix
#

my guess is that your library keeps getting kicked off the gateway but it cant reconnect properly because it isn't sending the new opcode - so it just gets in an infinite loop of

gateway: i want this
library: I don't know what that is, here is this instead
gateway: i dont want that

muted ridge
#

That's a perfect explanation lol, love it.

#

Thanks Discord JS, Very Cool. Thanks for your help, cry.

earnest phoenix
#

it was stupid from discords side to force this update so suddenly without prior notice

dusky marsh
#

discord made a stupid decision? would have never guessed

wide ridge
#

I'm getting a 401 from dblapi, just started happening recently. Any ideas why?

0|index    | 08-04 00:09:10.334:     at IncomingMessage.<anonymous> (/root/mybot
/node_modules/dblapi.js/src/index.js:118:25)
0|index    | 08-04 00:09:10.334:     at IncomingMessage.emit (events.js:327:22)
0|index    | 08-04 00:09:10.334:     at endReadableNT (_stream_readable.js:1201:12)
0|index    | 08-04 00:09:10.334:     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
0|index    | 08-04 00:09:10.334:   raw: '{"error":"Unauthorized"}',
0|index    | 08-04 00:09:10.334:   body: { error: 'Unauthorized' },
0|index    | 08-04 00:09:10.334:   status: 401,
earnest phoenix
#

wrong token

wide ridge
#

but my voting still works

earnest phoenix
#

🤷‍♂️

wide ridge
#

it's on the initial loading that errors pops up

earnest phoenix
#

401 is always used for providing incorect details to a locked endpoint, so unless DBL is misusing status codes, your token is wrong

#

try regenerating it

#

how do i use dblwebhook in my flask app

rugged hatch
#

Hey! anyone know what url to post to to get a new url using refresh token?

wheat jolt
#

What

steady hamlet
#

would it be breaking discord ToS if i made a command that allowed people to choose if they wanted to get a dm notification

#

when i say dm notification, i mean when someone with special perms to the bot sends out an announcement using the bot and whoever has the dm notifications enabled would get the announcement via dm

wheat jolt
#

I don't think so

steady hamlet
#

i couldnt find it while reading the tos

pale vessel
#

@rugged hatch what token are you trying to refresh?

rugged hatch
#

a token i have used

#

@pale vessel

summer torrent
#

discord or dbl

pale vessel
#

what token?

slender thistle
#

@steady hamlet I suggest you use a separate private channel where the bot mentions them instead of DMing

steady hamlet
#

ok

rugged hatch
#

Discord token

#

@pale vessel

balmy lantern
#

This is legit right

summer torrent
#

"SYSTEM"

prime cliff
#

Did you not even read the banner text above and below that

pale vessel
#

it's fake!!!

#

/s

balmy lantern
#

Idk ive just seen alot of crap where people get baited by 'official' accounts

#

As well as the spooky link that discord in theory should of undid so just bein safe

earnest phoenix
#

what the heck i am on my computer

rugged hatch
#

I got that too

pine bear
#

am I an idiot

pale vessel
#

yes

#

f is not defined most likely

pine bear
#

F

slender thistle
#

lenth?

uneven wyvern
#

lmao

high bough
#

Yea js lenth

#

lmao

pine bear
#

typo

#

wtf

#

I noticed that already

#

I'm trying to create a command handler and F*ed it.

#

XD, I only got stuck on command handlers

wide ridge
#

I have the base url
https://discordapp.com/api
How would I, for example, get a guild? Where do I put my authentication token in the url?

earnest phoenix
#

how can i make a message edit like 10 times with timeout..a simple way to do it?

pale vessel
#

not in the url

#

as a header

#

@wide ridge

wide ridge
#

for a get request? @pale vessel

#

I'm trying to use postman to send a get request

#

can't figure out how to include header for a get requst

pale vessel
#

yes

#

add the authorization header

earnest phoenix
#

I have to verify my discord account with my identity card (see image for proof), I put my identity card but Discord puts me its a few minutes after:

** We are unable to verify your identity because one or more of the documents you provided are unverified. Please try again.**

#

Yet my identity card can be seen

summer torrent
mossy vine
#

arent you supposed to be emailing support about htat

ornate shoal
#

I had that twice, worked fine the 3rd time

#

or try a different document

digital ibex
#

hllo

#

does anyone know why i cannot log into the compass?

frail ocean
#

Any good tutorials for Discord OAuth (js related) for me to hand onto someone asking? Can't find any decent ones.

earnest phoenix
#

follow the official docs

#

oauth isn't locked to a language

#

how do i post the server amount?

late hill
#

Is the privileged members intent, purely these events?
Will I still be able to "download" members the way it does now without this?

oblique basalt
#

Hiya,

I'm still having issues where it's claiming name is undefined.

/app/bot.js:25
console.log(Command ${props.config.name}.js (#${props.config.id}) loaded!

TypeError: Cannot read property 'name' of undefined
at files.filter.forEach.file (/app/bot.js:25:49)
at Array.forEach (<anonymous>)
at fs.readdir (/app/bot.js:22:78)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)

If you would like to help me and my friend fix this please DM me so I can add you to the glitch project. Thanks.

summer torrent
#

you cannot edit with this

#

use .edit()

#

no

#

.edit(new version of embed)

tight plinth
#

do u check for what reaction is even clicked

#

sec

wheat jolt
#

m isn't a message

#

m is a collector with reactions

tight plinth
#

try {awaitSomething blahblablah}catch(e){blabblh}//code

wheat jolt
#

.-.

pale vessel
#

._.

earnest phoenix
#

Since I swithched hosts from my bot (now on glitch) to fix a problem, it gives weird errors like this: message.guild.members.get is not a function, anyone know why?

#

the code works perfectly fine on my desktop

wheat jolt
#

is it discord.js v12?

pale vessel
#

probably the djs version

wheat jolt
#

yup

earnest phoenix
#

ah okay

#

thanks

wheat jolt
#

recheck the docs

#

discord.js v12 changed many things

earnest phoenix
#

so to get this to work I need to use v11?

#

because yes this is v12

wheat jolt
#

your choice

#

You can read the docs for v12

#

and update your code to v12

#

or downgrade to v11

earnest phoenix
#

that will take a while so yes

#

I'll update my code later

wheat jolt
#

cool

#

huh?

#

.-.

earnest phoenix
#

yes I'm reading docs now that should work

#

but I'm gonna update my code later when I have time to do it all

wheat jolt
#

you mean docs?

earnest phoenix
#

yes lol

wheat jolt
#

k

#

ro

earnest phoenix
#

yes was reading that too

wheat jolt
#

.-.

earnest phoenix
#

thanks guys

wheat jolt
#

np

vernal yoke
#

You guys got discord verification message? Im a bit skeptical sending my id lol

wheat jolt
#

what?

summer torrent
modest maple
#

Its an official message

#

if you actually read the message and looked at the details on their site

torpid valve
#

How to get bot's cpu in %?

twilit rapids
#

What are you using?

#

Nodejs?

torpid valve
#

Yep

twilit rapids
#

process.cpuUsage()

torpid valve
#

Thanks

digital ibex
#

hi

#

does anyone know why i keep getting this when trying to connect with mongoose?

golden condor
#

It... timed out?

digital ibex
#

yeah but

#

why

#

its been happening for over 30 minutes, i've reset my password a few times as well

golden condor
#

Possible scenarios where server selection timeout can happen include – if a network is down or a primary node failure in a replica set.

digital ibex
#

are there any ways to fix them?

golden condor
#

Not sure

#

Is it a localhost db?

digital ibex
#

yeah

golden condor
#

Try connect via localhost and the port

digital ibex
#

how would i do that?

#

i just started setting up my db

#

never used mongodb before

golden condor
#

What language you using?

digital ibex
#

javascript

golden condor
#

You could try use something easier like quick-db

digital ibex
#

i want an actual database

golden condor
#

It's sqlite

digital ibex
#

yeah, ik about quickdb

#

i mean like

#

one which is customizable

#

if that makes sense

golden condor
#

This is pretty good

cinder patio
#

you can use sequelize + sqlite3/mongo/postgres

#

or mongo

golden condor
#

He is tryna set it up for the first time

digital ibex
#

is there any way i can get mongoose to work though?

golden condor
#

How do you connect through postgres and use it?

#

I have a heroku postgres d

#

and a mysql db

cinder patio
#

Sequelize is an ORM for different databases

golden condor
#

Not sure how to connect]

cinder patio
#

And it's syntax is very similar to mongo

pine bear
#

for some reason this command handler doesn't work,

#

it's somehow correct but it doesn't send anything.

#

it doesn't show an error on console logs either,

honest perch
jovial nexus
#

is there a way for my bot to be online but with the phone thing?

quartz kindle
#

lmao

honest perch
#

i think my bots been in the future

earnest phoenix
#

You need to install it

#

No matter if it is inside the package.json or not, it does not mean that it is installed

quartz kindle
#

run enable-pnpm in your glitch console

#

pnpm gets disabled if you manually edit your package.json afaik

#

you should use the glitch add package button instead

#

👍

digital ibex
#

hi

#

does anyone know why my mongoose is not connecting on the compass?

#

it says Server selection timed out after 30000 ms and my ip is whitelisted

#

any ideas? I even deleted that cluster and made another one, its still not connecting

quartz kindle
#

are you using atlas?

digital ibex
#

yeah

quartz kindle
digital ibex
#

I can login with atlas and everything works fine on atlas, i can't connect to compass for some reason

#

my friend was helping me with it

#

i'll check that

prime glacier
#

how many days discord take to verify a bot

honest perch
#
    msg.edit(`:heartbeat: ${Date.now() - message.createdTimestamp} ms`); ```
#

discordjs

digital ibex
#

yep, i followed the guide but still

quartz kindle
#

@prime glacier top.gg is not affiliated to discord, so discord doesnt do anything. the top.gg staff takes from a few days up to 2 weeks to verify your bot

digital ibex
#

hm?

#

oh

prime glacier
#

@quartz kindle OHK

quartz kindle
#

@honest perch what is msg and what is message? maybe you want msg.createdTimestamp

#

you could also console.log those two values

plush magnet
#

I've tested it and it seems fine mathematically you might be getting 2 different messages mixed up misly

quartz kindle
#

@digital ibex double check the guide, maybe there's something you missed. i cant help you any more because i dont use mongo

digital ibex
#

okay

honest perch
#

@quartz kindle, thing is it worked fine but when I updated some code and cloned my repo its now doing this. I haven't touched my ping command for weeks

quartz kindle
#

does the value keep decreasing further into the negatives every time you run the command?

#

anyway console.log both message.createdTimestamp and msg.createdTimestamp and see if there is any pattern

#

you might be accidentally overwriting the message object or its timestamp

plush magnet
#

Or just use the debugger that can work even better

quartz kindle
#

if only node's debugger actually worked well

#

lmao

plush magnet
#

I find that more helpful then console logs everywhere

#

Works fine for my vsc shrugs

quartz kindle
#

never worked for me lmao

plush magnet
#

It's really damn helpful beyond belief

quartz kindle
#

it gets randomly stuck on "attaching/connecting/waiting for debugger"

crimson vapor
#

I prefer console logs

plush magnet
#

This is why we can't have nice things

crimson vapor
#

lol

quartz kindle
#

if i need to debug something hardcode, i login to my bot via nwjs and use chrome's console lmao

honest perch
plush magnet
#

The first time you run the debugger it takes a while to set it values up

quartz kindle
#

looks like there is a fixed offset of -430000

#

are you adding/removing the value 430000 anywhere?

plush magnet
#

After that it pretty much launches straight away though I think there's also an extention which sets the debugger up for node.js stuff

honest perch
#

ok i fixed it by changing it to this

#
module.exports.run = async (bot, message, args) => {




  message.channel.send("Pong...").then(msg => {

    msg.edit(`:heartbeat: ${msg.createdTimestamp - message.createdTimestamp} ms`);
  });

}

module.exports.help = {
  name: "ping"

}

crimson vapor
#

so close

#

there ya go

quartz kindle
#

you know, message is the author's message

plush magnet
#

Ye

#

That ain't it chief

quartz kindle
#

but well if it works it works

crimson vapor
#

well

#

that would show ping

plush magnet
#

But that's unreliable

#

This is literally calling a bug a feature hahaha

crimson vapor
#

just not what most people use because it includes the time for the client sending the message

earnest phoenix
#

How do I link coding to a bot?

quartz kindle
#

you could simply do something like js let time = Date.now() message.send("bla").then(msg => { msg.edit(Date.now() - time) })

plush magnet
#
const m = await message.channel.send({ embed: { color: 0x3AFF84, description: 'Ping is *Calculating*...' } });
		m.edit({ embed: { color: 0x3AFF84, title: '🏓 **Pong!** 🏓', description: `Latency is ${m.createdTimestamp - message.createdTimestamp}ms\nAPI Latency is ${Math.round(client.ping)}ms` } });```

This is one I've used
#

Either one works really

crimson vapor
#

you use the embed objects?

plush magnet
#

It's an old code I'm not bothered updating rly

crimson vapor
#

oh

plush magnet
#

If it works it works

quartz kindle
#

i use embed objects as well

velvet ember
#

in v12, can I use the cache on a guild channels manager to read/modify all channels in a guild?

#

or do I need to fetch them first?

#

(or both, heh)

crimson vapor
#

Tim, are embed objects more efficient or do you just prefer the object syntax?

quartz kindle
#

you should be able to access them all without fetching, but you cant update them all without adding some proper delay

velvet ember
#

yeah, I figured. Thanks

quartz kindle
#

@crimson vapor they are more efficient, but the difference is probably a few nanoseconds

crimson vapor
#

so on a large scale bot, that would be more optimal

plush magnet
#

It's in a scope where it doesn't matter which one you use

quartz kindle
#

its just that you have more control over your code if you do it manually, you can see exactly whats going on at first glance

plush magnet
#

Each person likes it their own way

velvet ember
#

Honestly, as long as I am consistent I don't care.

#

I use objects more often, since I usually include some language/translation files with my bots, stored in a json format.

#

(instead of hardcoding ex. a help embed, I'll use the language json file specified in the config and grab the object from there)

heavy marsh
plush magnet
#

There's a link at the top that takes you to where all the things are for each box

#

So if your not uses any of those

#

You have to click the box and provide an image or video showing your bot using that function

#

Eg if your bot does something when someone joins a guild

#

Your gotta tick that bottom box

#

The top box is for presence stuff like games

heavy marsh
#

OOk ok thanks

cinder patio
#

This may be a dum question, but in javascript, is storing references to objects more expensive than storing just a short string?

quartz kindle
#

@cinder patio i dont think so

#

would be arguably the same as storing a pointer in C

earnest phoenix
#

How long roughly does it take for our bot verification applications get responded to

sullen patrol
#

Hoe do people make those pictures like the mee6 level command?

#

Please in js

crimson vapor
#

canvas

marble juniper
#

you could use a node module called
node-html-to-image

crimson vapor
#

I prefer canvas

marble juniper
#

and then use html code and css to make an image

#

but there are other options

cinder patio
#

you can use puppeteer as well if you want...

copper cradle
#

@woven sundial the error log literaly tells you where the error originated...

#

learn to read errors

royal portal
#

I need help with my unban on discord.js

#

so it sends an embed saying who got banned and for what reason in a logs channel

#

but it still sends it when you say !unban (user) and the user is already unbanned

copper cradle
#

@woven sundial show the error

empty owl
#

what lib

copper cradle
#

and I'll show you exactly where it is

empty owl
#

nvm

#

I’m stupid

#

can I see your code

royal portal
#

sure

#

hold on

copper cradle
#

just show

#

I wasn't taking you for a dumb as you said

regal saddle
#

Whats popin

copper cradle
#

I just tell that to everyone

royal portal
#

@regal saddle not much

#

just ppl getting errors

finite bough
royal portal
#

and ppl like me stuck

#

on a code

regal saddle
#

What problem do you have?

royal portal
#

so

#

I have an unban thing

#

when you unban a user

#

it sends an embed

#

to a log channel

#

and

regal saddle
#

dont spam btw

royal portal
#

ok

#

if you unban a user which isnt banned, it still sends the embed to the logs channel

#

the embed contains the info like the reason and who got banned

copper cradle
#

well then make it check if the user has been banned

finite bough
#

show ur code pls

royal portal
regal saddle
#

then you missing an return or a command that checks if that user is banned or not

royal portal
#

i don't know how to check that though

regal saddle
#

gimme sec

#

ill hover over your code

#
if (!message.guild.me.hasPermission('BAN_MEMBERS')) return message.channel.send('Error: I don\'t have the permission to unban members.');
 if (!message.member.roles.cache.some(role => role.name === 'Server Administrator')) return;``` why?
#

dont check for a role, check for permissions.

copper cradle
#

uug

finite bough
#

thats his choice

#

and no return

copper cradle
#

not everyone will have a role called Server Administration

regal saddle
#

i mean you can do a setup command that create the role but...

#

useless

#

So, what you wanna do @royal portal

finite bough
regal saddle
#

tell me your idea

royal portal
#

so

finite bough
#

if there is no unban

royal portal
#

it sends the embed

#

in a channel

finite bough
#

it doesnt return anything

royal portal
#

even if the user is unbanned

finite bough
#

u can do
} else return;

regal saddle
#

you have a ban command right?

royal portal
#

yeah

#

and it works perfectly

#

if the user is banned, it doesnt send it in the log channel

finite bough
#

i will test ur code just to see for myself tbh

regal saddle
#

wait, me stoopid.

#

/// let bannedMember = await client.users.fetch(args[0]);

#

why is there ///?

royal portal
#

oh

#

wait

#

that should be right one

#

without the ///

regal saddle
#

btw, start using modules.

#

so you dont need to doe this

#

`if (message.author.bot) return;
if(message.channel.type === "dm") return;

let prefix = "-";
if (message.content.indexOf(prefix) !== 0) return;`

royal portal
#

well its fine

#

bot still works

regal saddle
#

just saying.

#

you dont need to

#

can i get the channel id of your mod log?

royal portal
#

ok

#

696121075192299552

#

but i dont want all bans to go to that channel

#

so if someone bans in that server, it goes to that server's logs

regal saddle
#

replace this
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");

with this:
client.channels.cache.get(696121075192299552).send()

#

for later

#

so if someone bans in that server, it goes to that server's logs
what you mean?

royal portal
#

so

#

if someone bans a person in the server, it goes the logs in that server

#

not in my server

regal saddle
#

Ok.

#

Just make it then.

royal portal
#

let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");

regal saddle
#

ok.

#

mh.

#
let reason = args.slice(1).join(" ")
        if(!reason) reason = "No reason given."
        let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");```
#

like i said you miss a return

royal portal
#

let reason = args.slice(1).join(" ")
if(!reason) reason = "No reason given."
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log") return;

regal saddle
#

read the discord.js docs.

#

You will find the problem there

royal portal
#

i am

quartz kindle
#

if message.guild.members.bannable return; this is not valid javascript

grizzled raven
#

.then() !== await

charred jetty
#

throw new Error(`Please install ${moduleName} package manually`);9:37 PM

^9:37 PM

9:37 PM

Error: Please install sqlite3 package manually9:37 PM```

How to fix it?
earnest phoenix
#

please install sqlire3 package manually

#

9:37 PM

#

So i have commands that you can mention people or use their id to do stuff but...
How can i make it so it detects the user by their username?
Example: _userinfo Zeiad

sudden geyser
#

Iterate through the guild member list and find the user by their username by checking their username (input === username).

earnest phoenix
#

@sudden geyser hmm... Like can you show me the code of it?
I got a little confused...

charred jetty
#

So how can i install sqlite3 manually?

sudden geyser
#

@earnest phoenix what library are you using.

earnest phoenix
#

Discord.js 12.1.1

sudden geyser
#

guild.members.cache.find((member) => {...})

member is a GuildMember. Check the docs for the user and then the username to check.

earnest phoenix
#

Hmm i see... Thx for the code... I'll check that out...

quartz kindle
#

@charred jetty run enable-pnpm in your glitch console

earnest phoenix
#

is it a bad idea to host different features of my bots on different services? like multiple instances that uses the same token but contains different commands, if that makes sense

quartz kindle
#

well, nothing wrong about that, but you're wasting a lot of resources

#

because you will have multiple machines wasting tons of ram and cpu for little work

#

a much better idea would be to use them for sharding instead

earnest phoenix
#

was thinking it could be useful if i want to test a new command and don't want the entire bot to crash if my code doesn't work as expected

quartz kindle
#

yes you can do that

#

i do that on my own pc

charred jetty
#

throw err;10:04 PM

^10:04 PM

10:04 PM

Error: Cannot find module '../build/Release/canvas.node'```

Now this
quartz kindle
#

canvas requires a lot of dependencies to be installed in the system

#

not sure if glitch supports them

charred jetty
#

But i was using it

finite bough
#

i use canvas in glitch

#

so yes it does

quartz kindle
#

then try reinstalling it

finite bough
#

try reinstalling canvas

charred jetty
#

Tried nothing happened

finite bough
#

holdon

#

u use glitch right?

quartz kindle
#

happy birthday btw

#

xD

finite bough
#

tyy xD

#

@charred jetty re enable pnpm

charred jetty
#

Trying re-enable npm

finite bough
#

LMFAO

charred jetty
#

@finite bough i did

#

And then it came

#

Previous one gone

finite bough
#

??

charred jetty
#

I think it's working

finite bough
#

ok cool

charred jetty
#

Ok.. by enabling npm the thing installed

#

Solved

#

@quartz kindle can you please teach me how you get that i have to enable-pnpm ?

finite bough
#

sqlite 3?

charred jetty
#

Yes

quartz kindle
#

afaik glitch disables pnpm if you manually edit your package.json or if you install stuff in the console

#

glitch wants you to use the add package button instead

finite bough
#

^ use this as reference, easy to understand

charred jetty
#

Oh

finite bough
#

tho

#

if u r using a db

#

as a glitch user i will suggest mongodb

charred jetty
#

But bot was not working... Like couldn't install anything with npm and it was stucked.. couldn't even refresh...

#

After 20mins it could install almost everything with npm

finite bough
#

following are the things that could have happened

#

ur internet oofed

#

the project oofed

charred jetty
#

I think my project crossed it's limited requests

quartz kindle
#

you get what you pay for :3

charred jetty
#

Yup

earnest phoenix
#

Same happened for me my internet was giving fine speed

finite bough
#

tim bully pandasad

charred jetty
#

And the same thing happened when i was trying to self host my bot.. exactly same error... Now i understand how to fix itoliy

finite bough
#

anyways

#

try mongodb

grizzled raven
#

or rethinkdb

charred jetty
#

@finite bough ok.. mangoman

quartz kindle
#

or json :^):^):^)

finite bough
#

yes json best db

#

to make a good json db u need a file named corona.js

grizzled raven
#

tim i thought you were smart

#

didnt know you were this smart

earnest phoenix
#

how do I link code to a bot?

elder vine
#

What?

#

You use a bot token

earnest phoenix
#

im downloading node.js currently

mossy vine
#

dont start with bot development if you have no coding experience

#

please

earnest phoenix
#

i do have coding experience

modest maple
#

in what language tho

earnest phoenix
#

ive used python java and snap

modest maple
#

why not use Python or Java then

mossy vine
#

^

modest maple
#

rather than a language youve never used...

earnest phoenix
#

well i just don't no how to put the code into the bot

modest maple
#

thats.... not how it works

earnest phoenix
#

what do you mean

quartz kindle
#

you dont put the code into the bot. you build a program with your code, and this program logs in to discord

earnest phoenix
#

ok

quartz kindle
#

you can use nearly any programming language, and there are a lot of libraries out there to interact with the discord api

earnest phoenix
#

ok im just trying to figure out how the bot uses the code

quartz kindle
#

you use a discord library and login via your bot token

earnest phoenix
#

ok

quartz kindle
#

you can do it without a library by using websockets yourself, but dealing with websockets is a pain

#

so just install and use a discord library

#

for javascript there is discord.js and eris

#

for C# there is Dsharp and discord.net (or something like that)

#

most of those libraries will have a website featuring comprehensive documentation and code examples that shows how to build a basic bot with it

pine widget
#

.

valid frigate
#

isnt there like one c++ discord api wrapper

mossy vine
#

isnt it dead

valid frigate
#

lmao yeah

#

the only one and it's dead

earnest phoenix
#

cpp api wrappers are a pain in the ass cause of websockets

pale vessel
#

@woven sundial this is nicer js let prefix = "."; if (message.guild.id === "DBLID") prefix = "cor!";

crimson vapor
#

umm

#

dont think that will work

golden condor
#

I have been trying to set my bot to dnd for ages and it won't work

#

on discord.js

crimson vapor
#

one sec lemme get the file open for mine

golden condor
#
  client.user.setPresence({ activity: { name: `c!help | ${client.guilds.cache.size} servers` }, status: 'dnd' })```
pale vessel
#

a command doesn't work?

golden condor
#

Nope

edgy heron
#

@woven sundial hello

#

please tell me how to do it xD

pale vessel
#

just do client.user.setStatus("dnd") if you don't need anything else

#

but it still doesn't work for you

golden condor
#

It won't work

pale vessel
#

i know

edgy heron
#

actually. i have 2 prefix now. . and cor!

golden condor