#development
1 messages · Page 26 of 1
I would love to change myname
but i don't remember my password lol
ask the mods to change my nickname i guess
mods lazy
True
how can i add only discord server can use the command
what
if (serverid !== "some id") return
Tried everything what do I do?
I even tried the written thing but comes back an eroor
*error
Anyone?
I doubt there’s much of a difference as the environment is optimized for both OS
linux will by far allow more ram to be used by the program
lol 11 message event listeners created
windows takes considerably more ram for itself
Oops where did my reply go
So linux is better for ram usage
??
Give the commands in .
I mean `` this signs
it's not "better for ram usage", it just uses less ram for itself compared to windows
Kahuhuwajabunku, I need somebody translating this above
._.
they want u to spoonfeed the correct code
Use google

inb4: no
._.
only corporate bosses who've never entered a terminal would pick windows as a host
Unfortunately some software out there is forcing us to
*essential
fake uses windows for host confirmed
@boreal iron BRO I DID IT
It came online
SUII
No ty as I did it myself
But still ty you tried
:)
pov: the issue apparently solved itself so you ignore the obvious error
people underestimate technical debt
Dunno what you mean
hey guys in djs v14, how woudl i check if a bot (of which i have the clientId and normal id of), is in a vc?
Ahh I just removed it from some servers and it worked lmao
Probably something sus or malfunction according to you my dear sir
Yes channel has a member property, a collection
Just search your known ID
The malfunction is your code and it’s suspicious you don’t get it
Okay so you suggest me looping thorugh all voice channels and try to find my id>
Got it
You didn’t specify you don’t know the channel
Fetch the guild member instead and check his voice status
with the new slash commands, how can i check that my bot has permissions to speak in a channel?
im trying to .fetch them but it doesnt have permission
I am new to coding I am officially a discord server developer
Without providing the code you won’t get help here
are you talking to me?
Nope
ah
You can use the permissionsFor() method on the guild channel
Like can I give the replit project code?
For your guild channel
._.
like this?
@boreal iron dming you my replit project
Ahh wat do I do then to get help ._.
Yeah
You can on chorme and desktop site
That will return the permissions bitfield
thats in my code already and it hits me with a "missing perms" api error 
*chrome
For your bot in that channel
Upload the part of your code making trouble on sourcebin hastebin or however they’re all called
That causes a permission error? Wut
This is where it's making the problems
It says to increase the limit of listeners
Sometimes
But now somehow ok as I made it leave 2 servers
:/
@boreal iron my ss
:)
30000 💀
@boreal iron this is all of my code and the resulting error
Ahh
if(!bot1.voice.channelId){
const axios = require('axios')
async function postData () {
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)
console.log(data)
return }
if (!bot2.voice.channelId) {
const axios = require('axios')
async function postData () {
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)
console.log(data)
return
}
if (!bot3.voice.channelId) {
const axios = require('axios')
async function postData () {
let data = JSON.stringify(
interaction,
(_, value) => typeof value === 'bigint'
? value.toString()
: value
)
console.log(data)
return
}
}```Would these return statements even work?
Oh lord
no, that's not the issue lmao
Also if the channel is the CURRENT one as I see, there’s a property called appPermissions showing you the exact permissions your app currently has in this channel
I have cut out lots of code, i know. It's just as a reference to know if the returns would work
that error must be caused by something else
Dude calm
Can only deal with one at the time especially on mobile
But kept it on a fridge so it's ok now
Sowy
I can understand
While paying out in my server
;(
Just comment out both fetch and permissionsFor lines and see if the error still occurs
Are you using djsv14 neelio?
those are the only two lines in the collector so no error lmao 😎
Just sending
yep!
Ignore the Config file
Then check the property app permissions
interaction.appPermissions
Just giving notes don't worry
It does return the permission but field incl. overwrites of the current channel the slash command has been executed in
i shouldve specified earlier, but the "missing perms" error points to the .fetch line
Show your index where you import your modules
How do i check if a bot is in a vc
Index.js got it
See the VC
Right?
._.
I tested it that way
Hmm doesn’t the bot has VIEW CHANNEL permissions?
in code... and well i have over 25 vc's.
Or could it be a missing intent and you’re missing the entire guild channel object
Hmm
it doesnt have the perms
but thats because im testing what my bot would respond under mismatched perms that other users might set
Well then you can’t fetch the channels
Means you have catch the promise
wait so that means a user could just spam slash commands and throw unavoidable api errors at my bot?
And recognize- ok I’m missing the permissions in that guild
ahhh
Of course bots still require permissions to perform actions
But webhook responses don’t require a send message permission
To respond to your interaction
That’s the reason you either catch the errors in a command handler or at this point
But like I said you don’t need to fetch the channel and/or permissions
That’s what API now provides
Oh that's cool
That’s already some “days” old
okay! i somehow missed this earlier but now i tried it and it worked - no error
how can i use the bitfield tho?
@boreal iron is this wat you are looking for (for me)
._. I am confused as I am new to coding
._.
If you’re not familiar with bitwise operations then I suggest to use the permission flags
https://discord.js.org/#/docs/discord.js/main/class/BitField
For example using <bitfield>.has(<permission resolvable>)
Anyways I need to sleep so bye sorry to disturb man I appreciate your help I will come back tmrw
The resolvable however can be a lot of things but the easiest one might be the permission flags
You can import the PermissionsBitFlags enum from djs
Then using PascalCase as permission names as property
Like PermissionsBitFlags.ManageGuild
This can be passed as argument to the has() method
Also as an array
Ooooooo okay
Of resolvables
Sounds good! Thanks for the help man much appreciated 🙏
👍
That doesn’t show the import your modules at all
Where’s your message event listener?
*stuff
resolving it?
client.guilds.resolve(Id)
This one (no19)?
Line 10, 19, 30
Ok lemme send
3 message event listeners
Oh wait
Ok
That’s not how it works
You only create one event listener then putting your code into it
You don’t create an event listener for each command
Would i have to resolve members the same way?
So: js let member = client.members.resolve(req.body.data.member)
I might misunderstood you here
Do you only speak about resolving or fetching the member at all?
Do you remember the little webserver we created? Well, it returns a member id. I want to fetch the member so i can let the bot join the vc
Ahh resolving the ID should be okay tho
Wait
Actually that’s a different client instance
But once the member has joined the channel it should be known
If you have the right intents enabled
So… resolveId(member id) should work, yeah
It should return a djs member object
wait wha
So this should work?
client.members.resolve or client.members.resolveId
holy fuck what was that code
what
As i said i just made a wuick snippet and had to remove so many things in order to be sent lol
This isn't a thing, the resolve
wasn't talking abt ur code lmao, yours is fine
it's client.members.fetch(id) or am i wrong
The client and the member are in the same guild
so we could use either one of those
Can’t you specify at least ONCE what you’re talking about exactly
Let me specify it for you cutie, well... i am trying to get a member by id. That's all
Yes you’re wrong
Client has no member property
What you want is to resolve a guild member
interaction.guild.members.fetch would work then right
So <guild>.members.resolve()
In this case
You can also fetch the member yeah
Which searches the cache first
i see
Oh wait I’m wrong here
You said you only have the member ID you pass to your second bot, right?
let member = interaction.guild.members.fetch('1008731369435840653')
if(interaction.member.voice.channelId === member.voice.channelId){```So this would be right then? It would check if the member is in the same vc as the bot
yup, also guild id
it's just the interaction object
Ah okay you need fetch then, yes
resolve would resolve an user resolveable or member object to a djs member object
i see, awesome!
Is the ID the ID example is the bot or member?
If it is the bot ID then use fetchMe()
You don’t have to provide the bot member ID then
You need to await fetching
No shit 
anyone know how to use posix on postgres
?
im trying to pattern match starts with and ends with
~ ^(name1|name2) something like this, this only matches the "starts with"
is there a way i can match both? starts and ends?
Sorta
According to the docs they mention something like POSIX-Like-Regex
No idea what that means but I'm sure it's essentially just regex
Sounds like an ugly and limited brother of regex
Wtf you wanna do in a SQL table with regex what LIKE and a few % placeholders can’t do?
Lmao
has anyone worked with react-dnd?
Nope
WHERE col LIKE ‘name1%’ OR col LIKE ‘name2%’

That’s when you use OR to chain your conditions
There’s no regex equivalent in SQL
Like you said
And isn’t needed
If you wanna dynamically set your WHERE clause then store it as string in a var and concat more conditions to it
For example in a loop
Or an user input

Try to formulate this question again
Hmm
I don’t ask
Your question is like what is car in steering wheel or what is planet in ocean

But I see you wanted to know if nodejs is available on rplit
We must be speaking two different languages I guess
Well idk
Never used that platform
dude are you talking about this?
https://nodejs.org/api/repl.html#repl
just search on google
when you are asking for others, give them more details, they are not search engine and they cannot always remember everything or understand your question
SIMILAR TO is what u want
and yes, never ask "what is xxx" if you can easily found the result on internet
SIMILAR TO is similar to LIKE operator, except […]
I like it
Hmm I see just a thing in postgres
it is basically an extension of LIKE that allows both LIKE placeholders and regex operators
Yeah already looked at it, seems to be a nice feature but not really needed
I am thinking about mongodb or postgresql, which one is more suitable for discord bot database
nosql sounds cool but i had never tried before
Depends on what and how you wanna store the data and which one you’re more familiar with
Known good SQL databases are usually highly scalable
Ok great, i guess i can start learning to use nosql such as mongodb, maybe it can be used at future
Might be pain to switch later if you haven’t really got into it
@oak cliff
If you plan on switching in the future, I recommend writing a class or something you use to manage your database, and only use that for making calls to it. That way in the future if you switch, you can just rewrite the database manager rather than all of the places you used your database
Or be like me and just never do that at all
And regret it at some point when you make a change to your tables or remove said tables
😎
import type { Awaitable, ClientEvents, RestEvents } from 'discord.js';
import { client } from '../bot';
type Events = {
[Name in keyof ClientEvents | keyof RestEvents]: Name extends keyof ClientEvents
? ClientEvents[Name]
: Name extends keyof RestEvents
? RestEvents[Name]
: unknown;
};
abstract class BaseEvent<Name extends keyof ClientEvents | keyof RestEvents> {
protected readonly client: typeof client;
public readonly name: Name;
public readonly description: string;
public readonly once?: boolean | undefined;
public readonly rest?: boolean | undefined;
public constructor(
name: Name,
description: string,
once?: boolean | undefined,
rest?: boolean | undefined
) {
this.client = client;
this.name = name;
this.description = description;
this.once = once;
this.rest = rest;
}
public abstract run(...args: Events[Name]): Awaitable<void>;
}
export class DebugEvent extends BaseEvent<'debug'> {
public constructor() {
super('debug', 'lol');
}
run(info: BaseEvent<'debug'>['run'] extends (arg: infer U) => any ? U : never) {
console.log(info, this.client.ws.ping);
}
}
export default BaseEvent;
Hello I am trying to automatically infer my event parameter types within the Event classes. My goal is that I don't need to add any types annotations to my DebugEvent's run function. Right now this thing works assuming I use the annotation BaseEvent<'debug'>['run'] extends (arg: infer U) => any ? U : never, which I want to remove, but if I do that, I get an implicit any error. How can I make my DebugEvent's run function infer the the type based on my event input name?
Now that is some typescript fuckery if I’ve ever seen it
If you explicitly declare something as any, that “implicitly any” error goes away and leaves you alone
Though I’m only half awake so I’m not sure what you’re doing here
I'm trying to update bot count but I've never used Python and theres no Lua examples on the Topgg API
What is the "bot" var in the python example for top.gg stats update example?
The instance of your bot
How do I get that from discord.py do you know?
What? I thought you were using Lua
I am but to update bot count I was going to use PY. Top.gg doesn't have any lua libs
You can’t just intermix two languages that easily
And I have no clue how to interact with api directly
But assuming you’re going to rewrite your bot entirely in python, just follow their docs
Otherwise you’re going to need to interact with the raw api with Lua (it’s not that hard)
Well i’m trying to make it so I don’t have to infer the types of the run function's parameters.
So the parameter types would be Client<true> if my event name is called ready
and my parameter would be a type of string if my event name is debug etc
from lua to python 💀
upgrades people, upgrades!
the damn floor
I'll live with the worms
is there a way to respond to a slash command interaction without actually sending something?
instead of interaction.reply maybe interaction.acknowledge?
Unfortunately not, interactions meant to have a response
ah damn
You could reply and instantly delete the reply but that’s about it
You can technically respond with a defer but
The interaction will be shown as failed after 15 mins then
oof
i used to have some admin cmds that would just react with ✅ when completed but now with slash commands i have to send a whole message 
Well just reply with that emoji as message content
yea i use those and i love em
They disappear anyways once the client closes its discord client
ephemerals are awesome

Does anyone have any idea why discord won't give me the content of any messages? I believe I have the right intents enabled, and I have message intent enabled in the dashboard.
lib?
have you add GatewayIntentBits.MessageContent?
I'm using IntentsBitField, is gatewayintentbits via js as well?
IntentsBitField is the same as GatewayIntensBits
Gotcha, do you know where a list of these intents are?
All I can find is the direct Discord one
export declare enum GatewayIntentBits {
Guilds = 1,
GuildMembers = 2,
GuildBans = 4,
GuildEmojisAndStickers = 8,
GuildIntegrations = 16,
GuildWebhooks = 32,
GuildInvites = 64,
GuildVoiceStates = 128,
GuildPresences = 256,
GuildMessages = 512,
GuildMessageReactions = 1024,
GuildMessageTyping = 2048,
DirectMessages = 4096,
DirectMessageReactions = 8192,
DirectMessageTyping = 16384,
MessageContent = 32768,
GuildScheduledEvents = 65536
}
but DJS uses camelCase
maybe "GuildMessages"?
I'll give them a shot
MessageContent did it, thank you!
I wish there was an easy list to access in their guild 😦
Updating to 14 is a doozy
thanks
11|v6API | src/handlers/subHandlers/getJoke.ts(4,19): error TS2732: Cannot find module '../../localDatabase/jokes.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
But I am already doing this??
show me tsconfig
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"resolveJsonModule": true,
"esModuleInterop": true,
"outDir": "./build",
"rootDir": "./src",
"target": "es6",
"skipLibCheck": true,
"strict": true
}```
Problem is, this works with nodemon, like it runs perfectly, but the moment I try to run it through pm2 I face the above error
you can't natively import json files
what
TS doesn't support importing json files like that natively
Though the option he enabled should allow him
so that is weird
Yea
and it works if I run it with nodemon, but pm2 causes the error for some reason
the server.ts file
Why are you telling pm2 to run a uncompiled file
you could save yourself the trouble and compile it and have pm2 run the compiled script
I tried but compiling just gives me error on running as well
so I decided to save me some time
What error?
wait I'll show
There's some issues with dotenv
dotenv isn't recommended to use in production anyway
Like process.env won't provide the keys
wait then what do I use? I have been using that for quite a while now
dotenv is just a way to force your env file to load globally (iirc)
Well
e.g
export const token = ""
alright
That's just me personally though you can use many other methods
hell I've used yaml files in the past :^)
damn
Thanks man, dotenv was the problem
using a .ts file now it works
._.
I think what you need is help with those 37k notifs
On a serious note, you can use buttons and or select menus
even the traditional reaction menu would work
Ok @sharp geyser tysm
yep
i tried this, but i want the operator to match the first word or the middle word or the last word in the name
for ex: yusuke joker kamado if i search "joker" or "yusuke" or "kamado" this should match
Hey guys

Does anyone know any electron and js docs app in the AppStore?
I would like to have a document to go in some sort of app, but ain’t to be found anywhere
not sure they actually write it to a pdf tho
just save the whole docs as a webpage
you can also just use a browser, we're in 2022
wdym, we are in 2012
@rustic nova help i think my unix time is -1
skill issue much
imagine still stuck in December 31, 1969
Is there any niftier way for me to do this permission checking in Discord JS v14?
They removed Guild#me so now I am left with this option
giiimme a moment
if (!guild.members.me?.permissions.has(PermissionFlagsBits.ViewAuditLog)) return;
That doesn't make it any better 😂
oh
God that is so long just to fetch the bot permission
just use
.me
Doesn't that mean I have to invoke GuildMemberManager anyway?
Which is exactly what Guild#members does
Before v14 you can just do Guild#me
o_-
I can understand the sentiment behind that but god damn the code readability T_T
damn, they nerfed the .me
cant u just do fullname LIKE '%joker%'?
regex is too expensive to waste it at that
Gotta love epoch fails
throw new Error(unrecoverableErrorCodeMap[error.code]);
^
Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
at WebSocketManager.createShards (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:250:15)
at async Client.login (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\Client.js:232:7) {
code: 'DisallowedIntents'
}
Node.js v18.7.0```
Im having a bit of a mare right now I just got finished fixing a bunch of errors then I got stuck on this error for a good hour now. I really hope it isnt asking me to apply for privileged intent and if it is I will uninstall discord and cry in the corner
Exactly as it states, whatever intent that your code is trying to use is not registered yet
I really hope it isnt asking me to apply for privileged intent
guess what?
alright see u all in the afterlife
does anyone know the max height of an embed image?
I found the width(400px max)
I'm new to c++, I don't really know what the problem here
#include <iostream>
using namespace std;
class Player {
public:
bool type;
string places = "";
int wins = 0;
int currentTurn = 0;
};
Player initPlayer(int type) {
Player player;
player.type = type;
return player;
};
int main() {
Player player1 = initPlayer(0);
cout << player1.wins << endl;
return 0;
};
message content, i just had to record a video for discord and upload it to youtube so i thought i would add a funny title
try std::cout << player1.wins << endl; and remove using namespace std; maybe?
it would theoretically be whatever height 5999 new line characters and one random character to prevent string trimming would be in the description
plus images I suppose since those add height
so there is no actual limit, its just capped to the embed max height?
oh embed image. mb
never bothered to test
id imagine none because of aspect ratios
I might just send an embed with a very very tall image with a width of 400 and see what it caps at.
Thank you very much for this nice idea. I did it and everything works
Nice
🧡
uploaded an image 300x8000
its size is 11x300 in discord.
seems the cap is 400x300
Umm any idea how we can choose lavalink server as per region in different different Servers
need some help asap if possible
i store data of users in mongodb, if lots of users use the commands it does this
i also store total data for each user which updates total stats on each command
dont think thats good so i gotta fix it asap
is that a mongodb response or a discord api response?
eitherway there is not much you can do, except reduce the amount of requests you make
pretty sure mongodb
welp i cant haha, its done after every command to save data of user and save total data
you should be batching requests then
(sending requests as one group over a short period of time)
Can you look into this msg
Why
You don’t need a massive lib for that
Just have a counter and update it every x amount of time
How do i check if a loop ended?
for(const key in splitted){```
so how do i check if the splitted is done
It’ll continue on to the next thing after the loop
I know.
the loop will end when it ends
But how do i know if the whole loop is done
Because… it ends…
it'll end after 50k items
I know
I KNOW IT WILL END
it starts with one...
but is there any way to trigger some type of event
to notify me it's done looping
yes
It will continue on to the statements after the loop body
So just emit an event after the loop body
simply put it outside of the loop
I see, so a simple random if statement outside the loop should basically be the 'ready' event as the if statement only fires after the loop?
loops are all* blocking, which means the code will only continue after it's done
- non-promise ones
I see! I never knew that actually
i thought that the code would run the rest before the loop would have ended
So it blocks all the code? In that case that if statement wouldn't even be needed
yes
in js it'll hang the entire runtime until it ends
in multithreaded langs it'll only stop the current thread
code is always synchronous unless you specify otherwise
I am using js and electron combined
I see!
doesn't matter
js being js is monothreaded
alrighty, thanks!
Hey how can I set background colour for a website in replit?
via the background-color property?
you're monothreaded
mono means "single" so...
You're mono
I'm monolithic
Tello World
Bruv i am not saving that kind of data.
how do u know which commands are most used then?
isn't electron js
so you are saying that you are using javascript with javascript

the slash at the end indicates that you were trying to scan a directory, rather than a file
check if it's a directory before proceeding ```js
lstat(path).isDirectory
i forgot if it's callable or not
she forgor 💀
I'm trying to use a random port (2615) for a http server (nodejs/http)
It works fine with ips (ip:2615) but not with a url such as (example.com:2615)
I'm running this on Ubuntu 18
Nevermind
Seems something with Cloudflare
Routed doesn't work
point ur dns server to the IP

when deploying global slash commands, do you need to do it every time you launch your bot? or just once (until you modify them)?
ahhh okay ty!
I'm new to making buttons on Discord.Js language. I have this code so far, but when I click the button interaction fails.
module.exports = {
data: new SlashCommandBuilder()
.setName('ping2')
.setDescription('Replies with Pong2!'),
async execute(interaction) {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('primary')
.setLabel('Primary')
.setStyle(ButtonStyle.Primary),
);
await interaction.reply({ content: 'Pong!', components: [row] });
},
};```
you only need to do it upon making changes or registering a new command, do keep in mind you need to update your commands if you add/change meta-data such as names, descriptions, and options.
ooo alright, thank you!
when u wanna use a domain make sure u point ur cloudflare to the same IP ur hosting on
I know
And I have it like that
how do you get roundtrip ping again?
you send and edit the message then compare times right?
and the port u used the same as the port of your server?
Of course
ok... is there any errors?
Nah

It's with Cloudflare I believe
hold on how are you connecting ur domain?
anyone intrested in starting a collaborative bot project as I am eager to learn further on how to make one
also intrested in being involved in current projects
at any capacity
I like the ambition but if you’re really interested in learning then just go ahead and jump right into it yourself, otherwise you might lose motivation without starting 🙂
Hello,
How can I fetch last message from user DM's? I tried this, but it doesn't work:
const channel = client.channels.cache.get('471724955365801984') // DMS channel
const message2 = channel.messages.fetch({ limit: 1 }).then(messages => {
var lastMessage = messages.first();
console.log(lastMessage)
});
define "didnt work"
That code has nothing to do with your error lol
what should I do
Add either a title, description, or fields to whatever embed you don’t have it on
Ah wait it’s to do with fields specifically
For fields you have to have a title and then a value for it, I don’t believe either can be empty
There we go… localizations has been rolled out
hello guys
never use var
I wanna add more modules to my bot, any ideas?
what about stop adding more stuff and improve the already existing?
also, are u logging command usage?
to know what's used and what's not
I don't know what to improve either💀
yep
my most used commands are snipe, editsnipe and whois
wasn't snipe deemed a privacy concern by discord?
yeah but I made it so u can opt out if u want
that was deemed ok by discord when i talked about them when I verified the bot
not inside the command, but inside the commands description
but well, if you are tracking command usage, give it time to gather some metrics
then see what's most used
besides the snipe commands aren't malicious, meant to be fun
yeah those 3 are the most used
but I've got no ides how to improve snipe, and whois is already really improved
how big is your sample?
let me show you
you talking about the usage amount or the time I collected the usage?
the amount of data collected
I tracked ever since I created the bot so around 2-3 months
well, with that data you can check what's the most used an what's the least
well yeah I told you what's the most used
those 3 are used at least a couple houndred per day
rest are.. in 10ths literally not a lot
and there is only 3 servers using the modules/plugins (and one of them is mine...) lol
@lyric mountain lmfao what...
how come discord allows u to have such large avatars but not embed them? wth
isnt it 8mb?
is it
soo.. bots are not able to display the avatars of some nitro users?
bots are limited to 8mb yes

but no user should have avatars higher than that
then home come this error popped up?
are u doing some kind of resizing?
most likely... let me double check
I wrote this command at the very beginning when i made the bot, haven't edited it since
all I'm doing literally appears to be this:
avatarEmbed.setImage(member.user.displayAvatarURL({ dynamic: true, size: 1024 }));
what should I set it to then?
well, try smaller sizes?
I won't be able to test if it fails then... but fine I'll set it to 512
@lyric mountain can you hack avatars as well?
is there an avatar property when u fetch users details directly?
I've seen some bots do that
Bruh
it would be quite a cool feature to have, no idea what you're laughing about
Looks like I third weekend here😀
this but i want it to accept just a number
Weeled**
anyone?
Modals don’t support other field types (yet)
You have to validate the value yourself
And eventually open the modal again when a wrong value has been entered
modals work without interactions yet or no?
no and never will
yes
I would hope so, but I've been told you cant
Are there any symbolic math solver library in npm?
eval 👀
If you use math.js properly it works well.
but you need to spend time learning it, it does contain several crashes
imo math.js is the way to go.
super powerful
yeah, math.js work for one purpose
but another purpose is to find a variable from formula
so, for example.
V = IR
if I and R is defined, it will be fine
HOW EVER, if V and I is defined, then it will died
Currently, i am using nerdamer + mathjs
Is there anyone who would use such functionality?
Well if you’re having trouble figuring out your basic physics homework then maybe…
i mean i can use wolfram but that thing is scary
it was meant for more difficult formula anyways
doesnt wolfram require a paid license
probably
Ah cool cool, i can do that myself no worries
Either show an (ephemeral) error message, telling the user to enter a valid number or for example respond with the same modal again but adding a placeholder for the field like “please enter a valid number”
That’s as user friendly as possible
Until other field types are available
Yup i did that sir
Currently on mobile but thats how i did it
I wont respond with the modal again, they can just press withdraw again
Yeah makes sense in your case since the button is still available
How should I go about doing a slide in-left animation for my side nav
I was thinking of initially setting it as hidden, but then I am stuck wondering how to make it appear from the left as if it is sliding in
what are u making misty
Have yet to fully thought it out
So I am really just practicing at this point
oh
@boreal iron do you know any css?
Doing things a little bit traditional but that doesn’t mean I’m bad at it
So what’s up?
just having issues trying to figure out this side nav animation thing
There are so many ways to do it, and I can't think of a single one 😔
What do you wanna do?
So essentially I wanna have it start out hidden, and be openable on click of a hamburger "icon"
https://Bot-Inviter-web-1.greendude1.repl.co
What can I add?
._.
Like how to animate the counting or like fill up the info box
The letters are too small
:/
Ye I want to make them karger
Ok
That box around the "Join our community now" just looks bad
It doesn't blend well with the background
So then design the element like how it would look if it’s opened up (on desktop and mobile) then use display: none; to remove it from the DOM, then use some JavaScript animation to fade it in or slide toggle for example
it just is there
It's glitched in I was coding the other boxes and it came out of nowhere
I was already doing this
But I can't seem to get it to even open normally without animations
Oh that’s easy
When clicking your icon you simply change the CSS display property to block
If you don’t wanna use animations
It is not that I don't wanna use animations
I just simply can't even get it to reappear
so why would it work if I added animations
It really is simple, assign your hidden menu element an ID, get the element by its ID when clicking the icon and change its CSS property
Clicking it then again changes the property back to hidden
I have ALREADY tried that
Ok if that doesn’t work you did something wrong 
I mean you can figure out what’s going on using the browser inspect tools
What’s actually not working for you exactly? Changing the CSS property?
I don't even know whats happening at this point. It changes the value of display, but still does nothing
It's like it isn't registering the change
It is assigned when using the inspect tools?
From when I looked at it yes
Can you show how it “looks like” in your inspect tools?
Also when editing the CSS property directly without the click event, does it show up then?
Okay so found the issue
😎
I was treating getElementById like querySelector where if you are searching for a class you need to use the respective prefix e.g .
so removing # from the id in the getElementById worked
Ah lol
Also
Any idea on how I can hide the nav once I click outside of it's area of influence
I can probably use a event listener on a class that holds the main content of the page
and if its clicked and the display of the nav is not none I will hide it
Yeah you actually create an event listener for the DOM comparing on a click if you clicked anything in the container or not
the event itself contains the element you clicked as part of its properties
Also consider to use a var in your code saving the current opening status
Actually that makes sense
import {Component, Inject, OnInit} from '@angular/core';
import {DOCUMENT} from "@angular/common";
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit {
constructor(@Inject(DOCUMENT) private document: Document) { }
onClick() {
const nav = this.document.getElementById('nav-container')!
const hamburger = this.document.getElementById('nav-hamburger')!
nav.style.display = 'inline-block'
hamburger.style.display = 'none'
}
ngOnInit(): void {
}
}
this is how I am currently doing it
I am treating this as if I am using vanilla js
😔
I could do this better
Make sure to also check if the clicked element (for example one inside your container) is a child of the container
To not falsely closing the container when clicking one of its children
Sadly can’t show you how I’m doing it atm from mobile but we can get back to this later this evening if you remind me
While I’m also working with native JS I’m also using jQuery especially for manipulating element’s CSS properties and for simple but neat animations
private void drawDialogueScreen () {
int newLines = 0;
if (currentDialogue.split("\n").length == 2) {
newLines = 1;
} else if (currentDialogue.split("\n").length == 3) {
newLines = 2;
} else if (currentDialogue.split("\n").length == 4) {
newLines = 3;
};
int dialogueX = gamePanel.tileSize * 2;
int dialogueY = gamePanel.tileSize / 2;
int dialogueWidth = gamePanel.screenWidth - (gamePanel.tileSize * 4);
int dialogueHeight = gamePanel.tileSize * (newLines + 2);
drawSubWindow(dialogueX, dialogueY, dialogueWidth, dialogueHeight);
graphics2D.setFont(graphics2D.getFont().deriveFont(Font.PLAIN, 21F));
int textX = dialogueX + gamePanel.tileSize;
int textY = dialogueY + gamePanel.tileSize;
for (String line : currentDialogue.split("\n")) {
graphics2D.drawString(line, textX, textY);
textY += 40;
};
};
Is there a better way to handle newLines?
The; first; step {
would; be; to; stop; putting; semicolons; everywhere;
};
I mean, I like semicolons. ;-;
Don't put them after brackets pls 
Maybe ```java
int length = currentDialogue.split("\n").length;
int newLines = length == 2 ? 1 : length == 3 ? 2 : length == 4 ? 3 : 0;
I guess.
angular 
Wym
onClick
I am simply selecting a span tag essentially
you can just do as state
<div>
<span id="nav-hamburger" (click)="onClick()" class="nav-hamburger">|||</span>
<nav id="nav-container" class="nav-container">
<ul>
<li>
Hello, World
</li>
</ul>
</nav>
</div>
trying to figure out this stuff
so
and reflect it in the template
bad html
Wait wut
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit {
constructor() { }
isMenuOpen = false;
onClick() {
this.isMenuOpen = !this.isMenuOpen;
}
ngOnInit(): void {
}
}
and in html template
<div>
<span [style.display]="isMenuOpen ? 'none' : 'block'" (click)="onClick()">|||</span>
<nav [style.display]="isMenuOpen ? 'inline-block' : 'none'">
<ul>
<li>
Hello, World
</li>
</ul>
</nav>
</div>
it's a shame that you still use document for manual element manipulation
smh
also
your code may result in render mismatch error
alright try it
by the way
there's even a cleaner way
nvm it's there
i forgot that the element must be there and not conditionally appears
if you want the element to only appear in the dom when matches certain conditions
you can use ngIf directive
Does it matter where it appears and when
that depends on placement and layout
Mmm
I was planning on having a container right next to where the navbar would be and have the navbar overlap the other content when it appears
say
<main>
<login-form *ngIf="userIsNotLoggedIn"></login-form>
<user-profile *ngElse></user-profile>
<main>
like this
Yea that makes sense
oh
you can use
the good old
absolute positioned box over relative navbar
Mmm
Well the navbar covers the entire hight of the screen but only 20% of the width
I gotta find a way to animate the navbar coming out from the side tho
time to learn about angular animations
I haven't used animations much
👀
yeah
sounds like fun
it's boilerplate
💀
essentially you wanna define transitions
form void => * and * => void
void means the component is destroyed
make sure the parent is relative
i swear it's simple*

@civic scrolldo you pay for webstorm??
yes
css?
only set margin of one side
body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100vh;
font-family: Arial, Helvetica, sans-serif;
background-color: rgb(28, 31, 36)
}
h1{
color: rgb(0, 136, 18);
}
input {
margin: 20px;
width: 300px;
height: 40px;
border: none;
border-radius: 7px;
background-color: rgba(0,0,0,0.7);
color: white;
font-size: 18px;
}
button {
margin: 20px;
width: 300px;
height: 40px;
border: none;
border-radius: 7px;
background-color: #000000;
color: white;
font-size: 18px;
cursor: pointer;
}
i see, thanks!
its the button & input margin
input {
margin-top: 20px;
margin-inline: 20px; /* if you wanna retain horizontal margin */
}
yeah
thank you guys!
what's the difference between vscode?
or other code editor
I know it's an IDE but I want to know..
if you noticed a big change
faster and accurate tooling
like code completion and types
plus tools are like
native
they feel fast
while vscode relies on plugins
hmm
whats does ?? do?
i love how it's called "nullish"
https://Bot-Inviter-web-1.greendude1.repl.co
Can anyone give me a Unicode so that I can fill up the box with numbers at the bottom (Information)
what do you mean
I mean like the number 12.
I want it in the form of like one of those fancy big msg with some blocks so that I can fill that box in my web up
use span elements
Is this here only js?
ah okay ty

What does this mean, exactly? https://cdn.hamoodihajjiri.com/cPAiHTKcRF
Means something was null when it shouldn't have been
if you're using intellij, possibly-null values will be highlighted in yellow
IJ is quite smart regarding warnings, don't ignore them
It’s the equivalent of trying to call a property or method on a null/undefined variable in js
Figured it out. 👍
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');
module.exports = {
name: 'console',
description: 'Developer Mode!',
voiceChannel: false,
options: [
{
name: 'Code',
description: 'A line of code you wish to execute',
type: ApplicationCommandOptionType.String,
required: true,
}
],
async execute({ inter }) {
const LineOfCode = ms(inter.options.getString('Code'));
if ((inter.options) == 'test') {
const embed = new EmbedBuilder()
.setColor('#5679EF')
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setTitle("💻 Console")
.setDescription(`the test worked`)
}
else {
const failembed = new EmbedBuilder()
.setColor('#5679EF')
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setTitle("💻 Console")
.setDescription(`the test failed`)
}
},
};```
So, this is my code, I am very new to slash commands and v14 as a whole so all of this is extremely experimental and a guess to be totally honest. I tried using some of my knowledge of python to help me achieve this but it failed horribly.
I basically want it to work in a way where if you enter a certain string, it returns a certain message and when I ran the bot it basically crashed and sent a really long error message (which i cant paste here since it is so long)
paste it in a txt file and upload that
And how does this actually get applied
<element [@AnimationName]="state / condition?"></element>
<element [@AnimationName]></element>
Mmm ok
you fucking donut, I meant the error
Sorry that was a bit harsh
you already gave the code, so I don't need it twice
Does someone know how to get Username from a UserID in discord.js v14? example 745619551865012274 turns into 0x4096#7678
fetch the user






