#development

1 messages ยท Page 781 of 1

lofty hamlet
#

I think is discord

#

๐Ÿค”

modest maple
lofty hamlet
#

It's strange

earnest phoenix
#

interesting

mossy vine
#

is your bot sharded

lofty hamlet
#

Yeah

#

@mossy vine

mossy vine
#

do none of your shards connect

#

ok no need to ping me im literally typing

lofty hamlet
#

Yes

#

Shardd does not launch

#

And also sometimes I think it's the API the bot removes and recovers from a lot of servers, 500 and sends back a message to the owner thanking him for adding my bot. I'm not going to risk having my account disabled, huh?

modest maple
#

the back end development has started

lofty hamlet
#

@mossy vine so ?

delicate zephyr
#

@modest maple tbf, backend isn't difficult

#

Probably the easiest tbh

modest maple
#

i just gotta manage alot of blocking code efficently

#

but shouldnt be too bad

delicate zephyr
#

Threading is bae

modest maple
#

basic principle:

add query to task list -> loop gets task -> get next free driver -> send task & add driver to current tasks -> Once Complete: send results to handler + add driver back to free drivers

#

every X amount of requests in the loop

lofty hamlet
#

somebody can help me ?

modest maple
#

make a new driver and load

#

you cant rlly help 500 errors

#

nothing you can do

lofty hamlet
#

It's discord ?

modest maple
#

500 codes mean somthing with the server side fucked up

delicate zephyr
#

^

#

There is nothing you can do

modest maple
#

the hardest thing is gonna be managing the creation and deltion of free drivers

lofty hamlet
#

I can't launch any bot wtf

modest maple
#

you want as little ram usage as possible

lofty hamlet
#

What is this

modest maple
#

but dont want them waiting for any amount of time

earnest phoenix
#
const Config = require("../../lib/mongodb.js");
module.exports = {
    name: "settings",
    category: "utils",
    description: "Get a whole list of things you can change",
    run: async (Discord, client, message, args, prefix, member, nopermsEmbed, validmemberEmbed) => {
        let settingsEmbed = new Discord.RichEmbed()
        .setTitle(":gear:**Settings**")
        .addField("**Change Prefix**", `${prefix}settings prefix [prefix]`)
        .setFooter(`[] = required, {} = optional | Requested by ${message.author.tag}`,`${message.author.avatarURL}`)
        .setTimestamp();

        if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send(nopermsEmbed);
        if(!args[1]) return message.channel.send(settingsEmbed);

        if(args[1] === "prefix") {
          let newPrefix = args[2];

          const doc = await Config.findOne({ guildID: message.guild.id });
          doc.prefix = newPrefix;
          doc.save();

          message.channel.send(`Changed prefix. New prefix is now **\`${newPrefix}\`**`);
        };
    }
};``` doesn't return anything even errors
#

?

#

its supposed to change prefix is i do {preifx}settings prefix [newPrefix]

#

so?

#

why args[1]?

mossy vine
#

^

earnest phoenix
#

learn to debug your code

delicate zephyr
#

@earnest phoenix read pins

earnest phoenix
#

what about them

delicate zephyr
#

We're here to help not criticise, lead them to guides to debug ยฏ\_(ใƒ„)_/ยฏ

earnest phoenix
#

i didn't criticise

#

lol

#

wdym why args [1]

#

i hate it how people throw full blocks of code at other people hoping they'll fix it, it's not how it works, you're supposed to investigate the issue yourself in your code, find it, and only then if you don't know how to fix it come ask other people for help

delicate zephyr
#

Maybe they've tried

earnest phoenix
#

x doubt

delicate zephyr
#

If you're not gonna be helpful. Leave.

earnest phoenix
#

lmaoooo

#

i stated that they should learn to debug, you're getting butthurt because you're minimodding / and-or a wannabe mod

modern sable
#

i hate it how people throw full blocks of code at other people hoping they'll fix it, it's not how it works, you're supposed to investigate the issue yourself in your code, find it, and only then if you don't know how to fix it come ask other people for help

You're assuming that they haven't already done this

earnest phoenix
#

because they haven't

#

if they have they'd not make us guess where the problem is

modern sable
#

maybe because they can't find it?

earnest phoenix
#

i've worked with people like this for over two years, it's just intuition when it comes to issues like these, and instead of fixing it for them you're supposed to push them to do it themselves, because otherwise, where's the point in learning if you don't do it yourself?

delicate zephyr
#

That's not what this channel is for though. Whilst we don't spoon feed we direct them to the right things and or point out the issue so they can research to fix it

earnest phoenix
#

you just contradicted yourself

#

but ok

delicate zephyr
#

@modern sable did I contradict myself?

earnest phoenix
#

the only thing i want to know does it not find the prefix that is inserted

modern sable
#

I dont see where

earnest phoenix
#

not what this channel is for though
proceeds to rephrase the statement i said in my message

#

im tired

delicate zephyr
#

I didn't though. You're saying that they shouldnt use this channel to find the issue at all

earnest phoenix
#

who said that

#

cause i surely did not

delicate zephyr
#

I'm saying people come here because they can't find the issue in the first place

#

They need help seeing the issue they're having in a clearer light and want support in knowing how to fix it

earnest phoenix
#

i said to first try yourself, if you can't, you then come to ask for help to other people

#

but debugging your code is not something you... can't not know

#

if people were to be interested in the topic, they'd ask more about it

#

anyways

delicate zephyr
#

Uh? It comes with experience though. You're telling people to just go and learn it without directing them to sources

earnest phoenix
#

im really sleep deprived

#

if people were to be interested in the topic, they'd ask more about it

modern sable
#

just saying "learn to debug your code" makes you seem like you dont want to help at all

Sure, we don't know if they looked at it or how long they looked at it. But it could also be something about JS that they genuinely don't know

delicate zephyr
#

Sending them guides and being helpful by directing them to links to where they can learn is helpful

#

Whether they asked for it or not

earnest phoenix
#

i'm aware it is helpful however chances are they're not going to read them / skim over them if they're not interested in the first place

#

i got it

#

im so dumb wtf

#

is wrong with me

delicate zephyr
#

@earnest phoenix you won't know that if you're just unhelpful straight off the bat tho

earnest phoenix
#

i dont want to come as narcissistic but i'm really experienced in this field and i genuinely understand how people flow in these types of situations

#

and trust me

#

being stricter is for their good

delicate zephyr
#

Everyone is different. Helping people learn rather than thinking just because you're so experienced in something you have the right to just saying "just learn x" it just doesn't help

modest maple
#

maybe take this to dms?

delicate zephyr
#

Again. That isn't what this channel is for

earnest phoenix
#

which just loops... back to my original statement that if they were interested in the first place they'd ask about it

#

this whole argument stems from a minimodder lol

#

im too tired

uneven wyvern
#

I'm sure that is not a Conversation about Development

delicate zephyr
#

It's fine

#

It's over

modest maple
#

its bad enough keeping track of threads

#

let alone, task, drivers and threads

earnest phoenix
#

python threading is messy wew

delicate zephyr
#

Threading with Python is fun

modest maple
#

its where i wish it had the ability to return stuff like async run in executor does

#

but sadly not

#

xD

#

it just means that there now has to be two seperate systems for starting tasks and getting the results back

delicate zephyr
#

I'm so glad I stopped using python lmfao

#

It's okay for web stuff

#

But for a discord bot

#

It's messy as heck

modest maple
#

not rlly

#

its only like that if you dont use the command handler built in or have a decent one youve made

delicate zephyr
#

I had a decent one I made

#

But then

#

Music

modest maple
#

music is pretty ez

delicate zephyr
#

Threading is messy asf tho

modest maple
#

considering wavelink has everything including the LL server sided stuff built in

delicate zephyr
#

I mean

modest maple
#

and handles everything

delicate zephyr
#

I didn't have lavalink back then

#

So I was writing a wrapper for YouTube itself

modest maple
#
    async def task_checker(self):
        while True:
            if len(self.pending_tasks) > 0:
                list_to_remove = []
                while len(self.free_drivers) > 0:
                    temp_task = next(self.task_cycle)
                    list_to_remove.append(temp_task)
                    await self.start_task(task=temp_task)
                for task_to_remove in list_to_remove:
                    self.pending_tasks.remove(task_to_remove)
                self.reload_tasks()
                await asyncio.sleep(0.2)
            else:
                await asyncio.sleep(1)```
#

hopefully

#

this shoulddddd work in terms of starting tasks

#

now how df i manage driver count is beyond me

earnest phoenix
#

i used lavalink for a while until i started having performance issues and huge resource consumptions

#

i just switched back to ffmpeg but the issue was i was spawning a new instance of the program every single time

#

so i just wrote a wrapper around ffmpeg libs and it's running quite smoothly now

delicate zephyr
#

Lavalink isnt a big problem for me anymore

#

And I quite often have around 20 players on my node because I'm supporting @robust trellis

#

And it only uses around 5-10% cpu

earnest phoenix
#

oh

#

really nice

#

i used to go up to 60-80% and i disliked that i had to have jre installed alongside other things on my machine

delicate zephyr
#

12 players atm

modest maple
#

its got alot better tbh

delicate zephyr
#

That used ram is only allocated

#

Not actually used used

west raptor
#

we're not going to spoonfeed you

#

but basically just store deleted message with the channel and user

modest maple
#

you have to store x amount of messages for each guild that are deleted

delicate zephyr
#

@modest maple or do as dream said

modest maple
#

thats basically what i ment

#

xD

drifting pike
#

how do you get a bot on discord community??

modest maple
#

?

#

@modern sable

drifting tiger
#

Hello

modest maple
#

why did you send a bot invite link here?

lofty vine
#

who?

modest maple
#

@drifting tiger

drifting tiger
#

Not Click Paste ๐Ÿ˜Ÿ

#

Sorry

lofty vine
#

lol

modest maple
lofty vine
#

lol

#

what's that error?

#

py?

modest maple
#

apparently it did not like that loop

lofty vine
#

oo

digital ibex
#
if (Roles.length <= 1) Roles = 'No roles';
if (emojiList.length >= 10) emojiList = 'Too many emojis to list';
if (emojiList.length <= 1) emojiList = 'No emojis';``` Can anyone see anything wrong in that for it to say `Too many emojis to list` & `Too many roles to list`?
#

even when it is smaller

lofty vine
#

guild.roles.length maybe?

split hazel
#

Is it possible to fetch a channel on discord js stable?

quartz kindle
#

Pretty sure it is

#

Should be guild.fetchChannel()

split hazel
#

Doesn't exist, on master i see it is client.channels.fetch but i do not see it anywhere for stable

modest maple
earnest phoenix
#

you shouldn't need to fetch channels cause they're always going to be in cache

split hazel
#

That's true, unless you decide to start saving memory

quartz kindle
#

True i cant find it either

#

I dont cache channels, but im on master

rotund crater
#

whats the bot commands?

split hazel
#

yeah looks like i'll have to upgrade to master

#

which is fine i guess EyesCross

quartz kindle
#

However, if the channel you need is the one the message came from, you can use the channel data from the raw event and add it to the channel cache manually

split hazel
#

The message raw event only sends the channel id

quartz kindle
#

Let me chekc the source

summer torrent
#

anyone help me for dirname?

grizzled raven
#

where do you load that?

summer torrent
#

util/commandHandler.js

earnest phoenix
#

hey, i found a dataset of this format

   "want":"wanteth",
   "wants":"wanteth",
   "was":"wast",

i want to use js to translate a sentence and replace words on the left hand to the corresponding word, on the right hand.
not sure how to approach it though

split hazel
#

What i would do is put the words in an array (if already in json, key it) then create an empty JSON object and have a for loop translate the words and add them to the JSON emptyJson[toTranslate] = translatedWord and then return the data or do whatever with it

#

You can use google translate, there's plenty of wrappers if you're unsure of doing it yourself

earnest phoenix
#

you definitely want to use a service like google translate, context doesn't translate when you statically replace words

#

google translate support old English?

split hazel
#

Oh for that there's probably a library that converts 21st century english into old english

earnest phoenix
#

could i do something like

str = "want"
str = Translate[str]

str = "wanteth"

earnest phoenix
#

d

quartz kindle
#

@earnest phoenix that woild only work for exact matches

#

And its case sensitive

earnest phoenix
#

coins system dosent work

late hill
#

ok

modest maple
#
Starting a new task
[01/02/20 | 16:32:58] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:32:59] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:32:59] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:00] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:00] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:01] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:01] Removing a driver - reason: Not needed.
[01/02/20 | 16:33:01] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:02] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:02] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:03] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:03] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:04] Removing a driver - reason: Not needed.
[01/02/20 | 16:33:04] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:04] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:05] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:05] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:06] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:06] Removing a driver - reason: Not needed.
#

so somthing went a lil wrong

#

xD

mossy vine
#

i see nothing wrong here

#

mainly cuz i have no clue whats going on

modest maple
#

turns out

#

i wasnt actually removing the task from the list

#

after it had been delt with

#

so it just kept looping it

#
[01/02/20 | 16:37:46] Returning Selenium_0 to free drivers, task complete ```
#

better

broken jay
#

I need help with Eris:
I'm creating bot.db PG Pool with:
bot.db = new pg.Pool({connectionString: config["db_url"]});

But when I want to use this in command:

const con = msg.channel.guild.shard.client.db.connect();
            let result = con.query("SELECT * FROM pokes WHERE id = (SELECT pokes[$1] FROM users WHERE u_id = $2)", [args, msg.author.id]);
            console.log(result);
            con.release();

I get TypeError: con.query is not a function. What is wrong?

late hill
#

connect is most likely async so you'll have to await it/use .then

broken jay
#

Ok

split hazel
#

In D.JS, Where are User and Member objects referenced, other than client.users and guild.members

#

I sweeped both of them and memory hasn't depleted, which leads me to believe there's more references than that

delicate zephyr
#

@split hazel that'll be presences. Which version of d.js are you on?

split hazel
#

master, i have disabled presence updates though

#

and when i get collection size for both, i get expected numbers

#

(the event)

delicate zephyr
#

then maybe its a mem leak

#

ยฏ_(ใƒ„)_/ยฏ

split hazel
#

???

#

sweeping 60k users and members should show at least a 10/20mb memory difference

topaz fjord
#

are you creating a fuck ton of event listeners

delicate zephyr
#

^

#

@topaz fjord d.js could have done that tbh

split hazel
#

only message, raw, ready and thats about it

#

well from my side

#

and message does nothing but update the last message timestamp property for the user as of now

topaz fjord
#

you can see node memory usage in real time by using chrome's dev tool inspector

#

if you run node with --inspect

split hazel
#

i can see the real time memory usage anyway

topaz fjord
#

I mean memory allocation in real time

#

to see what's taking it up

split hazel
#

when i tried that last time all i understood from it is a bunch of jibberish no one could understand

broken jay
#

How to make HTTPS JSON request and storage result to variable?

earnest phoenix
#

in what language

#

@muted junco

#

wow owner probot

#

is it possible to get a invite link to a server your bot is in through the discord api?

amber fractal
#

Yes, but most people would like that, or I wouldn't

earnest phoenix
#

why not?

amber fractal
#

Some people see it as a privacy breach

#

Some random person getting access to every server just because their bot is in it

earnest phoenix
#

or maybe there should be a way to opt out of certain api functionalities, dunno

#

it's there because it's a standard part of the api

#

that's where api abuse comes in play

#

you're allowed to use the endpoint but in a certain context only

topaz fjord
#

good question

#

I hope you're successful in figuring it out mmLol

earnest phoenix
#

yes.

#

make the script yourself

delicate zephyr
#

We answered you earlier

earnest phoenix
#

lol

delicate zephyr
#

We are not going to spoonfeed you

earnest phoenix
#

no one is going to spoonfeed you

#

unless your offering money

#

its right in the rules to not be spoonfed

west raptor
#

@earnest phoenix i already helped you

topaz fjord
#

Rule 7a. Don't spoon-feed or attack beginners

#

Asking for code = Asking to be Spoon-fed

green kestrel
#

Asking for code isn't being spoon fed, asking how it works is

topaz fjord
#

bruh what

quartz kindle
#

wat

topaz fjord
#

asking how code works isn't spoon-feed

#

asking for code so you don't have to do it yourself is spoon-feed

green kestrel
#

Codes no use if you don't understand it

topaz fjord
#

you'd be surprised

modest maple
#

dont stop people trying

topaz fjord
#

people take the code even though they don't know what it is doing

#

that basically defines all of DBL

green kestrel
#

I don't agree with the no spoon feeding rule tbh, I think that should be up to each person who wants to offer their time for free. But I'm not here to debate or argue the rules.

modern sable
#

no spoonfeeding

green kestrel
#

Some days I'm quite happy to spoon feed a newbie till they learn. Other days I can't be assed

#

But that's not for here

delicate zephyr
#

@earnest phoenix We arent giving you the code.

modern sable
#

@earnest phoenix please read rule 7a and stop using caps

topaz fjord
#

Those who wan't to be spoon-fed don't always want to know how it works

#

ok?

#

if your teacher will teach you don't talk about it here

modern sable
#

then be angry somewhere else

delicate zephyr
#

๐Ÿ’ฅ

topaz fjord
#

Joined server
Asked for code
People say no spoon-feed
Person gets confused and angry

green kestrel
#

๐Ÿ”ฅ

modest maple
#

so we make the back end first handler

#

to then decide

#

to change the thread system

#

to get futures returned

#

and well

#

it has fucked alot of stuff

slender chasm
#

One of my friends got banned, where do I look to see why?

earnest phoenix
#

banned where

modest maple
earnest phoenix
#

Halo! I am looking for people to help me with my discord bot cookie bot! I need some help with some commands and was hoping someone here could help. DM me if you can UwU

modest maple
#

how old are you?

earnest phoenix
#

why do you want to know?

#

;-;

#

that message halved the count of my brain cells

#

hush im wierd and im 13 -w-

modest maple
#

because you seem young and also this isnt the place to ask people to work on your bot for you, if you need help send your issue here

digital ibex
#

@earnest phoenix just becaus u said "UwU" i wont DM you to help, but help you here. So state your question & if we know then we will answer

earnest phoenix
#

oh-

#

ok

#

Nvm ill just go onto youtube-

digital ibex
#

ok

slender chasm
#

When he blocks you for dming me and talking about your tag

#

I miss when people where interested in itt.. ;-;

#

I like attention- wrong channel

digital ibex
#

ok

earnest phoenix
#

what's up with the cringe attack

digital ibex
#

sur i am not cringe

earnest phoenix
#

yes ๐Ÿ™

modest maple
#

Boois

digital ibex
#

hi

modest maple
#

we got the fucking thread futures working

#

thank god

digital ibex
#

girl

#

ok

#

kewl

modest maple
#

my hell has been lifted

earnest phoenix
#
for(i = 0; i < 10; i++)
{
    setTimeout(function(){console.clear(), console.log("\|")}, 1000);
    setTimeout(function(){console.clear(), console.log("\/")}, 2000);
    setTimeout(function(){console.clear(), console.log("\-")}, 3000);
    setTimeout(function(){console.clear(), console.log("\\")}, 4000);
}

i don't get why this is running once and not in a loop

digital ibex
#

hell has been lifted

quartz kindle
#

that will run 10 times after 1s, 10 times after 2s, 10 times after 3s, 10 times after 4s

earnest phoenix
#

what?

#

to me it just looks like the "stick" is doing 1 rotation and then stops

sudden geyser
#

Do you possibly mean to wait for the setTimeout to occur, then repeat it the next time

quartz kindle
#

you are looping 10 times, and on each loop you are creating 4 timeouts

#

after 10 loops, you have 40 timeouts

#

only then the timeouts start running

#

so you have 10 timeouts after 1s, 10 after 2s, etc

mossy vine
#

multiply the timeout by i + 1 to fix that

earnest phoenix
#

oh

split hazel
#

What else can I do to save memory on d.js, i have a bot running on about 700 servers and by sweeping unnecessary users, members, emojis, presences, voice states, and channels memory went down from 172MB to 115MB (obviously this will have a higher impact on the main bot)

earnest phoenix
#

so the timeouts are "overwriting" each other

quartz kindle
#

no, they are not overwriting

#

they are being executed all at once

modest maple
#

@split hazel ngl idk why you would want to remove any more, removing cache of certain stuff can fuck you more in the future in the little bit of ram you save

split hazel
#

I know what i'm removing and what the consequences will be

quartz kindle
#

you can sweep roles as well, if you havent already

#

idk how v11 stores them

split hazel
#

was thinking about that

#

i can pretty much do that as discord sends them on message

quartz kindle
#

ye

split hazel
#

and i switched to master so i could take advantage of client.channels.fetch

quartz kindle
#

i can send you my github if you want to take a look at how i do my anti-caching

split hazel
#

yes please lmao

digital ibex
#

yes

#

please

split hazel
#

mine isn't exactly anti cache except some

digital ibex
#

jk

split hazel
#

emojis and presences are locked to not be cached

digital ibex
#

i dont want it

split hazel
#

member, channels, users are swept on an interval based if they are frequently used or not

earnest phoenix
#

ok fixed it, not sure if this is what you suggested

var j = 0;
for(i = 0; i < 10; i++)
{
    setTimeout(function(){console.clear(), console.log("\|")}, j += i*100);
    setTimeout(function(){console.clear(), console.log("\/")}, j += i*100);
    setTimeout(function(){console.clear(), console.log("\-")}, j += i*100);
    setTimeout(function(){console.clear(), console.log("\\")}, j += i*100);
}
quartz kindle
#

i mean, you dont need j at all

blissful scaffold
#

nvm, forgot to scroll down

earnest phoenix
#

what would you do instead?

quartz kindle
#

just i*100

#

like

earnest phoenix
#

wouldn | / - \ run at the same time then?

quartz kindle
#

if i is 0, then the first 4 timeouts will be 0. if i is 1, then the 4 timeouts will be 100

#

and so on

#

so you will have 4 timeouts on 0, 4 on 100, 4 on 200, 4 on 300

#

just adjust your values until you have what you want

earnest phoenix
#

like this?

for(i = 0; i < 10; i++)
{
    setTimeout(function(){console.clear(), console.log("\|")}, i*100);
    setTimeout(function(){console.clear(), console.log("\/")}, i*100);
    setTimeout(function(){console.clear(), console.log("\-")}, i*100);
    setTimeout(function(){console.clear(), console.log("\\")}, i*100);
}
quartz kindle
#

its simple maths

blissful scaffold
#

maybe give each timeout a little offset so all 4 dont run at the same time

earnest phoenix
#

cause that doesn't work

blissful scaffold
#

0 + i*100
250 + i*100
and so on

quartz kindle
#

think of the for loop as the starting line. the timeouts only run after all the 10 loops finish. how do you need to configure all the 40 timeouts to have them execute in the correct order?

blissful scaffold
#

my numbers are incorrect, but you understand what i mean ^^

earnest phoenix
#

i think i get the logic of the foor loop it just generates 40 timeouts

#

and it's up to me to make sure the timeout goes

#

100, 200 ,300 ,400 ,500, 600 ....

quartz kindle
#

yup

#

you just need some multiplication and some addition using i

earnest phoenix
blissful scaffold
#

if you do i*100 then make sure that the values you add to it is below 100

earnest phoenix
#

?

tough kettle
#
<%- include('ek/header', {bot, user, path}) %
<div class="container">
  <style> body { background-color:#4c4c4c; } strong { color:#00bc3b; } h3 { color:#fff; } p { color:#fff; } </style>
  <div align="center"><br>
    <div class="jumbotron" style="background-color:#222; border-radius:40px;">
  <h3 style="color:#fff"><%- include('ek/header', {bot, user, path}) %>
<div class="container">
  <style> body { background-color:#4c4c4c; } strong { color:#00bc3b; } h3 { color:#fff; } p { color:#fff; } </style>
  <div align="center"><br>
    <div class="jumbotron" style="background-color:#222; border-radius:40px;">
  <h3 style="color:#fff">
earnest phoenix
#

oh i think i get it

modest maple
#

xD

earnest phoenix
royal herald
summer torrent
#

read the error

royal herald
summer torrent
#

what is random

royal herald
#

var random = Math.random() * (8 - 3) + 3;

modest maple
#

@earnest phoenix server, client, injector, pussygrabber now i cant tell what it is that makes me wonder thats odd about that

royal herald
#

@summer torrent

quartz kindle
#

@royal herald .toFixed() makes it a string

summer torrent
#

^

quartz kindle
summer torrent
#

ฤฐ use .toFixed?
yes

topaz fjord
#

@earnest phoenix imagine using visual studio

royal herald
#

how can i fix?

topaz fjord
#

asa

quartz kindle
#

dont use toFixed?

#

it says the input must be a number

#

toFixed() transforms a number into a string (text)

earnest phoenix
#

vs is good

quartz kindle
#

either use something else that doesnt transform it into a string, or transform it back into a number

royal herald
#

db.add(xp_${id}_${gid}, random.toFixed()); how can use wihtout to fixed?

quartz kindle
#

depends what you want to do

royal herald
#

level system

quartz kindle
#

why do you need toFixed?

#

you want to remove decimals?

#

all of them?

royal herald
#

but,on a ohter bot its works

quartz kindle
#

do you even know what toFixed() does?

vital lark
#

tim

#

at this point, i wouldn't even say he knows javascript

quartz kindle
#

@_@

royal herald
#

i am android coder.

#

^

blissful scaffold
#

I guess Ash tries to round/floor the value?

quartz kindle
#

lol

vital lark
#

"android coder"

modest maple
#

cringe

vital lark
#

also

#

toFixed makes the number into a string by it's radix

quartz kindle
#

ok so listen, when you use Math.random() operations, you get a number with a lot of decimals, ie 0.876597659376

vital lark
#
(0.55555).toFixed(2); //> 0.55
quartz kindle
#

you use toFixed() to truncate those decimals into the amount you want, like ^

#

but toFixed() transforms the number into a string. so it becomes text, not a number anymore

#

and your error says that it MUST be a number

#

it doesnt accept text

#

so do you need to remove decimals? how many decimals do you want to remove? there are other ways of removing decimals, and there are also ways to turn a text back into a number

royal herald
#

oh wait,i will go. bys

quartz kindle
#

Lol

slender thistle
#

And at that moment he has gone, to never return

blissful scaffold
#

learning overload

quartz kindle
#

this channel is gold

topaz fjord
#

Tim is why you live in this channel

quartz kindle
#

i dont know

#

honestly

modest maple
#

xD

vague talon
#

Looking for saome that will make me a bot for free

blissful scaffold
#

Good luck, I don't think you will find it here

mystic violet
#

Would this work if I were to eval it? ```js
new new require('dblapi.js')(client.config.topGGToken, client).postStats(client.guilds.size, 0, 0);

vital lark
#

that means the promise was successful

#

also 2 new keywords goose_thonk

mystic violet
#

Yeah not sure, but it works

#

lmao

#

it still says N/A on the site

#

im so confused

vital lark
#

it posts every 15 minutes iirc

#

i dont use the library since i can create my own autoposter Shrug

slender thistle
#

30 minutes by default if you provide it with your client

quartz kindle
#

double new wtf

modest maple
#

does anyone know

vital lark
#

was curious about that too, tim

modest maple
#

why my Loop

#

cannot support multiple Websockets

slender thistle
#

It's twice as new...
:)

vital lark
#

because ur loop succ /s

manic terrace
#

what are rich embed best practices?

earnest phoenix
#

what

#

there... aren't any?

manic terrace
#

i guess what i mean is like, how many rich embeds are too many etc

earnest phoenix
#

i mean a bot can post one embed per message

manic terrace
#

right i know that part, but i mean like, people can turn seeing them off right? i am curious as to why that's an option and what i can do with embeds to make them accessible and unobtrusive so that users wouldn't want to turn them off because of a bot

quartz kindle
#

you can send both

earnest phoenix
#

i've seen people just post a link to their github page with all of the commands

quartz kindle
#

for example:
if you cant see anything, turn on message embeds
embed here

manic terrace
#

is there a function to detect whether or not a user has them on or off?

earnest phoenix
#

nope

#

i mean you shouldn't really be concerned whether they can see it or if they can't

#

it was their decision to turn off embeds

quartz kindle
#

although people are stupid and forget or dont know what it does and then come asking why your bot doesnt work for them

manic terrace
#

the bot i am working on is for a TTRPG and i am setting it up so that the bot returns shit almost like a jrpg dialog screen. so like it has an NPC's name and portrait, then the message, etc

iron scroll
#

Daily Limit?

toxic jolt
#
const Discord = require("discord.js");

exports.run = async (client, message, args) => {

   message.guild.fetchInvites().then(invs => {
      let user = message.mentions.users.first() || message.author
      let personalInvites = invs.filter(i => i.inviter.id === user.id);
      let davetsayi = personalInvites.reduce((p, v) => v.uses + p, 0);
     ```
#

(node:21536) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined

#

help me pls

manic terrace
#

missing a semicolon

#

not strictly the fix, just noticing

toxic jolt
#

hmm

manic terrace
#
|| message.author;
toxic jolt
#

oh. thanks

#

man

#

โค๏ธ

manic terrace
#

i can't recommend a linter enough

toxic jolt
#

i dont fixed ๐Ÿ˜„

radiant iris
#

@toxic jolt Is it because message.author gives a map of the members data? rather than a true or false

vital lark
#

๐Ÿ‘ debug ๐Ÿ‘ your ๐Ÿ‘ code ๐Ÿ‘

radiant iris
#

Though I do agree it should give a true if the author exists

vital lark
#

console.log i.inviter and see what it returns

#

also Message#author is the author of the message, not an Array of the guild members' data

radiant iris
#

^ that, or try something like if (message.author) {console.log(1)} else {console.log(2)}

#

and yeah I was referring to the author as 'members'

vital lark
#

ah ok

quartz kindle
#

let a = something || somethingelse is perfectly valid

#

his problem is probably some weird entanglement elsewhere

toxic jolt
#

hmm

modest maple
#
[01/02/20 | 22:01:03] Starting Task Manager...
[01/02/20 | 22:01:03] Starting Driver Manager...
{'user_id': 290923752475066368, 'channel_id': 640156114343952398, 'url': 'https://www.crunchyroll.com/search?from=videos&q=test', 'type': 0}
[01/02/20 | 22:02:47] Starting a new task
[01/02/20 | 22:02:47] Returning Selenium_0 to free drivers, task complete
{'user_id': 290923752475066368, 'channel_id': 640156114343952398, 'url': 'https://www.crunchyroll.com/search?from=videos&q=test', 'type': 0}
[01/02/20 | 22:02:51] Starting a new task
[01/02/20 | 22:02:52] Returning Selenium_1 to free drivers, task complete
#

back end

#

sorta working

snow urchin
vital lark
#

bot can't use the emoji

snow urchin
#

Why

vital lark
#

it could be it doesn't have external emojis perms or the bot doesn't have the emoji

snow urchin
#

its in the guild, and im testing in a dm

vital lark
#

weird

summer torrent
#

is emoji animated?

snow urchin
#

Yes

grizzled raven
#

<a:bopsosjw sdi:whatever>

summer torrent
#

<a:bopparrot:emojiID>

grizzled raven
#

dont forget the a

summer torrent
snow urchin
#

Ah thanks!

vital lark
#

was gonna say

#

i did it with an animated emoji and it worked in dms

mossy vine
#

@iron scroll yes, google apis have quota limits

digital ibex
#

let user = message.mentions.users.first() || message.author || idk what to add here to make it show something like this

#

does that make sense?

#

so u can search by name

vital lark
#

well

#

x || y would work automatically

#

if x is undefined, it'll correspond with y

digital ibex
#

so uh

blissful scaffold
#

also if x has a value then y will not be executed

vital lark
#

^ forgot to say that

digital ibex
#

let user = message.mentions.users.first() || message.author || x || y?

#

thats wrong right?

late hill
digital ibex
#

yh knew it ;(, what does x & y be defined as?

blissful scaffold
#

x and y is an example, like you use in math

digital ibex
#

o

#

what would it be defined as

late hill
#

His question is probably how to get a user with a partial input string

#

you know

#

kind of what he showed

blissful scaffold
#

you want it to search for a user when you enter a partial name?

late hill
#

You can use the find method

#

and you will have to apply the logic you've just been told

#

if you just add it at the back

#

it won't ever work

#

because message.author will at least be used

#

your or statements will be executed left to right

vital lark
#

I would use filter and see if the user has that name, was mentioned, or something

late hill
#

i wouldn't use it on all users, rather on the guild members

vital lark
#

guess you can do it

#

that way

earnest phoenix
#

xD

quartz kindle
#

thats a lot of logging... do you work for the CIA?

earnest phoenix
#

i cant understand what you say

quartz kindle
#

lmao

earnest phoenix
#

i get translate

#

wait

#

no

blissful scaffold
#

too bad jokes almost never translate well xD

vital lark
#

cia be looking for nsfw avatars

#

and other shit that is kinda useless but

#

cia does what it does i guess

glacial mango
#

How would I create notifications for a YouTube channel?

modest maple
#

Guessing yt API and webhooks

summer torrent
#

pubsubhubbub ๐Ÿ‘€

earnest phoenix
#

So I need help creating a delete all channels command, im kinda stuck, at most I can get the command to delete 2 channels, can someone explain it to me?

#

loop through all of the channels in the guild and delete them

modest maple
#

Imo that's a rlly bad idea

#

That just opens the ability to nuking servers

blissful scaffold
#

I don't see any reason why you want to delete all channels

modest maple
#

If someone or you don't handle the perms properly

earnest phoenix
#

If there all spam channels yeah

#

Im making it a permission command

fleet chasm
#

well you could disable the channels via roles and clear the channels

modest maple
#

That gives the ability for nuking servers if it goes wrong

blissful scaffold
#

instead of deleting the channels just delete all messages in the last X minutes

modest maple
#

I wouldn't take the risk

earnest phoenix
#

Ok

silk gate
#

.

fleet chasm
#

dotposting

lean palm
#

how can you use code markdown in an embed?

dusky marsh
#

Same as in a regular message

blissful scaffold
#

I don't think you can use markdown in every area in an embed

#

but you will have to try it

lean palm
#

ok

west raptor
#

markdown afaik cant be used in embed titles and footers

grand wolf
vital lark
#

@grand wolf thats a token you make for webhook requests

grand wolf
#

Not the token. The password

vital lark
#

??

#

its the same thing...

grand wolf
#

This one

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); 
outer niche
grand wolf
#

Do u mea to repeat the token 2 times ??

vital lark
#

what

#

you put your password in the auth place

#

@outer niche what about that code?

outer niche
vital lark
#

maybe ur missing a )

outer niche
#

whar

grand wolf
#

This is the console log
Webhook running at http://0.0.0.0:5000/dblwebhook
But test button do nothing also voting dont log any thing

vital lark
#

check your code

#

@grand wolf did you even put anything in the webhook area

grand wolf
#

No

vital lark
#

for host, put your ip:port

#

for auth, put the same password

grand wolf
#

The same password of what?
Of what I have filled in authorization?

vital lark
#

yes

blissful scaffold
#

@grand wolf the password in your bot is the authorization on the site

grand wolf
#

Not worked
My code is

const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBLTOKEN,{ webhookPort: 5000, webhookAuth: process.env.DBLTOPWD});```
#

The console logs this on webhook ready event
Webhook running at http://0.0.0.0:5000/dblwebhook

#

The URL is empty in bot's page and assigned the same password

#

@vital lark can u please help me

fiery stream
#

Oh

grand wolf
#

What im missing?

fiery stream
#

What is that for

grand wolf
#

To get who voted on my bot

fiery stream
#

Do u have docs open

grand wolf
#

Yup

fiery stream
#

Link pls

grand wolf
vital lark
#

ur missing the url

grand wolf
#

Which url should i put

vital lark
#

ur vps ip

fiery stream
#

Okay

vital lark
#

and port

#

like: ip:port

fiery stream
#

All u need is this const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });

earnest phoenix
#

That's a fat spoonfeed

blissful scaffold
#

the URL you enter on your bot page should look like http://1.2.3.4:5000/dblwebhook
Where the IP is the IP of your VPS

fiery stream
#

Itโ€™s in docs either way

earnest phoenix
#

Oh lol

fiery stream
#

Yea i copy pasted docs

grand wolf
#

OH

#

To my vps

#

๐Ÿ˜…

#

I assigned it but also the same.
Nothing changed

#

@fiery stream I used it but nothing happens

fiery stream
#

Did anyone even vote?

grand wolf
#

Yup and test button

#

Nothing appears

#

Only the console logs this Webhook running at http://0.0.0.0:5000/dblwebhook

outer niche
#
async def mute3(ctx, member: discord.Member):
    role = discord.utils.get(ctx.guild.roles, name='Muted')
    await member.add_roles(role)
    await ctx.send("role added")```I am trying to use this milkman It is not working but it is also not throwing back any errors
sudden geyser
#

are you sure the role exists, how are you using the command (as in the message you sent)?

outer niche
#

Yes the mute role

#

Still nothing

heavy grotto
#

Anyone have any nice formats for discord announcements? I don't like using @ here to make it yellow although that is flashy, i'm looking for something more.

wicked pivot
#

(discord.js)

vital lark
#

use >

wicked pivot
#

what ?

#

or ?

vital lark
#

use >

#

i used this,

wicked pivot
#

exemple embed : js let embed = new Discord.RichEmbed() .setTitle("Teste") .addFied("AddFied 1", "AddFied 1") .addFied("AddFied 2", "AddFied 2") .addFied("AddFied 3", "AddFied 3") .addFied("AddFied 4", "AddFied 4")Where should I put it?

#

teste

#

test

#

ow okay

#

I'm going to try

blissful scaffold
#

.addFied(
make sure you write it correctly

#

It's addField

wicked pivot
#

yes i wrote it in the chat to explain x)

earnest phoenix
#

Hey, is there a way to wait for a embed image to load before sending the actual embed?

vital lark
#

no

earnest phoenix
#

rip

#

do u think using local upload will go faster?

#

or delay the message itself?

broken jay
#

Is possible to wait for .then before continuing?

#

In JS

vital lark
#

@broken jay reelaborate your question

amber fractal
#

@broken jay use await instead of .then

#

await's purpose is to wait for a promise to fulfil while a .then will allow other code to continue running while waiting for it

#

(just something from goolge) The fundamental difference between await and vanilla promises is that await X suspends execution of the current function, while promise.then(X) continues execution of the current function after adding the X call to the callback chain.

earnest phoenix
#

help mee PLS ```js

/node_modules/opusscript/build/opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){re

Error: read ECONNRESET
at _errnoException (util.js:1022:11)
at TCP.onread (net.js:628:25)```

broken jay
#

I want to use it in class constructor, but constructor isn't async. @amber fractal

amber fractal
#

Yeah I've run into that before, you can, in the constructor, call an async method inside the class and let that just act as the constructor (never tried this just came to mind, might not work) or you can put the rest of your constructor inside of the .then those are what I can think of now, you might be able to find more solutions online tho

wintry sonnet
#
exports.run = async (client, message, args, ops) => {
    if (!message.member.voiceChannel) return message.channel.send('Please connect to a voice channel to use this command');

    if (!args[0]) return message.channel.send('Please input a URL following ;play');

    let validate = ytdl.validateURL(args[0]);

    if (!validate) return message.channel.send('Please input a **valid** URL following ;play');

    let info = await ytdl.getInfo(args[0]);

    let data = ops.active.get(message.guild.id) || {};

    if (!data.connection) data.connection = await message.member.voiceChannel.join();

    data.queue.push({
        songTitle: info.title,
        requester: message.author.tag,
        url: args[0],
        announceChannel: message.channel.id
    });

    if (!data.dispatcher) play(client, ops, data);

    else {

        message.channel.send(Added ${info.title} to the queue);

    }

    ops.active.set(message.guild.id, data);
}

async function play(client, ops, data) {
    client.channels.get(data.queue[0].announceChannel).send(Now playing ${data});

    data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioonly' }));
    data.dispatcher.guildID = data.guildID;

    data.dispatcher.once('end', function () {
        end(client, ops, data);
    });
}
function end(client, ops, dispatcher) {

    let fetched = ops.active.get(dispatcher.guildID);


    fetched.queue.shift();

    if (fetched.queue.length > 0) {
        ops.active.set(dispatcher.guildID, fetched);

        playStream(client, ops, fetched);

    } else {


        ops.active.delete(dispatcher.guildID);

        let vc = client.guilds.get(dispatcher.guildID).me.voiceChannel;

        if (vc) vc.leave();

    }

}```



(node:5292) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of undefined.```

Help!

wintry sonnet
#

And I get no response, that's fucking amazing ๐Ÿ˜’

scenic kelp
#

read your error: 'push' is not a thing on undefined

#

don't be rude, it's early/late where a lot of people are

wintry sonnet
#

Fair enough

#

Wdym "read my error"?

scenic kelp
#

The 'TypeError...' explains what your problem is, you're using push on an undefined. I'm assuming you're expecting it to be an array

wintry sonnet
#

Here's where 'push comes in:

        songTitle: info.title,
        requester: message.author.tag,
        url: args[0],
        announceChannel: message.channel.id
    });

    if (!data.dispatcher) play(client, ops, data);

    else {

        message.channel.send(Added ${info.title} to the queue);

    }```
scenic kelp
#

Is data.queue ever defined?

wintry sonnet
#

No

scenic kelp
#

gotta have data.queue = []; somewhere

wintry sonnet
#

The tutorial I'm using doesn't define it

scenic kelp
#

well the tutorial either 1. is broken or 2. has something you're missing

#

also if you're learning from a tutorial I HIGHLY suggest you go through and learn what each individual part of the code does

wintry sonnet
#

Ok

#

Now I'm getting a new error:

    at play (C:\Users\XPS 9100\Desktop\sportstackerbot\commands\play.js:38:39)
    at Object.exports.run (C:\Users\XPS 9100\Desktop\sportstackerbot\commands\play.js:26:27)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
vital lark
#

@earnest phoenix I would like to know why are using the WASI module

#

do you even know what the WASI module does??

#

wait no i read that wrong

#

why are using opusscript, opusscript is only and should be used in development environments not in production environments

wheat jolt
#

@wintry sonnet show the play.js file

earnest phoenix
#
const code = args.join(" ");
let evaled = eval(code)
if(typeof evaled !== "string") evaled = inspect(evaled);
if(evaled.size >= 1024) evaled = `${evaled.substring(0, 50)}...`

last line does not work

vital lark
#

@earnest phoenix size doesn't exist in a String

#

try String#length

vague talon
#

Can somone pls make me a botm for free dm me if yes pls

vital lark
#

no

winter basalt
#

imagine getting a bot for free

earnest phoenix
#

@winter basalt i got one

#

with some simple commands

uneven wyvern
#

how can i push things into a empty object?

earnest phoenix
#
constructor(name, type, image, special, firstOwner, id){
    this.name = name;
    this.type = type;
    this.image = image;
    this.firstOwner = firstOwner;
    this.move = special;
    this.level = 1;
    this.xp = 0;
    this.id;
    if(id){
    this.id = id;
      return;
    }
    let iiid;
    mongo.connect(async err => {
  if(err) throw err;
      const db = mongo.db("main");
    let ids = await db.collection("ids").findOne({_id: this.name});
    if(ids === null){
      await db.collection("ids").insertOne({_id: this.name, latest: 0});
    }
    ids = await db.collection("ids").findOne({_id: this.name});
    let iid = ids.latest + 1;
      console.log(ids.latest, iid)
    this.id = iid;
    db.collection("ids").updateOne({_id: this.name}, {$set: {latest: iid}});
    });
  }
``` Can somebody tell me why do this.id equals to null but when I did the console.log, it outputted 1,2
#

I use MongoDB and discord.js

delicate zephyr
#

because you arent setting id as anything

#

You're giving it as a variable in the constructor

#

you dont need to check if it exists as if it isnt given it will be null anyway

#

@earnest phoenix Hope that helps

earnest phoenix
#

does js have minimum field width?

#

like

 8
 9
10

// instead of
8
9
10
delicate zephyr
#

use .padStart

late hill
#

You can't have an async constructor

earnest phoenix
#

hmm'

#

what if i want to pad from right side?

late hill
#

@earnest phoenix ^^

#

Your constructer should just return a base object

#

You can put the async stuff in a different method

earnest phoenix
#

@delicate zephyr im setting the ID later after the code

late hill
#

And then just immediately call that

earnest phoenix
#

where should i put it then?

#

i need await or else findOne will be Promise <Pending>

late hill
#

Example

class MyClass {
  constructor(prop, ...) {
    this.prop = prop;
    ...
  }

  async init() {
    //do some async stuff with awaits and all that
  }
}

//create an object and initialize it
let myObject = await new MyClass(prop).init();
earnest phoenix
#
8 %
9 %
10%
late hill
#

creating the object like that will only work in an async function because it's using await

earnest phoenix
#

thanks @late hill

late hill
earnest phoenix
#

oh, there is a padEnd()

delicate zephyr
#

@earnest phoenix .padEnd

earnest phoenix
#

I need it for something

modest maple
#

but it does nothing

#

either way

delicate zephyr
#

@earnest phoenix it literally does the same thing as just doing this.id = id

earnest phoenix
#

ik

#

i need it so it dont generate a new ID

modest maple
#

but-

delicate zephyr
#

everything you run new ClassName() it makes a new instance anyway

#

so what do you mean

#

are you using classes as functions?

earnest phoenix
#

i save the class in MongoDB but it wont save the function

#

so i have to make a new class each time

modest maple
#

thats not how- that works

#

when you create the object

#

it inherits everything

earnest phoenix
#

functions dont save in MongoDB

modest maple
earnest phoenix
#

I need to save them because the class functions as an item in my game bot

modest maple
#

so just save the object

#

and keep calling the object

#

rather than re initialising the class

earnest phoenix
#

but when i save the object, it only keeps its props in the database

#

how am I supposed to use the functions then

grizzled raven
#

is discord master faster

uneven wyvern
#

@grizzled raven yeah kinda

grizzled raven
#

kinda?

uneven wyvern
#

how can i get data from the website worldometer.info without scraping the website?

modest maple
#

optimisation of ur code will probs make a bigger diffrence

#

@uneven wyvern you cant :/

#

they havent got an API

#

which leaves you with scraping

uneven wyvern
#

ok that sucks

quartz kindle
#

they do afaik

#

but its paid

modest maple
#

@uneven wyvern you can just use selenium to scrap stuff easily tbh

earnest phoenix
#

hello sama badi her

earnest phoenix
#

guys

#

who are pro developer

modest maple
#

why r u sending this in every channel

uneven wyvern
#

@earnest phoenix first of all #general, second of all why u wanna know that

earnest phoenix
#

+1

shell obsidian
#

How do you send DMS to other users using Eris?

sudden geyser
#

Get the user, then call .getDMChannel, which returns a promise to a private channel

shell obsidian
#

Thanks.

mystic violet
#
const DBL = require('dblapi.js')
module.exports = async (Bot, guild) => {

  const dbl = new DBL(Bot.config.topGGToken, Bot)
  dbl.postStats(Bot.guilds.size, 0, 0);```
#
(node:9200) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
    at IncomingMessage.<anonymous> (C:\Users\jnsho\node_modules\dblapi.js\src\index.js:118:25)```
#

doesn't work for some reason

#

Ill check the token, but probably still doesn't work

delicate zephyr
#

0 isnt an acceptable shard count

#

get rid of the 0, 0

bitter sundial
#

just get rif of those 0s at the end

mystic violet
#

ok

#

so dbl.postStats(Bot.guilds.size)

bitter sundial
snow pine
#

what i ask. if you change the profile picture on the bot is it also changed on the website?

sudden geyser
#

eventually

uneven wyvern
#

@snow pine yes

restive condor
#

Hi

toxic jolt
#

๐Ÿ˜ฆ

lilac wharf
#

I think the issue is because you're requested the entire data instead of the actual data of it, it should be something like
JSON.parse(body.body);

toxic jolt
#

hmm

grizzled raven
#

is contabo's ping ok?

sudden geyser
#

^ It converted an object to its string form [object Object], so you're trying to parse that instead of the actual body.

grizzled raven
#

like should i choose digital ocean or contabo

#

when it comes to

#

actually nvm

unique nimbus
#

this is for my vps anyway

#

cheapest one

lilac wharf
modest maple
#

Back end mostly built

#

now to tets

#

test

#

xD

lilac wharf
#

Nice

modest maple
#

And crunchyroll's api crashed

grizzled raven
#

@unique nimbus thanks

modest maple
#

altho pretty sure im missing somthing

grizzled raven
#

was just asking as chip's ping is always high xd

unique nimbus
#

that is the 5 euro version

grizzled raven
#

bigger the server the higher the ping will be?

unique nimbus
#

no

#

well idfk

#

it depends on what its doing

grizzled raven
#

understandable

quartz kindle
#

location matters the most for ping

snow pine
modest maple
#

are you hiding the ads?

earnest phoenix
#

Ad blocker

#

I think

snow pine
#

uhh build in in the browser

#

i mean to make it dark

#

?

grizzled raven
#

@snow pine do you have js in the page?

snow pine
#

nope

quartz kindle
#

its ok to make it dark yes

#

(afaik)

modest maple
#

not to hide ads tho

quartz kindle
#

you can change everything except disable/hide things

modest maple
#

just as an fyi

snow pine
#

@modest maple its my adblocker

#

not in the code

earnest phoenix
#

@snow pine why <h2> </h1>

#

????

#

๐Ÿค”

#

is there a way to deal with varying symbol width?
| โ–‰โ–‰โ–‰โ–‰โ–‰โ–‰

  • โ–‰โ–‰โ–‰โ–‰โ–‰โ–‰
snow pine
#

@earnest phoenix idk xd

earnest phoenix
#
| โ–‰โ–‰โ–‰โ–‰โ–‰โ–‰
- โ–‰โ–‰โ–‰โ–‰โ–‰โ–‰
#

waith

#

are all symbols same width when typed in a code block?

mossy vine
#

in code blocks a monospace font is used

#

in regular messages, no

#

A monospaced font, also called a fixed-pitch, fixed-width, or non-proportional font, is a font whose letters and characters each occupy the same amount of horizontal space. This contrasts with variable-width fonts, where the letters and spacings have different widths.
Monospa...

earnest phoenix
#

is it possible to use monospace font in messages?

mossy vine
#

not without this or this

earnest phoenix
#

what is the markdown for the first one?

mossy vine
#

one backtick

#

`this`

earnest phoenix
#

test

#

cool

#

ty

obtuse wind
#

Yeah I'm having trouble downloading "FFMPEG" for my music command, node, discord.js, javascript blah-blah

can someone walk me through it pls

wintry sonnet
#

@wheat jolt

exports.run = async (client, message, args, ops) => {
    if (!message.member.voiceChannel) return message.channel.send('Please connect to a voice channel to use this command');

    if (!args[0]) return message.channel.send('Please input a URL following ;play');

    let validate = ytdl.validateURL(args[0]);

    if (!validate) return message.channel.send('Please input a **valid** URL following ;play');

    let info = await ytdl.getInfo(args[0]);

    let data = ops.active.get(message.guild.id) || {};

    if (!data.connection) data.connection = await message.member.voiceChannel.join();

    data.queue.push({
        songTitle: info.title,
        requester: message.author.tag,
        url: args[0],
        announceChannel: message.channel.id
    });

    if (!data.dispatcher) play(client, ops, data);

    else {

        message.channel.send(Added ${info.title} to the queue);

    }

    ops.active.set(message.guild.id, data);
}

async function play(client, ops, data) {
    client.channels.get(data.queue[0].announceChannel).send(Now playing ${data});

    data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioonly' }));
    data.dispatcher.guildID = data.guildID;

    data.dispatcher.once('end', function () {
        end(client, ops, data);
    });
}
function end(client, ops, dispatcher) {

    let fetched = ops.active.get(dispatcher.guildID);


    fetched.queue.shift();

    if (fetched.queue.length > 0) {
        ops.active.set(dispatcher.guildID, fetched);

        playStream(client, ops, fetched);

    } else {


        ops.active.delete(dispatcher.guildID);

        let vc = client.guilds.get(dispatcher.guildID).me.voiceChannel;

        if (vc) vc.leave();

    }

}```


```(node:5292) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of undefined.```


Help!
mossy vine
#

why did you ping some rando for that

#

also what line are you getting that error on

obtuse wind
#

you have to define "push"

wintry sonnet
#

Oh

mossy vine
#

wtf no

#

are you ok

wintry sonnet
#

Me?

mossy vine
#

no

#

what line are you getting the error on

wintry sonnet
#

One second

obtuse wind
#

wait no, ignore me

wintry sonnet
#

@mossy vine Line 25

#

Wait a minute

mossy vine
#

u sure about that

wintry sonnet
#

I changed this code before going to bed

#

Let me get the new code

#

And the error as well

obtuse wind
#

can you run the terminal/whatever you are using and start your bot, then show me full error response

#

@wintry sonnet

#

I guess not

scenic kelp
obtuse wind
#

Anyway, I guess I'll repeat

Can anyone walk me through installing FFMPEG, so I can make a music player command .-.

scenic kelp
#

What platform

#

Linux? Windows?

obtuse wind
#

Windows 10, Node, etc

#

My discord_bot isn't registering that I have NPM already installed .-.

mossy vine
#

did you add it to path

scenic kelp
#

make sure it is in your path yes

obtuse wind
#

no its just in c:/skydrive/desktop/discord_bot

mossy vine
#

npm

obtuse wind
#

npm is in that path.

mossy vine
#

in your path env var

scenic kelp
#

click the environment variables button

#

check if npm is in there

#

also nice dox

obtuse wind
#

its in there

scenic kelp
#

so when you run npm

obtuse wind
#

no I mean like, NPM is refusing to install FFMPEG

scenic kelp
#

Oh

#

Don't use npm to install ffmpeg

#

that's just the bindings afaik

obtuse wind
#

i even have my command pro~

#

okay now that explains it

scenic kelp
#

might not be idk

obtuse wind
#

ight

#

ty

#

ok wow I'm dumb I could've just done that, thank you .-.

wintry sonnet
#

@mossy vine Sorry for the late response, but I was able to fix the new error I was receiving with my new code. Thanks for trying :)

uneven wyvern
#

let ch = this.client.db.get(`modLog_${message.guild.id}`) let modLog = message.guild.channels.filter(c => c.id === ch) if(!modLog) { return message.channel.send("There is no Mod Log set for this Server\nsetmodlog <channelMention>") } member.ban({days: days, reason: reason}) modLog.send(embed)

the error says that modLog.send() is not function but why?

obtuse wind
#

Modlog is probably not defined as a channel

#

change

                      ///I just message.guild.channels.find
let modLog = message.guild.channels.filter(c => c.name === "modlog") //or whatever the moderation channel is supposed to be.

modLog.send({embed: embed})
uneven wyvern
#

oh fuck I used filter

wheat jolt
#

modlog isn't a channel

#

Yup

#

You should use find

obtuse wind
#

Well Idk what programming language that is.

wheat jolt
#

Filter gives you another collection

#

Node.js

obtuse wind
#

mhm

#

I've never seen filter used in node.

wheat jolt
#

it's a function that you can use on maps, arrays

obtuse wind
#

I have a question, so my automoderator is not actually responding to my ban word list

will show you in a second

#

or not cause atom.io stopped working so maybe an extra minute

#

My bot is not moderating the included word/line.

slender thistle
#

I can bypass by setting msg.content to all capital letters

obtuse wind
#

I know

#

but I mean its not actually sending the moderation

south sky
#

well first of all u should make it msg.content.toLowerCase.includes('nig'), so that the case of all letters wont matter.

slender thistle
#

toLowerCase is a function

south sky
#

toLowerCase lowers the case of all letters.

#

ah yeah, add the brackets right there

#

.toLowerCase().includes

obtuse wind
#

ok ty for that

slender thistle
#

Add console.log to your if statements and see which branch is being executed

obtuse wind
#

so like that

south sky
#

ive also noticed something there

#

the part in which ur checking if they have manage_messages or administrator perms

#

ur checking that on the user, and not on the guild member

obtuse wind
#

yeah I noticed that a while ago

south sky
#

see, theres a difference between users and guild members. user represents the overall account of said user.

obtuse wind
#

I just commented those lines and will do those later

south sky
#

guild member represents that user's instance in each of the guilds

#

yeah, it should be msg.guild.member(msg.author).hasPermission(...)

#

that way ur grabbing the guild member of that user

obtuse wind
#

yeah

#

I'll remove the administrator line cause I mean, they have "manage_messages" permission after all

south sky
#

good point

obtuse wind
#

thank you for the assistance though

uneven wyvern
south sky
#

well

#

the only thing i can think of in that case

#

is to do Number(days) in the member.ban function

#

could be convenient, im not sure of it implicitly converts its type or not

uneven wyvern
#

Didn't solved it

south sky
#

or up there u can also do let days = Number(args[1])

#

ah

#

nevermind then.

obtuse wind
#

which line tho

#

Also @uneven wyvern this is only my suggestion but

you should change line 46

modLog.send({embed: embed})
earnest phoenix
#

where do i get the id of an emoji?

obtuse wind
#

you have to post the emoji and click its ID

earnest phoenix
#

that i need to write it with a box

obtuse wind
#

or copy its image

earnest phoenix
#

what if it's a gif emoji and i dont have nitro ?

obtuse wind
#

673578164936769574 would be the id of that emoji

#

that I just used at least

earnest phoenix
#

is it possible to get id without using the emoji ?

obtuse wind
#

if you have manage emoji's permission on the server, you can always get the ID off the emoji list

#

otherwise you would have to use the emoji in the server

earnest phoenix
#

i own the server but i can't see the id under the emoji mangement tab

obtuse wind
#

you dont get the ID like that you have to right click it

#

and hit copy id

#

@earnest phoenix

grizzled raven
#

wow noone notices

earnest phoenix
#

how can i right click it if i can't use it?

grizzled raven
#

@obtuse wind change the = in the if statements to ==

obtuse wind
#

no you right click the emoji part not the name