#development

1 messages · Page 847 of 1

zenith terrace
#

no

high bough
#

No, the Secret token is your bot's password

earnest phoenix
#

W-

high bough
#

The client id is the id of your bot

earnest phoenix
#

The bot has a password?

high bough
#

Like the User Id

#

Yes

#

Soory

earnest phoenix
#

So I could log in to my bot right now?

high bough
#

no, you cant

elder vine
#

It's a token on the developer portal

earnest phoenix
#

W-

high bough
#

Yeah

zenith terrace
#

The token of the bot is what makes it online

elder vine
#

It can be used to access your bot.

high bough
#

The Client Secret is the token used to authorize your bot

#

Sorry, *your code

#

to be run on the application id

earnest phoenix
#

Ok afk, I'm gonna try log in to my bot's account.

#

Lol.

high bough
#

Basically, it shows which code belongs to the bot or not

earnest phoenix
#

Oh.

pallid zinc
#

My client Id is the same to @dusty moat

#

If client id was a password anyone can get it by pinging bot

high bough
#

Yes it is the same with your Bot's User ID

earnest phoenix
#

Well before I do I'll read mre of this Windows Getting Started at Bot Developing.

high bough
#

If client is was a password anyone can get it by pinging bot
@pallid zinc Not the ID, the Secret

earnest phoenix
#

then I can code!

high bough
#

Client Secret

pallid zinc
#

Token ??

high bough
#

Yeah whtvr

#

Yeah

#

-botinfo 422087909634736160

gilded plankBOT
#
Bot info
ID

422087909634736160

Username

Discord Server List

Discriminator

8005

Short Description

The official Discord bot for the Discord Server List!

Library

discord.js

Prefix

N/A

Total Upvotes

1526

Monthly Upvotes

126

Server Count

No server count

Owner(s)

@fossil oxide dblAdmin dblMod
@languid dragon dblCertified
@bitter sundial dblAdmin

earnest phoenix
#

What is this?

zenith terrace
#

keep commands out of here

earnest phoenix
high bough
#

-bots 414622975598395398

gilded plankBOT
high bough
#

okay, jesus im so sorry

pallid zinc
#

Why

zenith terrace
earnest phoenix
#

Hello! Any person know how to do premium feaatures? Like if you UpVote the bot 5 times you can run a command?

#

nope.

#

Sorry.

#

Any other person know?

pallid zinc
earnest phoenix
#

Can anyone tell me what this means?
this script downloads third party software

This script will direct to Chocolatey to install packages. By using
Chocolatey to install a package, you are accepting the license for the
application, executable(s), or other artifacts delivered to your machine as a
result of a Chocolatey install. This acceptance occurs whether you know the
license terms or not. Read and understand the license terms of the packages
being installed and their dependencies prior to installation:

This script is provided AS-IS without any warranties of any kind

Chocolatey has implemented security safeguards in their process to help
protect the community from malicious or pirated software, but any use of this
script is at your own risk. Please read the Chocolatey's legal terms of use
as well as how the community repository for Chocolatey.org is maintained.

Press any key to continue . . .

prime cliff
#

Just license agreement nothing major just press any key to continue

earnest phoenix
#

Ok.

tight plinth
#

nothing interesting, just do what it wants you to do

earnest phoenix
#

how to get a prefix?

tight plinth
#

define one

earnest phoenix
#

where?

#

Hello! Any person know how to do premium feaatures? Like if you UpVote the bot 5 times you can run a command?
Any person know?

#

I know what a prefix is, but I do not know how to get one.

#

Maybe try and put the prefix before the commands in the code, for each command name?

high bough
#

Okay, so I fixed this, but it still doesn't work.```js
if (command === "balance") {
var output = await eco.FetchBalance(user.id);
var user;
if (message.author.id !== config.ownerID) {
user = message.author;
} else if (message.author.id === config.ownerID) {
user = message.members.mentions.first();
}
const baleembed = new Discord.MessageEmbed()
.setAuthor(${user.tag}, ${user.avatarURL()})
.setColor([173, 216, 230])
.addField("Balance", "" + ${output.balance} + "")
.setFooter(${footer}, ${user.avatarURL});
message.channel.send(baleembed);
}

pallid zinc
#

Grayald all I knew is this is related to dbl API you can ask in #topgg-api

#

Kayui any error

high bough
#

No, but it doesn't run

earnest phoenix
#

Is there an error log message?
(Am I learning or getting dumber? Lol)

high bough
#

Is there an error log message?
(Am I learning or getting dumber? Lol)
@earnest phoenix I just said, no

earnest phoenix
#

Oh.

prime cliff
#

If you are not getting any errors then something is wrong with your command system

earnest phoenix
#

I thought you meant there was no error you can see in the code.

ember atlas
#

Probably should console.log it to see if it exists

high bough
#

My other commands are working

prime cliff
#

Try use console.log('Test'); in your code and see what parts work

high bough
#

All right, a sec

earnest phoenix
#

One second.

#

Wait nvm

#

Wait?

#

Do you need node.js AND discord.js!?!?!?

high bough
#

Yes

zenith terrace
#

@high bough error?

prime cliff
#

Yes did you read the guide

earnest phoenix
#

OOOF.

high bough
#

@high bough error?
@zenith terrace NO

earnest phoenix
#

I just saw you need discord.js and I was like W-

#

Lol.

#

I was like W- I already have a .js file.

high bough
#

Do you need node.js AND discord.js!?!?!?
@earnest phoenix

npm install --save node@12.13.0
npm install --save discord.js@12.1.1
pallid zinc
#

Kayui I can see you are not sending any message if the message.author.id !== Config.ownerId

mossy vine
#

@earnest phoenix how old are you Thonk

earnest phoenix
#

I am not telling you private info.

mossy vine
#

ok

#

well

#

you have some serious misconceptions

high bough
#

Kayui I can see you are not sending any message if the message.author.id !== Config.ownerId
@pallid zinc It will affect the messag, but the message is sent automatically

earnest phoenix
#

Yeah, but I have Autism, so it is hard for me to think straight.

mossy vine
#

so i suggest you take a huge step back and actually learn programming before jumping into bot development

pallid zinc
#

U are only sending message when both IDs are same

high bough
#

If it's owner, then it will define user as members.mentions.users.first() otherwise, it will only define user as message.author

earnest phoenix
#

I'm learning programming now, I am just making sure I have everything right.

high bough
#

Start from the basic, dude.

pallid zinc
#

check if your id is correct in config

high bough
#

Yes

#

Oh, I made a bit of correction```js

if (command === "balance") {
var output = await eco.FetchBalance(user.id);
var user;
if (message.author.id !== config.ownerID) {
user = message.author;
} else if (message.author.id === config.ownerID) {
user = message.members.mentions.first();
if (!user) {
user = message.author
}
}
const baleembed = new Discord.MessageEmbed()
.setAuthor(${user.tag}, ${user.avatarURL()})
.setColor([173, 216, 230])
.addField("Balance", "" + "" + "")
.setFooter(${footer}, ${user.avatarURL});
message.channel.send(baleembed);
}

pallid zinc
#

Try sending hello message inside the if statement

high bough
#

Umm, okay...

#

Avtually, a sec, I'll clean up my code

earnest phoenix
#

Woohoo!

high bough
#
if (command === "balance") {
    var user;
    if (message.author.id !== config.ownerID) {
      user = message.author;
    } else if (message.author.id === config.ownerID) {
      user = message.members.mentions.first();
      if (!user) {
        user = message.author
      }
    }
    var output = await eco.FetchBalance(user.id);
    const baleembed = new Discord.MessageEmbed()
      .setAuthor(`${user.tag}`, `${user.avatarURL()}`)
      .setColor([173, 216, 230])
      .addField("**Balance**", "**" + `${output.balance}` + "**")
      .setFooter(`${footer}`, `${user.avatarURL}`);
    message.channel.send(baleembed);
  }
earnest phoenix
#

Oh.

pallid zinc
#

Try logging the user in both case

zenith terrace
#

It wouldnt be qualified as spamming

high bough
#

Try logging the user in both case
@pallid zinc I played with it a bit, and only the embed won't show up

#

The conditions doesn't matter, it just won't show up

pallid zinc
#

Ok

high bough
#

Common issue?

prime cliff
#

See Kayui much cleaner code and easy to understand if something breaks :/

pallid zinc
#

It mean send the embed inside the if statement

high bough
#

See Kayui much cleaner code and easy to understand if something breaks :/
@prime cliff yeah, true

prime cliff
#

Btw does djs even allow both user.avatarURL() and user.avatarURL ?

high bough
#

Actually, I think I've found the issue

#

Btw does djs even allow both user.avatarURL() and user.avatarURL ?
@prime cliff Djs 12.1.1 uses user.avatarURL() instead of user.avatarURL

#
(node:7512) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.footer.icon_url: Not a well formed URL.
prime cliff
#

You use them both

#

Yup

high bough
#

Yeah, something's up

prime cliff
high bough
#

I literally didn't see that xd

#

Actually, it was just that my coding skills are so low, I didn't notice this.

var user = message.members.mentions.first();
#

Which is supposed to be

var user = message.mentions.users.first();
#

XD, but thanks @prime cliff

sick cloud
#
div id="list"
  div id="1"
  div id="2"

really basic layout of my code there

$('div#list').each((i, elem) => {
  $(`div#${elem.id}`)
});

that's what i'm trying to use but all i get is the original div (div#list)

#

so how do i fix that so i can get each div.id (div.1/2)

earnest phoenix
#

Hello i want to use external emoji in discord embed have u got a cod to help me ?

zenith terrace
#

what

earnest phoenix
#

I want to use external emoji

#

Exemple

dreamy breach
#

client.emojis.find(emoji => emoji.name === "yourCustomEmojiName");

earnest phoenix
#

in emoji.name i put the name of the emoji to use in my embed ?

dreamy breach
#

Yep

earnest phoenix
#

This @dreamy breach client.emojis.find(emoji => hammer === ">:paladium_hammer:689575253751365743<");?

zenith terrace
#

No

dreamy breach
#

just: paladium_hammer

wheat jolt
#

So I have an array with some file names and a function which downloades the files by their filenames and I want to download them at the same time and do a console.log when all the files finished downloading. To download them at the same time I use forEach, and to console.log when all the files downloaded, I use a ```js
if(arr.indexOf(element) == arr.length - 1) console.log('files downloaded successfully')

#

What should I do?

dreamy breach
#

So:
client.emojis.find(emoji => emoji.id === "689575253751365743");
Or: client.emojis.find(emoji => emoji.name === "paladium_hammer");

#

@earnest phoenix

earnest phoenix
#

Okai

tight plinth
#

searching by emoji id is btter

dreamy breach
#

yep to avoid issue if there is multiple emoji with the same name.

tight plinth
#

^

earnest phoenix
#

and how to use this emoji ?

dreamy breach
#

wdym?

earnest phoenix
#
const botconfig = require("../botconfig.json");
const red = botconfig.red;
const green = botconfig.green;
const orange = botconfig.orange;
const moment = require("moment");
moment.locale("fr");

console.log(`Prêt à pendre des commandes Chef !`)

module.exports.run = async (bot, message, args, client, user, emojis) => {
    
client.emojis.find(emoji => emoji.id === "689575253751365743");

      
        let good = new Discord.RichEmbed()
          .setDescription(`${emoji_hear} test pour hammer `)
          .setColor("GREEN")
          .setFooter(`Shop`)
 


    message.delete().catch(O_o=>{});
    channel.send(good);

  }

module.exports.help = {
  name: "test"
}```
#

It's my cod

dreamy breach
#

Just put:
const emoji_hear = client.emojis.find(emoji => emoji.id === "689575253751365743");

earnest phoenix
#

Okai

pallid zinc
#

channel.send()

earnest phoenix
#

Umh... I have this error but i have defind my emojis

at Object.module.exports.run (/home/container/Commandes/test.js:12:27)
at module.exports (/home/container/Events/message.js:16:17)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:789:20)
(node:25) 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(). (rejection id: 1)
(node:25) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
slender thistle
#

In HTML, what's the exact difference between name and id attributes?

dreamy breach
#

What's ur discord.js version? @earnest phoenix

earnest phoenix
#

v11

dreamy breach
#

Try to move to latest

earnest phoenix
#

But i change all my cod ?

barren swallow
#

Maybe

dreamy breach
#

Except if you are using some specific v11 function, moveto v12 will not affect a lot of things

barren swallow
#

He defined client as bot

#

bot.emojis.find()

dreamy breach
#

Oh I'm stupid

#

Yeha sry, missread the error log

#

So put:
const emoji_hear = bot.emojis.find(emoji => emoji.id === "689575253751365743");

earnest phoenix
#

Just i test

dreamy breach
#

@barren swallow But he also have client on the function x)

barren swallow
#

Ye I saw that

#

Weird

#

🤔

dreamy breach
earnest phoenix
#

Guys see this ```const Discord = require("discord.js");
const botconfig = require("../botconfig.json");
const red = botconfig.red;
const green = botconfig.green;
const orange = botconfig.orange;
const moment = require("moment");
moment.locale("fr");

console.log(Prêt à pendre des commandes Chef !)

module.exports.run = async (bot, message, args, client, user, emojis) => {
const emoji_hear = bot.emojis.find(emoji => emoji.id === "690098366453252126");

    let good = new Discord.RichEmbed()
      .setDescription(`${emoji_hear} test pour hammer `)
      .setColor("GREEN")
      .setFooter(`Merci d'avoir fait appelle au Zelkoa - Faction Shop`)



message.delete().catch(O_o=>{});
message.channel.send(good);

}

module.exports.help = {
name: "test"
}``` = my cod and say this

dreamy breach
#

What's ur client variable?

barren swallow
#

did you define the Client as bot or client?

grizzled raven
#

@slender thistle isnt it like user usernames and ids, its just better to use the id for storing and stuff?

earnest phoenix
#

I define my bot

#

not client

slender thistle
#

redShrug That's why I asked

barren swallow
#

Then bot.emojis.find()

#

@earnest phoenix

earnest phoenix
#

Yes

dreamy breach
#

Id is unique ? @slender thistle

slender thistle
#

Well apart from that lul

dreamy breach
#

Did u check stack?

#

Of course, there's more to it than that, but it will definitely get you thinking in the right direction.```
slender thistle
#

Yeah, reading right now :p
Second answer explained it just fine

dreamy breach
#

😉

slender thistle
#

Either way, thank you AYAYAsmile

earnest phoenix
#

And how to solve my probleme ?

dreamy breach
#

@earnest phoenix Comment tu définis ton client ?

barren swallow
#

Replace client.emojis.find with bot.emojis.find

earnest phoenix
#

Bah module.exports.run = async (bot, message, args, client, user, emojis) => {

dreamy breach
#

Non mais comment tu initialises ton client.

#

Dans ta classe main

#

Will help him @barren swallow ;p

pallid zinc
#

Wait why you have both bot and client

barren swallow
#

🙂 👍

earnest phoenix
#

can some one help with my bot? i have come to the part that i have to get the bot to that i need to get my bot up runing

dreamy breach
#

@pallid zinc That's strange x)

earnest phoenix
#

Bah enfaite je sais pas je vois rien dans mon main

barren swallow
#

@earnest phoenix what's up?

dreamy breach
#

Ask ur issue @earnest phoenix

pallid zinc
#

Hmm maybe I noob

dreamy breach
#

C'est quoi la classe ou tu te login avec le bot @earnest phoenix et là où tu initialises la commande.

earnest phoenix
#

i need to get my bot up runing. how do i do that?

dreamy breach
#

@pallid zinc No! xD

earnest phoenix
#

mon index.js

dreamy breach
#

Yep

barren swallow
#

@earnest phoenix do you have any programming knowledge?

quartz kindle
#

@earnest phoenix what have you done so far?

earnest phoenix
#

no

#
const client = new Discord.Client();
client.commands = new Discord.Collection();
const fs = require('fs');
const prefix = "s!"


fs.readdir('./Commandes/', (error, f) => {
    if (error) { return console.error(error); }
        let commandes = f.filter(f => f.split('.').pop() === 'js');
        if (commandes.length <= 0) { return console.log('Aucune commande trouvée !'); }

        commandes.forEach((f) => {
            let commande = require(`./Commandes/${f}`);
            console.log(`${f} commande chargée !`);
            client.commands.set(commande.help.name, commande);
        });
});

fs.readdir('./Events/', (error, f) => {
    if (error) { return console.error(error); }
        console.log(`${f.length} events chargés`);

        f.forEach((f) => {
            let events = require(`./Events/${f}`);
            let event = f.split('.')[0];
            client.on(event, events.bind(null, client));
        });
});





client.login('ah ah lol');```
#

Mon index.js

pallid zinc
#

You defined the Client as client

#

Client client

#

And try bot

earnest phoenix
#

but you have to defined bot

#

how to get Mon index.js

dreamy breach
#

If think you don't understand what the principe of:
module.exports.run = async (bot, message, args, client, user, emojis) => {

pallid zinc
#

Client client bot any difference

dreamy breach
#

You aren't obliged to put any variable, you have to choose which one you want to get from tje index.js file.

pallid zinc
#

^^

dreamy breach
#

So idk why there is user and emojis params.

quartz kindle
#

@earnest phoenix what have you done so far?

dreamy breach
#

Since you can get them with message and bot.

earnest phoenix
#

Woh !

#

Idk

#

i have connected my bot to my server, but not other than that i think

pallid zinc
#

Just go to index file second line second word change it to bot

barren swallow
#

@pallid zinc smh

pallid zinc
#

Oh he have used the client every where

#

Change bot to client

earnest phoenix
#

I replace all client with bot

pallid zinc
#

Yes

#

Run

barren swallow
#

@earnest phoenix what's your message event

quartz kindle
#

@earnest phoenix here's how a bot works:
when you create a bot application in discord, you are basically creating an account for your bot. it gives you a login code known as token, and an url to add your bot to servers.
Now you need to use this token to make your bot login. A bot is a program that runs on some computer or server and uses the token to login to discord in order to interact with it like a real user, but with automation. Creating a bot requires knowledge of programming/coding, and you need to build the program that will run the bot

earnest phoenix
#

hey are there any ppl here who cam help me in html stuff ?

elder vine
#

Yes

#

sure

pallid zinc
#

Omg so long msg

earnest phoenix
#

imm

#

@elder vine dm me plz

#

@elder vine

modest maple
#

the double @ xD

quartz kindle
#

post your issue here

earnest phoenix
#

^

#

We can all help you together

#

umm actually we are trying to make our own bot list we need help

#

Oh well

elder vine
#

That's funny.

earnest phoenix
#

@earnest phoenix here's how a bot works:
when you create a bot application in discord, you are basically creating an account for your bot. it gives you a login code known as token, and an url to add your bot to servers.
Now you need to use this token to make your bot login. A bot is a program that runs on some computer or server and uses the token to login to discord in order to interact with it like a real user, but with automation. Creating a bot requires knowledge of programming/coding, and you need to build the program that will run the bot
@quartz kindle how to do that? i have added my bot to my server

elder vine
#

Asking for help in another bot list.

earnest phoenix
#

As long as you don't actually advertise it

#

We can partially help you

tight plinth
#

@earnest phoenix dont ask in a bot list ppl to make another bot list

earnest phoenix
#

i know

tight plinth
#

seems kinda stoopid

earnest phoenix
#

thats why i am not asking them

quartz kindle
#

@earnest phoenix you need to learn programming. pick a beginner-friendly programming language such as javascript or python and look into some basic courses online

earnest phoenix
#

I replace all client with bot and no work

slender thistle
#

So... what's the issue?

barren swallow
#

@earnest phoenix that wasn't the problem

quartz kindle
#

or hire a teacher to teach you

mossy vine
#

hire tim

barren swallow
#

What's your message event

earnest phoenix
#

ok

elder vine
#

I have a program for that @earnest phoenix

earnest phoenix
#

What's the probleme

#

umm can anyone help me make it ? we have codes

#

I want to use a external emoji

barren swallow
#

@earnest phoenix what's your message event

earnest phoenix
#

How can I put a picture of the bot on .setFooter?

elder vine
#

It's under development and might lag on big servers - loading users.

dreamy breach
#

@earnest phoenix First fix your class load.

#

@earnest phoenix
.setFooter("Message", client.user.avatarURL)

slender thistle
#

umm can anyone help me make it ? we have codes
So you need a frontend developer for your botlist

earnest phoenix
#

What's class load ?!

dreamy breach
#

Class is a file of your project. So fix the way you are registering commands.

#

How you are loading commands.

elder vine
#

shivaco, you a frontend dev?

thorny meteor
#

so how do i get messagecontent before /?

earnest phoenix
#

idk

slender thistle
#

Eh... can copy stuff here and there and know how to style most stuff

barren swallow
#

@earnest phoenix what's your message event?

earnest phoenix
#

I have a program for that @earnest phoenix
@elder vine can you send link in dm?

thorny meteor
#

help me pls?

quartz kindle
#

@thorny meteor explain

earnest phoenix
#

it's this ```const Discord = require('discord.js');
const prefix = 's!';
const fs = require("fs");

module.exports = (client, message) => {
if (message.author.bot || message.channel.type === 'dm') { return; }
if (!message.channel.permissionsFor(client.user).has('SEND_MESSAGES')) { return; }
if (!message.content.startsWith(prefix)) { return; }

    let args = message.content.slice(prefix.length).trim().split(/ +/g);
    let commande = args.shift();
    let cmd = client.commands.get(commande);

    if (!cmd) { return; }
        cmd.run(client, message, args);

};```

elder vine
#

Ehh sure.

thorny meteor
#

so how do i get messagecontent before /?

elder vine
#

Let me get a link

quartz kindle
#

@thorny meteor explain better. i dont understand what you mean

#

show examples

thorny meteor
#

input: !test hey/bro
output: hey

elder vine
#

1 sec

barren swallow
#

Now what's the command file @earnest phoenix

quartz kindle
#

.split("/")

thorny meteor
#

i want args as the message content before /

quartz kindle
#

will give you an array of items split by /

#

assuming javascript

thorny meteor
#

.split("/")
@quartz kindle i tried this give messagecontent after /

quartz kindle
#

idk what language you're using

#

then you did it wrong

#

show code

thorny meteor
#

ok

earnest phoenix
#

it's this ```const Discord = require("discord.js");
const botconfig = require("../botconfig.json");
const red = botconfig.red;
const green = botconfig.green;
const orange = botconfig.orange;
const moment = require("moment");
moment.locale("fr");

console.log(Prêt à pendre des commandes Chef !)

module.exports.run = async (bot, message, args, client, user, emojis) => {
const emoji_hear = bot.emojis.find(emoji => emoji.id === "690098366453252126");

    let good = new Discord.RichEmbed()
      .setDescription(`${emoji_hear} test pour hammer `)
      .setColor("GREEN")
      .setFooter(`Merci d'avoir fait appelle au Zelkoa - Faction Shop`)



message.delete().catch(O_o=>{});
message.channel.send(good);

}

module.exports.help = {
name: "test"
}```

thorny meteor
#
  let split = message.content.split('/')```
quartz kindle
#

more code

thorny meteor
#

split[1]

quartz kindle
#

split[1] = second item

#

split[0] = first item

barren swallow
#

@earnest phoenix console.log bot.emojis

thorny meteor
#

first item will be / right?

quartz kindle
#

"a/b".split("/") = ["a","b"]

earnest phoenix
#

? what ?

quartz kindle
#

[0] = "a"
[1] = "b"

thorny meteor
#
    let split = message.content.split('/')
    const test = new Discord.MessageEmbed()
    .setTitle(split[1])
    message.channel.send(test)```
barren swallow
#

In the cmd console.log(bot.emojis)

earnest phoenix
#

ok after ?

barren swallow
#

What does it log in console?

earnest phoenix
#

i startd

#
console.log(bot.emojis)
ReferenceError: bot is not defined
at Object.<anonymous> (/home/container/Commandes/test.js:9:13)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at commandes.forEach (/home/container/index.js:14:28)
at Array.forEach (<anonymous>)```
#

error

elder vine
#

Bruh

quartz kindle
#

@earnest phoenix did you copy all that code from somewhere?

elder vine
#

You need to define bot

#

in a new Client

quartz kindle
#

copying code is not a good idea

earnest phoenix
#

No ? Just in other command in my bot

dreamy breach
#

Don’t lie 😅

quartz kindle
#

because code is very specific, it only works in the exact situation it was mode to work on. if you copy and paste code that was not made specifically for your use case, it will never work

thorny meteor
#

can i remove a certain message from the message content?

quartz kindle
#

yes

thorny meteor
#

whats the syntax?

quartz kindle
#

depends

#

what do you want to remove?

thorny meteor
#

a word

quartz kindle
#

is it always the same word? located anywhere in the message?

earnest phoenix
#

@barren swallow After error ?

thorny meteor
#

yes

quartz kindle
#

.replace("word","")

thorny meteor
#

what will be inside the second quotes?

quartz kindle
#

what to replace with

dreamy breach
#

message.split(‘word’).join(‘ ‘) can be useful for a replace all.

barren swallow
#

@earnest phoenix where is the console.log?

quartz kindle
#

"" = replace with nothing

earnest phoenix
#

where is ? in my cmd

thorny meteor
#

nothing means empty message or whatever that is left after removing the word?

barren swallow
#

The console.log(bot.emojis)

earnest phoenix
#

In my cmd

#

test.js

quartz kindle
#

"abcd".replace("b","") = "acd"
"abcd".replace("b","f") = "afcd"

barren swallow
#

Inside the module.exports.run?

thorny meteor
#

thx

#

let me try ti

#

it^

earnest phoenix
#

no

barren swallow
#

That's why

#

Put it inside the module.exports.run

earnest phoenix
#

Ok no error after ?

barren swallow
#

And what does it log?

earnest phoenix
#

clear.js commande chargée !
Prêt à pendre des commandes Chef !
cmd.js commande chargée !
Prêt à pendre des commandes Chef !
finish.js commande chargée !
help.js commande chargée !
ping.js commande chargée !
Prêt à pendre des commandes Chef !
refus.js commande chargée !
test.js commande chargée !
2 events chargés
ShoP's est en ligne.
this

#

bot.py

import os

import discord
from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

client = discord.Client()

@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')

client.run(TOKEN)

can someone help me?

barren swallow
#

@earnest phoenix are the sure?

#

Run the cmd

earnest phoenix
barren swallow
#

😄

earnest phoenix
#

wtf 😂

barren swallow
#

Ok

spare goblet
#

you're logging an object prolly

barren swallow
#

Then the emoji Id correct?

spare goblet
#

@earnest phoenix top left.

quartz kindle
#

@earnest phoenix thats python code. if you want to make a bot using python, you need to learn python programming

earnest phoenix
#

It's a emoji on other server

barren swallow
#

@earnest phoenix console log emoji_hear

#

@earnest phoenix is the bot in the server?

spare goblet
#

@earnest phoenix it depends on what kind of keyboard u got meowupsidedown

earnest phoenix
#

...no...

barren swallow
#

@earnest phoenix SMH

earnest phoenix
#

"SMH" ?

#
at Object.module.exports.run (/home/container/Commandes/test.js:11:13)
at module.exports (/home/container/Events/message.js:16:17)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:789:20)
(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(). (rejection id: 1)
(node:24) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
barren swallow
#

@earnest phoenix

spare goblet
#

@earnest phoenix
s_dot STOP tagging me.
s_dot You will get a response when someone is available to respond.
s_dot Laptops have varying keys.
s_dot Top left button, under the esc, typically. depends on what keyboard.

barren swallow
#

@earnest phoenix the bot must be in the server

earnest phoenix
#

Ohhh

#

Okai

barren swallow
#

What

modest maple
#

^^

regal saddle
#

iara going wild pepowot

earnest phoenix
barren swallow
#

Ye don't worry, incite the bot to the serve the emojis in and try agaian

golden condor
#

@earnest phoenix looks like either you are logging the "message" object or "guild" object, either way somewhere you are console logging something

elder vine
#

def not a msg

wheat jolt
#

why my progress bar gets crazy

wise quartz
#

How do you loop a command?

#

Or how do you use that look thing

#

Jees my english does somone understand me ?😂

elder vine
#

for

#

Depends the language, but I'm guessing you're talking about js?

wise quartz
#

Python

elder vine
#

Oh

#

Idk for python

wise quartz
#

Oh ty for trying

modest maple
#

@wise quartz You need to use flush on the print statement

#

python doesnt rlly do that kind of progress bar

wise quartz
#

A little more explaination?

modest maple
#

to make it update that one line without printing a new one

#

use in a print statment

#

flush=True

wise quartz
#

I don't think ur understanding my point

modest maple
#

the progress bar can just be done with lines

wise quartz
#

Look lemme explain what i wanna do ok?

modest maple
#

or other Unicode

wise quartz
#

Oh nvm ur helping the other guy

#

Lmao

modest maple
#

ngl thought u were talking about that guy xD

#

my bad

#

what was your issue / what do you wanna do

wise quartz
#

I am doing a countdown command. What should the command do is you give it a number and the bot starts counting down from that number like 10 9 8 7 6... etc

#

So what i am trying to do

#

Is

#

First send the number then edit the message and send the number by -1

#

Then loop that

#

Then i add an if so if the number is 0

modest maple
#

make a talk and asyncio.sleep ig

wise quartz
#

Say finished

modest maple
#

task*

#

make a coro

#

with a loop

#

make a event loop task

wise quartz
#

How? Thats my question

earnest phoenix
#

I have "[object Promise]" how can I convert it to string?

modest maple
#

async def my_loop():
  while True:
      print("i no block pa pa")

async def main():
  asyncio.get_event_loop().create_task(my_loop())
#

example of using loop tasks

earnest phoenix
#

I've been working since the morning I'll go crazy

wise quartz
#

Kinda confuzing

#

Never used loop before

#

But ty i'll try to understand it

elder vine
#

The closest to the bot host

#

Where is the host located?

#

Well, find out where the glitch host you're on is hosted by pinging.

honest perch
#

its hosted on aws

elder vine
#

region

honest perch
#

america most likely

elder vine
#

^
Alessandro

#

Yes.

#

Add new db user

#

and set atlas admin

#

save the password you created there for later

#

now to add ip

honest perch
#

0.0.0.0

elder vine
#

You want to allow access from all locations (0.0.0.0)

honest perch
#

to whitelist all

elder vine
#

Let me see.

#

Should be Network access

#

Go to Network Access

#

add ip address

#

And whitelist all ips

#

0.0.0.0

#

Or click the button that says whitelist all ips or something

honest perch
#

yes

elder vine
#

Yes.

#

Then go to Clusters - and click connect

#

then connect with your application

#

Copy the string

#

connect your application

#

Copy that string

#

and that you will use by mongoose.connect()

#

then mongoose.connect(CONNECT_STRING, { useNewUrlParser: true, useUnifiedTopology: true });

honest perch
#

yes

elder vine
#

yes

#

and change the username:password - to the password that you created in the earlier steps

#

yes

#

change <password> with the password you created in as atlas admin

#

no

#

without

#

Use the string here

#

mongoose.connect(CONNECT_STRING, { useNewUrlParser: true, useUnifiedTopology: true });

#

as the CONNECT_STRING

finite bough
#

also

elder vine
#

and download the npm package

finite bough
#

add log

elder vine
#

npm install mongoose

finite bough
#

mongoose

sullen salmon
#

How do I send a message in DM? It says shit about promises idk how that is I just wanna send somethi ng

sterile minnow
sullen salmon
#

Discord.js btw

elder vine
#

and declare it const mongoose = requrie("mongoose")

#

{member}.send() @sullen salmon

sullen salmon
#

Does it work for users too? @elder vine

elder vine
#

Like message.author.send("hi");

finite bough
#

@sullen salmon define the user

sullen salmon
#

Huh?

finite bough
#

define a user by either mentions or id

#

then just do .send

elder vine
#

Yes.

finite bough
#

like user = message.mentions.user.first();

elder vine
#

You can now make models and start using the database

finite bough
#

user.send('gay')

sullen salmon
#

Hmm it's rejecting probably because no common servers

finite bough
#

they are called schema

elder vine
#

You can't DM them if they're not in a common server, if I'm correct.

#

sure

#

In index.js

#

no.

#

you can make a schema but the mongodb string should be in the main file.

#

like where you're handling stuff.

sullen salmon
#

How do I check for common servers?

ruby warren
#

Discord.js v11 or v12?

sullen salmon
#

Latest

ruby warren
#

Yea

#

I started new project

finite bough
#

@earnest phoenix coz index.js is ur start up file

#

and mongoose has to connect to ur project on startup

elder vine
finite bough
#

nope

#

well

#

if u have a command handler

#

ur index.js reads the command files

#

so they are connected to ur index.js

elder vine
#

You only need it in index.js

finite bough
#

and also connected to mongoose

#

understood?

elder vine
#

Connecting it multiple times will cause errors.

#

It's fine, just connect mongoose in index file

#

No problem.

#

?

#

Use the string you created

#

Login using email and password

finite bough
#

yea what about the dashboard

elder vine
#

No problem

#

Hmm..

#

hm...

#

1 sec

#

const mongoose = require('mongoose');
mongoose.connect(process.env.DBTOKEN, {
useNewUrlParser: true,
useUnifiedTopology: true
});

#

This should work...

#

You should make it in a config.js

#

and

const dotenv = require('dotenv');
dotenv.config();

let config = {
    mongodb: process.env.MONGODB,
}
module.exports = config

#

and use config.mongodb instead

#

idk if it caught it as a string or not..

#

Weird..

quartz kindle
#

where did you put dbtoken?

elder vine
#

What is this then?

quartz kindle
#

how do you load the env file?

#

ah you're using glitch

#

glitch should autoload it

elder vine
#

did you do

#

DBTOKEN=string here

#

const dotenv = require('dotenv');
dotenv.config();

let config = {
mongodb: process.env.MONGODB,
}
module.exports = config

#

paste this

#

and install dotenv module

#

then use
const config = require("./config")
in index.js

#

and:
mongoose.connect(config.mongodb, {
useNewUrlParser: true,
useUnifiedTopology: true
});

golden condor
#

@earnest phoenix you use glitch, yes?

elder vine
#

He does.

golden condor
#

He doesn't need dotenv

zenith terrace
#

owo

golden condor
#

Glitch automatically handles env files

elder vine
#

Well, might be good for deployment to vps etc. later

golden condor
#

I use a dedi and using process.env.PORT works without dotenv

#

Yes

elder vine
#

Don't ask to ask 😛

#

yes

golden condor
#

where

#

What is the code line?

elder vine
#

show me the string (remove password ofc.)

quartz kindle
#

lol

elder vine
#

remove the secret stuff 😛

#

the mongodb string without password

#

Why MONGODB= twice?

#

Looks fine

#

You used the password for the Bot_Discord user that you created inside the atlas?

#

and removed the <>

#

this is mine

#

so it works now?

#

Well, good it works now tho.

#

Np

short siren
#

Hi

golden condor
#

Hewwo

elder vine
#

No, just do your research and it should go fine.

golden condor
#

o

#

How do you find a memory leak/

modest maple
#

look for code thats spawning somthing but never closing it

golden condor
#

Could top.gg server post be doing that

quartz kindle
#

highly doubt it

#

unless you're creating a new DBL in your message event or something stupid

earnest phoenix
#

umm anyone who is pro in html ?

white anvil
#

is anyone here decent at typescript

#

the transpiler is being fucky

golden condor
#

It posts randomly

earnest phoenix
#

umm anyone who is pro in html ?
@earnest phoenix

white anvil
#

im tryna transpile some stuff that doesnt flag errors in ts but the ts generated code does error

#

idk whether that should ever happen

#

or if its better to open an issue on the ts repo

earnest phoenix
#

plz help me

elder vine
#

Help is not asking someone to code your whole website.

earnest phoenix
#

ohk sorry

elder vine
#

You should begin learning yourself html, css, and javascript I KNOW YOU.

#

I don't know, check the error.

earnest phoenix
#

How do I start a new Command?

elder vine
#

Do you use a cmd handler in a folder Aayala?

earnest phoenix
#

no?

elder vine
#

Click it, Alessandro

#

Aayala, how does the current code look like?

#

No.

#

Click on the Botdiscord Alessandro

crimson vapor
#

what are you showing?

elder vine
#

What is that?

#

Go to clusters

#

show more

#

than just the text

#

Do you have issues with it?

#

oh, that might be why

earnest phoenix
#

I posted it

elder vine
#

add another case

crimson vapor
#

gl leny

heavy anchor
#

When i do this the bot keeps repeating itself how can i fix that?

var myGuild = bot.guilds.cache.find(g => g.id == guild_id)
   var logChannel = myGuild.channels.cache.find(c => c.id == channel_id)
   logChannel.send(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`)```
quartz kindle
#

make it ignore bots

#

else it will keep responding to its own messages

golden condor
#

Which guild are you tryna send to, one or all

quartz kindle
#

also, if you have the IDs, you dont need to use .find

#

use .get

golden condor
#

yeah

quartz kindle
#

.get(guild_id)

heavy anchor
#

I want it to log its own messages just not the ones in that channel its posting the logs to

golden condor
#

Ok

zenith terrace
#
let tim = bot.fetchUser('180112943612952577').makeUptime24/7()
if(tim).makeUptime24/7 === true, stayInDevelopmentChat.toHelpPeople;

bot.login(timToken)```
royal portal
#

Hi

quartz kindle
#

@heavy anchor then make it ignore that channel

royal portal
#

my bot crashes when someone DMs it a command

#

it tries checking for a role

golden condor
#
if(message.channel.id === logChannel.id) {
//what you want it to do in that channel 
} 
//rest of the logging of it's own message
}```
royal portal
#

how do I make it ignore the DMs?

golden condor
#

if(message.channel.type === 'dm') return; - discord.js

quartz kindle
#

check for existance of guild, or check for channel type

royal portal
#

alr thanks

zenith terrace
#

I think I made Tim online 24/7 now

quartz kindle
#

.makeUptime24/7() is invalid tho

zenith terrace
#

Shh

#

Its valid now

quartz kindle
#

you're trying to divide makeUptime24 by 7()

#

lul

zenith terrace
#

<_<

#

Dont u dare correct me

#

xD

quartz kindle
#

and you cant name a function as 7 lmao

zenith terrace
#

Shhhhh

quartz kindle
#

lmao

cinder patio
#

I mean technically you can but you can't call it like that ;d

zenith terrace
#
let tim = bot.fetchUser('180112943612952577').makeUptimeForever()
if(tim).makeUptimeForever === true, stayInDevelopmentChat.toHelpPeople;

bot.login(timToken)```
#

Hah

#

Changed

quartz kindle
#

how would you declare it?

#

knowing javascript, there's probably some weird way to get it to work

zenith terrace
#

actually went and did that xD

quartz kindle
#

@zenith terrace your code is still wrong lmao

cinder patio
#

well you'd have to do it in an object / class

quartz kindle
#

fetchUser is a promise

zenith terrace
#

Y u bully ;-;

#
let tim = bot.users.get('180112943612952577').makeUptimeForever()
if(tim).makeUptimeForever === true, stayInDevelopmentChat.toHelpPeople;

bot.login(timToken)```
#

:)

#

Better be right

quartz kindle
#

you actually can declare it as a method lmao

#

just cant call it

zenith terrace
#

istg tim stahp ruining the fun 😂

west spoke
#

n7

quartz kindle
#

lmao

zenith terrace
#

reeee

#

xD

west spoke
#

pfft

grizzled raven
#

[]

quartz kindle
#

you can also attach it to some parent object

grizzled raven
#

tim going way off track

quartz kindle
#

if something piques my interest i become unstoppable

grizzled raven
#

lol i see

heavy anchor
#

Am I just being stupid now the bot is not posting anything

bot.on('message', msg => {
   if (msg.channel.id === 694345224381530172) {
      console.log(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
      var myGuild = bot.guilds.cache.get(g => g.id == 692419586242641925);
      var logChannel = myGuild.channels.cache.get(c => c.id == 694345224381530172);
      logChannel.send(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
   };
});```
grizzled raven
#

7()

quartz kindle
#

@heavy anchor that will make it post only if the messages come from that channel

grizzled raven
#

change the numbers to strings

quartz kindle
#

also ^

#

and get doesnt take a function

#

.get(ID)

valid holly
#

it takes a snowflake

zenith terrace
#

Now I know not to be near tim with joke codes GWmythiBlobLUL

valid holly
#

Tim is very nice

quartz kindle
#

<3

zenith terrace
#

yes but gives you a coding lesson when you are only joking lol

grizzled raven
#
if (tim.isJoking) Nightmarionne.destroy()
quartz kindle
#

lmao

zenith terrace
#

thats tim on so many levels GWmythiBlobLUL

valid holly
#

Well consider yourself lucky cause this server isn't supposed to offer coding support.

quartz kindle
#

do you guys make your bots do anynthing special on april 1st?

pale vessel
#

any ideas?

zenith terrace
#

^

quartz kindle
#

mine trolls people

zenith terrace
#

dad joke bot

#

xD

sudden geyser
#

make a 1% chance to post an "interesting" video instead of the command.

quartz kindle
#

i make it 50%

#

to post a meme

earnest phoenix
#

How do I add another code for a command?

valid holly
#

Mine just plays the same song if anyone queues

zenith terrace
#

Have your bot make it look like its been hacked GWmythiBlobLUL

valid holly
quartz kindle
#

10/10

sudden geyser
#

kind of what youtube did once

zenith terrace
#

Yes

#

Every command sends that

earnest phoenix
#

Uhm

quartz kindle
#

how is your current command coded?

earnest phoenix
quartz kindle
#

a basic way to make multiple commands is like this js if(message.content === "pb!hug") { // do hug command } else if(message.content === "pb!ping") { // do ping command } etc...

zenith terrace
#

etc

quartz kindle
#

if you are gonna make commands that require a user input, like "pb!command something", then you can use message.content.startsWith("pb!command") instead

earnest phoenix
#

I'm trying to get them to ping a user when they are hugged

quartz kindle
#

you want to do like "pb!hug @ user"?

#

then you need to use startsWith

west spoke
#

message.mention[1] hugged message.mention[2]

#

or 0, 1

#

depending on if your language is bad

earnest phoenix
#

Yeah @quartz kindle

mystic violet
#

oh this is bot development

#

sry

wide wharf
#
/home/container $ node bot.js
/home/container/bot.js:1220
client.on("message", (message)) => {
SyntaxError: Unexpected token .
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
```Error... Why it doesn't work??
zenith terrace
#

Why do u have the ) there

#

ur basically ending the event before it even happened

west spoke
zenith terrace
#

dont let Tim see this or he go a wall

#

xD

tight plinth
wide wharf
#

But the error is about the .

tight plinth
#

idc

wide wharf
#

client.on("message", (message)) => {

tight plinth
#

remove it first

wide wharf
#

It's needed:
client.on**("message", (message))** => {

zenith terrace
#

It should be

client.on("message", (message) => {
})```
tight plinth
#

@wide wharf hell no

zenith terrace
#

No

#

Like I said

wide wharf
#

Owh okay

zenith terrace
#

ur ending it before it even started

wide wharf
#

Lemme test...

pale vessel
#

you don't even need the round brackets around message

#

unless 😳 it has more than one argument

modest maple
#

I am part of the Python initiative, we don't believe in the cult of {}

tight plinth
#

doing client.on('message',(message)) => {} is like client.on(), its useless

zenith terrace
#

@modest maple then begone

#

xD

sudden geyser
#

CF8, do you know the way of dictionaries. HyperAI

tight plinth
zenith terrace
#

owo

tight plinth
#

I'll just reuse my message.js event lol

#

with newMessage as message

pale vessel
#

what's it for? logging?

tight plinth
#

?

pale vessel
#

old content

earnest phoenix
#

I need help because I made a bot where they can respond to you when you hug them, and I'm having a difficult time getting said bot to communicate.

#

That's my code

tight plinth
#

watdafuk

#

delete the 2nd one

clear wraith
#

May I ask something??

tight plinth
#

yes u can

earnest phoenix
#

second what?

tight plinth
#

@earnest phoenix client.on('message'

earnest phoenix
#

oh

clear wraith
#

What service do you guys use to keep your bots online?

tight plinth
#

there should be only one

#

@clear wraith I have a vps, so I need nothin to keep it up

earnest phoenix
#

There I did it

tight plinth
#

so now

clear wraith
#

Ok, Well my bot keeps going down.. so im not sure what service to use for it

earnest phoenix
#

?

#

I use terminal

earnest phoenix
#

I am there

tight plinth
#

what u dont understand

earnest phoenix
#

I don't understand how to ping a user when my bot hugs them

tight plinth
#

is ur bot even working

earnest phoenix
#

Yes

#

It only can respond to replaced

tight plinth
#

wait a second

#

whats a shitty bot

#

thats*

earnest phoenix
zenith terrace
#

Why.....

#

You are putting client.on inside of client.on

earnest phoenix
#

?

tight plinth
#
client.on('message', message => {
if (!message.content.startsWith(prefix))
    return;

 

    if (message.content === 'replaced') {
      message.channel.send('why did you say the r word?');
    
      }
      
        else if (message.content === '!pb tickle') {
          message.channel.send('Stop tickling me! *Laughing*.');
        }
        else if (message.content === '!pb hug') {
          // grab the "first" mentioned user from the message
          // this will return a `User` object, just like `message.author`
          const taggedUser = message.mentions.users.first();
        
          message.channel.send(`I'll hug you I guess only because you asked. * hugs: ${taggedUser.username}*`);
        }


});
#

should just be this

earnest phoenix
#

Ok It works but there is a small issue it spams the response

#

What do I do?

zenith terrace
#

which one did it spam

earnest phoenix
#

the tickle

tight plinth
#

ik

earnest phoenix
tight plinth
#

put **return ** before every message.channel.send

heavy anchor
#

this does not work I'm an Idiot idk what I'm doing

bot.on('message', msg => {
   if(msg.channel.id === 694345224381530172) return
   var myGuild = bot.guilds.cache.find(g => g.id == 692419586242641925);
   var logChannel = myGuild.channels.cache.find(c => c.id == 694345224381530172)
   logChannel.send(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
});```
tight plinth
#

@heavy anchor what dont work

zenith terrace
#

U didnt put '' with the IDs

#

<_<

tight plinth
#

a,d they are strings too

#

not actual numbers

#

and doing that will cause ratelimits

#

ur bot will lag af

earnest phoenix
#
  if(command === 'test'){
    const filter = (msg) => msg.author.id === message.author.id        
    message.channel.send('test3').then(() => {
              message.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
                  .then(collected => {
                      message.channel.send(`Test1`);
                  })
                  .catch(collected => {
                      message.channel.send('Test2');
                  });
          });}
#

Why dont work?

tight plinth
#

what dont work

earnest phoenix
#

the boy dont say nothing

tight plinth
#

v11 or v12?

earnest phoenix
#

v11.5/6

tight plinth
#

hm

#

@quartz kindle dont look at here except if you want to become blind

zenith terrace
#

lmao

heavy anchor
#

It keeps Re-posting its own messages from channel it's not supposed to have access to

tight plinth
#

@heavy anchor its logic

pale vessel
#

catch collected lol

quartz kindle
#

its not even that bad?

tight plinth
#

u have to do something if message.author is client.user @heavy anchor

#

sec tim

#

look at this

earnest phoenix
quartz kindle
#

oh lord

earnest phoenix
#

@tight plinth so?

#

Because he's spamming

tight plinth
#

@earnest phoenix it will work yea

earnest phoenix
#

He's still doing it :_:

tight plinth
#

wait

#
return message.channel.send('...')
earnest phoenix
#

Lumap

tight plinth
#

do that for EVERRY message.channel.end

#

@earnest phoenix idk

earnest phoenix
#

:v

tight plinth
#

so basically to fix my music bot I have to go back to discordjs v11 and node v10 mhm

earnest phoenix
#

Do you know how I can get the bot to send its invite link?

tight plinth
#

literally send it

pale vessel
#

copy paste the invite link

earnest phoenix
#

Can someone help me? im tryting to do that a command can only be executed if you have upvote my bot (for example 5 times)

#

Its still spamming 😫 👌

quartz kindle
#

show full code

zenith terrace
#

@quartz kindle wanna rephrase the "not bad"

quartz kindle
#

i though it was about the other code block

#

from another person

zenith terrace
#

thought wrong

earnest phoenix
#

Can someone help me? im tryting to do that a command can only be executed if you have upvote my bot (for example 5 times)
?

#

here's my code

#

@quartz kindle

pale vessel
#

it's a mess

earnest phoenix
#

?

#

I don't get it.

zenith terrace
#

Green = yes
Red = no

elder garnet
#

y does this n0t w0rk

  let content = message.content.split(" ");
  let command = content[5];
  let args = content.slice(1);
  let prefix = config.prefix;

  //checks if message contains a command and runs it
  let commandfile = client.commands.get(command.slice(prefix.length));
  if(commandfile) commandfile.run(client,message,args);

error i get:

node:313856) 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: 8)
(node:313856) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of undefined
tight plinth
#

content

#

text cant be sliced

#

wait no

tired nimbus
elder garnet
#

?

tired nimbus
#

can someone tell me what the difference between these 3 are

elder garnet
#

maybe some more data?

#

idk l o l

grizzled raven
#

do you re-login when your bot disconnects?

pale vessel
#

google?

tired nimbus
#

says its a backup file but I never made a backup file

elder garnet
#

h m

pale vessel
#

console log content

grizzled raven
#

should you relogin when your bot disconnects?

elder garnet
#

nop

pale vessel
#

it should reconnect

earnest phoenix
#

He keeps spamming

#

My bot

elder garnet
#

ctrl+c

#

it stops the bot

#

try to fix it

#

and then run the bot again

earnest phoenix
#

How do I fix it?

elder garnet
#

?

#

show the part

#

lol

#

i gtg now

#

cya

grizzled raven
#

but

#

like

#

so when the bot disconnects, you should just exit the process?

earnest phoenix
#

My bot's code

tight plinth
#

entirely

zenith terrace
#

Wrong one

#

Green = good

#

Red = bad

copper cradle
#

lmao imagine creating one command for each argument

tight plinth
#

^

snow urchin
#

how would I bulkDelete messages while ignoring any boost messages

#
msg.channel.fetchMessages({ limit:  100})
  .then(messages => {
messages.forEach(messag => {
if(messag.type.includes("USER_PREMIUM_GUILD_SUBSCRIPTION")) return;
message.delete()
})
} );

I tried this, but its a bit... slow, and also deleted one of the boost msgs

zenith terrace
#

You can ignore any sort of messages

earnest phoenix
#

I removed the messages

sudden geyser
#

Please don't delete each message one by one.

elder garnet
#
message.delete()

/
|
i think that was supposed to be 'messag' because theres nothing defined as 'message'

snow urchin
#

Ye, i had accidentally added the e

elder garnet
#

ok

earnest phoenix
#

Hello Bois

sudden geyser
#

<Message>.type is a string. Keep an array of the boost types, and filter those. Example:
(fetchedMessages).filter((msg) => msg.type !== "theType")

elder garnet
#

y does that not work?

client.on("message", async message => {
  //a little bit of data parsing/general checks
  if(message.author.bot) return;
  if(message.channel.type === 'dm') return;
  let content = message.content.split(" ");
  let command = content[0];
  let args = content.slice(1);
  let prefix = config.prefix;

  //checks if message contains a command and runs it
  let commandfile = client.commands.get(command.slice(prefix.length));
  if(commandfile) commandfile.run(client,message,args);
})

everything is defined

#

for example the "config.prefix"

#

config is defined

#

and yeah

earnest phoenix
#

I don't have that thing you told me to remove @zenith terrace \

sudden geyser
#

NotSteve do you get an error message.

zenith terrace
#

send ur code then, the updated one

elder garnet
#

nop

#

whenever i try to send

#

a cmd

#

it just doesn't trigger anything

#

i can send source lol

sudden geyser
#

You could try logging each variable to see what doesn't look right. If commandfile is undefined, either the command doesn't exist or the variables you use to get it aren't right.

elder garnet
#

okay

#

undefined?

#

always undefined

#

:/

#

this part is changing it

#

but

#
  let props = require(`./commands/${f}`);
  console.log(`${f} loaded!`);
  client.commands.set(props.help.name, props);
#

this part works but idk if the "client.commands.set" part works

digital ibex
#

what r u tryna do

elder garnet
#
client.commands = new Discord.Collection();

fs.readdir("./commands/", (err, files) => {

  if(err) console.log(err);

  let jsfile = files.filter(f => f.split(".").pop() === "js");
  if(jsfile.length <= 0){
    console.log("Couldn't find commands.");
    return;
  }

jsfile.forEach((f, i) =>{
  let props = require(`./commands/${f}`);
  console.log(`${f} loaded!`);
  client.commands.set(props.help.js.name, props);
  client.commands.set(props.buy.js.name, props);
  client.commands.set(props.bal.js.name, props);
  client.commands.set(props.balance.js.name, props);
});

client.on("message", async message => {
  let content = message.content.split(" ");
  let command = content[0];
  let args = content.slice(1);
  let prefix = config.prefix;

  //checks if message contains a command and runs it
  let commandfile = client.commands.get(command.slice(prefix.length));
  if(commandfile) commandfile.run(client,message,args);
  console.log(commandfile)
})
#

very long

#

but

#

yeah

digital ibex
#

ok

#

but what're you trying to do?

elder garnet
#

i just want it load cmds from other local files

#

for exmple

#

example*

#

o k i h a v e n o e x a m p l e s

#

lol

muted bramble
#

How to display other user's complete activity details?

I could only able to make display Activity name
presence.activities
I want to display it's details like if someone user is playing Visual Studio code then it'll display :-
Playing Visual studio code || Editing index.js || workspace

elder garnet
#

i load files from an local machine folder and then
i check if one of them are typed (part which doesn't work)

#

so yeah

west spoke
#

@muted bramble raw api calls perhaps

muted bramble
#

?

#

Sorry I don't understand

west spoke
#

discord api docs, make a api request through your lib

muted bramble
#

Ah
Actually I have seen discord.js api but I didn't understand
That's why I asked here

slender thistle
#

Is there a way to simplify isNan(a) || isNaN(b) || isNan(x) in js

stark terrace
#

You could turn it into a method @slender thistle

elder vine
#

use function

stark terrace
#

Put all the values in an array and then you can iterate through the array checking if it's a number or not

spare goblet
#

@slender thistle
const arr = [ "a", "b", "c" ]

arr.some(s => isNaN(s))

stark terrace
#

Exactly

slender thistle
#

I don't think creating a function for one-time check is efficient

spare goblet
#

I answered in off-topic but you removed the message insteantly

slender thistle
#

Because it was a dev question and I am a good bean nekopeek

spare goblet
#

iara_rollonthefloor_rolypoly i think that's the only way

elder vine
#

how ya become a library dev?

earnest phoenix
#

d

spare goblet
#

by being a recognised dev for a lib

slender thistle
#

Oh, .some returns a boolean
that's even better, ty Yay

spare goblet
#

yeah it does xD

#

np shivu veryfastpats

clear wraith
spare goblet
#

your file is not a database.