#development
1 messages · Page 2000 of 1
kk
It very likely errors out on .lyrics(), which is interesting to me
I think the genius-lyrics library is outdated or does not function with some aspects of the API, there's also https://npmjs.com/package/genius-lyrics-api which has worked for me
A JavaScript package that leverages Genius API to search and fetch song lyrics and album art.It doesn't use any native node dependencies and therefore, can be used on the client-side.. Latest version: 3.2.0, last published: 6 months ago. Start using genius-lyrics-api in your project by running `npm i genius-lyric...
what
I'm terribly sorry to keep asking this, but I've been messing around with this for a while and can't seem to get the bot to play anything locally. I've tried multiple files whether it be mp3 or m4a files, but the bot just won't play anything lol.
Code: https://sourceb.in/GcoxiuCQ9c
If necessary, this is the slash command I use to play the audio:
if (interaction.commandName === "play") {
const fileName = interaction.options.getString("link");
if (!interaction.member.voice.channel) {
interaction.reply("You're not in a voice channel!");
} else {
interaction.reply("a");
audio.playAudio(interaction.member.voice.channel, interaction.member.guild, fileName);
}
}
@earnest phoenix how do you call the functions?
There are examples shown in the NPM package's library
i saw but i didn't know if i needed an identifier or something
getLyrics is very plain lol
oof aah https://img.ascencia.re/QceeRiYS.png ok
// CommonJS (CJS)
const { getLyrics } = require('genius-lyrics-api');
// ES Modules (ESM)
import { getLyrics } from 'genius-lyrics-api';
const lyrics = await getLyrics({
apiKey: 'Your Genius API key goes here',
title: 'Blinding Lights',
artist: 'The Weeknd',
optimizeQuery: true
});
console.log(lyrics);
I suppose the audio resource creator can't create the resource properly from a local path, try this:
import { createAudioResource } from '@discordjs/voice';
import { readFileSync } from 'node:fs';
import { Readable } from 'node:stream';
// Read file and get it's buffers.
const buffer = readFileSync('./jammer.mp3');
// Turn the buffer into a readable stream.
const readable = Readable.from(buffer);
// Create the audio resource.
const resource = createAudioResource(readable);
// Play the resource.
Ty! I'll try that
i'm making a ticket/helpdesk system, whats the most secure of doing the tickets?
theres no customer authentication, only staff can login
atm its /ticket/TICKETID?e=EMAIL, and having a valid ticketid (uuid v4) and email it unlocks ticket replies
whats the most secure way of doing this?
in that system I just need to know the ticket ID and email, so that's not secure
i'm thinking of having an access token for each ticket that never changes, but has to also be correct to allow ticket replying or viewing
like, if staff can login, then you have some form of authentication going around
could easily use some other platform to handle the actual account and flow, like google or discord
then just check if the current user is permitted to view the ticket, boom!
its not using any third party authentication, as its open source and designed to be stand alone without a need for other platforms
or i would have used auth0 etc
Unfortunately that didn't solve my problem, but thank you for your help.
Hmm, at this point I don't think there's anything wrong in the code but rather in the dependency side, what dependencies did you install for voice support that are required?
just tested with other platforms such as Hesk and Freshdesk, both use a similar system where you only need ticket ID and email to view ticket
but the ticket ID is a UUID which isn't easy to bruteforce find a ticket
@discordjs/voice, prism-media, @discordjs/opus, opusscript, libsodium-wrappers, tweetnacl, libopus. At least according to the dependency report. I'll real quick try uninstall most of them and see whether that fixes the problem.
I also have ffmpeg on my PC path but I uninstalled the npm packages.
I recommend only installing @discordjs/opus, FFMPEG (or ffmpeg-static, both works pretty well) and sodium
Aight. Thank you; I'll try that đ
how can I set box height
https://capy-cdn.xyz/n6IAtcrh.png when i do height:150px this happens
using Tailwind and regular CSS
okay soi
how would i split the name of the song from the artist name ? @earnest phoenix
and what if they don't put a artist name is it mandatory to have one?
You can either specify a delimiter such as | to split the song name and artist name between or use CLI options such as --song Blinding Lights --artist The Weeknd (This requires a Flags and Options parser, such as https://github.com/VoltrexMaster/opteric
) or simply using slash-commands if you prefer
args.join(' ').split('|');
Btw the artist field is optional, so if the artist is unknown or not passed in, you just simply pass in an empty string
ooo okey
i only asked cs when i tried w/o the artist it gave me artist field is missing
the issue isn't brute forcing. it's that it's still public. as long as someone has the ID and email, they can view it. so if you give me that ID and email, I can view it, even if it isn't meant for me. that may not be much of a problem now, but it is something to consider
It is definately a thing I'm considering
and I'm now looking into making a signup system for customers to use, and then they can list tickets etc
I can't seem to install sodium, but I have @discordjs/opus and ffmpeg-static. Unfortunately uninstall all my modules and re-adding them didn't seem to work...
audioPlayer.js: https://sourceb.in/VCpSfSBgon
package.json: https://sourceb.in/kBu9K3Fm1D
interactionCreate.js (or at least the part that uses audioPlayer.js):
if (interaction.commandName === "play") {
const fileName = interaction.options.getString("link");
if (!interaction.member.voice.channel) {
interaction.reply("You're not in a voice channel!");
} else {
interaction.reply("a");
audio.playAudio(interaction.member.voice.channel, interaction.member.guild, fileName);
}
}
The issue I currently have is that the bot doesn't play any sound, just joins the VC without any errors.
And also the directory.
Sorry that I can't seem to figure this out.
fileName.url instead of just fileName?
fileName is a String since I am using slash commands for testing
oh my bad
nw
oh wait, so you give like file.mp3 in the link?
yes
@simple stump can you test my bot for me ?
as like a proof read to make sure everything runs smoothly
i personally already overlooked most of the commands that didn't work but i want to be double sure so woo won't yell at me
my enviornment unfortunately is very messy lol
idk if changing the hoster would do very much ÂŻ_(ă)_/ÂŻ
not if using docker đ
pogg
guess you need to require it first,
let fileToPlay = require(`./${fileName}`)
or use fs to read the file
but what i see from .play method, you need to give this to play local file using buffer https://discord.js.org/#/docs/voice/stable/class/AudioResource
i'd assume you using this one https://discord.js.org/#/docs/voice/stable/class/AudioPlayer?scrollTo=play
You should have at least one encryption library installed as sodium didn't get installed, try using libsodium-wrappers with the libraries I mentioned
Yea I'm using fs rn with the code Voltrex sent. I'll look at AudioPlayer though; thank you
Aight. I'm using libsodium so I'll see how that goes. Thank you!
I created an application for using discord rpc to set my little user card info. wondering if folks might find use for such a thing?
makes this -v
Looks pretty good, although this also exists
https://github.com/ThatOneCalculator/DiscordRPCMaker
anyone knows why when i call my bot only with the prefix it turns off?
go offline
cannot send an empty message
but i didnt make a command with void name
well then your bot's trying to send nothing to the user
e.g. a blank message or embed with no contents
you could probably find where if the stacktrace includes the line numbers in your project's code
Check the console, any error?
cannot send an empty message
Show the error
throw new DiscordAPIError(request.path, data, request.method, res.status);
^
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/runner/railban-bot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/railban-bot/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
method: 'post',
path: '/channels/715210956723978259/messages',
code: 50006,
httpStatus: 400
}```
aight i just tried libsodium-wrappers along with tweetnacl, then tried uninstall tweetnacl and only used libsodium. none of those seem to work which is a bit strange.
Does it error only when u type only "?"?
yes
Or does it happen on ping?
no
audioPlayer.js (fileName is a String):
https://sourceb.in/VQkXMkPrvp
package.json:
https://sourceb.in/aFTYUYmvC8
interactionCreate.js (just for /play):
https://sourceb.in/Oz0YxToSFU
wait
You're probably not ignoring non-commands commands
So it try to send a message with nothing
That's pretty strange, I guess the only thing left for you to do is to either ask in discord.js' official support server:
https://discord.gg/djs
Or create an issue about it if the support from the official support server wasn't sufficient either in the GitHub repository:
https://github.com/discordjs/discord.js
I don't see how else would it not be working
Okay. Thank you for all your help; I really appreciate it. Sorry that what I tried didn't work.
const Discord = require("discord.js");
const client = new Discord.Client();
const db = require("/home/runner/railban-bot/models/commands");
const mdb = require("megadb");
let prefixdb = new mdb.crearDB("Prefixes");
module.exports = async (client, message) => {
let p = prefixdb.has(message.guild.id) ? await prefixdb.get(message.guild.id) : "?";
const args = message.content.slice(p.length).split(/ +/);
const prefix = p;
const cmd = args.shift().toLowerCase();
if (!message.content.startsWith(p) || message.author.bot) return;
const load_dir = (dir) => {
const event_files = fs.readdirSync(`./events/${dir}`).filter((file) => file.endsWith(".js"));
for (const file of event_files) {
try {
const event = require(`../events/${dir}/${file}`)
let eventName = file.split(".")[0];
allevents.push(eventName);
client.on(eventName, event.bind(null, client));
amount++;
} catch (e) {
console.log(e)
}
}
}
const command =
client.commands.get(cmd) ||
client.commands.find(a => a.aliases && a.aliases.includes(cmd));
if (command) {
const check = await db.findOne({ Guild: message.guild.id });
if (check) {
if (check.Cmds.includes(command.name))
return message.channel.send(
":x: Este comando fue desabilitado por los admins."
);
command.execute(client, message, args, prefix);
} else {
command.execute(client, message, args, prefix);
}
}
};
Why are u creating a new db for every message?
if(command.name == "") return; ?
Don't think so, but i can't really see anything anyway cuz mobile
wait
In a few mins I'll get my laptop
Wrap your command executing in try/catch
Catch the error and command name and log both to your console
Then you will know where the error is coming from
Or properly handle all promises by catching their errors
I better donât ask why you load files and create event listeners
It is one way of loading the events and registering them ig
You should probably watch the code before guessing
I am watching the code and that seems like exactly what he is doing
module.exports = async (client, message) => {
Ok
He could be using it as a start method to call in another file
and then he passes client and message to it
I also make start methods to call when I am actually ready to load events and such
So it will be called on any command
the error doesnt come from here
ofc idk the real reason behind why he did that but that is just my assumption
What?
no
Unless he is treating it like a command it won't
Wtf
Wait nvm you might be right
Watch the fucking code
my fucking bad ya twat
He is fucking handling the messageCreate event with this
Thats cool I just realized that so stop riding my fucking dick
calm down with the cursing pls thanks
Slicing of the message, getting his cmd name
What happens if you register event listeners over and over again?
funny stuff
Yes thatâs I told you to wrap the command execute method in a try/catch
Log the error and command name and you got the source
ew
why would i recode to slash commands
, it's only for noob coders who can't use command handlers
it also makes it to easy smh , why write 25 lines of code when you can do 45 and worry about prefixes ect
so I don't ever see your help command!
its only for noob who cant use command handlers with slash command
you can lol use the prefix and say help -_-
yeah but I don't want to do that
just type / and I can see them all and their descriptions
it's only for noob coders who need an easy way to code something when they can learn the actual code instead of relying on js intents to work
can click through and see extra
then your lazy lol
no, I want something consistent
yikes
djs v13 developers vs djs v12 developers
because every bot creates their own language and vocabulary without a standard like slash commands
what
i use v12
same
you can think of slash commands like a standard, which is why I mentioned consistency
my bad this is too easy for you, literally just 2% of my code
doing /help and !help doesn't really make a difference
Not worth arguing with tbh
you cant reject slash command unless you are making a private bot that doesnt need verification
ik i'm just confused on what there trying to explain 
Calling people noobs in general is childish especially considering the fact that discord is forcing slash commands on a ton of bots
^
this lol
eh i guess
w response
I respect those who like them but I generally hate that bots are being forced to use them
well it gives discord more control so they don't care
yeah, being forced to rewrite 250 commands + codebase is pain fr
i was mainly talking about new coders and how majority of them are using slash commands instead of actually learning the material so if they won't be able to use slash commands for whatever reason they can actually code a command , not trying to discredit someones skills or anything like that
ic
well i don't feel like typing more code
you're still learning js writing interactions though
i guess
but you're building off of the interactions so it's still relying on it , regardless discord is garbage either way
there already making giga chad moves cause v11 can barely support itself and v12 is inconsistent
Supposedly theyâre making more customizations for slash commands soon but still, I donât like them lmfao
same
The permissions for them are a nasty wreck atm
pretty soon v12 wont work at all and your gonna have to recode to v13 then slash commands will probs be mandatory
Mhm
flexiblity and slash commands will never go together imo
I agree
slash commands are more like a framework
if it felt just like a schema then maybe they'd work
Like you said tho, discord doesnât care unfortunately
yeah
discord: take it or leave it
they hardly care abt anything besides there app and marketings
because thats what actually matters lel
they wouldn't give me my old acc back after the obvious proof it was mine lol
this ^^
for some cases, slash commands are bad because if you have multiple bots with same command's name, it's hard to get the right bot, especially on pc
you cant scroll

slash command but custom "slash"?
yes
imagine i have bootleg slash command
just make / the prefix
ez fix no longer needs v13 update
discord does tell you which command is associated with which bot
yeah but what i meant is, example: like you have 6 bots with same command's name, discord only show 5 of them
oh really? damn
yea
help command
lmao
imagine they do all this work just for v14 to remove slash commands and basically revert back to v10

Hii
why is intl so damn slow in js đ©
I wonder about how would handle all (slash) commands without a proper handler
joke died
Aye
it also makes it to easy smh , why write 25 lines of code when you can do 45 and worry about prefixes ect
alright let me benchmark performance with performance
Like the dude arguing about slash commands
damn
ñ
You should also benchmark the subtraction
May takes 100ms of your 142

(micro)2 optimization
now this is surprising
process.hrtime.bigint() is just as fast as process.hrtime()
even tho bigint in general is slow af
You should be careful
When the time gets negative as benchmark result you might accidentally create a black hole
i will divide by zero before that
lmao
steins;gate?
Turning into a super nova then
much better
I feel like I shouldnât mention this
Maybe an issue of your performance class
Youâre benchmarking all of them right now, arenât you?
you canât resist

things
I see you tried a few
I wish I could test intl for PHP to fuck you up, when itâs faster

But damn mobile phones are limiting you a lot nowadays
guess I need to buy a Windows phone
Haa!
Damn I somehow like your net-ipc package
Looks promising for what I wanna do
If I ever have the time to 
exdee
yamete
I have a weird error encountered on this code line,
if(cmd) cmd.execute(message, client, args)
if I use .lb-exp (which is the leaderboard)
it throws an error like (message.guild.id < undefined id)
If I re arrange the
if(cmd) cmd.execute(message, client, args)
to
if(cmd) cmd.execute(client, message, args)
the leaderboard working but it throws another error like
const target = message.mentions.members.first()``` undefined members
If I re arrange the
```js
if(cmd) cmd.execute(message, client, args)
to
if(cmd) cmd.execute(message, args, client)
if I use .lb-exp (which is the leaderboard)
it throws an error like (message.guild.id < undefined id)
problem solved
lmao
"rearrange"

yep xd
my man's code looking like
const parameters = [message, args, client]
cmd.execute(...shuffle(parameters))
you gotta like.. pass arguments in the exact position your code expects them
this is what dynamic typing does to a person
LMFAO what am I looking at
It's more like... this is what not learning a language properly before making a bot does to a person
parameter order is one of the first things you learn when you learn functions
to be fair, not all drivers behave that way
i came from slappey module, sooo i didnt arrange, got confused about using normal command handler
this is why we use destructuring
function takesAnObject({ one, two, three, four, five }) {}
takesAnObject({ five, four, two, one, three }); // still works
syntax highlighting on mobile 
sorry i'm only here to shit on dynamic typing
https://sourceb.in/MnlOM1eoSe so, i was trying to move all codes in slappey => normal command handler got error after this, if I do findOneAndUpdate at the last part, the messageCount not changing or adding at all
and this is so nice for my eyes
It's not
opposite đ
Do yourself a favor and start using atomic mongodb operations
const userData = {
memberID: message.author.id,
guildID: message.guild.id
}
YourCollection.updateOne(userData, {
$set: userData,
$inc: { messageCount: 1 }
}, { upsert: true })
this will create the document if it doesn't exist and increment the messageCount by one if it does
you might need to use $setOnInsert for setting a default message count of 0 though
shut up whitename
only if you have a blue name
blue names are usually correct
lol
ok green name
am i doing wrong for using sqlite? 
pls fix this bug
you can try fixing it yourself, these are the main starting points
sqlite is good
yeah i like it, the other bot devs ik switched to nosql and i felt left behind
Read Dannys annoucement in #381965829857738772
There was breaking changes
also the other devs: "damn why is it so hard to structure data and create relationships between them??2?"
sql is good and if they don't understand it and switch to mongo they are just stupid
Well there are people out there loving a chaotic database storage system
Imagine loving a well organized and optimized storage system
Eww
danny đ
why people still use d.py
indeed u need cope
what if I tell u
I still know people who use d.js v11
people hate changes, they want to code once and have it live forever
i see
them trying to fix that one issue solved in djs v13
One message removed from a suspended account.
One message removed from a suspended account.
sqlite db + lmdb cache >>>> mongo db + redis cache
djs 12 is still less ooga booga
One message removed from a suspended account.
cuz it's very recent
"still less ooga booga"
but 11 is barely hanging

One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i mean its still hanging, why migrate 
One message removed from a suspended account.
One message removed from a suspended account.
Im trying to send message to a member but .send is undefined, I'm pretty sure this worked before but doesn't now
Any ideas why its like this?
try fetch instead
whenever you write "cache.get" and get undefined it'll >> ALWAYS << be "X is not cached" solution
alright, ill try
or maybe the id is wrong
Keep in mind fetch is a promise
Hey hey!!1! Go away with your obvious solutions 
strings are utf 16
also made sure there's no zero width characters

Thatâs why everyone is posting in hereâŠ
Because trolling is legit in here
besssst channel
Scylla > sqlite + lmdb
No donât!!!
Now he will end up benchmarking the whole day instead of developing his API
đ€Šââïž
Deez Nut 3
is it allowed to use flags like đșđŠ in our bot's name? Asking because some platform are like we don't allow stuff like political opinion and what not
That falls under unicode usernames
Flags are hard to type so you need to have english characters in your bot name if you put ukraine flag there
understand my feelings! i mean i want to show my support for Ukraine, Like updating the profile picture and about me of the bot
Is it allowed or against discord's rules
it's not
Put the flag in the bot's status or description
discord would be ratioed if they did ban it
but like i said you shouldn't put in your bot name otherwise you can't ping it
it's not against tos but generally looked down upon
I mean Scylla is just categorically one of if not the fastest main stream database available
just remember, after verification you become unable to change the bot name
so keep that in mind if you plan on going above 100 servers
Not like it will change anything anyway...
well, he'd become stuck with a flag on the name
My bot is already verified and i will just add the flag on the profile pic. Tysm for the help.
And all for internet clout
I'm curious./ how does putting the flag there show your support? are you actually offering support to the people of ukraine, or are you actually just putting a flag on your bot name as a marketing technique? (please dont be offended by this, I'm geniunely curious)
like, I just dont see how showing a flag actually shows you are supporting.
Awareness
awareness !== supportiveness.
Not always
I'm on the "showing the flag is a marketing strategy" team
it's like bmw changing the logo during lgbt pride
i honestly felt the same with tons of bots during when BLM was at its peak.
and yea, during pride period it happens too lol
I personally have donated money to ukraine
I love sass's website because all the websites removed the black lives matter banner from their site after the "trend" died down and nobody talked about it anymore, but sass still has it because it's STILL a major issue
i remember skittles did a pride special, where all skittles where white, because there was only one rainbow that was important during pride... đ
if that isnt pandering for the crowd, idk what is đ
đ©
and m&m making the green female candy less vulgar
I mean, fuck it they all taste the same
imo, that actually shows that they care. moreso than those who flexed a banner during the hype
hype about people fucking murdered by police
lol, yea... its a pretty sad world tbh đŠ
this might be getting too off topic
let's go to #general-int
Really not sure how bringing awareness through a Discord bot would help
This shit's all over news, social media, irl
Can't wait for the trolls to say "you're a bit too early bro"
Do I look or sound like I give a single fuck
i could see - for example, adding a link to every embed your bot makes, that links to some Ukraine relief fund - that'd be actual support imo.
Now that can count as support, yes
ye, that is, bringing awareness to how to donate
not bringing awareness that ukraine flag is yellow and blue
And then there is the pygame website
at least it made me aware! i always thought it was blue and yellow?!
I didn't know such a flag existed
This is a peace protest against war by some people involved with pygame. The pygame website is temporarily down. Thank you for your support.
Fun
đŽó §ó ąó łó Łó Žó ż <- best flag. 
â i disagree
đŹđ·
how did they get an emoji in the button?
(discord rpc)
I've tried doing the name:id for an emoji, but no luck đŠ
Thatâs the official button, you canât specify that afaik
not sure, could be. but they also show the emoji in the top right
discord js rpc doesnt have emoji support in the setActivity function it seems đŠ
Thatâs integration discord has provided with certain companies Iâm sure
ahh well, guess i need to start a company for my bot lol
Yeah, you can see that with similar things like Spotify
That's specified by Discord's game detection on it's own after partnering with PlayStation, Although I saw discussion for that being made support for, but I don't remember where
that makes sense
RPC is just kind of annoying to deal with in general
Iâm not gonna bother with it again until they support websocket RPCs
Although that's only gonna be available in the GameSDK, not the Discord-RPC which is deprecated
You could add it yourself and fork the lib 
They remastered a piece of trash
The docs for sdk and stuff is just so đ€ź
It's pretty good if you know how to use it, although I agree, the documentation for the GameSDK isn't really that solid
And entire app made for gamers that doesn't like game presence
It works perfectly fine for game presence
what is rpc then
It was never intended for people who donât know what theyâre doing
The docs are sub par
But not nearly the worst Iâve seen
We all know detritus has the worst docs
Detritus is not the worst docs Iâve ever seen either
It's so bad googlefeud had to make his own
Heâs the main contributor of the docs
Detritus doesnât hold your hand, the docs themselves are pretty clear when you think about it
It just doesnât have a lot of examples
It's the website itself
You get random 404s for search results, css sometimes doesn't load although it only seems to be an issue with me, 404s sometimes redirect to /, etc.
If you think detritusâ docs are the worst, you obviously havenât looked at a lot of docs 
And Iâve never had a problem with any of that
maybe i have.... skill issue
Indeed
typedoc's docs are hard to read in general IMO
but they have a redesign coming soon which hopefully makes it better
hopefully
Only colors & layout's changed

This barely readable text's gonna stay đŠ
You guys wrote JS to get away from Java only to arrive back at Java
All roads lead to Java
nice
approved for what ?
JS to escape the class based and strongly typed languages only to end back up to class based and pretty strongly typed with TypeScript
The concept behind OOP is easy to understand; OOP is very structured and is easy to separate different parts of the program from each other
I love oop
What are the differences between flow and ts?
If you have to ask there isn't one
Lol same
Idk i just felt like doing it
Also how does adding flag act as marketing technique
My bot is returning this error some times. Did anybody know something about this?
5xx errors are server end, nothing to do with you as far as I know
probably because #site-status
@mellow locust ^
thank you!
Hello so am ..
When I run my bot on a vps/locally I face a small problem - After playing a YouTube audio I cant seem to play a stream audio [Radio Stream].
I dont get any error on my console but no audio seems to be played
sorry it's not about discord, but does anyone know about that bug? I can't find how to solve it 
You tell me?
server side error

lol it should resolve itself
When I take the direct hosting from VSC the bot is still online
I don't know why
And it's a problem for when I'm trying to make changes
It doesn't save
Do you know how to make the Discord client offline after stopping the direct hosting with CTRL+C in prompt?
Then some other process is controlling your bot.
How exactly are you starting your bot?
It could be a task, a command on the command line (though this is what you claim to be killing), something that spawns a separate process (and hence won't be affected), etc.
When I exit the process on command prompt, the bot stops its streaming status and goes online, and it does not respond to any commands.
I also do not have any hosting services holding up my bot currently
Isn't that what you want?
It stays online unaccompanied
I would like it to me offline
So that my changes in the code would save
If you donât logout from your active gateway connection the API thinks of a disconnect
Your status icon wonât change for like 10-30s
Make sure when exiting the process to destroy your client
Means to end its gateway connection accurately
Examples for process event listeners can be found here:
At least for nodejs
And where exactly am I supposed to try this?
<div class="article rounded p-4 mb-4 text-white items-center justify-center md:w-1/2 md:w-2/6 md:m-auto ml-3 mr-3 cursor-pointer" onclick="window.location='/article/<%= article.articleID %>'">
<div class="flex items-center">
<div class="flex flex-col text-left ml-3 mr-3">
<span class="articleTitle"><%= article.articleTitle %> <span class="articleArrow">â</span></span>
<span class="articleDesc"><%= article.articleDescription %></span>
</div>
</div>
</div>```
how can I make articleArrow's margin change on div hover not arror hover
.article:hover .articleArrow {
...
}
ahh
I use @discordjs/voice to stream music - v13 d.js
Well in your code?!
Makes sense to put it at the end.
Then destroying the client, database etc. - basically any active connection
Inside the event listener of course
Hii
Hello, do you know if the puppeteer has a discord server?
Do I need react-query if I use firebase with reactfire? (in a nextjs project)
u can mark, article div as group.
and then can use group-hover:* on its children
yes misty
wait
I thought I was doing smth wrong ngl I haven't calculated milliseconds like that in a while
24x60 returns minutes
đ
times 60 again
7 * 1000 * 60 * 60 * 24
ah right cause that turns it to milliseconds, seconds minutes days right?
should be
my ocd
lmaooo
i'll fix it later
my laptop might die at any moment don't want bottums to be offline lols
y e s
@dry imp
please kill me now
use that cmd on mobile
o h
g o d
i need to check perms with it lol
omg the stretch lol
i might make it where you can add your own background tbh
but my spaget code will cri
does anyone know how other economy do dep all to dep their cash? or even using 1e8 = 100,000,000 do you have any idea or know some docs?
if input == "all" then money = user.balance
ohhh thanks thanks
okay so i have a question
my economy commands stopped working after i changed it from db.set to economy.set
but in quick.db docs it says use
var economy = new db.table('economy')
but it doesn't show any new table and now nun of the commands work
as stated above ^^
if you want my code
if (command === "work") {
let user = message.author;
let author = await db.fetch(`work_${message.guild.id}_${user.id}`)
const cooldown = cooldowns.get(message.author.id);
if (cooldown) {
const remaining = humanizeDuration(cooldown - Date.now());
let timeEmbed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(` You have already worked recently\n\nTry again in ${remaining}`);
message.channel.send(timeEmbed)
} else {
let replies = ['Programmer', 'Builder', 'Waiter', 'Busboy', 'Chief', 'Mechanic', 'Engineer', 'Hitman', 'Hacker']
let result = Math.floor((Math.random() * replies.length));
let amount = Math.floor(Math.random() * 80) + 1;
let embed1 = new Discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(`You worked as a ${replies[result]} and earned ${amount} coins`);
await message.channel.send(embed1)
economy.add(`money_${message.guild.id}_${user.id}`, amount)
economy.set(`work_${message.guild.id}_${user.id}`, Date.now())
cooldowns.set(message.author.id, Date.now() + 10000)
setTimeout(() => cooldowns.delete(message.author.id), 10000);
}
}
work cmd
if (command === "bal") {
let user = message.mentions.members.first() || message.author;
let bal = economy.fetch(`money_${message.guild.id}_${user.id}`)
if (bal === null) bal = 0;
let bank = await economy.fetch(`bank_${message.guild.id}_${user.id}`)
if (bank === null) bank = 0;
let moneyEmbed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(`**${user}'s Balance**\n\nPocket: ${bal}\nBank: ${bank}`);
message.channel.send(moneyEmbed)
}
bal cmd
i get no errors it just doesn't show anything ;-;
nvm
i needed to change var economy to let economy

i hate my life
Glad to have helped
đ„° Anytime my donut
why i have
DiscordAPIError: Missing Permissions
at RequestHandler.execute (/layers/paketo-buildpacks_npm-install/modules/node_modules/discord.js/src/rest/RequestHandler.js:349:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/layers/paketo-buildpacks_npm-install/modules/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
at async TextChannel.send (/layers/paketo-buildpacks_npm-install/modules/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15) {
method: 'post',
path: '/channels/953206592935964712/messages',
code: 50013,
httpStatus: 403,
requestData: {
json: {
content: ' You need to type 36',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: { message_id: '953214484523151371', fail_if_not_exists: true },
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
error in this code
try {
message
.reply(` You need to type ${data.guild.count.lmite}`)
.then((msg) => {
setTimeout(() => {
if (msg.deletable) {
msg.delete().catch((e) => {
console.error(e);
});
}
}, 10 * 1000);
});
} catch (error) {}
@solemn jolt what is the whole thing
i add 2 catch to stop it but the bot well be offline
or is that it
yep
one why is it formatted like that makes it very hard to ready but nice for style points
what is this
${data.guild.count.lmite}
and your error might be on message.delete make sure your bot has permissions for it
this thing get count value for guild from mongo database
ohh
POST /messages means it can't send a message
your using mongo db understandable
i need to add line cheack the bot permission before deletet it ?
It's not deleting that's the issue here
hush i wanna sound smort
I fucking explained it above already few seconds ago
he isn't wrong tho lol i didn't read that far
make sure it can send messages to
DiscordAPIError: Missing Permissions
but i have this code in many i now it this is why i add 2 catch for it but i wanna now why the catch is dont work
always check bot perms though because if they don't have a certain perms cmd wont work
catch (error) {}
Ehh...
oh that to
It's not occurring in that code snippet, I reckon.
he just want to catch it
catch (error) {
return;
}
i type this
Is that not what he's doing already
yeah but if you get an exact line it's easier to find problem
yes
nO
it doesn't log where the error is specifically in the console
i just want to catch it and dont do anything
I'll leave the JS clusterfuck to you then
lol
it isn't the console log is so you have more info on the error
Though logically the code does make sense I'd say
Maybe give .catch a try too
i use somthing before in discord.js v11
if (message.deletable) {}
but for now this is dont work
no

.
or just use promise.finally instead of promise.then
this is the problem
i add 2 catch to stop the error but the error make my bot down
try putting a console.log(msg) in the .then
maybe msg is the author's message
no i test in the guild
v13 is message.deleted, check if the message still exist or not
v14 is nothing
i dont have eval command
for?
for one check the bot need 5m to come online
you mean like this
message.delete().then(msg=> console.log(msg)).catch(error=> console.error(error));
?
i fix it
if (!message.channel.permissionsFor(message.guild.me).has("MANAGE_MESSAGES")) {
message.delete()
}
yeh ty all
hhhh
pog
hi
nice nice
#development Etiquette
This channel is to help and educate each other. Please refrain from contributing if your intention is to be unhelpful.
Be mindful that we all started as beginners, so be nice to each other. Helping one person helps us all. The more knowledgeable the development community is, the more we all benefit.
If you are unable to answer a question, please refrain from deducing your knowledge from another source - you will mostly create more confusion.
If you are able to help a user, please do so without expressing a condescending or rude attitude.
Do not use random, unhelpful, unrelated jargon to make yourself seem smarter. Always be mindful that the intention of discussion in this channel is to be helpful and educational, not to show off your vocabulary.
Do not ask to ask - this channel is for questions, so you do not need permission to ask.
Keep inside jokes to a minimum as they will most likely confuse the user asking a question.
No language / library wars - anyone involved will be muted.
Do not assume that users have not already googled their question. If they are asking here, it is likely because they were unable to find a helpful answer via Google. Telling someone to âGoogle itâ is unhelpful and rude.

As it always has been
No one really followed or enforced it tbf
Whoever was smart enough to follow this is just smart enough to use common sense along with experience in helping
damn we cant make jokes about js anymore
sad times indeed
Huh
"Missing Permissions"
It has no permissions to chat in that channel
No language / library wars - anyone involved will be muted. oh no all of topgg will be muted
fr
It's has Administrator role
Why are you giving your bot an admin role
Bruhhh
It's not even working in other servers
Then contact the dev
Huh it's my bot
Then how do you not know how it has no perms

Dumb on purpose?
check if your bot have SendMessages in that channel
he said the bot has admin
like if there is no code i literally dont know where does the error points to
^
yeeeeah, unfortunately common sense isn't that common
Discord global error?
idk my bot works fine tho
Hmm and Can you help me with It ( tell me How to fix It?)
dont know js sry
its just missing access errors
check what permissions your bot requires, and make sure it has those permissions in the areas that your bot is trying to manipulate when throwing the error
for example: if error thrown when registering slash commands, if you are registering commands on a per guild basis, some guild might not have application.commands permission for the bot, or if its thrown when scanning channels or sending a message, then its likely a channel or guild permission error for embed_links or something stupid
yes but it is send this error when i type npm start not when i run command
idk, i'd guess its likely that your bot has some command that requires a permission that your bot doesnt have. some module called gcommands is mentioned alot in your error message. and the error seems to be getting thrown from the ready event
missing slash scope maybe
or you're trying to load slashes in a guild your bot is not member of anymore
idk it is send this error when i type npm start not when i run command
hm
either way, unless you show some code not much can be done
your bot needs both those scopes in the invite link for you to be able to register slash commands
it could be some framework is trying to automatically register commands to the dev guild or something but cant ~ idk
i agree, need more code or something đ
require('dotenv').config();
const { Intents, Collection } = require('discord.js');
const { GClient } = require('gcommands');
const path = require('path');
const client = new GClient({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.GUILD_MEMBERS,
],
dirs: [
path.join(__dirname, 'commands'),
path.join(__dirname, 'events')
],
devGuildId: '951943054892335104'
});
client.queue = new Collection();
client.login(process.env.DISCORD_TOKEN);
need to edit this
show gcommands
ah, public lib
"remaking"
that's one of the worst options available
but anyway, yes gcommands tries to sync guild commands
hmmm so how can i fix it?
not cloning an existing bot would be a good start
but if u must, filter out guilds that dont have the required scope
i dont make it publish
publishing isn't the issue
diy is where the lernz are @tidal bridge
you're trying to maintain someone else's bot without enough knowledge
I lowkey wanted to make a music bot with webpage n cards showing what music is currently playing in the guild
oh fk, sorry, it wasnt support to @plucky sonnetonereally lol
this is a huge task even for the original dev
ohmyfukinggawd illstop
imagine for an outsider
you literally cant put an at symbol with random text without it atting someone
@lyric mountain did you know how to fix it ?
tbh, the best way to learn, is to do as much of the code yourself from the ground up. but thats not time efficient, so its all about finding a balance that suits your learning pace, as well as allows you to grow đ
don't simply ignore everything I said đ
you're in for a huge task you'll not be able to deal with
nor anyone but the owner can answer your issue
i mean, it does seem like the issue is that its trying to register slash commands without the application.commands scope on the bot
~ could be wrong tho
that's probably it, but solving that on the probably giant codebase is a big task
i'd try just kicking the bot from dev guild, and then reinviting it with the scopes
and if that fails, then i'd probably give up on that library đ
my ssd says the wear level is n/a any ideas why?
Might not report it. If it used to report it then the module that used to report it might be borked
plus his error paths match with MusicBot source
click the hyperlink on the embed
its got a cheatsheet
please any one help
i didn't understand what they said

please say
there is a guide for you
whats the problem?
You need opus or some sort of encoder I believe
npm install opus?
Try installing @discordjs/opus
Oh wait
It literally says what to do
Didnât even see that line
Do what it says to do
can someone explain what exactly is happening here?
why is my div 24px even tho the svg and the a are only 16px
Although Iâm pretty sure opus would work too
Padding?
Hold on, there is no padding...?
yea there isn't any
just ask
Could there be any parent elements causing this?
the parent element is a flex (yellow) which again is in a grid (red)
the flex has smaller childs then the - General field tho, so it shouldn't come from there
@civic scroll css
min-width
or the bigger menus
iirc grid spans to the child which has the largest width
I want them to be smaller, not the other ones as big
it's in a flex, that flex is just in a grid on its own
it has similar behaviors
but there are even smaller ones, so it can't come from it getting bigger because of min-height
in this case it's width
since whitespace: nowrap
also smaller ones will stretch
why do I need width when I wanna manipulate height?
for what
Hello everyone, need help on an error.
2022-03-15T16:14:49.334504+00:00 app[Worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
2022-03-15T16:14:49.334504+00:00 app[Worker.1]: at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-03-15T16:14:49.334505+00:00 app[Worker.1]: at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
2022-03-15T16:14:49.334505+00:00 app[Worker.1]: at async MessageManager._fetchId (/app/node_modules/discord.js/src/managers/MessageManager.js:219:18)
2022-03-15T16:14:49.334505+00:00 app[Worker.1]: at async Object.run (/app/SlashCommands/partnerworld/visualizzaRichiesta.js:47:30) {
2022-03-15T16:14:49.334506+00:00 app[Worker.1]: method: 'get',
2022-03-15T16:14:49.334506+00:00 app[Worker.1]: path: '/channels/951500288123093042/messages/953290244235603988',
2022-03-15T16:14:49.334506+00:00 app[Worker.1]: code: 10008,
2022-03-15T16:14:49.334507+00:00 app[Worker.1]: httpStatus: 404,
2022-03-15T16:14:49.334507+00:00 app[Worker.1]: requestData: { json: undefined, files: [] }
2022-03-15T16:14:49.334508+00:00 app[Worker.1]: }
2022-03-15T16:14:49.334547+00:00 app[Worker.1]:
2022-03-15T16:14:49.334548+00:00 app[Worker.1]: Node.js v17.7.1```
I'm trying to fetch for a message and send it again, works with another one but not with this one
edit: I send the full console.log
The message apparently doesn't exist
I've found out that a staff member deleted the message lmao
it's ok
Best server name adding my bot I've ever seen
Federation of Equality against Europe and everyone...
Probably headquartered in North Korea
I'm wondering whether it's worth it to store ranges as { start: usize, end: usize } and calculate the line & column they're at only when I need it. It saves a few bytes per range, and there are gonna be a lot of ranges, and it's never guaranteed that I'll need the line & column. Only problem is that getting the line and column isn't that easy... or fast
16 vs 32 bytes, but also keep in mind that the column & line are going to be counters which will get incremented conditionally every time a new character is getting consumed, so that's also some overhead
My gosh... fixed an API issue being around for months returning a bigint as integer and not string
When you have to shake your head about yourself...
hi
Need any development help?
uh not yet
Quick question, how would I check if a user is in a guild by their ID? (discord.js v13)
Without OAUTH you will have to fetch a guild member using that user ID
Which works for guilds only, your bot is in
I see, I tried this:
let m = await msg.guild.members.fetch(top[topu][0]);
if (m) {
tope.push(`<@${top[topu][0]}> - ${top[topu][1]} points`);
count++;
};
However it returns the following error:
/home/pi/wordle/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown Member
at RequestHandler.execute (/home/pi/wordle/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/pi/wordle/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildMemberManager._fetchSingle (/home/pi/wordle/node_modules/discord.js/src/managers/GuildMemberManager.js:407:18)
at async Client.<anonymous> (/home/pi/wordle/index.js:98:21) {
method: 'get',
path: '/guilds/941120743083737088/members/567516955922137109',
code: 10007,
httpStatus: 404,
requestData: { json: undefined, files: [] }
}
Node.js v17.7.1
catch ur promises
is top[topu][0] actually the user ID?
yes
As Kuuhabawankbuku said
You need to catch the promise to get rid of the error
As it seems you don't need the error, simply catch the error to /dev/null 
.catch(() => {})
hello devs its now $300 free azure credits https://capy-cdn.xyz/VzrTX9CJ.png
I was about to ping a mod
damn, these ads nowadays

benefits: there are no benefits
targetted ads!!!
300$ free because nobody ain't using that microsoft shit
lol
lol
nobody helping our grandmas and grandpas anymore to solve their tech issues
damn, sad times
I have this grid and I want the different columns to scale individually
I thought I could fix it by using repeat(3, minmax(0, 1fr)) instead of repeat(3, 1fr) but that' still doing the same thing
then you'd not have a grid at all
oh wait, u mean the whole column
cant u just set its width?
queue.textChannel.send(
^
TypeError: Cannot read properties of undefined (reading 'send')
at DisTube.<anonymous> (/home/runner/railban-bot/index.js:125:23)
at DisTube.emit (node:events:390:28)
at SpotifyPlugin.play (/home/runner/railban-bot/node_modules/@distube/spotify/dist/index.js:183:28)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)```
textChannel is undefined
textChannel is undefined

no
Yes
this error only happens when i play spotify songs
they should scale with longer/shorter names and bigger numbers
except if u set table width to 100%
there's a property to make columns flexible, but you'll have a smaller table
that would be even better
Thoughts on the best way to get line and column from just an index in a string? I have this:
fn loc(&self, text: &str) -> Location {
let mut current_ind = 0;
for (line_ind, line) in text.lines().enumerate() {
let line_end_ind = current_ind + line.len();
if *self > current_ind && *self < line_end_ind {
return Location {
col: ((line.len() - (line_end_ind - self)) + 1) as u64,
line: (line_ind + 1) as u64
}
} else {
current_ind += line.len() + LINE_ENDING_LEN;
}
}
Location::default()
}
But I'm questioning it's speed đ€ This is the first thing I thought of and I can't think of anything better
tf is *self?
It iterates through each line in a string, self being usize. I'm comparing whether self is between current_ind (sum of all lengths of the previous lines) and line_end_ind (current_ind + length of current line), if it is then the index is on that line.
I could probably make the method accept a Lines iterator, or even better, make it accept a vector of strings, and cache each vector, but that kinda kills the optimization I'm trying to make
dereferences a reference, in this case it's a reference to usize so it basically clones it







