#development
1 messages · Page 1888 of 1
oh yeah I get it
async functionality?
ofc
okay nice, thanks for the help
U sent error only, show the code
Anyhow, is there a Open source API for truth or dare questions that we can use ?
open source api?
I use ticket.js open source bc i cant create ticket system im so tired and peoples are waiting for v2
Like public access.. without paying
No cap, my eyes are in pain now... Coding on phone lol
yeah open source is the wrong word but anyways
there's plenty from my days of making wyr commands
yeah, my bad
Soory i am working hard and my pc broke and peoples are waiting for v2
can you guys help?
You need to wait for KuHaku or some good dev to come online.. lol
actually a lot of them suddenly shut down
what I'd do is generate a huge list of them from some website and throw them into a text file and randomly pick each one
I thought about that😂 actually
or reverse engineer one of their websites
Bruh
you gain nothing herelol..
Who know good discord bot dev? that i can write him in dm?
I don't think that's good either... Best is to wait for em!..
there are many if you haven't noticed
but the mods here say to use a freelance website like fiverr usually
What i can pay its 1$ who fix ticket system or give me working system
Hi there, i need some help: I've just found a new error that makes my bot crash, when i play music with it if i move him to another channel he then crashes once i stop it, i was then wondering how to fix this issue, thanks
Hello, i dont wanna be rude but mayne somoene have ticket system with (reaction, embed) i can pay 1$ soory for small budget :) Dont say i am bad dev i am just tired.
Wants a "good bot dev" for $1 :^)
Dblneeddev
I just need ticket system
@molten flint
You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.
It means for me i can eat 4 raw meatballs 😋
then what will be?
true and false
If you necessary need a number then use Number(database_value)
Why not just use existing bot that manage tickets
why is this happening, worked before
const embed = new MessageEmbed()
.setTitle("bruh")
msg.channel.send(embed)
Error: DiscordAPIError: Cannot send an empty message
Use a description or fields, just a title isn't enough anymore
pft
Try something like send({embeds:[embed]})
Could someone help me with this?
show the error message
Show the code you used.
Actually its
i'll create a new one, give me a second
But he using v13 but code is v12
Well if so he might specify that.
song_queue doesnt exist
@earnest phoenix read that
Why would I be getting the following error for this code? Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred. The reply was never deferred and I am not updating the interaction reply at any point, it reaches the point where it sends to database so it seems to be coming from the <Message>.send which makes no sense?
const song_queue = queue.get(message.guild.id); it was in the code already sent
yea you are sending an empty message ;d
Ha! Weird, tought titles only aren't enough... but okay
Its your solve 
see that
check that voice_channel_leave();
Did you use template strings again? `${Number(db_value)}`
yeah cuz if someone stops the bot he then leaves, but if the bot got brought to another channel he then crashes
Then its not developing you just recreating other bot
how do you think developing something that is already been developed is like? i understand if you want to make something new but ticket bots, there's tons
.catch should handle that
My bot its moderating not ticket i just need ticket commands bc my pc broke i cant dev on phone XD and peoples are waiting for v2
To your suggestion, where should i put it? just normally at the end?
when you connect
then i rlly dont see the problem on using a known template
Alright.
I dont like take code when its done 100% i like create not steal
you should look at voice_channel.leave() not stop_song
you think the person ur gonna pay the big amount of 1$ is gonna spend time on making a new ticket system or just take it from yt?
there is voice_channel.leave(), i made a const for stop_song that goes on when the command to stop is done
This make it that when the song_queue is clear the bot automatically leaves
😬
perhaps
i now wonder why i put it
it cant leave twice
if it gets moved from a vc, then you dont have to disconnect it
no but like, after he gets moved, if i force the quit he gives error
and doesnt leave the current channel
maybe show the stop_queue code
ur showing me the constant
i have no stop_queue
so, error happens when bot gets moved by command?
mb ur asking for something else?
nop, manually moved, then if you try to stop the song/the song ends/nothing else in queue the bot has the error
because it thinks its connected to the old channel
excacly
so how do i make him understand that he is in a new one? that's what i ment, mb i asked wrongly i apology
that was when i removed song_queue as a test
ill now try to define voice.channel with const voice_channel = message.member.voice.channel; at 83
mh, i didnt notice that it wasnt
now im just confused, i have no idea what i have to put and where
how i can get a slash command id?
Noobie Question. but where can i see on which Discord Servers my Bot is running?
And.. what the f. am i doing wrong with my bot?
Still getting these errors
https://i.imgur.com/tMPqtGb.png
I tried catching it.. but i think i did something wrong
.play(ytdl(song.url))
.on("finish", () => {
serverQueue.songs.shift();
play(guild, serverQueue.songs[0]);
})
//.on("error", error => console.error(error));
.on("error", (error) => {
console.log(`An error occured!: ${error}`);
const stupidQueue = serverQueue?.connection?.dispatcher;
if (stupidQueue) {
stupidQueue.end();
} else {
console.log(`Serverqueue.connection.dispatcher is null urgh`)
}
//message.channel.send("There was an Error playing this Song, Skipping to the next one...");
})
Djs version?
You'd be surprised how many people are on v12
damn
why are they still on v12
Don't want to learn the new features I guess
i did check that but i didnt understand and i hate reading
damn
I dont think I can simplify it more than the guide tbh
could u just show me examples
that'd be
enough
for me
The guide has copy paste examples
im so lazy to read that whole thing written in it
(Pulled from that page)
You Sir, recently said you’re using Java for some reason
Anything else doesn’t matter anymore after that statement 
me i guess
guys
whats the even for
when the bot gets added to a new guild
in d.js
is it onGuildAdd
or
onGuildCreate
thanks man
Is there a way to set a "per guild Activity"
More details please
Well.. you can set the Activity of the Bot with client.user.setActivity(); My Question is.. can you set the Activity on a per guild basis?
Oh you mean presence

Yeah not possible, presence is global
Same as the Avatar?
Yes
Hmpf
And is there a way to see on how many servers the bot is active?
define active
All active guilds will be send via the ready event
That was a joke 😄
So on ready i could technically echo them out with name and stuff?
😮
or : O
😮
Aye
You can loop through the collection printing the guild names for example, find one, use the filter etc.
At any time of course…
Uuuh Nice
hello
Sorry to go again after this but..
Did i do something wrong with that stuff?
.on("error", (error) => {
console.log(`GUILD: ${guild.name}(${guild.id}) - An error occured!: ${error}`);
const stupidQueue = serverQueue?.connection?.dispatcher;
if (stupidQueue) {
stupidQueue.end();
} else {
console.log(`GUILD: ${guild.name}(${guild.id}) - Serverqueue.connection.dispatcher is null urgh`)
}
//message.channel.send("There was an Error playing this Song, Skipping to the next one...");
})
log the dispatcher
There was a specific reason I was using Java, I can explain!
im so close to being able to release my bot 😢
java bad
but everyone deserves it
stink
extreme is not love
Extreme is love
Loving Java means loving this douche
That’s like dirt under your fingernails
dirty dirt
Why does he look like a member of the French Aristocracy in the 16th century
He looks like he eats children, innocent children
he looks like elon musk's lost brother that turned out to be a mega corp villain
Java has committed the grave sin of too much memory overhead
Take a look at LavaLink
that thing fucking monches ram

It is supposed to be lightweight and it does really good at making the best of its situation, but it still suffers greatly from overhead
The CPU footprint is actually very minimal
That's the lightest way I can put it because I respect LavaLink and the fact that it makes voice systems modular and distributed instead of the traditional fashion of the audio processing being in the shard/cluster process
I wouldn't have made this if I was complacent with its memory footprint on my VPS' though; https://github.com/AmandaDiscord/Volcano
That’s sounds like the ugly kid will never have friends but makes the best out of it living alone in its basement

I wouldn't recommend rn though because there's a memory leak in prism-media
I could hack fix it, but blegh
Is running v8 with worker threads instead of the JVM really worth it? Why not something like rust
isn't that the exact problem lavalink is trying to solve
It is worth it. v8 doesn't end up using too much as overhead. Workers are also really efficient. The memory usage difference between LavaLink and my rewrite is substantial
and Idk too much rust
js is just my go to lang
hi
Can someone guide me a little bit about sharding in discord.js but using the same port because I keep getting error that port is already in use
but I need the same port for top.gg
for dblwebhook?
@lament rock can you add more statistics? Like for 10 players the resource consumption?
Create the express server on your shard.js/manager file.
Ah, this is a bug you get once in a while... Mail the developers on replit ... They'll fix it
ohk
Did u get ide crashed or something too
nope
Then maybe check the code! If possible
ok
https://srcb.in/2tjI7yPkoE
err : its not sending the attachment
can oyu explin more
yes
do I require to make a help command for my slash command bot?
It depends how many commands you have
If you only have a handful then there's not much point
If you have a lot it's probably better from a UX point of view
every bot needs a help command because... how would users know how to use your bot
That's not really true when it comes to slash commands
yea true imma do it
If your bot has a handful of commands and the user types slash then they'll see them all with the descriptions in the channel
this isn't possible
/command (doesn't work)
/command subcommand
but is this possible
/command subcommand
/command subcommand (actually a group) subsubcommand
https://dpp.brainbox.cc/stream-mp3-discord-bot.html
made this today 😄 people want music functionality, so im making examples
every bot needs a help command because... how would users know how to use your bot
Nope, a help command doesn't make any sense if you use slash commands.
Each component you set has it's own possible description.
This information will be shown to the user at the moment he's entering the arguments.
What the heck is D++
Ah I see...
i disagree
a help command can cover context help that goes beyond 'these are the commands and their arguments'
like what happens if i use /command whatever?
will the slashcommand syntax help tell me that? you only have a sentence to convey what it does!
having a help command or at very least a /help command that gives a button link to a website with help on is still very important to have
what about things your bot does that arent commands
like antispam etc
im definitely keeping my help command... it has stuff in that tells people theres a premium subscription to be had, and that they can vote for the bot, and what these things get you etc, and that you can log into the dashboard to do stuff, where the dashboard is, etc
I would agree in fact for more complex commands with multiple arguments.
But most of the component types (which are available right now) won't allow wrong user inputs or will show a list of for example, channels, users, timestamps, predefined values etc.
for something like /meme cat or /kick user sure
but for a config system... you need to explain in more reason the rationale behind the configuration not just that it can be set and what the values are
But most, let's say common commands, and 200 chars of description of each parameter (component) you can predefine should be enough, I guess
That's true, I had to manage to explain the component, like setting a network by passing an argument and setting it back to default without passing the argument, too
200 chars is absolutelly not enough in this case(s)
yeah
plus.... your 200 char field can only be in one language
my /help is localised to 16 languages
But they somehow try to trim it to "fit" into mobile clients as well
lol trim it.... you mean what you wanted to convey is lost 😄
Descriptions now can already have 2 lines or more on mobile clients and require the user to scroll through it 
sometimes i hate slash commands
A tooltip while entering any argument would probably be a better choice.
But I'm not sure... a tooltip with 1000 chars would be shit, too
That just proves once again slash commands are far away from being a development milestone for Discord or generally said, still need a lot of work
very liteweight Discord lib for c++
Discord.c++
discord.cpp
hey does anyone knows how to make a cron like thing
what im trying to do is after someone runs a cmnd i store smthng in db and exactly after 1 week ( basically smthng like reminder but time is specified )
im using djs btw
Nodejs probably has are more efficient way but save the target timestamp in your database, load it into your bots cache, have an asynchronous timer check if any timestamp in your cache matches the current tick and if so run it, whatever it should run, for example an in the database saved action
ye but i was thinking for a better way
bot could lag/crash if the process is heavy
Not sure if there’s a better, you need something checking each process tick if the current timestamp matches your target timestamp
Well then use a child process or any other type of software and send an event to your app if the current time matches your timestamp
can someone explain why sending invalid interaction responses gets the user's discord client stuck on sending command
Yeah had that a few times, too
Seems to be a bug
And will be gone after a few minutes/hours 
Hmm well I’m only using the browser version
same
anyways can you help me with message components?
the button works fine then i edit the message but after that im not receiving the interaction when the message is edited and the user presses the button
https://sourceb.in/N2w1FBbDgW
i pressed the second button and error
nothing in the console too
Later that day, gonna take a quick nap
who needs sleep when you are a programmer
Programming isn’t my job 
hey, how can i randomly choose an item based on droprate in js?
let sort = ["Quick Hands", "Ninja Cloak", "Armor", "Shiny Armor", "Reflection"]
var finalietm = sort[Math.floor(Math.random()*sort.length)];
var nfifl = Math.floor(Math.random() * 101);```. I for example want to set the quick hands to a 15% droprate, and the rest 1 %
and if none of them drop?
it would just say you win nothing lmao
I was thinking about using if statement s for each one of them
But pretty sure there’s an easier way?
you can make a tier list
something like:
let n = Math.random();
if(n < 0.81) { // 100 minus 15% minus 4 x 1%
// won nothing
} else if(n < 0.96) { // 15%
// won 15%
} else {
let index = Math.floor((n - 0.96) * 100); // crop the number to index range
let item = arrayOf1Percents[index];
}
although this is highly specific for your particular list, if your list changes, this code will have to change as well
aha i see!
I might have to work with cases tho, as all the other listed items also have different drop rates
so i think that cases would work better
what do you think?
switch cases dont work with bigger/smaller than cases
oowhh fuck
unless you use switch(true)
never knew that
you can use it, but there is no difference against if else
alrighty, awesome tim. Thanks for clarifying this!
i can help u
but idk detrius
erwin: sucks to be you
Erwin gave up on this server
go to his server
inactive
djs not cool
^
djs cooler
give me tags?
Discord.stinks = true;
✅
wardrobe_malfunction
nfc tags have insanely low storage
do floppy disks work?
wait what kinda tags?
NFC
Discord.complainer.stinks = true
oh not booru tags
cannot read property complainer of stinky
template tags: (yes this is a valid javascript function)```js
myfunctionsome text ${hello} lol
Discord.complainer = {
stinks: true
}
see djs users can't read errors properly 
Discord is undefined

I've never seen a purpose for using it
other than String.raw
what about this
tags ```java
int i = 0;
loop:
print("amog");
i++;
if (i < 100) goto loop;
print("sus");
I used invisible Unicode characters to define Discord 
unicodfish
ye right

python error: invalid indentation
:^)
Aren't those called labels
just to make sure, there is no way to hyperlink the footer of an embed right?
Nope
any work around?
Don't use footer
cause it wouldve looked pretty cool lol
zero width space
ohh
embed.addField("\u200b", "[DO NOT CLICK THIS LINK](https://google.com/search?q=scientific+name+for+pig");
sus
hey!
hi
let gp = await message.channel.send(`Opening........`, {files: ["./images/bronzechest.png"] })
setTimeout(() => {
console.log(gp.attachments)
gp.edit(gp.content + {files: ["./images/evilchest.png"] })
}, 2000);```how would i add an attachment to an already sent message?
you cant
unless you edit the message with an image link
that's sad!
you can
You can add or delete attachments on an already existing message
how if i may ask?
Try adding the previous image inside the edit
you can edit embeds, but files are final
also what content + { files: [] }
You've been missing out
i believe discord added the ability to edit in new attachments
some time ago
i never tested it tho
if (!Embedchannel || Embedchannel.type !== 'GUILD_TEXT' || 'GUILD_NEWS'){
message.channel.send(`\\❌.`)
}
How can i allow both ?
allow what?
GUILD_TEXT and GUILD_NEWS
something === 'THIS' || 'THAT' is NEVER valid
Embedchannel.type !== "GUILD_TEXT" && Embedchanel.type !== "GUILD_NEWS"
oh okay
this will make your command only work outside of guild text and guild news
|| doesn't work as a "match one of these", it's strictly an OR operator
i tried to get the previously set attachment
and add a new one to it.
well, all you did was making some text here[object Object]
/GUILD_TEXT|GUILD_VOICE/.test(channel.type) ¯_(ツ)_/¯
yup, i kinda saw that already!
you fckin killed the shrug dude
Is there any way to do it right then
edit({ content, files })
im pretty sure you dont need to put in the content again
unless you changed the content
wouldn't that remove the previously set atttachment
It's new content
aha okay!
That's why I told you to add the old one also inside the array
gp.edit({files: [...gp.attachments.values(), "new/image/here.png"]})
Wasnt the ability to edit artachments added?
it strangely doesn't change the attachment
but the edit icon does show up on the message
let gp = await message.channel.send(`**Opening........**`, {files: [ffinaimage] })
setTimeout(() => {
let ffinaimage1 = zeeze[Math.floor(Math.random()*zeeze.length)];
console.log(ffinaimage1)
gp.edit({files: [...gp.attachments.values(), [ffinaimage1]]})
}, 2000);```
without the array around ffinaimage1
still the same!
gp.edit({files: [...gp.attachments.values(), ffinaimage1]})```
./images/evilchest.png
./images/vikingchest.png
the images logged.
what about files: [ ffinaimage, ffinaimage1 ]
if that doesn't work try npm uninstall discord.js
alrighty let me test
nope sadly didn't work either
noice
what if you replace the old one with the new one
the old attachment?
i've tried that before too tbh, but let me do it again
Did they seriously not implement it?
It's probably getMessage().getReactions() or something
let me try with my lib
O they deleted their message
i saw the same options and thought i've solved the problem xd
alrighty, sure!
so apparently you cannot remove attachments
but i was able to add a new attachment
let me ask in dapi
tim asking others for help? impossible
But delete old msg and can send new one with removed
yes we know that
figured it out
theres a separate attachments field on the PATCH endpoint
thats where you remove files from a message
so basically it works yes
if it doesnt work for you, it could be a djs issue
how can I introduce variables into json strings?
like "iWantBananas": "I want {variableN} bananas"
I think it's called a placeholder
I see you're becoming Erwin 2.0
const newString= keyString.replace(/\{variableN\}/g, variableN);
just that? seems simpler than cutting the strings in half xD
yes
but you do have to put more .replace for more variables
tho you could use a recursive function/loop for this
what about YAML, maybe I should use it for translations
well, having translations in JSON also sucks
xml 
ah
the language that doesn't have a standard for parsing
😭
because it has the exact same syntax as javascript objects
hmm
you're using javascript right?
yes, TS
"error": {
"cmd": "There was an error when trying to execute that command!",
[...]
}
for something like this is easy
"levelUp": {
"congrats": "Congratulations",
"levelTo": "you leveled up to level",
"received": "and received ¤"
},
but for this you can already see the problem
I cut the strings in halfs/thirds so I can put the variable in the middle
ig you can do smth like this
const placeholders = {
a: "never",
b: "gonna",
c: "give",
d: "you",
e: "up" // discord.js moment
};
function replace(string, placeholders) {
let mutated = string;
Object.keys(placeholders).forEach(k => mutated = { mutated.replace(new RegExp(`\\{${k}\\}`), "g"), placeholders[k]) });
return mutated;
}
const replaced = replace("{a} {b} {c} {d} up", placeholders);
console.log(replaced);
@old cliff when you ask a guy with a ahlook___at___myFancyNaME to give you nitro
haha

I do
seems like a good way, ty @earnest phoenix
@outer perch just a heads up, that code doesn't even work
guys can someone tell me why my gif in an embed is not loading
like the code works
cause i console logged the link of the gif
and it does open up in the browser
yeah I noticed
can .setImage() have a url as input?
intense syntax errors
me?
yes
well why does the gif not load up then :(
check the url itself
const placeholders = {
a: "never",
b: "gonna",
c: "give",
d: "you",
e: "up" // discord.js moment
};
function replace(string, placeholders) {
let mutated = string;
Object.keys(placeholders).forEach(k => { mutated = mutated.replace(new RegExp("\\{" + k + "\\}", "g"), placeholders[k]) });
return mutated;
}
const replaced = replace("{a} {b} {c} {d} up", placeholders);
console.log(replaced);
fixed
if (!message.guild.me
^
TypeError: Cannot read properties of null (reading 'me')
at Client.<anonymous> (/home/container/events/guild/NQN.js:4:23)
what is wrong with me?
@urban slate .setImage('https://i.imgur.com/someID.gif') this is working for me
hmm
idk whats wrong with you
haha
but in your code, message has no guild
dont be rude XD
i mean the code the js cant read me???
so how i can fix it?
let { Default_Prefix } = require("../../config.js");
module.exports = async client => {
client.on("message", async message => {
if (!message.guild.me
.hasPermission("MANAGE_WEBHOOKS")) return;
if (message.author.bot || !message.guild || message.webhookID) return;
let enambed = await client.data.get(nqn_${message.guild.id});
if (!enambed) return;
let Prefix = await client.data.get(Prefix_${message.guild.id});
if (!Prefix) Prefix = Default_Prefix;
if (message.content.startsWith(Prefix + "react")) return;
let msg = message.content;
let emojis = msg.match(/(?<=:)([^:\s]+)(?=:)/g);
if (!emojis) return;
emojis.forEach(m => {
let emoji = message.guild.emojis.cache.find(x => x.name === m);
if (!emoji) return;
let temp = emoji.toString();
if (new RegExp(temp, "g").test(msg))
msg = msg.replace(new RegExp(temp, "g"), emoji.toString());
else msg = msg.replace(new RegExp(":" + m + ":", "g"), emoji.toString());
});
if (msg === message.content) return;
let webhook = await message.channel.fetchWebhooks();
let number = client.randomNumber(1, 2);
webhook = webhook.find(x => x.name === "NQN" + number);
if (!webhook) {
webhook = await message.channel.createWebhook(`NQN` + number, {
avatar: client.user.displayAvatarURL({ dynamic: true })
});
}
await webhook.edit({
name: message.member.nickname
? message.member.nickname
: message.author.username,
avatar: message.author.displayAvatarURL({ dynamic: true })
});
message.delete().catch(err => {});
webhook.send(msg).catch(err => {});
await webhook.edit({
name: `NQN` + number,
avatar: client.user.displayAvatarURL({ dynamic: true })
});
});
};
code blocks please
kk
module.exports = async client => {
client.on("message", async message => {
if (!message.guild.me
.hasPermission("MANAGE_WEBHOOKS")) return;
if (message.author.bot || !message.guild || message.webhookID) return;
let enambed = await client.data.get(`nqn_${message.guild.id}`);
if (!enambed) return;
let Prefix = await client.data.get(`Prefix_${message.guild.id}`);
if (!Prefix) Prefix = Default_Prefix;
if (message.content.startsWith(Prefix + "react")) return;
let msg = message.content;
let emojis = msg.match(/(?<=:)([^:\s]+)(?=:)/g);
if (!emojis) return;
emojis.forEach(m => {
let emoji = message.guild.emojis.cache.find(x => x.name === m);
if (!emoji) return;
let temp = emoji.toString();
if (new RegExp(temp, "g").test(msg))
msg = msg.replace(new RegExp(temp, "g"), emoji.toString());
else msg = msg.replace(new RegExp(":" + m + ":", "g"), emoji.toString());
});
if (msg === message.content) return;
let webhook = await message.channel.fetchWebhooks();
let number = client.randomNumber(1, 2);
webhook = webhook.find(x => x.name === "NQN" + number);
if (!webhook) {
webhook = await message.channel.createWebhook(`NQN` + number, {
avatar: client.user.displayAvatarURL({ dynamic: true })
});
}
await webhook.edit({
name: message.member.nickname
? message.member.nickname
: message.author.username,
avatar: message.author.displayAvatarURL({ dynamic: true })
});
message.delete().catch(err => {});
webhook.send(msg).catch(err => {});
await webhook.edit({
name: `NQN` + number,
avatar: client.user.displayAvatarURL({ dynamic: true })
});
});
};
message.guild.me is before !message.guild
are we posting bad code again? here's my take
just invert the order of these
if (!message.guild.me.hasPermission("MANAGE_WEBHOOKS")) return;
if (message.author.bot || !message.guild || message.webhookID) return;
ok i try now the command
Array.prototype.reverse.call(code);
they are two different things tho
i mean push + reverse
show what you did
still don't get why you'll do that
module.exports = async client => {
client.on("message", async message => {
if (!message.guild.me.hasPermission("MANAGE_WEBHOOKS")) return;
if (message.author.bot || !message.guild || message.webhookID) return;
let enambed = await client.data.get(`nqn_${message.guild.id}`);
if (!enambed) return;```
[1,2,3,4].unshift() // [2,3,4]
[1,2,3,4].push(5).reverse() // [5,4,3,2,1]
thats not what i mean lel
a = [];
b = [];
for(let i = 0; i < 10; i++) {
a.unshift(i)
}
for(let i = 0; i < 10; i++) {
b.push(i)
}
b.reverse()
when there is a var/let/const there is a python
told ya
noice
what about concat and spread
my disappointment is immeasurable and my day is ruined
repl disagrees
yes
@split hazel FUCK YOU
WHY DID YOU HAVE TO LOG ME OUT OF 2FA DISCORD WHEN MY PHONE'S AT THE MOBILE REPAIRING STORE
don't worry I'll try help you reach a diagnosis
LOL
based on the current facts your problem appears to be a skill issue which must be resolved by yourself
damn, if only i could read that joke
can someone help me?
i asked in the detritus server but that place is dead
never gonna let my 2fa down
where do you store your backup codes?
C:\\Downloads
what if your pc dies
I store mine on gmail
a would be attacker will never know
because I don't label them so if I lose one I'd have to go through tons of emails
too used to it
do someone know py and can help me?
@quartz kindle Just is for Linux only, and I develop on Windows 😦
I’m trying to do timed bans by inserting the date/time into the database, then use setTimeout to unban the user after a certain time. But how would I convert the date into a number, then check if the time has passed? (The purpose of this is if the bot goes down, when the bot starts up I get the date from the database, then check if it’s passed a certain point and if it hasn’t setTimeout)
With express, how can i stay in the same page when changing the url but running a javascript function in the html?
I'm waiting on the memory leak with one of the libs to be fixed and then I will definitely do that
nope
ok nice 😁
how did i screw up package.json
don't manually edit the package.json if you don't understand syntax
i understand how it works
but obviously something screwed up while working with a vps

okay
So, just fix the syntax of your package.json then
no need to ask us why there's a syntax issue if you understand it
oh now i see what i did
the problem is i didn't see anything wrong since the current package.json i have worked forever
I still wouldn't manually edit it regardless. npm or yarn or pnpm offers everything you need
I manually edit it all the time since npm screws up a lot
the package lock is the one you shouldn't be really modifying
then you don't go to the bleeding edge like i do
package.json is made to be edited change my mind
0|index | - /root/novabotv13/node_modules/@discordjs/voice/dist/audio/AudioResource.js
0|index | - /root/novabotv13/node_modules/@discordjs/voice/dist/audio/index.js
0|index | - /root/novabotv13/node_modules/@discordjs/voice/dist/index.js
0|index | - /root/novabotv13/node_modules/@koenie06/discord.js-music/src/index.js
0|index | - /root/novabotv13/index.js
0|index | at Object.loader [as require] (/root/novabotv13/node_modules/@discordjs/voice/node_modules/prism-media/src/util/loader.js:12:9)
0|index | at loadOpus (/root/novabotv13/node_modules/@discordjs/voice/node_modules/prism-media/src/opus/Opus.js:17:17)
0|index | at new OpusStream (/root/novabotv13/node_modules/@discordjs/voice/node_modules/prism-media/src/opus/Opus.js:46:10)
0|index | at new Encoder (/root/novabotv13/node_modules/@discordjs/voice/node_modules/prism-media/src/opus/Opus.js:149:5)
0|index | at Object.transformer (/root/novabotv13/node_modules/@discordjs/voice/dist/audio/TransformerGraph.js:120:24)
0|index | at /root/novabotv13/node_modules/@discordjs/voice/dist/audio/AudioResource.js:156:60
0|index | at Array.map (<anonymous>)
0|index | at createAudioResource (/root/novabotv13/node_modules/@discordjs/voice/dist/audio/AudioResource.js:156:41)
0|index | at playSong (/root/novabotv13/node_modules/@koenie06/discord.js-music/src/index.js:325:26)
0|index | at Object.exports.play (/root/novabotv13/node_modules/@koenie06/discord.js-music/src/index.js:95:9)```
How can I fix this error?
you couldn't've posted a worse error message
lmao
that reminds me
typing (_ => {})() into the example playground on chakra ui docs crashes the site
who is chakra ui
fine then whatever you say
the lib is a nice replacement for css
even though I'm on 15% battery and my whole house has no electricity atm
and nice it works
I'll also keep an eye on that lib
it looks nice
it is incredible
no more centering css pain
also 100 accessibility score in devtools
kinky
adobe dreamweaver
lavalink still works with discord.js v13
glitch
ah
I feel like most web editors require reloading the file, as that's how web editing works
I’m trying to do timed bans by inserting the date/time into the database, then use setTimeout to unban the user after a certain time. But how would I convert the date into a number, then check if the time has passed? (The purpose of this is if the bot goes down, when the bot starts up I get the date from the database, then check if it’s passed a certain point and if it hasn’t setTimeout)
how do i make something like, when a thing is completed, the bot will send a message
like when you get 100 trophies it'll give you 100 coins so when giving it'll say "You've got 100 trophies so i'm giving 100 coins to you"
it's in message event, no?
it's not a part of discord.js so nope
but you can emit the event yourself
// when 100 trophies
client.emit("100trophies", member);
// somewhere else in code
client.on("100trophies", member => do stuff);
Why not check if a user has 100 trophies right after you give them thropies and send the message then?
Less overhead
i only use it for editing my site quickly
too wallet intensive like ALL adobe apps
🏴☠️
adobe price is worse than my 20 line hardcoded tictactoe winner detector
Just make a tic-tac-toe ai
tic-tac-toe ai:
play(openspaces[Math.floor(Math.random() * openspaces.length)])
just in case you need it https://sourceb.in/IJxIitkaQi
well, it is
npm -i is optional
can you set your bots custom status to invincible? so it'll still be offline when you turned it on
I presume it would be something like client.user.setStatus('offline');, right?
Imagine
It's offline
really?

bot.hp new endpoint
it’s just discord smh
didn't ask
who????
yo anyone familiar with tenor api?
how do i request the media url if u are familiar with it?
if you do console.log("word"); how to make the "word" appear centered?
there's no "center" in a terminal
you basically need to know how large (in characters) the terminal window is, then offset the text by width / 2 - length / 2
right padding is unnecessary tho
you MIGHT be able to get window width with native shit
but it'll be...well...native shit
so it will look nice
but its terminal
you can change the text color console.log('%c Oh my heavens! ', 'color:red');
but it doesn't support text-align:center or any of those formatting stuff
just calculate the center
I can add spaces and preted it is the center
but I want it done automatically
but thats the ppoint right?
so code don't look messy
get the width of the box?
Uuh.. What can i effectively do against these kinds of Errors?
https://i.imgur.com/3CvJkSl.png
Enabling this?
https://i.imgur.com/mFdlTrP.png
.catch()
also u shouldn't use oAuth2 code grant
Permission error. Someone invited the bot and didnt provide the Perms.
then do it
*A few Servers.
make a permission handler
...did u just ignore me?
just get the width of the screen, cut it in half also minus the text, I'm using node.js it should work, but don't know how to start making something like that as a function
cause even i had thsi problem
*window
uuuh... can you recommend a good tutorial for that? xD
yea sso how do I go about doing it?
if u get the SCREEN width you'll always consider a maximized window
ummm tbh i did it by myself but lemme dm u somethin which might be a bit helpful
also, there's a LITTLE issue with centering text
Would be great.. im still in the beginner phase of JS and Discord.JS in general
ohh okk
there's a thing called "headless"
if u try centering text in a headless system you'll always get 0 width
bcuz they don't have interface at all
ye
how would I make it a function?
why tf is everyone ignoring my answers
They ignored mine too
😐 ok I'll make it myself then
Java user...
it'll add remaining scopes
People don't trust you.

done
I think
const centerAlignText = function(_text, width) {
width = (process.stdout.getWindowSize()[0] - _text.length) / 2;
return " ".repeat(width) + _text + " ".repeat(width);
}
feel free to use
if you want
everyone thug until you get fatal errors due to negative padding
I’m trying to do timed bans by inserting the date/time into the database, then use setTimeout to unban the user after a certain time. But how would I convert the date into a number, then check if the time has passed? (The purpose of this is if the bot goes down, when the bot starts up I get the date from the database, then check if it’s passed a certain point and if it hasn’t setTimeout)
Why does this work locally but not on a linux server? https://i.callumdev.xyz/mkxga.png
it just doesnt play any audio when on the server
no errors or anything, very annoying
don't u need some additional packages to reproduce mp3?
I mean, linux usually stays bare minimal
Don't think so
that's all I can think abt
if you can find any link with more info, would be handy 👀
run the code at DEBUG level
are you try/catching anywhere in the code without logging?
see if there's any error
throw early and catch late
Found the issue, somehow ffmpeg installed incorrectly 😄
i am using an interaction url endpoint for my slash commands. is the best way to see if the bot has permission to just make the call and see if it fails? i dont see any info about the bot's permission in the body of the request.
there's usually info regarding which scopes you're authorized to
this is all i see in the body
what is in options?
it's the parameters to the slash command
oh, no, I don't mean that
Are you using djs?
i have setup an interaction url and registered it with discord. no library or gateway
Ah okay.
Ah nvm I remember you tried to get rid of your VPS and any gateway connection, hmm?
im moving away from the gateway, but maybe
yeah
can't u just request that info directly?
like, isn't there any endpoint for that?
yeah, but is it worth making that call if i can just try calling the endpoint directly and see if it fails?
is the best way to see if the bot has permission to just make the call and see if it fails?
Which permissions you're speaking about?
The permission to send a webhook?
manage roles and manage channels
Okay.. sanity check pls..
If a Bot doesnt have perms to you know.. Join, Speak or do something.. it shouldnt be able to read chat, processing messages and "Speak" in VC.. right?
it will still be able to read all messages
until april 2022
Hmm can't you send an API request the check your permissions in the guild?
Because.. i tested my bot on a Guild without any perms. it has requested.. and it worked without a problem
Discord is like, do something, send something and if you're missing the permissions it's okay for us, but handle your errors.
But it didnt throw any error on my test bot.
yeah, but i think the best way would still be to just call the endpoint and see if it fails. adding that extra call to check perms adds an extra call
The Prod Bot was flooded with errors like that
Yeah that's what I mean, it's okay to send an unsuccessful request but you need to handle the errors yourself.
i was hoping they would send me the permission bitwise thingy of the bot so then i could prevent the calls from going out in the first place, but it looks like it's not there. at least for now
Guess that's intentional to prevent developers from knowing a bot may have more permissions than needed.
Which doesn't makes sense since he could send any request to do shit and supress the errors.
So yeah... actually would be a good idea if Discord would send that information.
The less you expect from Discord the better.
true
uuuh btw.. how can i you know.. convert a guildID to a Name?
anyone? RangeError: Invalid count value
query the name, maybe
idk JDA cache always did that for me
Fetching the guild object, then all properties like the name etc. are available
const centerAlignText = function(_text, width) {
width = (process.stdout.getWindowSize()[0] - _text.length) / 2;
return " ".repeat(width) + _text + " ".repeat(width);
}
``` what's wrong with this?
UUh.. Am i stoopid or..
https://i.imgur.com/x1eoTDt.png
client.guilds.fetch(guild_id)
console.log(text+
text+
text)
Okay.. i am Stupid xD
console.log(var1, var2, cock3);
if anyone knows wat wrong with this let me know
no need to pass in width to the function. define it inside
alright let me try then
and define it inside
Oh... you're trying to list all guilds. Nvm should have took a closer look.
woops, pingo
I did that, but I'm still getting the RangeError: Invalid count value error @proven lantern
Ngl.. i like to get pinged.. as long as its important
important pingu
...
lol
Noice
You did map the collection to an array and tried to log it
oh I think I know why
Easier way to loop through the collection and log it in your console
how can I make it support the```
helo helo helo
strings?
Each guild per line might be better tho?!
why cant i send emojis, DiscordAPIError: Cannot send an empty message
that is not an array
its an array actually
@earnest phoenix
it is
it isn
its .split('')
djs v13?
({content:emojis[3]})
do you know how to make the function support big strings?
because if string is too long the thing goes -
ye
Could you provide an example, please?
wut
Ben already wrote the correct syntax.
Ok.
Didn't get what you mean...
401 guy talking
make it so width subtracts _text.length
and min width is 0
it already does that
nice
const centerAlignText = function(_text) {
const width = (process.stdout.getWindowSize()[0] - _text.length) / 2; //get width and - text length then half by 2 to paste it twice over the text
return ${" ".repeat(width) + _text + " ".repeat(width)};
}
but it doesn't support a string that look like this
`
hel
e
e
`
for example
yeah, that wont work
maybe your terminal has a setting that will let you format it
am i doing it wrong or what
no I tried looking online for it, I found only 1 npm package that does that too, but you have to type in the value of spaces manually, so that won't work for me :/
Okay.. why am i not able to display a simple array in node.. pls.. someone?
display as in log it?
id make it an array
Or better.. how the f. can i loop through an array
It's still a string, not an array
const array = ["1", "2", "3"]
array[2]
its an array
It's not.
chararray
there are a few methods to loop over an array
something like.. foreach(guild in guilds) { name: guild.name, id: guild.id } Is there an equivalent or smth?
are you doing this?
oh, i see
yeah
If you don't include the important part in your screenshot, not my issue, dude
see
square is an emoji
[3]
even if i did msg.channel.send("😀")
it doesnt send it
Dude, create an array [emoji, emoji, emoji]
{content:"emoji"}
OR split by a space
and put a space into it
just make it an array in the first place
Unexpected for..
no reason for it to be a string and then split into an array
SyntaxError: Unexpected token 'for' 😢
b.. bb... because i wanna put thingy to thing
create you array, and push items to it
you want to use the map function on the array
i may have been wrong
javascript 🤢
let array = [];
for(... of ...) array.push(item);
array.map(thingy => ({...thingy, more:thingys}))
const guildNames = array.map(guild => guild.name)
Think he just wanna log the guilds
I mean it's not really needed to create another array or object at all, the guilds are already available as collection
Excactly
console.log(client.guilds.cache.map(guild => guild.name))```
i did that before with the IDs.
omg
But i kinda whant it in console.table()


Had to double check
