#development
1 messages Β· Page 650 of 1
You will want an interval but he asked for a set timeout
promisify setTimeout and loop trough it
setTimeout would need to be in a recursive or a loop
Yes
const arr = str.split("");
for(char in arr) {
setTimeout(() => {
console.log(char);
}, 1000)
}```
Right
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
why so hard
(async () => {
const output = Array.from("string");
const timeout = require('util').promisify(setTimeout);
for (const ch of output) {
await timeout(1000);
channel.send(ch)
}
})();
as proved by the "hello world" challenge the simplest solution is writing a programming language that outputs "hello world"
π

ok sorry im back

s.split("")
setTimeout(function () {
writeAnswer(s[i])
}, 1000)```
so i have that
now what
wait yeah
yeah have fun doing it recursive with old callbacks
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
CHY's answer is a good example of using async in a abstract code
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
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?
wait, we are talking in the browser?
π
electron
var
oh then its okay
but remove (async () => { and })();
it was just for my purpose cause my eval isnt async
ok cool
I'm not sure but I think electron supports requiring node modules? if not search for a polyfill
Uncaught TypeError: "..." is not a function
btw when did using in/of in for loops become popular?
document.getElementById('answer').innerHTML = "..."
(async () => {```
at PineappleFan has nothing to do with my code
...
I said you should remove that function wrapping stuff
uuh
and I think the lack of semicolons cause js to execute "..." as a function lmao
and yeah it supports it
use semicolons
sorry i mainly do py
just saying 
what is the code right now
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)
}
})();
}```
just remove (async () => { and ` })();
` it was just needed for my case
its broke the whole code
man are you sure you can do this?

you are just supposed to copy and paste code and modify it to your needs
why are you not able to do that
yes
Bet
StackOverflow is coming baby
i have just copied it
but now its broke function check() {
which is what this is inside
yeah it has to be a async function...
cause that code is using async/await
obviously
so will i have to go and change eerything else in the code to make it work with async?
1 thing
idk i havent used it
if you use await the function must be defined as "async function"
I said that
what other thing?
what? thats it
oh ok
i thought it was something inside
again it changes the getelementbyid but doesnt do the loop bit
no errors
your problem, you where already spoonfeeded code and still can't get it running
@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
ok can i try a different way
what are you even trying to do?
what does writeanswer() do?
function writeAnswer(inString) {
document.getElementById("answer").innerHTML = inString;
responsiveVoice.speak(inString);
}
that will always replace the previous character with the next one
is that what you want to do?
ok
so yeah, you have three options
- recursive function
- increasing timeouts
- async/await loop
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
is that code block inside another function? where does it run from?
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
did you try console logging the for loop to see if it works?
for(){
console.log("a")
}
uuh no
to see if they work, and if they come 1 at a time, or all at once
but nothing worked at all
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?
literally nothing run?
Send your full code in hastebin
hang on do i need to change how i run the function>
well, put more console.logs backwards until one that works
perhaps
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")
typing "hello"
runs the function like normal and deletes the textbox thing
typing "spell something" just sets the top bit to "..." and stops
is runs the function like normal and deletes the textbox thing what you want to happen?
it should make the input empty which it does on every other command
and the top text should say each letter 1 sec apart
could you answer my question?
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()
you still didnt answer my question, is it currently working the way you want it to, or not?
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
at the moment it just changes the value of answer
so back to what i originally said, did you put the console.log in there? did you test if the loop works?
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
so the answer gets changed to ...?
yes
did you put the console.log inside the loop?
yes
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
put it between await and writeanswer
then the problem is the timeout function
ok
It works fine in node.js so I don't think so
how do i check what it is?
after a quick google search, that's not the proper way to promisify settimeout
so how then?
util.promisify((a, f) => setTimeout(f, a))
ok so how do i write this bit
what is responsiveVoice.speak(inString); even
it just reads something out
I mean, you can remove the timeout and we will see if it works then
i got that answer fomr this one https://stackoverflow.com/questions/51796014/difference-between-util-promisifysettimeout-and-ms-new-promiseresolve
but apparently is node 8, maybe things have changed since then
remove the timeout and will see if it works kthx
you can also try try { await timeout(1000) } catch(e) { console.log(e) }
/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
8.10.0
yeah update
well, considering the current version is 12
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?
yes, check what that logs
@onyx summit is there any command for ubuntu terminal to update it?
first time using vps
use nvm
uhhh tbh I used nvm but its all weird for me
i think the delay isnt working
we want to know what it logs not what it says
yesh it logs everything
we know the delay isnt working, also why did you add () around the require util?
1
1.5
( responsivevoice stuff )
2
also, how many times did it log?
9
@quartz kindle that was my code and I edited it a few times, so thats why there are still the (), I removed it tho
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?
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
im on 10 15 0
cool.
so is there a way that works on all versions?
it should work in yours
I bet my ass it also works on 10.15.0
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()
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
oh nei
i tried to reinstall nodejs and it still 8.10.0v
Linux Ubuntu
you cant get it from an ubuntu repo, those are outdated
and stuff
use nvm
Node Version Manager - Simple bash script to manage multiple active node.js versions - nvm-sh/nvm
My code also works on v10.13.0
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')
};```
finally got something
Lol
why am I even here
why did you remove the setTimeout?
CaUsE hE dID wHaT tIm tOlD hIm
so what do i need to add?
a brain
i literally did what you said
what do i do then
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?
How was your bot approved if you don't even know JS?
py

how can i go through a string and add ". " after each char?
Make an array from the string and join it with a "."
https://cyborg-bot.is-inside.me/snHvvtnV.png
tried to clean cache - not worked
tried to delete node_modules and reinstall it - not worked
try deleting package-lock.json and node_modules
oh god to delete node_modules 30 min
to terminal?
oh lol
so fast
ok now trying to run npm i
ok now it keeps going
@topaz fjord ty so much
im so happy
np
If I have a duration in milliseconds like 205267, how can I convert that to 3 min, 25 sec using moment?
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)
Show code
just nvm rather not
ok
prob just a internet bug or something
because I don't see any errors by myself on the code
Well we can figure out what is wrong if we see the code, but up to you anyways...
yep think it was just the api or something that did something for a sec
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
try running the code again
what's the version of discord.js shown in ur package.json?
im going just reinstall everything wait
oh ok, go ahead
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
why does not it work?
Did you post your servers?
how?
d.js
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
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
what
how do you make it so that commands are disabled for this guild (discord.js)
check with id?
264445053596991498 π
ok
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.
can't help without your code
never mind i figured it out
does anyone know how to mention/link to a user's profile without pinging them? similar to the message when a user joins a server
that's a system message, you can't send system messages
^
im pretty sure you can prevent a ping by putting the mention in an embed
and that might be the only way
Ye thatβs the only way
a great example for that is the 100s of welcome messages in #265156361791209475
quick question
pull server id from bot.on message
message.client.id ?
Message has the property guild
ah ty I was confusing that with Client
Client is the actual bot
if(message.guild.id === "264445053596991498") return console.log("DBL");
so that should catch messages from here?
yes
β ty
And um....how would I store data using heroku since it doesn't write to the files?
database, hold in s3 buckets, etc.
Hello how to setup bots to give trivia answers plz tell
I want to be on a different account on the website but it wont let me change it
I don't know if there is a bot that does that already @finite crow
I guess there are
@earnest phoenix ^
Anyone knows how how to restore deleted File Content on Glitch?
it works but is just a stupid idea
Ok
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
Ok
Heroku and glitch are not the way to go
i'd invest a dollar to get a vps from a reliable hosting provider
I'm looking for something simple to use and never down etc
money isn't really an issue
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
An VPS for Free ok Google Cloud?
ask me how i know
How
its a free unlimited trial
as long as ur ram isn't above 512 mb and u get the "worst" vps
Okay
i have a blackberry
Well i never heard about a Free VPS before
;P
waiting for GCar to compete with tesla
"We noticed you were browsing brown suits yesterday, would you like to navigate to JC Penny for their brown suit sale?"
π
stonks
web server probalby biggest item on my to-do list
I don't like leaving my PC on all day
the ionos vps is great for a webserver
"main" runs all day and I gotta zip code and run test instances everywhere i go for work
you usually don't need that much ram for em
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
@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
Ok
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
Query? 
yes thanks
UnhandledPromiseRejectionWarning: Error: This video is unavailablewhat does it mean, it puts me that for any video that I'm launching
help
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
eec ?
european economic community
I'm French sorry I do not understand everything, not that I know
article 13 ?
kind the copyright etc
the problem is that I tried with several video and I have the same problem
Can i only have one .setURL in my embed?
yes
Cyber, okay
ghost ping >:c
its literally right there 
Ok
And why did you expect such a server to have everyone ping available to everyone
but carry on with your question
Do you know how to code
No idea
Learn to code first before trying to make a bot
I want to know you have a any trick about know bots command
the help command @earnest phoenix
peter I think he just wants to know how to get a bots command
oh
π context π clues π
@loud salmon yes
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**
@loud salmon you know about any trivia Answer bot??
no
lol
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
@loud salmon sorry
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?

@peak quail doesn't timeOut require braces for function? I could be wrong
setTimeout ( () => { function (), 3000 }
we dont help you with bots here
@loud salmon why bro
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.
spider π’
?
wasn't there another guy spamming about a trivia bot
@loud salmon I know bro you make some answer bot
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
lmao that is so random
i mean i guess its not that improbable because this site is the #1 hit for trivia game show answers bot
@loud salmon where are you from Master mind
low iqs being low iqs π€·
@earnest phoenix stop asking about it or I mute you
@loud salmon not game name
oh?
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?
@loud salmon you know about India
basically a class instead of args
because I know basic geography 
@loud salmon yea
@loud salmon bro I not asking you for a bot
I want know command
what

and click support server
π
What df did I wake up to
i cant tell if this is a troll or a low iq in a natural habitat
be nice smh @earnest phoenix
@loud salmon I don't understand please send a screenshot of the page
Let's keep this beautiful #development channel on topic
^
@earnest phoenix go to #memes-and-media
^
@loud salmon next
what
ok why do you ping someone every time you send a message.
That seriously bugs me
doesnt mind me all that much π€·
anyone knows how to Markdown Links in Embeds?
yes
No discord.js
i do
Ye
Ye
but dont works somehow
embed.add_field(name='Ofifcial Website', value='[**Website**](http://neko-bot.net)')
It should work the same
And ads
ok i try ig
The one I sent is for py
But markdown is markdown
wait
@stray garnet
It needs to be in the description, not the title
@west spoke What if i want to have more than one markdown?
what
You just do two of them
^
Ok
Its like doing this
you can have as many as long as it doesnt reach the max embed characters
(That isn't Markdown but rather a hyperlink done with Markdown)
^
and as long as its within embed limits
^
In TypeORM, what's special about BaseEntity.findAndCount()?
What does the AndCount() part entail?
How can i do that when i do for Example ;help that the Command gets Deleted after 1 sec
message.channel.send(`ur Message`).then(m => m.delete(1000))
still dont works :(
but thats how you do it
message.delete() .then(msg => console.log(`Deleted message from ${msg.author.username}`)) .catch(console.error);
Its from the Docs
That Works
anyone know why this happens? https://canary.discordapp.com/channels/264445053596991498/264445053596991498/597458527799345197
What's the code you are executing when that command gets invoked
only happens in that dbl test server
well it happened on the wikipedia and youtube command
You aren't closing a ClientSession /shrug
basically just gives a link to a wikipedia page related to the search
how do i close that
Β―_(γ)_/Β―
Send code
nvm i see why
(in aiohttp, I recommend using async-with if possible)
Or explicitly do .close() on the session 
yeah
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?
for multiple you could just store multiple channel ids no matter how their seperated
and then run if(!storedids.includes(channel.id)) return
how to add a record to the database using java script?
Is it possible to make a bot on mobile
Thx
phymyadmin
but I mean adding a record with the command
@mossy vine why not
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
have you tried google
@vagrant bison First, What kind of database?
mysql
But I mean the script discord.js which will add a record to the database.
// 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.
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)
});
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;
});
I have connected well with the base
why should I read this if I am talking about the script discord.js?
Discord.js is only used to interact with Discord, not with your database.
^
but I'm talking about the script discord.js which, after calling the command, will add a record to the database
Yes
you understand?
Yeah? It's sql that must add that entry to the database.
SQL does the add a record to the database part
lol
client.on('message', (msg) => {
// later in code:
con.query(insert_sql_here);
}
INSERT INTO flm.guilds (guilds) VALUES ('1');
Try it.
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;
});
um
No.
flm.guilds is a table column
@vagrant bison xd is a very insecure password
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;
});
no.
something is wrong here
con.query(`INSERT INTO flm (guilds) VALUES ("1");`, (err, row) => {
if (err) return;
});```
lmao
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?
Again, Try it.
do I test it? xD
Yes.
Then it must.
there is no error in the console
@vagrant bison Move the con.connect bit and the const mysql out of the client.on
connect is probably async
omfg.
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.
or connect in ready event?
Yeah.
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");
});
});
you are closing the string
how to fix it?
You should learn JavaScript and sql+mysql. Will help you out a lot.
https://img.oliy.church/190707074713.png this is screwing everything up
I'm a beginner
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
You won't learn from it though.
Something that is a big part of being a developer is being able to debug your code.
No.
why
Also, rule 7 https://img.oliy.church/190707075619.png
visraul studio
Get a linter or something.
good no matter, someone else helps me. how will it fail to write ...
@vagrant bison in var sql = "INSERT INTO flm.guilds (guilds) VALUES ("2")"; the 2 is not part of the string.
INSERT INTO flm.guilds (guilds) VALUES ("test")
Replacing 2 with test isn't going to fix it as that's not the problem
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
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");
});
});
Stop stealing code.
Well, if it is open source, you could say that you put it out there for people to see
Hi,
I am new to Discord.js
How to tell my command if something go back and run command from the begging again?
I didnt understand your question
i have a command with multiple IF funcions
how to tell command go back and run whole command again?
Sorry for my language
You could put the whole command in a function and then call the function again
Just be careful you don't get into a loop
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
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?
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
var loop = 0
while (loop !== 1){
voice.join().then(co => {
co.playFile(musique[random])
console.log(musique[random])
})
}```
kind of?
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)
});
@wicked pivot recursion. im too tired to explain but look at this as example
https://github.com/cyber28/blankbotradio
@tribal hornet ofc ur gonna get random people?
i remember something like that happening to me as well
Just use webhooks and be safe 
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 => {```
db.fetch doesnt seem to return anything
something that works
Ok then whats something that works
what db are you using
quick-db
@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
I have a problem of rules bot is offline all the time
How is this for custom profiles π
nya
very last month
i like the top, not the blurple and the pink tho at the lower area
]]atmods
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.
Please don't ping all the mods
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
yea thats ur answer tho, iara is top tier
Or simply don't add a server in the field and edit it later

Who knows how i can get the username and the discriminator of an user by its ID
which library
d.js
I am a bit confused
Get user > Use the users properties
what's your code
fetchUser returns a promise, either await it or use then
@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
How can i let my Bot reply to a Mention?
What lib?
discord.js
Thx
My bot is flat out not playing any sound when it is connected to a voice channel.
I am using this code: https://pastebin.com/LjEdhAqh
Some help would be much appreciated!
who pinged me
@nocturne hazel my mobile fked up, removed the message so you wouldn't get confused sorry
Oh ok
ok, so I have another question - https://repl.it/talk/ask/Server-side-storage/16435
aight so how would i get shard status (ready, reconnecting), etc. from broadcastEval? i'm not sure what to eval lol
What lib?
js
he said node.js
Who did...?
Anyway, I assume you are using Discord.js
Read this guide: https://discordjs.guide/sharding/
A guide made by the community of discord.js for its users.
How can i do that when a User runs an Command, that the Bot Dm's him?
the issue with the guide is for the most part, it explains sharding in its most basic form
@stray garnet what lib
@twilit rapids Discord.js
<Message>.author.send("some cool text goes here")
i found WebSocketShard.status but that's for internal sharding smh
@twilit rapids Don't Works
show your code
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
- If I need to add it to another Discord server, how can I get invite the bot into server LINK?,
- 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?
@umbral glacier Here you go bud. https://discordjs.guide/preparations/adding-your-bot-to-servers.html
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*
@stray garnet that should send 'test' to the person who invoked command
But it dont @spare goblet
oh
thats because
thats cuz you reclaimed the "message" constant
change it to this
//stuff
msg.edit(embed)
message.author.send("Test")
})```
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
what's your db file like?
I think it's json.sqlite
@spare goblet Dont works still :(
@stray garnet Can you send in your code
reeeeee
You should make your help command dynamic instead of manually adding each new command to it
wdym
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
can u do an little Example?
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
Ok sounds complicated for me, or im just dumb
Each of your commands are in external files?
@spare goblet so whats worng there?
But ok
@stray garnet is there an error? Whatβs supposed to happen? Whatβs happening instead
It won't do anything? As the message is getting changed to the exact same thing.
Yes
@slim heart No Errors, It should DM a user when it runs the Command
let msg = await message.channel.send(embed);
await msg.edit(embed);
message.member.send('Test');
Shouldnβt make a difference
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.
Shit. I forgot to remove that lmao.
Lmao
I don't use Rich Embeds so I don't know how you can change an already made embed.
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
No Error but dont works still @warm marsh
@slim heart Oh it does send the Embed but it dont sends the DM
message.member.send isnβt a function, it would either be message.author.send or message.member.user.send
message.member.send is a function.
Is it?
is it?
Iβve never seen it
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
@stray garnet does any of your commands actually run?
Yes of cause.
This is the only command that doesn't?
Weird.
Is there anything that you're not doing on this command that's in every other command?
Oh wait i need to fix that




