#development
1 messages · Page 1855 of 1
If I use the mute command or it is reported as lacking permissions, is there a way to check the bot's permissions with the rights of the person who is muted?
that's not bad source code
it is 😄
its completely unmaintainable, unreadable
one of them has a basic level of being distinguishable
the other one is what i would see my sleep paralysis demon write
and that is the latter
go read this lol
i mean thats one of many 10,000 line source files 
but the entire game logic, its models, its animations, everything is hard coded into the games C++ code 😄
typical for old games
Looks like a lot of tabs lmao
how do I fix this repl process died unexpectedly: signal: killed
you're running out of memory
I deleted all my repls
you know it's bound to be bad when your RAM usage flies up to 90% with it open lmao
rent a proper vps 🤷♂️
well I will but for now what do I do
optimize your bot's ram usage
how do I do that
well
and don't use node 
I'm using py
"i cant get food in my mouth"
"use a fork"
"how do i do that"
this is as much a silly question as "how do i optimise my code" - you tell us, your code!
bruh I mean I don't even understand what you mean by "optimize your bot's ram usage" here
make it use less memory
How much RAM do you even have?
8 Gb
Brain is still alive. Haven’t seen you for a while.
Hmm haven’t seen Erwin, too for a while now
not your pc lol, the vps
Would be funny if he repeats that
its repl
Oh for free nvm then
its like complaining theres no space in your home, but then you find out youre on the 'home free plan', which is a small wooden box on a street
@earnest phoenix turn off any and all caching, wherever you can. sorry, cant tell you how, as i dont do python
Erwin dumped up
hey there @boreal iron 😄
yea
for some time I thought he's ded
but then I found him in detritus server all activ
500 mb
yea
lemme try that
we're preparing to move home, so discord has been lower down the priorities, just keeping triviabot ticking over really till im settled in new place. its got a literal man cave!
17080s cellar with sandstone walls!
Sounds poetic
God thanks I have placed cat 6 cables into each wAll when I was renovating my house and garage
As well as sat cables and others
Found out later I was a genius doing that earlier

But all that doesn’t matter if you just have 50Mbit/s upload like me at home
Damn EuroDocsis3.1 but that trash upload cause my ISP sucks
1PB
client is missing "GUILD_VOICE_STATES" intent"
i have a simple python script that draws text n stuff using pillow
but the text gets kinda weird if i run it on windows
like this for example
i think the text gets a bit wider and there is a 12px y offset whenever i draw one
can anyone help me if they have an idea
Something like that
let maxSymbols=15
let bar="emoji1".repeat(maxSymbols).split('').map((v,i)=>i==Math.trunc((playedTime/duration)*maxSymbols)?"emoji2":v).join('')
Replace emoji one and emoji two
And try
Sry I'm on phone so can't code long one
playedTime and duration should be replaced with your variables
then i display bar in the embed?
so like
Put it anywhere you want
.addField() the bar variable right?
Yeah or in description
or even footer
ill just check what on earth every function does
btw
should it be in like
a specific time?
There's another version but I can't write it since I'm on mobile
not formatted tohh:mm:ss
playedTime and duration should have same unit
Seconds or minutes
And be number not text like 55:44
you do realize they spoonfeeded you
that is true

but i will be still learning on how it works
doesnt seem like it
can i have a fast question here very NOT related to bots? but about development =p
someone know how to install apple configurator ON LINUX ? wine i have broken btw
👀
•_• noone? ;-;
https://dpp.brainbox.cc/buildwindows.html
finally updated my windows build instructions... feedback welcome, after someone who isnt a C++ dev to have a look and see if it makes sense
whats apple configurator?
for making profiles for ios. official downloads are ONLY for macOS, i found replacement for windoz but have also broken wine so i can execute it lmao
sounds hacky lol
a little. but app is generally legal. nothing else except wine for linux? or something to install macos appstore app under this linux?
no
broken wine?
you cant run an osx app under linux, unless its made to run in linux and you have source code to rebuild it
what to do with it.....I'm completely clue less
i installed dotnet 40 but when i try to install dis shit it throws that i dont have service pack of dotnet 3.5
Dotnet 40?
dotnet 4 doesnt replace 3.5
prefix both 32 and 64
yep
iirc
but shouldnt 4.0 install also previous versions?
no
the same way windows 10 doesn't install previous versions of windows
god. pls no JAVA !!!!!
it doesn't make sense
theres already dotnet 5 and 6 lol
this ik also
guys pls
.net framework is different from .net core which is different from dotnet
dotnet 40 when
dotnet. and service pack 1
it kinda does, in that windows 10 has like 90% of the code from windows 95 in it 
from 3.5
at least it isn't dos based ™️
as far as we know
all windoz is dos based?
no
all versions. even 11
havent you found that bit of code that hides the dos stuff 
from windows xp and beyond it no longer runs on dos
wut?
SO HOW FCKIN CMD WORKS ?!
you have a misconception
command promot is just uh... a command prompt 😄
dos is a kernel
Magic
yep. same as unix and linux :/
wanna see something funny?
this is a hex edit of cmd.exe
wht to do?
Do fizzbuzz in brainfuck
wai... WUT ?
get it
lol
send the intents you need
which library are you using?
djs
which version?
latest
which is?
lemme see
Need help
v13
The HyperText Transfer Protocol (HTTP) 410 Gone client error response code indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent.
so you should have a little place in your Client that says intents
where?
where you create the client
so what should I do? any solutions
new Client()
can u gimme an example code?
you are trying to download something that doesnt exist
its already in your code
intents are required in v13
like where and how to require intents
yea some external files.....wait...that means someting is wrong with the path?
show where you create your client
d should be capital
no lol
in my code it is
that code is not for v13, thats old code
because thats how you defined discord
doesnt mean he did
oh
what code should I write then?
ok
thx
Do they really make you do that long ass definition of intents now
Or can you still just use strings to define the intents
Oh thank God
I'll pretend like I know what this means
can't we simply write
const { CommandoClient } = require('discord.js-commando');
isn't that ez?
If you're using commando ig
or I'm stupid
Any help
You can destructrue yes
const client = new Discord.Client({
intents: 515,
shards: "auto"
})
Okay
I understand it completely now
I assume that number represents the intents bitfields added up?
ye
it's still showing that fuckin error
show code
Hey Tim how's your raw lib coming along?
that error vanished when i restared the code
how?
Bro
it works @quartz kindle thank you 👍
Just note the guild members and presence intent requires it to be enabled in the dev portal
its blur on my pc
struggling with creating a cache, so im mostly writing docs now for the parts that are done
Ah I see well I'm sure you'll figure it out
decisions decisions
the best memory efficiency is achieved with arrays
but then you cant access caches by id
hey u can't leave space when you are using let
and thats kinda needed in most cases
Can't you take a page out of djs books
Hey Tim, if you remember I solved this problem because of you. but now i faced a problem like this
You could make a collection system like djs has no?
Or just use djs collections
Or is that not what you mean by caching
you changed the font size to 36
you have to change the height to be equal as well
the height is still 30
not exactly
its how you put everything together
Ah I see
for example djs puts channels both outside and inside guilds
and uses a lot of nested collections
guilds have a collection of channels, which have a collection of messages, which have a collection of mentions, etc
that quickly ramps up to millions of instances of collections, which is extremely inefficient
Hi I'm new discord user
if you put things inside arrays instead of collections, for example a guild having an array of channels instead of a collection of channels
it would make a huge difference in memory usage
but then you lose access by id
you have to use array.find for everything, which wastes cpu
im trying to go for an intermediate solution inspired by sql tables
but theres a lot of work involved to keep the relationships together
how to print 'hello world' in python
Did you really just ask that
jk 
Yea sure
"How do I console.log "hello world" in JS?"
guys why i got this error every month lol
i put it on hold for now, since its not that important
people can simply create their own caches anyway
lel
I'd just use a map and call it a day
Wait wha
members.get([guild_id, user_id])
Well okay that makes sense
Wait
Couldn't you just bind members to guild and neglect the need to provide a guild id yourself or?
thats the issue
if you put a map inside a guild, or create a separate map for each guild, with 1000 guilds you have 1000 maps
Mmm true
1 map for combined guild id and user id, plus an array of member ids inside guilds is more memory efficient
you can easily have methods on a guild object that does it for you if you want
True but I don't see the point
Alot easier just passing the guild id and user id yourself
hey
when I try to play a specific song on my music bot, it shows status code 410 and when I play other songs, it plays them well
Hi all
player.play is not a function
glitch
how to fix?
I have a feeling this is copy pasta
it happended with me a lot of times
Yep
juts make a false file in your code, delete it, restart the website and again run the code
From v11
thats not enough information, you have an uncaught promise somewhere, catch your promises. the error doesnt really help
Zeriodev/Music-bot (now I remember)
lol
the other one seems to be up to date tho

Androz2091/discord-music-bot
like they have time to read the README
or effort
or knowledge
or wisdom
Or tim
they have Tim tho
Lol
No
Tim is gone
Tim should have a special role with how much he's in development
Homie only has a little less than 20k messages outside of the dev channel
75k/93k
Vote Tim for Guardian of Development
can @slash.slash be put above/with @bot.command so that the command will be added to both slash and prefix commands.
this is for python
Try it
how can i split the message content to two messages when the content is too big?
automaticly
split the string, then check the left if it exceeds a certain number slice it into equal chunks and put it all back together
how?
I told you how
How can i make a variable for each 5 objects inside an array
No, i have an array of, for example 70 strings, and i want to make a variable for each 5 of them containing the 5 strings
like chunking?
idk i guess
YES
very enthusiastic yes
there's a way of doing it with reduce, but idk how it works exactly
the way I do is by iterating over the array and creating sub arrays
Does anyone know where i can find the documentation of the line of code to recieve button responses? Or just a basic tutorial on buttons for python? The button documentation tells me how to make them but not what to do after sending them.
mhmmm
i dont know how that the thing
I can show how I do it, but it'll be java code
i know a little bit of java, maybe i can transale it to ts, but first i need to know how its done
actually
public static <T> List<List<T>> chunkify(List<T> list, int chunkSize) {
int overflow = list.size() % chunkSize;
List<List<T>> chunks = new ArrayList<>();
for (int i = 0; i < (list.size() - overflow) / chunkSize; i++) {
chunks.add(list.subList(i * chunkSize, (i * chunkSize) + chunkSize));
}
if (overflow > 0)
chunks.add(list.subList(list.size() - overflow, list.size()));
return chunks;
}
here, better
thank you!
const limit = 1000
const texts = []
if(message.content.length <= limit){
for(let a = 0; a < Math.celi(message.content.length / limit); a++){
let tmp;
if(a === 0){
tmp = message.content.slice(0, limit)
} else {
tmp = message.content.slice((a*limit), (limit * (a + 1)))
}
texts.push(tmp)
}
} else {
texts.push(message.content)
}
There's a 420% chance this code won't work but still. It'll automatically create as many arrays needed
but it's really just looping over the master array breaking into mini arrays
then creating a final array containing the leftover elements
if (!msg.guild.me.permissions.has("SEND_MESSAGES")) return
He still throws an error that he cant send messages
@modern sable
id 668861966147911700
marco?
idk he was on the top on the list and und that there were bots, so I thought there arent moderators on the server 🥴
if (!msg.channel.permissionsFor(msg.guild.me.permissions.has("SEND_MESSAGES"))) return
Now he always returns no matter if he has the permission or not
I don't really know how to explain how wrong that is
but basically, remove msg.channel.permissionsFor
how to calculate ram in nodejs
lmao
process.memoryUsage.rss()
its in bytes
how do i convert it into mega bytes?
Hi! I have an easy question (i think) about javascript:
// INPUT
let array = {};
array["color"].push("blue")
array["color"].push("red")
array["place"].push("italy")
array["place"].push("argentina")
console.log(array["color"])
console.log(array["place"])
// OUTPUT
["blue" , "red"]
["italy" , "argentina"]
I want to do this; use .push in an array but, in a specific argument. Can I do that?
PD: the code that I show you, doesnt work
what you want isn't an array but an object
and yes, you can
howeber you need to instantiate the array before attempting to push else it'll fail
Does anyone know how to use buttons well in python?
This is my loop for button detection but it simply says that "This interaction failed" when either of the buttons are pressed. I am not sure why.
while True:
try:
interaction = await wait_for_component(bot, components=action_row, timeout=30)
if interaction.component.custom_id == "2":
cur_index += 1
if cur_index >= len(embedList):
cur_index = 0
await interaction.edit_origin(embed=embedList[cur_index])
elif interaction.component.custom_id == "1":
cur_index -= 1
if cur_index < 0:
cur_index = len(embedList)-1
await interaction.edit_origin(embed=embedList[cur_index])
except asyncio.TimeoutError:
break
im not getting errors in my console for it either
so the buttons stay active for the time frame and the users can press them as much as they want to navigate
event emitter internet explorer style
Im transfering over from using reactions
so I just kept it. Would there be a better way?
buttons have their own event, just listen there
not even reactions required a loop to work
but then how would i keep track of the index
Give them actual IDs lol
store the pagination object somewhere so you can track its state
how do you ping a role?
<&id>
oh ok
then id have to store the data class to hold the max, min and index into a dict with the identifier being the actual pagination object :/
Also how would I allow for time out? So I don't have to permanently store the pagination objects and delete them upon a certain time frame of in-activeness and also remove the buttons while im at it.
the whole point of using the loop was so that I could infinitely have it whilst also allowing for timeout
<@&ID>*
let array: number[] = [1, 2, 3, 4, 5, 6];
let chunk = 2;
let output: number[] = [];
for (let i = 0; i < array.length; i+=chunk) {
output.push(array.slice(i, i+chunk));
}
console.log(output) // [ [1, 2], [3, 4], [5, 6] ]
Or with reduce:
let array: number[] = [1, 2, 3, 4, 5, 6];
let itemsPerChunk = 2;
let chunks = array.reduce((chunks: number[][], item: number, index: number) => {
const chunk = Math.floor(index / chunk);
chunks[chunk] = ([] as number[]).concat(chunks[chunk] || [], item);
return chunks;
}, []);
console.log(chunks) // [ [1, 2], [3, 4], [5, 6] ]
Not 100% sure that last one works tho haven't tested it
either use timestamps or self-expiring maps
like this https://pypi.org/project/expiringdict/
There, now the reduce one should work
<3333
python makes me jealous
that exists for pretty much any lang afaik
I use it on java
actually, every cache lib will have a self-expiring map
Can Java scripts run in the browser?
probably, using scriptlets
weebassembly
while you can embed java into browser it'll result in a relatively big file
that's why javascript was created
The creation of JavaScheme, colorised
https://i.tusinean.ro/M7W7Rqx.gif does anyone know why v16 doesn't throw the address already in use error?
I've also tried the error event but it isn't fired
try-catch it
it does throw, else it'd not say "Uncaught error"
^^
v16 doesnt raise any errors, it binds twice with SO_REUSEADDR
reuseaddr is the right way to do if you wish to reuse the port
else it'll stay alive for some time after shutting down the process
doesn't v14 use SO_REUSEADDR too?
I'm confused
ah I get it now
Linux and windows behave pretty diffrently with how they handle it
im surprised they actually enabled it for windows tbh
the reuseaddr?
this is actually wsl. The v16 is a linux build and the v14 is a windows build, you can see the .exe extension
makes sense now
anyways, now I'm wondering how I can disable SO_REUSEADDR
I just don't wanna reuse the port and get an error when the port is bound
can i ask smth now or channel busy?
You can always ask a question.
k, thk
from this thingy:
l = []
scam = requests.get("https://script.googleusercontent.com/macros/echo?user_content_key=V1VRkcLy79NqRzGszzki5IwoqgfiRS0CPnpSth1jVdX0Z88w39o7tC71MMkAARMFYXSZIe5ysMkkTdp_V8q-gLFNUefAtxy5m5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnA1zRMJcOWhp5p8-TrasYiLfc8s82yHYvncMdEYM4VMzrAWyr3_vgWcPkd2qwPRs1bz0TAVXLS4Dleb--x_lwbJ0QrOacq8a_9z9Jw9Md8uu&lib=Mvhguv8KrjGlroshaZkuz2rjldAiTUHuJ")
Data = scam.json()
for i in Data:
for key in i:
l.append(i["put here stean scam: ↓↓↓"])
@bot.listen("on_message")
async def scam(ctx):
global l
for thing in l:
if thing in ctx.content():
ctx.delete()
i got this error:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 37, in scam
if thing in ctx.content():
TypeError: 'str' object is not callable
is it possible to fix?
PS: friend was helping me so some bugs might be made by him =p
Looks like you're sharing an API key there 👀
its not api key but a database. public ofc
Ok
if ya want - enter there. but it contains mal links to filter
stean scam
Does Context even has content attribute doe. Well, regardless, ctx.content seems to be a str object which doesn't implement __call__ method. So, the fix is just don't call it lawl
this is correct but this bug is between list, string and word
It's not
if != for
ctx is really a Message
this type content. ctx is correct
Ah, lawl, I didn't even realize it's on_message
and line 37 at me is if thing in ctx.content():
so how to get from db?
Even in the example it's a Message (https://discordpy.readthedocs.io/en/stable/ext/commands/api.html?highlight=listen#discord.ext.commands.Bot.listen)
It's not the problem with that
and .content is a property—not a method
i know this ye? i just want to know how to do it. this one works. now i only have a smol problem with similar with db
this what works alr:
with open("bad-words.txt", 'r') as f:
global badwords
words = f.read()
badwords = words.splitlines()
@bot.listen("on_message")
async def swears(ctx):
msg = ctx.content.lower()
for word in badwords:
if word in msg:
await ctx.delete()
Because you don't call the str object
?
You can't do ""()
so why this work?
Because str objects are not callable
Because you don't call the str object
Say ctx.content were an empty string, you're doing "".lower() which is valid
anyways - here is a messup i see - im gonna ask somewhere aelse
They're gonna tell you the same thing though
what if i dont want only lower but all chars (caps and not? and numbers?)
Well, pretend .lower() doesn't exist
if you dont want lower just do ctx.content()?
No, don't call a str object 
isnt that done same as u say virgin?
well I don't code in py as u showed in the example above u did call it
It's their code...
Yes, a property
then just do ctx.content
without () ?
yes its a property
Literally what Klay and I have been telling ya
kay. now works (and i also forgot bout await. like always)
I DIDNT SAID ALREADY THAT AT ME IS DONE?! STAHP TALKIN BOUT DIS !!!
Help my starting my bot
Provide context about your problem instead of saying something vague please
How is the new form of joining a voice channel?
channel.join() does not exist now
You will have to look into the docs of your library
it doesnt exist
im using djs v13
on v12 you could do .join()
this link shows all the changes
well fuck
now its a external module
can we clear cache in discord.py while the bot is running
probably
how
you just need to find out how to access it
I do know how to access it
and tbf, you can ONLY clear the cache while the bot is running
wait actually idk
hm
once you find out how to access the cache, just clear the collection
yes I guess
I did try to find but I couldn't
go to docs, look for a github icon in the navbar
which cache are you looking for
d.py stores all cached information into object classes
you need to be way more specific
and what are you trying to do?
lemme read that first
jfc
thank you I'll try it out later today
well you know the messages cache
how do I clear that
okay
let me try and explain how it actually works lol
there's a on_socket_response event in the gateway, that occurs when there's a new detected event that is dispatched by the websocket connection
just kill the process and restart the bot
when that happens, it dispatches it to an internal class method to call for the right object to have its class data set
the "cached" data changes because of every new event dispatch
you can't really clear the cache if you want the simple answer.
the term "cache" is really referring to class instances being set with values from the last declared event dispatch
it's not as you're seeing it
if you want to "clear" cache you can do del ctx.message to completely erase it
but it will then no longer work, and you should only delete for globals.
hmmm
it helps if you actually read the source code to understand this that the cache cannot be cleared through conventional methods
have fun
there's about 30 files stringed together to the gateway 
@round cove
also
i can't really think of a reason of why you'd really need to clear specific parts of the objects d.py provides
Calling del will only dereference it, though. The object itself will still be cached, no?
with another file for the HTTP / session handling
if you want to clear it just dont set it at all
wait we can set the limit
how do I do that
I wanna set it to 100
theoretically yes
the limit is already 1000 why do you want it lower?
the object class itself will still have been given set values, you're only removing the identifier that points to it
There's max_messages parameter afaik
hence why there's no actual "clear caching" solution
Here's where the container is https://github.com/Rapptz/discord.py/blob/master/discord/state.py#L265-L268
oh he's using deque that's smart
You'll find that alot of the libs that arent discord.js tend to be pretty well developed
alright smarty pants
wait
okay nvm, that's just an odd name
"none()" made me go
what
I have a question
how the fuck does discord calculate intents and what the heck is << >> | &
<< and >> are bitshift operators
<< doubles IIRC and >> halves
| is an operator to conjoin/combine intflags, & removes?
which is a little funny because in my mind they should be the other way around
iirc d.py does something like default = GUILD_MEMBERS | MEMBER_PRESENCES
but that should be an anti intflag if done right
mb, used to calling them intflags ¯_(ツ)_/¯
basically:
FOO = 1 << 0
BAR = 1 << 1
ALL = FOO | BAR
permissions = 0
if permissions & BAR != 0: # user has this permission
...
i wonder how d.js coded partials though
<< just shifts the bits to the left
yes
0110 << 1 becomes 1100
im sure that means it would double
yeah so it doubles lmao
because that's registering a higher value
saying it just moves the bits to the left/right makes more sense, helps understanding why it exists
"shift" is in the name for that
class Intents(IntFlag):
GUILDS = 1 << 0
GUILD_MEMBERS = 1 << 1
GUILD_BANS = 1 << 2
GUILD_EMOJIS_AND_STICKERS = 1 << 3
GUILD_INTEGRATIONS = 1 << 4
GUILD_WEBHOOKS = 1 << 5
GUILD_INVITES = 1 << 6
GUILD_VOICE_STATES = 1 << 7
GUILD_PRESENCES = 1 << 8
GUILD_MESSAGES = 1 << 9
GUILD_MESSAGE_REACTIONS = 1 << 10
GUILD_MESSAGE_TYPING = 1 << 11
DIRECT_MESSAGES = 1 << 12
DIRECT_MESSAGE_REACTIONS = 1 << 13
DIRECT_MESSAGE_TYPING = 1 << 14
this is how i wrote mine atm
but im really curious as to how d.js implemented partials for specific intents
you mean like GUILDS_MEMBERS | GUILD_BANS?
i can't remember
but thinking about it i'm pretty sure that's how they're most likely doing it
they probably just use the bitflags to define what should be retrieved into the partial
im still having the formdata issue, does anyone know why its not like getting the form data?
const form = document.getElementById('changeData');
const formData = new FormData(form);```
and formData is just an empty object
am i doing something stupid or?
changeData is a form
the error is coming when I'm trying to test a webhook using my bot
you're trying to send a request with the wrong method
like using GET on a POST endpoint
how to send message through a webhook using a bot command
like I added a command to my bot which sends message through a webhook
thx
Well watching the MDN docs the compatibility of formdata is a mess. Lot's of listed browser do not support it or got marked as ? which isn't a good flag either.
then whats the better option to not manually send data
just because it shows up as an empty object doesnt mean its empty
afaik formdata contents are kinda hidden
you have to use formdata methods to access them
Not sure how you defined changeData before but try to use this:
const formData = new FormData(document.querySelector('changeData'));
how am i supposed to do that in my backend?
wtf did I just copied
E.
why this:
@bot.event
async def on_command_error(error, ctx):
if isinstance(error, commands.CommandNotFound):
await ctx.send("What was that ?!")
else:
raise error
gives me this in terminal instead of message ?!
TypeError: exceptions must derive from BaseException
It's ctx, error, not the other way around
you're using formdata in your backend?
ah, ok, found on stackoverflow. u know
that code was front end no?
? nah

but im receiving an empty object
oh na
ye
with multer?
is that a middleware?
yes
then you need it for formdata
np
wait it says "NOTE: Multer will not process any form which is not multipart (multipart/form-data)."
i jus got bakc to my pc and went on the npm page
is your form not using multipart?
i think it can accept json but as raw string
idk what u mean, in the body i have that then i have a callback which makes it json
not makes the formdata json but response
formdata is specifically made for multipart
oh
i thought thats how ur supposed to like
not manually send data
how am i supposed to not manually send data if that makes sense
just do form.submit()
form submit will use urlencoded
but thats not much different from json
and express should be able to handle it natively
how am i supposed to do it? is it something like js fetch('url', { method: 'post', body: form.submit() .... } ? or something
guys
document.getElementById("myForm").submit();
yeah now im confused on how it sends to the correct endpoint
i need project replit slash command
oh in the form tag i use action?
you specify it in the form tag yes
thank
this is so annoying man
now the preventDefault it not working
document.getElementById('save-btn').addEventListener('click', (event) => {
event.preventDefault();
form.submit();
});```
One message removed from a suspended account.
once you go jetbrains you cant go back
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
🚣♂️
One message removed from a suspended account.
anyone kno how to fix my issue lol
One message removed from a suspended account.
Didn't it work yesterday after removing the arrow expression?
I remember you said you replaced the code with the previous version and it doesn't use arrow functions... if I remember correctly.
you forgor 💀
nope he also posted a code snipped
nope

oh, yeah it was workin fine
i misread
but i thought i had to use formdata, and formdata would not send any data
its still not reloading the page, and i change it to form.submit and now it sends the data everything updates and everything
but it reloads the page
dub
wdym
form.addEventListener("submit", event => event.preventDefault())
kk
actually
doesnt change anything
that will also prevent the form from being sent lol
which means you have to use fetch one way or another
im confused
i forgot that submitting forms makes the browser change pages
so you have to go back to using fetch and manually sending the data
what dont you get?
Hello
cuz u said i dont have to use fetch and i didnt understand
Thx
yw
Okay
Question, if I make a method on typescript like this:
class Something {
private onFinish: any;
constructor() {}
public start() {
return new Promise((res) => {
this.onFinish = res;
});
}
private end() {
this.onFinish(true);
}
}
What type would onFinish be and what type would start return?
don't u have to declare method return type?
end() would be void for sure since it has no return
Yes
But start and the private property onFinish
Start would return a promise but with what type?
any
it's a promise of any as it seems
wait
nono, it's a promise of void
no return at all
So Promise<void>?
Start would return a promise resolving to nothing (Promise<void>). onFinish would be a function taking a boolean as a single argument and returning nothing ((bool: boolean) => void?).
hey is it possible to make slash commands that only certain users can access? like developer / admin commands that only show up for specific IDs or Roles
no but you can check which user used the command before executing it
I know, I just... dont want my debug or admin-only commands showing up when users /
That feature was already planned in the Discord API docs API discussion (https://github.com/discord/discord-api-docs/discussions/3581), so it's not possible yet, the only thing you can currently do is to either wait until the feature is rolled out, or just compare IDs and bailout if it doesn't match
dammmmmmmmmnnnnnnnnnit
^ i have not fixed it, turns out it wasnt even making the api request at all
Registering slash commands for guilds (not global) is a way to limit them to your server only, for example to test them.
A permission system (user/channel/server whitelist) shouldn't be complicated to integrate into your slash command handler.
Returning messages for members without privileges to run that slash command can be ephemeral which means they don't spam any channel, tho.
Even if these options are available in the future I still prefer handling it using your own command handler since editing the global commands a lot of times sometimes brings issues with it.
@earnest phoenix please don't share those links
ive dmed you, mind replying back?
@earnest phoenix change your password and activate 2FA
How can somebody take ur account by clicking on a link?
It’s not like you’re revealing your login data…
the link they posted literally asks you to type your login and password
🤦♂️
@zealous trellis did you use discord v12 with wrapper?
no.
its a fresh new bot
djs 13
oh, they can fish alot of data, especially if the connection is direct
how are you running your bot?
and where is it hosted?
i want to make a O(n) intersection of array function how can i do it in js but i also want to make sure there are not duplicates for example : there is a array of [1,1,1,4,5] then a array of [1,1,2,3,4] i want to make the output [1,1,4] not [1,1,1,4] or something
tip: inspect the interaction object if you are in debug mode
Modern browsers are really idiotic at autofill and such utilities. They can phish for a helluvalot of data from you just clicking a link
Its a valid interaction...
i said inspevt it
just do it
No clue, dont think VSCode can do that
I can console log oit
thats about it
VSCode can debug
check if element exists, then delete from the lookup array
if you run native js
oh wait, O(n)
show your package.json
okay
also, do you have a .replit or .sh file? if so show those too
you literally are using a runtime to run your bot
ill dm u the json
yes i was using this but this has problems
mhm .replit
@zealous trellis
it's typescript but whatever
still same as js
you can debug it
I dont see why I need to debug the interaction, I can just log it
check if said method is available in interaction object
you are literally running the script that intentionally throws an error
can you afford to type console.log a thousand times and scroll up the console?
yes?
Ive been doing that for years
works fine..
.-.
damn kids these days with your fancy debug inspectors, ive been manually logging data for years
and it works
"kids"
lol
that's a tool
alright ill change it
it's really important if you ask me
imagine big data set
keep scrolling forever
but that outta way
by any means, inspect the interaction object
your replit run file should be "node index.js" to explicitly run your index file, or "node ." to run the "main" file from your package.json
and check if said method exists
yeah ive did "node index.js" but it sends
internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, scandir './commands/mod/'
at readdirSync (fs.js:955:3)
at load (/home/runner/topgames/handler/command.js:7:26)
at /home/runner/topgames/handler/command.js:14:41
at Array.forEach (<anonymous>)
at module.exports (/home/runner/topgames/handler/command.js:14:28)
at /home/runner/topgames/index.js:30:71
at Array.forEach (<anonymous>)
at Object.<anonymous> (/home/runner/topgames/index.js:30:33)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: './commands/mod/'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! topgames@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the topgames@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-08-24T20_00_00_464Z-debug.log
very bad
thats not bad
it does not
what's the type of the interaction?
i mean, its an error yes, but at least now you now your files are actually running
slash command..
before your file was not even running in the first place
aka. the first few words before {
now you have to fix your issues
Programming do be like that
Use __dirname and not the relative path for filesync calls
okay so <CommandInteraction>.reply()@zealous trellis
good grief
for the love of god you need to understand inspection
also console.log is a bad practice, leave it
since when
2 actually
if console.log was bad practice, consoles wouldnt have a reason for existing
since literally every bash utility logs data to the console
1 
how tf you would set a breakpoint then?
consoles exist for printing messages
not for inspecting
Reporting issues to the console also let clients the chance to report them isn’t a bad practice
not inspect-friendly
thats literally what Im doing
youre just dragging semantics into it for no reason
.-.
no, you're console logging
breakpoints are debug-exclusive

another mouse click
🥔
breakpoint -> debugger -> stops code there and allows u to view where and how it goes
console.log -> logs
I know how breakpoints work... Ive been using VS since 2015
.-.
console.log 

me since 2020 and like
just see me set a breakpoint in this punch card
I just prefer logging something
it's easy if you are running native javascript on node
for ts you need deno
or ts-node compiled code with sourcemap enabled
I dont need a TS debugging tutorial
huh....
my original problem was that I wanted to cancel an interaction
idk how the hell we went this far off on a tangent
my extended problem is that you used it for 5 years and still don't use the debugger
again, I just prefer logging data
dont see the problem
fun fact: debugger has logging


