#development

1 messages ยท Page 662 of 1

amber fractal
#

I do that lol

tight heath
#

I don't because ocd

#

I just do it correct from the start

amber fractal
#

because my indent is 2, but it auto corrects to 4 and I get annoyed

tight heath
#

Btw

candid lynx
#

xd

tight heath
#

nekiono/eslint-config-raven for good eslint

candid lynx
#

@amber fractal what ide?

tight heath
#

totally not mine

candid lynx
#

xD

amber fractal
#

I use vscode, I havent actually coded anything in like 2 months tho

candid lynx
#

i use atom

tight heath
#

vscode is dope for free editors

#

Atom is slow imo

candid lynx
#

hmm

tight heath
#

personally usually use sublime

candid lynx
#

i might use vscode

#

i had problems with that when using python

tight heath
#

just because it's lightning fast

candid lynx
#

unlimited free trial

tight heath
#

@candid lynx what was your js question tho?

#

And I actually have a paid sublime license

candid lynx
#

do you prefer making classes with the function() method or the class method

#

that something with constructors

#

like this

tight heath
#

ik what a class is lmao

candid lynx
#
class Food {
    constructor(name) {
        this.name = name;
    }
    
    getName() {
        return this.name;
    }
}
amber fractal
#

the class constructor was made to replace that method

tight heath
#

and obv with the class keyword

#

that's the reason it got implemented in es6

amber fractal
#

es6 good

candid lynx
#

yeah ik

#

but which do you prefer

amber fractal
#

class constructor

tight heath
#

Take a guess.

candid lynx
#

ok..

#

wth ur index.js is so short

amber fractal
#

most people's are

tight heath
#

that's because my code is clean

candid lynx
#

xd

#

mine is ... long

#

jk mine is 25 lines

amber fractal
#

except it's client.config now

#

and not client.privates

#

but that doesnt really matter

tight heath
#

@amber fractal why no EventHandler class

amber fractal
#

?

tight heath
#

Can I give you an honest opinion

candid lynx
#
const cfg = require("./config.json");
const discord = require("discord.js");

const bot = new discord.Client({disableEveryone: true});

bot.on("ready", async () => {
  console.log("Bot is online.");
});

bot.on("message", async message => {
  if(message.author.bot) return;
  if(message.channel.type === "dm") return;

  let prefix = cfg.prefix;
  let messageArray = message.content.split(" ");
  let cmd = messageArray[0];
  let args = messageArray.slice(1);

  if(cmd === `${prefix}ping`) {
    return message.channel.send("Pong!");
  }
});

bot.login(cfg.token);
#

mines code is different

tight heath
#

i have physical pain looking at either

#

@amber fractal can you run my eslint conf and count the amount of errors mmlulabravery

#

That's the ocd points I get

#

I'm jk; each to their own style

amber fractal
#

I normally dont make classes lol

#

Where is your eslint config?

#

eslintrc.json ?

#

small

tight heath
#

.eslintrc

#

And you can just install it

#

See readme

amber fractal
tight heath
#

No this is custom conf for the bot

#

A fork of mine btw

amber fractal
#

I dont want to get your hopes up by telling you I'll run it, in which I probably wont mmLol

broken shale
#

Why is this so popular now??

inner jewel
#
c
.
on
(
    'message'
    ,
    async
        function
        (
            {
                author
                :
                {
                    id
                }
                ,
                member
                :
                {
                    guild
                    ,
                    voice
                    :
                    {
                        channel
                    }
                }
            }
        )
        {
        }
)
;```
tight heath
#

because it's new

inner jewel
#

best code style

amber fractal
#

yes

candid lynx
#

wtf?

amber fractal
#

I agree

tight heath
#

|| was the same with spoiler ||

broken shale
#

Anyone who used md markdown before should know it though

amber fractal
#

It was never in discord before now

tight heath
#

@inner jewel put all control chars on the right

inner jewel
#

no

tight heath
#

And all text to the left

inner jewel
amber fractal
#

Imagine coding with text aligned left

tight heath
#

Yes

#

Thanks

amber fractal
#

why would you do this

tight heath
#

Yes

candid lynx
#

look at the brackets on the right

amber fractal
#

java is already mean

tight heath
#

Javython

amber fractal
#

you made it look worse

tight heath
#

java is chill

candid lynx
#

no its jython

tight heath
#

pyvaโ„ข

topaz fjord
#

pyva

#

Yes

tight heath
#

pip install pyva

#

actually

amber fractal
#

make it

tight heath
#

pip install npm

amber fractal
#

no

candid lynx
#

uhmm

tight heath
#

npm install gradle

amber fractal
#

npm install python

tight heath
candid lynx
#

if i was correct...

#

node is for javascript?

tight heath
#

yes

candid lynx
#

then why pip install npm

inner jewel
#

youc temp = x; x = y; y = temp;

vs the guy she tells you not to worry about c x ^= y; y ^= x; x ^= y;

tight heath
#

Woahhhh

#

Tho

#

[x,y,z] = [z,x,y]

#

In js

amber fractal
#

why have I never seen this

candid lynx
#

xd

#

a, b = b, a in python

inner jewel
#

but then you allocate an array

tight heath
#

But it's op af

inner jewel
#

xorswap ftw

tight heath
#

Noone cares about resources in js

inner jewel
#

meanwhile i'm writing code for stuff with 20kb of ram total

tight heath
#

Lmao

candid lynx
#

this is weird...

tight heath
#

The node runtime needs like 50

inner jewel
#

50 but 3 orders of magnitude greater

candid lynx
#

how large is node?

tight heath
#

big

#

Very

#

ok

#

Ok

candid lynx
#

hi

#

this channel is dead

earnest phoenix
spare goblet
#

no irrelevant posting in here thx @candid lynx

candid lynx
#

ohh ok

pallid zinc
#

    at item.request.gen.end (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)

    at then (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)

    at process._tickCallback (internal/process/next_tick.js:68:7)

(node:8970) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 16)```
#

What does it mean

west spoke
#

Can you even read

#

"Missing permissions"

#

it cannot send to the channel

pallid zinc
#

How can I write data with fs

#

It's only reading old data

late hill
#

Editing status when a shard connects in eris makes the shard disconnect bigconcern

pallid zinc
#

What does it mean

earnest phoenix
#

@pallid zinc fs.writeFile('')?

pallid zinc
#

Yup

earnest phoenix
#

JSON.parse(fs.readFileSync(''))

pallid zinc
#

I tried it

#

Both of them

#

It only read

earnest phoenix
#

writeFile('') // write

#

readFile('') // read

old geyser
#

so from my previous issues, how would one allow for collectors to not overwrite one another when they are triggered from multple servers

const quiz = require('./quiz.json');
const item = quiz[Math.floor(Math.random() * quiz.length)];
const filter = response => {
    return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};

message.channel.send(item.question).then(() => {
    message.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
        .then(collected => {
            message.channel.send(`${collected.first().author} got the correct answer!`);
        })
        .catch(collected => {
            message.channel.send('Looks like nobody got the answer this time.');
        });
});
earnest phoenix
#

Filter not defined?

#

Oh no i'm blind

old geyser
#

so just wrap the whole thing in an if and set the guild.id when its called?

late hill
#

Add it to your filter

#

Also

#

Doesn't channel.awaitMessages() create a messageCollector within that channel alone

#

I mean, that would make sense wouldn't it?

earnest phoenix
#

Yup message collector is better

#
a.createMessageCollector(filter, 3000)
})```
#

Something like this

#

Its in docs

#

@old geyser look that

late hill
#

awaitMessages() should work too?

earnest phoenix
#

Yes but awaitMessage is weird

#

awaitMessage is not really for quiz

old geyser
#

it works.. but if its triggered in another server, it overwrites the previous server

late hill
#

If that's the full code

#

Your problem is probably that your variables are global

#

Because you didn't add an identifier

#

const/let or at least var

old geyser
#

so if i make all the variables in the function let, it should fix the issue?

late hill
#

It's an issue

#

Are there more issues? Maybe..

#

Start by fixing that

frozen granite
#
id: ["id1", "id2"],```

im using this inside of a permissionOverwrites, is the format correct or no? please ping if you have an answer
![djs](https://cdn.discordapp.com/emojis/604235197356965888.webp?size=128 "djs")
old geyser
#

ok i think that was my issue

earnest phoenix
#

.overwritePermissions(id, { 'VIEW_CHANNEL': true 'SEND_MESSAGES': true 'READ_MESSAGE_HISTORY': true })

#

@frozen granite overwritePermissions for what?

#

and this format should be work

frozen granite
#

I want to use multiple ids

earnest phoenix
#

id its a properties of overwritePermissions and accept array

frozen granite
#

for multiple users

#

sorry it's for a new channel

earnest phoenix
#

yup so id: ['id', 'id2'],

#

Should be work

frozen granite
#

TypeError [INVALID_TYPE]: Supplied parameter is not an User nor a Role.

#

lol

earnest phoenix
#

Normal

frozen granite
#

I got it

#

dww :PPP xd

earnest phoenix
#

This error happened when the id is not in a string

#

or if its not a id

frozen granite
#

mm its just meant to look a little different @earnest phoenix

#
permissionOverwrites: [{
    id: "1234567890",
    allow: ["PERMS"]
},{
    id: "0987654321",
    deny: ["PERMS"]
}]```
earnest phoenix
#

Yea

#

I'm dumb

frozen granite
#

same

old geyser
#

what would vbe causing this to throw an error when it works fine everywhere else

if (!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES', false)) return;
                                                      ^
TypeError: Cannot read property 'me' of null
opaque eagle
#

Did u run that command in a DM @old geyser

spare goblet
#

on message event make sure you ignore channel.type dm

old geyser
#

no it checks if the bot itself can send a message in that channel then returns @opaque eagle

#

first time ive seen that error thrown

opaque eagle
#

yeah... but when u got that error, did u run the command in a DM

old geyser
#

im not sure, one of the servers did it

#

ill test it

opaque eagle
#

that's the only possibility

#

there's no other reason for Message.guild to be null

#

Like iara said, make sure you ignore DMs

old geyser
#

it shouldnt have as its under

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

ill test it

old geyser
#

anyway to force \u200b in js? when it ouputs it just ignores and doesnt do a space

earnest phoenix
#

Do default emojis like ๐Ÿ‘ have ids?

slender thistle
#

They are unicode

late hill
#

\u200b is a zero width space

#

Why aren't you using regular spaces

#

๐Ÿ‘€

old geyser
#

EXAMPLE OTHER EXAMPLE

#

need to add more spaces

#

but it just outputs as EXAMPLE OTHER EXAMPLE

mossy vine
#

because they are zero width spaces

earnest phoenix
#

use an ideographic space

#

\u3000

valid frigate
#

total noob to this but is a lower or higher highWaterMark value better when downloading a readable stream

#

e.g. ytdl allows you to provide this option, same with djs dispatcher.play(), but i'm not sure what would happen as a result of increasing/decreasing this value

smoky mica
#

how can i check permissions of a user?

#

discord.js

idle basalt
#

you cant

smoky mica
idle basalt
#

you can check permissions of a member though

smoky mica
#

I meant a member, sorry

idle basalt
#

you just linked it to yourself

smoky mica
#

i get [object Object]

idle basalt
#

youre trying to send json as a string

#

youll have to do something to the data

#

what are you trying to accomplish?

smoky mica
#

i'm trying to get something like this

idle basalt
#

member.permissions.toArray()

smoky mica
#

oh my god i skipped over that in the docs

idle basalt
#

all good

smoky mica
#

I'm retarded

idle basalt
#

happens to everyone

smoky mica
#

ig, thank you so much! <3

idle basalt
smoky mica
#

I got this mess lmao, and it shows the deprecated perms as well

#

I feel like idk what's going on rn ._.

smoky mica
#

@idle basalt

earnest phoenix
#

Is it possible to push JavaScript classes into arrays?

mossy vine
#

i think so

earnest phoenix
#

ok thanks

stray garnet
#

How to display the User Count

warm marsh
#

Display it where and what language?

stray garnet
#

In the Bot Status and d.js

warm marsh
#

The user count is <Client>.users.size

stray garnet
#

@warm marsh

warm marsh
#

filter the users

#

<Client>.guilds.reduce((prev, next) => prev + next.memberCount, 0);

#

something like that might work

#

or change memberCount to members.filter(member => !member.user.bot).size

stray garnet
#

Ok thx its Working now

late hill
#

Would still be wrong

stray garnet
#

hmm works for me

late hill
#

Contains duplicates?

stray garnet
#

no

late hill
#

It's just adding member counts unless I missed something

#

Users can be in multiple servers

stray garnet
#

Ik

#

its showing all users

warm marsh
#

Yeah, Duplicates will be shown.

smoky mica
#

Can you explain the code? @warm marsh

#

What's .reduce((prev, next) => prev + next.memberCount, 0);

quartz kindle
warm marsh
#

Thanks.

smoky mica
#

O, thanks. I didn't know where to look ๐Ÿ˜…

pallid zinc
#

fs.writeFile("prefixes.json", data).catch(console.error);

smoky mica
#

Is there a better way than this which I could use to get userinfo of some thorough idjs message.guild.members.get(args[0])

hybrid ruin
#

Seems fine to me as long as you validate it

smoky mica
#

What do you mean validate it?

cursive dagger
#

Make sure its a proper userid

hybrid ruin
#

If I were to type .example fwaeoijwefoij, I think you'd receive an error

#

^

smoky mica
#

Ah okay, true. Thanks!

cursive dagger
#

also converting mentions is also a good idea

hybrid ruin
#

Check if args[0] only contains numbers for example, and check if it actually returns something forehand

smoky mica
#

I do have it

#

this might be a bit wrong but this is my code

#

When I use the ID right now, everything works except name

cursive dagger
#

change up the order? If i think correctly the order you are using is mention > sender > id

smoky mica
#

oh sorry, noo

hybrid ruin
#

I think that's fine

#

Users are most likely to mention first, then check their own profile

#

People don't usually use IDs

smoky mica
#

mine's actually ``` let user = message.mentions.users.first() || message.guild.members.get(args[0]) || message.author;

hybrid ruin
#

Hmm

smoky mica
#

i was changing up the order

#

when i did this

warm marsh
#

@pallid zinc read the error....

hybrid ruin
#

What happens when you do z.userinfo fffff?

smoky mica
#

it would not go to the id and get the user of the author

#

Thana, it gets the info of the author then

hybrid ruin
#

300 IQ

smoky mica
#

XD

hybrid ruin
#

Looks good to me then

warm marsh
#

Quick question, Why are you use mentions.users || message.author then using guild.members?

#

Why not just use members the whole way.

smoky mica
#

But why I do get name as undefined

warm marsh
#

name?

#

For what?

smoky mica
#

But why I do get name as undefined*

warm marsh
#

Name of what?

warm marsh
#

because of the members bit

cursive dagger
#

Can we see your entire command code instead of just snippets?

warm marsh
#

let user = message.mentions.members.first() || message.member || message.guild.members.get(args[0]);

smoky mica
#

Lemme see

#

I just removed it Dillon

warm marsh
#

removed members?

#

let user = message.mentions.users.first() || message.author || message.guild.members.get(args[0]).user;

#

or use that if you really want to use user.

#

<GuildMember> and <User> are different things which means they've got different methods and properties although a few are the same.

smoky mica
#

Oh it worked!

#

I think it's cause I added user at the end of args

#

let user = message.mentions.members.first() || message.guild.members.get(args[0]).user || message.author;

warm marsh
#

๐Ÿ‘

hybrid ruin
#

Seeing other devs excited will always make my day lol

smoky mica
#

Haha same

#

Sometimes its so stupid

hybrid ruin
#

Yeah

warm marsh
#

Yeah, Because you had member before not user.

hybrid ruin
#

Didn't know you 100% needed the user object for this

#

But it makes sense

warm marsh
#

@smoky mica change message.mentions.members.first() to message.mentions.users.first()

#

because you changed the other part that must go back.

smoky mica
#

Yep I just changed it back but now because I added user at I get another error

#

So how I had it setup was if you do z.userinfo it gets the info of the user /member who typed it

#

if you typed z.user @mention it gets the info about the mentioned user

warm marsh
#

Ok?

smoky mica
#

but i wanted to add for ID as well and now that it works because i added .user to message.guild.members.get(args[0])

#

it gives me an error of undefined lol

#

TypeError: Cannot read property 'user' of undefined

warm marsh
#

because can't find the user

smoky mica
#

gimme a sec

warm marsh
#
let member = message.members.mentions.first() || message.member || message.guild.members.get(args[0]);
#

but you won't need to do that, Your error comes from invalid ID.

smoky mica
#

Let me see

late hill
#

or it's a user that's not cached?

hybrid ruin
#

It is. He tried it out with his own user ID

#

I was thinking of the same but that doesn't seem to be the case

smoky mica
#

I confused all of you guys lmao

hybrid ruin
#

XD

#

Perhaps go for some rubber ducking

#

Read your code out loud and explain each line to yourself

smoky mica
#

Basically I made it work with the ID but now when I type z.userinfo it gives me undefined error

#

hahah i'ma get off for now, don't have time as well

warm marsh
#

Cya!

hybrid ruin
#

Sure thing, lets hope we can resolve it when you return

#

Take care

smoky mica
#

Thanks :)

mossy vine
#

okay its absolutely not related to that

#

my bot just refuses to start

loud salmon
#

@mossy vine smh cyber just google it

mossy vine
#

okay, so all bots just refuse to start

#

spider, thats not my issue anymore

loud salmon
#

o h

mossy vine
#

node by itself works

#

but my bots absolutely refuse to do anything

#

multiple bots made with different libraries

#

it just doesnt work

#

bots refuse to start. nothing is logged and they dont connect

#

adding a console.log that doesnt depend on the bot works

#

refuses to load further

quartz kindle
#

it doesnt even install its packages?

mossy vine
#

it did have packages installed

#

i removed node_modules and appearently cant install shit anymroe

quartz kindle
#

reinstall node? lul

#

reboot the server?

mossy vine
#

node isnt the issue

#

it runs stuff just fine

quartz kindle
#

if it cant install packages it is an issue with either node or npm

#

or soemthing else causing this issue in them

#

if you reinstall node, npm should also be reinstalled

#

or you can try cleaning the npm cache

mossy vine
#

the server panel is not accessible

quartz kindle
#

then your server is having issues?

mossy vine
#

maybe the host is still doing maintenance

#

fucking hell why does it take over 15 hours

quartz kindle
#

which host is it?

mossy vine
quartz kindle
mossy vine
#

time to consult google translate

#

thanks

#

their website isnt fully translated and i have a hard time navigating it lol

quartz kindle
#

wait if you're not french why are you using a french vps?

mossy vine
#

becuase its cheap af

#

for a few hours

#

yes its been 15-16 hours at least

quartz kindle
#

lmao

mossy vine
#

Saturday, July 24 7:00:

The equipment has been moved to the DC de Lyon, we are completing the network configuration.

smoky mica
#

rip

mossy vine
#

welp

#

time to reconfig pm2

quartz kindle
#

lmao

tight heath
#

npm reconfig pm2

peak quail
#

can i return if the err.message is = RangeError: RichEmbed field values may not exceed 1024 characters.

slim heart
#

You should probably just make sure theyโ€™re below the limit before hand?

smoky mica
earnest phoenix
#

too much fields, unreadable

#

you can combine the members, online & offline, idle, dnd into one imo

smoky mica
#

I can't lol

earnest phoenix
#

why not

smoky mica
#

Tell me how

earnest phoenix
#

field name Members, field value Total: num\nOnline: num etc

smoky mica
#

Oh, hmm that might work.

#

this is the best it will look lmao, might just revert to the 'new' one and remove idle, dnd and something else

#

wait one sec

#

I hadn't disabled the fields but now after disabling it, it looks worse lmao because of uneven fields

topaz fjord
smoky mica
#

That does look good.

#

WAIT IS THAT BLACK THEME

#

WHAT

#

@topaz fjord how did you get black theme what

halcyon nymph
#

Does anyone have any idea how to make it so i can send messages in a check function in client.wait_for_message

Cus I'm trying to do this

async check(message):
   if message.content == 'testing phrase':
      await client.send_message('well done')
      return True
   else:
      return False

@client.event
async def on_message(message):
   await client.wait_for_message(message.channel, check = check)

i dunno if this is possible

topaz fjord
#

Anyone it works in Samsung s9 and note9 without root

#

Every other phone needs root

#

And it's for android

#

Oh and one more thing

#

Doesn't break discords tos

halcyon nymph
#

But, i get an error saying check was never awaited

smoky mica
#

@halcyon nymph what lang and lib is that

opaque eagle
halcyon nymph
#

But, don't link me to the docs

smoky mica
#

Guessed so but idrk much about python

opaque eagle
#

Pretty easy to identify

halcyon nymph
#

the docs don't say anything about it

smoky mica
#

Oh thanks a lot Turtle, my bro has s9+ but I don't xD

halcyon nymph
#

I don't think you're really supposed to do it, but for my purposes I need it

tight heath
#

@topaz fjord thanks

topaz fjord
#

what

#

?

tight heath
#

That app is a++

topaz fjord
#

Oh

#

Yes very much

#

U have an S9/note9 I'm guessing

tight heath
#

I have successfully made Discord pink

topaz fjord
#

no please

tight heath
#

S9 as replacement phone

topaz fjord
#

Why ravy

#

why

tight heath
#

Yes

#

Jk it's just the accent color

#

I'm using Ocean dark

topaz fjord
#

Also replacement o_O

#

Oh I'm using pitch black

tight heath
#

OP5T in repair

topaz fjord
#

Since

#

Battery is very gud to save

tight heath
#

This is my dad's old one

topaz fjord
#

Oh

tight heath
#

he now has an OP7Pro per my recommendation

topaz fjord
tight heath
#

Also Discord with pink accent is op

topaz fjord
#

You won't be able to use the app on op5t

tight heath
#

Root

#

/shrug

topaz fjord
#

I use #008ecc

#

also did u turn the screen to high res

tight heath
#

If it doesn't work with root I'll use Substratum

topaz fjord
#

Substratum gay

tight heath
#

Substratum is super op

topaz fjord
#

Nah

tight heath
#

Galaxy S6 with substratum

#

2017

topaz fjord
#

Swift installer super op

topaz fjord
#

Ravy

#

This is development

tight heath
#

Substratum on RR

topaz fjord
#

I just realized

tight heath
#

Oh

topaz fjord
#

Uh we should move this convo

tight heath
#

Well then let's talk about me developing custom roms

#

For the S6

topaz fjord
#

lmao

#

I need to find a rom

tight heath
#

I used to

topaz fjord
#

for my 6p

tight heath
#

Back in '17

topaz fjord
#

But my 6p ded

tight heath
#

6p what

topaz fjord
#

Nexus 6p

tight heath
#

Ah

#

Good phones you say

#

Well uh RR

#

Best ROM

topaz fjord
#

I got pixel experience

#

but now the phone won't charge and stop bootlooping

tight heath
#

Flash stock via adb?

#

And then retry?

#

Or, if you have access to twrp use that

topaz fjord
#

I mean I'd let it be

#

Since I'll file a claim and get up to 400 dollars back

tight heath
#

Gotem

smoky mica
tight heath
#

Thanks Mr. Minimod

smoky mica
#

XD

topaz fjord
#

We're talking about developing custom roms

pallid zinc
#

โ€‹ if(!args[0] || args[0 == "help"]) return message.reply("usage: !prefix") 

prefixes[message.guild.id] = {

prefixes: args[0] }; 

fs.writeFile("./prefixes.json", JSON.stringify(prefixes), function(err) { //your original code

if (err) console.log(err) }) let data = JSON.stringify(prefixes); console.log("start to write data"); 

fs.writeFileSync("prefixes.json", data, function(err){

if (err) console.log(err).then(message.channel.send(err))
 })
 let sEmbed = new Discord.RichEmbed() 
.setColor("#FF9900") 
.setTitle("Prefix set")
 .setDescription(`set to ${args[0]}`)
 message.channel.send(sEmbed) };```
#

const args = message.content.slice(prefixes.length).trim().split(/ +/g);

const command = args.shift().toLowerCase(); ```
#

โ€‹โ€‹```
#

The problem is it is writting the prefix in prefixes.json but it is not responding with prefix

quartz kindle
#

why are you writing twice?

pallid zinc
#

What

quartz kindle
#

fs.writeFile
fs.writeFileSync

late hill
#

args[0 == "help"] megunani

quartz kindle
#

also, writeFileSync doesnt take a callback

pallid zinc
#

Wesley it work

#

Come in test

quartz kindle
#

"it will work" Lol

#

args[0 == "help"] = args[false]

smoky mica
#

shouldn't it be args[0] == "help"

pallid zinc
#

Leave this

#

I want to know why it's not responding with any prefix

smoky mica
#

uhh buddy..

pallid zinc
#

I will fix that later

smoky mica
#

do you not have a command handler

pallid zinc
#

Yup

quartz kindle
#

the reason is that probably one of your problems is causing it to get stuck

pallid zinc
#

Ok

quartz kindle
#

so fix your problems, and the problem will fix itself

pallid zinc
#

But it's writting data in prefixes.json file

smoky mica
#

I hate multiple prefixes, but I might implement it in my bot lmao idk

quartz kindle
#

its writing twice and getting stuck in one of them probably

earnest phoenix
#

want to hear an awesome solution? don't use json files as a database

topaz fjord
halcyon nymph
#

@earnest phoenix Thonk

late hill
#

Should also consistently use semi-colons

tight heath
#

+rep to @earnest phoenix

opaque eagle
#

+rep 2x to cry

pallid zinc
#

Cry I am noob in database so I use json

earnest phoenix
#

it's not an excuse

pallid zinc
#

It is

#

I have to learn

tight heath
#

using mongo is easier than json changemymind

pallid zinc
#

Mongo I never tried

#

It can be

earnest phoenix
#

"i don't know maths ergo that means i don't have to know what 4+6 is"

tight heath
#

json is prone to data loss

#

and hella slow

earnest phoenix
#

not to mention, strict formatting rules and very constraint data types

tight heath
#

excuse me K/V redis

#

tell me about constraint data types

opaque eagle
#

lol

earnest phoenix
#

i only use sql databases like a pro ๐Ÿ˜Ž

tight heath
#

I don't like SQL because it's like embedding another language into your project

#

SQL itself is cool tho

earnest phoenix
#

i usually use ORM frameworks because sometimes writing sql yourself is a headache

tight heath
#

i use mongo because it's ez and it works

#

and sometimes redis for caching

#

@languid dragon are you ok sir

#

do you need love

earnest phoenix
#

best database discord, store all of your data in discord text channels as messages wesmart

tight heath
opaque eagle
#

Postgres + Redis = โค

pallid zinc
#

I will try mongo

runic barn
#

SQL based databases like postgres are much easier to use imo due to better documentation and better resources to read from

amber fractal
#

mongo docs work tho

pallid zinc
#

I think if your are master in any database that will be best for u

stray garnet
#
  
  const embed = new Discord.RichEmbed()
      .setColor("RED")
      .setTitle("Ayo - Welcome")
      .setDescription(`Hello ${member.user}, welcome to ${member.guild.name}\n We are now ${member.guild.memberCount} Users!`)
      .setThumbnail(member.user.avatarURL())
  
  member.guild.channels.find(c => c.name === "welcome").send({ embed }) 
  
});```

it dont sends an message in the welcome channel when an User joins
topaz fjord
#

does the welcome channel exist

stray garnet
#

yes

amber fractal
#

any errors?

stray garnet
#

no

amber fractal
#

is the code running

stray garnet
#

Yes

pallid zinc
#

U send in wrong way

#

.send({ embed })

#

Change this with .send(embed)

#

@stray garnet

spare goblet
#

@pallid zinc, <channel>.send({embed}) works also. blobsmilehappyeyes

pallid zinc
#

Nah

#

.send({embed:{

}})

spare goblet
#

Yes it does naniwdym

valid frigate
#

ok so I asked this yesterday but what exactly does highWaterMark do

pallid zinc
#

It's the right thing

spare goblet
#

@pallid zinc .send({embed}) works in discord js bearieyawnle

hollow saddle
#

^

#

Itโ€™s just an object shortcut

#

Instead of using .send({ embed: embed })

pallid zinc
#

I mean just remove {}

west spoke
#

Cache.

#

Wait at most 5 minutes

slender thistle
#

It could be kicked from this server

west spoke
#

-bots @slow crypt noembed

gilded plankBOT
#

Fear#7005's bots:
@proven plank

west spoke
#

Yeh it gone

smoky mica
sick cloud
#

both ugly bloblul

slow crypt
#

@slender thistle

#

Why is it kicked ?

smoky mica
#

@sick cloud lmao still better than before

sick cloud
#

why show raw data though

#

don't even format it

smoky mica
#

What raw data?

#

The region and verification level?

sick cloud
#

and you just provide a date and stuff

#

its not really human consumable

#

just format stuff a bit nicer

smoky mica
#

I love the icon for your guild

#

I'm gonna work on the date

sick cloud
#

it's my logo bloblamp

smoky mica
#

very cool haha

#

what lib do you use?

swift topaz
#

how do I make
something like this

inside a message.channel.send( )

#

that

mossy vine
swift topaz
#

yeah but what if I need to put ${params}

mossy vine
swift topaz
#

ooh thanks

smoky mica
#

I don't think you need that man \

mossy vine
#

you do

#

otherwise it will completely fuck it up

#

you need to escape it in the string

#

and you do that with a backslash

sick cloud
#

@smoky mica discord.js master but i'm moving to eris next release

indigo geyser
#

[Python] how can I check if a channel is nsfw?

sick cloud
#

channels should have some variable like nsfw or is_nsfw i guess

indigo geyser
#

Oke

#

Thanks

smoky mica
#

@sick cloud i was wondering if i should move to eris but can you explain why you're moving to eris?

sick cloud
#

eris uses shit less loads of memory and it's somewhat nicer

#

like my bot currently uses 4gb of memory over 16k servers/9 shards but eris is bringing it to <1gb

swift topaz
#

I always have this problem in message.bot.user wherein the user is always undefined

#

how do I fix this

#

specifically

const permissions = voiceChannel.permissionsFor(msg.bot.user);
    if(!permissions.has('CONNECT')){
        return msg.channel.send("Puff, puff, Jigglypuff, puff! (I don't have permission to join the voice channel. Please give me a permission first!");
    }
    if(!permissions.has('SPEAK')){
        return msg.channel.send("Puff, puff, puff, puff! (I don't have permission to speak in the voice channel. Please give me a permission first!");
    }```
#

help

hollow saddle
#

User isnโ€™t a property of bot

#

Itโ€™s the other way around

#

Bot returns a Boolean

swift topaz
#

but in the tutorial I'm following (again) it's like that

slow crypt
#

Can someone help me with

swift topaz
#

bot is the variable for my Discord.Client

slow crypt
#

Reply embeded msg

sick cloud
#

what tutorial

slow crypt
#

On hey

mossy vine
#

bot is definitely not available under msg tho

slow crypt
#

D.js

sick cloud
#

its message.client

#

usually

swift topaz
#

and his is msg.client.user

#

yeah it is but here's mine const bot = new Discord.Client();

mossy vine
slow crypt
#

What us code for replying to hey with embeded msg hey

mossy vine
#

The client that instantiated the Message

hollow saddle
#

Thatโ€™s why most people donโ€™t define their client instance as bot as it intercepts the bot properties

mossy vine
#

wait

hollow saddle
#

Oh wait

mossy vine
#

yeah that should work

hollow saddle
#

Yeah I misread

mossy vine
#

wait no

hollow saddle
#

No it shouldnโ€™t

mossy vine
#

@swift topaz you need msg.client anyways, because its a property of the Message object

#

it doesnt matter that you defined it as bot, it doesnt modify the property name

swift topaz
#

ohhh I see

#

thanks Cyber!

smoky mica
#

@sick cloud woah! i might switch to eris then but wouldn't i have to rewrite my bot? idk how similar discord.js and eris is

mossy vine
#

pretty similar

#

you will need to rewrite a few things

late hill
#

There's no reply function

#

And send is createMessage

#

There's also no class for embeds like in discord.js

#

Those are probably the main things you'll have to change

#

And collectors and stuff

#

You'd have to create your own if you're using those

sick cloud
#

^

#

it's a bit different

smoky mica
#

oh god i'll see ahah and also i don't use the message.reply function

#

I forgot when I submitted my bot but it must be somewhere in january, and if i looked at it now, i'd like DISGUSTING

#

i quit from around half of feb and came back in may i guess and i'm so happy how much i changed my bot and learnt so much

peak quail
#

how can i write a file without overwriting ||(fs) (txt)||

quartz kindle
#

@peak quail append to file?

onyx summit
#

what could be the cause of gc running a lot?
producing a lot of garbage?
(nodejs)

runic barn
#

is it a bad idea to run asyncio.sleep for 12 hours in python?

slender thistle
#

depends on what you want to do

#

It's used though and isn't blocking so I'd say you're safe

runic barn
#

It's for the on_dbl_vote event to remove a user's status in the database. I just don't want to bother with timestamps again

slender thistle
#

Yeah I believe it's fine but keep in mind it isn't persistent between restarts

runic barn
#

Oh, true. I guess there's no avoiding timestamps for at least checking people's statuses when the bot restarts.

valid frigate
#

you could run a cron job every say hour or so to check votes

#

and store what time they voted in a db, if by the time the cron job runs and it's been >12hrs you can remove it

#

this is generally speaking since i dont know anything about py but it should do what you want

runic barn
#

Yeah, I'm thinking about doing that instead. It won't be super precise, but it should get the job done.

#

I may put the check to each 1 minute

hybrid river
#

how to send post request to dbl to post servercount

amber fractal
#

Lang?

hybrid river
#

JS

amber fractal
#

Do you have dblapi.js?

#

or are you using something else

hybrid river
#

can i send post request by using node-fetch

amber fractal
#

You can use anything that can post

#

1 sec

#

at the bottom

#

idk why we cant link it

#

directly

#

or if we can I cant see it lol

hybrid river
#

yes but when i try it, it says "{ error: 'Unauthorized' }"

amber fractal
#

Use the Authorization header with your dbl token for that bot

hybrid river
#

Okay

#

thanks

#

the response now is { hello: 'world' }

amber fractal
#

uh

#

how did you post

topaz fjord
#

what link are you posting to

hybrid river
topaz fjord
#

are you trying to post stats

hybrid river
#

Yes

topaz fjord
#

post to /api/<id>/stats

amber fractal
hybrid river
#

Okay

topaz fjord
#

with the json body as { 'server_count': amount }

hybrid river
#

{ error: 'Not Found' }

#

oops

amber fractal
#

Which bot are you trying to post for?

hybrid river
#

i post to https://discordbots.org/api/531147148385845258/stats is it correct?

amber fractal
#

both your bots have counts

#

and if that's the id of the bot, it's correct

slender thistle
#

/api/bots/id

hybrid river
#

ok

amber fractal
#

what?

hybrid river
#

yes this one works

amber fractal
#

api/bots/id gets a bot

#

that's not where you post tho

hybrid river
#

oops

slender thistle
#

await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload)

#

dblpy sends POST request to /bots/id, works

hybrid river
#

also

amber fractal
#

he's in js

slender thistle
#

Does it matter

hybrid river
#

in browser and in console

#

so its not correct

slender thistle
#

Same URL, different request types

amber fractal
#

ofc you couldnt open it in browser

hybrid river
#

ikr

amber fractal
#

it's a post request

hybrid river
#

Im sending post request in my code

#

to that url

amber fractal
#

can you send your code?

#

just edit out your token

hybrid river
#

okay

#
  fetch('https://discordbots.org/api/531147148385845258/stats', {
        method: 'POST',
        body: JSON.stringify(data1),
        headers: {'Authorization':  'No' }
  }).then(res => res.json()).then(json => console.log(json));
amber fractal
#

you forgot something

hybrid river
#

What

amber fractal
#

/api/bots

#

you just do /api/id

hybrid river
#

oh sh

amber fractal
#

api/bots/id/stats

#

should work

hybrid river
#

wait

#

FetchError: invalid json response body at https://discordbots.org/api/bots/531147148385845258/stats reason: Unexpected token < in JSON at position 0

amber fractal
#

I dont use node-fetch

#

try it without the res.json()?

hybrid river
#

Wait a minute

amber fractal
#

just log the res maybe if you want it

#

not sure tho

inner jewel
#

res.text() then log that

hybrid river
#

Getting "Unauthorised" when trying to post

#

:/

#

OH wait

#

i did typo

opaque eagle
#

Does it work now? @hybrid river

hybrid river
#

i dont know

#

i see {} in the console

opaque eagle
#

Are you literally putting in 'No' for 'Authorization'?

hybrid river
#

no

opaque eagle
#

Alright

hybrid river
#

im using auth key from my bots in dbl api docs

opaque eagle
#

Yeah, that's fine

#

Apparently it does return an empty object

hybrid river
#

Oh thanks

wheat carbon
#

So for this channel I can ask for help with making a discord bot?

opaque eagle
#

Yes

wheat carbon
#

Ok

#

Thaanks

opaque eagle
#

Umm yw I guess

zinc furnace
#

Hello

runic barn
#

Hi

hybrid river
#

mmm

sharp current
#

mmmm

hybrid river
#

So i send post requests to discordbotlist for server_count but its not updating

hybrid river
#

halp

slim heart
#

@hybrid river give it a second to update, caching and other shenanigans happen in between

#

Should be updated by now tho?

hybrid river
#

it does nothing

#

i just see {} as response from dbl

#

but its not updating anymore

slim heart
#

Updating gives a {}

hybrid river
#

@slim heart

slim heart
#

Iโ€™m still here

hybrid river
slim heart
#

No

sharp current
#

I don't

hybrid river
#

Then

sharp current
#

There might be a limit on how many servers your bot has to be in before it shows

slim heart
#

Are you using the official api library

hybrid river
#

im using nodefetch to make post requests

#

i dont use lib

slim heart
#

Use the dedicated library

#

For js

hybrid river
#

.

slim heart
#

Youโ€™ll get way more support and tbh this is likely an issue on your end which just simply wonโ€™t be an issue if u use the dedicated library for doing so

sinful lotus
#

or you are just doing your request wrongly so why not just show your code

amber fractal
#

he did

hybrid river
#

nevermind im not using post request for dbl

#

i will use slow dblapi.js

amber fractal
#

uh

#

I think node http is faster than node-fetch

#

not sure tho

#

and why does it matter how fast it goes Thonk it's not like you're posting every 10 seconds

hybrid river
#

yes

#

but sending one post request is faster than loading whole libary with not needed things like webhooks and etc

#

when i just need to post guild stats

candid lynx
#

so

#

uhh guys

#

do you prefer eris or discord.js?

#

hmm ๐Ÿค”

shy rose
#

eris

candid lynx
#

why so?

shy rose
#

lighter on ram

candid lynx
#

oh

shy rose
#

and doesnt leak

#

djs has certain cases where it can start "helping" that makes it a leak

amber fractal
#

Havent had that issue on master ever

#

I run like 10 bots on a 2gb ram vps mmulu

earnest phoenix
#

2 guilds on each bot with no activity ๐Ÿ™ƒ

amber fractal
#

Well when I ran pet bot on my vps it was fine

storm grail
#

hi im using .net for my bot

#

seems that commands are taking ages to execute, as in they arent even taken to the command handler that fast

#

anyone seen this problem before?

sick cloud
#

shit host probably

real cedar
#

Use something like one of vultr high end ( expensive but if you want good vps)

#

@storm grail

storm grail
#

i am self hosting rn

#

turns out a guild member update event was constantly firing

#

not sure why

#

so i didnt add in to ignore bots and for some reason they make it fire constantly

earnest phoenix
#

Does anyone know why requiring module B in module A, then requiring module A in module B returns undefined or blank? (Node JS)

#

Nevermind I think I was able to figure it out.

stone dust
#

what did you find?

earnest phoenix
#

Instead of requiring a module as a single object through module.exports = local, I defined the exports I needed, so I did module.exports.Vars and modules.exports.Funcs.

#

@stone dust

stone dust
#

ah cool cool

#

thanks

earnest phoenix
#

why does it take so long for the vote list to update -_-

peak quail
#

    const talkedRecently = new Set();

    if (talkedRecently.has(message.author.id)) {
      message.channel.send("Wait 1 minute before getting typing this again. - " + message.author);
} else {

     // the user can type the command ... your command code goes here :)
  message.channel.send("LAL")
  // Adds the user to the set so that they can't talk for a minute
  talkedRecently.add(message.author.id);
  setTimeout(() => {
    // Removes the user from the set after a minute
    message.channel.send("Timeout")
    talkedRecently.delete(message.author.id);
  }, 6000);
}

why it always saying LAL but not "Wait 1 minute before getting typing this again. - " + message.author

stone dust
#

if you're creating the set on the line before the if check then it'll always be empty

ember atlas
#

Is this the start of an exec command? require().execSync(args.join(' '))

#

Ping cuz might be sleeping

sick cloud
#

are you even requiring anything

stone dust
#

oh i guess they're sleeping

ember atlas
#

Iโ€™m not

#

Imma require child_process

stone dust
#

oh hello

#

yeah i think thats good

earnest phoenix
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print('Received an upvote')
        print(data)
#

This doesnt print any data

ember atlas
#

@stone dust as long as I require child process in that line it should work as a command right?

stone dust
#

i think so yeah

ember atlas
#

Do I have to do message channel send or something

stone dust
#

runs on your terminal (or whatever) though so might be risky

ember atlas
#

I want it to send to channel

stone dust
#

i think so? it does return a buffer object which you would have to go thru and convert to a string

ember atlas
#

Looking for a exec command to send the executed code to the channel

twilit rapids
#

stdout is a string iirc

stone dust
#

tried testing and got buffers in a couple instances

#

you're probably right though

ember atlas
#

Ya I was looking for a simple classic exec command always fails

twilit rapids
#
require('child_process').exec(`The thing you want to do `, (err, stdout, stderr) => message.channel.send(stdout, { code: 'css' }));
ember atlas
#

Thatโ€™s literally an exec command

#

?

twilit rapids
#

That's what I use for it

ember atlas
#

Oh

#

And what does it output when you use it

twilit rapids
#

whatever the console would output if you would run it there yourself

ember atlas
#

Ah

#

Also I can do like args.join(' ') so I can input something right

twilit rapids
#

Yes

ember atlas
#

Perfect ty

earnest phoenix
#
    async def update_stats(self):
        while not self.bot.is_closed():
            print('Attempting to post server count')
            try:
                await self.dblpy.post_guild_count()
                print('Posted server count ({})'.format(self.dblpy.guild_count()))
            except:
                print('Failed to post server count')
            await asyncio.sleep(1800)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print('Received an upvote')
        print(data)

There is no output of votes or anything however the update_stats function works?

#

Please help, I cant see what I'm doing wrong

slender thistle
#

Make sure your port is open and forwarded

earnest phoenix
#

If it wasnt port forwarded then I wouldnt be able to post the server count

#

But I can

#

Its the on_dbl_vote that isn't printing any data

slender thistle
#

How would you be unable to post guild count if your port wasn't forwarded

earnest phoenix
#

ah

#

What port should be forwarded

slender thistle
#

The one you use in webhook_port in dblpy's Client args

earnest phoenix
#

Thank you

#

I'm a nonce

slender thistle
#

๐Ÿ‘Œ

earnest phoenix
#

Its a TCP port right?

slender thistle
#

Yeah, should be

earnest phoenix
#

Ah thats odd man

#

Nothing

slender thistle
#

I opened both TCP and UDP /shrug

earnest phoenix
#

Its weird because when I check for the vote bool, it shows astrue

#

Someone voted and apparently didnt get their reward

#

I'll open UDP

#

and hopefully it works lol

#

Still nothing

#

):

earnest phoenix
#

For some reason, I keep getting similar errors from dblapi which is from discordbots.org Error: 503 Backend fetch failed File "/app/node_modules/dblapi.js/src/index.js", line 118, in IncomingMessage.res.on const err = new Error(`${res.statusCode} ${res.statusMessage}`); File "events.js", line 203, in IncomingMessage.emit File "domain.js", line 448, in IncomingMessage.EventEmitter.emit File "_stream_readable.js", line 1129, in endReadableNT File "internal/process/next_tick.js", line 63, in process._tickCallback

mossy vine
#

5xx error codes mean its not your fault

earnest phoenix
#

Ok

#

```console.log(Shutdown in progress...)
console.log(Shutdown in 5 secs...)
console.log(Shutdown in 4 secs...)
console.log(Shutdown in 3 secs...)
console.log(Shutdown in 2 secs...)
console.log(Shutdown in 1 secs...)
console.log(Shutdown now...)

let Windows = WSH.BuildVersion('windows10').console.error();
Windows.switch("windowsxp").catch(err => {
if(err) {
console.log(err)
}
})
if(Windows.BuildVersion == "windowsxp") {
Windows.shutdown()
} else {
console.log("fuck u")
}```

#

lol

analog garden
#

neat ^

earnest phoenix
#

Hey guys little help

#

Got no clue what to put here

slender thistle
#

Anything you want

#

It's a password for your webhook

earnest phoenix
#

Ah yes sorry I didnt clarify

#

Do I put it in quotations

#

Alsooo where do I call on_dbl_test

candid knot
#

.

pale marsh
#

]]dotpost @candid knot

covert turtleBOT
#

Please do not post random punctuation marks or letters to clear your messages and/or to get attention. This is considered spam as you are not contributing anything to the conversation. Should you need to get the attention of the chat, simply start by saying hello. Should you need to clear your messages, right click on the channel then click "Mark As Read"; this can be done from mobile by holding down on the channel. Further offences will result in the appropriate consequence.

warm marsh
#

In discord.js/master it says you can fetch a guild using, <Guild>.fetch() I tried this but it just threw an error. Is it broken/not added?

mossy vine
#

what error

warm marsh
#

That fetch isn't a property of guild

earnest phoenix
#

you can't fetch() a guild

#

what is it supposed to do?

warm marsh
#

It caches the guild.

earnest phoenix
#

you don't really need to do that. It's common to fetchMembers() when the guild.large is true, but everything should be good if you fetch or don't

warm marsh
#

Ok

timber cloud
#

What is better gigantic tree of if's (one inside other etc) or a lot of separate if's with few more in thwm

pallid zinc
#
 let cmd = args.shift().toLowerCase()โ€‹```
#

Why my bot response to ever prefix

earnest phoenix
#

mass!help

smoky mica
#

@pallid zinc what