#development
1 messages ยท Page 802 of 1
Oh right
and pfp changes
but they'r gonna limit that in future right?
My bot uses whether users are online or not so I guess I have to keep it
wdym limit? there are certain restrictions when using it already
i dont do anything presence related since i broke my bot by iterating over 40k users each second trying to check their online activity
#noobbot ๐
there was some post where they are gonna be limiting it to 100 guilds
if you use presence data
yes, also for guildMember data
it requires turning on a setting in your bot application
in discordapp
ye
what does that mean though ~@ track server members
like, would using message.member count?
the guildMember intent affects memberAdd memberRemove and memberUpdate
like, the events?
Hey.
So.
I've been trying to search for data in a column.
let crow = await con.prepare('SELECT * FROM codes');
const { code } = await con.prepare('SELECT code FROM codes');
if(code == args[0]) {
i think this is the code that is messing up.
if you use intents but dont enable guild members, you dont receive any guild member events
meaning your bot will not be able to track members, nor their count
nor when they join/leave
nor nickname updates
:/
i had to use guild.memberCount for getting accurate member count since bot.client.users fails hard af
tells me 10k, when its over 120k now
you can still estimate member count via guild.memberCount
but the count will not be updated automatically
ahhh
yup
ehh, idm, i was thinking of removing the welcome emssages and mod stuff from my bot anyway
there are tons of bots for that that do it better, mines is more rpg minigame focused
so no real need
@pine aspen i believe i have answered your question before
.prepare() will create a prepared statement, but not run anything by itself
Ok.
you need to actually execute the queries after preparing them
.query()
refer to your library's documentation
which library are you using?
Discord.js
database library
npm mysql?
Yes
doesnt look like the library supports prepared statements at all
if(code == args[0]) {
let row = await con.prepare('SELECT * FROM config WHERE guildid = ?').get(message.guild.id);
const { premium } = await con.prepare('SELECT premium FROM config WHERE guildid = ?').get(message.guild.id);
if (premium == 0) {
I have prepare for my premium.
It works fine.
that looks like a different library
the example for mysql shows this
connection.query('UPDATE users SET foo = ?, bar = ?, baz = ? WHERE id = ?', ['a', 'b', 'c', userId], function (error, results, fields) {
if (error) throw error;
// ...
});```
better-sqlite3 does it that way
Ah well I haven't used that
You use the same structure
the mysql library works like this connection.query("SQL",[parameters],(error,result,fields) => {})
your code shows this connection.prepare("SQL").get(parameters)
Ok.
I have mysql installed in my Node_Modules.
show your package.json
"dependencies": {
"ascii-table": "0.0.9",
"bot-utils": "^1.4.2",
"common-tags": "^1.8.0",
"discord.js": "^11.5.1",
"fs": "0.0.1-security",
"moment": "^2.24.0",
"mysql": "^2.18.1"
},
Yeah that's mysql so use the structure described by tim
i cant find any mention of .prepare in the mysql page
you said your other code is working?
Yes.
Awesome. The developers of the library I use said they automatically process rate limits for me, across multiple library calls
All my codes are working.
Apart from my code fetch.
Free text/code sharing site supporting 450+ different languages!
example this works.
fine.
My Con
show the code that calls the run function
Wdym?
In index
Like login to databse?
what is con
Yeah but hide the credentials
Duh
const Database = require('./handlers/Database');
const con = new Database({
connectionLimit: 20,
host: '',
user: '',
password: '',
database: ''
})```
This is con Tim
well, what is /handlers/Database?
My mysql con looks nothing like that
i wish my package dependencies were asa few as your syn ๐
Free text/code sharing site supporting 450+ different languages!
Yeah thats what's in ^^
thats like a custom wrapper for the mysql library
alright, then you should follow what he says
there is no documentation for that as its custom made
Might be more useful to use something documented if you're trying to learn
At least there's support
@slate oyster D4J already has rate limiting for ages ^^
THANKS!
I got it to work.
Tim you gave me an idea when you said .get() and now it works!
There's a few errors which i should be able to fix.
Does anyone have a good idea on how to measure a MySQL database latency in JS?
Would something like this be trustworthy?
// get time a here
con.query('SELECT 1', (err) => {
if (err) throw err;
// get time b here
console.log('The latency is ' + time b - time a);
});```
how fucking big is your DB for it to take a noticable amount of time
Lol true
I guess store var before = new Date() before the request and then compare it to var after = new Date() once the request is done - but it will be a tiny number
even a large DB is factions of second
Yeah
yeah I know it's a really small time, but I just want to know
Fair enough I guess
@true ravine with 'once the request is done' you mean in the con.query thing itself?
As long as the db is not physically far away the ping should always be near 0
As long as the db is not physically far away the ping should always be near 0
Yeah
@true ravine with 'once the request is done' you mean in the con.query thing itself?
After you check for errors
okay okay
Basically where you console.log is
thank you both for your help
Np
How can i fix this error.
(node:468) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `code` of 'undefined' or 'null'.
at Object.run (/app/data/DiscordBot/commands/misc/redeem.js:36:5)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, orby rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:468) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
It check's if code is valid.
If the code is not valid i want it to do something.
Free text/code sharing site supporting 450+ different languages!
It does the correct thing if the code is valid btw
(in the table)
You can always use a catch block
Or with normal mysql you get an err object that you can literally throw in an if statement
or
here's a crazy thought
fix the code that throws errors?
try catching everything is not the solution and a ton of memory gets wasted on handling exceptions/errors
@earnest phoenix Gosh. Why didn't i think of that.
Pff who wants a stable platform in 2020?
Thats the code that might go wrong
Ah k
It doesn't literally have to be badcode
bomboclaat
Make sure you always log errors that you catch, you will regret it later if you don't
Indeed
Alright.
where is peanut dread?
๐
you cannot destructure a property if it doesnt exist
lets examine your query, you have { something } = await database.prepare().get()
this means that, if the database returns an object like this { something:10 } the value of your something variable will be 10
but what if the database doesnt find anything? what if the supplied parameters are not found in the database?
the code will try to extract a something property from nothing
the error says that your database is returning either a null value or an undefined value
so you have to account for those possibilities before trying to extract a property out of them
essentially, doing { something } = value is the same as doing something = value.something. and if for some reason value is null, then doing { something } = value will be the same as something = null.something, which will throw an error, because null cannot have values
also, you're running a lot of duplicated queries, which is terribly innefficient
thats basically the same as loading a website twice to get one word from it each time, instead of loading a website once and getting two words from it
hi
does anyone know what
means? And why its not working on the vm but its working on my pc
show code
When I was having problems where my code worked on my pc but not my server, it was because on my server I was running using node index.js instead of node .. Might not fix your problem but it could be an easy fix?
let embed = new Discord.MessageEmbed()
.setAuthor(`Total: ${lost.commands.size}`, message.author.displayAvatarURL())
.setColor('#fffffa')
.addField('Administration', 'a!purge\na!dm\na!slowmode', true)
.addField(
'Moderation',
'a!ban\na!unban\na!kick\na!mute\na!unmute\na!purge\na!dm\na!slowmdode\na!checknick',
true
)
.addBlankField()
.addField('Utility', 'a!say\na!erotes\na!roles\na!emotes', true)
.addField(
'Info',
'a!commands\na!help [command]\na!info\na!invite\na!lost\na!membercount\na!ping\na!uptime',
true
);
message.channel.send(embed);``` you need to see more?
Isn't it meant to be new Discord.RichEmbed()?
not for master
@digital ibex Discord.js v12 does not have addBlankField()
it was removed 6 days ago
use .addField("\u200B","\u200B")
its basically what blankField was doing internally
oh
have you tried clicking on "click here for help"?
if(!code) should suffice, but you have to do that without destructuring
ie:
let response = await con.prepare().get();
if(!response) { return message.channel.send("not found") }
let code = response.code```
or just use response.code directly
k
Can i get the reason for banning dexter bot โ675991950762967040โ? I am a bot mod
Wasn't banned
Ok
can you get the content of system on join messages?
yes
does someone know how to make my bot icon moving
like moving to top and down
in dbl page
css animation
yeah but
how
webkit-animation: mover 1.5s infinite alternate;
animation: mover 1.5s infinite alternate;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
border-radius: 50%;```
@quartz kindle
Did Google help
did you define the keyframes?
are they even here
That's him
as i explained to him, i dont selfbot
So how u do embeds
the only way to send an embed on an user account is selfbotting
well not really
could be an oauth app with permission to send messages
that is not selfbotting
Selfbot
but it could be
oh mah god
whats an oauth app
only thing that can send images is users bots and webhooks
and both webhooks and bots have a bot tag in their name
@earnest phoenix selfbot?
What's ur prefix proper
and webhooks cant have roles
no ffs
@earnest phoenix how do you do it then lol
Yes
he made me gay aswell several times
unless its just some dumb joke
He says "no selfbot" but no proofs
in every channel
and he is posting images
@earnest phoenix say /coinflip now without delay
@tight plinth how do you want me to prove
HE MADE ME GAY
Well prove
man this is the wrong channel
/coinflip
yeah u shutted it down
oh mah god
ye he did
i was reading testin 1
also the images are from a different server
honestly alex was smart af, not only straight up threatening a report but also reporting it in a public and wrong channel
2000iq
unless you can prove how you sent those messages without selfbot its obvious
but is your bot using your user token?
@earnest phoenix did you put your user token in your bot?
widget
insp element
^^
so yes, its a selfbot
well if u did put a user token its a selfbot ๐ ๐
Literally just admitted it and doesn't even realize ๐คท๐ปโโ๏ธ๐คฆ๐ปโโ๏ธ๐
@coral trellis can u do something pls
Why is this even being discussed here
idk
could be an oauth app with permission to send messages
this is impossible by the way
no app can send messages for you
yes i realized
otherwise that would be a huge both privacy and security breach
ive read so many other api docs i swore discord has something like that too
I thought Discord oauth could do that
but that is long abandoned
cant a client emulate discord's own oauth flow for users?
@slender thistle you are smart smh
this isn't #memes-and-media
true
under the esc
google the type of your keyboard and append backtick
omg yall just assume everyone has the same keyboard layout
its alt gr + 7 for me smhhh
lol
oh god
under 1 what letter is there?
To be honest I use a nes keyboard with my computer smh
lol
LMAOOOO
Okay
ouch my brain cells
Next to W is there a E?
it looks like this
well american keyboard layout
but somewhat same
what is that supposed to mean
Like this?
Where are you from
On windows try pressing windows key and space to see keyboards
Not enough arrows smh
@earnest phoenix sorry what are we supposed to see on that screenshot?
this
no probleM ๐ !
cry is a helpful dev
now how do you call Python functions in ASM

asm lol
why is the link purple though
dark reader and i visited it
Where you got that sweet dark reader from?
yes
I am guessing you use chrome
it is also on Firefox
lol no
nah he uses safari
ez
chrome more like here you go use my data without my consent
Chromium enough
Firefox > *
this tbh

Isn't the discord windows client based on chrome? 
what is the difference between chrome and ium
One is cool one is edgy
chromium doesn't have feature like sign in
ok
chromium is open src
no sync afaik
Chromium has sign in and sync?
and it acts as a base for chrome
chromium is mostly just chrome but less bloat
okay my internet is fucking me
that's erotic
did your internet ask for consent?
dont give them tea
anyways chromium sucks and it consumes an ungodly amount of ram for no reason
chromium has sync wdym
chromium is a stripped down version of chrome, that is also open source.
but still shit
thats why you can only install chromium os on windows not chrome os
because chrome os is for cool people
lag city
Windows machines *
i can install it on my linux machine
Because it's linux based I swear
you swear?
Not on christian servers
good.
I'm confused and never had this issue before, for some reason running console.log on ascii (surrounded by back ticks) returns "irregular expression"
can we have a snippet of the code?
@earnest phoenix so firefox > chromium in a way?
just a mile?
I'll let your internet send the replies in an hour 
firefox actually cares about user privacy
free vpn also
firefox's engine is weird af tho
always needs dedicated css rules to fix inconsistencies
i don't trust opera since it's a chinese company
But do you trust TikTok
no
Good
Opera is a independent Chinese company
never even signed up nor download
They don't sell data to government
because it is
but is the opera gx worth the try
but is this the right channel
No because yall just ignored someone who asked for help xd
your question was answered
b-but
how to set time limit on bot message response ?
i mean user need to response between 1/2 min
create a message collector with a 30000 ms timeout
ooooof
nice
master is best
true
which type of presence?
guildMember presences
i thought we already have that
not when fetching
Hey.
number_codes = 0
new_code = "Code"
setInterval(async () => {
let { number_codes } = await con.prepare("SELECT COUNT(*) FROM codes").run();
console.log(await con.prepare("SELECT COUNT(*) FROM codes").run())
while (number_codes < 100) {
const new_code = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);return v.toString(16);});
con.prepare("INSERT INTO codes (code) VALUES (?)").run(new_code);
}
}, 1 * 10000) // 1 * 10000 = 1 Minute
(node:822) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `number_codes` of 'undefined' or 'null'.
at Timeout.setInterval [as _onTimeout] (/app/data/DiscordBot/index.js:43:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:822) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, orby rejecting a promise which was not handled with .catch(). (rejection id: 3)
How could i make this work?
Do i use a catch box again?
Did you see the explanation tim wrote earlier?
can anyone suggest a node module or any api that can auto detect a language
its for my translate command
(node.js)
google-translate
@earnest phoenix so when you run the command it gets your info?
message.guild.members.find()
edited alr
Unless you define it
^ same as message. if you dont define it, it arent a thing.
message is a thing when used in a message event ๐คฆ๐ปโโ๏ธ
It's automatically defined via the event
nope.
Lol ok
client.on("message", message/msg => {})
Yeah that's a message event
Yes you can choose what you want it to be your not wrong
But it is defined with the function the variable is whatever you set it as
For a userinfo command if it's returning his info even if he tags someone I'm gonna take a shot in the dark and say he didn't define how to call the user he tags
is there a way to stop multiple instances of a bot without restarting the whole process?
bruh i cant word anything
๐
ok if you have a bot sending 3 messages, how do you stop that without restarting the bot
Don't quote me on that ^
Probably by stopping the other instances
@grizzled raven so say if you run the help command it returns the response multiple times?
Yeah I'd do a token Regen or find what other instances are running and stop them. (Again token Regen not guaranteed to work but usually helps me)
@restive furnace but like how would i go about that
and also, it seems as if its works together, like say i set a cooldown, the other instances also have that cooldown cached
@grizzled raven do you use d.js?
yes
Does your bot restart often on its own?
Me?
noob
Oh
He's just having the multiple instances issue
Bot responds to one thing multiple times
yeah but what for?
no i mean what he wants to achieve, if i dont understand what he wants, its hard to suggest how to approach the problem
Oh I see what you mean
it could be load balancing, could be sharding issues
That is true
Honestly Sharding Issues didn't even cross my mind ๐คฆ๐ปโโ๏ธ
@earnest phoenix then your bot is missing perms
Make sure it has the send messages perm, read channels perm ect
@quartz kindle i havent sharded, the bot responds to commands and message multiple times, how do i stop it from responding multiple times without actually restarting thr bot
not right now, but im just asking for an if so
@earnest phoenix could be an error from another server then
@earnest phoenix this is for a userinfo command right?
Can you show me the code or tell me how you define the user
@grizzled raven why does it respond multiple times? did you add multiple message events?
Oof
hey guys, how would one check if a string is a color hex code?
Try something like this
let user = message.mentions.users.first();
if(!user) user = message.author
@earnest phoenix
Replace what you sent me with what I sent you
How to add image in canvas-constructor on glitch?
Then?
It's asking for path
Not link
@earnest phoenix what permissions does your bot have
It shouldn't throw a perms error unless it's missing a perm
To get it to stop sending your info
Delete This
And try this
let user = msg.mentions.users.first();
let muser = msg.guild.member(msg.mentions.users.first());
if (!muser) muser = msg.member;
if(!user) user = msg.author;
@earnest phoenix it works if you tag them because that's what your telling it to use
A tag/mention
const user = message.mentions.users.first() || message.author || message.guild.members.find(args [1])
message.author always exists
so message.guild.members.find() is never checked
What I sent should work if he sets it up right that's similar to how my set up is currently
just switch them around lol
also, .find() requires a function as an argument
not a value
Tim what if he wanted to get them VIA Nickname or ID that would be defining the user as args right?
Nickname is one idk how to do. I know how to make the bot use if they have a nickname in messages like <@!${user}> but mention them via their nickname I have never tried.
Don't even know if it's possible
But if I tag one it goes, only if I put the nickname it doesn't go
This is Also why I asked that question
Search the string with a users name?
No he wants to call them via a nickname like let user =
String = args.
<Guild>.members.find(x => x.whateverthenicknamepropisnowadays === args[index])
Np.
I think it returns null if a user doesn't have a nickname, Will need to check though.
Would only make sense if it does. But I'll look into it
@quartz kindle i dont know
that could actually be the case when i think about it, as when the client.ready event is emitted, it loads all commands and events
so actual
yeah
console.log(client._events)
yeah nvm 
i restarted the bot already

i was just asking for the next time it were to happen
you can disable events by removing them from client._events
if that was the problem
Is that safe though
yes
hello
how to remove this line
go to inspect element and check out what it is then remove it in your css
i cant see whats that.
How can i check if the mention is a user?
you very much can
ohhh
you'll have to regex check for it @royal ravine
is wrapper
@royal ravine explain your problem a bit more
i have a command like SB give @ user
but when the author enters a role
so he tags a role
the script stops
cus it cant give a role a role
how can i check if the mention is a user in the channel
what library?
i use disocrdjs
how are you parsing the mention?
show the error
1 sec
ok i cant
1 se
how to remove that line
i tried searching that in inspect element
but i cant find it
whats your bots id
going to try to find the element
658294671167979570
it's border-top property of the container @earnest phoenix
set it to none in your css
ok so
I've just spent way too long customizing my bots top gg page ๐
i put display: none
no
that's the display property
i said to set the border-top property to none
@neat ingot btw, sry for mention, but, how u put the bot icon moving
@earnest phoenix wym
what
learn css
Tbh CSS is hard imo
how the div class is named?
it's really... not
its called .container?
yes
okay ty
the class is called container
okay
. is a class selector
its just i did not understand it. @quartz kindle
Eh it's probably just me who sucks at this stuff /shrug
yeah i know
lmfao
but
i tought
the class was called like that
nvm
when you get stuck at those kind of things
play with the inspector
this exists
LMAO rip /
yeah
but i didnt see that
.container {
border-top: none;
}```
@earnest phoenix
does not work
@earnest phoenix css styles. you can view source on my page to see how, but i just pinched the css from medals page ๐
yeah yeah xdd i saw that xdd dw
#bot-details-page #details .container {
border-bottom: 1px solid #18191c;
border-top: 1px solid #18191c00;
padding: 40px 0;
}
^functional
used it on mine
okay
@neat ingot but i need the keyframes for the animation in bot icon
btw, thanks it works
keyframe animations in css arent that hard
@-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgb(255, 181, 59);
}
70% {
-webkit-box-shadow: 0 0 0 20px rgb(255, 181, 59);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(25, 118, 210, 0);
}
}
@keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 0 0 0 0 rgb(255, 181, 59);
box-shadow: 0 0 0 0 rgb(255, 181, 59);
}
70% {
-moz-box-shadow: 0 0 0 20px rgb(255, 181, 59);
box-shadow: 0 0 0 20px rgba(25, 118, 210, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}
}
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
transform: translatey(-20px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
transform: translatey(0px);
}
}```
or you can spoonfeed, that works
i copied from elsewhere so idm ๐
though they will never learn anything
this is true
but i already had the edit page opened, so was no real hasstle
and saves the dude at least 30 minutes if never done it before
But if you learn it you wont need to ask again
also true ๐
thank me later
then i use this:
.bot-img img {
-webkit-animation: mover 1.5s infinite alternate;
animation: mover 1.5s infinite alternate;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
border-radius: 50%;
}```
@neat ingot right?
you dont need to repeat properties if you use their short hand version
thats a pretty neat site cry ๐
wait, you dont?
so i dont need to use the -webkit prefix?
@neat ingot ยฟ?
ooohh lol. yea noah
and also, most times you dont need to use -webkit
im trash with css ๐ฆ
-webkit is to make it work in old versions of webkit browsers when those properties were still experimental
yea that'd make sense ๐
so basically animation: name [duration] [timing-function] [delay] [iteration-count] [direction] [fill-mode] [play-state]
if you include those properties in the animation rule, you dont need to declare them separetely
animation: name 2s;
is the same as
animation-name: name;
animation-delay: 2s;
yea i figured what you meant. cause the animation has infinite declared its obsolete in the other declarations ๐
yeah, and css is even smart enough to not require them in order
if a message is partial, and you fetch it, will all the properties be fetched too, such as the author, reactions or channel properties
yes
yes, most properties will
They should
channel most likely not
huh
what makes a message only partial? slow speed?
no
im not on djsv12, so i cannot test this
partial means its incomplete
Only part of its properties are available
i can test that for you
how would that occur?
yeah thanks
@grizzled raven
this is what a message packet contains
so fetching a message will parse and resolve whatever it can from that
if the channel is cached, it will have a full channel, if guild is cached, it will have a full guild
but the message itself only comes with author, embeds, mentions and attachments
also reactions if they exist
it doesnt come with reaction details, those need to be fetched separately
@quartz kindle how can i lock a command if a json value is a id?
this is not the support server for invite manager
LOL
@quartz kindle ok next
@quartz kindle can you answer my question now?
explain better pls
the command works only if a json value is an id
hes saying that you are not good enough and wants the next person to help
@quartz kindle please help me
show code example
@shrewd perch i already told you, you are in the wrong server
this server is for the website www.top.gg
we have nothing to do with invite manager
-wrongserver @shrewd perch
lol
wrong cmd
@quartz kindle so, i mean, lock command only for ids
check if ids exist?
noo
@shrewd perch https://discord.gg/S977tw2
the command to work only for specified ids
how can i check the if id exists?
show code
i dont have code
then make a code lol
:\
how
then check if the id exists in the variable
require or fs.readFile or fs.readFileSync
Ok
ok
Why is the CSS file not included on the page? This my code head tag between:
is it against the ToS of DBL/top.gg to have direct communication to server owners from me thru messaging my bot?
so basically i'd be able to message a server owner and vice versa thru my bot
I think that as long as you don't message a server owner first it is okay but a mod would know
ye the question is generally towards a mod but dont wanna ping them bcs p sure there's rule against that xd
Not exactly the right channel for such question
It's finmost likely alright if the bot mentions who sent which message
make an @earnest phoenix array
and check
coz
it's easier on the basic level
u can use advanced stuff when u get the hang of it
author is included in the message
if you have nothing cached, the correct order would be to cache guild -> channel -> message -> reactions
Why is the CSS file not included on the page? This my code head tag between:
@zenith orchid
what does your console say?
(browser console) (f12 -> console)
actually, go to network and reload your page
@grizzled raven yeah it is
what are you trying to do?
@zenith orchid show your style.css
can you see it if you open mysite.com/style.css in your browser?
Cannot GET /style.css
are you using express?
Yes, i solved
@zenith orchid you Turk
res.sendFile(__dirname + "/web/style.css")
});```
?
ctrlc ctrlv
@zenith orchid thx
@finite bough thx
If you mention me, i'm will report u.
Normally good, now it's broken
@earnest phoenix translate?
I'm looking for base Bootstrap template to edit? Do you recommend something?
Hey everyone, Iam pretty new (aka I donโt know anything tbh) to this and I just want to get a general idea how I can fix my problem:
What options would you recommend me for setting up a deadman switch bot? I need it to dm friends of mine when I donโt send it a message in a set period of time. Mentioned people will be in the same server as the bot and allow it to dm them
Have you check to see if a solution exists already?
I tried to find something on the net but Iam afraid I do not know where to look and how to have good results
If you're looking to make a solution yourself then, I would personally recommend finding a Discord.JS bot tutorial on youtube, opening up the Discord.JS docs and joining their help server. The function you want to achieve shouldn't be too difficult to achieve and the Discord.JS server are very helpful if you get stuck
Thanks a lot, thatโs a way I can follow
Im writing a bot in Discord.js and its giving a role when I run a command that mentions the user. Is there a way to delete all messages sent by the user i mentioned in the command?
kinda like the purge command?
There is but i forgot how let me look it up
You would probably be using a fetchMessages function, although for specific help I would recommend joining the discord.js server
// Parse Amount
const amount = !!parseInt(message.content.split(' ')[1]) ? parseInt(message.content.split(' ')[1]) : parseInt(message.content.split(' ')[2])
if (!amount) return message.reply('Must specify an amount to delete!');
if (!amount && !user) return message.reply('Must specify a user and amount, or just an amount, of messages to purge!');
// Fetch 100 messages (will be filtered and lowered up to max amount requested)
message.channel.fetchMessages({
limit: 100,
}).then((messages) => {
if (user) {
const filterBy = user ? user.id : Client.user.id;
messages = messages.filter(m => m.author.id === filterBy).array().slice(0, amount);
}
message.channel.bulkDelete(messages).catch(error => console.log(error.stack));
});```
thats how this github is doing it: https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/examples/miscellaneous-examples.md
o thx
Np
my advice would be
even if your current bots code would allow you to copy and paste that dont
id look at it and try to dissect it then make your own so itll help you in the future :)
if you copy and paste everything (like i did for one of my first apps ๐ ) when its time to fix it youll be lost
Hi. With djs v11, I'm trying to get the bot send an error embed each time "soemthing went wrong" whle executing a command. but this code https://prnt.sc/r9nt7r (here on my command handler) just doesnt work, the error is just sent in the console, o error message. Why? Is there something wrong in this code?
Your then block should look like .then(() => { and you should put a }) on the line below the console.log
It's meant to enclose the code to do 'then'
Can't easily give an example as I'm on mobile
if the console.log is working then thats not the problem
u mean like that?
@quartz kindle when you fetch a channel, would the guild also be fetched, since the api endpoint is guilds/id/channels/id, isnt it?
actually that might not matter but im just asking anyway
wait what the fuck
@grizzled raven i dont think so
oh okay
the channel will have a guild id, but not the full guild
https://prnt.sc/r9nvmf nope, still nothing
Is error like a reserved word
No but in general
but you said this console.log was working right?
the error was logged to your console
then the problem has nothing to do with that
add a .catch to the message
well thats an unhandled promise rejection
oh
are you awaiting your promises?
@flat pelican ads
@earnest phoenix ads are not allowed
u mean this ? https://prnt.sc/r9nwav
lmao
tim you got killed
stop sending ads
banned now
banned
is command.execute an async function?
then you have to await it
otherwise the error will not be caught
try/catch can only catch sync errors, not async errors
unless they are awaited
like that?
no, the execute
im not a boomer btw
hello
ur not
can i have help
ask question pls
for what
lol
my folder
i think he means right click menu on windows
no
oh
command prompt is a program. you can find it in the start menu
it says hold shift key and right click anywhere inside the folder
yes
https://prnt.sc/r9nyr6 welp, time to go. bye!
did you try it?
what happens if you right click anywhere inside the folder?
hold on
you have to hold SHIFT while right clicking
there is an option in windows that says "replace command prompt with power shell"