#development

1 messages ยท Page 351 of 1

earnest phoenix
#

Add return promise;

#

I suppose

#

To the end of each function

glossy sand
#

...assuming you have a variable called promise that's a promise, I guess

earnest phoenix
#

Wait

#

I dont

#

Wait im a bit confused

glossy sand
#

wtf are you trying to do

earnest phoenix
#

Im creating a promise chain

#

With functions

#

The functions have promises inside them'

#

But as you said

#

They dont return anything

#

So im unsure what it needs to return

glossy sand
#

if they have promises in their bodies, just return the promises right

earnest phoenix
#

So I just return the whole code?

glossy sand
#

what

earnest phoenix
#

How would I return the promises

#

return promise;?

glossy sand
#

didn't you just say there is no variable called promise

earnest phoenix
#

Yes, there isnt

glossy sand
#

return whatever you call the variable you've stored the promise in

earnest phoenix
#

OH

#

I stored it in a function so ill return the function

glossy sand
#

what

#

give me some code

#

you're not making much sense

earnest phoenix
#
var Questions1 = () => {
#

I return Questions1 correct?

icy lynx
#

ahh it's JS

glossy sand
#

why would you do that

#

give me the entire source code for Questions1()

earnest phoenix
#

Because I need to return a promise

#

Oklay

glossy sand
#

a function isn't a promise

earnest phoenix
#

``js

glossy sand
#

that doesn't even make sense

earnest phoenix
#
var Questions1 = () => {
  message.guild.fetchMember(message.author.id).then(user => user.send(Question1))
  .then(() => {
         message.author.dmChannel.awaitMessages(response => response.content, {
           max: 1,
           time: 30000,
           errors: ['time'],
         })
         .then((collected) => {
          message.guild.fetchMember('376147022660632587').then(user => user.send(`${Question1} \n \`\`${collected.first().content}\`\``))
           })
           .catch(() => {
            message.channel.send('There was no collected message that passed the filter within the time limit!');
          });
        });
}
glossy sand
#

ok add a return before message.guild.fetchMember(...

#

fetchMember returns a promise

earnest phoenix
#

Oh, okay!

#

For each function?

#

Or just the first

#

I assume each function okay

#

Because I have 24

glossy sand
#

...sure

#

again, I feel like your life would be a lot easier with async/await here

#

but whatever floats your boat I guess

earnest phoenix
#

Thank you good sir

#

Oh no its not waiting

#

Urrggg

#

Also idk how to use async/await >.>

glossy sand
#

it's never too late to learn

earnest phoenix
#

I tried

#

It makes no sense to me ;-;

#

Also apparently promises cant wait for other promises

#

Because i've tried literally everything

umbral pelican
earnest phoenix
#

I did

#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
var firstMethod = function() {
   var promise = new Promise(function(resolve, reject){
      setTimeout(function() {
         console.log('first method completed');
         resolve({data: '123'});
      }, 2000);
   });
   return promise;
};
 
 
var secondMethod = function(someStuff) {
   var promise = new Promise(function(resolve, reject){
      setTimeout(function() {
         console.log('second method completed');
         resolve({newData: someStuff.data + ' some more data'});
      }, 2000);
   });
   return promise;
};
 
var thirdMethod = function(someStuff) {
   var promise = new Promise(function(resolve, reject){
      setTimeout(function() {
         console.log('third method completed');
         resolve({result: someStuff.newData});
      }, 3000);
   });
   return promise;
};
 
firstMethod()
   .then(secondMethod)
   .then(thirdMethod);
 
#

This just looks like it uses Timeouts

#

I guess I can try it tho

#

Nope

#

Didnt work

thorny hinge
earnest phoenix
#

I've been working at this for literally 6 hours

#

Im so annoyed

#

Its so stupid, like why cant they just make something that allows to easily chain promises

glossy sand
#
promiseFunc1().then(() => promiseFunc2().then(() => promiseFunc3().then(() => { /* ... */ })));
#

this is why they introduced await/async

#

this looks garbage

compact scaffold
#

Which emote represents a server best?

earnest phoenix
#

@compact scaffold Wdym

compact scaffold
#

Like # denotes channels

earnest phoenix
#

?

#

Oh

compact scaffold
#

I'm adding emotes to a command

earnest phoenix
#

Im not sure

#

I would say maybe *

compact scaffold
earnest phoenix
#

Or @

#

But dats just my opinion

compact scaffold
#

Ok

earnest phoenix
#

@glossy sand If your up for it, do you think you could show me an example of async/await?

#

Because that might be the only way to chain promises

glossy sand
#
async function a() {
  // do something asyncronously
}
async function b() {
 // do something else async
}
(async function() {
  console.log('doing a and b...');
  // execute a and wait for completion
  await a();
  // execute b and wait for completion
  await b();
  console.log('done!');
})();
earnest phoenix
#

Ah!

#

Yes thats exactly!

#

Thank you!

#

So I would do

#
(async function() {
    Questions1()
    Questions2()
await Questions1();
await Questions2();
//do something else here
}
glossy sand
#

no

#

you define an async function with

async function funcName() {
  // ...
}
earnest phoenix
#

Okay

#

Would I need to return again?

glossy sand
#

async functions always return promises regardless of what you actually return

earnest phoenix
#

Oh good

glossy sand
#

so like

async function a() {
  return 1;
}
#

return a promise that resolves to 1

earnest phoenix
#

Ah!

#

Okay!

#

Ah man this is amazing

#

This is exactly what I was looking for

#

Er

#

I do need the return

#

Because I got this error

#

When I have this'

#
                    (async function() {
                    await Questions1();
                    await Questions2();
                    await Questions3();
                    await Questions4();
                    await Questions5();
                    })();
#

I defined them all as async functions

#

Why is this so complex ;-;

#

Its saying then isnt a function

#

This is the code I put into each function

#
  message.guild.fetchMember(message.author.id).then(user => user.send(Question1))
  .then(() => {
         message.author.dmChannel.awaitMessages(response => response.content, {
           max: 1,
           time: 30000,
           errors: ['time'],
         })
         .then((collected) => {
          message.guild.fetchMember('376147022660632587').then(user => user.send(`${Question1} \n \`\`${collected.first().content}\`\``))
           })
           .catch(() => {
            message.channel.send('There was no collected message that passed the filter within the time limit!');
          });
        }); 
#

It says the first line isnt a function

#

Which makes no sense

#

Aaaaaaaaaaaaaa

glacial vale
#

maybe you missing brackets somewhere?

#

that could be an issue. I dont code it so i wouldnt know

#

@icy lynx also it would be cool if the server count example for python conformed to pep ๐Ÿ˜›

icy lynx
#

@glacial vale I'm not a pep guy :P

glacial vale
#

๐Ÿ˜›

#

humf

#

lol

#

But are you a Zen of Python guy

#

@icy lynx

icy lynx
#

Na

#

Forgot how my style is called, but it's kinda like php's default style

#

But without braces :P

glacial vale
#

lol

patent reef
#

@earnest phoenix Oh alright, heres the HTML:

<div id="snow">
</div>```

and here is the CSS:
```css
#snow{
background-image: url('https://raw.githubusercontent.com/Habchy/sethpage/master/s1.png'), 
url('https://raw.githubusercontent.com/Habchy/sethpage/master/s2.png'), 
url('https://raw.githubusercontent.com/Habchy/sethpage/master/s3.png');
    position:absolute;
        top:0;
        left:0;
        bottom:0;
        right:0;
        height:100%;
        width:100%;
    z-index:-1;
    -webkit-animation: snow 10s linear infinite;
    -moz-animation: snow 10s linear infinite;
    -ms-animation: snow 10s linear infinite;
    animation: snow 10s linear infinite;
}

@keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 500px 1000px, 200px 400px, -100px 300px;}
}
@-moz-keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 400px 1000px, 200px 400px, 100px 300px;}
}
@-webkit-keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 500px 1000px, 200px 400px, -100px 300px;}
}
@-ms-keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 500px 1000px, 200px 400px, -100px 300px;}
}```
elfin depot
#

someone go here

thorny hinge
earnest phoenix
#

I have a problem with my code ;-;

#

Im using async

#

But its not running the promises async tho

#

Its running them at the same time

#
    (async function() {
    await Questions1();
    await Questions2();
    })();
#
async function Questions2() {
          message.author.send(Question2)
          .then(() => {
                 message.author.dmChannel.awaitMessages(response => response.content, {
                   max: 1,
                   time: 30000,
                   errors: ['time'],
                 })
                 .then((collected) => {
                  client.fetchUser('376147022660632587').then(user => user.send(`${Question2} \n \`\`${collected.first().content}\`\``))
                   })
                   .catch(() => {
                    message.author.send('There was no collected message that passed the filter within the time limit!');
                  });
                });    
#

Question1 is the same thing but with the numbers replaced

#

Im so confused

#

Does anybody know why it isnt working?

prime cliff
#

Are you missing a } ?

earnest phoenix
#

Nope

#

Oh I forgot to include it in my code preview

prime cliff
#

uh hu

earnest phoenix
#

Yes there is a }

#

Its just now shown

#

*not

#

I rlly dont get why this isnt working

#

It should be running them one after the other

#

Yet it runs both at the same time

#

All im legit trying to do

#

Is run promises in an order

#

One after the other

#

It appears awaitMessages is messing it up

earnest phoenix
#

@prime cliff ```css
#netneutrality {
display: none;
}

prime cliff
#

wew

earnest phoenix
#

lad

#

i couldnt figure out why my game was lagging

#

then i relized

#

im like

#

pumping

#

gigs of data

#

through 1 socket

#

lol

#

(not litteral gigs but a shitload of data)

#

my poor server:(

elfin depot
#

i got that error when i setted up heroku

abstract mango
#

can you read the error

#

(it's a obvious one)

earnest phoenix
#

I went to the d.js server

#

Nobody was able to answer my question

#

;-;

patent reef
#

๐Ÿ˜‚

fierce jasper
#

Lmao

north fog
#

wew

earnest phoenix
#

Error: Cannot find module 'googleapis' googleapis don't work on heroku.. but in pc it works perfect why?

neon pasture
#

rip

north fog
#

upload the module ยฟยฟ

stone kiln
#

install the module?

north fog
#

deploy the module

earnest phoenix
#

not working. I tried!

#

bots @north fog

#

-bots @earnest phoenix

gilded plankBOT
#
Avenger#8215
Bots

@grim wedge

earnest phoenix
#

-bots @north fog

gilded plankBOT
#
DeStilleGast#5179
Bots

@cold vector

earnest phoenix
#

!help

fervent goblet
#

Yo

#

Can someone help me with react-intl?

north fog
#

sorry, i cant

fervent goblet
#

for some reason its not loading my translations

#

[React Intl] Missing message: "TodoList.Description" for locale: "en"

#

but its definitely defined

shrewd field
#

hey

#

guys

#

I get an error for cannot send an empty message

#

but I have a message to send how??

#
   if (message.content === (prefix + "cat")) {
      let urlWithSize = randomCat.get({
        width: 120,
        height: 600
      });

      message.channel.send(urlWithSize);
      message.channel.send("This is a cat link");
      message.channel.send("CATS CATS");
}```
earnest phoenix
#

Error: OPUS_ENGINE_MISSING there exists a build for this on heroku?

north fog
#

Deni, maybe is the urlWithSize empty

shrewd field
#

how

north fog
#

maybe it fails to find a result, idk

viral tiger
#

@EแžตแžตแžตliteDaMyth#3663 use await

#

i'm guessing randomCat.get returns a promise

#

await it

#

@shrewd field

languid dragon
#

or alternatively, "urlWithSize" probably doesn't return as a string or embed so

earnest phoenix
#
            var server = servers[message.guild.id];
            if (server.dispatcher) {
                server.dispatcher.end();
            }``` what is wrong with this?.. is skipping 2 songs.
languid dragon
#
// do something like this instead

switch (option) {

    case "skip": return functionName(pass, any, variables)

}

function functionName (pass, any, variables) {
  let server = servers[message.guild.id];
  if (server.dispatcher) {
    server.dispatcher.end();
  }
}
earnest phoenix
#

aha.. ty

topaz fjord
#

Im pretty sure you need to put a timeout

#

end

languid dragon
#

a timeout? WaitWhat

quartz jackal
#

He probably means using setTimeout() between changing songs. I had the same problem. Damn prism media.

fervent goblet
#

yeah you can put a 1 second timeout

quartz jackal
#

Lol why?

#

All you need is ~200ms

earnest phoenix
#

and... how i set ms?..

quartz jackal
#

Google

#

I don't have google because of the repeal of net neutrality

fervent goblet
#

setTimeout(functionName(pass, any, variables), 1000)

#

1000 is 1 second in ms

quartz jackal
#

Seriously please don't they can Google it themselves

languid dragon
#

pretty sure thats wrong lmaoooo

#

setTimeout(() => functionName(), 4000)

fervent goblet
#

o

#

idk

#

xD

languid dragon
#

i also dont see why a timeout is needed

fervent goblet
#

lol

#

same

quartz jackal
#

Apparently it bugs out and skips too many times or just plain out breaks

#

And both

uncut slate
#

this is wrong

setTimeout(functionName(pass, any, variables), 1000)
#

what ken said is nicer, but if you have a single function to call, I would prefer setTimeout(functionName, 1000)

#

optionally setTimeout(functionName.bind(this), 1000)

fervent goblet
#

arguments?

uncut slate
#

.bind(null, arg1, arg2)

fervent goblet
#

oh

#

okay

crystal void
#

kek

earnest phoenix
#
setTimeout(()=>{
//i prefer putting the function in the timeout  cause im lame :(
}, 1000)```
earnest phoenix
#

anyone know how to run a node.js file in the backround without being in the terminal 24 / 7?

glossy sand
#

you can do a nohup node file.js

earnest phoenix
#

Thanks

#

why cant i do anything :P

glossy sand
#

ctrl + c it

earnest phoenix
#

then it kills it

glossy sand
#

yeah you need to nohup <command> &

#

so nohup node file.js &

#

nohup just makes the process ignore sighup

earnest phoenix
#

can i do nodemon?

glossy sand
#

idk

#

haven't tried

#

but I would guess so

earnest phoenix
#

ill try :P

inner jewel
#

i'd use screen/systemd

#

easier to kill the process

earnest phoenix
#

ok

#

how do i kill the nohup then

#

@glossy sand i want to stop the nohup, how i do it

glossy sand
#

er find the process id and kill it

#

ps -A | grep nohup

#

followed by kill <pid>

earnest phoenix
#

ma god

glossy sand
#

er perhaps ps -A | grep node

earnest phoenix
#

it shows pts/0 at onepoint

#

30639 pts/0 00:00:00 node

glossy sand
#

I guess if you only have one node process running, that must be it

#

kill 30639

earnest phoenix
#

done thx

#

yeah tmux is easier tbh

#

can you help me? i try the server count code:

request({
    method: 'POST',
    uri: 'https://discordbots.org/api/bots/'+ client.user.id,
    headers: {'Authorization':tokens[0]},
    json: {"server_count" : client.guilds.size}
  });

and it doesn't work

#

someone please?

inner jewel
#

what error

winged osprey
#

@earnest phoenix add /stats to the end of your url

inner jewel
#

"doesn't work" means nothing

#

also you don't need /stats

winged osprey
#

o

earnest phoenix
#

no error, just not updating

inner jewel
#

no wait

#

you do

#

you don't need bot id*

earnest phoenix
#

i don't?

inner jewel
#

no

#

you need /stats

earnest phoenix
#

doesn't work

mighty barn
#

I think it is 'https://discordbots.org/api/bots/'+ client.user.id +'/stats'

earnest phoenix
#

i added stats and it didn't work

bitter sundial
#

id is not necessary

earnest phoenix
#

both ways not working anyway

#

so what do i do?

bitter sundial
#

there must be some error if it's not updating

earnest phoenix
#

no error

bitter sundial
#

show code

#

nvm it's up there

earnest phoenix
#

haha fixed it, just had to change the token

unreal vortex
#

Ya @earnest phoenix same name somewhat ๐Ÿ˜‚

earnest phoenix
#

haha yeah

unreal vortex
#

We are bothers

#

lol ๐Ÿ˜‚

earnest phoenix
#

Aaahh- Can someone look at this and check why it's not working lol

winged osprey
#

what is the specific issue you are having

earnest phoenix
#

I was unsure what the other developer was encountering but I will try and ask them

#

@winged osprey

haughty barn
#

ok so

#

say i have a banking system for my bot

#

and

#

i want to make it generate a data bin for every encountered user without a command

#

how to

fervent goblet
#

I wouldn't recommend that

#

a public discord bot gets a ton of users

#

easily racking up to a few hundred thousand

#

which would flood your storage

haughty barn
#

ive got the storage space, each file is only ~ 0.1 kb

fervent goblet
#

well, if you have hundreds of thousands of users

#

do the math

haughty barn
#

right i have a server with 1.6 tb

fervent goblet
#

its still a waste of storage

#

get a database

icy lynx
#

What are you planning to do by storing it?

fervent goblet
#

bank

haughty barn
#

bank and rep

#

mainly

fervent goblet
#

like there aren't 200million bots that do exactly that + 20 billion more features

haughty barn
#

shhhhhh

icy lynx
#

Well, is that bank like a level up system?

haughty barn
#

a little

icy lynx
#

Earn it by posting?

#

Then on every new message, you can add the user

haughty barn
#

hmmm

icy lynx
#

That's kinda how level-up bots are done

#

It also stores the time of when the post was made, to avoid spam

haughty barn
#

ok

icy lynx
#

Should be easy to code, but mantaining it is a pain

#

If the bot keeps growing, that is.

haughty barn
#

xD

elfin depot
#

message.channel.send("๐Ÿ“ฅ | "+message.author.username+", the help menu has been sent to your PMs");

#

how can i embed that

glossy sand
#

create a new RichEmbed object

thorny hinge
#

^

icy lynx
#

Just wonderinf

thorny hinge
#

And pls use string literals

elfin depot
#
embed: {
          color: 0xff9d00,
          title: "BotTuber Help Menu",
          author: {```
icy lynx
#

Why is there an emoji on the code? nvm it's a string

elfin depot
#

im using that kind of embed

glossy sand
#

that kind of embed is used in eris

#

you need a RichEmbed in d.js

elfin depot
#

oh

thorny hinge
#

It works in d.js too

glossy sand
#

really?

elfin depot
#

ye

thorny hinge
#

Yep

glossy sand
#

haven't tried it lol

elfin depot
#

no u so how can i embed it

glossy sand
#

channel.send('', embed); iirc

thorny hinge
#

^ lol

#

I mean

#

channel.send({embed: embedname});

#

That works

#

Or
channel.send({embed}) if the embed is called embed

glossy sand
#

also can't you just message.reply(embed)

#

er no that's just my own code

thorny hinge
#

Haven't tried

quasi marsh
#

Okay so I'm not the kind of person to really be desperate for help, but I might really need some shit explained

#

So gotta be fair, my database is pretty shit, consisting of 150+ ini files with configparser

#

So I want to switch to redis, and automatically backup to SQL everyday (but that's not important)

#

I've written a script that for each file in my database, will write it to redis using a `server_id:setting' approach

#

But for some reasons, even with the exact same database on my local machine vs the server, the results get completely buggered sometimes

#

Some settings seem to be perfectly transfered over, whilst others give strange results

#

So for my migrating script, I use the following code to get a file

for file in os.listdir('.'):
    if fnmatch.fnmatch(file, '*.ini'):
        config.read(file)
        file_name = file.replace(".ini", "")
#

And to retrieve a file and set it in Redis, I'm using

            try:
                r.set(name=config['settings']['server_id'] + ":prefix",
                      value=str(config['settings']['prefix']))
            except KeyError as e:
                r.set(name=config['settings']['server_id'] + ":prefix", value=";")
#

This especially seems to occur with non-required values

#

But when that value does not exist, it should throw a KeyError as configparser would

#

And set the value to it's default

earnest phoenix
#

I have an issue aswell

#

In my async function

#

Sometimes things arent running async

#

Which doesnt make sense

quasi marsh
#

They're only async if you await them

#

afaik

earnest phoenix
#

I did

quasi marsh
#

Not everything is a coroutine

earnest phoenix
#

?

#

Nice vocab

quasi marsh
#

Some things are just natively blocking

earnest phoenix
#

Im using awaitMessages though

#

It works in small quantities

#

And im getting very few hiccups

#

But im puzzled on why im getting hiccups at all

#

By hiccups I mean slip-ups when the program runs

quasi marsh
#

What kind of slip-pus?

earnest phoenix
#

Well

#

What it does is

#

It sends a question

#

waits for a response

#

Sends the response somewhere else

#

And etc

#

Over and over

#

But

#

Sometimes

#

The questions take their own questions and send them as a response

#

For example

#

YEAH

#

DONT USE PYTHON

quasi marsh
earnest phoenix
earnest phoenix
#

anyone got good resources for passportjs or a related authentication system?

inner jewel
#

@obsidian sleet ๐Ÿ‘‹

earnest phoenix
#

๐Ÿ‘‹

glossy sand
#

if you google "passportjs example", there are a ton of example applications using express, restify, etc.

crystal void
#

..

crystal void
#

people, I have a problem with a person, he banned me from his server and I want to unban myself via my bot (it's in that guild, yes + it has admin perms) anyone who could help?

thorny hinge
#

D.js? @crystal void

crystal void
#

ye

#

the problem is that I never used that :/

thorny hinge
#

client.guilds.get(id).unban(ur id)

crystal void
#

kk, thx โค

thorny hinge
#

You know the server's id?

crystal void
#

wait.... I don't have the id

#

I could get it

#

when they execute any command, I log the server id to the console ๐Ÿ˜„

#

I have the id of one of the channels in the guild

#

but that wouldn't help

#

:/

thorny hinge
#

Yes it would

#

client.channels.get("channel id").guild.id

crystal void
#

oh... good

thorny hinge
#

:+1:

crystal void
#

โค

#

thx bro

earnest phoenix
#

.

#

@thorny hinge dont you dare copy my nick

#

jkjk

crystal void
#

๐Ÿคฆ

earnest phoenix
#

@crystal void you sure they didnt remove your bot?

crystal void
#

ye

#

I log everything into console

#

for now

#

it might become very bad when it's in 50+ guilds

earnest phoenix
#

lool

crystal void
#

and now.. @thorny hinge how to delete an invite link via bot, how to execute a command from one server but the result is in another (what I want to do it delete the old invite link my bot created, and from my guild, create a new invite link for that guild (already made a command for creating instant invites))

thorny hinge
#

I mean if u already know how to create invites for ur own server u can easily do
client.guilds.get("jsjsendjdjejd").doYourStuff

crystal void
#

oh.. yeah

#

xD

#

I'm so dumb

crystal void
#

@thorny hinge sorry for the 100000 ping, but, how does the bot delete an invite (or all of them)

#

SSS jumps in...

torn finch
#

I would get the invites and then run a loop or something that deletes them

#

and yeah I jumped in

#

deal with it

crystal void
#

hmm... good idea

#

but... how would you get them?

torn finch
#

what lib are you using?

#

I assume D.js but who knows

crystal void
#

ye

#

xD

torn finch
crystal void
#

oh.. ๐Ÿคฆ

torn finch
#

Try looking at the docs sometime ๐Ÿ˜‰

crystal void
#

I just don't read

torn finch
#

screw reading that's not important

crystal void
#

ctrl+f

quiet bobcat
#

Can someone help me? I'm trying to make a userinfo command but it changes timezone so for me its GMT+0100 but for my bot its GMT+0000.

#

I want it to only be GMT+0000

#

And I'm using discord.js

crystal void
#

docs

torn finch
#

uhhhhhhhh

crystal void
torn finch
#

You can't make it GMT+0000 unless you teleport everyone to that timezone

crystal void
#

xD

quiet bobcat
#

That's going to be hard

torn finch
#

just a little hard

#

right?

quiet bobcat
#

Yeah

torn finch
#

Idea!

#

Make it check if the timezone is GMT+0000 and if it isn't, then ignore them!

#

problem solved, right?

quiet bobcat
#

I guess

#

How do I even check for timezones?

crystal void
#

๐Ÿคฆ

torn finch
#

idk

crystal void
#

docs

#

https://discord.js.org might just help

quiet bobcat
#

I'm already there

#

Don't know where to look

#

To make it check for timezones

crystal void
#

ctrl+f

#

and search for it

torn finch
#

or CTRL+W and then search for it

crystal void
#

yup..

quiet bobcat
crystal void
#

xD

#

if you actually did it.. just do ctrl+shift+t

#

and it shall bring it back ๐Ÿ˜‰

quiet bobcat
#

I know ๐Ÿ˜‰

#

I've looked through every doc type

#

Not a single one says anything about timezones

crystal void
#

mozzila JS docsห™

#

enjoy ๐Ÿ˜‰

torn finch
#

thats because you can't search for basics

crystal void
#

agreed

torn finch
#

figure out those blanks and you have redeemed urself

crystal void
#

mozilla*

#

yup

#

xD

quiet bobcat
#

this is going to take a while

crystal void
#

enjoy

torn finch
#

listen bub you didn't want to search the docs

#

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

quiet bobcat
#

Yeah I guess, my fault

crystal void
#

agreed

#

with boh

#

both*

quiet bobcat
crystal void
#

idk

#

u read it ๐Ÿ˜‰

torn finch
#

that is up to you

crystal void
#

or use ctrl+f

quiet bobcat
#

Thank you guys, I found it

crystal void
#

np ๐Ÿ˜„

torn finch
#

ใŠ—

hoary sphinx
#

Can somoene help with this ```JavaScript
module.js:538
throw err;
^

Error: Cannot find module '/app/bot.js'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3```

#

Im using heruko

bitter sundial
#

the file /app/bot.js doesn't exist

mighty barn
#

Pretty self explanatory

torn finch
#

@hoary sphinx What is the dir of the file you want to access?
(From your main bot folder)

hoary sphinx
#

Idk if heruko is trying to aces it

#

Access*

#

My bot code dosen't want to access it

torn finch
#

The file Bot.js is capitalized, while the file your code was trying to access (bot.js) is not

hoary sphinx
#

Ok

#

Thanks man

torn finch
#

This is a very delicate system

#

no problemo

hoary sphinx
#

Yes

#

Ok

#

Note to self : Use capatilisation

fervent goblet
#

don't use it in the files

torn finch
#

^

earnest phoenix
#

Posting here again

#

I own a website, it shows discord bots on my server. But right now, i have to add them manually. I would want it to add automatically when a bot joins, anyone know?

glossy sand
#

use a bot that listens to user join events

earnest phoenix
#

i got one

#

bot*

earnest phoenix
#

ok so like

#

use a bot you have created

#

for users in the discord check if user has the bot tag

#

if it does getElementById('your div ele').innerHTML += bot name

#

if you want to be really cool use sockets so it live updates

#

lik uh

#

mainjs```js
//assuming you already have a bot that has a function to fetch all users on discord

let fetch_user_bot = require('fetch_user_bot')

io.on('connection', (socket)=>{

socket.on('get-bots', ()=>{
    let bot_array = []
    let user_object = fetch_users_bot.fetch() //assuming it returns an object with username:boolean boolean being whether its a bot account or not

    for(user in user_object){
        if(user_object[user] = true){
            bot_array.push(user)
        }
    }

    socket.emit('bot_user_list', bot_array)
})

})```

#

something like that

#

if you want help setting up something like that dm me babe

uncut slate
#
if(user_object[user] = true)
#

๐Ÿค”

earnest phoenix
#

oh wait

#

ignore that syntax wrote on mobile

#

lol

uncut slate
#

fair

earnest phoenix
#

just an example for babe

#

i have a firm belief that sockets are the future

#

lol

#

var should be executed

#

let and const reign supreme

#

anyone know good resources for theming other then bootstrap/bootswatch

#

something similar

#

nah

#

i just use bootstrap

#

yea i guess

#

i have this horrilbe habbit on templating out all my programs or sites in ms paint

#

apposed to something more usefull like photoshop

#

i dont have money for photoshop

#

and its not needed for me

fervent goblet
#

Cracked ps

#

Works perfect

#

I'm going to install it on my PC later agaib

#

Again*

earnest phoenix
#

im about to publish the most advanced node library ever

#

bam

#

most advanced library

#

ever

tawny lava
#

holy hell

#

how does he do it

earnest phoenix
#

most advanced mathmatics library ever

#

now hold up

#

watch this

#

Major update 2.0 out now @tawny lava

#

its a trick

#

you see

#

if you trick them into thinking its subtraction

tawny lava
#

it's still + wew

earnest phoenix
#

then they will

#

believe it

tawny lava
#

amazing

earnest phoenix
#

and i will be payed more then i should be

uncut slate
#

you might want to consider parseFloat

earnest phoenix
#

oml

steel shoal
#

Only the servers

#

i need to add that to my site

bitter sundial
#

that looks like the wrong site zoomeyes

uncut slate
#

kek

steel shoal
#

I need something like that ๐Ÿ˜„ @bitter sundial but indeed its the wrong site ๐Ÿ˜‰

bitter sundial
#

-bots @steel shoal

gilded plankBOT
#
MR.DARK2001#9259
Bots

@simple hinge

bitter sundial
#

-botinfo @simple hinge

gilded plankBOT
#
Bot info
ID

348187123536494592

Username

BOT ZONE

Discriminator

0735

Short Description

A bot that can make your server a more lively and fun place!!

Library

discord.js

Prefix
Upvotes

2

Server Count

No server count

Owner(s)

@steel shoal

Links
steel shoal
#

its still muted

bitter sundial
#

do you mean

steel shoal
#

thats cool tho

#

that command

bitter sundial
#

you want to have your servers shown on this website?

steel shoal
#

yes pleas

bitter sundial
steel shoal
#

i take a look thx

#

i did't know that

#

and you must know how i can and the status (online) to an server

#

@bitter sundial sorry for the tag...

bitter sundial
#

wwhat do you mean

bitter sundial
steel shoal
#

i know now how i can add the server count but the online butten thatc cool

bitter sundial
#

that page already has that

steel shoal
#

Im building a site for my bot

#

and i would like to add that to the site

bitter sundial
#

ah

#

then the widgets

steel shoal
#

๐Ÿ˜…

#

can i pm you?

bitter sundial
#

go and edit your bot and scroll down ๐Ÿ˜„

steel shoal
#

i share the site

bitter sundial
#

no need

steel shoal
#

Okey np

#

but can you tell me how i can add that?

bitter sundial
#

you see the thing at the bottom of the edit?

steel shoal
#

hmm where?

bitter sundial
#

log in if you aren't

#

and click edit

#

and scroll down

steel shoal
#

okey second

#

I see it thx ALOT!

earnest phoenix
#

i dare someone to put this in their code อพ

#

and then forget about it

fervent goblet
#

wot

earnest phoenix
#

its not a semicolon

#

it iwll error out the code

#

i spent thousands of hours and im proudly introducing

#

my new math library

fervent goblet
#

j'idiot

#

lol uber

#

very useful

earnest phoenix
#

very

#

most innovative thing since html5 :^)

fervent goblet
#

lol

earnest phoenix
crystal void
#

lol

earnest phoenix
#

hek

uncut slate
#

what the fuck

#

that indentation is probably the worst part

#

also, I don't think ^ is a thing in JS

#

you'll want Math.pow or **

bitter sundial
#

ah yes

#

^ is xor

cosmic plover
#

OH GOD WHAT THE FUCK IS THAT BRACKET INDENTATION

inner jewel
#

kek

#

kodepls

cosmic plover
#

@hollow abyss found someone who unironically did that

hollow abyss
#

Oh yeah that

earnest phoenix
#

hey

pale light
#

hi

earnest phoenix
#

yall making fun of my 1337 library indentation

#

how dare u

#

would u rather me write it on one line

#

everyone knows all your brackets go 5 tabs in

#

and your semi colons go on the next line

tawny lava
#

Ew no

#

You put all of your code in one line smfh

#

Do you even code?

earnest phoenix
#

do you even code? its pretty obvious you write code in jsfuck and convert it to practical js

#

quality

tawny lava
#

Beautiful

earnest phoenix
#

the most beutiful is that one shakespearean code

tawny lava
#

What the fuck

earnest phoenix
#

code entirely wrwitten in emojis

tawny lava
#

Some people have too much time on their hands

earnest phoenix
#

i mean all i see these as are a bunch of #defines

#

tbh

#

i make sure to convert all my code to jsfuck before i publish to github

tawny lava
#

Very good idea I'm gonna start doing that

slate comet
#

msg.channel.send("this is invalid code")อพ

wanna know why

#

the "อพ" i used is a greek question mark!!!

earnest phoenix
#

I want to put Python code what are the bugs that I need but I do not want Red Bot

fervent goblet
#

u don't copy code

#

write yo orn

#

own*

wooden shoal
#

^

earnest phoenix
#

pretty

#

idk how to design background

#

:/

wooden shoal
#

cool

#

you coud probably google how to add an image to the background

earnest phoenix
#

i know how to

#

but i gotta design hte map

wooden shoal
#

oh

earnest phoenix
#

and why am i in this channel how did i get here

wooden shoal
#

lol dik

#

idk*

fervent goblet
#

lol

topaz fjord
#

my razer synapse be fucked

tawny lava
#

same lol

#

trash software

#

my mouse isn't displaying any colors and the app doesn't open

shrewd field
#

hello
Uncaught Promise Error: TypeError: Cannot convert undefined or null to object
I have this error can someone help
Thanks

prime cliff
#

Something is undefined ofc

pale light
#

hm

#

is there an npm module for reading a permissions bitfield zoomeyes

earnest phoenix
#

@here any devs willing to help meh?

prime cliff
#

Nice fake ponk

icy lynx
#

Can someone give me a CSS style for the discordbots bot page?

earnest phoenix
quiet bobcat
icy lynx
#

looks like there's no such file or directory

earnest phoenix
#

why

quiet bobcat
#

Yeah

icy lynx
#

but that's a guess

quiet bobcat
#

Its case sensitive btw

earnest phoenix
#

What is the solution

icy lynx
#

check if it exists

#

type ls

earnest phoenix
#

I have installed all the files

icy lynx
#

and screenshot

#

type ls

earnest phoenix
#

ok

icy lynx
#

THere's no such file

#

that's why it doesnt exist

quiet bobcat
earnest phoenix
#

What is the solution

icy lynx
#

Read redbot docs

quiet bobcat
earnest phoenix
#

yes

icy lynx
#

Read it, your solution is somewhere inside

prime cliff
#

AHHH REDBOT

inner jewel
#

REDBOT

#

CLONE

earnest phoenix
#

can i get help please?

fervent goblet
#

@earnest phoenix red clone......

#

noob

earnest phoenix
#

wuts wrong with this

#

}
if (msg.startsWith( prefix + 'SCAM ' + arg[1])) {
let scammer = args[0];
let reason = args[1];
const embed = new Discord.RichEmbed()
.setTitle('Scamming')
.setDescription('Reported By:' + message.author.tag)
.addField('Reason:', "${reason}")
.addField('Scammer:', "${scammer}")
.setColor(0x52c7d3)
message.channel.send(embed);

}

prime cliff
#

scam?

earnest phoenix
#

yeh

prime cliff
earnest phoenix
#

its for my server

prime cliff
#

What lang/lib is that?

icy lynx
#

ScamLib

fervent goblet
#

java

earnest phoenix
#

is node.js

fervent goblet
#

how

earnest phoenix
#

discord.js

#

to be specific

quiet bobcat
#

What's the error?

fervent goblet
#

LOL

#

L O L

#

+arg[0]

#

or

#

1

#

whatever

#

it

#

was

#

thats the culprit

earnest phoenix
#

so all i gotta do is add +arg[0]?

#

wut exactly am I trying to do

prime cliff
#

Try debug it :3

icy lynx
#

what is the issue
wut exactly am I trying to do

earnest phoenix
#

ok

fervent goblet
#

OH MY GOD

#

IT MEANS

#

REMOVE IT

#

jesus

earnest phoenix
#

K

icy lynx
#

Are we allowed to steal copy CSS code from other botpages ๐Ÿ‘€

quiet bobcat
#

I guess

fervent goblet
#

yep

glossy sand
#

it's implicitly copyrighted

#

unless dbl has some weird ToS clause that says otherwise

fervent goblet
#

theres no rule that says you can't copy it

glossy sand
#

I think the DMCA counts as a "rule"

fervent goblet
#

and you can't just say ey this css is mine, it may happen how people would write the exact same css on accident

icy lynx
#

Indeed, it depends who owns the CSS once set. User or discordbots?

fervent goblet
#

discordbots

glossy sand
#

wtf do you mean I can't

#

what if I accidentally rewrote the entirety of windows 10 from scratch

#

that doesn't stop microsoft from copyrighting their code

icy lynx
#

By using this website, you agree to give up your right to pursue legal action against www.discordbots.org or any of its affiliates, sponsors, partners, staff or entities.

#

wut

#

All material on www.discordbots.org is the sole property of www.discordbots.org , with some exceptions, including bot avatars, bot names, bot owner names, usernames of users of services provided by www.discordbots.org , and other user submitted content.

#

Meaning discordbots doesn't own user-submitted CSS

earnest phoenix
#

@fervent goblet Can you give me the necessary code to install Python on the Ubuntu system

fervent goblet
earnest phoenix
#

๐Ÿ˜ข

#

plz

fervent goblet
#

google๐Ÿ‡ด๐Ÿ‡ดgoogle๐Ÿ‡ฑ๐Ÿ‡ช

earnest phoenix
#

๐Ÿ˜•

glossy sand
#

I'm sure an apt-get install python should be sufficient

quiet bobcat
#

Yeah google it

fervent goblet
#

nop

#

apt get install python diesn't install 3

#

doesn't*

#

and btw

glossy sand
#

apt-get install python3 whatever

fervent goblet
#

python is installed by default

#

on ubuntu

icy lynx
#

^

#

To run, use python3

earnest phoenix
#

hm how run bot py

fervent goblet
#

Any python developer who wants to collaborate on a new project? DM me if interested

glossy sand
#

python somePythonFile.py

fervent goblet
#

SnoW please learn english

#

this is torture

glossy sand
#

or python3 somePythonFile.py I suppose

icy lynx
#

python3 file.py

earnest phoenix
#

@fervent goblet Actually I'm not English

glossy sand
#

maffie did you know you can help people without insulting them every 20 seconds?

fervent goblet
#

I noticed SnoW

#

and I"m not insulting anyone

#

I'm just being honest

glossy sand
#

well if I'm going to be honest you're an ahole

icy lynx
#

Also, it might be that you have an older version, use sudo apt-get update and sudo apt-get upgrade

glossy sand
#

but you're not going to catch me saying that offhand

fervent goblet
#

how sweet of yo

fervent goblet
#

Any python developer who wants to collaborate on a new project? DM me if interested

glacial vale
quiet bobcat
#

Nice

glacial vale
#

@fervent goblet i would but im already working on my Snowflake bot

fervent goblet
#

you can work on multiple

glacial vale
#

hmm

earnest phoenix
#

i have a host called glitch which i use for my bot and my website, but they are in different projects, now i want to get the post count from my bot to my website, how do i do this?

icy lynx
#

GET /api/bots/:idย - Get info of a certain bot

earnest phoenix
#

i'm not trying to get info from this website

#

i'm trying to get my bot's server count to MY website

icy lynx
#

If you use their API to add your bot's server count to their website, you can use their API to get the srrvercount to your website

earnest phoenix
#

isn't their api is for their website?

prime cliff
#

No you can use it for anything

earnest phoenix
#

oh, how so?

request({
    method: 'POST',
    uri: `https://discordbots.org/api/bots/${client.user.id}/stats`,
    headers: {'Authorization':process.env.SERVER_COUNT1},
    json: {"server_count" : client.guilds.size}
  });

how can i do something like this to my website?

prime cliff
#

Pretty much all bot list sites have an API and i use all of them in my bot p/getbot

earnest phoenix
#

so how do i use this api on my website, example would be nice, because i have no idea

#

?

twilit lichen
#

@viscid widget

#

!stats

quiet bobcat
wooden shoal
#

@brisk notch ```css
#bot-img>.bot-img>img {
border-radius: 50%;
animation-name: icon;
animation-duration: 3s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}

@keyframes icon {
0% {
transform: translate(0, 0);
}
50% {
transform: translate(0, -20px);
}
100% {
transform: translate(0, 0);
}
}

brisk notch
wooden shoal
#

thats how you do the css animations

brisk notch
#

let me try

hallow wing
#

@trim steppe am I in trouble o.o

trim steppe
#

what?

#

why would you be in trouble

hallow wing
#

I saw my bot got muted that;s all o.o

#

working on fix rn

topaz fjord
fervent goblet
#

its the correct value

hallow wing
#

can someone tell me how to stop say looping

#

?

#

in python

uncut slate
#

ignore bot messages

hallow wing
#

how do I do that lol?

earnest phoenix
#

Hi is someone here a Discord.js god?

glossy sand
#

just ask your question

#

no point asking to ask

earnest phoenix
#

Cannot read property 'split' of undefined

#

In args.

topaz fjord
#

show codeee

glossy sand
#

I mean presumably you're trying to call split() on an undefined variable

#

maybe you mistyped something?

earnest phoenix
#

message.content.split(/[ ]/).slice(1).join(" ");
?

topaz fjord
#

so

#

message.content

#

is undefined

glossy sand
#

perhaps the message has no body

#

e.g. someone uploads an image but with no caption

hallow wing
#

fixed @trim steppe

trim steppe
#

๐Ÿ‘

hallow wing
#

can someone tell me why this isn't working right or what this error means?

quasi marsh
#

@hallow wing

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    else:
        do_command_handling_here()
#

or simplified

@client.event
async def on_message(message):
    if message.author != client.user:
        do_command_handling_here()
#

That's for looping

#

aexit means that the async code was closed, is your aiohttp being run in an async function?

#

So ```python
async def thing(arg):
pass

#

instead of

#
def thing(arg):
    pass
hallow wing
#

yea

quasi marsh
#

Can you send the code segment around line 1975?

hallow wing
#
async def on_ready(self):
        token = 'censored'
        post = {
        'server_count': len(self.servers)
        }
        headers = {
        'Authorization': token
        }
        url = 'https://bots.discord.pw/api/bots/366772786573869058/stats'
        async with aiohttp.ClientSession as session:
            resp = await session.post(url, data=post, headers=headers)
            resp.close()


        dbltoken = "censored"
        url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
        headers = {"Authorization" : dbltoken}
        payload = {"server_count"  : len(bot.servers)}
        async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)
            resp.close()```
quasi marsh
#

ah

#

Okay first things first

#

Don't make new sessions

#

Just do at the bottom

#
async with aiohttp.ClientSession() as aioclient:
    await aioclient.post(url, data=json.dumps(payload), headers=headers) as pw_resp:
        pass
    await aioclient.post(url2, data=json.dumps(payload2), headers=headers2) as dbl_resp:
        pass
icy lynx
quasi marsh
#

Don't forget to import json and rename your headers for dbl.org to headers2, payload to payload2 and url to url2

#

Sorry bugs fixed

hallow wing
#

ty

icy lynx
#

Looks good ๐Ÿ‘

#

But hmm, why would you do that on_ready?

quasi marsh
#

To send the initial payload if you have to reboot your bot?

#

I use it in on_ready, on_guild_update and on_guild_remove

icy lynx
#

Same, but I dont have the token inside on_ready

#

And the other vars

quasi marsh
#

Same

#

I do not recommend storing any kind of token inside the code

icy lynx
#

Ye

quasi marsh
#

If it's open source and you do a forgetti moms spaghetti you're fucked

icy lynx
#

๐Ÿ‘Œ

hallow wing
#

can just regen a new token

icy lynx
#

Better safe than sorry

quasi marsh
#

That's more work than just doing the right thing anyway

icy lynx
#

It also makes testing easier

#

As in, you dont have to change the tokens everytime

quasi marsh
#

Exactly, I just use my test config locally and when I upload it it doesn't matter since it now uses the config on my server

shy rose
#

On patreon its with both ranks that have that

pale light
#

lol

earnest phoenix
quasi marsh
#

You forgot sudo

earnest phoenix
#

how

quasi marsh
#

In front of your command

#

So sudo apt install

earnest phoenix
#

ok

quasi marsh
#

It will prompt for your password

earnest phoenix
#

the same problem

#

I have installed it

#

.

icy lynx
#

Screenshot @earnest phoenix

#

With sudo

earnest phoenix
#

end this

rich kiln
#

yore using c9

#

u have to do sudo su

earnest phoenix
#

or sudo -i

#

same thing

fervent goblet
#

oh fuck maybe I should make it class Database instead of def Database

#

jeez

#

not the only mistake in all that code

#

fortunately I only wrote 200 lines yesterday

#

it was at 11pm

#

or I'd have 2000 issues to solve

fervent goblet
#

Whats the difference between redis.Redis and redis.StrictRedis

north fog
#

not sure, but I think that one is more strict then the other (think like types)

stone kiln
#

@fervent goblet


    In addition to the changes above, the Redis class, a subclass of StrictRedis, overrides several other commands to provide backwards compatibility with older versions of redis-py:

        LREM: Order of num and value arguments reversed such that 'num' can provide a default value of zero.
        ZADD: Redis specifies the score argument before value. These were swapped accidentally when being implemented and not discovered until after people were already using it. The Redis class expects *args in the form of: name1, score1, name2, score2, ...
        SETEX: Order of time and value arguments reversed.

So you should stick to Redis class if you have used redis-py for a long time - it has some commands' argument's order changed to seem more Pythonic (or even by accident). ```
fervent goblet
#

oh fuck that

#

no need for that

stone kiln
#

StrictRedis you ain't gonna need XD

fervent goblet
#

hm I tried decode_responses while initializing the redis class

#

but apparently I need to do it while initializing the connection pool

fervent goblet
#

why do we even use : in redis

stone kiln
#

because of basic py functions that have the same name

fervent goblet
#

oh now I see

#

The colons have been in earlier redis versions as a concept for storing namespaced data. In early versions redis supported only strings, if you wanted to store the email and the age of 'bob' you had to store it all as a string, so colons were used:

stone kiln
#

yeah

fervent goblet
#

nice

quasi marsh
#

Yeah

#

And I think that stuck around

#

Cus it's not a bad method