#development
1 messages · Page 1436 of 1
That's gonna take a lot of JavaScript and some requestAnimationFrame magic 😊
damn i forgot to feed my robot again
😂
@earnest phoenix why?
can't tell if we found modern day socrates or, well, yk
@umbral zealot without canvas
wat theme
Hello
Don't Just Say "Hello" in Chat.
"Hello"
"Hello" in Chat.
https://nohello.com/ @earnest phoenix
Don't Just Say "Hello" in Chat.
"Hello" in Chat.
hello
@drifting wedge hello what's up 👋🏻
hey!
What's the point in doing without a canvas?
Why do it with canvas?
it's the license for the software
why doesnt this work
event.getJDA().getStatus().equals(OnlineStatus.ONLINE);
event.getJDA().getStatus().equals(Activity.playing("Terraria"));
what doesn't work
well you aren't setting it anywhere
no?
how do i set
do you even know java
👏
server helped me yay
now i can continue my journey of learning java
and making bots
because they helped me get past this barrier
thanks so muh
event.getJDA().getPresence().setActivity(activity);```
same goes for onlinestatus just use setStatus instead of setActivity.
thanks
Imagine a library that sets status using getStatus() and gets using setStatus()
Hello how we make for that the profile of the bot floats?
print it on a piece of paper, glue it to a plastic container and flip the container upside down
it's floating in water!
😂 But I get not ask that
i know
yes imagine a lib that uses a getter as a setter and a setter as a getter
i was kidding with you because you need to give more context with your question
I've no idea what "Floats" means either
making the boat float sounds like a new meme level.
@sweet ravine the selector for the stars is .entity-header__star.star.icon
from what I can tell they are cooler integers but not quite as cool as doubles
How'd you get "Animation" from that? lol.
Thank you

Because I just went float: left , y'know?
"the profile of the bot floats" most likely they mean a floating effect animation where the image slowly goes up and down
wait are we talking about floats css, floats animations, or floats numbers
Lmao
On top.gg I saw that we could float the pp of the bot and I would like to know how we do this I hope I was pretty clear
I thought we were talking about numbers
Just to be clear abey, you mean a floating animation?
Yes
the pp of the bot 
🗿
Google css floating animation
Youre not wrong lol
use https://animista.net/ to generate css animations to save yourself a trip to a therapist
Man I'm so confused about the second part, literally iterated through the entire thing and got the numbers but after multiplying it says your answer is too low, like what, 
what the hell is this
Aoc
Advent of code
This is what i tried and got those
0, 2, 4, 6 as in 1, 3, 5, 7
Just string and array indexing starts from 0
i have a embed something like
.setTitle('mytitle')
.setDescription('mydescription')
.setImage('urlofaimage')
message.channel.send(embed)``` tho the image doesn't come
🗿 I'm pretty sure tim is trying to pass every challenge in advent of code to reach to my question rn
🗿 Advent of code is pretty much a certified bruh moment
@earnest phoenix I'm pretty sure you're in love with this emoji 🗿
🗿 Yes we moyai
-bots @earnest phoenix
is there any npm package that lets me convert other image Formats into jpg
When I try to run this line this.client.guilds.get(this.guildID), it says this.client.guilds.get is not a function
aka
.png .webp .jpeg
into .jpg
How can I change the colour of the text with css (next to the stars)
Pretty sure canvas can do that
hmm ok
I can't get the CSS. 😅
Show store.js line 30
require(filepath) should return a class
Console.log it to see what it returns
Console.log it to see
Literally

console.log(require(filepath))
Before that line
One of your commands returns an empty object
{}
guild.channel.create is not a function, why am I getting this error?
guild.channel doesnt exist
yeah^
any idea
is there someone who used mysql on vps? I am not able to connect and stackflow aint helping, maybe someone here managed to use mysql vps and connect it to their bot
hi, I have had a lot of problems creating an embed, can someone pass me their embed code? discord.py
where just about to send you code for C#
anyone knows any good sites that can help with the webhooks for notifications when a server gets a vote?
if dbl #topgg-api
oh okay my bad
it's pretty much the same as using mysql in ur pc
what's the issue?
you could iterate over the pixels in the image and copy to a placeholder image
then save the placeholder as the desired format
*something thats easy to do
that is easy to do
not sure if canvas supports webp or not
I mean I use jimp
Jimp works too

lool
I don't really care about the package size
its not gonna be used for a browser
What have you tried, what is the error?
I use mysql heavily for everything
if you try to connect from remote allow remote connections.
(but its not recomended for Production systems)
(there are cases where its fine)
Is safe enough if you have it set to SSL only plus cert Auth, but still not the best idea
And that's not a subject for beginners
i have my Databases closed for remote connections. if i need to login i use a VPN
I don't have my databases open for remote use at all, if I want to connect remotely I use phpmyadmin, or I tunnel SSH
i dont like phpmyadmin had some security issues
back when i used mysql ive used mysql workbench running on my pc with a encrypted VPN connection to the database server
How can I get a user's username and avatar without going through the oauth flow? (Like what KSoft does, it can get a user's info even if the user has never signed in)
Fetch the user using a bot token
Can you fetch a user that you don't share a guild with?
Yes
It is an API endpoint though
With "Bot <token>" as the Authorization header
That's all
All good
ok im back
after not learning js cus i don't feel like it
is there a way i don't have to learn js and i can still learn how to code?
well coding implies that you learn a programing language
You could learn a different language
tbh I tabbed into the wrong channel

back to testing-1 time
hi
Whats the issue
ok
look
So the listening for messages
do we keep that in index.js?
wait nvm i got it
someone help pleas
please*
@quartz kindle
Build an object like this ```js
let obj = {
guildcreate: "guildCreate"
}
i have a command that deletes invite links, how do i make it pass for users with admin perms?
@commands.Cog.listener()
async def on_message(self, message):
if "discord.gg" in message.content:
await message.delete()
await message.channel.send("{} Do Not Send Invite Links Here!".format(message.author.mention), delete_after=5)```
You said you got it
it with something else
when i turn the bot online
Well you didnt explain the problem
Ok
Well here is my coding
when i turn the bot online it says that
im rn using https://discordjs.guide/creating-your-bot/#replying-to-messages to learn
where at?
client.on("message", message => {
// message exists here
})
// message does not exist here
client.on("message", message => {
// message exists here
});
// message does not exist here
don't a ; need to be next to })?
Not familiar with Python but, it's probably something like if "discord.gg" in message.content and message.author.guild_permissions.administrator == False:
Not required
is that my problem?
im confused its my first time lol sorry for the hard time and im following a site not sure what to do at all i tried. I tried learning js it just wasn't for me i was confused and getting a lot of answer wrong.
Look at my answer
Do you see the brackets
{}
inside those, message exists, outside it doesnt
You cannot use message outside those brackets
Like i showed
Everything that uses message needs to be inside there
learn js before you jump into it it will save you from some frustration
hi
so infront of is
so basically put if inside the brackets?
what exactly does bitrate mean in video and audio
Like that?
In telecommunications and computing, bit rate (bitrate or as a variable R) is the number of bits that are conveyed or processed per unit of time.The bit rate is quantified using the bits per second unit (symbol: "bit/s"), often in conjunction with an SI prefix such as "kilo" (1 kbit/s = 1,000 bit/s), "mega" (1 Mbit/s = 1,000 kbit/s), "giga" (1 G...
The amount of data per second used to display the audio/video
so it basically means the average amount of bytes that are used per a time interval to display the audio/video
Yes
I personally prefer to use not x as opposed to x is False
I see
}``` i got this right, it works perfectly but how would i make it so that if basically anything in the sentence has it, it deletes it including other words? because if i do like testfuck it dosent do anything compared to fuck
not is just a shordhand for checking if it's False?
Well it simply negates the boolean and iirc more efficient even though the difference isn't that significant
if "discord.gg" in message.content and not message.author.guild_permissions.administrator:
You use it like this?
You need data.words.some as well
.some.includes?
Yes, you need a double loop
One to loop over words, another to loop over the forbidden words and see if a word contains a part of the forbidden word
that would just clarify its not a function
if(message.content.split(" ").some.includes(e => data.words(e))){?
GitHub got dark mode
Officially?
yeah
No....
Pog
.some is a function
this is a great day for humanity
How can I create a extra shard?
You already had the first one right
ikr
no AMOLED darkmode? i like the one discord offers
Did not tried discord.js light @Tim#2373 pls apoligize me busy with school
d.js-light is nice, but you have to work around some stuff. bcs of less cached stuff
@quartz kindle then?
I do not cache so much thing , there are just two commands which just work with cache
well stuff like permission checks need some stuff cached.
You had the first .some right, you need another one inside it. A full .some with a function like the first one
oh
that are the two commands which checks the user permisson
So how to create a extra shard?
yea, i have one command. but you need to cache some stuff for it
use internal sharding or sharding manager
use tripple tildes
```
code here
```
you can use fetch method
using the shard manager of dsc js
you can use pretty much the same method as the normal d.js sharding
but d.js-light adds forging with is really nice to have
yes tim showed me , was noice , right
Originally they were named .fake()
i havent used it bcs i have no need for it.
xD
atleast for now. but idk if i will reach the point anyways with js
Because its creating a "fake" instance
discord.js handles the sharding on the same process.
its also easy to implement
you just add a Client Option
(also all the broadcasting stuff you maybe need to implement)
client.shard.broadcastEval ?
already have them
You dont need them for internal sharding
Is there a way to create a full on module reloader? Like a folder with commands in it?
oh i fixed it ty
yea np
hello i need some help, i would like to know when user join & leave voice channel, here is my code :
client.on('voiceStateUpdate', (oldState, newState) => {
if(oldState.channelID === undefined && newState.channelID !== undefined) {
console.log('join')
}
if(newState.channelID=== undefined){
console.log('leave')
}
}``` the console doesn't return join or leave could you help me ?
It's probably null instead of undefined
Null is a better definer than undefined.
You can just use !oldState.channelID
You don't need to check for undefined explicitly
discord PC doesnt have AMOLED mode
They meant GitHub and Discord mobile
ok flazepe & fuzzy i test it
Okay.
Tanks it works 👌
(or not)
so i have the cooldown stuff from https://discordjs.guide/command-handling/adding-features.html#cooldowns and want to prevent it from starting the cooldown if they mention themselves in a command, how would i go about that?
(honestly lmao)
lmao
i can detect if the user mentioned is the one who uses the command, but it activates the cooldown anyway
if (message.mentions.users.first().id != message.author.id) {
message.channel.send(`<@${message.mentions.users.first().id}>`)
}
else {
message.channel.send("You can't give yourself a cookie silly!")
}
Okay I recommend defining user elsewhere and calling for it.
yea, but thats not the issue
Makes life easier.
Okay so after that, in your cooldown thing add a field that checks if the user.id === message.author.id
wait that code was in my command
if (timestamps.has(message.author.id)) {
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`)
}
}
here is my cooldown
in index
Add a field in there that checks the user id against the author id.
hld on
What my thought process says:
thats not gonna work
because the cooldown acivates when a command gets used, but i want it to cooldown if they send the command correctly, just not when they mention themself
if(timestams.has(message.author.id)) {
if(user.id === message.author.id) return;
if(now < expirationTime) {
const timeLeft = (expiration - now) / 1000;
return await message.channel.send(`Please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${cmd.name}\` command again.`);
};
};
There are probably errors in there but yeh.
hold on
Thats what I think.
i gotta switch classes, ill be back in a few mins
Fair. I don't use switch classes I use a decent command handler from AtlantaBot.
Oh lol
Honestly thats what I think because to exit early you check if something is true.
/home/runner/Aperture-Bot/index.js:69
return await message.channel.send(`Please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${cmd.name}\` command again.`);
^^^^^
SyntaxError: await is only valid in async function
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
exit status 1
@stable nimbus
Yeah I async everything.
ASyncing everything helps a lot, abuse it.
You can remove the await keyword however.
@twilit geode
yeah, why are you awaiting that
Is there a point in "asyncing everything" if you aren't awaiting anything inside?
@stable nimbus your code doesnt work
it got errors out the wazzoo for every reason immaginable
Hmmm
send an screenshot
from the json file
if there is your token remove it until you got the screenshot
which one
the json file that has the error
Is the error in main.js?
did you see the image?
?
how do you create a hyperlink in footers of embeds?
So in the package.json file then.
hyperlink?
ok please wait 1 minutes
the package.json is a default file from node.js, that file shouldn't have errors 🤔
Ik that then why won't it work then it has to be in the main.js file.
`embed: {
color: "PURPLE",
author: {
name: client.user.username,
icon_url: client.user.avatarURL()
},
title: "Click aquí para unirte a mi servidor oficial 🤖",
url: "link",
description: "",
}`
something like that?
uh
Ok....
Where do you put the Token?
I can't see anywhere for the Token.
Unless you have it in a different file.
Is it an index.js file or main.js file?
In the error, the main.js file of the module seemed to be faulty, so I send it.
Do you have a place for the Token?
token in the settings.json
ok so the embed thing that you sent me make my title into a link
But im tryna make a word in my footer into my link
so i need help wit that
and this main.js is for the module, normally I use index.js for the bot
@turbid osprey Did you create the code or get it from online?
I also bought a bot developer that I watched on youtube
error I think they will fix it in the next update from the module, I'm sorry that I run you in vain
are you portuguese by any chance?
Wich one is better ? (talking bout the cursor)
no i'm turkish but why are you asking
the way you spoke seemed like a straight up translation(like, without google translate)
should have known Erwin
anyway
just making sure, on try catch blocks, err will never be undefined right
try {
} catch (err) {
if(err) {
// Code here
}
}```
but realistically it shouldn't unless a package or my code has some fucked up error handling right?
ye
alright
time to fix the like 4 times I used that
try {
if (Math.random > 0.5) throw "some error"
console.log("Threw some error!");
} catch (err) {
console.error(err);
}``` would the console.log only run if it does not throw?
Yes
ok

Wdym
wait
hmm
it would be undefined not "Cannot read property random of"
but is undefined > 0.5?
no its not
huh
yes but I did property not method
would Math.random not be undefined
oh wait you're right
it would return a function
why am I so dumb rn
and it would try to compare if function > 5
alright is a function > .5
would return false, but not error
oof
js is very cool indeed
@green kestrel I fix it, but thank you!
what language, library, and issue
instead of asking if someone can help, just ask
@earnest phoenix ^
is there a way i can check someones role and in the base of that a Admin can ban a Mod
i mean ik how to do the first one i just need to jump at the action
it would be checking if the authors top role is below the targets top role @slender wagon
that's the logic but I do not know discord.js
yup i see thanks!
since when does gh have dark mode?
it looks a little off
I dunno, gh darkmode plugin feels a lot more natural
yeah that looks better
hello, I'm mention the bot, making them use commands. but I don't know how to do the message.mentions.members part.
let user = message.mentions.members.array()[1];
it works if I do. - @mention avatar @earnest phoenix
if I do it doesn't work. - /avatar @earnest phoenix
seeing that..it's definitely the blue thats messing it up
Use args
I don't think the dark mode looks bad but its strange
it's a good starting point, but generally they should tone down the colors because ultimately, the point of dark mode is to make it easier on the eyes
the real question is why are you awake at 2 AM
how so
ı am from turkey 🙂
OH lol
okys
:))
does anyone here know how to make websites???
I would think a fair few people here do.
well i'm looking for one
webhooks are basically reverse APIs
instead of you making requests to the API, the API makes requests to you. you need an open port and a webserver in order to achieve this
I didnt get it.
what do you not get about it
I agree with cry
what
I thought you were talking about webhooks
authentication would be using oauth iirc
Yea I am tlking abt webhooks
not sure
it's up to you how you interact with discord, that's irrelevant here
top.gg just sends JSON data about the voter to your webhook
Hmmm
a common way to build this is to use a webserver package for your language and alongside that also log in to discord in the app
that way you'll have an open webserver and a discord bot in one app
for example, node has express, .net has asp.net core etc etc
yea thats how most people do it
dbl.webhook.on('vote', (vote) => {
console.log(`User with ID ${vote.user} just voted!`)
})
Im alking abt this
...okay?
yEah so how does this function work ?
so in dbl you put the address of the open webhook and they post to your webhook when someone votes
which function
dbl.webhook.on()
that's just an EventEmitter method
https://srcb.in/Bk8sfi3Pj0 The code and the error pls help
Just tell dude
cry answered you correctly
my address?
no
basically it calls every time the webhook recieves a vote
anyone know how I can get that green verified tag on all of my git commits
I setup the keys as it says but it didn't work correctly I think
@main elk client.GiveawaysManager is undefined
make sure u defined at index.js or bot.js
GitHub already has documentation on verifying commits
whatever file u have
I mean yes they have docs but there are also docs on literally every js function but people still ask for help here
so I guess im more asking for help setting it up
I wonder why
lol
Yeah but it's kinda hard to explain how to set up gpg keys
good point
dblapi.js
yes
Wy?
but thats still the official module
Wait so where are the source code of it ?
The new dark mode’s tones really nice, however the blueish tones make quite hard to see anything on GitHub. There’s an unnofficial plugin I’ve been using for quite some time, and I know a lot more people out there also used it before dark mode being a thing here, it uses the classic “darcula” theme palette, and makes GitHub look a lot more eye-...
on github
GitHub
well, let's see if this suggestion goes anywhere
Ye
Berry manages that one
The new one doesn't work ?
It should, but I don't think it's on npm yet
they renamed it? lmao
It is
but its still like the exact same thing?
Is clang (the compiler) pronounced like if you were to hit a pan with another pan, or just C-lang
lmao
Yeah
pretty sure its C lang
depends on how you are feeling imo
maybe
Lol
Lmao lol
INTeresting
having a bad day? 🍳🍳
maybe you want to say engine-x but simetimes just "en jinks"
true, i do say n-ginx
I mean
lol
I do
o
lmao
I used to pronounce it as n jinx
Until I read online that you were supposed to pronounce it as engine x
i say neither lmao
if you go for the same sound as "engine", then jinx makes more sense
but i say ginx because i never refered to it as engine
also because i like the sound of the hard G
same with gif
well it is gif
with the g
ok now I see what you mean
https://million.is-a.computer/files/r7ZWdbMxG1qmNR5.png nice I figured it out
if(message.content.startsWith(prefix + "mute" )){
if (message.member.permissions.has("ADMINISTRATOR")) {
const target = message.mentions.users.first();
if (target) {
let mainRole = message.guild.roles.cache.find(role => role.name === '👤| Members');
let muteRole = message.guild.roles.cache.find(role => role.name === 'muted');
let memberTarget = message.guild.members.cache.get(target.id);
if (!args[1]) {
memberTarget.roles.remove(mainRole.id);
memberTarget.roles.add(muteRole.id);
message.channel.send(`<@${memberTarget.user.id}> has been muted`);
return
}
memberTarget.roles.remove(mainRole.id);
memberTarget.roles.add(muteRole.id);
message.channel.send(`<@${memberTarget.user.id}> has been muted for ${message(message(args[1]))}`);
setTimeout(function () {
memberTarget.roles.remove(muteRole.id);
memberTarget.roles.add(mainRole.id);
}, message(args[1]));
} else {
message.channel.send('Cant find that member');
}
}else {
message.channel.send('You do not have the permission');
}
}
error ms in not denfind
only one way to find out
What are you trying to do?
Why are you removing and adding the role to the member every time?
There are a lot of problems
any api for fake tweets?
ty ❤️

does anyone know how to set a bot on phone?
Not sure what you mean. Code? Set up? Unclear.
Supposedly people who do know won’t tell
code. and im using discord.js
also supposedly it requires editing d.js code
How to add sort cmd like disconnected 👉 dc
elaborate
What
explain
Huh?
what do you mean by that
do you have a command handler 🤔
Yah
how do I replace an item in an array?
[10, 20, 300, 40] to [10, 20, 30, 40]
also.. assume that I don't know the key
hm?
name = *
for a or cname? @earnest phoenix
a name
still nothing
Name on a record should be @
let filter = m => m.author.id === message.author.id
const loc = message.author.send('Test')
message.channel.send('LCSN Staff Application has been started, Please confirm in DMs and answer the questons.')
message.author.send('Are you sure you want to start your application?').then(() => {
loc.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
.then(message => {
message = message.first()
if(message.content.toLowerCase() == 'yes' || message.content.toLowerCase() == 'y'){
message.author.send('Yes')
} else if(message.content.toLowerCase() == 'no' || message.content.toLowerCase() == 'n'){
message.author.send('No')
} else {
message.author.send('Invalid Response')
}
})
})
Im having issues with awaitmessages, error in console says
TypeError: Cannot read property 'awaitMessages' of undefined
any ideas?
@uneven monolith loc.dmChannel.awaitMessages
do you know how long that will take
1-10 min
Ill try it out, thank you
wait it returns as Message
loc.channel
With the DMChannel, it still says it is undefined
@earnest phoenix ey
i don't know py
LR
yes indexOf()
o ok
how do i make https://www.riverhost.xyz/ redirect to https://riverhost.xyz/
like make it non-www
my bots suddenly stopped working today, they're coming online but not sending or apparently reading messages anymore
last log message in is the JDA connecting to websocket
then nothing
they were running until I restarted them , now not working. Anyone have any suggestions?
I refreshed it
Oh
It logs in no problem, just doesn't seem to be seeing messages, or posting
no errors thrown
Wait what library are you using?
Oh i only know about discord.js
rip
Are you still using the deprecated JDABuilder?
I'm not sure, when was that deprecated?
so, are you using new JDABuilder() instead of JDABuilder.##?
jda = new JDABuilder(AccountType.BOT).setToken(token).addEventListeners(commandClient).build().awaitReady();
looks like it
Yeah, you're using the deprecated one.
how recently was that deprecated?
I am tryna make an remind command ok so I thought I would take user input turn that into milliseconds and then when Date.now() === Date.now()+userInput time dm them thier msg. Is this a good idea?
It has been deprecated for months.
No problem. 
@unborn crow it worked, thanks a bunch chief
woulda been stuck for hours
seems like I'm not getting player lists though from the servers I'm in, did that change as well?
send help in #topgg-api
so would a cookie command that sends DM's to the recipient be under rule 14 (bot list rules) in #rules-and-info ?
If the user invokes the command and it sends the DM then it's fine.
@client.command(aliases=['b'])
@commands.has_permissions(kick_members=True)
async def ban(ctx,member: discord.Member,*, reason="No reason provided"):
if ctx.author.top_role < member.top_role:
await ctx.send(f"{ctx.author.mention}, you are not high enough in the role hierarchy to do that")
if member is ctx.author:
await ctx.send('you can not ban yourself')
return
else :
await ctx.send(f" {member.name} has been ban from the server! Reason: {reason} https://media.giphy.com/media/fe4dDMD2cAU5RfEaCU/source.mp4")
await member.ban(reason=reason)```
This is my ban command
but my admins can kick each other idk why
You probably want to check with <= instead of <.
So you can check if the role is the same or higher in role hierarchy.
Though you'll probably want to put more checks in place. For example, does the user you want to ban also have permission to ban members? What if the ban fails (try: ... except X as e: ...)?
yep so its like !cookie @user then the bot notifies the mentioned user that they recieved a cookie via dm
Eh I don't know about the user mentioned getting a DM since they didn't ask for it. You could ask a mod.
are we allowed to ping one idk
Passing the @commands.guild_only() decorator would solve that dm invoking command issue
What's the error
@client.command(aliases=['b'])
@commands.has_permissions(kick_members=True)
async def ban(ctx,member: discord.Member,*, reason="No reason provided"):
if ctx.author.top_role <= member.top_role:
await ctx.send(f"{ctx.author.mention}, you are not high enough in the role hierarchy to do that")
if member is ctx.author:
await ctx.send('you can not ban yourself')
return
else :
await ctx.send(f" {member.name} has been ban from the server! Reason: {reason} https://media.giphy.com/media/fe4dDMD2cAU5RfEaCU/source.mp4")
await member.ban(reason=reason)```
Admins are able to ban each other
Dont you have to pass .position as well

Suddenly it went brr
And you get no traceback error?
where does this eror come from
TypeError: Cannot read property 'get' of undefined
i didn't encounter this thing since 5d ago
TypeError: Cannot read property 'get' of undefined
at Object.module.exports.play (/app/handler/play.js:4:30)
at module.exports.play (/app/handler/play.js:18:22)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:23240) UnhandledPromiseRejectionWarning: Error [VOICE_PLAY_INTERFACE_BAD_TYPE]: Unknown stream type
at VoiceConnection.play (/rbd/pnpm-volume/71866528-40ae-4780-a1fa-ab254fbee7da/node_modules/.registry.npmjs.org/discord.js/12.5.0/node_modules/discord.js/src/client/voice/util/PlayInterface.js:84:11)```
<= on a Role compares the position
i mean 5d ago was when i last time updated my code
Post the snippet

which
It comes from file handler/play.js line 4.
Welp
It means you tried to use .get on something that was undefined
It still banned
client.queue is undefined
Either you didn't set the property or client is not what you expect it to be.
It still bans admins
how to properly do messageattachment in the bulkdelete like this?
i got this code
bot.on('messageDeleteBulk', async messages => {
const attachment = new Discord.MessageAttachment(messages)
bot.channels.cache.find(ch => ch.id === '779582435364175872').send(`Here:`, attachment)
});```
is there any alternative ways to sort arrays appart from thsi?
return b.data-a.data;
})```
because it returns a innacurate
what is data?
its a value in my array
so in my array[0] for exampel theres ID and Data
@tranquil drum
data isn't
data is a number
not a string
and it does sort its just not exactly accurate tho
what do you mean exactly?
so like
every time a person messages, 1 is added to their key in quick.db
then for a leaderboard i get all the data with db.all() then sort it in descending order
but a person with 1000 messages doesn't come in the array but a person with 900 messages comes on top.
what about when you grab the data back out?
your data types are at the whim of whatever function is getting the data from the db
just for fun try this
const top20 =a.sort((a,b)=>{
return parseInt(b.data)-parseInt(a.data);
})
I'd use Number()
ah kk
just give me like a min or 2 rq
so i can update the code
nope @tranquil drum some still don't come
unlucky
what else should i do?
log the array before you're sorting just to make sure all the data that you expect to be there is there
ye i did
is it in there before and not after?
how do I replace an item in an array?
[10, 20, 300, 40] to [10, 20, 30, 40]
array.splice
assuming that I don't know the key
use indexOf to find the key
but that only replaces the first instance
assuming i have multiple instances of it
you should probably sort in the db query
You could iterate through the whole array if that's not too big
wdym teemaw?
what if its too big
like sort it while im getting it?
sql and mongo support sorting in the query
you could write a reverse lookup map
im using quick.db
what does quick.db connect to?
sec
ahh sqlite
bettersqlite iirc
you should look in their docs to see if they have a method for sorting
these docs are kinda bad
I suspect there's one that you can give in the options object but there's no way to be sure
damn it actually doesn't
their lib doesn't use SORT BY
you should look into just using https://github.com/JoshuaWise/better-sqlite3
it'll let you do SORT BY
did you have less than 20 rows last month?
i had 17k
yes
maybe the db lib just happened to return the top 20 ones
nah actually i get all 17k rows
cause it's not guaranteed
thenn i do top20.length =20;
ye
i m not sure how tho 😅
v8 devs write tests for that kind of stuff
But the result aren't sorted, are they?
they are
Have you tried sorting them before changing the length?
return parseInt(b.data)-parseInt(a.data);
})```
top20 is the result of the sort
i do do that
i sort them
then change the length
let a =all.filter(e => e.ID.startsWith('messages-'));
const top20 =a.sort((a,b)=>{
return parseInt(b.data)-parseInt(a.data);
})
top20.length =20;```
like log all,top20 and then top20 after length?

s
last month
but that was 30 days
should be lesser now
i logged all vars give me a sec
should i log like .data?
yep
i got undefined
wait
top20 is a array containign many objects
all is too
so i can';t join console top20
right?
takes string

You need to use findIndex for complex things like that
I just wanted to replace an array inside an array with an array

someone help me?
also how do I check is an array is inside an array
assuming that I have no idea what the index is
btw im making "Snake" game using a discord bot
you know that game when you hit your body you die
Just check?
How do I?
You can use array.some()
If one of the elements inside the array is an array, it will return true
How do I replace an array inside an array with an array?
Find the index of the array by using array.findIndex() and use that index to replace it by using array[index] = newArray;
For example:```js
const array = [[1, 2], [3, 4], [5, 6]];
const toReplace = [3, 4];
const index = array.findIndex(x => x.toString() === toReplace.toString()); // 1
array[index] = [99, 99];
array; // [[1, 2], [99, 99], [5, 6]];```
that is more complicated than I thought but its that not that complicated
Why am I not able to use indexOf
hello
.unshift() kinda modifies the existing array and doesn't produce a new array...
How can I add items infront of the array without it modifing the existing array and creates a new array
@quartz kindle
Create an array clone and unshift that clone instead
We won't spoonfeed you
botunu 7/24 yapmak isteyen dm
how to add vc empty and bot dis. auto. ?
client:on('messageCreate', function(message)
discordia.extensions()
local client = message.client
local guild = message.guild
local args = message.content:split(" ")
local command = table.remove(args, 1)
local test = "tak"
if command == "?ban" then
local Member = message.member
if Member:hasPermissions("ADMINISTRATOR") == true then
local nick = table.concat(args, " ")
local nicktwo = "test"
if nick and string.match(nick, "<@!%d+>") then
print("Ban ".. string.sub(nick, 4,-2))
nicktwo = string.sub(nick, 4,-2)
elseif nick and string.match(nick, "<@%d+>") then
print("Ban "..string.sub(nick, 3, -2))
nicktwo = string.sub(nick, 3, -2)
elseif nick and string.match(nick, "%d+") then
print("Ban ".. string.match(nick, "%d+"))
nicktwo = string.match(nick, "%d+")
else test = "nie"
end
local User = client:getUser(nicktwo)
local UserTwo = guild:getMember(nicktwo)
User:send('Otrzymujesz bana na serverze nazwa servera')
guild:banUser(nicktwo)
message.channel:send {
content = " " .. nick .. " został zbanowany.",
}
User:send('dostałeś bana!')
end
if test == "nie" then
message.channel:send {
content = "Niepoprawna nazwa użytkownika!",
}
end
else message.channel:send {
content = "Nie posiadasz uprawnień do banów!",
}
end
end
end)
its correct?
@pale vessel







