#development
1 messages · Page 617 of 1
k
can someone copy the index.js code and put it in a pastebin? i can't copy it for some reason. https://repl.it/@DominicBurke/Windows-Bot
When someone does it please ping me
What do i need to do to give my servercount en status to the site?
I already installed the API.
the docs
that's for when you become a bot developer
Oh and that
Okay, Thx.
you need an api token
Thanks @amber fractal
Would someone be interested in doing a preliminary test of my bot?
yes
hi all can someone please look over this code and tell me what i should use instead of await? as i get SyntaxError: await is only valid in async function at Module._compile (internal/modules/cjs/loader.js:703:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:822:10) at internal/main/run_main_module.js:17:11
Thanks , i just noticed i closed the message event early by using }); 😃 thanks for your help your comment helped my realise my mistake even though it looked valid it was not 😄
@opaque eagle
why don't you make a command handler?
ayy i crashed someones api website <br /> <b>Fatal error</b>: Out of memory (allocated 10485760) (tried to allocate 1191936 bytes) in <b>C:\Users\BrightSkyz\Documents\Development\BrightSkyz\MemeLoad\api\v1\random.php</b> on line <b>8</b><br />
lmao i sent to many requests to it
puts in 5 thinking it means minutes not milliseconds
gee I wonder why my api crashed
lmao i was doing some quick maths
axios({
method: "get",
url: "https://api.memeload.us/v1/random"
})
.then(function(response) {
console.log(response.data.image);
});
}
(function loop() {
var rand = Math.round(Math.random() * (300000 - 500)) + 500;
setTimeout(function() {
task();
loop();
}, rand);
}());```all done by this code
not my fault
i need the web site its not coming back online rip
Oof
yep big rip to my random meme event
^^^
hopefully the dev of the website comes back and gets it back up n running with some more ram
gets back up with less ram and bans your access point
Lol
u are rude and yea im on glitch they change ip every 24 hours
yea they change ip of the project continuously
Which gets irritating tbh
If you don’t use uptime your bot might go offline every 12 hours
i do skysilk vps
it’s the best my wallet can do
Free isn't really a good reason to use something so terrible
i want to get cloud 9 but its confusing and glitch has live editor that i love
The only other option is self host
which is not free but it lasts 24/7
i dont really care about FREE part
The live editor is nice as well
^^^ thats what i love
Honestly glitch runs pretty well for me
Lmao
I don’t really have any issues
i want to get cloud 9 i got it once but i dont know how payments work on aws
so i am scared to get it
Idk I'll switch to Glitch when it can run my Redis stores and kubernetes clusters
aws is just a credit card
^^^ i know that
but i dont know how billing works like how they take money on usage or what
And no, you can't change my mind.
i wasnt able to figure that out
hourly billing
Glitch can use databases
normally
ec2 machines are per hour
ewww glitch
I use a different database
exactly
Can’t remember which one
Nono
k
Json is so bad
Just like Glitch @grizzled spruce
real pro's use csv databases
why do u guys hate glitch they do everything for free without ads
bro
Dude
because the hosting is potato
I’m not a pro lol
also discord blocks its IP every so often lol
@shy rose there ping is faster than digital ocean i have tested that myself
Yep
It can't do anything advanced... it can't run Redis stores, Docker containers, etc... no ssh, no pipelines, no CI, no nothing. It's an editor, not a host. It's an editor, not a host. @fiery stream
Well it works for what I do so idc
@fiery stream depends on your neighbours and also server location of that do machine
^^^ dont complain about something free
@fiery stream i can get avg of 15ms ping to discord off aws
And you can't scale up your "system" in Glitch
You can't allocate more memory to it
heroku at least has scaling capacity
@fiery stream the reason why most people don't use it because free hosting is shit hosting
as its designed as a service not a hobby thing
When using glitch, you're not in control of the environment in which your bot is run. And I hate that more than anything.
i dont think so because they care about there users they add updates regularly
They can solve all of these problems... if they add Docker support
thats just containerised code thats pretty good tbh
But they won't, becuz Glitch isn't meant for that
It’s free tho
glitch is a hobby hosting thing tbh
What do you expect from a free service?
and guess what @shy rose they are using aws in backend
heroku is free and designed as a service
You need to stop citing it being free as a good thing... that is bad news, not good @grizzled spruce
@fiery stream yes but you also share it with god knows how many neighbours
if the person next to you is downloading the internet then your latency will go through the roof
@opaque eagle your not the one using it so I don’t give a shit
If you absolutely need a free option, Heroku is much better
^
umm true rn im just waiting to get my self a domain then i am moving my all important stuff to vultr
heroku is designed as a service not a hobby system
@opaque eagle is now sh free again 😮
yeppy i got achievement
And when I have this argument with others, they think I'm hating on Glitch. I'm not. No dev who talks shit about Glitch is doing it cuz Glitch is bad. Glitch is good... at what it's supposed to do. Using Glitch as a bot host is misusing it, and that's where it goes terribly wrong.
wait does zeit just run like aws lambdas? @opaque eagle
Yeah
thats cool
They dropped Docker support in exchange for AWS lambdas
can you make long running apps or is it just lambda based?
@grizzled spruce how many achievement things you got????
Think they do both
Infinite
lmao really
Lol
thats cool 😄
My bot can generate any
srsly
Yep
It’s not on the bot list yet
ohh can i join the server its in
I can give you the link in a non advertising way
just inv me in your testing server or som if u got one
If someone explicitly asks for a link, there's nothing wrong in sharing it through DMs, or so I believe.
Ok
if its in context yeah
^
Just posting a link and saying "yo join my server" is... not so good. But I'm assuming it's fine in this case.
@ mooserators bean for ads
lol
I checked rules. It’s ok as long as it’s requested
Bet they won't respond even if u pinged @shy rose
im sure i could get at least 1 ping sock
they ill they fast as Freak
O
https://hasteb.in/nocakehi.js pls help
returns undefined
uses nekos.life
discord.js
nvm'
so if a server owner decides to kick/remove my bot how can i find out the user who did the kicking/removing
i wanna be able to send them an ominous private message
i know i can use the guildDelete event listener
guildDelete could also mean the bot left by itself
!ping
Bro
Sending them an ominous private message will just make them not like the bot more
Not to mention idek if that's allowed
@amber fractal fair enough
ok so i have a sqlite database that i use to log what someone uses my bot for (commands, server join, server leave, etc.) and the date the bot is used. i have the use date stored as a sequelize date, when i get a date object from the db and try to adjust it for my time zone using the .toLocaleString() method in the javascript docs it only outputs a string with the time set to the UTC time zone
can anyone help me test something in my bot
ayy whats wrong with this
// This is the name of the role.
name: "Admin",
check: (message) => message.channel.type === "text" ? (message.member.hasPermission("ADMINSTRATOR") === message.author.id ? true : false) : false
},```
its saying Invalid permission string or number.
you spelled administrator wrong
Pronounced admin-straight-tor
Lol
@sinful lotus is it gonna work if i spell it correctly
Hang on
am gonna check permissions
just so you know
8 is the admin number
@fiery stream ^^
@delicate zephyr nah
check your spelling
If i fix it will it work
facepalm did you read what I said?
Okay i fixed the spellin
Nope it will not work
Unexpected token it will show
Why is that
Lol
that ternary isnt needed
thats just useless and will make your code unreadable
because hasPermissions will already return TRUE or FALSE
make your code better
uhmm what?
because you set it to let collector = await message.channel.createMessageCollector(col => !col.bot, { time: 30000 })
time: 30000 means it will wait for 30 secs to end
read documentation
console.log if it doesnt send and look on where your code stops
it stops at setImage
then start debugging from there
i guess the image im trying to send is undefined ..
but i dont know how else to define it
read documentation of the api
theres no docs...
define works and not work
also if you open that link on browser
you will find your answer tbh
i have it open
what do you see?
did you really open the api?
i think im going to just leave this server breh
https://fortnite-public-api.theapinetwork.com/prod09/store/get if you open this link
what do you see?
Its a json response
i got it
and literally if you would google "JSON PARSER"
Dont blame us for your lack of knowledge. We are only gonna point you to right direction.
Another thing is code legibly, I even have a hard time reading that code
i didnt blame you for anything
How am I supposed to grab different items if the items arnt numbered
@gilded plank prefix @earnest phoenix
GuildClean's prefix is -
@fiery stream this is #development lol
🤔
@gilded plank prefix @mild heart
Ayako's prefix is a~ or @Ayako
Hello, I would like someone who is currently available on computer. And who have nodejs
Sure, what do u need
I can not install the superagent module and I would like you to give it to me please @opaque eagle
Its puts makes mistakes
What kinds of mistakes?
The operation was denied by your operating system
Already done..
There I speak with a phone but I have a computer next to me..
who can give it to me the module superagent so ?
build it yourself
yes
Idk why ur getting that error lmao... unless ur installing globally
I see that expected
I put everything in a folder superagent and its puts puts it does not find the module..
I was wondering if someone could install it on his computer and send it to me?
There's just the superagent that lags
And I don't know why
I do
npm i superagent```
and if its not working I did
npm i superagent --force
its not working even in Admin
install yarn and try it with that
ok
Thx
Seriously, its takes time to install it and puts it like what I can not, you can give it to me directly because I have 20 minutes after I have to go..
@earnest phoenix what is the error
@spring ember The operation was rejected by your operating system.
let role = message . guild . roles . find ( r => r . id == ' 547042181223809055 ' ) case " role " : if ( ! role) return message . channel . send ( ` ** $ { Message . author . username } **, role not found ` ) message . guild . members . filter ( m => ! m . user . bot ). forEach ( member => member . addRole (role))message . channel . send ( ` ** $ { Message . author . username } ** ** role $ { role . name } ** Was added to all members ` ) break ;
Can you check
No err but not working
What the actual fuck
What
Why did u have those spaces there in the first place then...
Use ur bot’s eval command to remove all spaces with regex
Let me send screen shot
How can I use eval for it
Can you give example
Plzz
I am new to eval
eval("code")
@pallid zinc which library are you using
Discord.js master
oh ok
try this
eval message.channel.send ('hi')
or come i n #commands for example
u should stop leaving that many spaces
yeet
bots aren't something you can easily "make", they are programmed just like any other software/game
not that recently
rude
@spring ember ok wait
@modest remnant please read my previous message, or click on the following link:
https://discordapp.com/channels/264445053596991498/272764566411149314/578599704963842058
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../mime/cli.js',
npm ERR! dest: '/storage/emulated/0/Bot Discord/bot/node_modules/.bin/mime' },
npm ERR! stack:
npm ERR! "Error: EACCES: permission denied, symlink '../mime/cli.js' -> '/storage/emulated/0/Bot Discord/bot/node_modules/.bin/mime'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../mime/cli.js',
npm ERR! dest: '/storage/emulated/0/Bot Discord/bot/node_modules/.bin/mime',
npm ERR! parent: 'bot' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
@spring ember
One message removed from a suspended account.
@modest remnant You don't know how to create at least one app bot?
Have you watched YouTube videos or on the Internet?
there are like over 3.5k public bots you can find on the site, why do you need a custom one specifically?
He's gone..
no
He got banned?
One message removed from a suspended account.
🤦
he didnt even leave
One message removed from a suspended account.
deleting one message
"yep, he's gone"
I hadn't seen
how about scrolling up to see his previous messages? since that's exactly the reason why discord never deletes them
How can I make bot that tell the time
I know it's useless (my bot name is also useless)
thx
@pallid zinc is the issue the bot or the time
What programming language?
.js
Ok
@spring ember always the same error
You can not still give me the superagent module and its dependencies please
It already in
It's a permissions error
Deleting the node_modules folder and then running npm install again might work as well
Its started to settle but its stopped
Already done
But the error comes only for the superagent module, you can give it to me directly to the worst?
I have no idea what causes it sorry
Try googling this issue and add an issue on the GitHub repository
Personally I prefer superagent
Well I can't help you with that
I was just asking if someone could give me the module because me it makes me mistakes..
wdym
if (event.guild.id != "493025435769372682") return;
if (!events.hasOwnProperty(event.t)) return;
const { d: data } = event;
const userid = bot.users.get(data.user_id);
console.log(events[event.t], userid)
bot.emit(events[event.t], userid);
});```
Hi
My problem is :
This line does not work :
if (event.guild.id != "493025435769372682") return;
The error is : id of undefined
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat you want see all my code ?
One message removed from a suspended account.
I want get the id of the personn who has add the reaction
It's been 3 hours that I can not do it and nobody can find the test with the event
why are you using raw 
🆙
I want get the id of the personn who has add the reaction It's been 3 hours that I can not do it and nobody can find the test with the event
part of codage :
guild.channels.get('578603303085146132').send(nouvserv);
Error :
TypeError: Cannot read property 'send' of undefined
@earnest phoenix channel doesn't exist
then it would work.
But the ID of the target lounge is the right
One message removed from a suspended account.
?
@sage bobcat why ?
One message removed from a suspended account.
One message removed from a suspended account.
But the channel with the ID 578603303085146132 is in my server and not in the one where it is added. How do I make it send to my server?
@flint trellis
One message removed from a suspended account.
just use messageReactionAdd
One message removed from a suspended account.

One message removed from a suspended account.
@sage bobcat what ?.??
@earnest phoenix just do <client>.channels.get()
ok
@flint trellis
guild.channels.get('578603303085146132').send(nouvserv);
it's good
is guild defined
yes
as what
But its not working
show code pls
k
codeblock or hastebin
k
https://discordapp.com/channels/264445053596991498/272764566411149314/578636857894502422 Look my message and help me if you can thx 😉
@flint trellis
https://hastebin.com/lusajejoza.js
come
i would also suggest adding an error catch to the guild.owner.send because Guild#owner is a nullable object
sry
see if it works with <client>.channels.get()
then the channel doesn't exist
But if there is
you are looking for the channel in the guild the bot gets added to
which only exists if its added to the server the channel exists in
do client.channels.get instead
I wonder who said that. Three times. 
@mossy vine same error
oh boy
are you 100% positive that the channel does indeed exists and that its actually a channel id and not something else
Ok

ID : 578603303085146132
:v
or maybe the channel isnt cached
@earnest phoenix restart your bot, send a message to the channel, and add the bot to another server
k
Why does my bot shut down after 1-2 weeks with an error?
I am very sorry.
I have to change my account under various circumstances. If so, can I change the owner on this list?
@earnest phoenix whats the error?
@unique nimbus
I can not track this error
Where do you host your bot?
amazon
I am not sure sorry
it's alright, thanks
Suppose I am creating a webserver with http.createServer() from a js file, now I need that webserver object in another js file, How can I do so?
export the object
^
from the file you made the webserver
const server = http.createServer()
module.exports.server = server```
well I was kinda not wanting to spoonfeed him..
Then I .require() the file where webserver was created to access its module.exports?
I think .require() will run that file again
.require()?
^
it's just require
if you need to access it from the file you created it in, its already defined as server
so you can do server.listen()
ez
const webserver = require('./webclient.js').server```?
@mossy vine I deleted the salon, I have recreated another and I copied the ID, I even checked with koya the ID and it is the same I copied but its always puts
Cannot read property .send of undefined
are you sure the bot is in the server the channel is in
Yes, it is in the support server
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i don't see an if statement
@sage bobcat I wouldn't be able to eval anything since you use js and I use py
One message removed from a suspended account.
One message removed from a suspended account.
pingsock
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
you have a client.on in there
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
and that is why
you format your code
to realize you have a missing )
and that is also why
you dont use glitch
and use a proper ide
Why doesn't this change the shape of my bot's logo to a circle?css div.bot-img img { border-radius: 50%; }
You have to edit it
With 100% it makes it almost a circle. But I just edit the images. Since it doesnt place the circle always how I want it
For example:
http://neko-bot.net/images/ownerimg.round.png
oh... why doesn't the css work tho?
Why it doesn't work
client.on('guildCreate', guild => {
let addembed = new Discord.RichEmbed()
.setColor("GREEN")
.setTitle("**__Merci de m'avoir ajouté dans ton serveur !__**")
.addField("💼 • Mon prefix :", "`t/` (Changeable)")
.addField("✨ • Ma page d'aide :", "t/aide")
.setFooter("Encore merci de m'avoir ajouté dans ton serveur !")
try{
guild.owner.send(addembed)
}catch(e){
console.log(`Nouveau serveur ! Message privé avec le owner bloqué.`)
}
});
whats the error
^
^ not working can mean lots of different things
just saying "help pls it dont work" isnt helpful to anyone
@opaque eagle idk
oh
No problems appear in the console.
I work with css and html more than js
lol
How do u know it doesn't work
Me?
@earnest phoenix there could be many issues with that. instead of not doing anything with the error (e) how about you log it instead of some useless "oh shit problem occured" shit
because I tested
is guild.ownerID your id
Log the error in the catch @earnest phoenix
But I want that when someone adds my bot, the bot sends a message to the owner of the server in question
yes we can read your code, you posted it
so we know what the error is
can anyone help me with audio stuff in nodejs
am I able to stream an audio instance using discord.js
please ping me
One message removed from a suspended account.
how do I turn an audio instance into an audio stream
hello, can anyone help me out understanding an issue with emojies.
I want my bot to have customs emojies, in all servers where he is
it already has
right click + copy link
does that mean he needs to inject his emojies in each server?
no
No .
no
It has nitro
it doesnt
:mmLol:
only some nitro features
Essentially
bot-version of nitro
^
So that means what, i upload custom emojies to 1 server, support server, and he will be able to use that id code on every other server?
Yeh
and i can upload emojies like a user, not even needed to do it as a bot?
I need bots
I get a 400 Bad Request error ```js
fetch(https://discordbots.org/api/bots/${this.client.user.id}/stats, {
method: "POST",
body: { server_count: this.client.guilds.size },
headers: {
"Authorization": this.client.discordBotList
}
});
@opaque eagle i believe you need a content type
Oh
Nope, still same error
fetch(`https://discordbots.org/api/bots/571097569644773455/stats`, {
method: "POST",
body: { server_count: 11 },
headers: {
"Content-Type": "application/json",
"Authorization": auth
}
}).then(console.log);```
then what would it be
That's a js object
👍
@west spoke it worked at last (the round image thing)... apparently I didn't enclose my css in <style></style> tags xD
Anyone knows if it is possible to shorten all this characters in the URL link here:
I see one bot has:
How can i make it like this?
just a sec
no swap
i need "picture input outpu"t codes for javascript


https://www.npmjs.com/package/jimp @earnest phoenix
custom css
style tag
@shy rose yeah I know that but like I have my site embedded in an iframe blah blah but some of the other bot pages have dark backgrounds
custom css via a style tag
<style>
body {
background-color: black;
}
</style>
yeah i believe so
#cbf57a
he/she said black
#00000
ik....
<style>
body {
background-color: black;
}
</style>
but #00000
is same value as black
or even shorten the hex to #000 or rgb(0,0,0)
css3 has variables for even more options 
Yeah
and functions
Honestly u can do it so many ways
and all the stuff it should have had long ago
I just wish DBL offered LESS/Stylus support
sass is a precompile
it has everything css should have
chrome even supports previewing css in sass view lol
Yeah
I just wish there was a default dark theme
so that I could just pop the style tag in there lol
ah, I got it. had to steal some code, ngl. https://discordbots.org/bot/544017840760422417
but think it looks good
it is indeed done using style tags in ur bot description thingy.
- How do I make that circle behind the logo disappear
- How can I make the text behind the image go to the right
In-case u wanna preview itcss <style> div.bot-img { background-color: #C9B37A } div#bot-img, div.bot-img, div.bot-img img { border-radius: 50% !important; animation: MoveUpDown 2s linear infinite; position: absolute; left: 0; bottom: 0; } @keyframes MoveUpDown { 0%, 100% { bottom: 0; } 50% { bottom: 5px; } } </style>
you can use display: none for the circle
did you add box-shadow?
no, that css above is all I have
shoot
if the border-radius is 4px it might go normal
nope still there
div#bot-img, div.bot-img, div.bot-img img {
border-radius: 50% !important;
border-radius: 4px;
animation: MoveUpDown 2s linear infinite;
position: absolute;
left: 0;
bottom: 0;
}
@keyframes MoveUpDown {
0%, 100% {
bottom: 0;
}
50% {
bottom: 5px;
}
}```
Lmao so much trouble just to get it to bounce up and down
.columns #bot-img .bot-img {
box-shadow: 0px 0px 0px 0px #C2C1BE, 4px 4px 8px 0px rgba(0,0,0,0.2) !important
}
```is what i did to remove the white circle
||psst you set the border radius to 50% and 4px above||
ohh lol
I like finding the easy way of things... anyone know of a open-sourced Discord bot w/ an economy/currency system? 😉
Or can anyone point me in the right direction in developing this bot?
i sure wish a mod was on, but you can go over to https://discordbots.org/
you would need a database to store balance and stuff
is it cool if I can ask a question on some command development stuff
just ask
Can a bot edit his own message on DM channel?
Lepi yes i think
Yes
I'm trying to work on a command that pulls a random post from a subreddit, and I've been struggling a bit with getting it to work
since its the bot's message
i receive a FORBIDDEN status code
@opaque eagle bruh
provide more context
discord.errors.Forbidden: FORBIDDEN (status code: 403): Cannot execute action on a DM channel
Is there any way I can pull this off or is more context needed
Tbh stringing api together is easy
what is the language
if we dont know those we cant help
Nekos.life(yes eww) just use the image variable :v
Nekoslife is fine because it is a public api and you get what you expect to get
I'm using discord.js and tried wrapping it using node-fetch
Can a bot clear reactions on a DM channel ?
any errors?
His own reactins
yes
discord.errors.Forbidden: FORBIDDEN (status code: 403): Cannot execute action on a DM channel
then probably you cant
I dont think it can use reactions
this line makes an error await client.clear_reactions(message);
Technically a bot in a dm has the @everyone role with no perms except delete and edit their own messages
If you think about it
:-0
Make it send a separate one that checks if it's in a dm or not
And that's why I dont use reactions
=help -main
=h profile -profile help
Essentially structured like that
I think I found out why the reddit command might not be working
the code is a giant mess and it's just a big blob of commands
how do i can get messages own id which seding by "await channel.send" func.
for example, i will send 4 messages using by "await channel.send" func. and user react emoji 2nd message.
in this case, how i can do for bot recognized it ( just react only 2nd message. )
what language
python.
@static marsh Thank you. it's so simple 😃
👌 😁
i didn't see it's return type...haha..😜
Hello, I have a question. What exactly is allowed for discord bots. Is there a policy I can refer to? I know that it is not allowed to punish for not voting, but what other limitations are there? Am I allowed to deny service to anyone? or only if they abuse bot/cheat? I know that some bots deny service for muting their bot etc. I just did not want to violate a policy. For a reply, please ping me! Thank you!
@robust acorn well you cant change activity more than 5 times a minute
what does that mean?
I thought it was 5 messages per 4 sec limitations
but in terms of blacklisting, what is okay?
such as @gilded plank is "Watching Discord Bots" that is activity
intervals between editing a message has some limit idk
then they find it
You are allowed to blacklist anyone after all it's your bot.
Are you saying you can see all their tokens?
how do people make multistep forms in bots? i mean how is it done best to keep track of what question the user has answered to?
Do i create something like a global open_dialogues, as soon as some user start the form, and then always check for each message everywhere if its part of a dialogue. This seems bad somehow.
I mean a user starts a multipart form. get asked one question after the other and has to answer one question after thje other
that's not a form :what:
oh you mean web
so i mean this concept in a bot
how do people make multistep forms in bots?
forms don't even exist in chat
ok. i understand form as a more general think as you do
wat
A form is not 2 white boxes with username and password only on webpages.
A form is something that allows a user to enter data that is sent to a server for processing.
and there is no such thing on discord
you do it everytime you send a message
bro u really dont understand what i want by now?
no, you're being vague
Ok assume two people want to setup their account for my bot. For this they have to write "ar!setup". Then the bot will start the setup process for the user. It then "allows a user to enter data that is sent to a server for processing." But it first asks the first question, then the user answeres the first question. After successfull answer of the first question, the bot should ask the second question, and the user answeres the second question. Then the bot asks the third question. do you get it?
User: ar!setup
Bot: What is your xyz?
User: blablabla
Bot: What do you want to be your whatever?
User: This and that
Bot: To finalize please blabla
User: dumdum
Bot: Everything saved. Setup done. Thnaks
listen to user responses -> filter out any message that's not by x user -> time out if there's no response, otherwise repeat
But how do i internally keep track of how far the user is?
Do i create something like a global open_dialogues, as soon as some user start the form, and then always check for each message everywhere if its part of a dialogue.
which library are you using
nodejs
library
discordjs
Ok nice. So as soon as someone starts the setup, i start a message collector and add it so some global array? This messagecollector listens to that channel only, and the filter assueres that only messages of that user are processed.
Now after the setup command, the bot send the first question and a messagecollectior is created. When the user answeres it will pass the collector's filter (by userid) and i can process that message. correct?
yes
the collector has a collect event which you can use to interact with the message at the time of reply
ok nice, but this i could have also achieved by simply saving userid,channelid on setupstart, and then filter on every message for those values, right? (Using collectors only reduces workload?)
How can i know in which step the user is within a started dialogue/collector? How do i implement these steps mechanics (moving to next question if first answer is valid, fallback to the last question on false answer, resolving it at the end if everything is correct, remove the dialogue if the user doesnt respond for some time, etc.) ?
Also, it should be assuered that two useres can make their setup process partly simultaniously in the same channel.
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {
target:
WebSocket {
_events:
[Object: null prototype] {
message: [Function],
open: [Function],
error: [Function],
close: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
readyState: 2,
protocol: '',
_binaryType: 'nodebuffer',
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_closeCode: 1006,
_extensions: {},
_receiver: null,
_sender: null,
_socket: null,
_isServer: false,
_redirects: 0,
url: 'wss://gateway.discord.gg/?v=6&encoding=json',
_req: null },
type: 'error',
My bot crashed and gave me his
where are you hosting the bot
I had done it on my phone just this morning but its done several times that I lit it for a long time on my phone and it never gave me this error
get a proper vps
I can't find
that's probably the root of the problem
i do this
Hi,
What you can do is a simple change in node_modules/discord.js/src/client/websocket/WebSocketConnection.js
Line 364, change the whole function onError(err) to:
onError(error) {
if (error && error.message === 'uWs client connection error') {
this.reconnect();
return;
}
this.reconnect();
return;
}
Which will force a connection instead of crashing on that error.
and its stopped from crash
that's not, i-
Uh
Lmao
You know they crash for a reason right?
If it keeps reconnecting they will just reset your token
One message removed from a suspended account.
hey
One message removed from a suspended account.
how can I get info in a js file from a html file's <input> userinput?
because I cannot use require() in <script> and I need to
why would you need require for getting the value of an input field?
document.getElementById('inputid').value```
you want to write that to a js file or what
I will tell what I want to do.
I need the user to put their server ID in a <input> then I need to store that info in a variable in my main js file to lookup server and give back server info
let userinput = document.getElementById('inputid').value
console.log(userinput) // whatever the value of the input field is```
you dont need to store that
I need something like index.js.variables.serverID = userinput
let webclient = require('./webclient.js').server
const serverID = '';
await webclient()
.then(document => {
serverID = document.getElementById("userinput")
})``` is this ok? @mossy vine
Assuming its regular html + js, no
As you said yourself, you cant use require() in browser js
That code will be in my main file
Which you are running on your server, so document wont be valid
I am still hosting my site along with my bot app because pm2 won't work with auto-restart
It needs sudo perms
And my host doesn't give them
- Buy a vps, assuming you are using a free host
- Look up guides on how to safely send data between server and client
get a host that's not glitch or heroku then
And i told you how
Whether I implement it in my code or not
But that isnt what youre looking for
I was curious
you probably shouldnt mix and match frontend and backend code
especially not backend code into frontend
This might be a simple question for certain people. I've been using a MessageCollector for my discord.js bot. It collects a message, inserts it into a database and then goes on to the MessageCollector.next property. However, when it gets to that property, it will stop the collector and only 1 value is inserted into the database. I dont know what I'm doing wrong. I know the issue lays with the MessageCollector, as it doesn't show a error in any syntax.
Please tag me when someone replies. I have the server muted and I'm on my way to a appointment.
Idk discord.js so I may be reading what that means wrong, but if you are storing messages from users in a persistent db, I hope that you have a privacy policy stating that, or some other way to make that clear. The database should also be encrypted, if not that breaks TOS.
-help
Hello </Jazz>!
Need help? Get more help and information here: https://discord.gg/pFPrbyq
Some FAQ:
+ Does this bot/website have a bump function?
No, Discord Server List does not support any bumping functions.
``````diff
+ My image|member count|emojis|name wont update?
Try updating your server on the website.
Go here (https://discordbots.org/servers/264445053596991498/edit) to edit Discord Bot List.
This bot does not have any other commands yet!
I can assure you, I'm not storing messages themselves. This is for a project that I'm part of. I can also happily say that no ToS will ever be broken.
The user executes a command and that starts a process that adds the values from that user to the database.
how would i create a webhook in js?
i looked at docs and they aren't super helpful
What library
discord.js?
it seems like you need an already made webhook
Look at the second link
how else would you get the token and id
alternatively, that ^
@slow elk Sorry, Im not familiar with discord.js, but messageCollector sounded like user messages, sorry for the confusion.
It's fine.
@scarlet phoenix
A MessageCollector is a temporary collector of messages in a channel. They're usually used for voting systems. There's also a sister of the MessageCollector, which is the ReactionCollector, which is usually used for menus with multiple pages on, for example, a music queue.
or you can be like me and completely disregard those collectors and build your own
its not really public, but i can send you the code if you want
Please do. I'll be able to study it and, with credit, edit it in my own little way.
Hi i nned help with discord.js bot script
module.exports.run = async (bot, message, args) => {
var con = mysql.createConnection({
host: "localhost",
user: "****",
password: "*********",
database: "******"
});
con.query("SELECT user FROM Staff", function (err, result, fields) {
const users = JSON.stringify(result)
console.log(JSON.stringify(result))
let userr = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
if(!message.author === (`${users}`)) {
if (err) throw err;
console.log(err);
if (!userr) return message.channel.send("Usage: -givepremium <server id>")
CODE
} else {
message.channel.send(`Sorry but you are not staff!`);
}
})
}
Error:
I got Sorry but you are not staff! as reply but i am added in db
you can't compare an object to a collection
nevermind i see what they're doing
putting the collection into a string
thinking it joins it
@strange escarp or @earnest phoenix
You mean i did wrong some its not db error or some
it's not a database error, it's a user error
you mean collecting my id or users?
Checking if the user is the author
Author is an object in discord.js
Depending on what you have stored in your database, it's going to require a certain type of value from the author object.
Probably the ID
will check
question for canary users, when you copy the message url it's then canary.discordapp.com for you, but is this also the case for webhook urls?
@strange escarp its varchar
yes
What does the object look like?
[{"id":1,"user":"572527691949932556","type":1,"date":1556908550,"administrator":"572527691949932556"},{"id":2,"user":"559041831569063936","type":1,"date":1556908550,"administrator":"572527691949932556"},{"id":3,"user":"572527691949932556","type":1,"date":1556908550,"administrator":"572527691949932556"}]
that is the output i think you mean this
Okay
So user and administrator look like snowflakes
Which one are you checking?
user
Okay
This should be interesting
function checkUsers(users, id) {
for(const user : users) {
if(user.user == id) {
return true;
}
}
return false;
}
Then your if statement can be: ```Javascript
if(checkUsers(users, message.author.id)) {
It's not a pretty solution, but it's a working one.
Why are you pasting code?
idk i mean like where should i write/paste it
Replace your current if statement with the one I wrote
As for the function, put it somewhere outside of the function you currently have.
okay
I need to know for sure, does anyone with canary know the actual answer?
webhooks are part of the api, not the client
if you look at their url, they have the /api endpoint
meaning no
@strange escarp i got this when i put as function
well I had to ask, cause of the canary message urls and stuff
message urls are still part of the client
mk then
guys help when i try to start my bot this message comes
i dont understand anything it says
go recheck your commands and validate that all groups are lowercase, as the error states
this is my index
yeah xd
i dont want my HAVOC to be controlled
i litterly have tried EVERYTHING there is but i can't get it to work
btw, I was installing the requests module, and is now stuck at this for over 10 minutes now 
this is my coin flip code i dont know if its complete or no
One message removed from a suspended account.