#development

1 messages · Page 560 of 1

earnest phoenix
#

i have to put 1 of these in each

#

I dont just type it in because i want the bot to update this information as the site updates

viral spade
#

you stop after .setcolor(); ok?

#

make no .addfields on that embed object here

earnest phoenix
#

ok

#

so how can i get the information in?

viral spade
#

now add them afterwards in a for loop.

for(whatever of whatevers)
embed.addfield('','');

earnest phoenix
#

im so confused this is complex af for me lol

#

so id put like for(${text, 1})

amber fractal
#

Wait, hold up. I just got here. What your trying to do?

earnest phoenix
#

im trying to grab titles / links from a forum page and post it into a message

#

so as the titles/links change on the forums , they change when i run the command

viral spade
#

@earnest phoenix you need to put the scraping code into the run function, so you can access the text and href field there ok?

amber fractal
#

Dont just request the data once then

earnest phoenix
#

but im a bot at coding so i rlly dont know what to do lol

viral spade
#

let embed = new Discord.RichEmbed()
.setDescription("Rumble Fighter Announcements")
.setColor("#15f153");

$('.PreviewTooltip').each((i, el) => {
embed.addField('${text}','${href}')
});

earnest phoenix
#

thing is each topic is named text and href , so how could i get all 5 listed?

viral spade
#

i dont understand

earnest phoenix
#

or will all of this show in a list?

viral spade
#

$('.PreviewTooltip').each((i, el) => {
embed.addField('${text}','${href}')
});

#

this is a loop

#

it adds multiple fields. one field is one heading+description

earnest phoenix
#

oh wow nice

viral spade
#

this is the same loop you use for the console.log

#

image instead of console logging you add fields to your embed

earnest phoenix
#

so i think all i have to do is get rid of this

viral spade
#

as i said, the whole scraping function need to be in the run function, otherwise you cannot acces the $ object

earnest phoenix
#

LOL

viral spade
#

looks not bad

sick cloud
#

replace ' with `

viral spade
#

right

earnest phoenix
#

oh duh LOL

#

hold up getting an unexpected token , gotta find out where to put

amber fractal
#

.addField(name, value)?

earnest phoenix
#

Imma use what linc sent cuz i just messed something up

#

oo i put it in the wrong spot

amber fractal
earnest phoenix
#

oh wait looks like you did too , $ is still undefined

amber fractal
#

Can you show your code?

earnest phoenix
amber fractal
#

I forgot i was retarded

earnest phoenix
#

?

#

o-o

amber fractal
#

I cant help you is what im trying to say

earnest phoenix
#

xD

#

this is so hard

amber fractal
#

The only reason id see for $ being undefined in that case is because the try/catch failed but im guessing you didnt get an error so i mean

#

Whatever, its 2 AM imma go to bed now

#

Gn

earnest phoenix
#

gn thanks

#

^^ you were right btw thanks !

visual zenith
#

@earnest phoenix u still on?

earnest phoenix
#

yea wassup?

visual zenith
#

did you change ' to ` ?

#

yet

earnest phoenix
#

i did

visual zenith
#

also what are you trying to do?

$('.PreviewTooltip').each((i, el) => {``` ?
earnest phoenix
#

like cat food said , it was outside of the try/catch

#

i was trying to get titles and links from a forum page and send it into a message

visual zenith
#

are you sure u need $ instead of something else?

earnest phoenix
#

not sure

#

but i got the command to work

visual zenith
#

that line doesnt make sense to me tbh

#

also what does it show now?

earnest phoenix
visual zenith
#

is that good ?

#

this is a problem still?

earnest phoenix
#

no this is exactly what i wanted

visual zenith
#

or u got it

earnest phoenix
#

basic but just want i wanted to accomplish for tonight, ill modify tomorrow xD

visual zenith
#

ok

sturdy delta
#

Does anyone know how I could make a manual override function just for me? Maybe something like if(message.member.hasPermission(‘ADMINISTRATOR’) || {what do I put here(I have a let function that has my I’d named owner)} ?

earnest phoenix
#

Xignotic

coral trellis
#
if(message.author.id !== OWNER.ID) {
    if(message.member.hasPermission('ADMINISTRATOR'){
    }
}
earnest phoenix
#

but then if it is

coral trellis
#

So if it doesn't equal you it will check for the author has admin

earnest phoenix
#

wait isn't that bad

#

what if it is

#

then he's gonna have to write 2 codes

coral trellis
#

Actually is terrible

earnest phoenix
#

XD

coral trellis
#
if(message.author.id !== OWNER.ID && !message.member.hasPermission("ADMINISTRATOR")) {
channel.send("No perms")
} else {
// Has perms
}```
earnest phoenix
#

would that really work tho?

coral trellis
#

It should

sick cloud
#

use &&

#

otherwise they have to both equal true

keen drift
#

just use &

idle mountain
last apex
#

lmao I didn't update heroku in 4 months 😂

chrome olive
#

module.exports.help = {
    name: 'help',
    aliases: ['commands']
};

How i can add here a permision section?

sturdy delta
#

@chrome olive message.member.hasPermission ?

chrome olive
#

oh ok

sturdy delta
#

what is Oauth2?

#

Nvm

earnest phoenix
#

Is there a way to hide a link into a piece of text ?

keen drift
#

markdown?

mossy vine
#

a tag with same style as regular text?

earnest phoenix
#

Is it possible to do a markdown on a web scrape generated loop message?

keen drift
#

what

earnest phoenix
#

😂😂

mossy vine
#

Uhm yes?

keen drift
#

what in the engl8sh w0rld

earnest phoenix
#

Breh it makes sense if you understand what I'm talking about lol

#

But alright I just wanted to know if it was possible

quartz kindle
#

no it doesnt

#

"web scrape generated loop message"

#

elaborate please

mossy vine
#

Just style the a tags i think

keen drift
#

You started with a generic question of hiding a link into a piece of text w/o context

#

This is Discord, so I assumed you are talking about markdown

#

Then the web scraped generated loop message, I have no idea

#

where the punctuation at

rain rivet
#

Isn't it against discord's ToS to allow users to have timed api calls like say Rainbow roles or Changing bot presence?

#

Because @jaunty lake does something similar. Sending an API call every minute to change the name of a voice channel

quartz kindle
#

well, they will probably get rate limited or worse

#

eventually

rain rivet
#

So it isn't bannable?

quartz kindle
#

"or worse"

#

includes ban

rain rivet
#

Where can i report it?

quartz kindle
#

idk, send an email to discord, or whatever, if it bothers you that much

rain rivet
#

:+1:

quartz kindle
#

lil snitch lul

slender thistle
#

I wouldn't really care if the rainbow role was every 24 hours or so

earnest phoenix
#

Wait changing presence is against tos?

mossy vine
#

no

earnest phoenix
#

Yeah but every 30 seconds?

crisp sluice
#

@steel oak

mossy vine
#

fake rythm xd

crisp sluice
#

@spice wren

quartz kindle
#

abusing the api is against the TOS, which means any form of excessive calls to the api

amber fractal
#

We have rate limits for a reason Thonk

earnest phoenix
#

wait tim

#

so change prescense 30 secs is bad?

quartz kindle
#

yes

#

in general, bots should only do something when responding to commands, they should not do something in time intervals without user input

#

specially if the time interval is very low

zealous veldt
#

Yeah

quartz kindle
#

it can be used to achieve interesting experimental features, but should not be used in large scale public bots

earnest phoenix
#

hmm

#

i like my change prescense tho

inner jewel
#

staying inside the ratelimits doesn't mean it's not abuse

earnest phoenix
#

so 30 seconds is good?

viral spade
#

What is usually done when you need another permission for a new feature, but your bot is already installed on servers? send error messages on feature use, telling them they should reinvite the bot to use that feature?
is it bad practice, will people be frowned upon when simply asking for admin or majority of roles (even tough they are not needed in the current state of the bot)?

#

@earnest phoenix
"web scraped generated loop message" could have also just said embed 😏

amber fractal
#

But its not sending a message or doing anything, its just switching its presence

#

Which users can also do very quickly

earnest phoenix
#

Where this error?

<?php
$output = "shell_exec('node simple/bot.js')";
if ($output === "Logged!") {
header (Location: http://smookywizard.net.ru/bot/started.html);
exit();
} else {
header (Location: http://smookywizard.net.ru/bot/fail.html);
    exit();
};
?>
zinc pawn
#

handled nvm

viral spade
#

@zinc pawn check all your variables. sounds like you have a problem of not-declared, duplicate names, wrong scopes, wrong type(const let)

zinc pawn
ruby talon
#

Hey, I got an error.
I have no idea on how to fix this right now.

HTTPSConnectionPool(host='link', port=443): Max retries exceeded with url: /sublink/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

Some info:
Python: 3.7.1 64 bit

#

idk if it has something to do with it.

#

But I think its on my side.

earnest phoenix
#

help

mossy vine
#

masterhacker

ruby talon
#

My above error got fixed.
How I fixed it:
Reinstalled Python- lol I had the 32 bit but my pc is 64 bit 🤦

amber gorge
#

does anyone know typescript ?

quartz kindle
#

@earnest phoenix what are you trying to do? you're creating a string, not actually executing anything

lofty hamlet
#

Who can help me ? i want delete the "look screen for this" in my page of discordbot.org

idle mountain
#

@lofty hamlet css <style> .shapes-background { display:none; } </style>

#

in your bot's long descriptions

#

@uneven laurel what language & library

lofty hamlet
#

Thanks @idle mountain

idle mountain
#

npnp

quartz kindle
#

client.users.size

#

but if you want only people with "online" status, then its more complicated

#

you need to loop over all users, and check their presence

inner jewel
#

members, filter, length

#

reduce

idle mountain
#

are there SQL-like functions in js?

inner jewel
#

sql.query("select * from x where y=z")

#

:^)

idle mountain
#

in C# we can do myCollection.Where(x => x.boolThatIsTrue)

#

and it'll filter out anything where boolThatIsTrue isn't true

inner jewel
#

array.filter(predicate).map(thing)

#

etc

#

check the methods on Array

#

the equivalent to that would be filter

idle mountain
#

well TIL, and Robin you can use that, bc it's neater in your code (and is probably faster?) ^

lofty hamlet
#

@idle mountain ?

#

How can I find the names of things to edit?

#

ex :.shapes-background {

idle mountain
#

Depends on the browser, on Chrome you right click > Inspect

#

on other browsers it's similar

lofty hamlet
#

This I know 😂

#

Where ? Because he does not say it explicitly

inner jewel
#

a for loop would be the fastest way to get the count

idle mountain
#

it'll bring up a neat menu of all the items, just search around until it highlights the thing you want, then copy its class name and then put a dot in front of it in the css, ie if you wanted to edit a div with the name "mydiv", do css .mydiv { /*something here*/ }

#

if that's what you're asking thonkku I'm not entirely sure

inner jewel
#

filtering (aka creating a new collection) is a bad way of counting

#

reduce would be better for that

idle mountain
#

ah

#

wonder why bingT

#

I suggest, Nebulus, that you learn CSS if you don't already, w3schools has some good tutorials on it

inner jewel
#

reduce can do it without copying

idle mountain
#

it's not that hard, you can understand all the basics in like 10 minutes

inner jewel
spring ember
#

@inner jewel oh wow that's hot

earnest phoenix
sick cloud
#

your calling connection().play() probably

#

connection isn't a function as it explains

earnest phoenix
#

how can i fix it?

sturdy delta
#

If I get my bot to remove roles, but the person does not have they role, will it throw errors?

sick cloud
#

dont ghost mention random members @sturdy delta

sturdy delta
#

Something dorky: I didn’t mean to, he’s a happy to help on another server, and I just copied and pasted and forgot to remove the ping

topaz fjord
#

@sturdy delta yes it will

amber fractal
#

Whenever that happens i just use a try and catch and do nothing with the error as it is expected

earnest phoenix
#

i bet you 50% of js devs do that in here

amber fractal
#

Whats the point of handling the error when you know the cause? I mean i guess you could send "User doesn't have the role specified"

#

I guess you could use an if to see if they have it, but thats more work

inner jewel
#

or even better

#

you fix the code so the error doesn't happen

bright spear
#

or just handle the error since a "fix" would just detect the error before it attempts it

sly brook
#

How do I do a bot user count?
My code right now is
bot.users.size and that just produces a number that keeps rising. I have guessed my bot has around 40k users but it’s only showing 16k? Anyone that may be able to help me?

amber fractal
#

It's showing cahced users

#

cached*

sly brook
#

Ah ok

empty axle
#
const Discord = require('discord.js');
const database = require('../database');
module.exports.run = async (bot, message, args) => {
    let abc = message.mentions.users.first()
    database.Users.findOne({
        "_id": message.author.id
    }, function (erro, documento) {
        if(documento){
            let enbed = new Discord.RichEmbed()
            .setColor('#FF0000')
            .setDescription(`${abc}, aceita se casar com ${message.author}?`)
            message.reply(enbed).then(msg => {
                msg.react('530808552575467538') 
                msg.react('530808552575467528')         
                const sim = (reaction, user) => reaction.emoji.id === '530808552575467538' && abc.id === abc.id; 
                const sim2 = msg.createReactionCollector(sim, { time: 60000 }); 
                const nao = (reaction, user) => reaction.emoji.id === '530808552575467528' && abc.id === abc.id; 
                const nao2 = msg.createReactionCollector(nao, { time: 60000 }); 
                sim2.on("collect", async r => { 
                let embed = new Discord.RichEmbed()
                .setColor('BLUE')
                .setThumbnail(abc.avatarURL)
                .setDescription(`${abc} e ${message.author} se casaram! 🙂`)
                message.channel.send(embed)
                documento.casado = true
                documento.save()
            })
#
                nao2.on("collect", async r => { 
                    let embed = new Discord.RichEmbed()
                    .setColor('RED')
                    .setThumbnail(abc.avatarURL)
                    .setDescription(`${abc} e ${message.author} não casaram! :eita:`)
                    message.channel.send(embed)
                    documento.casado = false
                    documento.save()
                    })
            })}})
    var pessoa = new database.Users({
        _id: message.author.id,
        level: 0,
        xp: 0,
        coins: 0,
        rep: 0,
    })
}
#

Help pls

quartz kindle
#

you dont need two reaction collectors lol

#

also, there is nothing ending them, they will keep running for 60 seconds and will keep replying to the reactions

inner sentinel
#

Hey I'm trying to setup the votes webhook

#

I'm getting an empty response

empty axle
#

@quartz kindle No?

#

What

inner sentinel
#

I get the Authorization header right, but the body of the post request is empty

empty axle
#

How will collect X and V

inner sentinel
#

nvm, im dumb

earnest phoenix
amber fractal
earnest phoenix
#

think i got it tbh

amber fractal
#

Alright.

quartz kindle
#

@empty axle js collector.on('collect', r => { if(r.emoji.id === "emoji id") { // something collector.stop() } else if(r.emoji.id === "other emoji id") { // something else collector.stop() } });

#

or you can use awaitReactions

empty axle
#

ok

violet plume
#

So I read a lot about say commands being a risk because of messages being reported 🤔
Would having the messages signed by the user make a difference?
So tag commands have the same risk?

inner jewel
#

if you add something like command executed by XYZ#1234 it may help you avoid a ban

#

may

#

discord t&s has a big history of stupid bans

bright spear
#

ive never heard of bots being reported for say commands

#

pretty much every multipurpose bot has a say command

inner jewel
#

i've had a friend banned because of say commands

#

¯_(ツ)_/¯

#

user: <prefix>say gorelink
bot: gorelink
user: deletes message
user: reports bot

deft kestrel
#

I feel like this is a stupid simple mistake but does anyone here have any idea why fil gives the correct list of message maps but prevMsg gives Promise { <pending> }?

Im using NodeJS because I was naive when starting out (i still am but slightly less) and it's too late to go back

//get previous message
            async function lastMsg() {
                //fetch channel's past 10 messages  
                var msgs = await msg.channel.fetchMessages({ limit: 10 })
                //remove messages not by the author
                var fil = msgs.filter(lsMsg => lsMsg.author.id != msg.author.id)
                //log the messages (development only)
                console.log(fil)
                //return the messages
                return fil
            }
            //fetch last messages
            var prevMsg = lastMsg()
            //log last messages (SHOULD be the same as before)
            console.log(prevMsg)

I understand that the issue is to do with mixing async and sync but I'm using a function so I thought it would wait.

sonic ermine
#
async function lastMsg() {
  return new Promise(function(resolve, reject) {
    var msgs = await msg.channel.fetchMessages({ limit: 10 });
    var fil = msgs.filter(lsMsg => lsMsg.author.id != msg.author.id);
    console.log(fil);
    resolve(fil);
  });
}

var prevMsg = await lastMsg();

console.log(prevMsg);```
#

Haven't tested it

#

but I think it'll work

#

@deft kestrel

grand raft
#

@deft kestrel It's because an async function returns a promise. You should await or call .then(...) on that promise

#

Async functions are just a syntactic wrapper on top of promises

deft kestrel
#

but the promise is pending

#

i have to figure that out first

grand raft
#

It's pending because the function executes asyncronously

#

The function immediately returns a promise, which is resolved later once it's fetched the messages

#

But fetching the messages is a different promise

#

and the first promise waits on the second one

#

A pending promise is just a promise that hasn't completed yet, and it'll call a callback you pass it using .then(...).

deft kestrel
#

how do i get it into synchronous

grand raft
#

You can't, that's a limitation of how nodejs works

deft kestrel
#

because both you & Kie are thinking it's all async

#

the thing is i did something like this before cross-file

sonic ermine
#

I don't know how async works n stuff I just used it once and thought I could help lol

deft kestrel
#

it just wont work here

grand raft
#

It's impossible to go sync, because if it's sync the promise will never resolve because it's being blocked by your sync code

deft kestrel
#

okay well thanks for killing this conversation, and thank you Kie for at least trying

grand raft
#

There is one way to do it, but it's fairly bad practice

amber fractal
#

Wait what are you trying to do?

grand raft
#

He's trying to call an async function synchronously

blazing star
amber fractal
#

Was that his question?

grand raft
#

He was asking why he was getting a Promise { pending } instead of a value from his async function

#

then asked how to just get the value explicitly syncronously

blazing star
#

js 100

inner jewel
#

congratulations, you just met the colored function problem

grand raft
#

The problem is that it's literally impossible because nodejs is singlethreaded and sync code will block the event loop, thus preventing the promise from ever resolving

amber fractal
#

Isnt he just trying to get the previous message?

grand raft
#

Previous message is awaited in the async function

#

so either way he's stuck

inner jewel
#

await is just sugar for CPS

#

aka it becomes .then()

#

it's not sync

#

just looks like it's sync

amber fractal
#

I just got 2000 messages tho, so I dont see why he couldnt get 1?

slim heart
#

ok so um i have no idea how rethink works and one of my devs told me this is how to get a value other then the base thingy (id) and so I did this db.table('user_stats').getAll({username: req.query.username}).run().then(data=> etc. but this doesn't work, any idea how this works?

grand raft
#

He's trying to grab data from an external api syncronously

inner jewel
#

it breaks the function and puts whatever is after the await into a callback

grand raft
#

not from cached messages

amber fractal
#

Yes

#
let contents = msgs.map(m => m.content)```
grand raft
#

There was a node module I'm trying to find which allowed you to jump between stack frames and thus execute async code "syncronously"

#

but I can't remember what it was called

#

also that's still async

inner jewel
#

that's a dangerous idea

grand raft
#

because you're awaiting a promise

#

Yeah I would never use it in production

#

but it's super nifty

deft kestrel
#

what have i created

inner jewel
#

that's what go does

#

it uses green threads for concurrency

#

once they hit IO, they're swapped out

grand raft
#

found it

#

Non-blocking sync code

#

though it has to be wrapped inside a fiber, you can't just arbitrarily jump around

#

so depending on your needs you may not be able to get into a fiber

#

since fiber execution is async, it's just that once you're inside the fiber you can execute async code syncronously

#

async/await is almost always a better option though

inner jewel
#

it is blocking

#

but the context switch makes it look as if it doesn't block

grand raft
#

yep

#

I tried using it as part of a sandboxed server administration eval bot awhile back (so it would run user code with what looks like a sync api), it worked out pretty well

#

had seperate protections for infinite loops though

lusty dew
#

How could I assign something a default value?

#

like mute time

#

if a mutetime is not provided

#

it assigns it a default one

grand raft
#

use ||

#

as in var mutetime = value || 60

#

so if value is falsey (0 or NaN) it gets set to 60

lusty dew
#

Can't use that

grand raft
#

wait what language are you using

lusty dew
#

I have to define the default another way

#

I got it though

#

ima do

#

let mutetime = args[2]
if(!mutetime) mutetime = 300000, msg.channel.send('You didn't supply a time so a default of 5m was assigned')

#

I think that will work

#

although that check I think is a bit wrong

grand raft
#

What values could it be? You might want to Number.parseInt(...)

#
let mutetime = Number.parseInt(args[2]);
if (!mutetime) {
    mutetime = 5 * 60 * 1000;
    msg.channel.send("Mute time defaulted to 5 minutes")
}```
#

If it ends up being a non-number value (e.g. "foo") you'll get NaN, which is falsey and would thus trigger the default

#

0 would also trigger it

#

may want to check for negative numbers as well

amber fractal
#

let mutetime = parseInt(args[2]) || 300000 is just shorthand for let mutetime = parseInt(args[2]) if(!mutetime) mutetime = 300000

#

and Number.parseInt is the same as parseInt isnt it?

grand raft
#

I prefer the latter just because it's more obvious what scope it's coming from

#

even though it exists in both

sturdy delta
#

Does anyone know how to make an !apply command. Like someone does that, they get a Dm with 10 or so questions in an embed, then it gets their Answers, puts it into an embed and then sends it to a channel named applications

upper tundra
#

Is there a way to make the bot check if the person invoking the command is "Active on Mobile" or not?
(Discord.NET)

sick cloud
#

no

#

the API doesn't give us that

amber fractal
#

Isnt the mobile thing relatively new?

#

It may come in the future if it is

#

@sturdy delta this is possible yes. You will want to awaitMessages (d.js, there are also other ways to do it, if you dont want to use this) also, make sure the bot can dm them by using a try/catch for the first message and if it doesnt go through, then tell the user to allow dms to apply

earnest phoenix
amber fractal
#

Error?

#

Or is there not one

earnest phoenix
#

there isnt one

#

Im trying to figure out how to post the embed with info , then have the link sent to the 2nd half of the command which makes the bot join the voice channel and play what ever the link is

amber fractal
#

Is there any reason these are in seperate module.exports.runs

earnest phoenix
#

no reason , im just bad at coding lol

#

i couldnt get it all to fit under 1 without errors

amber fractal
#

I just was asking why its in there and not a function itself

#

Anyeays, does it get the result you want, the link i mean

earnest phoenix
#

the command literally does nothing but make my bot join the vc...

amber fractal
#

Oh

#

Well i see in your catch it just says console.log

earnest phoenix
#

oh and when it joins the vc it says.. "sorry alrdy in a voice channel" lmao

#

but yea , thats all i know o-o

amber fractal
#

Then its probably a good idea to diagnose the issue mmLol

#

I wish i could assist more, but i must go to bed now

#

I hope someone else can help you tho

earnest phoenix
#

:/

#

alright thanks... good night

lusty dew
#

is arg an array? python rewrite

#

I think it is

#

but just wanted to be sure

#

Also any suggestions on how to make a Logging channel cmd in python rewrite

ruby talon
#

@lusty dew do you mean *args?

lusty dew
#

No

ruby talon
#

If its a function you'rr trying to execute maybe help(function) could help you.

lusty dew
#

Eh

#

No

#

But thanks

#

I think I got what I need

ruby talon
#

👍

earnest phoenix
#

how can i define get?

lusty dew
#

Usually when you get an error like this

#

It is something before you use get

#

Show code plz

lusty dew
#

Oof

#

Use hastebin or smth

#

Lol

earnest phoenix
#

hastebin broken

lusty dew
#

Ok

#

Use

#

Hatebin

earnest phoenix
lusty dew
#

Where is active defined?

#

Nvm

#

I see it now

earnest phoenix
lusty dew
#

I see it now

earnest phoenix
#

Yea its really confusing

#

Been working on this for 5 hours lol

lusty dew
#

Ye

#

Music bots are a pain in the ass

earnest phoenix
#

i know :/

lusty dew
#

@earnest phoenix why are you passing ops through module.exports if you have ops defined?

earnest phoenix
#

i have

#

no clue

#

im just trying anything

lusty dew
#

Well I have to sleep

#

Sorry I couldn't help

earnest phoenix
#

dam

#

ok thanks :/

#

i deleted ops from every module.export and it worked gg

daring flume
#

Traceback (most recent call last):
File "C:\Users\MHRO~1\AppData\Local\Temp\tmpt58muklupycharm-management\pip-10.0.1\setup.py", line 6, in <module>
from setuptools import setup, find_packages
ModuleNotFoundError: No module named 'setuptools'

#

how can i fix that problem

#

by the way i am trying to install packgaging tools

daring flume
#

Thank you much

ruby talon
#

Np.

earnest phoenix
#

hello i want make move log with dbm how can i make ?,

coral trellis
#

Ask in the DBM servers

keen drift
#

dbm wew

keen drift
#

great, my bot is writing too fast to redis and it crashed

sturdy delta
#

does anybody know how to make a spam filter
like if someone starts sending messages rapidly it gives them a local slowmode or something?

chrome olive
#
        let cmdnr = colection.help.colection;
        let cmds = [];
        cmdnr.forEach(name => {
          if(name.help.category === info)
          {
            cmds.push(name.help.name);
          }
        });
        return '\`'+cmds.join('\`, \`')+'\`';

this can work???

earnest phoenix
#

no. @chrome olive

#

That has so many errors

chrome olive
viral spade
#

good day,
when i broadcastEval and receive back an array of values, can i assume this array is sorted by shardid? first result is from shard with id 0 and last result from shard with max id? can i also assume there are no gaps in between shardids?

steel heath
#

yes

viral spade
#

okey so if i need a shard with a certain guild on it, i can address it by its position in the result of the broadcastEval(hasGuild(id))?

steel heath
#

yep

amber fractal
#

What would happen if a shard were offline tho Thonk

ruby talon
#

It wouldn't be online.

steel heath
#

they reconnect automatically

#

u can set the retry limit and such and

#

i dont know how or why but you still can get information from offline shard

inner jewel
#

you can get the shard a guild belongs with some math

#
shard_id = (guild_id / Math.pow(2, 22)) % shard_count```
tulip ledge
#

hey I have a question so I'm using mysql and I have a row with value: id, id, id
Now I split them so I got [ 'id', 'id', 'id']
Now how would I get the tags of these id's because if I would do client.users.get(id) it wont work

inner jewel
#

<@{ID}>

sick cloud
#

it's an array too

tulip ledge
#

No it's I want to get the tags from the 3 id's in the array

sick cloud
#

map over them

quartz kindle
#

so you want to get an array of 3 tags?

tulip ledge
#

Yes

quartz kindle
#

use .map()

sick cloud
#

forEach id in array
client.users.get id

#

basically

tulip ledge
#

That's the problem I've read like 3 documents watcged a video and I still don't get how mapping works

inner jewel
#

if you just want to mention there's no need to get the user object

#

just build the mention yourself

quartz kindle
#

array.map(t => client.users.get(t).tag)

tulip ledge
#

No I went the tag not the mention

quartz kindle
#

or something like that

inner jewel
#

oh

sick cloud
#

tag = user#0001

inner jewel
#

then you need to get from the client

#

¯_(ツ)_/¯

#

some people use tag meaning mention

tulip ledge
#

Tag is name#discriminator

quartz kindle
#

basically

sick cloud
#

literally just forEach over it

quartz kindle
#
let array = ["id","id","id"];
array.map(item => do something with item and return it back to the array)
// map copies the array and then does operations to each item before returning it```
#
[1,2,3].map(t => t + 1) // [2,3,4]```
inner jewel
#

let [tag1, tag2, tag3] = array.map(...) :^)

sick cloud
#
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-opus@0.3.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-opus@0.3.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

its been literally forever since i've seen this error

#

like what's up

inner jewel
sick cloud
#

i have build tools installed tho

slim heart
#

anyone know whats wrong with this nginx config?

    listen 443;
    server_name play.jt3ch.net
    location / {
        proxy_pass "https://127.0.0.1:443";
    }
}```
#

it just says nginx: [emerg] unknown directive "censorbot_panel" in c:\nginx-1.15.8/conf/nginx.conf:1

quartz kindle
#

you're not supposed to rename server

slim heart
#

nginx: [emerg] "server" directive is not allowed here in c:\nginx-1.15.8/conf/nginx.conf:1

quartz kindle
#

you're using the wrong config file

slim heart
#

i dont have a sites-available folder tho

quartz kindle
#

what do you have in /etc/nginx/?

#

oh youre on windows

slim heart
#

conf-contrib-docs-html-logs-temp

quartz kindle
#

nvm

slim heart
#

so i make the directory

#

or is it a file

#

no

stuck ibex
#

.heko

#

.help

quartz kindle
#

you can use a server config inside the main nginx.conf if you put it inside an http block

#
    server {
        location
        etc
    }
}```
slim heart
#

aah

#

alright thanks

#

wait still problem lol

#

i put it in the http block

#

or do i put it in server?

#

nvrm im dumb

quartz kindle
#

works now?

slim heart
#

yea

quartz kindle
#

👍

slim heart
#

i think™

quartz kindle
#

xD

quartz kindle
#

check how to install lzma-native on windows

#

you're probably missing a dependency or something

earnest phoenix
fierce thorn
#

For?

amber fractal
#

He probably wants it to get a meme, idk

neon prairie
#

Why is that last console.log() undefined?

let mUser = message.mentions.members.first()
let mGame = mUser.presence.game
   
 if (mGame.name === 'Spotify') {
        console.log(mGame.assets);
        console.log(mGame.assets.RichPresenceAssets);
    }

// Output: 
// RichPresenceAssets {
//  largeText: '2002',
//  smallText: null,
//  largeImage: 'spotify:2c4c4fe5a1216866373548a755d787da23daeec6',
//  smallImage: null }
// undefined
split hazel
#

What is assets?

inner jewel
#

because there's no RichPresenceAssets property

neon prairie
#

assets is this output

// RichPresenceAssets {
//  largeText: '2002',
//  smallText: null,
//  largeImage: 'spotify:2c4c4fe5a1216866373548a755d787da23daeec6',
//  smallImage: null }
#

So what to do to get largeImage from

Game {
  name: 'Spotify',
  type: 2,
  url: null,
  details: 'Promises (with Sam Smith)',
  state: 'Calvin Harris; Sam Smith; Jessie Reyez',
  applicationID: null,
  timestamps:
   { start: 2019-01-25T19:58:17.089Z,
     end: 2019-01-25T20:01:50.398Z },
  party: { id: 'spotify:365162284655443978' },
  assets:
   RichPresenceAssets {
     largeText: 'Promises (with Sam Smith)',
     smallText: null,
     largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
     smallImage: null },
  syncID: '5N5k9nd479b1xpDZ4usjrg',
  _flags: 48 }
RichPresenceAssets {
  largeText: 'Promises (with Sam Smith)',
  smallText: null,
  largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
  smallImage: null }
inner jewel
keen drift
#

highest iq I have seen

slim heart
#
    server {
        listen 443 ssl;
        server_name play.jt3ch.net;
        
        ssl_certificate  server.crt;
        ssl_certificate_key server.key;
        
        location / {
            proxy_pass "http://127.0.0.1:2001";
        }
    }
    server {
        listen 443 ssl;
        server_name img.jt3ch.net;
        
        ssl_certificate  server.crt;
        ssl_certificate_key server.key;
        
        location / {
            proxy_pass "http://127.0.0.1:8074";
        }
    }
    server {
        listen 443 ssl;
        server_name nginx.jt3ch.net;
        
        ssl_certificate  server.crt;
        ssl_certificate_key server.key;
        
        location / {
            proxy_pass "http://127.0.0.1:1002";
        }
    }
    server {
        listen 443 ssl;
        server_name test.jt3ch.net;
        
        ssl_certificate  server.crt;
        ssl_certificate_key server.key;
        
        location / {
            proxy_pass "http://127.0.0.1:3000";
        }
    }
    server {
        auth_basic "Administrator's Area";
        auth_basic_user_file .htpasswd;
    
        
        listen 443 ssl;
        server_name db.jt3ch.net;
        
        ssl_certificate  server.crt;
        ssl_certificate_key server.key;
        
        location / {
            proxy_pass "http://127.0.0.1:4352";
        }
    }``` whats wrong with this
#

with then redirects to port 2001

#

as if it was play.

#

even when i make /test return req.headers it says its host is 127.0.0.1:2001

lofty hamlet
#

How i can searsh in array ex : ?searsh Ar

And the bot send all the array start with "Ar"

quartz kindle
#

array.filter()

lofty hamlet
#

🤔

quartz kindle
lofty hamlet
#

Thanks

quartz kindle
#

@slim heart all others work? i dont see anything wrong with the config file

slim heart
#

yea

#

they all do

quartz kindle
#

is there anything running on port 3000 that might redirect or something?

#

or maybe dns configuration?

slim heart
#

ill try changing the port really quick see if anything changes

#

nope

#

even changing the port it still redirects

#

for no reason

quartz kindle
#

check dns maybe?

slim heart
#

ok i fixed it

#

nginx was being fucktard

keen drift
#

kek

#

I rarely use nginx just for proxying

slim heart
#

for some reason i had to go all the way to god damn task manager and quit it

quartz kindle
#

lmao

slim heart
keen drift
#

speaking of load balancing

#

was looking into google's load balancer service, so I can redistribute to my other nodes

#

looks expensive PepeCry

lofty hamlet
#
            fonction.channellogs(message)
            let xoargs = message.content.split(" ").slice(1);
            let xo03 = xoargs.join(" ")
            if (!xo03) return message.reply("Erreur :Croix: : `Entrez minimum une lettre à rechercher comme mot clé dans votre PC`")
            const filterItems = (query) => {
                return Dresseur.Sac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1);
            };
            message.channel.send(filterItems(xo03))
        }```

How i can if the message of the bot content 2.000 caracters the bot send 2 messages
slim heart
#

ok its still being really dumb for whatever reason when i completely remove the test.jt3ch.net block it still connects to the same thing sks

quartz kindle
#

@lofty hamlet js .send(message,{split:true})

#

or {split:{splitoptions}}

slim heart
#

i completely shutdown nginx and all their forwards still work ok wtf is happening

#

@quartz kindle any idea

quartz kindle
#

wtf

#

is it getting cached anywhere? cloudflare?

#

idk

slim heart
#

im using cloudflare yea-

#

but like the entire api side of it is still working

#

wait no its not!

quartz kindle
#

you're on windows right?

slim heart
#

also yes

quartz kindle
#

does nginx run as a service on windows?

#

or as a process

slim heart
#

process

#

i just checked if it was a service

#

and no

#

hold on im purging the cloudflare cache

quartz kindle
#

so yeah, i guess cloudflare caching is fucking it up

#

they have a page that tells you what features you should disable when running an api

slim heart
#

where

quartz kindle
slim heart
#

even after purging its still doing it

lofty hamlet
#

thanks ! @quartz kindle

#

But fpr eùbed ?

#

embed*

slim heart
#

ok thats even weirder, when i use my sharex host it even still picks up new images meaning its as if even tho its not cached its still making requests

lofty hamlet
#
                .setColor(embedcolor)
                .addField("Pokémons contenant : " + xo03, filterItems(xo03), { split: { maxLength: 100 }})
                .setFooter(client.user.username + " - by Nebulus")
                .setTimestamp()
            message.channel.send(embed)```
#

And error max caracter

#

RangeError: RichEmbed field values may not exceed 1024 characters.

#

But message.channel.send(filterItems(xo03), { split: { maxLength: 2000 } }) work

quartz kindle
#

i dont think you can auto-split embeds

#

you have to do it yourself

lofty hamlet
#

Oh ok

#

Thanks

slim heart
#

im gonna go eat dinner if its not fixed by then by whatever cloudflare magic im gonna ping u and we can figure it out ok tim

lofty hamlet
#

@quartz kindle just for finish and i goin my bed i can detect if my message is empty ?

#

i try this but is not work

prime oriole
#

How do i fix it

jolly kiln
#

can you link me to your bot on DBL website?

prime oriole
#

Idk what website that is

jolly kiln
#

ok one sec

earnest phoenix
#

fix what

prime oriole
#

My bots responding to other bots

earnest phoenix
#

just make it not

#

like

#

what library do you use

jolly kiln
#

yeah i got it

#

you're using async right?

prime oriole
#

Yea

jolly kiln
#

ok one sec

#

(i just fixed this for my own bot yesterday and it just got unmuted here like 3 mins ago for that xd)

lusty dew
#

What does the encoding property do with fs.writeFileSync?

jolly kiln
#

wilfmaster, put this somewhere in your code

#
@bot.check_once
def is_user(ctx):
    return not(ctx.author.bot)
prime oriole
#

Ok

jolly kiln
#

every command that's called will go through that

prime oriole
#

Ummm im using client not bot

jolly kiln
#

one sec

knotty steeple
#

then replace it

lusty dew
#

then replace bot with client

#

yeet

jolly kiln
#

client doesn't have check once

#

one sec

lusty dew
#

Boi

#

if he defined his thing as client

#

then he can use client

prime oriole
#

Client and bot is two different things

lusty dew
#

how did you define your discord.Client

jolly kiln
#

bot is part of discord.ext

#

aka an extension

lusty dew
#

Again boi

#

I use client even when using discord.ext

#

it works fine for me

knotty steeple
#

oh no

jolly kiln
#
client = discord.Client

is not equal to

bot = commands.Bot()
prime oriole
#

I can use both but they write over the cmds

knotty steeple
#

holy shit

lusty dew
#

I still used client = commands.Bot()

knotty steeple
#

listen here

lusty dew
#

it works fine

jolly kiln
#

well ok you just changed the name, that's all

#

wildmaster used discord.Client

knotty steeple
#

you can set discord.Client to anything you want

lusty dew
#

ok

knotty steeple
#

you can set anything to commands.Bot also

lusty dew
#

^

knotty steeple
#

if he has it as client just replace bot in the code with client

jolly kiln
#

wildmaster, can you send the code where you declare your client

knotty steeple
#

not that hard

lusty dew
#

Rico question

jolly kiln
#

yes

lusty dew
#

Not very well

amber fractal
#

define your bot as thispieceoffuckingshitiworkon

jolly kiln
#

ok you can help him

lusty dew
#

wildmaster just replace bot with client

prime oriole
#

Ok i added the code but idk if it worked

lusty dew
#

test it out?

prime oriole
#

Its muted

lusty dew
#

oof

#

in your server

prime oriole
#

How?

lusty dew
#

.

amber fractal
#

run a command

prime oriole
#

Ok

lusty dew
#

I can't help this kid if he doesn't know how to run a cmd

knotty steeple
#

also btw this works in your message event

if msg.author.bot:
    pass
#

iirc

prime oriole
#

It didnt work

knotty steeple
#

havent used python in a while mmLol

prime oriole
#

The cmds wont run

jolly kiln
#

yeah ig he's not using rewrite

lusty dew
#

probably not

slim heart
#

samurai it looks right

#

:p

lusty dew
#

Samurai posted something?

#

oof just saw what he posted xD

#

Discord is taking a while to load things

#

Also with fs.writeFileSync

#

what does the encoding property do?

inner jewel
#

the encoding used for the data

lusty dew
#

AH ok

#

Thanks

slim heart
#

how can i make an express server mask itself with a different express server (lol)

knotty steeple
#

what

slim heart
#

like i have an express server right and then i can do something like app.use( qhniuoqhdiqwn whatever, then point it to 192.168.0.69

jolly kiln
#

@prime oriole since you don't use rewrite, you use the on_message event to direct the code to commands, right?

lusty dew
#

don't I do

#

msg.guild.channels.get(id)

#

to get a channel>

#

?*

amber fractal
#

if msg is your message object

lusty dew
#

Ye

prime oriole
#

Yes

jolly kiln
#

ok then do what samurai said

prime oriole
#

?

jolly kiln
#

at the start of the method

#
if [message].author.bot:
     return

replace [message] with whatever your argument variable name is

prime oriole
#

Wdym?

jolly kiln
#

did you code your own bot

#

and do you have experience with python/coding?

prime oriole
#

Yea

jolly kiln
#

can i dm you

prime oriole
#

Yea

quartz kindle
#

@slim heart like a redirect?

slim heart
#

no kinda like a map

lusty dew
#
    let code = Math.random().toString(36)
    if (err){
      let file = fs.writeFileSync(`${code}.txt`, err.stack)
      msg.guild.channels.get('538529927352287235').send(file)
    }

Is this how i'd write an error to a file and send the file to a specific channel?

slim heart
#

like its pointing to my other computer but want is that it redirects if it's actually there but since its a testing point i want it to say that its not open if its not

quartz kindle
#

like, you want to check if the server is reachable/working?

slim heart
#

yes and then if it is working then it uses that point

quartz kindle
#

you can use nginx for that

slim heart
#

h ow

quartz kindle
#

i have it on mine brb

slim heart
#

alright, thanks

lusty dew
#

Is that how i'd write an error to a file

#

and send it to a specific channel?

slim heart
#

no

#

ur sending the contents of that file to a channel

#

wait no

#

huuuuh

#

whatre ya doin

amber fractal
#

No, writeFileSync returns undefined

quartz kindle
#

@slim heart ```nginx
error_page 500 502 503 504 =200 @error;

    location @error {
            default_type application/json;
            return 200 '{"status":"ERROR", "error": "temporarily unavailable"}';
    }
amber fractal
quartz kindle
#

that's is my nginx config file

inner jewel
#

why are you writing a file

#

send it as a message

lusty dew
#

No

#

I want to do it this way

inner jewel
#

or, if too big, you don't need to write to disk to send a file

slim heart
#

oh alright so if it gets error 500-504(-501) it uses location @ Error?

lusty dew
#

and so does the person I am making the bot for

#

they also want me to write the error to a file

quartz kindle
#

yes

#

with status 200

slim heart
#

do i put that above or below location /

quartz kindle
#

anywhere i guess, i have it above

jolly kiln
#

Client.command()
async def help():
await client.say("msg")

slim heart
#

its doing the same thing tim

#

maybe the error codes arent right? im trying to fetch it to see what the code may be but im not getting anything lol

quartz kindle
#

here i get error 500 when node is not running

slim heart
#

wait it just worked

#

but it took a really long time

#

is there a way to fix that

quartz kindle
#

it works fine for me, like instantly

slim heart
#

i think its just waiting for the bad response

quartz kindle
#

do you get error 500 if you try to proxy it to a non-existing port?

#

in the browser

slim heart
#

it still does its thing where it takes forever

#

and then doesnt even give me a response cuz cors

lusty dew
slim heart
#

oh wait proxy nginx shit yea

#

tim like it works itll eventually do it but it just like takes forever to load

jolly kiln
#

*args = array

#

if that's what you mean kawaii

lusty dew
#

LK

#

K

#

thaanks

#

so I can do

#

mutetime = *args[1]

amber fractal
#

Well its not *

jolly kiln
#

mutetime = args[1]

#

(2nd element in the array/list)

lusty dew
#

Oh uea

#

Ue

#

Ue

jolly kiln
#

*args would be in the argument call

lusty dew
#

omg

#

ye*

amber fractal
#

you might want to also get the number out of it

lusty dew
jolly kiln
#

k

lusty dew
#

and it does the same thing as *args

#

I thnk

#

think*

amber fractal
#

*args is just a correction

#

its just args

jolly kiln
#

oh well now i realize i typed that wrong

#

but yeah lol

knotty steeple
#

tfw ur working on a bot list

quartz kindle
#

check the html source code

#

does it output anything?

lusty dew
#

Does Discord.py rewrite have anything equivalent to D.js try and catch>

#

?*

topaz fjord
#

I don't think you're allowed to ask questions about another botlist here

knotty steeple
#

ur not

quartz kindle
#

try catch is a language feature, not library

topaz fjord
#

I got in trouble doing that before

quartz kindle
#

pretty sure almost all languages have a try catch

knotty steeple
#

py has one

lusty dew
#

isn't it

#

try and except though?

#

not try and catch

#

or am I wrong

knotty steeple
#
try
    pass
except e as Exception
    pass```
lusty dew
#

Ye

topaz fjord
#

^

lusty dew
#

Thanks

topaz fjord
#

quick google search but no biggie

lusty dew
#

I didn't know if try and except was correct

#

I did google search it

#

but I didn't know if try and except was correct

quartz kindle
#

just google "try catch in languagehere"

cobalt dune
#

Hey so I was just wondering if you have any helpful sites or videos that would help me understand how to edit a message / embed using a bot.
All Im finding is how to edit a message within the code so message.channel.send(embed).then(e => { e.edit(embed2) })
Like a message you make in the code, I want to know how to be able to edit a message using a command and get the message id then it sends the edited version. I cant find any videos or anything on how to do something like that.
(using discord.js)

fluid spire
#

So I have this code

#
exports.run = async (client, message, args, level) => {
    try { 
    let botid = args[0];
if(!botid) return message.reply("you must specify a bot id that is on discordbots.org");
client.dbl.getBot(botid).then(bot => {
        

const embed = new Discord.RichEmbed()
    .setColor(randomColor)
    .setThumbnail(`https://cdn.discordapp.com/avatars/${bot.id}/${bot.avatar}.png?size=2048 `)
    .setAuthor(`${bot.username}#${bot.discriminator} (${bot.id})`, `https://cdn.discordapp.com/avatars/${bot.id}/${bot.avatar}.png?size=2048 `  )


  message.channel.send({
    embed
  });
    
});
    } catch (err) {
        message.channel.send("that bot is not on discordbots.org! It is possible that a different error occurred!!");
        console.log(err);
    }
};
#

Not complete whatsoever

#

But if I do

#

the command with args[0] as a random number

#

The error gets logged

#

404 not found in console

#

The message.channel.send("that bot is not on discordbots.org") part never sends :/

amber fractal
#

@cobalt dune you need a message object to edit a message. You can do this by storing it as it's sent, or getting it later <message>.edit([content], [options])

slim heart
#

with nginx im i have the basic_auth set up and .hwpasswd and what not and that all works great, but without saving the password it'll take another 5 minutes of being inactive on the page until it requires me to do it again meaning i can refresh all i want. is there a way to make it instantly require no matter what?

#

(more nginx yes zoomeyes)

nimble sky
#

What would be some ways to check for an alternate account?

earnest phoenix
#

Kind of hard without IP

#

But you could just call it as a possible alt if its under X days old

quartz kindle
#

@fluid spire try/catch doesnt work with .then() promises, only with await promises

#

if you use .then() you need to catch them with .catch() instead

earnest phoenix
#

q about JS: I have a variable that looks like this

const herbs = { 
"edible": 
[
{
"name":"Rosemary",
"desc": [
    {
        "info":"kkjjj",
    "source":"Wikipedia"
    },
    {
        "info":"kkjjj",
    "source":"Herb Cottage"
    }
    ]
},
{
    "name":"Lavender",
    "desc": [
        {
            "info":"kkjjj",
        "source":"Wikipedia"
        },
        {
            "info":"kkjjj",
        "source":"Herb Cottage"
        }
        ]
    }
]

}

I want to print out the wikipedia info from the first array using a string, so I used the find function:

let findsource = "Wikipedia"
let result = herbs.find(r => r.edible[0].desc.source === findsource);

console.log(result.edible.desc.info);

And ofc i'm thrown with an error, is there any way I can search from my array using a string? maybe I should use includes()?

#

o holy gosh thats a big message

#

Hello, so i want to make a website with user can input their text there but confused in her text things, I do:

<textarea class="materialize-textarea"># Text With Markdown In Here and I want it converted to html like I use `#` and want it convert to `<h1>`</textarea>
``` But at the page only shown with text like a normal text ( not converted )
I use `<p>text here</p>` for that text ^
#

nvm, I got it

quartz kindle
#

@earnest phoenix your array is inside edible not herbs

#

so it should be herbs.edible.find()

earnest phoenix
#

Thank you for answering my question @quartz kindle ! I added that in as you suggested but I’m still getting a type error 😞

quartz kindle
#

what error are you getting?

#

how does your code look like now?

earnest phoenix
quartz kindle
#

you're adding it as text, not as html

earnest phoenix
#

its html

#

in html file*

#

but its appear like a normal text :/

quartz kindle
#

well how does your code look like?

earnest phoenix
#

<p type="text/html">that long description here with markdown converted to html<p>

quartz kindle
#

where is that? in your bot's edit page?

earnest phoenix
#

Its in bot page

#

I use marked package to convert it

quartz kindle
#

in dbl?

earnest phoenix
#

no

quartz kindle
#

thats not dbl then

#

then show your code

#

your actual code, how are you converting/generating the page

earnest phoenix
#

:'/

quartz kindle
#

use ejs's unescaped html tag

#

<%- instead of <%=

earnest phoenix
#

lemme try

#

Nah its work

#

Thanks you very much Tim 😅

quartz kindle
#

👍

rustic obsidian
#

Oof html

earnest phoenix
#

Can you help me?

#

I have a problem

#

Cannot read property member of undefined

marble needle
#

mind posting a code snippet? think

earnest phoenix
#

No

#
client.on('message', (msg, message) => {
  if (message.member.roles.has(456693113130582018)) {
  if (msg.content === prefix + 'shutdown') {
setTimeout(shutreply, 60);
  msg.channel.send(":octagonal_sign: **Завершение работы**!")
function shutreply() {
  msg.react(":ballot_box_with_check:")
 };
setTimeout(shutdown, 120);
function shutdown() {
  process.exit(-1)
  }};
} else {
client.on('message', msg => {
    msg.reply(':octagonal_sign: **У вас недостаточно прав, обратитесь к @*Admin**');
})};
});```
#
  if (message.member.roles.has(456693113130582018))

Give error

glass linden
#
  if (message.members.roles.has(456693113130582018))
earnest phoenix
#

Ok, try

#

This not help

glass linden
#

Didn’t work?

marble needle
#

are you using djs?

earnest phoenix
#

No

#

This script to deny admins script for users

marble needle
#

which library are you using then

#

can't think of any that passes two message objects on the message event think

earnest phoenix
#

I use only discord.js

marble needle
earnest phoenix
#

what is it?

marble needle
#

discord.js lib code, the event only passes one parameter, why are you passing "msg" and "message"

earnest phoenix
#

i must use only one?

marble needle
#

yes

earnest phoenix
#

now

glass linden
#

Oh I didn’t even notice that

earnest phoenix
#

roles undefined

#

Why bot spam?

marble needle
#
client.on('message', msg => {
    msg.reply(':octagonal_sign: **У вас недостаточно прав, обратитесь к @*Admin**');
})};```
#

if you don't ignore messages sent by bots you will reply to your own bot

#

ending up in an infinite loop

#

there's also no point in having multiple listeners for the same event you can put everything into a single one

earnest phoenix
#

And if I want to use otherwise

#

@marble needle i want to check user role, if he not admin send he message

#

I make it

#

And get infinity loop

marble needle
#

give me a sec

earnest phoenix
#

@marble needle

#

Well, what is it?

marble needle
#

remove the second listener and add a check for bots

#

return if msg.author.bot is true

earnest phoenix
#

Can you write it?

#

I newbie

abstract crystal
#

no spoon feeding here, look-up documentation or some tutorials on a search engine called GOOGLE

marble needle
#

^ can't possibly give you any more hints

quartz kindle
#

@earnest phoenix ```js
// bad
client.on("message", msg => {
// something
})
client.on("message", msg => {
// something
})

//good
client.on("message", msg => {
if(msg.content === something) {
// something
}
if(msg.content === something) {
// something
}
})```

earnest phoenix
#

Thank

daring trellis
#

)

#

I'm noob

#

I write eval command for 2 users

marble needle
#
if(!(message.author.id === '</>' || message.author.id === '</>')){ . . . }```
daring trellis
#

Thanks

amber fractal
#

A better way would just to but ids into an array and see if the array includes the id or not

lofty hamlet
#

My code is this hastebin

#

I have a problem

#

When i use this command the number is false the bot add too many 0

#

🤔

quartz kindle
#

you're not converting to a number properly

#

its better if you convert it right at the beginning

#

achievement1 = Number(args.join(""))

#

also, you dont need to test for - to see if its negative

#

just check if its < 0

lofty hamlet
#

Thanks @quartz kindle i, go test

cobalt dune
#
    bot.on('guildMemberAdd', member => {
        let guild = bot.guilds.get("242022034257870849");
    bot.channels.get('361993945942589442').send(`Welcome ${message.member} to **${guild.name}**! You are user number **${guild.memberCount}**! :smile: \nPlease read [#445788244471447557](/guild/264445053596991498/channel/445788244471447557/) for the rules of the server and [#481606686419714068](/guild/264445053596991498/channel/481606686419714068/) for some useful information. If you would like special roles, you can opt in and get some in [#444235670685351953](/guild/264445053596991498/channel/444235670685351953/). If you need help with anything, don't hesitate to ask our staff team! \nWe hope you enjoy the server and may we meet again!`, {
        file: "https://cdn.discordapp.com/attachments/309443624020475904/519647531102109728/sdf.gif"
        });
});```
So I have this code to send a message in a channel to welcome someone. Problem is that I dont get any errors and it doesnt send the message, so I dont know what the problem is with it.
marble needle
#

wild guess but aren't you supposed to get guild.channels instead of bot.channels

knotty steeple
#

you dont have to get the guild to get the channel

#

i mean in eris you do but

marble needle
#

doublecheck the channel/guild ids and whether or not your bot even has writing access in said channel/guild

quartz kindle
#

Welcome ${message.member}

#

there is no message

cobalt dune
#

bot.channels.get works the same as guild.channels
Bot also is admin so it is able to send messages
I changed message.member to member and still nothing

marble needle
#

yea noticed that after checking the documentation, haven't touched djs in a while

inner jewel
#

pretty sure this isn't valid file: "https://cdn.discordapp.com/attachments/309443624020475904/519647531102109728/sdf.gif"

#

discord files can't be urls

#

you need to send the actual data

marble needle
#

according to their docs they accept remote sources

inner jewel
#

¯_(ツ)_/¯

#

try .catch-ing it

#

and console.log the error

marble needle
#

maybe cause he used file instead of files and didn't add the brackets

dusky marsh
#

^^

earnest phoenix
#

Yup

inner jewel
#

¯_(ツ)_/¯

dusky marsh
#

he still needs to make the files an array

#

either way

inner jewel
#

no

#

file: notAnArray vs files: [an, array]

#

reposting it after 30 seconds won't help you @uneven laurel

dusky marsh
#

file is deprecated

marble needle
#

depends on the branch he uses, its deprecated but might still work (should drop a warning)

inner jewel
#

anyway, even better way of finding what the error is there

cobalt dune
#

If I do the code with a command and send the welcome message includes the file, it sends alright. But I added it to the bot.on and it doesnt work so I think its something to do with it, but I dont know what because I searched it up and all seems right

inner jewel
#

is to .send(...).catch(console.error)

cobalt dune
#

Ill add the error and see what happens

marble needle
#

wouldn't his app crash with said error even if he doesnt catch it

dusky marsh
#

@uneven laurel Can you try to better format your question, I don't quite understand what you're trying to do.

cobalt dune
#

Theres no error

#

It should work, but the fact it doesnt and there is no error for it not happening is just confusing the hell out of me.

marble needle
#

isn't it kind of counter intuitive to have a command that tells people to use another command instead

inner jewel
#

@cobalt dune that code works for me

#
let bot = new (require('discord.js')).Client();

bot.on('guildMemberAdd', member => {
        let guild = member.guild;
    bot.channels.get('310856262235586570').send(`Welcome ${member} to **${guild.name}**! You are user number **${guild.memberCount}**! :smile: \nPlease read [#445788244471447557](/guild/264445053596991498/channel/445788244471447557/) for the rules of the server and [#481606686419714068](/guild/264445053596991498/channel/481606686419714068/) for some useful information. If you would like special roles, you can opt in and get some in [#444235670685351953](/guild/264445053596991498/channel/444235670685351953/). If you need help with anything, don't hesitate to ask our staff team! \nWe hope you enjoy the server and may we meet again!`, {
        file: "https://cdn.discordapp.com/attachments/309443624020475904/519647531102109728/sdf.gif"
        });
});

bot.on("ready", () => console.log("bot ready"));

bot.login(require("fs").readFileSync("token.txt").toString());```
cobalt dune
#

it worked? for you?

dusky marsh
#

Research the array.includes method @uneven laurel also as Rye said, it is kinda counterintuitive to do it that way

cobalt dune
#

Now Im super confused as to why it doesnt work for me

inner jewel
cobalt dune
marble needle
#

try it in a different channel with a different id, can't think of any other reason that might cause this to fail

cobalt dune
#

Ima try with my other bot, idk see if it works there.

#

I put the code in my testing bot and it worked great, just as I wanted so I will try to use a different channel then

#

Nope changed the channel and it still didnt work. So my bot just seems to not like this code

marble needle
#

did you use the code natan posted?

cobalt dune
#

I did

#

and I derped

#

I had to put bot bot.on"memberAdd" above the bot.on"ready" so it works now..

#

all this time and the issue was simple code placement..

#

I want to die

inner jewel
#

the order shouldn't matter

cobalt dune
#

well

#

it does in this case so

#

¯_(ツ)_/¯

#

at least it works

marble needle
#

wat

inner jewel
#

so the listener wasn't ever being added

marble needle
#

reporter damn didn't even notice

#

probably had it within the ready listener

#

if putting it above it worked

cobalt dune
#

hmm probably

#

lol but you should see my indentation lmao

#

its baaad

#

I dont even try to make it look good just press enter here, tab there xD

marble needle
#

that's gonna fuck you over sooner or later when your code becomes more complex and you need to take a solid 10 minutes to decipher your code because of bad readability hmm