#development

1 messages Β· Page 650 of 1

onyx summit
#

why do you guys make it so complicated

low wasp
#

You will want an interval but he asked for a set timeout

onyx summit
#

promisify setTimeout and loop trough it

maiden mauve
#

setTimeout would need to be in a recursive or a loop

low wasp
#

Yes

glad charm
#
const arr = str.split("");

for(char in arr) {
    setTimeout(() => {
        console.log(char);
    }, 1000)
}```
onyx summit
#

that won't send it with 1 sec apart

#

that will log all of them after ~1 second

glad charm
#

Right

maiden mauve
#

function doItAgain() {

    setTimeout( () => {



        doItAgain();
    }, 1000);

}

#

thats in a recursive

#

the blank space is whatever you wanna do until you break the loop with a return

onyx summit
#

why so hard

maiden mauve
#

hard or easy to read?

#

I don't know exactly what hes trying to accomplish

onyx summit
#
(async () => {
    const output = Array.from("string");
    const timeout = require('util').promisify(setTimeout);
    for (const ch of output) {
        await timeout(1000);
        channel.send(ch)
    }
})();
maiden mauve
#

as proved by the "hello world" challenge the simplest solution is writing a programming language that outputs "hello world"

#

πŸ˜›

onyx summit
wide ruin
#

ok sorry im back

west spoke
wide ruin
#
 s.split("")
    setTimeout(function () {
      writeAnswer(s[i])
    }, 1000)```
#

so i have that

#

now what

maiden mauve
#

correct Timout

#

to Timeout

#

πŸ˜‰

wide ruin
#

wait yeah

onyx summit
#

yeah have fun doing it recursive with old callbacks

wide ruin
#

wait i ned to go through every letter

#

so setinterval?

onyx summit
#

you either understand what he was trying to tell you, and adapt it to your needs (what would require a few parameters) or you use the promise and for..of loop that I made

maiden mauve
#

CHY's answer is a good example of using async in a abstract code

onyx summit
#

but I'm dumb its the wrong loop, I need for..of

#

fixed

maiden mauve
#

but if someones asking how to do something in a 1 second interval

#

the go-to answer usually isn't a number of shortcuts

#

🀷

#

I'm not a pro at this stuff. I only understand what you wrote by picking it apart

wide ruin
#
var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "..."
    (async () => {
      const output = Array.from(s);
      const timeout = (require('util').promisify(setTimeout));
      for (const ch of output) {
        await timeout(1000);
        writeAnswer(ch)
      }
    })();```
#

so like that right?

#

ok so does that work inside of a normal function?

onyx summit
#

wait, we are talking in the browser?

maiden mauve
#

πŸ˜„

wide ruin
#

electron

glad charm
#

var

onyx summit
#

oh then its okay

#

but remove (async () => { and })();

#

it was just for my purpose cause my eval isnt async

wide ruin
#

ok cool

onyx summit
#

I'm not sure but I think electron supports requiring node modules? if not search for a polyfill

wide ruin
#

Uncaught TypeError: "..." is not a function

maiden mauve
#

btw when did using in/of in for loops become popular?

wide ruin
#
document.getElementById('answer').innerHTML = "..."
    (async () => {```
onyx summit
#

at PineappleFan has nothing to do with my code

#

...

#

I said you should remove that function wrapping stuff

wide ruin
#

uuh

onyx summit
#

and I think the lack of semicolons cause js to execute "..." as a function lmao

wide ruin
#

and yeah it supports it

onyx summit
#

use semicolons

wide ruin
#

sorry i mainly do py

onyx summit
#

just saying shrug

wide ruin
#

so it sets the getelementbyid to "..."

#

but it just stops there

onyx summit
#

what is the code right now

wide ruin
#
else if (textboxValue.startsWith('spell')) { // spell 
    var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    (async () => {
      const output = Array.from(s);
      const timeout = (require('util').promisify(setTimeout));
      for (const ch of output) {
        await timeout(1000);
        writeAnswer(ch)
      }
    })();
  }```
onyx summit
#

just remove (async () => { and ` })();

` it was just needed for my case

wide ruin
#

its broke the whole code

onyx summit
#

man are you sure you can do this?

wide ruin
onyx summit
#

you are just supposed to copy and paste code and modify it to your needs

#

why are you not able to do that

maiden mauve
#

its harder to screw up a recursive

#

πŸ˜‰

wide ruin
#

yes

glad charm
#

Bet

onyx summit
#

StackOverflow is coming baby

wide ruin
#

i have just copied it

#

but now its broke function check() {

#

which is what this is inside

onyx summit
#

yeah it has to be a async function...

#

cause that code is using async/await

#

obviously

wide ruin
#

so will i have to go and change eerything else in the code to make it work with async?

maiden mauve
#

1 thing

wide ruin
#

idk i havent used it

maiden mauve
#

if you use await the function must be defined as "async function"

onyx summit
#

I said that

wide ruin
#

what other thing?

onyx summit
#

what? thats it

wide ruin
#

oh ok

#

i thought it was something inside

#

again it changes the getelementbyid but doesnt do the loop bit

#

no errors

onyx summit
#

your problem, you where already spoonfeeded code and still can't get it running

low wasp
#

Console log output after declaring it

#

Verify its in an array you want it to be

maiden mauve
#

@wide ruin if you don't understand code, say so, don't try to jackhammer a nail in the wall

#

There are more basic solutions you could understand and use

wide ruin
#

ok can i try a different way

quartz kindle
#

what are you even trying to do?

wide ruin
#

@maiden mauve

#

writeanswer() to each letter of a string, doing 1 letter every second

maiden mauve
#

I wrote a simple recursive back aways

#

You just have to call the function

quartz kindle
#

what does writeanswer() do?

maiden mauve
#

But Tim might help you it looks like

#

πŸ‘

wide ruin
#
function writeAnswer(inString) {
  document.getElementById("answer").innerHTML = inString;
  responsiveVoice.speak(inString);
}
quartz kindle
#

that will always replace the previous character with the next one

#

is that what you want to do?

wide ruin
#

yes

#

so like s

quartz kindle
#

ok

#

so yeah, you have three options

#
  1. recursive function
  2. increasing timeouts
  3. async/await loop
wide ruin
#
else if (textboxValue.startsWith('spell')) { // spell 
    var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = (require('util').promisify(setTimeout));
    for (const ch of output) {
      await timeout(1000);
      writeAnswer(ch)
    };
  } ```
#

i tried that but it didnt work

quartz kindle
#

is that code block inside another function? where does it run from?

wide ruin
#

its inside async function check()

#

which is ran by clicking a <button> or pressing enter

#

that bit worked fine

#

but that bit stops it all

quartz kindle
#

did you try console logging the for loop to see if it works?

#

for(){
console.log("a")
}

wide ruin
#

uuh no

quartz kindle
#

to see if they work, and if they come 1 at a time, or all at once

wide ruin
#

but nothing worked at all

quartz kindle
#

thats why debugging exists

#

you analyze your code in parts and see what works and what doesnt

#

did you put the console log in? did it work?

wide ruin
#

literally nothing run?

west spoke
#

Send your full code in hastebin

wide ruin
#

hang on do i need to change how i run the function>

quartz kindle
#

well, put more console.logs backwards until one that works

west spoke
#

perhaps

quartz kindle
#

you can start by simply putting a console log at the very beginning of the function that is called by the click

#

console.log("ok, click works")

wide ruin
#

typing "hello"

#

runs the function like normal and deletes the textbox thing

#

typing "spell something" just sets the top bit to "..." and stops

quartz kindle
#

is runs the function like normal and deletes the textbox thing what you want to happen?

wide ruin
#

it should make the input empty which it does on every other command

#

and the top text should say each letter 1 sec apart

quartz kindle
#

could you answer my question?

wide ruin
#

so when you run spell

#

it deletes the textbox value, but that happens when the async check () { completes

#

then the top text will read out all of the letters of s ( the input without "spell " at the start) with 1 second apart

#

and by read out, it does writeanswer()

quartz kindle
#

you still didnt answer my question, is it currently working the way you want it to, or not?

wide ruin
#

no its not

#

it doesnt do the reading out bit

quartz kindle
#

it seems you're mixing what it does and what you want it to do without any obvious distinction, so i cant understand which parts are working and which parts are not

wide ruin
#

at the moment it just changes the value of answer

quartz kindle
#

so back to what i originally said, did you put the console.log in there? did you test if the loop works?

wide ruin
#
else if (textboxValue.startsWith('spell')) { // spell 
    var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = (require('util').promisify(setTimeout));
    for (const ch of output) {
      await timeout(1000);
      writeAnswer(ch)
    };
  } ```
#

answer is the top text bit, getElementById

#

the loop doesnt work

quartz kindle
#

so the answer gets changed to ...?

wide ruin
#

yes

quartz kindle
#

did you put the console.log inside the loop?

wide ruin
#

yes

quartz kindle
#

did the console.log say anything?

#

where did you put it? before the await line?

wide ruin
#

hang on lemme check this

#
else if (textboxValue.startsWith('spell')) { // spell 
    var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = (require('util').promisify(setTimeout));
    for (const ch of output) {
      console.log('1')
      await timeout(1000);
      writeAnswer(ch)
      console.log('2')
    };```
#

it outputs 1 but not 2

#

no errors

#

also writeanswer works fine

quartz kindle
#

put it between await and writeanswer

wide ruin
#

normally

#

it did not output 1.5

#

in between the lines you said

quartz kindle
#

then the problem is the timeout function

wide ruin
#

ok

onyx summit
#

It works fine in node.js so I don't think so

wide ruin
#

how do i check what it is?

quartz kindle
#

after a quick google search, that's not the proper way to promisify settimeout

onyx summit
#

so how then?

quartz kindle
#

util.promisify((a, f) => setTimeout(f, a))

onyx summit
#

scroll down to node, it works perfectly fine in node.

wide ruin
#

ok so how do i write this bit

onyx summit
#

what is responsiveVoice.speak(inString); even

wide ruin
#

it just reads something out

onyx summit
#

I mean, you can remove the timeout and we will see if it works then

quartz kindle
#

but apparently is node 8, maybe things have changed since then

onyx summit
#

remove the timeout and will see if it works kthx

quartz kindle
#

you can also try try { await timeout(1000) } catch(e) { console.log(e) }

wide ruin
#

well

#

it just said "g"

#

"spell something"

#

so it just needs the delay

latent oasis
#
/root/CYBORG/node_modules/fs-nextra/dist/fs.js:5
_a = fs.promises, exports.access = _a.access, exports.copyFile = _a.copyFile, exports.open = _a.open, exports.rename = _a.rename, exports.truncate = _a.truncate, exports.rmdir = _a.rmdir, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.symlink = _a.symlink, exports.lstat = _a.lstat, exports.stat = _a.stat, exports.link = _a.link, exports.unlink = _a.unlink, exports.chmod = _a.chmod, exports.lchmod = _a.lchmod, exports.lchown = _a.lchown, exports.chown = _a.chown, exports.utimes = _a.utimes, exports.realpath = _a.realpath, exports.mkdtemp = _a.mkdtemp, exports.writeFile = _a.writeFile, exports.appendFile = _a.appendFile, exports.readFile = _a.readFile;
                                      ^

TypeError: Cannot read property 'access' of undefined
onyx summit
#

what node version

#

node -v

latent oasis
#

8.10.0

onyx summit
#

yeah update

latent oasis
#

hmm

#

i need to update it?

onyx summit
quartz kindle
#

well, considering the current version is 12

wide ruin
#
var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = (require('util').promisify(setTimeout));
    for (const ch of output) {
      console.log('1')
      try { await timeout(1000) } catch(e) { console.log(e) }
      console.log('1.5')
      writeAnswer(ch)
      console.log('2')
    };```
#

like that?

latent oasis
#

ohh lol

#

ok

quartz kindle
#

yes, check what that logs

latent oasis
#

@onyx summit is there any command for ubuntu terminal to update it?

#

first time using vps

quartz kindle
#

use nvm

wide ruin
#

well

#

it just says g again

onyx summit
#

uhhh tbh I used nvm but its all weird for me

wide ruin
#

i think the delay isnt working

onyx summit
#

we want to know what it logs not what it says

wide ruin
#

yesh it logs everything

quartz kindle
#

we know the delay isnt working, also why did you add () around the require util?

wide ruin
#

1
1.5
( responsivevoice stuff )
2

quartz kindle
#

also, how many times did it log?

wide ruin
#

9

onyx summit
#

@quartz kindle that was my code and I edited it a few times, so thats why there are still the (), I removed it tho

wide ruin
#

which is the amount of letters in something

#
var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = require('util').promisify(setTimeout);
    for (const ch of output) {
      console.log('1')
      try { await timeout(1000) } catch(e) { console.log(e) }
      console.log('1.5')
      writeAnswer(ch)
      console.log('2')
    };``` like that?
onyx summit
#

you can add a as many () as you want, not gonna change

#

anyway, it seems to be a problem with you or with electron, the code works super duper on node v10.15.3

wide ruin
#

im on 10 15 0

onyx summit
#

cool.

wide ruin
#

so is there a way that works on all versions?

quartz kindle
#

it should work in yours

onyx summit
#

I bet my ass it also works on 10.15.0

quartz kindle
#

another thing you can try is to move the require somewhere else

#

const util = require("util") on the top of you code

#

then just util.promisify()

wide ruin
#
else if (textboxValue.startsWith('spell')) { // spell 
    var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = require('util').promisify(setTimeout);
    for (const ch of output) {
      console.log('1')
      try { await timeout(1000) } catch(e) { console.log(e) }
      console.log('1.5')
      writeAnswer(ch)
      console.log('2')
    };```
#

this just locks up again

latent oasis
#

oh nei

i tried to reinstall nodejs and it still 8.10.0v
Linux Ubuntu

onyx summit
#

yeah tbh its a big mess

#

use nvm

quartz kindle
#

you cant get it from an ubuntu repo, those are outdated

onyx summit
#

and stuff

quartz kindle
#

use nvm

onyx summit
#

My code also works on v10.13.0

wide ruin
#

i did what you said @quartz kindle

#

Uncaught (in promise) NodeError: The "original" argument must be of type Function. Received type undefined

#
else if (textboxValue.startsWith('spell')) { // spell 
    var s = String(textboxValue.slice(6))
    document.getElementById('answer').innerHTML = "...";
    const output = Array.from(s);
    const timeout = util.promisify();
    for (const ch of output) {
      console.log('1')
      try { await timeout(1000) } catch(e) { console.log(e) }
      console.log('1.5')
      writeAnswer(ch)
      console.log('2')
    };```
quartz kindle
#

finally got something

onyx summit
#

.......

#

goodbye

#

just learn coding

quartz kindle
#

Lol

onyx summit
#

why am I even here

quartz kindle
#

why did you remove the setTimeout?

onyx summit
#

CaUsE hE dID wHaT tIm tOlD hIm

wide ruin
#

so what do i need to add?

quartz kindle
#

a brain

wide ruin
#

i literally did what you said

quartz kindle
#

you didnt do what i said, you copy/pasted what i said

#

its different

wide ruin
#

what do i do then

quartz kindle
#

you could try learning js

#

the single thing that creates delayed code is setTimeout how is your code supposed to work if you remove it?

earnest phoenix
#

How was your bot approved if you don't even know JS?

wide ruin
#

py

west spoke
wide ruin
#

how can i go through a string and add ". " after each char?

opaque eagle
#

Make an array from the string and join it with a "."

topaz fjord
#

not that hard

#

or

latent oasis
topaz fjord
#

try deleting package-lock.json and node_modules

latent oasis
#

oh god to delete node_modules 30 min

topaz fjord
#

rm -rf

#

it

latent oasis
#

to terminal?

topaz fjord
#

rm -rf node_modules/

#

in the directory

#

yes in terminal

latent oasis
#

oh lol

#

so fast

#

ok now trying to run npm i

#

ok now it keeps going

#

@topaz fjord ty so much

#

im so happy

topaz fjord
#

np

latent oasis
#

AHAHAH

#

it works

#

first time using vps for discord bot

opaque eagle
#

If I have a duration in milliseconds like 205267, how can I convert that to 3 min, 25 sec using moment?

shy turret
#

discord.js what happened?

#
(node:25012) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
    at item.request.gen.end (Location\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
    at then (Location\node_modules\snekfetch\src\index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:25012) 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: 2)
opaque eagle
#

Show code

shy turret
#

just nvm rather not

opaque eagle
#

ok

shy turret
#

prob just a internet bug or something

#

because I don't see any errors by myself on the code

opaque eagle
#

Well we can figure out what is wrong if we see the code, but up to you anyways...

shy turret
#

yep think it was just the api or something that did something for a sec

opaque eagle
#

As long as you're not using some weird add-on someone made you should be good

#

Also, update your discord.js version... I have a strong feeling that would fix it @shy turret

#

you're using an outdated version of discord.js

shy turret
#

maybe it's that, do i just npm install discord.js again?

#

(after CD)

#

ok did

opaque eagle
#

try running the code again

#

what's the version of discord.js shown in ur package.json?

shy turret
#

im going just reinstall everything wait

opaque eagle
#

oh ok, go ahead

shy turret
#

think it would be better

#
{
  "requires": true,
  "lockfileVersion": 1,
  "dependencies": {
    "async-limiter": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
      "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
    },
    "discord.js": {
      "version": "11.5.1",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.5.1.tgz",
      "integrity": "sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw==",
      "requires": {
        "long": "^4.0.0",
        "prism-media": "^0.0.3",
        "snekfetch": "^3.6.4",
        "tweetnacl": "^1.0.0",
        "ws": "^6.0.0"
      }
    },
#
    "long": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
      "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
    },
    "prism-media": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz",
      "integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ=="
    },
    "snekfetch": {
      "version": "3.6.4",
      "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
      "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="
    },
    "tweetnacl": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz",
      "integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A=="
    },
    "ws": {
      "version": "6.2.1",
      "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
      "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
      "requires": {
        "async-limiter": "~1.0.0"
      }
    }
  }
}
#

11.5.1

#

rerunning code

#

same as normal, idk what the error was anyways

#

idk if it fixed or not, because i don't know what happened

vagrant bison
west spoke
#

Did you post your servers?

vagrant bison
#

no

#

you have sexy avatar

#

XD

west spoke
#

You need to post your servers

#

Ty

vagrant bison
#

how?

west spoke
#

Http requests.

#

What lib do you use

vagrant bison
#

d.js

west spoke
#

hm

#

Ok

#

so what you need to do is make a http request to

#

I believe

#

Ye

#

Ask about this in #topgg-api for further help idk anything about js requests

vagrant bison
#

em

west spoke
earnest phoenix
#

how do i identify this server

#

how do you do what

naive gull
#

what

earnest phoenix
#

how do you make it so that commands are disabled for this guild (discord.js)

naive gull
#

check with id?

earnest phoenix
naive gull
#

probably

#

idk js

earnest phoenix
#

ok

#

what is this server guild id

#

o got it

naive gull
#

264445053596991498 πŸ‘Œ

earnest phoenix
#

ok

velvet wave
#
events.js:167
      throw er; // Unhandled 'error' event
      ^
TypeError: Cannot read property 'location' of undefined
    at C:\Users\Xvori\Desktop\Rainbot\commands\rainbow.js:21:40
    at C:\Users\Xvori\Desktop\Rainbot\node_modules\weather-js\index.js:116:16
    at Parser.<anonymous> (C:\Users\Xvori\Desktop\Rainbot\node_modules\xml2js\lib\parser.js:303:18)
    at Parser.emit (events.js:182:13)
    at SAXParser.onclosetag (C:\Users\Xvori\Desktop\Rainbot\node_modules\xml2js\lib\parser.js:261:26)
    at emit (C:\Users\Xvori\Desktop\Rainbot\node_modules\sax\lib\sax.js:624:35)
    at emitNode (C:\Users\Xvori\Desktop\Rainbot\node_modules\sax\lib\sax.js:629:5)
    at closeTag (C:\Users\Xvori\Desktop\Rainbot\node_modules\sax\lib\sax.js:889:7)
    at SAXParser.write (C:\Users\Xvori\Desktop\Rainbot\node_modules\sax\lib\sax.js:1436:13)
    at Parser.exports.Parser.Parser.parseString (C:\Users\Xvori\Desktop\Rainbot\node_modules\xml2js\lib\parser.js:322:31)
Emitted 'error' event at:
    at Parser.exports.Parser.Parser.parseString (C:\Users\Xvori\Desktop\Rainbot\node_modules\xml2js\lib\parser.js:326:16)
    at Parser.parseString (C:\Users\Xvori\Desktop\Rainbot\node_modules\xml2js\lib\parser.js:5:59)
    at Request._callback (C:\Users\Xvori\Desktop\Rainbot\node_modules\weather-js\index.js:55:17)
    at Request.self.callback (C:\Users\Xvori\Desktop\Rainbot\node_modules\request\request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.<anonymous> (C:\Users\Xvori\Desktop\Rainbot\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:182:13)
    at IncomingMessage.<anonymous> (C:\Users\Xvori\Desktop\Rainbot\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)
[nodemon] app crashed - waiting for file changes before starting...
#

** So the bot crashes for example if i do {fl} but if i do {florida} it doesn't crash the bot**
how do i make it so it doesn't crash if someone puts 2 letters in stead of the full name btw i am trying to fix my {weather} command.

earnest phoenix
#

can't help without your code

velvet wave
#

never mind i figured it out

charred latch
earnest phoenix
#

that's a system message, you can't send system messages

west spoke
#

^

earnest phoenix
#

im pretty sure you can prevent a ping by putting the mention in an embed

#

and that might be the only way

charred latch
#

ah alright thanks helpful

#

thankyou c:

naive gull
#

Ye that’s the only way

grim aspen
maiden mauve
topaz fjord
#

Message has the property guild

maiden mauve
#

docs kinda confused me

#

"guild" is the "Server"

#

or the channel?

topaz fjord
#

guild is the term for server

#

So yes

maiden mauve
#

ah ty I was confusing that with Client

topaz fjord
#

Client is the actual bot

maiden mauve
#

so that should catch messages from here?

topaz fjord
#

yes

maiden mauve
#

β˜‘ ty

grizzled spruce
#

Heloooooo

#

So I happen to be very dumb

west spoke
#

hi

#

mood

grizzled spruce
#

And um....how would I store data using heroku since it doesn't write to the files?

west spoke
#

database, hold in s3 buckets, etc.

grizzled spruce
#

ah

#

Ok makes sense

finite crow
#

Hello how to setup bots to give trivia answers plz tell

earnest phoenix
#

I want to be on a different account on the website but it wont let me change it

wooden girder
#

I don't know if there is a bot that does that already @finite crow

#

I guess there are

covert turtleBOT
spare goblet
#

@earnest phoenix ^

stray garnet
#

Anyone knows how how to restore deleted File Content on Glitch?

fading wigeon
#

don't use glitch

stray garnet
#

Ik im about to switch over to Heroku

#

@fading wigeon lol

fading wigeon
#

it works but is just a stupid idea

stray garnet
#

Ok

maiden mauve
#

once you get Heroku set up, how is the ease of access to files? Is it simple to put in auto restarts etc?

#

seems like the way to go for a start up bot

stray garnet
#

Ok

fading wigeon
#

Heroku and glitch are not the way to go

#

i'd invest a dollar to get a vps from a reliable hosting provider

maiden mauve
#

I'm looking for something simple to use and never down etc

#

money isn't really an issue

fading wigeon
#

you can get a small vps for free on google cloud

#

otherwise i'd suggest ionos

#

but it takes them 2-3 days to ste up your server

stray garnet
#

An VPS for Free ok Google Cloud?

fading wigeon
#

ask me how i know

stray garnet
#

How

fading wigeon
#

its a free unlimited trial

#

as long as ur ram isn't above 512 mb and u get the "worst" vps

stray garnet
#

Okay

maiden mauve
#

i like google things

#

ill try that out

#

google phone, google email, google life

fading wigeon
#

i have a blackberry

stray garnet
#

Well i never heard about a Free VPS before

fading wigeon
#

;P

maiden mauve
#

waiting for GCar to compete with tesla

fading wigeon
#

Nothing will compete with Tesla

#

google really f-ed up there

maiden mauve
#

"We noticed you were browsing brown suits yesterday, would you like to navigate to JC Penny for their brown suit sale?"

#

πŸ˜„

fading wigeon
#

stonks

maiden mauve
#

web server probalby biggest item on my to-do list

#

I don't like leaving my PC on all day

fading wigeon
#

the ionos vps is great for a webserver

maiden mauve
#

"main" runs all day and I gotta zip code and run test instances everywhere i go for work

fading wigeon
#

you usually don't need that much ram for em

maiden mauve
#

Hm

#

I feel like starting out a bot game to people the worst scenario is downtime

#

you want people to get addicted into playing it

#

It kinda crashed and burned on my private server because I pulled it down to test so much lol

#

people got mad I reset their "RPG grinding" stats

#

when you feel like every action you do is permenant and gainful it keeps you interested

spare goblet
#

@stray garnet if you're still thinking of restoring deleted content you can use the back button. lower left iirc
βͺ this button. it rewinds your project

#

and then u just select back to a time when the thing is still around

#

dont recommend glitch tho

stray garnet
#

Ok

mossy vine
#

ok so the url can have that part after ? what are those called again like https://discordbots.org/search?q=e what are the things like q after the ? called

#

i actually forgot smh

split hazel
#

Query? mmLol

mossy vine
#

yes thanks

wicked pivot
#

UnhandledPromiseRejectionWarning: Error: This video is unavailablewhat does it mean, it puts me that for any video that I'm launching

topaz turtle
wicked pivot
#
const ytdl = require('ytdl-core')

module.exports.run = async (bot, message, args) => {
    if(message.member.voiceChannel){
    const info = await ytdl.getInfo(args[0])
    const connection = await message.member.voiceChannel.join()
    const dispatcher = await connection.playStream(ytdl(args[0], { filter: 'audioonly' }))
    console.log(`${info.title}`)
    }else{
        return console.log("Join voice")
    }
}

module.exports.help = {
    name: "play"
}```
#

UnhandledPromiseRejectionWarning: Error: This video is unavailable

fading wigeon
#

its a ytdl problem

#

@wicked pivot are u in the eec?

wicked pivot
#

eec ?

fading wigeon
#

european economic community

wicked pivot
#

I'm French sorry I do not understand everything, not that I know

fading wigeon
#

so u are

#

some videos arent avalible cus of article 13

wicked pivot
#

article 13 ?

#

kind the copyright etc

#

the problem is that I tried with several video and I have the same problem

stray garnet
#

Can i only have one .setURL in my embed?

mossy vine
#

yes

maiden mauve
#

hmm

#

Why would GCP say my pointer file is not found after deploying?

#

(first run)

stray garnet
#

Cyber, okay

mossy vine
#

ghost ping >:c

stray garnet
#

how?

mossy vine
#

those are markdown links

stray garnet
#

ok

#

can u do an Example how to do that in an Embed?

mossy vine
#

its literally right there angeryBOYE

stray garnet
#

Ok

earnest phoenix
#

Hey! @everyone

#

Anyone help me

unique nimbus
#

please dont try to ping everyone

#

and what do you need help with?

earnest phoenix
#

Ok

#

Sorry

split hazel
#

And why did you expect such a server to have everyone ping available to everyone

#

but carry on with your question

earnest phoenix
#

How to know any bots commands??

#

Please rply me

unique nimbus
#

Do you know how to code

earnest phoenix
#

No idea

unique nimbus
#

Learn to code first before trying to make a bot

earnest phoenix
#

I want to know you have a any trick about know bots command

loud salmon
#

the help command @earnest phoenix

#

peter I think he just wants to know how to get a bots command

unique nimbus
#

oh

loud salmon
#

not for actual development help

#

dbl clap context clues

covert turtleBOT
#

πŸ‘ context πŸ‘ clues πŸ‘

earnest phoenix
#

@loud salmon yes

loud salmon
#

see

unique nimbus
#

Spider I ain't smart like you smh

peak quail
#



  if (cooldowns.has(message.author.id)) {
    message.delete();
    
    return message.channel.send(cooldownEmbed);
  }
  
  if (message.author.id !== config.OwnerID) {
    cooldowns.add(message.author.id);
    setTimeout(() => cooldowns.delete(message.author.id), 3000);
  }```
why this dosenΒ΄t work (no errors in the console) its not adding a timer PunchTrees
**HELP?! XD**
earnest phoenix
#

@loud salmon you know about any trivia Answer bot??

loud salmon
#

no

maiden mauve
#

lol

loud salmon
#

we are not the server to ask for a bot that cheats at a game show, leave the server if that is what you are looking for @earnest phoenix

earnest phoenix
#

@loud salmon sorry

loud salmon
#

where do you even get the idea that we have a bot that does that @earnest phoenix

#

who told you there was a bot here?

maiden mauve
#

@peak quail doesn't timeOut require braces for function? I could be wrong

earnest phoenix
#

I have some bots but I don't know there's command

#

@loud salmon

maiden mauve
#

setTimeout ( () => { function (), 3000 }

loud salmon
#

we dont help you with bots here

earnest phoenix
#

@loud salmon why bro

loud salmon
#

we just dont

#

you ask in the bot support server

#

dbl wrongserver

covert turtleBOT
#

This server is NOT the support server for ANY bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of DBL.

peak quail
#

spider 😒

loud salmon
#

?

maiden mauve
#

wasn't there another guy spamming about a trivia bot

earnest phoenix
#

@loud salmon I know bro you make some answer bot

loud salmon
#

wrong

#

@maiden mauve yea, there is some indian trivia game show and a shitload of people come in here and ask for a bot that gives out answers for it

maiden mauve
#

lmao that is so random

loud salmon
#

i mean i guess its not that improbable because this site is the #1 hit for trivia game show answers bot

earnest phoenix
#

@loud salmon where are you from Master mind

loud salmon
#

ah yea

#

thats the game name

#

master mind

earnest phoenix
#

low iqs being low iqs 🀷

loud salmon
#

@earnest phoenix stop asking about it or I mute you

earnest phoenix
#

@loud salmon not game name

loud salmon
#

oh?

earnest phoenix
#

Im asking you where are from

#

@loud salmon

loud salmon
#

I must be confused then, nvm

#

im from america

maiden mauve
#

alittle bit more on topic, I'm looking to improve the coding friendliness of my message "args[]"

#

would a class that enforced type casting work?

earnest phoenix
#

@loud salmon you know about India

maiden mauve
loud salmon
#

yes

#

i do

maiden mauve
#

basically a class instead of args

loud salmon
#

because I know basic geography mmLol

earnest phoenix
#

@loud salmon yea

#

@loud salmon bro I not asking you for a bot

#

I want know command

west spoke
#

what

loud salmon
#

we arent the place to ask that

#

go back to the page where you got the bot

west spoke
loud salmon
#

and click support server

maiden mauve
#

πŸ˜„

west spoke
#

What df did I wake up to

earnest phoenix
#

i cant tell if this is a troll or a low iq in a natural habitat

loud salmon
#

be nice smh @earnest phoenix

earnest phoenix
#

@loud salmon I don't understand please send a screenshot of the page

slender thistle
west spoke
#

^

loud salmon
west spoke
#

^

earnest phoenix
#

@loud salmon next

west spoke
#

what

#

ok why do you ping someone every time you send a message.
That seriously bugs me

loud salmon
#

doesnt mind me all that much 🀷

earnest phoenix
#

Sorry

#

All

stray garnet
#

anyone knows how to Markdown Links in Embeds?

west spoke
stray garnet
#

k

#

embed.addField('[Test](discord.js.org)')

like this?

split hazel
#

yes

stray garnet
#

ok

#

Dont works. @split hazel

west spoke
#

@stray garnet embed.addField('[Test](https://discord.js.org)')

#

Python?

stray garnet
#

No discord.js

west spoke
#

Ah

#

Ok

#

But you need a https:// or http:// at the start

stray garnet
#

i do

west spoke
#

Ye

stray garnet
#

embed.addField('[Support Server](https://discord.gg/)')

#

@west spoke

west spoke
#

Ye

stray garnet
#

but dont works somehow

west spoke
#

embed.add_field(name='Ofifcial Website', value='[**Website**](http://neko-bot.net)')

#

It should work the same

#

And ads

stray garnet
#

ok i try ig

west spoke
#

The one I sent is for py

#

But markdown is markdown

#

wait

#

@stray garnet

#

It needs to be in the description, not the title

stray garnet
#

ok sht

#

oh ye now it works

stray garnet
#

@west spoke What if i want to have more than one markdown?

mossy vine
#

what

west spoke
#

You just do two of them

mossy vine
#

^

west spoke
stray garnet
#

Ok

west spoke
#

Its like doing this

split hazel
#

you can have as many as long as it doesnt reach the max embed characters

slender thistle
#

(That isn't Markdown but rather a hyperlink done with Markdown)

west spoke
#

^

split hazel
#

and as long as its within embed limits

west spoke
#

^

opaque eagle
#

In TypeORM, what's special about BaseEntity.findAndCount()?

#

What does the AndCount() part entail?

stray garnet
#

How can i do that when i do for Example ;help that the Command gets Deleted after 1 sec

west spoke
#

await bot.delete_message(message)

#

I believe

#

Idk

#

Wait

#

You use ks

#

Js

stray garnet
#

yes

#

i have an Code but that dont Works somehow

slender thistle
molten yarrow
#
message.channel.send(`ur Message`).then(m => m.delete(1000))
stray garnet
#

still dont works :(

mossy vine
#

but thats how you do it

stray garnet
#

message.delete() .then(msg => console.log(`Deleted message from ${msg.author.username}`)) .catch(console.error);
Its from the Docs

#

That Works

ionic compass
naive gull
slender thistle
#

What's the code you are executing when that command gets invoked

naive gull
#

only happens in that dbl test server

#

well it happened on the wikipedia and youtube command

slender thistle
#

You aren't closing a ClientSession /shrug

naive gull
#

basically just gives a link to a wikipedia page related to the search

#

how do i close that

#

Β―_(ツ)_/Β―

slender thistle
#

Send code

naive gull
#

nvm i see why

slender thistle
#

(in aiohttp, I recommend using async-with if possible)

#

Or explicitly do .close() on the session mmulu

naive gull
#

yeah

earnest phoenix
#

Hey guys! I have a question. If i would like make "I don't know how its called" that special command could use only in selected channel.
How its called? And is it doing through DB?

west spoke
#

No

#

You can store the ID as a string

#

If it's meant for one channel

split hazel
#

for multiple you could just store multiple channel ids no matter how their seperated

#

and then run if(!storedids.includes(channel.id)) return

west spoke
#

^

#

I use, or \n to separate.

vagrant bison
#

how to add a record to the database using java script?

finite crag
#

Is it possible to make a bot on mobile

vagrant bison
#

te

#

ye

finite crag
#

Thx

mossy vine
#

@finite crag yes but you shouldnt do it

#

@vagrant bison what db are you using

vagrant bison
#

phymyadmin

mossy vine
vagrant bison
#

but I mean adding a record with the command

finite crag
#

@mossy vine why not

mossy vine
#

most apps that let you do it are horrible

#

if you actually want to code the bot, you still shuoldnt

#

programming on mobile is just a nightmare

earnest phoenix
#

have you tried google

warm marsh
#

@vagrant bison First, What kind of database?

vagrant bison
#

mysql

warm marsh
#

Ok.

#

Then learn SQL.

vagrant bison
#

But I mean the script discord.js which will add a record to the database.

warm marsh
#
// Adding: 

connection.query(`INSERT INTO table_name (column1, column2) VALUES("value1", "value")`, (err, row) => {
    if (err) return;
});
#

Something along the lines of that, But you must already have connected to the database.

tribal hornet
#

So I'm having an issue with getting the list of users who have voted for my bot. (It's a small bot, so not an issue with too many votes). When I run the code to get them, I occasionally get a list of names I recognize, but more often it's a bunch of names I've never seen before. Any idea what could be happening?

const DBL = require("dblapi.js");
const dbl = new DBL(process.env.dtoken, bot);

dbl.getVotes().then(votes => {
                    console.log(votes)
                });
warm marsh
#

using node module mysql

vagrant bison
#
var mysql = require('mysql');
var con = mysql.createConnection({
host     : 'host',
user     : 'user ',
password : 'password ',
database : 'database'
});

connection.query(`INSERT INTO table_name (column1, column2) VALUES("value1", "value")`, (err, row) => {
    if (err) return;
});
warm marsh
#

con.query

#

As that's your variable name.

#

learn some sql.

vagrant bison
#

I have connected well with the base

#

why should I read this if I am talking about the script discord.js?

warm marsh
#

Because it's sql that puts the data inside of the database.

#

not discord.js

opaque eagle
#

Discord.js is only used to interact with Discord, not with your database.

warm marsh
#

^

vagrant bison
#

but I'm talking about the script discord.js which, after calling the command, will add a record to the database

opaque eagle
#

Yes

vagrant bison
#

you understand?

warm marsh
#

Yeah? It's sql that must add that entry to the database.

opaque eagle
#

SQL does the add a record to the database part

vagrant bison
#

lol

warm marsh
#
client.on('message', (msg) => {
    
    // later in code:
    con.query(insert_sql_here);
}
vagrant bison
#

INSERT INTO flm.guilds (guilds) VALUES ('1');

warm marsh
#

Try it.

vagrant bison
#
var mysql = require('mysql');
var con = mysql.createConnection({
host     : 'xd',
user     : 'xd',
password : 'xd',
database : 'xd'
});

con.connect(error => {
if(error) throw error;
msg.channel.send("Connection to database successful!");
});

connection.query(`INSERT INTO `flm.guilds` (`guilds`) VALUES ('2');, (err, row) => {
    if (err) return;
});
opaque eagle
#

um

warm marsh
#

No.

opaque eagle
#

use interpolation

#

INSERT INTO ${flm.guilds}

warm marsh
#

flm.guilds is a table column

tight heath
#

@vagrant bison xd is a very insecure password

vagrant bison
#

i konw

#

xd

warm marsh
#

You would do INSERT INTO flm (guilds) VALUES("guildID");

#

inside ``

vagrant bison
#
var mysql = require('mysql');
var con = mysql.createConnection({
host     : 'xdd',
user     : 'xd',
password : 'xd',
database : 'xdd'
});

con.connect(error => {
if(error) throw error;
msg.channel.send("Connection to database successful!");
});

connection.query(`INSERT INTO ${flm.guilds} (`guilds`) VALUES ('1'), (err, row) => {
    if (err) return;
});
warm marsh
#

no.

vagrant bison
#

something is wrong here

warm marsh
#
con.query(`INSERT INTO flm (guilds) VALUES ("1");`, (err, row) => {
    if (err) return;
});```
vagrant bison
#

ok

#

wait

opaque eagle
#

welp should've read the scenario before responding lol

#

my bad

warm marsh
#

lmao

vagrant bison
#
var mysql = require('mysql');
var con = mysql.createConnection({
host     : '69.69.69',
user     : 'asdfasdfas',
password : 'xdasdfas',
database : 'xdafasdfasd'
});

con.connect(error => {
if(error) throw error;
msg.channel.send("Connection to database successful!");
});

con.query(`INSERT INTO flm.guilds (guilds) VALUES ("2");`, (err, row) => {
    if (err) return;
});
#

ok?

warm marsh
#

Again, Try it.

vagrant bison
#

do I test it? xD

warm marsh
#

Yes.

vagrant bison
#

it does not work.

warm marsh
#

Then it must.

vagrant bison
#

there is no error in the console

warm marsh
#

@vagrant bison Move the con.connect bit and the const mysql out of the client.on

vagrant bison
#

where it is?

#

con.query i have

late hill
#

connect is probably async

warm marsh
#

omfg.

vagrant bison
#

so how to change to synchronous?

#

xd

#

i'm idiot

#

sorry

warm marsh
#
const mysql = require('mysql');
const con = mysql.createConnection({
    host: '',
    user: '',
    password: '',
    database: ''
});

con.connect(err => {
    if (err) throw err;
    console.log('Connected', con.threadId);
});

client.on('message', (message) => ...);
#

like that.

#

Put the connection stuff at the top of the code.

mossy vine
#

or connect in ready event?

warm marsh
#

Yeah.

late hill
#

There's no reason to do that

#

In his case

#

You'd just be waiting

#

For no reason

vagrant bison
#

wait

#
var mysql = require('mysql');
var con = mysql.createConnection({
host     : 'adfads',
user     : 'sdfadsf',
password : 'fasdf',
database : 'wxx'
});

con.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
  var sql = "INSERT INTO flm.guilds (guilds) VALUES ("2")";
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log("1 record inserted");
  });
});
mossy vine
#

you are closing the string

vagrant bison
#

how to fix it?

mossy vine
#

dont close the string

#

basic javascript issues youre having here

vagrant bison
#

/:

#

will you fix it for me? Please

warm marsh
#

You should learn JavaScript and sql+mysql. Will help you out a lot.

high lava
vagrant bison
#

I'm a beginner

high lava
#

2 is completely excluded from the string

#

It just looks like you're trying to apply a string, a number, and then another string to a variable

vagrant bison
#

ye

#

Well, just why it does not work. help me, please

warm marsh
#

You won't learn from it though.

#

Something that is a big part of being a developer is being able to debug your code.

vagrant bison
#

/:

#

will someone improve my script?

warm marsh
#

No.

vagrant bison
#

why

high lava
late hill
#

What do you use to write code @vagrant bison

#

πŸ‘€

vagrant bison
#

visraul studio

late hill
#

And it doesn't show you that what you're doing isn't going to work?

#

πŸ‘€

warm marsh
#

Get a linter or something.

vagrant bison
#

good no matter, someone else helps me. how will it fail to write ...

late hill
#

Whatever that means

#

Good luck

vagrant bison
#

xd

#

i'm niot from england

tribal hornet
#

@vagrant bison in var sql = "INSERT INTO flm.guilds (guilds) VALUES ("2")"; the 2 is not part of the string.

vagrant bison
#

INSERT INTO flm.guilds (guilds) VALUES ("test")

late hill
#

Replacing 2 with test isn't going to fix it as that's not the problem

tribal hornet
#

Essentially you have two strings here var sql = "INSERT INTO flm.guilds (guilds) VALUES (" and ")".

#

The 2 is just sitting in the middle and causing an error

vagrant bison
#
var mysql = require('mysql');

var con = mysql.createConnection({
host     : 'afadsf',
user     : 'afasdf',
password : 'afad',
database : 'asdf'
});

con.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
  var sql = "CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))";
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log("Table created");
    
  });
  var sql1 = "INSERT INTO flm.guilds (guilds) VALUES ("test")";
  con.query(sql, function (err, result) {
    if (err) throw err;
    console.log("1 record inserted");
  });
});
warm marsh
#

Stop stealing code.

wooden girder
#

Well, if it is open source, you could say that you put it out there for people to see

vagrant bison
#

help me

split hazel
#

Steal code only if you understand it

#

And idk where the error is coming from

alpine sentinel
#

Hi,

I am new to Discord.js

How to tell my command if something go back and run command from the begging again?

split hazel
#

I didnt understand your question

alpine sentinel
#

i have a command with multiple IF funcions

#

how to tell command go back and run whole command again?

#

Sorry for my language

split hazel
#

You could put the whole command in a function and then call the function again

alpine sentinel
#

Could I?

#

I am experimenting right now

split hazel
#

Just be careful you don't get into a loop

alpine sentinel
#

Please see below

#
    if (message.content === 't') {
        message.react('πŸ‘').then(() => message.react('πŸ‘Ž'));

        const filter = (reaction, user) => {
            return ['πŸ‘', 'πŸ‘Ž'].includes(reaction.emoji.name) && user.id === message.author.id;
        };

        message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
            .then(collected => {
                const reaction = collected.first();

                if (reaction.emoji.name === 'πŸ‘') {
                    message.reply('you reacted with a thumbs up.')
                    .then(message => {
                        message.react('πŸ‘Ž')
                          })
                          
//I want here to go back and run whole command again to find answer

                } else {
                    message.reply('you reacted with a thumbs down.');
                }
            })
            .catch(collected => {
                console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
                message.reply('you didn\'t react with neither a thumbs up, nor a thumbs down.');
            });
    }
});```
#

Please ignore

#

wait

#

Please check below @split hazel

#
    if (message.content === 't') {
        message.react('πŸ‘').then(() => message.react('πŸ‘Ž'));

        const filter = (reaction, user) => {
            return ['πŸ‘', 'πŸ‘Ž'].includes(reaction.emoji.name) && user.id === message.author.id;
        };

        message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
            .then(collected => {
                const reaction = collected.first();

                if (reaction.emoji.name === 'πŸ‘') {
                    message.reply('you reacted with a thumbs up.')
                    .then(message => {
                        message.react('πŸ‘Ž')
                          })
                          
//I want here to go back and run whole command again to find answer

                } else {
                    if (reaction.emoji.name === 'πŸ‘Ž') {
                    message.reply('you reacted with a thumbs down.');
                    }
                }
            })
            .catch(collected => {
                console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
                message.reply('you didn\'t react with neither a thumbs up, nor a thumbs down.');
            });
    }
});```
#

So if i press πŸ‘ then πŸ‘Ž after it will go back and return message.reply('you reacted with a thumbs down.');

#

if my code is correct do to this

wicked pivot
#
let voice = bot.channels.get("412414337848967189")
    if(voice) {
            voice.join().then(co => {
                co.playFile(musique[random])
                console.log(musique[random])
            })
    }else{
        console.log("not channel")
    }```how to loop a song?
high lava
#

You just have it check a looping variable, let's say if (loop === 1), and if it's 1 for "on" then have it repeat the song it was just playing

wicked pivot
#
var loop = 0
        while (loop !== 1){
            voice.join().then(co => {
                co.playFile(musique[random])
                console.log(musique[random])
            })
        }```
#

kind of?

tribal hornet
#

So I'm having an issue with getting the list of users who have voted for my bot. I occasionally get a list of names I recognize, but more often it's a bunch of names I've never seen before. Any idea what could be happening?

const DBL = require("dblapi.js");
const dbl = new DBL(process.env.dtoken, bot);

dbl.getVotes().then(votes => {
                    console.log(votes)
                });
mossy vine
slim heart
#

@tribal hornet ofc ur gonna get random people?

tribal hornet
#

No, believe me I'm not.

#

Only 21 votes. Most of those are me/another developer

mossy vine
#

i remember something like that happening to me as well

onyx summit
#

Just use webhooks and be safe akkoShrug

glass sandal
#
C:\Users\Camaro\Desktop\DiscordBotTEST\index.js:11
    db.fetch(`guildPrefix_${message.guild.id}`).then(i => {
                                               ^

TypeError: Cannot read property 'then' of null
    at Client.bot.on.message (C:\Users\Camaro\Desktop\DiscordBotTEST\index.js:11:48)
    at Client.emit (events.js:198:13)
    at MessageCreateHandler.handle (C:\Users\Camaro\Desktop\DiscordBotTEST\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\Camaro\Desktop\DiscordBotTEST\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (C:\Users\Camaro\Desktop\DiscordBotTEST\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\Camaro\Desktop\DiscordBotTEST\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\Camaro\Desktop\DiscordBotTEST\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (C:\Users\Camaro\Desktop\DiscordBotTEST\node_modules\ws\lib\websocket.js:789:20)
    at Receiver.emit (events.js:198:13)
PS C:\Users\Camaro\Desktop\DiscordBotTEST>```
 How would I fix this error this is line 11 
   ```css
 db.fetch(`guildPrefix_${message.guild.id}`).then(i => {```
mossy vine
#

db.fetch doesnt seem to return anything

glass sandal
#

Ok what should I use then?

#

@mossy vine

#

would fetchALL do anything

mossy vine
#

something that works

glass sandal
#

Ok then whats something that works

mossy vine
#

what db are you using

glass sandal
#

quick-db

mossy vine
#

cant help then, sorry

#

docs might help

glass sandal
#

tried those

#

Anyone know quick-db

spare goblet
#

@glass sandal I don't use quick db
I suggest you to go to quick db official server which is plexicode

Apart from that quick db is littered with bugs but iirc it's supposed to be db.get

I could be wrong, I have never actively used quick db

onyx charm
#

I have a problem of rules bot is offline all the time

versed turtle
#

@amorking17#4795 Why don't you turn the bot on?

#

uh

#

ok

prime cliff
tight heath
#

nya

maiden mauve
#

very last month

spare goblet
#

i like the top, not the blurple and the pink tho at the lower area

earnest phoenix
#

you don't have to ping a whole role for that

pale marsh
#

]]atmods

covert turtleBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.

Mentioning an entire moderator role without a justifiable reason is a punishable offence.

spare goblet
#

Please don't ping all the mods

fiery birch
#

real talk

#

i was nearly lying down straight horizontal and my chair far from my desk

#

and i pulled myself up for just a mod ping huh

#

that was a lot of effort brotocho

spare goblet
#

Brayen - try submitting again, if not then you submitted something wrong

fiery birch
#

yea thats ur answer tho, iara is top tier

pale marsh
#

Or simply don't add a server in the field and edit it later

spare goblet
wheat jolt
#

Who knows how i can get the username and the discriminator of an user by its ID

earnest phoenix
#

which library

wheat jolt
#

d.js

wheat jolt
#

I am a bit confused

amber fractal
#

Get user > Use the users properties

wheat jolt
#

thanks

earnest phoenix
#

what's your code

wheat jolt
earnest phoenix
#

fetchUser returns a promise, either await it or use then

wheat jolt
#

it's working but it gives me undefined

#

oh

#

Tysm

prime cliff
#

@spare goblet the pink color is your favourite color that you can change and will also effect the color on embeds πŸ˜‰ and yea the blurple background is a bit weird maybe a darker blue will do

stray garnet
#

How can i let my Bot reply to a Mention?

twilit rapids
#

What lib?

stray garnet
#

discord.js

stray garnet
#

Thx

nocturne hazel
#

Some help would be much appreciated!

nocturne hazel
#

who pinged me

cursive dagger
#

@nocturne hazel my mobile fked up, removed the message so you wouldn't get confused sorry

nocturne hazel
#

Oh ok

quasi forge
#

ok, so I have another question - https://repl.it/talk/ask/Server-side-storage/16435

I am making a http server using express in nodejs and I wanted to know if there was something similar to session storage but for the server side. Like this is a variable but I want it to be same for all users even when it changes. This might've been possible if it were possib...

valid frigate
#

aight so how would i get shard status (ready, reconnecting), etc. from broadcastEval? i'm not sure what to eval lol

twilit rapids
#

What lib?

valid frigate
#

js

steel terrace
#

he said node.js

twilit rapids
#

Who did...?

#

Anyway, I assume you are using Discord.js

stray garnet
#

How can i do that when a User runs an Command, that the Bot Dm's him?

valid frigate
#

the issue with the guide is for the most part, it explains sharding in its most basic form

twilit rapids
#

@stray garnet what lib

stray garnet
#

@twilit rapids Discord.js

twilit rapids
#

<Message>.author.send("some cool text goes here")

valid frigate
#

i found WebSocketShard.status but that's for internal sharding smh

stray garnet
#

@twilit rapids Don't Works

twilit rapids
#

show your code

stray garnet
#

Wait

umbral glacier
#

Hello guys, need a little help from you.
I dev and deploy bot now it can run and work fine on my private Discord server
Questions is

  1. If I need to add it to another Discord server, how can I get invite the bot into server LINK?,
  2. Do I need to publish the bot or the app into public (like to be display on the Discord official bot list page), or can I keep it like that?
drowsy sentinel
earnest phoenix
#
const Discord = require("discord.js") 
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')
const adapter = new FileSync('db.json')
const db = low(adapter)

module.exports.run = async (bot, message, args) => {
	let user = message.author;
	if(!db.get("premium").find({ user_id: user.id }).value()) {
		message.channel.send("**⚠ Vous n'Γͺtes pas premium.**") 
	} else {
	const say = args.join(" ")
	message.delete().catch(err => {
		if(err) {
			return
		} 
	}) 
	var saye = new Discord.RichEmbed()
	.setFooter(`${say}`) 
	message.channel.send(saye).catch(err => {
		if(err) {
			message.channel.send(err) 
			} 
		}) 
	}
}

module.exports.help = {
	name:"say"
} ```

Why the bot don't find the user id ?
*i have already add the id in db file*
earnest phoenix
#

??

#

please

spare goblet
#

@stray garnet that should send 'test' to the person who invoked command

stray garnet
#

But it dont @spare goblet

spare goblet
#

oh

#

thats because

#

thats cuz you reclaimed the "message" constant

#

change it to this

//stuff
msg.edit(embed)
message.author.send("Test")
})```
late hill
#

or instead of having one being msg and another message you can also use names that actually tell you what that variable is

#

such as naming your bots reply "reply" for example

late hill
#

what's your db file like?

wheat jolt
#

I think it's json.sqlite

stray garnet
#

@spare goblet Dont works still :(

spare goblet
#

@stray garnet Can you send in your code

stray garnet
#

Yes

spare goblet
#

Oh shit wrong tag -_-

#

wait what

#

stop changing your name and pic reee

stray garnet
#

reeeeee

opaque eagle
#

You should make your help command dynamic instead of manually adding each new command to it

stray garnet
#

wdym

opaque eagle
#

Don’t hard-code each command and it’s description in the help command... make it get that automatically

#

I mean it’s not required or anything but it makes things so much simpler for you

stray garnet
#

can u do an little Example?

opaque eagle
#

I mean it’s not that hard, just map each command by their category and remove duplicates to get an array of all the categories... iterate through those categories and find the commands that have that category, and then just add a field to the embed while you’re at it

stray garnet
#

Ok sounds complicated for me, or im just dumb

warm marsh
#

Each of your commands are in external files?

stray garnet
#

@spare goblet so whats worng there?

slim heart
#

But ok

#

@stray garnet is there an error? What’s supposed to happen? What’s happening instead

warm marsh
#

It won't do anything? As the message is getting changed to the exact same thing.

slim heart
#

Yes

stray garnet
#

@slim heart No Errors, It should DM a user when it runs the Command

slim heart
#

Well there’s gonna be An error if it doesn’t

#

Does it send the embed

warm marsh
#
let msg = await message.channel.send(embed);
await msg.edit(embed);
message.member.send('Test');
slim heart
#

Shouldn’t make a difference

warm marsh
#

Yeah I know.

#

@stray garnet change it to

message.channel.send(embed).then(msg => {
    msg.edit('Testing');
    message.member.send('Test!');
}).catch(console.error);
#

To see if it throws an error.

mossy vine
#

what

#

embed.title = msg.edit

slim heart
#

Wtf

#

Yea lol

warm marsh
#

Shit. I forgot to remove that lmao.

naive gull
#

Lmao

warm marsh
#

I don't use Rich Embeds so I don't know how you can change an already made embed.

mossy vine
#

btw in that code .catch will catch msg.edit and message.member.send, not message.channel.send

#

you edit the message to have a completely new embed

stray garnet
#

No Error but dont works still @warm marsh

#

@slim heart Oh it does send the Embed but it dont sends the DM

warm marsh
#

Em.

#

Does anything happen when the command is called?

hollow saddle
#

message.member.send isn’t a function, it would either be message.author.send or message.member.user.send

warm marsh
#

message.member.send is a function.

hollow saddle
#

Is it?

mossy vine
#

is it?

hollow saddle
#

I’ve never seen it

warm marsh
mossy vine
#

huh

#

it is

#

weird

hollow saddle
#

Very weird

#

I would just use message.author.send tbh

#

Keep the user object

#

Otherwise further confusion of the member object and the user object might occur

warm marsh
#

@stray garnet does any of your commands actually run?

stray garnet
#

Yes of cause.

warm marsh
#

This is the only command that doesn't?

stray garnet
#

Just try some of them

warm marsh
#

Weird.

#

Is there anything that you're not doing on this command that's in every other command?

stray garnet
#

?

#

wdym

warm marsh
#

Hold on

stray garnet
#

Oh wait i need to fix that

warm marsh
#

Yeah, It works for me.

#

Without changing any of your code.