#development

1 messages · Page 567 of 1

wide ruin
#

SyntaxError: Invalid or 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:657:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19)

#

thats the problem

mossy vine
#

obviously its a problem with your code then

wide ruin
#

vscode has no issues detected

mossy vine
#

did you save the file

wide ruin
#

yes

quartz kindle
#

vscode by itself doesnt run javascript files, so run active file doesnt work

#

you have to run it using node

wide ruin
#

ok

quartz kindle
#

you can do that in vcs's own terminal if you have node installed proiperly, i sent you a link yesterday about it, did you read it?

wide ruin
#

yes i did

#

it says C:\Users\\Downloads\INFINITYHelper>

#

what do i put?

quartz kindle
#

is that where your file is saved?

wide ruin
#

yes

quartz kindle
#

if so, type node yourfilehere.js

wide ruin
#

so like node server.js

quartz kindle
#

yeah

wide ruin
#

(function (exports, require, module, __filename, __dirname) { ��

quartz kindle
#

wut

#

show picture

wide ruin
#
(function (exports, require, module, __filename, __dirname) { ��
                                                              ^

SyntaxError: Invalid or 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:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)```
#

thats the full thing

inner jewel
#

your file is corrupted

quartz kindle
#

or file encoding is wrong

inner jewel
#

you may have a zws or something at the beginning

wide ruin
#

its UTF-16 BE

quartz kindle
#

try creating a new file, doing something simple like console.log("test")

inner jewel
#

try utf-8

wide ruin
#

different error

#

with normal code now

#

thanks for help

#

its just already declared, so a regular code error

dusky steeple
#

could someone tell me what I am doing wrong here:

if (guildSettings.leaveEnabled === 'true') {
        if (client.user.bot) {
            return;
        } else {
            const leaveembed = new Discord.RichEmbed()
                leaveembed.setColor('RED')
                leaveembed.setAuthor('Member Left', member.user.displayAvatarURL)
                leaveembed.setThumbnail(member.user.displayAvatarURL)
                leaveembed.setDescription(leaveMessage)
                leaveembed.setTimestamp()
                leaveembed.setFooter(`Member Count: ${member.guild.members.size}`, client.user.displayAvatarURL);
            if (member.guild.channels.find('name', guildSettings.leaveChannel)) {
                member.guild.channels.find('name', guildSettings.leaveChannel).send({embed: leaveembed}).catch((e) => client.log('log', `Unable to send message to leaveChannel (${guildSettings.leaveChannel}) on ${member.guild.name} (${member.guild.id}): \n ${e}`, 'Error'));
            }
        }
    }

I am trying to make my bot not reconize when another bot joins or leaves the server.

ruby dust
#

tip: color your code by adding js at the beginning of the code block for easier readability

earnest phoenix
#

How can I make a command that shows me a list of the servers that my bot is in

ruby dust
#

what language

earnest phoenix
#

Discord.js

ruby dust
#

I can't check right now, but the client object should have a collection of cached server objects

earnest phoenix
#

I cant find anything online

ruby dust
#

google discord.js documentation

#

I can't open my browser and check it for you cause I'm installing a VM with my poor CPU that can't handle basic multitasking

dusky steeple
#

Ty I updated the code

ruby dust
#

what is the error you are getting

dusky steeple
#

not getting any

earnest phoenix
#

I read on servers but gave me info on how to catch data from a server and not catch all servers

dusky steeple
#

it either disables the messages for everyone or doesn't detect the bot

ruby dust
#

so it doesn't startup?

dusky steeple
#

yes it starts fine and runs

ruby dust
#

er, ok

dusky steeple
#

the way I have it in the code right now. I invite a bot it doesnt send the message. But if a non bot user joins it doesnt send the message

languid dragon
dusky steeple
#

B

languid dragon
#

Why?

ruby dust
#

depends, why you need it for

dusky steeple
#

It looks more professional to me

languid dragon
#

one pager site

ruby dust
#

A then

languid dragon
#

yeah I agree, thanks

dusky steeple
#

heh I thought it was for a footer or something else

languid dragon
dusky steeple
#

that way looks better then. matches the other links

quartz kindle
#

@dusky steeple if (client.user.bot) {

#

you're checking if your own bot is a bot

#

instead of the user who joined

dusky steeple
#

hmm lol

#

Thank you @quartz kindle can't believe it was something that stupid I was over looking.

quartz kindle
#

👍

daring trellis
#

How send message in gmail through node.js module, emailnode?

#

I'm very very noob

#

)

quartz kindle
#

link? i cant find any module called emailnode

daring trellis
#

Lol

#

Thats strange

amber fractal
#

Do you mean nodemailer?

daring trellis
#

Yes

quartz kindle
daring trellis
lofty hamlet
#

How to remove all the reactions of a message? it is possible ?

quartz kindle
#

is that a yes?

#

lmao

lofty hamlet
#

Me ? @quartz kindle

quartz kindle
lofty hamlet
#

🤔

#

I do not understand

#

@quartz kindle

#

I want remove all reaction of a message

wide ruin
#

So I use a command handler for different files

#

Main is server.js

#

One I need is commands/eval.js

#

Is it possible to eval something into an array in serverjs?

bright spear
#

@lofty hamlet yes, Tim sent the link to the docs for it

lofty hamlet
#

I read but i do not understand

wide ruin
#

@lofty hamlet

#

.clearReactions()

lofty hamlet
#

Yes but it does not work

#

I'm going to sleep I'm coming back tomorrow

quartz kindle
#

@wide ruin its possible yes, but its kind of a hacky way to do it. its better to use module.exports

earnest phoenix
#

is there a new word used for tags or is this just wrong?

smoky spire
#

is wUser actually a user

quartz kindle
#

discriminator is the numbers after the username

marble needle
#

If your lib doesn’t have a designated ‚tag‘ string you can just combine the username with a # and their discriminator, gets you the same thing

sick cloud
#

eris is the only one without it, but you can add it easily

#
const { User } = require('eris');

Object.defineProperty(User.prototype, 'tag', {
    get() { return `${this.username}#${this.discriminator}` }
});
earnest phoenix
inner jewel
#

because your code is wrong

earnest phoenix
#

ok

#

what wrong with it ?

#

guilds is a collection of guilds, not a single one

unique iron
#

Can you even make that possible? I thought that a discord user only has 1 status message

lusty dew
sick cloud
#

client.users.size

lusty dew
#

That is in a SSH terminal

earnest phoenix
#

what can you make possible

unique iron
#

Nvm lol

#

Me stupid

earnest phoenix
#

🤷

unique iron
#

Coo!

golden raven
#

How can i make the bot do what the bottom one does? (js)

harsh nova
#

With codez

night imp
#

@golden raven what language

golden raven
#

js

night imp
hushed berry
#

@earnest phoenix just wanted to say that it's a really bad idea to update the presence on every guildCreate event

amber fractal
#

you should use a set delay

celest latch
#

Hey!

#

Quick question, I am using discord.py and I have seen some people allow commands to fall back on the help command i cant seem to use this in my bots does anyone have suggestions or a direction to run in?

earnest phoenix
#

@hushed berry why ?

sick cloud
#

@celest latch what do you mean fall back

celest latch
#

like if they dont use the command properly. rn the command just fails and says nothing

#

ideally id like it to fall back to the help of that command

hushed berry
#

@earnest phoenix If you join servers too quick, it'll violate the limit

#

Also, it's fairly common for Discord to send guild create events

#

like

#

really common

#

for guilds that you're already in

#

all at once

sick cloud
#

check if they dont use it right

#

and if its not right then send it

celest latch
#

right, do I need to personally write each help command out or is there a simpler way to do it?

sick cloud
#

depends on your system

#

all my help and stuff is in one file and i just query it from there, but you can do other

celest latch
#

gotcha. Lastly how do I get the bot developer role?

hushed berry
#

submit a bot and successfully get it verified ^^

celest latch
#

Gotcha!

#

Thanks

hushed berry
#

you seem competent so i dont think youll have any trouble doing that 😊

lusty dew
#

ERROR: (gcloud.compute.scp) Source(s) must be remote when destination is local. Got sources: [C:\Users\Aj\Desktop\Link], destination: dr-anderson-011929
Can someone explain this? I am using google cloud

bright marsh
#

Can someone help me make a help guild

#

ping me

#

or dm

keen drift
#

what

bright marsh
#

I need help making a list of all the commands I have for my bot

errant ocean
#

What

dawn orchid
#

How to get my dbl bot's token

nova atlas
#

anyone use digital ocean for their host ( i need help setting up mines)

#

@ me

bright marsh
#

how to I make a command list pop up when I put in. my prefix and then help

#

Like I just need to look at some coding in discord.js

gilded idol
#

ik this isnt the appropiate channel

#

but can someone just tell me how to see how many servers my bot is in

#

im in js

#

have no idea how api works at all

#

so confused

coral trellis
#

You want to post your bots guild count on the website?

gilded idol
#

yes

#

please

bright marsh
#

Same

gilded idol
#

im dumb and cant code

#

make it simplified in dumb people terms please

coral trellis
#

Right so you did it in DBM

bright marsh
#

well not that far

coral trellis
#

Correct?

gilded idol
#

yes.....

scarlet bane
#

@hushed berry dont mean to be rude or sound like a smartass but, popular libraries need to enforce/maintain ratelimits, you shouldn't violate any limits even if you do try to do the same thing really fast many times. But yeah its not a good idea to either way. Just wanted to clarify that it wont actually "violate a limit" if you're using a proper library

coral trellis
#

I suggest you ask in the servers as there should be someone there to help you

gilded idol
#

theyre dead

coral trellis
#

Well thats kind of the only place you will be able to get help

scarlet bane
#

We can't really help you here, we kinda program here :<

gilded idol
#

yeah i assumed

#

this wasnt the place but maybe

#

someone who knew dbm was here

scarlet bane
#

You'll have better luck in the dbm server, even if it takes them a while to respond.

gilded idol
#

yeah

#

i kinda wish it was bigger

#

not enough people know about it

#

like

coral trellis
#

Which server are you in PPepoCIA

gilded idol
#

the main one

coral trellis
#

Last time I was there, There were about 6000 members or smth

gilded idol
#

nobody helps each other

#

its just a group of like a handful of mods

coral trellis
#

Eh thats just the community PPepoWeird

gilded idol
#

everyone else just shitposts

#

like

#

this server you can get help from about anyone

coral trellis
#

However the majority don't use DBM

gilded idol
#

yep

coral trellis
#

Can you invite me to the main guild in DM's please

gilded idol
#

majority actually have attention span and can sit down and learn a language

#

wait

#

huh?

coral trellis
#

To the DBM official server

gilded idol
#

sure

#

oh shoot just got help

coral trellis
#

Noice, Could you still shoot me the invite, I wanna pop back in

gilded idol
#

i cant inv

#

im disabled

coral trellis
#

I see, I'll find one somewhere

lofty hamlet
#

@quartz kindle i'm back so you can help me for .clearReactions() (plz) ?

quartz kindle
#

what didnt you understand from the docs?

lofty hamlet
#

.clearReactions()

#

...

quartz kindle
#

yeah but what part didnt you understand?

lofty hamlet
#

I just want to remove all the reactions of an embed how should I do?

quartz kindle
#

the docs say it lol

lofty hamlet
#

.... but i do not understand

quartz kindle
#

what dont you understand?

lofty hamlet
quartz kindle
lofty hamlet
#

...

quartz kindle
lofty hamlet
#

?

quartz kindle
lofty hamlet
#

😂

#

how ....

quartz kindle
lofty hamlet
#

newEmbed.clearReactions() ?

#

But it not works

quartz kindle
#

message.clearReactions()

lofty hamlet
#

Yes i know but is not works

#

newEmbed.clearReactions()

quartz kindle
#

you need to get the correct message

lofty hamlet
#

🤔

quartz kindle
lofty hamlet
#

?

quartz kindle
#

newembed is not a message, its just an embed

#

message is a message

#

then you edit it, and the .then() creates a new name for the message

burnt birch
#

how to add halpo and halpie in my server?

quartz kindle
#

you named it newMsg

lofty hamlet
#

Hum okayyy so newMsg.clearReactions()

quartz kindle
#

so newMsg is the message after it was edited

lofty hamlet
#

I go test thanks

burnt birch
#

how to invite halpo and halpie in my server

quartz kindle
#

@burnt birch go to the website, and click invite

burnt birch
#

there was no halpo nor halpie

#

i check again

quartz kindle
#

then they are not on this website

burnt birch
#

i ts say no bots found

quartz kindle
#

yeah they are not on the website. where did you find these bots?

burnt birch
#

in discord bots

#

.com

quartz kindle
#

then go there

lofty hamlet
#

@quartz kindle he not work

quartz kindle
lofty hamlet
#

I not understand this clearreactions

rustic walrus
#

guys how to make a shop

burnt birch
#

yeah i searched there only

rustic walrus
#

like, I have a coin system if they react on this, they will have this and their coins will be deducted

quartz kindle
#

do you have a database?

burnt birch
#

its not there

#

what database

quartz kindle
#

im talking to phonetic

burnt birch
#

oh sorry

quartz kindle
#

you need to look for them elsewhere

burnt birch
#

oh ok

quartz kindle
#

try other websites or ask servers who have them

rustic walrus
#

Tim I have json file

burnt birch
#

do u know how to make a dyno a welcomer and a leaver

lofty hamlet
#

where i can add this clearReactions() @quartz kindle ? oO

rustic walrus
#

@burnt birch at their own website

quartz kindle
#

you mean using the dyno bot?

burnt birch
#

yes

quartz kindle
#

check their website, they have all the instructions there

carmine echo
#

Quick stupid question. Can guild, user, channel or role ids match?

quartz kindle
#

@carmine echo no, all IDs are unique afaik

carmine echo
#

Ok epic thanks

rustic walrus
#

Tim can you help me out??

quartz kindle
#

you have a json database right? so you can just use it

rustic walrus
#

ye

burnt birch
#

@quartz kindle where is the website

quartz kindle
#

nebulus show the code you tried

#

@rustic walrus what part of your shop have you already done? is the coin system working? is the reaction working?

rustic walrus
#

I haven't made it yet

#

let me

lofty hamlet
quartz kindle
#

below line 39? 🤔

#

there is no newMsg there

#

newMsg exists only inside the .then() block you created

earnest phoenix
#

🙀

lofty hamlet
#

Hum yes but...

burnt birch
#

@quartz kindle i didnt got much from that website

quartz kindle
#

it has everything you need

#

you just need to understand it

lofty hamlet
#

Where i can added this line ? tim

quartz kindle
#

inside the .then() block

lofty hamlet
#

Yes but where ...

quartz kindle
#

anywhere...

lofty hamlet
#

Is not work

#

Where in r.message.edit(newEmbed) .then(newMsg => console.log(`new embed added`)) .catch(console.log); });

quartz kindle
#

inside the then() block

lofty hamlet
#

....

quartz kindle
#

show me what you tried

lofty hamlet
#

It work xuse me i'm so stupid oO

quartz kindle
#

@_@

lofty hamlet
#

😂

lofty hamlet
#

@quartz kindle for includ is for example : if (Dresseur.BDDTitre.content("Adorateur de Pokémons")) and for not include what is it ? : if (!Dresseur.BDDTitre.content("Adorateur de Pokémons")) ?

quartz kindle
#

nope

#

is BDDTitre a string or an array?

lofty hamlet
#

Array

quartz kindle
#

so its .includes("")

lofty hamlet
#

for include if (Dresseur.BDDTitre.content("Adorateur de Pokémons")) works but for not include if (Dresseur.BDDTitre.content("Adorateur de Pokémons")) not works

#

yes but for not include just add ! ? but is not works

quartz kindle
#

yes

lofty hamlet
#

.... strange

quartz kindle
#

array.includes("")
!array.includes("")

#

is correct

lofty hamlet
#

Ok thanks Even if it does not work strange 🤔

quartz kindle
#

show code

lofty hamlet
#

I go searsh

#

My code is true ...

#
                        if (!Dresseur.BDDTitre.content("Adorateur de Pokémons")) {
                            Dresseur.GradeG = "Adorateur de Pokémons"
                            Dresseur.BDDTitre.push("Adorateur de Pokémons")
                            message.channel.send('__Vous avez capturé 100 Pokémons et vous avez terminé la quête unique 1, vous gagnez le titre : Adorateur de Pokémons__ (?settitre | Pour définir un de vos titres)')
                        }
                    }```
quartz kindle
#

as i said before

#

its .includes

#

not .content

lofty hamlet
#

Uh ok i'm stupid today bloblul

#

Not works 🤔

quartz kindle
#

show code >.>

lofty hamlet
#

Not i'm so stupid ! 😢

#

Xuse me again

quartz kindle
#

@_@

earnest phoenix
#

In my serverinfo when there are more than 20 roles I would like it to mark "too many roles" how to do it?

#

Because right now I have a 1024 characters error in my console

quartz kindle
#

check if there are more than 20 roles

earnest phoenix
#

But in the embed I don't know how to do it

quartz kindle
#

d.js?

earnest phoenix
#

Yes

quartz kindle
#

if you want to check it inside the embed generator, you can use a ternary operator

earnest phoenix
#

?

#

ternary operator?

quartz kindle
#

(roles.size > 20 ? "too many roles" : roles)

#

its the same as an if, but returns the result

earnest phoenix
#

Thx

wide ruin
#

how would one use .permissionOverwrites?

#
 setTimeout(() => {
        let channel = split[1]
        channel.permissionOverwrites
        channel.send('<@&522791520533741596>')
    }, ms(split[0]))```
#

its a channel id

earnest phoenix
#
.addField("Nombre de roles", message.guild.roles.size + "\n" + message.guild.roles.map((r) => r).join(' '))
(messages.guild.roles.size > 20 ? "Trop de rôles" : roles)```
#

?

quartz kindle
#
.addField("Nombre de roles", (question ? result-if-true : result-if-false))```
earnest phoenix
#

Thx

wide ruin
#

how is channel.permissionOverwrites used?

quartz kindle
#

permissionOverwrites returns the list of overwrites

wide ruin
#

so, if i want @everyone to read messages

quartz kindle
#

if you want to create a new overwrite, you can use .replacePermissionOverwrites()

wide ruin
#

ok

quartz kindle
#

im not sure if you can replace the everyone role tho

wide ruin
#

would that be the default?

grim aspen
#

is it alright if i put a picture of my code here?

quartz kindle
#

yes its alright

grim aspen
#

because the fucking plugin crashed an i give up

wide ruin
#

@quartz kindle i found this:

#

.permissionsFor(memberOrRole)

quartz kindle
#

this is to check if permission exists

wide ruin
#

ah ok

grim aspen
wide ruin
#
channel.replacePermissionOverwrites({
overwrites: [
  {
     id: message.author.id,
     denied: ['VIEW_CHANNEL'],
  },
],
  reason: 'Needed to change permissions'
});```
#

would i change denied for allowed?

quartz kindle
#

yes, you can check the docs for more details

#

also

#

that will replace all permissions

#

@grim aspen i've never used repl.it so i wouldnt know

#

you're trying to run index.js right?

#

can i see its contents?

grim aspen
#

no🇩ejs

amber fractal
#

Can you host on repl?

grim aspen
#

keyboar's broken

#

i can connect my bot that way

quartz kindle
#

i mean

#

you have two files in there

#

index.js and server.js

#

which one are you running?

grim aspen
#

index.js, it's trying to acquire server.js

#

here, let me convert this to github

quartz kindle
#

well its either a problem with repl.it or your code is causing a crash

#

thats why show code

clever wave
#

Hi

quartz kindle
#

hi

wide ruin
#
setTimeout(() => {
            let channel = split[1]
            channel.replacePermissionOverwrites({
                overwrites: [
                {
                    id: message.author.id,
                    allowed: ['VIEW_CHANNEL'],
                },
                ],
                reason: 'Released puzzle'
                });
            channel.send('<@&522791520533741596>')
        }, ms(split[0]))   ```
#
TypeError: channel.replacePermissionOverwrites is not a function
    at Timeout.setTimeout [as _onTimeout] (C:\Users\\Downloads\INFINITYHelper\commands\release.js:16:21)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)```
quartz kindle
#

channel must be the channel object

#

what is split[1]? the channel id?

wide ruin
#

yes

quartz kindle
#

so you must get the channel object

wide ruin
#

you do >release time|channel id

quartz kindle
#

client.channels.get(id)

wide ruin
#

let channel = client.channels.get(split[1])

#

like that?

quartz kindle
#

yes

wide ruin
#

thanks

grim aspen
#

screw nodejs, i'm going to use python

harsh nova
#

Why

amber fractal
#

repl isnt really a host tho

wide ruin
#

@quartz kindle

#

TypeError: Cannot read property 'replacePermissionOverwrites' of undefined

#
let channel = client.channels.get(split[1])
            channel.replacePermissionOverwrites({
                overwrites: [
                {
                    id: message.author.id,
                    allowed: ['VIEW_CHANNEL'],
                },
                ],
                reason: 'Released puzzle'
                });
            channel.send('<@&522791520533741596>')```
earnest phoenix
wide ruin
#

🤦

earnest phoenix
#

?

quartz kindle
#

we cant afaik

wide ruin
#

ages

earnest phoenix
#

Selfbot?

quartz kindle
#

thats probably a self bot

earnest phoenix
#

Yes

#

Wait

grim aspen
#

nvm the server's being shitty on the website

wide ruin
#

oh, didnt realise its a normal account

earnest phoenix
#

Okay

quartz kindle
#

@wide ruin channel id is wrong

grim aspen
#

@quartz kindle server's at the website i'm using are down

#

explains why

quartz kindle
#

i see

earnest phoenix
#

Don't say I told you that.
The code prompt: Xvr5XPx

#

Join

wide ruin
#

@quartz kindle it is correct

#

shows here

earnest phoenix
#

#deleted-channel

#

Lol

wide ruin
#

youre not in the server

earnest phoenix
#

Yes

wide ruin
earnest phoenix
#

Okay

#

Tim?

amber fractal
#

I use await for things like that

earnest phoenix
#

Or Moderator?

#

Okay

#

If there is a moderator, I would like him to come in privately

amber fractal
#

Thats something that you should report to discord staff aswell

earnest phoenix
#

I don't know how to tell them because on Twitter they don't answer

amber fractal
quartz kindle
#

@wide ruin try this js let channel = client.channels.get(split[1]); console.log(channel)

#

and see what comes up in your console

amber fractal
#

Yea selfbot

ruby dust
#

ban them, report them

#

nothing to see there

earnest phoenix
#

Okay

#

Thx Rudyard

amber fractal
#

iirc when deleting messages sent by someone else you can auto report to t&s cant you?

slender thistle
#

I actually wonder how that thing works

#

Because they usually tell you that once a message is deleted, it's gone forever

amber fractal
#

Thats literally what they say on the report

slender thistle
#

Yep

harsh nova
#

Well, messages have a tag called “deleted”. I think if you copied the I’d they can still get it

slender thistle
#

Reported. Message IDs included. Same thing

harsh nova
#

Ye

ruby dust
#

a while ago when ddevs was still active, they told me that they keep deleted objects for the next 90 days

harsh nova
#

Cool

slender thistle
#

That explains it, thanks

wide ruin
#

@quartz kindle undefined

#

"let channel = client.channels.get(split[1]);
console.log(channel)"

#

i did eval on that

#

with a channel id instead of split[1]

#

as a string

quartz kindle
#

well, undefined means the channel was not found

wide ruin
#

its copied from the channel

#

the bot has access

#

so, to start the bot i type node server.js

#

is there a way to add a command that restarts it for me?

quartz kindle
#

use a process manager such as pm2, or a script that auto-restarts it if it quits

#

then you can just make a command that shuts it down, and it will be auto-restarted

#

or make the bot call an external restart script

slim heart
#

What would be the simplest way to combine messages sent within like a minute of each other or something and then combine them to one string idk

inner jewel
#

messageA + "\n" + messageB

wide ruin
#

@quartz kindle like what?

#

im confused

quartz kindle
#

@wide ruin to quit the process, you can use process.exit()

#

if you have a process manager, it will restart it automatically, you dont need to do anything else

wide ruin
#

how do i get a process manager?

quartz kindle
#

if you dont want to use a process manager, then you need to create a script that kills the process and restarts it

wide ruin
#

which is easier?

quartz kindle
#

i use pm2

#

its a process manager for node

slim heart
#

Yasmin I mean receiving messages from other users

#

Like 5 or something separate messages sent by another user then combine them into one string

quartz kindle
#

use fetchMessages() ?

slim heart
#

But like I wanna receive them in time I guess?

#

Is there a way to make a message collector like how reactionCollector is

quartz kindle
#

then use a message collector

slim heart
#

Is that a thing?

quartz kindle
#

assuming you're using d.js

#

Advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management, at a glance.

slim heart
#

Oh I was looking at guildchannel lol

#

I’m smart zoomeyes

#

So and filter I would do like filter: {author: Author} ?

#

Oh wait nvrm the collector thing

steep hatch
#

söyle

#

bir vakit gelicek ki

#

buralar

#

bir sessiz olacak

#

ama

#

ne zaman

#

inş ben öldükten sonradır

quartz kindle
slim heart
#

Is there a way to break the collector? Like on('collect',a=>{if(a.whatever Boolean) break;})

#

Obviously that doesn’t work but can I break the rest of the collection if something

inner jewel
#

.stop()?

quartz kindle
#

^

earnest phoenix
#

can someone tel me how to start the bot in heroku i dont have the worker addon and i cant find it and it dosent want to start and for some reasosn someone keeps entering my bot and sending and mentioning everyone and sending in dms stuff cz i put it on github or heroku am not sure

quartz kindle
#

thats because you made your token public

#

your token is your bot's password, you have to keep it safe

harsh nova
#

Refresh token at once

#

Go into discord developer portal and refresh it

earnest phoenix
#

@quartz kindle ol

ruby dust
#

just so you know, heroku is not as free as paying for a virtual private server, you pay them with your nerves and precious time

earnest phoenix
#

ik and i keep doing it

quartz kindle
#

also, put it in a file and make github ignore that file
and go into your heroku settings and make your project private

earnest phoenix
#

i just refreshed it

#

i want other people to use it

#

will they be able to use it after that ?

ruby dust
#

they don't need access to your files

earnest phoenix
#

tru

ruby dust
#

they just need to be able to add it to their servers

earnest phoenix
#

could u come call and i show u and u help me ?

#

:d

ruby dust
#

I don't dm with randoms

earnest phoenix
#

oh ok

#

so i should upload a file not like that ?

#

also how do i make github ignore it

ruby dust
#

heroku is just not a good place in general, it will be a lot easier to just pay $3 per month for a real server

earnest phoenix
#

hard for me broosky :d

ruby dust
#

ignoring a file means putting the file's path inside the .gitignore file

quartz kindle
earnest phoenix
#

wait what

#

@quartz kindle ill check that ty

#

an idiots

#

lmaoo

quartz kindle
#

read the warning block right at the beginning of that guide

earnest phoenix
#

i did

quartz kindle
#

it tells you how to keep your token safe

#

and how to create a gitignore file

earnest phoenix
#

okay

#

??

quartz kindle
#

git is a software that needs to be installed in your system

earnest phoenix
#

oooh

#

wait fr

#

ok

#

which one ?

mossy vine
#

do you speak english? "Choosing the default editor used by Git"

earnest phoenix
#

there is use visual studio code thought it would be this one

#

😃

#

and yea i do speak english as my second language i mean u understand me

#

u dont need to act smart fam

mossy vine
#

i mean

#

you can literally just read what it says

quartz kindle
#

just chose notepad and be done with it

mossy vine
#

and understand it

earnest phoenix
#

ight

#

okay bro

#

i dont want to miss up smth

mossy vine
#

doesnt matter tbh, you can use the second option

earnest phoenix
#

okay ty

#

btw u use js ?

#

java i mean

quartz kindle
#

js =/= java

earnest phoenix
#

yea

#

:d

#

there is a code i dont understand

quartz kindle
#

java is different

#

js is javascript

earnest phoenix
#

oh

#

yea i mean js lmao

quartz kindle
#

=/= means not equal

#

so js is not the same as java

earnest phoenix
#

okay

#

which one u use or know

quartz kindle
#

i use javascript

earnest phoenix
quartz kindle
#

its a class extension

#

its more advanced js

earnest phoenix
#

okay

#

is there other ways i can use it ?

quartz kindle
#

there are always alternatives

earnest phoenix
#

no i mean

quartz kindle
#

but if you're using commando, just keep using the way its supposed t

earnest phoenix
#

to make timer bot and other commands for fun

quartz kindle
#

if you're new to the language and want to understand what you're doing, its much better do not use commando

earnest phoenix
#

the guy am watching uses it

#

soo idk

#

is there easier ways ?

quartz kindle
#

you can make your own command handler, its much simpler to understand

earnest phoenix
#

ok could u send me a link to a video ?

#

cz am trying t omake my bot better and learn js

harsh nova
#

Just search

#

I think anidiotsguide had a guide

quartz kindle
#

its still a bit advanced tho, you could start with something even simpler

#

like a single file bot

earnest phoenix
#

okay

#

i need a tutorial btww 😄

quartz kindle
earnest phoenix
#

okay

#

ty

empty steppe
#

discord.py
I have an issue with "discord.on_reaction_remove(reaction, user)":
Parameters:
reaction – A Reaction showing the current state of the reaction.
user – A User or Member of the user who removed the reaction.

However, for me, if the bot (client) removes a reaction, the user parameter will not be the client.user but the reaction.message.author (the user who originally added the reaction).
Is this behaviour intended? And is there a way to get the user who actually removed the reaction?

earnest phoenix
mossy vine
#

@earnest phoenix please learn javascript properly first

#

before jumping into this

#

there are also other resources pinned in this channel

earnest phoenix
#

am only doing this for securing my token tho

#

:d

quartz kindle
#

thats a very basic example of a discord.js bot

#

you can start there and elaborate on it

harsh nova
#

A case switch would be less cluttered

quartz kindle
#

yes but a bunch of ifs are easier to understand for beginners

harsh nova
#

True

earnest phoenix
#

okay

quartz kindle
#

@empty steppe no idea, it seems like a bug

harsh nova
#

Well anyways gl with your coding

quartz kindle
#

you can try asking in the discord.py support server

#

if there is one

earnest phoenix
#

if anyone could send me a video of a tutorial an easy one to make my bot

#

:p

#

that dosent use commando since its hard

harsh nova
#

Just google

empty steppe
#

@quartz kindle okay, i think I will open an issue. Do you know of a way to determine if a user or the bot deleted a reaction?

quartz kindle
#

i dont know much about discord.py but the user object should contain the user of whoever deleted the reaction

empty steppe
#

yeah then its definitely a bug, thanks!

earnest phoenix
#

@harsh nova okay but i was watching this guy but he uses commando apparently its advanced

#

so ill see someone else and ill see how to secure my thing

mossy vine
#

@earnest phoenix if you only care about securing your token:

  1. make a json file containing the token
  2. do not fucking share that file
earnest phoenix
#

lmao then how do i upload it to freaking github

#

so i can use heroku

mossy vine
#

i have never used heroku, does it work with private repos

earnest phoenix
#

i think no i never tried

#

it needs to be payed

#

and its expensive i think

#

llol

#

and i dont upload hten how its goign to work 😄

#

without the token

mossy vine
#

dude

#

github private repos are free

harsh nova
#

That is valid json yes

earnest phoenix
#

yea i mean heroku

#

😄

#

i got what to do now

mossy vine
#

solution: dont use heroku as its dumb as fuck

earnest phoenix
#

ill make the github ignore the file

#

and it will work

#

give me another free hot then

#

host

mossy vine
earnest phoenix
#

idc

#

ill just do it for now bro

#

if glitch is better than heroku

#

ok

mossy vine
#

???

earnest phoenix
#

it will make it private haha

inner jewel
#

no need to make it private

earnest phoenix
#

yess ty

inner jewel
#

you shouldn't ever add tokens, keys, passwords, etc to a git repo

earnest phoenix
#

then how is it going to work 🤔

#

excuse me if am retarded 😄

mossy vine
#

the post literally tells you yo

earnest phoenix
#

ok

quartz kindle
#

@earnest phoenix

  1. upload your bot to github, but dont upload the token file.
  2. upload to heroku from github
  3. manually add the token file to heroku, but not to github
#

simple enough

earnest phoenix
#

so i dont type the token to index.js

#

ok

#

so i remove the bot.login with the token from index.js and put it in the config.json

ruby dust
#

Is there a way to tell how many messages are there in a channel without fetching all messages?

earnest phoenix
quartz kindle
#

you're doing somehting wrong

#

its should be like this:

earnest phoenix
#

it is tho

quartz kindle
#

json file: ```js
{
"token":"your token here"
}


index.js file: ```js
    const jsonfile = require("./jsonfile.json")
    client.login(jsonfile.token)
earnest phoenix
#

the last one i mean

quartz kindle
#

no, its just an example

earnest phoenix
#

ohhh

#

OH YEA AM RETARDED

#

😄

quartz kindle
#

just make sure you're not putting anything else in the json file besides the token

#

or the prefix

earnest phoenix
#

ok

#

client.login(jsonfile.token) i add this ?

#

isnt it supposed to be

#

bot.login

#

🤔

harsh nova
#

What

#

Yeah if you have the client defined as bot

earnest phoenix
#

yea i guess

quartz kindle
#

something.login()

#

the something is whatever you named it in something = new Discord.Client()

#

bot = new Discord.Client() -> bot.login()
client = new Discord.Client() -> client.login()
etc...

#

same with the json file

#

jsonfile = require(./config.json) -> jsonfile.token
config = require(./config.json) -> config.token

#

^ you decide what to name it

earnest phoenix
#

its bot then

#

;d

#

client i mean

#

lmao

quartz kindle
#

the .on() is also part of Discord.Client()

#

so it should use the same name

earnest phoenix
#

oh

#

the guy i watched did bot.on

#

so i didnt know

#

lol

#

i thought its permenant

quartz kindle
#

because he did bot = new Discord...

#

the name you give it, is the name you have to use everywhere in the code

earnest phoenix
#

so like this ?

quartz kindle
#

yes

#

now another thing: .sendMessage() is deprecated/outated

#

you should change it to .send()

earnest phoenix
#

ok

#

this guy is rly out dated

#

am gonna see anoter one

#

and i deleted the commando thing ill use another easy thing since u said for beginners

#

use another thing

quartz kindle
#

if you focus on understanding the language, you wont need any tutorials

#

there is a huge documentation website for discord.js

#

understand the rules and you wont need anyone to show you

harsh nova
earnest phoenix
#

okay ill see

#

could someone tell me how to upload my token to heroku

#

or send me guide

quartz kindle
#

doesnt heroku have an option to create/upload a new file?

earnest phoenix
#

no

#

wait do u have a better host for free ?

quartz kindle
#

amazon and google are free for 12 months

#

but require a credit card to create an account

earnest phoenix
#

lel

#

someen told me

#

is this nice ?

mossy vine
#

no free hosts are nice

earnest phoenix
#

Is there a way to have a max character or 100 character? Discord.js

quartz kindle
#

what do you mean

earnest phoenix
#

I'm trying to add a command (trumptweet) and I want users to be limited to 100characters or it will be too big.

quartz kindle
#

check if the message is bigger than 100

#

and if it is, return an error or something

earnest phoenix
#

That will be messages, I know how to check that but I want characters

#

like "hi" = 1 word; 2characters

late hill
#

@earnest phoenix I'm pretty sure heroku git repos are private

#

If not you could always use environment variables

#

I think it's called config vars

earnest phoenix
#

its paid

late hill
#

In the settings

#

You can access them in your code with process.env.whatEverYouNamedTheConfigVar

earnest phoenix
#

okey bro

#

my friend is back he helped me

#

ty guys anyways

quartz kindle
#

@earnest phoenix thats what i said, check if the message is bigger than 100

#

message.content.length returns the size of the message, ie: the number of characters it has

earnest phoenix
#

oh

#

Thanks ❤

quartz kindle
#

👍

earnest phoenix
#

wtf ?

#

my bott sends messseges like this

#

why ?

harsh nova
#

idk?

#

its your coding so you should know

earnest phoenix
#

fam

#

i dont have a code for sending stuff like this

#

whenever i put it to heroku

#

it does that

#

lol

#

hmm, is the GitHub private?

#

Cause someone prob got ur token

#

👀

mossy vine
#

@earnest phoenix you already leaked your token, gg

earnest phoenix
#

?

#

i didnt lol

#

yesudid

#

how

#

Is your project on GitHub

mossy vine
#

i mean

#

there is no other way your bot is dming you unsafe links

earnest phoenix
#

i dont have

#

my token

#

on github

fleet horizon
#

What's the link?

earnest phoenix
#

then what's it on?

mossy vine
#

bro your token is fucking public on your github

earnest phoenix
#

files

#

but not the token

mossy vine
#

bottom of the file yo

#

literallly there

earnest phoenix
#

client.login("NTQxNzg0MDE4MjQ5NTgwNTQ1.Dzy1Wg.hlZ-agHbvyoSjsTFzVVrKi6w1Zg")

fleet horizon
earnest phoenix
#

OHA MRETARDD

#

LOL

#

boi

#

Reset ur token

mossy vine
#

reset your token

earnest phoenix
#

And make the GitHub private

#

i was testing the bot

#

and i forgot to change it

#

:d

#

B4 changing

mossy vine
#

please learn proper js smfh

earnest phoenix
#

toxic?

#

i fixed it anyways it was mb

mossy vine
#

be sure to reset your token

#

previous commits (including your token) are still visible

earnest phoenix
#

knotty steeple
#

who puts their token in the mainfile

last seal
#

can you help me with a code?

knotty steeple
#

what is the code

grim aspen
#

what library?

knotty steeple
#

lul

last seal
#

js

knotty steeple
#

library

#

not language

last seal
#

node

grim aspen
#

oh good

#

that's what i use

knotty steeple
#

oh no

grim aspen
#

what's the problem?

#

@last seal

last seal
#

I did a charge system for reactions, but it's giving error

knotty steeple
#

cant help if i dont know the actual library

#

¯_(ツ)_/¯

last seal
#

okay

#

@grim aspen you can ?

knotty steeple
#

do you use discord.js

grim aspen
#

what's it saying for the error?

last seal
#

@knotty steeple yes

#

@grim aspen private message

knotty steeple
#

whats the code and whats the error

grim aspen
#

.?

knotty steeple
#

send it here

last seal
#

ok

grim aspen
#

bad bot

last seal
#
if(message.content.startsWith('!lol'))
var embedlol = new Discord.RichEmbed()
.setColor('#11ABDD')
    .setTitle("**Adicionar o Cargo de jogador do LoL**")
    .setDescription("Para entrar nos canais de LoL clique nessa reação: ✅\n teste teste teste: ❌")
    .setFooter("mensagem", client.user.avatarURL);
    
    message.channel.send(embed).then(msg => {
    msg.react('✅')
    msg.react('❌')

    const embedlol = (reaction, user) => reaction.emoji.name === `✅` && user.id === message.author.id;
    const r1 = msg.createReactionCollector(embedlol, {time: 60000 });
    r1.on('collect', r => {
        r.remove(message.author.id);
        message.member.addRole('League of Legends')
    })

    const embedlol2 = (reaction, user) => reaction.emoji.name === `❌` && user.id === message.author.id;
    const r2 = msg.createReactionCollector(embedlol2, {time: 60000 });
    r2.on('collect', r => {
        r.remove(message.author.id);
        message.member.addRole('League of Legends')
    })

    });```
grim aspen
#

it blocked me from sending the photo

last seal
#

@knotty steeple what is error ?

knotty steeple
#

wat

grim aspen
#

wait which program for the library are you using?

last seal
#

visual studio code

knotty steeple
#

ur missing {} around the code

last seal
#

where

knotty steeple
#

a r o u n d t h e c o d e

last seal
#

i found

#

Is the rest right?

#

ReferenceError: embed is not defined

#

thanks.

grim aspen
#

it's not recognizing the name as an object

#

function*

amber fractal
#

Does the youtube API allow for "listening" for a new video posted so it will automatically post in a channel or should I just put it on a timer

knotty steeple
#

it should

last seal
#

@grim aspen what can I do ?

amber fractal
#

That means I actually have to figure out how to use the api then mmLol

last seal
#

Is there a charge id in discord?

astral quail
#

change id?

#

or charge id?

last seal
#

id role

#

role

#

cargo

grim aspen
last seal
#

i'm brazilian, use translate

#

existe um id especifico para um cargo ?

grim aspen
#

id for a job?

#

what you mean by that?

#

you mean like to find a channel or user id?

last seal
#

um id para cargo "addrole" role
R O L E

earnest phoenix
#

give context

slender thistle
#

Cargo

last seal
#

ISSO

earnest phoenix
#

literally no one knows what you're on about

last seal
#

isso cargo

slender thistle
#

Sounds like drug dealing

last seal
#

-.-

earnest phoenix
#

stop speaking caveman

grim aspen
#

it's brazilian

last seal
#

forgets

#

bye

grim aspen
#

i just got wooooshed didn't i?

earnest phoenix
#

yes

lofty hamlet
#

@knotty steeple i have memory hole for avatar of guild it is : guild.avatarURL ?

knotty steeple
#

i would like that you dont randomly ping me

lofty hamlet
#

exuse me i have missing

#

of personn

knotty steeple
#

so?

#

i dont give a shit

lofty hamlet
#

xuse me guy

formal agate
#

In the following js function I want to check that in all the comianations it produces it has to contain "a" for exsample ```js
let array = ["a", "b", "c", "d", "e", "f", "g"];

function getCombinations(input) {
var result = [];
var f = function(prefix, input) {
for (var i = 0; i < input.length; i++) {
result.push(prefix + input[i]);
f(prefix + input[i], input.slice(i + 1));
}
}
f('', input);
return result;
}

var combo = getCombinations(array);

earnest phoenix
#

So I am trying to use patreon to allow users that have bought the subscription to use patron only commands. I have been told I need a webserver in my bot. Anything else I need to know

formal agate
#

understand api

#

or at least how to do it

opaque eagle
#

I think they meant that you need a database, not a web server. @earnest phoenix

earnest phoenix
#

Well I have a Database

opaque eagle
#

Ok...

earnest phoenix
#

I just dont know how to get the user id and stuff into the bot whenever they purchase it

opaque eagle
#

You mean you don't know how to use a database?

earnest phoenix
#

no

#

I don't know how to make patreon write the users info whenever they buy the patron thing

formal agate
#

it would be a pull not a push unless you are using webhooks

#

so you would have to request it

quartz kindle
#

you want all possible combinations with all possible lengths?

#

from a until ggggggg?

inner jewel
#

you can use patreon webhooks

#

as long as the users link discord with patreon you can get their id

formal agate
#

@quartz kindle basicly but like i think i said i want it to require "a" in each possibility

quartz kindle
#

should the "a" be hardcoded or a parameter?

formal agate
#

it should be a parameter containing "a"

quartz kindle
#

hmm alright let me think

formal agate
#

ok thank you

earnest phoenix
#

I need help making so that the bot grabs a random guild from the list of joined guilds.

#

then returning the name or logs it in the console so I can further develop the feature

sick cloud
#

what is that feature

earnest phoenix
#

send a paper plane to a random server

#

like those weird apps you find on the app/play store

#

could be interesting /shrug

sick cloud
#

paper plane?

#

explain what it actually does

#

and do you have explicit permission to do so

earnest phoenix
#

wait

#

here's a link to my message explaining the feature

sick cloud
#

would the users name be attached, or is it anonymous

earnest phoenix
#

hm

#

I don't know, what do you think would be better

sick cloud
#

not doing it

#

lots of issues would arise

earnest phoenix
#

like?

sick cloud
#

permissions, api tos agreement, channels

earnest phoenix
#

for channels, just find one with the name general or bot-commands, if they're not found. send it to the first channel

#

also, what api tos

#

found it

sick cloud
#

you'll annoy users and defeat your bots purpose

earnest phoenix
#

hm

#

maybe a set command for a specific channel

#

client.on("guildJoin or whatever") {
await message. channel. send("Thanks for inviting me. First, we need to setup some stuff. where would you like to receive paperplanes?")
collect the channel
save it somehow
then done

sick cloud
#

thats got issues of its own

earnest phoenix
#

hm?

sick cloud
#

just add a setup command that can be run

earnest phoenix
#

o

#

on join>message("Thanks for inviting me! to make this bot run properly on your server, please execute the -setup command.")

sick cloud
#

no

#

you cant send a message on join

#

the users will work it out

earnest phoenix
#

ok

sick cloud
#

just put it in your help command

inner jewel
#

you can send a message on join

sick cloud
#

those are a pain though natan

inner jewel
#

you not liking them != them not being allowed/possible

earnest phoenix
#

xd

#

but how should I do it

quartz kindle
#

@formal agate that was an interesting challenge

#
var param = "a";
var array = ["a","b","c","e","f"];

function getCombinations(a,p) {
    let res = [];
    let test = new Array(a.length).fill(a[0])
    function loop() {
        if(test.includes(p)) { res.push(test.join()); }
        for(l = 0; l < a.length; l++) {
            let i = a.indexOf(test[l]);
            if(i++ === a.length-1) {
                if(l === a.length-1) { return }
                i = 0;
                test[l] = a[i];
            } else { 
                test[l] = a[i];
                break;
            }
        }
        loop();
    }
    loop()
    return res;
}

getCombinations(array,param)```
formal agate
#

well thank you because i had no idea on how to do it

#

you saved the day again @quartz kindle

quartz kindle
#

its not something easy to do, specially if you need to consider arbitrary lengths and values in it

#

also, there's probably a gazillion ways to do it

inner jewel
#

what is that supposed to do?

earnest phoenix
#

^

formal agate
#

im using it for user flags

quartz kindle
#

basically brute forcing an array

#

lmfao

formal agate
#

to determine what hype squad house people are in

quartz kindle
#

wait what

formal agate
#

because f the userflags

inner jewel
#

use the bitwise ops