#development
1 messages · Page 1107 of 1
you cant split twice
learn
js
please
example: nickname with space notwork like {gok selw}
im uisng args[1] and args[2]
1 is for nickname
2 is for platform
but when i use nickname with space nickpart 2 is in args2
learn
js
please
lua walks in
t o i l e t
better alternative: 🚪 🚶♂️
better alternative:
lua
I don't agree with that
Yay lang wars
aha something work



trash bot starter pack:
- doesn't know language
- asks to be spoonfed
- glitch and/or heroku
trash bot starter pack
- "X is a multipurpose bot with loads of features!"
- "X is a moderation bot with loads of features!"
trash bot starter pack
- "X is a multipurpose bot with loads of features!"
- "X is a moderation bot with loads of features!"
@restive willow dont forgettotally glich 24/7!1!!!!12132£!"!£!!!!!!123!"!!!!
andmee7
too many people try to copy big bots
as if that'll gain them any popularity lol
the community is oversaturated enough
Why copy bots when u already have them smh
Mee5 1/2
@faint prism dont pain ur mom
only make a bot if you have an original idea smh
or if u can do it better
mee5
M336
only make a bot if you have an original idea smh
@restive willow true
yapdb op bot ngl
yagpdb
Meeπ
Dynomous
Dookiecord
terraria miner
Me is making a cricket bot
ping/pong bot
Waw
thing is with those its hard to make them interactive
you asked
like u can interact with reactions or whatever but super slowly
@earnest phoenix don't post any account credentials, thank you
Make pictionary bot
why? just edit the message instead of sending new ones and clear the reactions
How was it illegal @restive willow
How do u get the bot Dev role
u could take emojis from other servers and upload it to urs
anyone can help me ?
but discord said Nah
shivaco
@earnest phoenix
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
u could take emojis from other servers and upload it to urs
Owo has one such command tho
i just want code bot with banned user in dbl
can i ?
i wont add he dbl owner list
Thanks @slender thistle
i can right?
thank's
whats the wrong?
const DBL = require("dblapi.js");
const dbl = new DBL(ayar.dbltoken)
.addField("`Oy Bilgileri`",`**Kiritonun** \nToplam Oyları : **${dbl.getBot(client.user.id).points ||"0"}\nAylık Oyları : ${dbl.getBot(client.user.id).monthlyPoints || "0"} **``)```
?
i dont use that library
so i dunno, sorry
also, what exactly is the problem here?
is it not connecting to discord?
I dont understand whats going on in that code
or is the command not working
theres no embed
if the command isnt working its because you dont have that field info connected to a variable and you didnt actually ask your bot to send the embed
thats all i know
if its not connecting its because if thats all the code youve got you arent asking it to and you arent providing a token for it to use
yeah
you have to actually connect that info to an embed and then ask your bot to send that embed
Anyone know an offline code academy?
no
In Javascript, how can I split a string into several parts that do not exceed 2000 characters and must use the character \n to split?
that one i dont know
@dire stag you could use khan academy they have free js and c# classes i think
if you make an account
i dont think it works offline
@balmy knoll if you don't care about the characters after the 2000-limit, you can just use .substring(start, end) and .split(delimiter)
if you do, split them first, then loop over them and keep adding them until the limit is exceeded
Okay, but using .match and a regex can't do it?
Which blows my mind ^
The problem is that I can't figure out absolutely how to do it, I've only come to do that has to split every 2000 characters, but I don't know how to put the condition of \n.
/[\s\S]{0,2000}/ 
ew
Ok, i try
I'm sorry, but I just don't understand, could someone help me find the right regex?
anyone know how to split embeds that are over 1024 characters ?
https://cdn.discordapp.com/attachments/385837258768515083/739175167347130388/m.png
answer my problem, ty
Anyone knows Python?
@wispy viper split down the chars into mutiple (sub-)arrays
cause its like for a message update thing
@safe kelp what is that?
?
"freebingocards.com" lmfao
@balmy knoll this is my solution
whats wrong with heroku and glitch 😦
probably more complicated than regex, but im pretty sure its more performant
nothing wrong wid dem doe
well, why not simply get a vps
not everyone has money
free glitch is useless lol
heroku isnt meant for production (can still be used for it though, they dont mind)
u need to pay glitch to be somewhat useful
and glitch isnt a host
you could ping it in the past
It is
both services offer "Free" Hardware but you pay with unreliable stuff. and if you get the "Premium" Plan from them its still shit and they will limit it
no
no its not
but that doesnt work anymore
glitch is bad
where the fuck does it say that???
it is bad
a vps will be more effective in the long run over premium for those services
glitch is-
waitcaniusemywebapponheroku?
yea
no heroku is good for small projects
Vps is the best option
and hosting free
glitch is really bad, a lot of modules dont even work
glitch isnt a host... :fp:
vps is obv thebest option of course
free glitch is useless lol
@midnight blaze I use it for when I'm trying out something that I don't know will work, and then I go to virtual studio and put it in my actual bot
glitch is really bad
@midnight blaze fixed it
glitch isnt a host... :fp:
@digital ibex you host your project on there = Host
xD
use repl for testing
are you have the retard

🙂
can somosa tell me where i can host my web vid chat app for free when its done?
then with ur logic, are u saying a text editor is a host or something? thats literally what it sounds like
I have made some progress, one of my bots got even verified
or a console
can somosa tell me where i can host my web vid chat app for free when its done?
@pure lion heroku might work
but
use a vps
ok ill have a look
if possible
oWo
3 euro per months guys..vps is so much better in so many ways xD I am sure u could get that
i dont use either
mine is 3.59 a month
both have their own purposes
then with ur logic, are u saying a text editor is a host or something? thats literally what it sounds like
@digital ibex it li- it literally hosts it?? I don't get what you're trying to say
i need to verify now
does heroku have a console/available ports?
then with ur logic, are u saying a text editor is a host or something? thats literally what it sounds like
@digital ibex You're using resources from Glitch to run your Bot, technically hosting your bot on glitch
eh fuck it ill buy a vps
it li- it literally hosts it?? I don't get what you're trying to say
@bright dove it runs it. not hosts it
eh fuck it ill buy a vps
@pure lion good decision
digitalocean here we GOOOOOOOOO
hosting is near 24/7
wheres this info come from about me hosting my bot on glitch, or even me using it
not just a test
@bright dove it runs it. not hosts it
@misty sigil well... yeah you got me there
jeremy where are you hosting?
I agree with Jeremy^^ sry hope, but u are wrong there. Hosting is something else, then pressing play for 15minutes.
🐂ide.host
ox 
xo
simply google: what is glitch.com "Website. glitch.com. Glitch (previously known as Fog Creek Software) is a software company specializing in project management tools. Its products include project management and content management, and code review tools."
thats pound you nut
im assuming i would host on the englishMoneys3 one? atJeremy
@pure lion indeed
okay epic
thy english money of 3 a month
thats pound you nut
@pure lion shutty!
i have 20 per month so we good
no idea why 2 of you are coming to the conclusion of me using glitch when i've never used it or ever tried it.
lMao lost use glithc?! haha funny front page news story
no idea why 2 of you are coming to the conclusion of me using glitch when i've never used it or ever tried it.
@digital ibex nobody said you used it
bruh
you will land on starboard lost for using glitch
fuck i need motivation
O:
https://lmgtfy.com/?q=what+is+glitch.com
simply google:
what is glitch.com"Website. glitch.com. Glitch (previously known as Fog Creek Software) is a software company specializing in project management tools. Its products include project management and content management, and code review tools."
@digital ibex
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
the rate of this chat becoming cancer ever since the whole corona thing:
I'm gonna need the axis on that line graph
cba lol
y/t?
@balmy knoll this is my solution
@quartz kindle Using this method, however, I lose the return characters (\n)
let's just drop it though, because it's a pointless argument and people can use whatever they want 
he was just getting the search results for what is glitch, through lmgtfy
lol
to show that you were correct
Just a website you can send people for future reference @digital ibex
Instead of sending the google definition
oh
Someone send me a Javascript code
ty
no
Small ones
needed that one
No like for a test
write it yourself
No Spoonfeeding
No no
out of curiosity
Like for a test
Do you know js?
@opal plank whats your bingo card?
LMAO
wait can someone send an empty?
lol rip
ty
thanks
are u supposed to tick the ones u do?
yea
hol' up we can only cross three rgith
ooh that's good
why the internet is now hating if else statements, smh
@digital ibex not the ones you do, the ones you find here coming to ask
oh
cuz switch exists @opal plank
xDLOL
LMAO
just chill here giving advice for people asking for help and mark the stupid/bad coding practices you see here
inb4 #memes-and-media
owch
what about ternary operator. A lot cooler than switch
i can feel the hurt
and glitch whoops
Switch/case is technically faster than an If/else.
However, it isn't always appropriate for what you want to perform a comparison between
corona: bot devs ⏫
i dont :p
stonks
what about ternary operator? nobody mention this as an alternative
.
@summer torrent https://www.oreilly.com/library/view/high-performance-javascript/9781449382308/ch04.html#:~:text=As it turns out%2C the,than it is for switch .

javascript
high performance
🤣
LOL
how bout ternary operator
ternary 💪 https://i.imgur.com/aMSq08Z.png
finally somone
eeeeeh
not quite
in some cases yes
switch is good for larger number of conditionals
wrong channel
switch is good when you're comparing against the same thing
that too
but if all your comparisons are different, better use if else
oh god..... here we go again
@quartz kindle fixed
hello
I gotta make UI then I'll release it
i am scoring off my bingonium ticket
Your who
https://jeremy-clarkson.is-inside.me/XiQ3WMeP.png
How to turn bot online? https://canary.discordapp.com/channels/264445053596991498/714045415707770900/739179130083606579
Glitch https://canary.discordapp.com/channels/264445053596991498/272764566411149314/739051518833066057
Send code https://canary.discordapp.com/channels/264445053596991498/272764566411149314/739192685033816134
Doesn't know the lang https://canary.discordapp.com/channels/264445053596991498/272764566411149314/739192887698259969
bingo
last time i saw var, i just opened visual studio code :sunglasd:
same
that was a uhhh joke
to dice
Jajajaja
oh
Use object literals if you don't like if else or switch statements
its less about liking and more about not pulling a yandere sim dev
Don't know what that is
there are cases
Elsie iffy
Note: no need to brag about your Scratch skills in the comments, if you use Scratch you have no skill
watch this
there are cases
No there are no cases whatsoever
dont watch it, you will be stuck with those videos for a while
yanderedev = best dev

well, now i've got to say that was a joke because people dont know what a-
im... going.... to... take a long walk
yup
I have less than 10 else statements in my entire code
How much lines of code is it though?
163
Ah
in the whole of my bot, i've got around like 30 if/else statements
doubt
ydoubt
I have a lot of if statements but little else
I don't use else/else if unless I need something else to happen and I'm not exiting the function scope
how would i do this, https://discordapp.com/channels/264445053596991498/272764566411149314/739200166954926100, but for the whole folder?
Change the filter to search in "Project" rahter than "current document"
Oh wait
crtl shift f iirc
ctrl + shift + f
just cat * | grep if | wc -l
then again it's not a bad thing to have a lot of else
Nope
ooof i got quite a few else ifs in a json builder
agree, else if ftw
can someone help me with a bot music script
yikes
dont ask to ask
linter usually spaces
it'd be cooler if it scanned your node_modules folder
o ok
i need to remove my output folder
Or just if lol
66 in bot and dashboard
what
so around 30 in bot then
args[2] is a string right?
yes
What are you comparing exactly?
If it doesn't exist, then the array index would throw an exception
if (args 2 exists) you didnt provide guildmember
this is what you're doing
in human redable
if args[2]?.Length > 0 ? return "Good" : return "No guild blah blah"
wtf is that
@opal plank ty for seeing that, works now
np
ternary conditional operator bro @opal plank
thats one cause where you're overcomplicating
i know what it is
if(args[2) //do something
well you haven't checked if args array is that long
You can't just access it (unless JS allows that)
rather than if args[2](conditional chain check).(accesing another property)
this is the command.
you can check
when i ping someone its sill sending him the you did not provide a GuildMember!
so if var args = {"some", "string"}
and you try to if (args[2] would that not throw an exception because [2] is an invalid index?
Must be a language-specific thing
@opal plank like this?
reee
Well I do C#
Which will crash if you attempt to access memory outside an array
@opal plank
why doesn't the style css I wrote doesn't show on full screen on my laptop but when I make screen smaller it changes to my custom css?
why did you put my example there?
so quick question, how to get the permissions the bot has in the guild?
why doesn't the style css I wrote doesn't show on full screen on my laptop but when I make screen smaller it changes to my custom css?
nodejs
I can send screenshot of how it looks if it helps
discord.js ?
lib?
lemme grab docs
<Member>.permissions.toArray()
oh you're not talking to me
why doesn't the style css I wrote doesn't show on full screen on my laptop but when I make screen smaller it changes to my custom css?
message.guild.me.permissions.toArray()
alright thankyou!
why doesn't the style css I wrote doesn't show on full screen on my laptop but when I make screen smaller it changes to my custom css?
use Final permissions
thanks for the help ill read that
that takes into account channel overrides

i still cant believe Ron copied my example and put it there
Any1 can send me an ez command
can anyone help me
no
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
Fack?
no spoonfeeding @slim tundra

use documents
Figure out if you want to start making a bot using code;
- Coding a bot requires the knowledge of a programming language.
- If you want to learn from the beginning, you can find a good guide here: https://anidiots.guide/getting-started/getting-started-long-version
- You can ask for additional help with bot development in #development.
If you don't want to learn how to program and start from scratch, you can jump into bot development with: https://store.steampowered.com/app/682130/Discord_Bot_Maker/
np
we dont give pre-made code
^^
here is a tip for security for python bots
you make a text file named token.txt then enter your token in it and paste this code in it
f = open("token.txt", "r")
client.run((f.read()))
or use environment variables
Posted shit in #memes-and-media
if im mentioning me its still sending me the you did not provide a GuildMember!
what is args[2]
Also, may want to mention that they should be careful not to commit their secrets by accident by excluding them in .gitignore if they use SCM @earnest phoenix
use mentions
where?
The third argument I guess
use mentions
@summer torrent me?
ye
you do know arrays start at 0 and not 1 right @stiff stream ?
that too
does any 1 know a good discord.py tut website kind of thing
An array's index is an offset of a memory address from where array[0] begins.
the @earnest phoenix docs?
you can ask in discord.gg/dpy @earnest phoenix
hjey thanks
how can i align a div element to the center?
@pure lion if you didnt change those little things i gave you i'll legit slap you thru the internet
give me all the slaps
just 2 things make it 20000x better
circle
bg
a background and round the icon
thats it
i dont have the original to show difference
maybe add a very low transperency background block behind the text
but just compare them
thats what i changed shiemi
idk where its at
@pure lion show original
that was like 5 minutes css
Contrast
style=""
.setImage(message.author.displayAvatarURL()); << that makes an image of your pfp
.setAuthor(message.author.displayAvatarURL());<< it shows the link? 🙂 any ideas why it doesnt work?
o h f u c k t h e r e s t h r e e
and nice site
thanks x2 :D
😄
how do I make the user chhose something in discord.py example .purge num or .hug person {num}
i have a roll command that combines randomly number generated variables
its attached to the first argument
put its only connecting to the second, even though ive set it to arg 0
someone help
it works fine if i put the number in the second argument, but for some reason it cant connect to the first one
var numberdos = Math.floor(Math.random() * args[0]) + 1
var numbertres = Math.floor(Math.random() * args[0]) + 1
var ffnumber = numberuno + numberdos + numbertres```
isnt it supposed it be arg 0 for the first argument?
arguments have worked with arg 0 for other commands
ctx.send or message.channel.send
why is it connected to the second arg?
im so confused
do i have to put it at -1 args? why does it do that
how can i create a button at frontend that triggers a res.redirect at backend?
assuming theres something on stacc actually but ill be back
can someone help me, im so confused
dontasktoask
no matter what number i put in the slot it always is connected to the second one
im going to put in 69
lets see if it connects to the second
slot?
Like args[0] is putting you on the second arg?
Console log your arg variable
Log your args variable, see whats actually in it
Please help me I want to make a application bot I know only how to create the channel
how to make a purge command but the user choosing how many messages is d.py
Clan application
bro
bulkDelete(args[0]) if i had to guess
Oops I don’t see all the message wdym?
fluffy boi he means oppy
are you speaking english
barfs
give me your oppy senpai
Worlds slowest delete
wtf are you even doing at this point
also im not really sure how to attach the console log to the args
ive only done one console log thing where i just see if the bot is ready
console.log(something)?
whatever the name is of the variable you store the arguments passed to the function is what args is
so you need to log that
for example, if it was named args, you'd do console.log(args)
where though and when would it trigger
put it where you think it would log/run, then test it
Where you are trying to use args
im going to make it log whenever i rerun the code
okay well now its not even putting anything in the terminal at all
console.log('your EPIC BOT IS ONLINE!!!');
console.log(args)
})```
That makes no sense
app.get('/', (req, res) => {
res.send('<button type="submit" method="POST" action="/e">redirect me daddy</button>')
})
app.post('/e', (req, res) => {
res.redirect(`/${roomID()}`)
})
i want <button> to redirect me to /roomID but its not :d
args on ready event?
Ready event has no args

do i put it with args
where is args defined?
probably
const args = message.content.slice(PREFIX.length).split(/ +/);
how do i connect it to that
Connect what to what
ive been enlightened
I've used express a bit
do i just put the console.log next to the defining statement?
like how do i actually put it with the args
You put the variable in () of console.log()
but where do i put console.log tho
Where you want it to log
i dont understand because im dumb
ok so woo i want button to get /e which will redirect me to room but h o w
Href?
href yea
currently looking into using kubernetes stuff to handle image processing
app.get('/', (req, res) => {
res.send('<button type="submit" method="GET" action="/unlocking_door">redirect me daddy</button>')
})
app.get('/unlocking_door', (req, res) => {
res.redirect(`/${roomID()}`)
})
in the context of this?
it still doesnt put anything in the logs
you what
var numberdos = Math.floor(Math.random() * args[-1]) + 1
var numbertres = Math.floor(Math.random() * args[-1]) + 1
var ffnumber = numberuno + numberdos + numbertres
var threembed = new MessageEmbed()
.addField('First Roll! :game_die:', numberuno)
.addField('Second Roll! :game_die:', numberdos)
.addField('Third Roll! :game_die: ' , numbertres)
.addField('Total!', ffnumber)
.setColor('FBFF64')
.setTimestamp()
if(!args ||!isNaN(args)) return message.channel.send("Supply a number!")
else message.channel.send(threembed)
console.log(args)```
put it doesnt put it
am i dumb
ehhh
yeah
im so confusion
this is gonna sounddumb put i dont know what that means
like i understand that it logs
but at the point you log it doesnt make sense to me
when you run that point of code it logs it?
i guess would be what it means but it aint workin
The code that executes before console.log will have run
Code after console.log will run after console.log
Excluding some async stuff
one sec, lemme try something
console.log(stuff to be logged)
yes i know, i have that in the code but its not logging it
else message.channel.send(rollEmbed)
console.log(args)```
its not logging anything, though
not even my regular "your bot is ready" is logging
let me restart vsc
okay give me a sec
ugh
my regular "your bot is online isnt logging anymore"
console.log('Success!');
})```
is my "your bot is online" code
good evening all i hope everyone is well, i just wondered if there was a way to fix this shard issue at all thanks in advance feel free to ping me
const Client = new Discord.Client();
okay
all of my "Clients" are uppercase already, though
does it matter?
it still doesnt do anything
my entire file?
const client = new Discord.Client();
const token = 'lol you dont get to know my token';
const PREFIX = '='
const fs = require('fs');
const { execute } = require('./commands/help');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles){
const command = require(`./commands/${file}`);
client.commands.set(command.name, command)
}
client.on('message', message=>{
if(!message.content.startsWith(PREFIX) || message.author.bot) return;
const args = message.content.slice(PREFIX.length).split(/ +/);
const command = args.shift().toLowerCase();
client.on('ready', () =>{
console.log('Success!');
})
if(command === 'help'){
client.commands.get('help').execute(message, args);
} else if (command === 'roll'){
client.commands.get('roll').execute(message, args);
} else if (command === 'roll2'){
client.commands.get('roll2').execute(message, args);
} else if (command === 'roll3'){
client.commands.get('roll3').execute(message, args);
}
});
client.login(token);```
im trying to make a giveaway command, and i know how but heroku blocking JSON files so the giveaway command with a timer isnt working, so i made a new one with out a timer. and i want to add that if i type (prefix) end (giveaway id) it will random choose one. any one knows how?
thats the whole code :/
im trying to make a giveaway command, and i know how but heroku blocking JSON files so the giveaway command with a timer isnt working, so i made a new one with out a timer. and i want to add that if i type (prefix) end (giveaway id) it will random choose one. any one knows how?
@stiff stream 1. don't use json as db
oof, yeah taake that outside your message event
client.on('ready', () =>{
console.log('Success!');
})
this event outside your message event
okay
wait
wait
did i just break everything
are consts global, like if you put one in a bracket would it apply outside of that bracket?
Does anyone have a sharded bot here I have a question
yeah okay thats what i thought
i guess i just f'ed up my bot when i was making too many changes
lets see here
ok well
the success command works
but the bot still connects to the second arg
rather than the first
also, even though i have console.log(args) before the if statement it doesnt log
it just doesnt log the args
is there nothing in them?
im so confused tho
why on earth does it connect to the second arg
thats so weird
like even if i put it to connect at the 1000th args it still connects to the second
maybe send code
name: 'roll',
description: 'rolls a dice',
execute(message, args){
var number = Math.floor(Math.random() * args[0]) + 1
if(!args ||!isNaN(args)) return message.channel.send("Supply a number!")
else message.channel.send('You rolled a ' + number + '!')
}}```
debug it
the command itself works fine but when i say args[0] it connects to the second arg rather than the first for some reason
args[0] would probably be a string
and you're trying to multiply it by a number right
well yeah
ah well sadly javascript allows it so nvm
what does console.log(args) return
nothing
at all
for some reason
wait
one sec
ok
if i do =roll 10 it sends back ten but it still doesnt actually connect to the ten
if i do =roll 10 10 it would react to the second ten and roll a ten sided die
im so confused
=roll 10 logs ['10']?
yup
wait lemme try something
okay
uhhh
so
i changed it so console.log(args[0] and it recognizes that args 0 is the first arg
like if i do =roll 10 it would return ten
but the command only actually reacts to args[1] for some reason
i dont even have the term args[1] in the code once
did you save the file
yup
im going to restart vsc even though its not going to do anything
and it did nothing
im so confused
javascript
when the array is of length 1, or 0, !isNaN(array) returns true
you're trying to check if an array is not a number
yes
instead of !args || !isNaN(args), try !isFinite(args[0])
okay
How to get content of <form> <input type="text">
discord only cares about how your bot uses their data
yes, they don't bother with bot lists
good evening all i hope everyone is well, i just wondered if there was a way to fix this shard issue at all thanks in advance feel free to ping me
https://alebot.is-inside.me/t3oscpRZ.jpg
how get user input
@misty idol pip install -U discord.py
ok thanks
Try replacing pip with pip3 and all other variations
e?
Splendid
bruh why do we have to do all these dumb math functions... like why can't they just make a block for picking something at random 😑
Because that's such a niche, unnecessary thing @bright dove
this isn't too hard to do
// Stolen from:
// https://discordapp.com/channels/264445053596991498/272764566411149314/739239189744320604
Math.floor(Math.random() * int);
lol
there
lmao ty
I forgot what's the ram command can someone tell me please?
yes thx
Let's test my command
And I'll come back if it don't work
What is this error
Error: Cannot find module '/data/data/com.termux/files/home/ram'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
what did you try doing
so like i am making a bot with just api requests because ram usage will be really low now and it is such a small bot that is all it needs. and i am kinda needing an on message command and i dont know exacly how i can do that with api requests. i assume i have to subscrive to a webhook but i dont know how
maybe this is the issue? I'm not really sure
Idk
Türk Varmı
but at the same time you're trying to run node from a mobile android phone it seems. have you tried on a desktop

that's an object
process.memoryUsage() is an object
or not
oof idk what y'all mean
If you want a property you can just do obj[a]... if you want the object as a string, use JSON.stringify(obj)
<form id="userInput" onsubmit="return false" style="text-shadow: 0 0 20px white; color: black;">join a room<br>
<input class="text" id="href" type="text">
<input class="button" type="submit" onclick="localStorage.setItem(href, document.getElementById('href').value);">
</form>
i want the user to attempt to be redirected to a room, and if it fails then an error message will appear but if not the redirect goes through. how'd i go about this?
there are no errors
i just want to know how to redirect to a place the user typed in
:( ok
Any other .NET developers
kinda
you go first
i've got this, but is shows that tiny bit at the bottom, with css, how can i remove that and only show the white part, any ideas?
whats ur problem lmao
idk how to take user input and then redirect to the content of said input
also right click on the tiny annoying rectangle and inspecc
ur making an online chat?
???
oh
apart from the video chat its kinda ez, ez-madium
is that the app.get ?
wait ill show my server.js
guys, do you like my embed generator? https://www.animalbot.xyz/embed?stitle=useless modules&color=fff000&description=p.s bot did not respond&title=new module from jeremy studios&image=https://jeremy-clarkson.is-inside.me/LOsDJSkI.png
ok
const express = require('express')
const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server)
const port = 3000
const { v4: roomID } = require('uuid')
app.set('view-engine', 'ejs')
app.use(express.static('public'))
app.get('/', (req, res) => {
res.render('welcome.ejs')
req.query()
})
app.get('/unlocking_door', (req, res) => {
res.redirect(`/${roomID()}`)
})
app.get('/:room', (req, res) => {
res.render('room.ejs', { roomID: req.params.room })
})
io.on('connection', socket => {
socket.on('join-room', (roomID, userID) => {
socket.join(roomID)
socket.to(roomID).broadcast.emit('user-connected', userID)
socket.on('disconnect', () => {
socket.to(roomID).broadcast.emit('user-disconnect', userID)
})
})
})
server.listen(port, () => { console.log(`listening on port ${port}`) })
(i added the empty req.query func because idk)
you wouldnt really wanna do it like that
just complicates everything
just do this:
uh oh
app.get('/unlocking_door/:roomID', (req, res) => {
if (req.params.roomID !== roomID) return res.render('room.ejs', { message: 'hey nerd, stop tryna mess with my epic site!!' });
res.redirect(`/${req.params.roomID}`);
});```
also pls use semi colons
the only difference is in the url 😦
you what
?
i want to get input (text field that puts data to local storage) and use the data as a URI element
get the input from the frontend and do something with it in the backend?
yeah
ohhh
sorry i was unclear
what does ur frontend look like already?
brb
<form id="userInput" onsubmit="return false" style="text-shadow: 0 0 20px white; color: black;">join a room<br>
<input class="text" id="href" type="text">
<input class="button" type="submit" onclick="localStorage.setItem(href, document.getElementById('href').value);">
</form>
this is the submit boi
i really need to learn more frontend web dev.. but i dont think thats how form works..
(dont take my word on that)
just put it in a div instead of using the form
and wrap the div inside the form
so ur code is just
the form tag does get the data btw
i know
you need to provide the method and action
not styles id onsubmit
well id yh
form can have method and action
<form action="/DATA_SENDING_BACK" method="post">
<div id="userInput" onsubmit="return false" style="text-shadow: 0 0 20px white; color: black;">join a room<br>
<input class="text" id="href" type="text" name="hello">
<input class="button" type="submit" onclick="localStorage.setItem(href, document.getElementById('href').value);">
</div>
</form>
form is used to send frontend data to ur api
thats the frontend ^^
and in the backend: js app.post('/DATA_SENDING_BACK', (req, res) => { const { hello } = req.body; console.log(hello) // this is what the user put in the input tag });
Tempted to make an api for my bot, and move the logic over to it
Maybe I should just move the logic to a library instead, so it's easier to unit test
ok got it
So if I made a website, I could make calls to it for data the bot uses
(im assuming the bot and dashboard are different things?)
idk man
it seems really hacky to me
i'd use ipc then, like i totally know how to use it and stuff
100% familiar with it
totally
app.get('/finding_key', (req, res) => {
const { input } = req.body
try {
res.redirect(`/${input}`)
} catch {
alert('No')
}
})
h
oh shit youre right
Hi
using the try/catch is a bit redundent there since its always going to redirect them to /whatever
hello there
how do i not redirect?
wdym?
TypeError: Cannot destructure property 'input' of 'req.body' as it is undefined.
u m
what does the frontend look like?
<form action="/finding_keys" method="POST" style="text-shadow: 0 0 20px white; color: black;">join a room<br>
<div id="userInput" onsubmit="return false">
<input class="text" name="input" id="href" type="text">
<input class="button" type="submit"
onclick="localStorage.setItem(href, document.getElementById('href').value);">
</div>
</form>
did u put something in the input thing and press enter?
oh
i misread the error
just like
add near the top of the code app.use(express.urlencoded({ extended: false }));
join room works now :D
but how do i stop a user from inputting a valid ID/catch the error and stop crash?
how are you generating the id?
js



