#development
1 messages · Page 1477 of 1
use cache before get
yay thanks
If you use git you can just go back to your previous commit. actually any commit
Server count posted!
congratulations
bruh when did i said that
I kinda had a feeling that you are gonna
noooooooooooo
?
No Advertising
when
No Advertising
i just showed pic
see rules
😊
sup ?
yeah so close
who deleted the message
He just realized he was in wrong channel
bruh when i send . it deletes it
?
hi
const id = args[0]
message.channel.send("e")
await message.guild.members.unban(id)
i have this
and it should perfectly work
but it isnt
and its annoying me
for some weird af reason im getting this error UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
try .toString()
ok i realized something
the reason i got that was
catch(e)
{
message.channel.send(e)
}
i had this
but shouldnt that also send the error
actually nvm im dumb
i had to log that
do you know how to unban user not using id?
nope
however im getting this now
TypeError: Cannot read property 'id' of undefined
i thought this would work:
const user = message.mentions.users.first()
const member = message.client.users.fetch(user.id)
await message.guild.members.unban(member)
but it isnt
im getting the id err again
that means there's no user found in the mentions
if you didn't mention a user then it should be empty
thats the point
idk whats wrong with my bot
i found this somewhere
Servers do not have users, they have MEMBERS, so use
message.mentions.members.first().id
which implies that users is useless cuz cmds will always be used in servers
Don't use message.mentions.members.first() to ban or kick it causes serious trouble
im using users cuz thats what worked before
but it isnt working now
console.log(message.mentions.users.first().id) gives me the cannot find 'id' of undefined error
can't you just use id to fetch user
okay let's say the bot sees the message like this
!unban @glossy raptor
so take the second argument and catch the user with the id (remove <, > and @)
you have to first check if .first() returns anything
let id = args[0] user = message.client.users.fetch(id)
btw thats how its done right
@near stratus
no it contains < @ and >
you can remove them and try
kk
hold on
let id = args[0]
user = message.client.users.fetch(id)
this also works
try :
let id = args[1];
message.guild.members.unban(id);
while doing this
but how do i get the username
you don't
console.log(message.mentions.users.first().username) is giving an err again
bruh
shouldnt that work
why do you need the username again
for the embed
anyway that should work
no
it shouldn't work
even that isnt working
are you even mentioning ?
if you mention someone that should work
even in the server ?
yea
gimme a moment
ok
You can't mention someone who is banned
or not in server
I sus
im showing that the acc is banned
yeah test if first() is returning anything
Hey, check if guild member intent is turned on
Hey guys. Just now, Discord updated discord.js library.
member.hasPermission(“ADMINISTRATOR”) has now been replaced with member.permissions.has(“ADMINISTRATOR”)
Any bot using this permission validation is now buggy by default so go update your buggy codes lmao 😂
CodeBreaker ... name checks out
I try my best Thomas
good to know. but i use permissions.has now for a while bcs the other way where buggy for me since ive use V12
No, that's Permissions#hasPermission() and Permissions#hasPermissions(). It doesn't apply to GuildMember#hasPermission() since it includes other checks which GuildMember#permissions.has() doesn't do
First of all, on what condition would you ever want to use GuildMember#hasPermission()?
If your bot is subscribed to a message event for example !kick @user, and you want to validate admin previledges on the member who made the call then it's message.member.hasPermissions not message.guildmember.hasPermissions coz that doesn't work
What?
second of all, my bot was declined because of this issue that's why am posting it here. But feel free to use whatever works for you
Not sure what you mean by message.guildmember.hasPermissions but okay
Error [SHARDING_NO_CHILD_EXISTS]: Shard 2 has no active process or worker.
How to repair this?
Ping me when u have a anwser xD
My beta bot keeps going online and offline i hosted it on uptime robot
why is that?
I have a original bot hosted there but my beta bot keeps going online and offline
(Its really unstable ngl)
Both bots are hosted on uptime robot?
Hold on a second
You can host bot on Uptime Robot ?
yea
wasn't it for pings ?
what ?
mindblowing, right
bruh
And I spent 5 minutes searching if they changed their services and found that NO
They don't host.
They just ping the host
in ts, I've a readonly array how do I create a variable whose value can be only from this array?
why do you need to do that
can't you just pass values directly from that array instead ?
so check if it's in that array and throw if it's not ?
i mean if you have 'foo' in that array and 'foo' in a different variable isn't it the same thing ?
hmmm hmm, i got it
like you could make that array a separate type and then have the parameter of that type
but if somebody passes a different instance of that type it might break
¯_(ツ)_/¯
since emojis are in the format:
<:python_is_gay:id>
would it be a good idea to use regex for this or parseInt since the snowflake can be parsed out as it's a number but discord names emojis uploaded on mobile as emote_somenumber by default so that might cause problems
string.match(/\d*/);
don't discord libs already parse emojis for you ?
I have a normal string and want to parse the emoji from it
like /<a?:\w+:(\d{17,18})>/g
@earnest phoenix https://stackoverflow.com/a/64064778
i googled for discord emojis in message
why is this not working
client.on('message', message => {
(channel => channel.name === 'akame-logs' + message.channel.send(console.log))
how does it not work? do you get an error ?
no errors
you shouldn't do that in the first place tf
@lucid prawn what are you even trying to do
get a proper logger, don't log to discord
/ - start of regex
<
a? a is optional
:
\w+ 0-9 a-z one character or above
:
(\d{17,18}) 17-18 digit long for snowflakes
/ - close of regex
g - global modifier to match all
especially not on every message
i want everything in log to send to a channel
that would cause an infinite loop
detect message => send message
and WHY are you doing that anyways
because it will be loging my anti spam

Asking about your attempted solution rather than your actual problem
const { name, region, memberCount, owner, afkTimeout } = guild
^
TypeError: Cannot destructure property 'name' of 'guild' as it is undefined.
at Client.<anonymous> (/home/runner/SmoggyAffectionateCygwin/index.js:372:11)
at Client.emit (events.js:327:22)
at Client.EventEmitter.emit (domain.js:483:12)
at MessageCreateAction.handle (/home/runner/SmoggyAffectionateCygwin/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/runner/SmoggyAffectionateCygwin/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/runner/SmoggyAffectionateCygwin/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/runner/SmoggyAffectionateCygwin/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/runner/SmoggyAffectionateCygwin/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/runner/SmoggyAffectionateCygwin/node_modules/ws/lib/event-target.js:132:16)
@lucid prawn ahh did you get muted in djs too?
i didnt get muted
can you send your code again
no code for that
@lucid prawn guild is undefined; not because you never defined it but because the value you set to it was undefined
so how do i defind it
can you send the code where you defined guild@insane-personality#5066
@lucid prawn
fuck mentions
const { guild } = message
const guild = client.guilds.cache.get("772658962112839680");
brb going to get on my laptop @earnest phoenix
@lucid prawn why are you defining it twice
const guild = client.guilds.cache.get("772658962112839680");
``` just added that
the guild is not cached
try using fetch and awaiting it
const guild = await client.guilds.fetch("id");
ok#
Guilds should always be cached in discord.js since the gateway always sends GUILD_CREATE for every available guild.
fetch is usually implemented for partials
@lament rock yeah but you never know
client.on(`message`, message => {
let channel = client.channels.cache.get("791613097076195370")
if(!channel) return
channel.send(console.error)
let findchannel = client.channels.cache.find(channel => channel.name === '⛔akame-logs')
if(!findchannel) return
findchannel.send(console.log)
})
how do i get it not to say
function () { [native code] }
function () { [native code] }
You have two names that are guild
I told you so many times, console.log is a function and you're sending the code of that function to the channel
@lucid prawn are you pretty experienced with javascript or are you just starting out
Clearly starting out
no
well greenname
doesn't really mean anything tbh
Just like how my literally USELESS bot got approved by stinky marco
im sure they'll reject my actually good bot with an actual purpose
@pure lion I got a bot with 1 command get verified
console.log(user.id)
})```
this only returns the bot's id and my id
even though there are so many more members
can someone help?
member intent moment?
rtfd
how about i just keep trying things until it works
You need the presence intent enabled to get an entire list of members sent on ready
m.delete({ timeout:5000 })```
guys, can someone help?
*member intent enabled
member intent is for guild member create, delete and update
and i can't "unhost" my bot, mf doesnt even start now
guild presences is what sends the entire member list on guild create
wat
where did you host it in the first place ?
doesn't fetchAllMembers only work with guild presences enabled?
Otherwise, the request will timeout
I guess not
Oh. Interesting
you need it for presences though
Of course
Did you set worker ?
Yes
then it should run
App not compatible with buildpack: https://github.com/heroku/heroku-buildpack-python
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: b9d08a15607ae0437be9dae0495ab34ec3fc1b4e
remote: !
remote: ! We have detected that you have triggered a build from source code with version b9d08a15607ae0437be9dae0495ab34ec3fc1b4e
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
but even after setting it
i get the same error
I just wish for discord to allow users to fetch member presences without the intent like what they did to users/members
but presences are just not from REST
so I can understand that
hold on a second
PLEASE STAHP USING HEROKU
how are you hosting ?
with GitHub or command line ?
I mean you can still search for members using queries via WS without the guild members intent
no
Heroku 
READ THIS
what's the difference
aye thank ye
lmao
idk man I wouldn't want to hear it from you
the git works differently
idk i wouldn't wanna hear it either
git hub ?
yeah
then just add a comment somewhere and commit
but before
use git pull
then commit > push
Then start dreaming about 100% uptime
fr
I don't trust my internet service at least
me neither
I don't trust my electric company.
Get a VPS
he's trying free
yesterday my internet died, never happened before, and right at the moment the br wanted to review my bot
fuck my life
Don't say you cant get a vps because no money, you have nitro and are a booster
F
damn, i got nitro for 1 dollar
...
||f|| ||u|| ||q|| ||u||
and i got 2 boosts with it
fug those VPS repl is getting 100% uptime with 7$ per month from January

you killed him bro
true 100% uptime doesn't exist
there's never an ideal condition to have 100% uptime
I had 100% on AWS but the shit was complicated as hell
maybe on your app/vm
but not on a discord bot
and even then
your app/vm is granted to crash someday
nothing is ideal in the real world
even Google didn't have 100% uptime this month
20 mins off
exactly
nothing does
We all know 100% uptime doesn't exist because of the insane amount of offline declines in #mod-logs
lmfao
some kids don't even code the bot.
They create an application from Dev portal and come to top.gg to add it
sigh kids these days forever
I watched a YouTube video saying How to make a discord bot without coding lol
bit like people adding botghost bots lol
lol
@earnest phoenix wouldn't you have to refetch the role after creating
You got the role object then created a new role but then ur adding the old role object instead of the new one
Oooh, he right
It was code who helped, I was just a bystander lol


:))
Thx
Guild members intent moment?
ye
ENOTFOUND sounds like the machine running the bot is either not connected to the internet or is trying to connect behind a firewall and discord.com is blocked
someone probably turned off their wifi
lawl
(that url is the url the gateway tries to request to get the websocket url to connect to)
also lol. Api v7. Update your lib to use api v8 since v6/7 are deprecated
discord.js uses API v7 until the next major release
v12 still uses api/gateway v7?
yes
you sure you have the intent enabled in developer portal?
no errors but not working
hey guys
allItems = fs.readFileSync("./cart.txt", "utf8").split("\n").map(x => x.split(/ +/))
console.log(allItems)
let filtered = allItems.filter(x => x[0] === message.author.id)
let final = filtered.map(x => x[1]).join("\n")``` these are my variables. Allitems contains all arrays of users. The filtered is just an array of 1 user. I am trying to remove the filtered from the allitmes.
how would i do that?
You'll wanna loop over allItems and splice out entries which satisfy constraints which you can determine based on if there is an entry in filtered which matches the current
This will be a NodeJS question.
I'm looking to possibly integrate the worker_threads built in module into my gateway and main worker to reduce single threaded stress on multi-core platforms. I wanna know if it's more taxing on the system to spawn multiple threads on single core systems versus just having it all be on a single thread or if the scheduler is able to delegate cpu time as efficiently in either scenario
so you want to force a single threated application multi threaded?
it will probably will have a tax on the host system. since you add more stuff to the chain
It'll mostly just be IPC between the gateway and main worker, just sharing the same memory space
i never looked into this tbh, i rather learn a multi threaded language than adding more headache to something that will maybe work but at what cost.
or look into microservices.
Micro services is what I'm using currently, but I'm not sure if it would be more beneficial to IPC over http between the gateway worker and the main worker or to have the gateway and main share the same memory space just be on different threads
any answers?
you will probably get some better IPC out of it, but im not sure if its worth the hassle
also possible that you gain only 1-2% IPC improvement
i know that Brain got his Bot I/O locked while using C+, so its possible that offloading stuff to a different thread gets you also I/O limited
Actually. You're probably right but for a different reason to continue to use micro services. I do have to restart the main worker sometimes and having to restart the gateway as well would be pretty taxing on the cache worker once all of the asynchronous events get emitted
what are you attempting to do?
multithreading
offloading stuff on a different Thread to improve IPC
I think I could still make use of worker threads in different areas at least. I meant to make a worker to handle image manipulation, but
maybe look into a multi threaded Language, they can also be made in Micro service style but with the benefit to have stuff like your main worker in itself Multi threaded.
any suggestions
i have no bot that require me to get better IPC or Micro Services since i have 1 Shard
fair enough. I'm not at the point of absolutely requiring multi threading, but I plan to future proof since clustering multiple ws connections on a single thread can be very taxing down the line
would love to help you tho
i dont expect that my bot gets past 500 Guilds so im fine
You might surprise yourself
im stuck now for 4 Months at around 300 Guilds
also the Game ive made the Bot for is about to die
I was at a similar situation until YouTube started banning IPs of larger bots, which caused a pretty big surge. https://amanda.moe/to/stats
Ultimately, it was out of my control, but demand may increase or may not. Never know. You better be ready if it explodes though.
i dont think it will blow up. since its a niche with already some other way larger bots that do most of the same stuff.
i did like the bot reads every msg and if the msg is "this or that" then it responds (bot). is that (conversation) gonna save in my pc?
what
plz tell me this fast urgent needed
What do you mean? It's hard to understand what you're saying.
someone knows how to put a bot 24/7
rent a vps
use a vps
How much does it cost
you pay what you get. so between 3-7$/Month usually
Ok thanks
is there any alternative to user.roles.cache.has(level5) level5 is a role and ``user is a user`
What do you mean
like cache returns undefined sometimes right
is hter any other method to see if a user has a role?
fetch the user before trying to interact with it i guess
fetch the member?
i do fetch the member
const user = await client.users.fetch(`${member.id}`) and member is from a promis
That's a user
yes and im fetching the user righ?
message.guild.members.fetch?
yes
got it thanks
i coded sry mom called i mean when i runs the code it shows every single msg of server and i coded like if the msg is = .ping then bot responds
so i have confusion that those conversation will save in my pc or
didn't you use message.content == ".ping"
They will not be saved to your PC. They only show up in your console until the console window is cleared or exited.
alr ty
@near stratus i did like this
``if (msg.equals(".ping"))
{
channel.sendMessage("pong!").queue();
}
``
@near stratus i use java
bruh
Hey I don't know why my bot is giving me ping 10K ms
Shards: 5
Guilds: 2156
Hosting: Microsoft Azure (2 CPU, 4GB RAM)
I didn't face that problem when I had like 1500 servers
how are you on 5 shards but you don't have enough guilds to shard in the first place 🤔
I know it's 2800 guilds
@vague imp This is not a fun channel
not guaranteed
yep
@cinder stratus answering to him

sharding is per 2500 guilds; Not 2800
you should let your library handle the amount of shards
2 shards
which lib are you using
You can shard auto then if you are predefining shard then you can shard 5 server too
I use kurasuta
I once divided my 1000 server in 2 shard
Unless you are growing very quickly, then you should not use more than 2 shards currently
Just by predefining number of shard
god that lib is trash
how are you calculating the ping
Where is the server located geographically
also that

i mean
it won't be the same as doing a REST request to create a message
simply pinging the api is doing a GET and out, isn't the same as POSTing for a message and waiting for it to be created and returned to you
I mean the Bot Latency not the api one
It will help in find out what's the actual ping
no it won't
my api latency is 18ms which is good
gateway latency is different than rest
@cinder stratus is your bot response is slow?
Oh then your server is really close to US-east
U are using discord.js
yeah
?
you shouldn't compare timestamps
yep
Zlib-sync and etc
yeah
I see
I'd probably explain the latency as network congestion or some other side effect of using 5 shards at such a small scale
measure ping with Date.now()
Date.now(); // store in a variable
await send();
Date.now() - previousDateNow; // this is your actual REST ping
for comparing bot latency?
gateway websocket latency would be different since it's independent of the rest, but how you calculate rest latency currently is not technically correct
hmm
const previousDate = Date.now();
const msg = await message.channel.send('Pinging...');
const latency = Date.now() - previousDate;
msg.edit(`Bot Latency: \`${latency}ms\`, API Latency: \`${Math.round(this.client.ws.ping)}ms\``);
Looks good, yeah.
but still what to do about the ping issue
Actually, your naming for the latency types are incorrect
Bot latency should be renamed to Rest latency and API latency should be renamed to Gateway latency
yes it's hosted in us-east
ok
I did that because some people are idiot
they don't understand technical things
Some people don't have to understand it. You should be honest with what it is instead of trying to sugar coat it
But still the rest latency is high what should I do about it?
Hey, do you guys know any tutorial to do a multiselect input field like the carl bot has in its dashboard?
It'll always be higher than ws latency
but it's responding very slow
Try not using 5 shards
But at some point I have to use 5 shards
At some point, sure but that's at 10k guilds
Has anybody api like that:
Gives me image with code (to make verification)
And this code in string
const cheweyBotAnalyticsAPI=require("discord-bot-analytics")
const customAnalytics = new cheweyBotAnalyticsAPI("YOUR API TOKEN", client)
Can Anyone tell me what this is how do i onnect discord bot to website
what website
Have you tried, like, rtfm? https://www.npmjs.com/package/discord-bot-analytics
Probably not, try generate your own images with canvas.
still high @lament rock
Remind me what your bot's rest latency is
It was much lower when I hosted my bot on google cloud
gateway one was around 10ms
You started this conversation by saying it was 10k ms ping so we literally thought you had 10 second pings.
This is still within normal operating parameters.
yeah the old method showed around 80ms
when it was on google cloud
the timestamp
Well yo'ure just on a slightly slower internet connection
hmm
there's nothing to "Fix" here, other than "choose a lower latency host"
You guys don´t happen to know a tutorial for this do you? I just want something where i can have all selected ones listed with a little x to remove them but also add new stuff via an input field
I think I should get some more money and again move to google cloud
oh you're on a free or really cheap host? yeah that would explain it.
i'm on cheap host and my latency is like 20ms.
If it were me I'd literally look at the source code and figure it out, or look for a framework that gives me that feature (like, I dunno, bootstrap or something, depends on how you write stuff)
It should be pretty easy to do if you are using a framework like react or vue
oh yeah with react it would be super simple
Discord is hosted inside AWS. So how it's the worst? It should be the best.
"should" doesn't reflect reality
I just do basic html with bootstrap, but i haven´t been able to find something using only bootstrap and maybe jquery and looking through the Source is a pain
Yeah, but i am just doing some basic stuff right now and was hoping there was an easy solution
I am also using php for the backend, so yeah
I know I know I'm saying "go learn a framework!!!" but truly, really, seriously, all you need is create-react-app and maybe, I dunno, tailwindcss or chakra or something, and you are in for a treat of development
and your back-end can then be purely a REST API and have no bearing on what your front-end looks like
which is how it should be
Thanks, i will look into that
CRA 🤢
For starters, cry
even though i am really bad when it comes to designing things xD
c'mon you can't expect the first step of someone into react to be a fully customized snowpack+babel+plugins setup
but yeah, that doesn´t change with using a framework or not, so thanks for the tip!
So am I, I absolutely suck at UX. I have a friend that helps me out by fixing my CSS 😂
I copy/paste boilerplate to make it look half decent
and I concentrate on code to make things work
Just look at the website i am working on xD
I looks like a pile of shit, but it does its job
I use bootstrap for almost everything visually - then I just reskin it
Me too
But i am able to reskin it so badly it looks crappy
@umbral zealot same I also copy/paste boilerplate
material-ui is my togo UI framework
I suck at front-end
super stylable and it looks good out of the box
how come
when was the last time you used it 🤔
"oh sorry you wanted a nice navbar? HAH sorry, no"
i built multiple apps with MUI and all of them look super nice
it's made to look like an android app or iphone app
try flutter
like I said, my opinion, and I'm highly opinionated
right now I'm trying out tailwind, it seems to be... nice enough
web dev is it's own field for a reason. It isn't as simple to make a nice website as it is to make a bot that responds to !ping
it's not that bad. it's readable and clean.
i built a simple todo with MUI https://cryy.github.io/todo/
The login looks like something out of the 80s
and one of my electron apps is also MUI
case in point. Looks great on mobile. doesn't look nice in full wide 1080p screens.
This is fine
this... isn't. not as good. it's clearly mobile-first design.
And that's where I don't like MUI, because it's mobile FIRST. instead of being mobile-friendly.
I do responsive designs, I don't do apps for mobiles that somehow still function on my PC, y'know? 😛
need to get into react. had first the idea to use plain HTML /CSS/jquery but its annoying to use, then ive had the idea to switch to express together with express-headers but react looks way better.
React is just goddamn amazing
Yeah, i´ll start learning react until family is here
this is an electron app built entirely with MUI, looks pretty good on all viewports
I was hired as a web developer with react and I literally had no experience with it. And within 2 years I was basically senior level in knowledge. And that's not because I'm super smart or anything, it's because react is so goddamn easy.
any recomended toolchain for React?
Well, i also have like 0 experience in js alone, so
I´ll see where it goes xD
Take react and add styled-components and what you have is basically as enjoyable as working with pure html, css, and javascript. Because, well, there's no special snowflake "decorators" and shit, so you have pure JS. Then your "HTML" is the JSX, basically xml that's just different names (but can mostly be pure html, with the occasional "Component" in it). And styled-components gives you that nice pure CSS syntax with a bit of js sprinkled in
for example, here's my "home" for my blog: https://text.evie.codes/okaxeyimiq.js
and more
i sill dont understand what forwardref does 
oh yeah react-router-dom. gorgeous.
client-side routing is beautiful
angular seems nice aswell but it doesn't seem to give me as much freedom as react does
So, React + Styled-Components + react-router-dom. If you need "global state management" don't go with redux, take a look at zustand it's just as powerful and much, much simpler. If you want to integrate a CSS Framework, there's a lot of choices, though, so you'll have to explore around.
yeah SPA's are great, but make SEO a lot harder
no angular is absolute horseshit omg.
recoil is also worth checking out for global state management
i fell in love with it the moment i tried it
you can do some simple SSR (server side rendering) to account for SEO, no problem.
thanks, will look into it
like, render the main page server-side and the rest is client-side?
imho zustand has one big advantage: you can actually use the state outside of components, if you need to 😛
good point
does anyone knows how to change background color of bot or server page?
but i mean you can always create a ghost component that just acts as a "portal"
search for the class of the background color
basically yes, pre-render a full html from the server-side. So, you get a faster pre-render of the site when someone loads it as a bonus, your SEO works, and all you have in your FE is "the interaction". So, it's pretty great.
and switching between routes is pretty much seamless
so it makes it look like a native app
yes but... see, this is in my App.js, outside of the components, it's just... loading my profile on page load: ```js
import userStore from './store/userStore';
const { me, setUser } = userStore.getState();
me().then((user) => {
if (user?.isLoaded) {
setUser(user);
}
});
I don't need a component for this. no hook. no complicated loading shit. This is all I need to know if my user is logged in if they load or refresh the page.
it just sits there and does its damn job 😄
Man, if i use a REST-API for the Backend, i could actually implement it directly into my bot... Would make a lot of things really easy
i use a rest api for transferring stats between bot n site
yeah after I'm done this blog platform I really gotta do a bot dashboard
my old one still uses EJS. shudders
gasp
That is what i plan on doing with the website, to some extent i already got it working, however, i am struggling with multi-selects
hello
how about making a validation middleware?
I Want to make a website and want to store my discord bot analytics on the website how will i do that?
learn backend stuff
IK But whats the best keyword to searcch it?
no
learn express first
how would i delete a specific users messages without going over any other messages, just that one users in discord.py.
my backend is really messy... I have one function i always have to look at the code, because i always forget what it does. Even though the name is a good one, as it describes what it does...
Oh my, functional react lul
functional react is best react
I find classes more organised
I just use pug
Like, nothing against but funcional is getting discontinued
I thought so at first but then I started using redux and mapStateToProps and willComponentRender and willComponentUnmount and omgHowManyFuckingFunctionsCanYouHave and I just tableflipped.
what? no. classes are obsolete, functional react is the future
you have it the wrong way around
functional is newer
Hooks are the future, everything is going to hooks, that's how it is
Well, to each one their own
functional programming 💪
There's nothing inherently wrong with the class-based methods of react
But the team is aiming to make things faster and more efficient with functions
things they just can't do with classes
It's literally my job to know these things and to stay aware of the technologies, y'know 😂
**i figured out How to get my bot analytics now i want to connect it to my website.
here is the api info https://api.chewey-bot.top/analytics/getlatest/664103404963889168 **
Weird flex but ok
Congrats.
Nice caching and rate limiting @earnest phoenix
That's the api they're using, not their code
if you think they could write an API you haven't been following their journey 😂
Oh 😂
yikes
let name = arr[i].slice(0, -5)
let user = await msg.guild.members.fetch({ query: name, limit: 1 })
.then(console.log)
.catch(console.error);
if(user) console.log(user.first())```
Name is tag, idk what I am doing wrong but it console logs `Collection(0) [Map] {}`
aren't you awaiting the catch
Sorry?
Doesnt know what they mean 😂
Free nordvpn premium lul

His status
says a Google Pfp user
ngnl < code geass
Different genres, can't compare a toast to a banana
sure lol
yes
you're a script kiddie you have no rights to talk :omegalul:
excuse me?
hi
hello
NGNL is meh but it's entertaining at most
I would say better then other isekais
The thing is that ngnl stopped too soon
erm this is development why we oof toopic
anime is superior
^

3-1 we win
3 2
dang
💀
we still have the high ground


I can't read that not that I can help you
not workin\

It doesn't work anymore since the gateway update
``package store;
import javax.security.auth.login.LoginException;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
public class Start {
public static String prefix = ".";
public static void main(String[] args, Object Game) throws LoginException
{
JDABuilder builder = new JDABuilder();
builder.setToken("Your-Token-Goes-Here");
builder.setStatus(OnlineStatus.ONLINE);
builder.addEventListeners(new GuildMessageReceivedEvent(null, 0, null));
builder.build();
}
}
oo
may u tell me plz
Use the new builder
JDABuilder.create() iirc
You're using intellij, just press ctrl + space
opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){ret
RangeError: Source is too large
at Uint8Array.set (<anonymous>)
at OpusScript.decode (C:\Users\gamin\node_modules\opusscript\index.js:78:17)
at Decoder._decode (C:\Users\gamin\Documents\med1\node_modules\prism-media\src\opus\Opus.js:64:25)
at Decoder._transform (C:\Users\gamin\Documents\med1\node_modules\prism-media\src\opus\Opus.js:189:20)
at Decoder.Transform._read (_stream_transform.js:191:10)
at Decoder.Transform._write (_stream_transform.js:179:12)
at doWrite (_stream_writable.js:441:12)
at writeOrBuffer (_stream_writable.js:425:5)
at Decoder.Writable.write (_stream_writable.js:316:11)
at PassThrough.ondata (_stream_readable.js:714:22)```
can someone help
Oh, nvm them
First time seein dark mode eclipse
Anyway
Use the new builder
See JDA github page for an example
may i dm u plz
yes sure i will
🙄
But mainly, it's JDABuilder.create
have other prob
@prime glacier source is too big
may i plz plz
Just ask here
how can i fix it like any help
am eating currently
JDABuilder.createDefault("token")
and status and all?
Opus probably have a limit on how big the input files can be
That'll not include guild_member gateway
yea
Nor presences
hmm ok
Wow just noticed a major issue @earnest phoenix
You're doing the event listener completely wrong
You need to create a new event handler class to pass on addEventListener
Not pass an event to it
@drowsy epoch as you were the one who asked what happened with custom.discord.re, i updated it https://custom.discord.re
i just want to do npm i discordjs/discord.js!
@pale vessel brrr private testing botum
Is there i can get a message link using discord.js
message.url
thanks
const link = `https://discord.com/channels/${guild.id}/${channel.id}/${message.id}`;
why
kek
just what flaze said, thanks
client.on('ready', () => {
client.user.setPresence({ activity: { name: "$help", type: "WATCHING" } });
console.log("am ready");
});
I did the order and it didn't work the wachting
Error [SHARDING_NO_CHILD_EXISTS]: Shard 2 has no active process or worker.
``` How to fix this ?
this is a bug in djs
how to prevent it?
how to set libary
client.user.setActivity("$help", {
type: "WATCHING"
}).catch(console.error);
you can keep console.log("am ready"); if you want
@fair scaffold
please help
set library?
How to end a process without restarting it?
like in the process itself?
yes my bot is running two times and now I want to end a process
@solemn latch its an emergency xD, I do not have access in the server
most process managers will restart a process when you close it, youll want to have server access.
maybe I just renew the bot token
😭
that will still restart...
will this work?
lol
itll logout the bot, yeah
with renewing the token?
then I have to wait till my friend is online, so that he can login the bot
lost 20 guilds bc of that problem xD
Hello, can you tell me what's wrong with the bot?
which bot
PartyBeast
this server isn't for help with bots it's for help with the site. go to the bot on the site and support server
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'snipes'
any idea how to fix this?
why can't I read bot messages?
extend bot (or just make global variable) and add snipes variable into the extended class.
you disabled displaying embeds in your client settings
Why did u just ping a bot reviewer?
Is it possible to have the bot generate an invite link on a guildMemberUpdate event? Can't seem to figure out how to make it work on this event
You can, but why?
I want it to send them a one time invite link when they receive a certain role
why not simply , you know, GRANT them the role when they join?

rather than nviting them to give them a role
Because they need manual approval
and how is automated links going to do that?
"free pass" invite ig
By giving them the invite link when they get the role added to them?
That only has a one time usage
thats not manual though
But they need to manually be given the role lol
whats the difference between
making a link => having them click it => get role
give them role
both are going to end up being the same, everything is based on what THEY do, not you, theres nothing manual
make a reaction collector then
lots of bots already do that, where you have to react to a message saying you agree to rules n stuff
why not have them click the raction and give them the role?
I think he has 2 servers, once someone reaches a certain level they're granted an invite to the second server
He said guildMemberUpdate but yeah, it'd have nothing to do with member events
how does a level ralate to "when they join they get dm'd a link for one time use role" ?
well rather than assuming, lets ask them
@odd stratus what exactly you trying to do?
The bot is in two servers, if an admin gives a member a specific role, I'd want the bot to send them a newly generated invite link to a Premium server which can only be used once and expires after 24 hours
so you want something like
!invite @odd stratus
bot makes invite to new server wtih role set to expire for 24h, thats it?
Well not with a command
and sends u the link in dm's
Just when they receive the role
well, do you have a different trigger?
that'd still be under MemberUpdates iirc
role updates are sent
Yep
Just need to check if the role that triggered the event is the chosen one
Then open user private channel and send a newly created invite
but either way, once you get that trigger to happen, you'll need to do the following
let invite = client.guilds.cache.get('YOUR PREMIUM GUILD').createInvite({OPTIONS_HERE});
USER_RECIEVED_FROM_EVENT.send(invite + 'bla bla message, here, click this bla bla')
https://discord.js.org/#/docs/main/stable/class/GuildChannel?scrollTo=createInvite More options here @odd stratus
does anyone know how i can make the "created_at" look good? right now it just sends the exact time and is it possible to make the time not utc but the servers region time?
Use timestamp for that
It's the only way of making the same message adapt to user's local time
you can also instead format is as age
created x years y months z days ago
created x minutes y seconds ago etc
So what is cronjob?
It's something that'll run on scheduled times
its like a way to schedule a function
Like, "run this every X seconds"
crontab is hella confusing tho
Is it in your API?
No
Could I get a gh link?
But since you're using java, there's an official lib for that
oh, cool
You said maven
oh yh
Just search "cron maven"
It'll get u a mavencentral page
Just add to ur dependencies
Then read the docs on how to setup
And use a cron generator to prevent headaches
ok cool, and how can I like read my server count?
Once u set a cron job (for exemple: once per hour), just put the server count uploader inside it
What's good about cron is that you'll not rely on long no-restart periods to have the code execute
Cron is based on current time, not some internal timer
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Inside that link I have posted I have my HTML code I'm simply just trying to get text in the middle of the image
client.on("ready", () =>{ console.log(Logged in as ${client.user.tag}!`);
client.user.setPresence({
status: "idle", // You can show online, idle... Do not disturb is dnd
game: {
name: "Into The Light", // The message shown
type: "LISTENING" // PLAYING, WATCHING, LISTENING, STREAMING,
}
});
});
client.on("ready", () => {
console.log("I am ready to receive and Send Mails :D")
client.user.setActivity("Into The Light")
})
`
it just say playing a game
Screenshot?
ok brb
client.on("ready", () =>{
console.log(`Logged in as ${client.user.tag}!`);
client.user.setPresence({
status: "idle", // You can show online, idle... Do not disturb is dnd
game: {
name: "Into The Light", // The message shown
type: "LISTENING" // PLAYING, WATCHING, LISTENING, STREAMING,
}
});
});
client.on("ready", () => {
console.log("I am ready to receive and Send Mails :D")
client.user.setActivity("Into The Light")
})
So it looks like you set the presence twice
At client.user.setPresence
Near the bottom
And also at the top
So it might override
You should only add 1 event listener for a single event unless absolutely necessary
ok so imma take one off
ok
Take off one at a time
Does one of the overloads for setActivity accept just a string?
Makes sense. Didn't know that
it still says playing a game



"
