#development
1 messages ยท Page 1244 of 1
Ok thanks
for webhooks, it's vote.user to get the ID
@slender thistle
Wait
Vote.user gives me id????
I thought it gave me user name #
You can have multiple users with the same name
adada#0001
adada#0002
and so on
then you have two of those users with different unique IDs
one's ID is 123, the other's os 101
hmm, will this work...
trying to have a useful metric of if my bot is trending up or down in a single figure
so i have a figure called 7 day retention
its worked out by percentage of kicks vs joins, so positive means overall more servers are being added than removed, negative means more are being removed than added
100% means nobody is kicking it, -100% means everyones kicking it, 0% means no growth
should this be ok? seems to make sense to me
i decided to work it out only ever over the last 7 days otherwise the previous weeks and weeks of data will smooth out the average too far
i should probably call it 7 day trend not retention though
is there a way to make a bot use a rich presence?
no
how do you make it the live status instead then
@green kestrel
i mean, if you give a little explanation at the bottom that explain what it is, yeah it would be fine
7 day trend is a better name yeah
rich presence is for games, via the discord gamedev api library, which tells the client to set the rich presence, iirc
you can set just a standard presence @earnest phoenix
ik but i forgot how to make it live
well streaming
bro is it just "STREAMING"
i swear
for streaming it needs to have a valid youtube or twitch stream url
depends what lib u use
setPresence or setActivity in discord.js
sa
@green kestrel you should log / store when your bot joins the guild and if it's instantly kicked / how longs its in the guild before its removed
Hmm nice, I'll record that, thanks!
Generally the ones that don't keep it run a game and kick it, about 10 mins retention max
ye but checking the join - leave time would be more accurate, since I've had my bot in guilds for 6 - months and up and it affects the statistics accuracy over time if lots of server do it at once
@quartz kindle yeah but how
client.user.setPresence({
status: "??",
activity: {
name: ``,
type: ""
}
(that's the bit i have
Hm, is there a reason why guild.owner doesn't exist on this serv?
use fonts from fonts.google.com
@earnest phoenix do they work in canvas?
Hm, is there a reason why
guild.ownerdoesn't exist on this serv?
@lime gorge p sure its cause cache
an alt owns the guild not oliy
wdym alt
an
alt account
i know
yup, but still, shouldn't I be able to get the owner without having to loop through the user list?
but like i thought oliy owned it
I mean, its not a matter of cache, the owner object should be inside to the guild one on its own, without going through the cache.
my .htaccess not working
help
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]```
eg, doing:
const guild = client.guilds.cache.get('264445053596991498');
console.log(guild.owner); // null```
the owner isn't cached
most likely due to the guild being too big and the client only caches online members
you don't need to loop through the user list. you can fetch the owner by id using members.fetch(guild.ownerID)
Then discord.js indirectly calls the cache to get the guild owner? Thought the object to be directly attached to the Guild Object
it can't get the owner, it's not cached
the api for guilds only give the id for owner, discord.js has the guild.owner property that resolves the owner id to a member (at least tries to...)
Yes, but my point was that you dont call the cache directly to get the owner. Which makes it unclear where it gets it.
wdym
it can't directly attached to the guild object. the owner state can change (e.g. their presence, username, discrim etc.), like normal members
which makes sense why it should be in the cache along with other members
try guild.owner.user
now canโt get badge developer right ?
Y E S
try
guild.owner.user
that won't work if the owner isn't defined in the first place
welp, How do we define guild?
what im guessing is to put the guild id
7777777.owner.user
correct me if im wrong
im pretty noob
grab the guild from cache (<client>.guilds.cache.get(<id>)) or fetch it
how can i update without restarting my bot?
Javascript
And like editing a command without restarting the bot
or adding new files/commands
You'd need a command handler to separate your commands into separate folders. If you want to reload a command, you need to unload it from your commands collection, clear the required file cache (delete require.cache[require.resolve("./path/to/file.js")]), then require the file and add it to your commands collection again.
See this example: https://discordjs.guide/command-handling/adding-features.html#reloading-commands
@jovial nexus
ok thx
Howdy boys and girls!
How do I make a command that mutes everyone in the voice channel?
voice channels have the members property which is a collection of members inside the vc
how can i make a progess bar? ;-;
For a website? Or for your bot?
for my bot
The general idea: Let's say progress = 70, loop until i is equal or more than progress, and every time increment i by 10. If i % 10 == 0 add a full bar, otherwise add half a bar
how can i make a progess bar? ;-;
@earnest phoenix You can use my package calledstring-toolkitfor thatDefinitly not an ad
is anyone know how to keep our bot 24/7 online
use a process manager
Like a vps or hosting service
vps is free ?
hm
vps is free ?
@main chasm u can get a good vps for free if u are student
Checkout Github Education Pack
How can i get total and exact storage of RAM of the vps without any package?
with the github.tech domain thingy, how can i like link it to cpanel?
I did it!
I got a singular command to respond on both Discord and Nertivia!
(Not that it actually bans users)
how would i let a variable be a mention but if not a mention, the userid that was put instead?
like getting arguments of a command
with the github.tech domain thingy, how can i like link it to cpanel?
@drifting wedge set the correct nameservers in your registrar panel and add the domain under "Addon Domains" in cPanel
the font is scuffed though
@earnest phoenix An open source chat client. Basically Discord, minus VC, plus free nitro and pre-boosted servers
Made by Fishie/Pancake
Anyways
V4 of my bot will work on both Nertivia and Discord
V3 is only working on Discord
Certain things, like VC stuff, obviously won't work on Nertivia
hey im trying to code my bot to do an embed to list bot commands, im kind of a noob, is there a way to make it send a complete paragraph? because as far as i know i can only do one line of speech as footer or description
use \n as a line break
im coding in JS does that work in javascript?
Yes
not only in javascript 
so could you give me an example of how to use it because im not sure
so would i do : .setFooter('hello')\n or somthing then another sentance?
How to check if the user voted 
Oh cool thanks
How i can receive photo from bot dm?
public lava: Shoukaku = new Shoukaku(new Client, nodes, ShoukakuOptions)
i've made a shoukaku client
and i started the lavalink server but when i start my bot i dont get any logging saying the node is connected
yo does anyone have any experience with cloud servers that could help me, my bot goes offline randomly...
check your logs if it goes offline randomly
i suspect it has to do with a memory leak
@wide ruin which language you coding on and also which lib u using?
What service are you using
@cerulean salmon just attach the image and send it to yourself
with pm2 you can use pm2 logs appname
i use skysilk
regardless of vps
i think its the bot
java script
space

yo @pale vessel tysm that /n thing worked! my code used to just send 15 messages one after next
how to get ratelimited 101
\n btw
ik
don't get confused
i wasnt sure if it would do that to my message so i just switched it
hmmmm
@wide ruin which language you coding on and also which lib u using?
@opal plank js
this might be a big annoyance
Discord.js
@wide ruin and are you using DBL's lib/
i meant library to handle DBL api
not DIscord's
No 
if(args[0] === `@modest plaza`) {``` Is that even possible? Or how to fix it to make it work?
well, yeah
it works just fine
though use ' rather than `
compiler expects input with `
though what exactly you trying to accomplish/
?
But instead of just typing my name, I would like to ping it.
@modest plaza you cant ping inside an embed
nah i want .user @modest plaza instead of .user ethxrnity
Do you have no AA on your font??
then check mentions
How can i get total and exact storage of RAM of the vps without any package? Discord.js
Ok
Anyone know a good C# lib for drawing text on images?
cry recommended magick.net and imagesharp
@faint prism https://bfy.tw/P4Fe
sketchy link
i just checked,im not ratelimited, i just surpassed the lib ability to handle that traffic
url shortner

is shorten.er a thing?
of course
ye
that could be from any channel, even outside the guild
since it's a user property, not a member property
that's why there's both lastMessageID and lastMessageChannelID
is there an event listener in node for any uncaught rejections/errors?
process
.on('unhandledRejection', (reason, p) => { console.error(reason, 'Unhandled Rejection at Promise', p)})
@opal plank
hey i have a question
np
@bot.command()
async def start(ctx, reason=None):
for member in guild.members:
print("Yay")
it says that guild is not defined...
guild are just servers
yes ik
did you define it?
idrk really know the exact d.py syntax but something like
guild = message.guild
# or
guild = message.member.guild
if you do that and define, they you can access the members property and then iterate over it
that won't work for some reason
i did guild = message.guild and it saya that message is not defined
how can i edit this messages?
i assume its ctx.message
why bother editing it
i'm trying to make a control panel working with reacts
client.on('message ' , msg => {
if (msg.content.StartsWith ('1') {
msg.react('๐')
// i want add 18 react to messages and 18 max ๐
you want to use different emojis i assume @main chasm ?
how to i do like where it shows how many servers the bot is in
no if i send 1 and u send 1 another person send 1 i want max 18 msg donโt react to msg
@earnest phoenix for d.js it would be:
<Client>.guilds.cache.size
ohhh
so you want to cap that message to have only 18 reacts?
so
I mean the code for the use case would differ but the tl;dr is that:
- You would need to create a message react add listener
- Make sure that your filtering the listener to 1 msg (i.e the message you want to cap reactions for)
- use
<Message>.reactions.cache.sizeto count the number of reactions on the message and then do your if else logic to stop reactions
thank u man for full help @prisma oriole
๐ค
<> refers to instance, so whatever you named it
so
let bot = new Discord.Client();
in this case it would be bot.guilds.cache.size
no bro
or
wait
let client = new Discord.Client();
in this case it would be client.guilds.cache.size
yes and that too
you put it in a string
(`${client.guilds.cache.size}`);
Alternatively:
("Bot is in " + client.guilds.cache.size + " servers");
or
is someone who make bot with web framework like flask(python)?
for example, discord.py + flask
help full @earnest phoenix
client.user.setActivity(${client.guilds.cache.size} Servers!, %help,{ type: 'WATCHING' } ,
thanks
await client.user.setActivity(`${client.guilds.cache.size} Servers!, %help`,{ type: 'WATCHING' })```
use code blocks so you can see `
right
thanks guys
looking for advice from a video game designer, DM me
@prisma oriole
client.on('message', async message => {
if(message.channel.name == "suggestions"){
if(message.author.bot) return
message.delete()
if(message.content.toLowerCase() === '?start') {
message.channel.send(' started successfuly :man_biking:')
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(message.channel, filter);
collector.on('collect', (m, col) => {
if(m.content.toLowerCase() === '?stop' && (message.author.id === m.author.id)) {
console.log("Stopped.");
collector.stop();
}
else {
let embed = new Discord.MessageEmbed()
.setDescription(m.content)
.setTimestamp()
.setTitle("Suggestion")
.setAuthor(m.author.tag,m.author.avatarURL({format: "gif"}))
.setColor('#4f65ff')
message.channel.send({embed}).then(embedMessage => {
embedMessage.react("751137346422046738")
embedMessage.react("751137346585493536")
})
}
});
i want without ?start auto work suggestion command in channel suggestion how ?!
how can i edit this message?
<message>.edit()?
UnhandledPromiseRejectionWarning: FetchError: request to https://discord.com/api/v7/gateway/bot failed, reason: getaddrinfo ENOTFOUND discord.com
wtf that error
<message>.edit()?
@thick gull it doesnt work
promisees???
as long as you keep them
guys who is know from message collector?
-notr
ฤฐngilizceden baลka dillerde sohbet etmek iรงin #general-int kanalฤฑnฤฑ, top.gg hakkฤฑnda (Tรผrkรงe olarak da) destek almak iรงin #support kanalฤฑnฤฑ kullanฤฑn.
Bu kanalda Tรผrkรงe konuลmayฤฑn.
@flat pelican ^^
@main chasm what?
assuming you need this
cuz very borken ingrish
Anyone here familiar with creating npm packages?
@opal plank i have a question
@main chasm then ask it
@pliant iron why do you ask? If you want to learn try google.
I am know how, I want to ask a security question regarding it
what is the new form of client.channels.get is it client.channels.cache.get?
client.on('message', async message => {
if(message.channel.name == "suggestions"){
if(message.author.bot) return
message.delete()
if(message.content.toLowerCase() === '?start') {
message.channel.send(' started successfuly :man_biking:')
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(message.channel, filter);
collector.on('collect', (m, col) => {
if(m.content.toLowerCase() === '?stop' && (message.author.id === m.author.id)) {
console.log("Stopped.");
collector.stop();
}
else {
let embed = new Discord.MessageEmbed()
.setDescription(m.content)
.setTimestamp()
.setTitle("Suggestion")
.setAuthor(m.author.tag,m.author.avatarURL({format: "gif"}))
.setColor('#4f65ff')
message.channel.send({embed}).then(embedMessage => {
embedMessage.react("751137346422046738")
embedMessage.react("751137346585493536")
})
}
});
i want code work without command ?start please how ?
oh god
what is the new form of client.channels.get is it client.channels.cache.get?
@opal plank
@pliant iron hm?
@cobalt spruce yes
Josh, what kind of security question?
So my npm package that I'm making is to get data from my mysql database on my website. Like getting an id of a user then it shows other details about them etc. How would I get it to connect to the MySQL database because if I just insert my MySQL details such as host,user,password etc people can just go in the node_modules file and get info and then login and that would not be ideal at all.
Would I have to create an api that it gets info from instead?
use functions / classes
@cobalt spruce yes
and make the user input their sql stuff
Josh, why would you make a package for this?
@cobalt spruce v12 client.channels.cache.get()
This seems like a module you would right in your code then just import the main file to use

client.on('message', async message => {
if(message.channel.name == "suggestions"){
if(message.author.bot) return
message.delete()
if(message.content.toLowerCase() === '?start') {
message.channel.send(' started successfuly :man_biking:')
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(message.channel, filter);
collector.on('collect', (m, col) => {
if(m.content.toLowerCase() === '?stop' && (message.author.id === m.author.id)) {
console.log("Stopped.");
collector.stop();
}
else {
let embed = new Discord.MessageEmbed()
.setDescription(m.content)
.setTimestamp()
.setTitle("Suggestion")
.setAuthor(m.author.tag,m.author.avatarURL({format: "gif"}))
.setColor('#4f65ff')
message.channel.send({embed}).then(embedMessage => {
embedMessage.react("751137346422046738")
embedMessage.react("751137346585493536")
})
}
});```
that spacing was giving me a headache
Josh, why would you make a package for this?
I'm doing it so people can easily get info from it that they can use externally for their bots/websites of their own within a couple lines of code
i want work code withour commamd brother @opal plank
oh it is ur code
yes
so then make a class like Official said
the moment you see me using embedBuilders you can bonk me in the head ace
i just switched all of my events, commands and errors logger to Webhook
and i fell the bot is faster
@main chasm wat is the problem
i want my code work without ?start
start ?
Okay thank you for your help. Just to be sure using classes will resolve the issue regarding people being able to get the MySQL login info? I haven't really used classes much in the past and am looking in to it more now.
wdym
async function handleVideo(video = false) {
if (video.duration.hours !== 0) return message.channel.send('โ I cannot play videos longer than 1 hour, dummy!');
}
look my code
why doesn't work
client.on('message', async message => {
if(message.channel.name == "suggestions"){
if(message.author.bot) return
message.delete()
if(message.content.toLowerCase() === '?start') {
message.channel.send(' started successfuly :man_biking:')
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(message.channel, filter);
collector.on('collect', (m, col) => {
if(m.content.toLowerCase() === '?stop' && (message.author.id === m.author.id)) {
console.log("Stopped.");
collector.stop();
}
else {
let embed = new Discord.MessageEmbed()
.setDescription(m.content)
.setTimestamp()
.setTitle("Suggestion")
.setAuthor(m.author.tag,m.author.avatarURL({format: "gif"}))
.setColor('#4f65ff')
message.channel.send({embed}).then(embedMessage => {
embedMessage.react("751137346422046738")
embedMessage.react("751137346585493536")
})
}
});
then dont attach it onto message
async function handleVideo(video = false) {
if (video.duration.hours !== 0) return message.channel.send('โ I cannot play videos longer than 1 hour, dummy!');
}
@earnest phoenix ๐
@pliant iron you would pass the credentials into the class, and use methods to interact with the db.
async function handleVideo(video = false) {
if (video.duration.hours !== 0) return message.channel.send('โ I cannot play videos longer than 1 hour, dummy!');
}
any help?
hm
@ancient nova can you stop spamming?
Ah okay thanks for explaining.
how i can fix it ?
sorry I'm just in a hurry

be patient like everyone else
Bae
yes?
const dispatcher = serverQueue.connection.play(ytdl(song.url))
.on("finish", () => {
async function handleVideo(video, message, voiceChannel, playlist = false) {
if (video.duration.hours !== 0) return message.channel.send(':x: I cannot play videos longer than 1 hour, dummy!');
}
}
this is my entire code
You need to explain what you want to happen, and what it currently is doing
I want to block usage of songs over 1 hour
i deleted message event but repeat messages when i send one message bot reply 3 message

ok, also can you please put your code in code blocks from now on?
sure
video.duration.hours !== 0 so if I understand this correctly, this would return true if the duration isn't equal to zero. So to solve this we would need a greater then, less than comparison.
I want this to equal zero since hours would mean if I pasted 1 then it would mean that if over 2 hours play error code
if I did
< 0
wait
opposite
this could work
if hours > 0 return
^
i wonder if its cache doing that gap

is that your bot?
yes
yeah
my refresh cache is chunking in 100 requests, so i can see
diff between total and live?
oh nevermind
but still weird that the count updates like that
yeah
thats likely on my refresh
but i dont clear the cache until i recieved a response
so its odd that the count is gong down
im bad in musics
and the refresh just updates the value, it doesnt remove it
maybe your bot reconnected
nah
its on all the time
that happened in this gap
between the start of the refresh cache and the end of it, that gap appeared

that was for bae right?
my idk man?
yeah
no, you
๐
debugging this is going to be a hassle
I've only made music bot's in a dev environment
if (song.duration.hours > 0) return serverQueue.textChannel.send('โ I cannot play videos longer than 1 hour, dummy!');
``` <- I made the code a bit shorter, let's try now
dossing who?
if he was ddos, he has more pressing issues than a music bot
not erwin vs husky
huh?
how much is an hour in MS
wdym me vs husky?
isn't it video instead of song?
I deleted async
bro @ancient nova you can use .addField("Duration", song.duration, true)
so I had to change
@main chasm I want to make the bot disable playing songs over 1hour not show the duration of a song
oh
fml why debugging on ubuntu so hard?
sorry
don't worry about it, you tried to help
(;
I'll make it work eventually
though i spend my entire free day coding the bot
uSE wINdoWs as YoUR prOdUCtiOn eNV
- coding one command

which has made me pretty sad
lol its on ubuntuon the production
my local rig is on windows
just slap vsc and run debugger, just like that
now on that shit rig, i gotta add a server
add debugger
open ports
is it 18.04 or 20.xx
ssh connect
and then i can expose the debugger on chrome
its such a fucking pain
i have no idea tbh
no clue
that is something you need to know
how would i accurately get all members in a guild?
also, you should have you bot run in a docker container if you can
if (song.duration < 3.6e+6) return serverQueue.textChannel.send('โ I cannot play videos longer than 1 hour, dummy!');
``` lol
why would you do that?
I am too tierd to think
18.04.2
Erwin, to add more to your plans for your bot, you should have your bot run in docker
i'll use docker for this sort of stuff down the line
I'm very glad I learned docker
return this.getMember(data.member, guild).user;
^
TypeError: Cannot read property 'user' of undefined
I forget what I used but it might have been ytdl
anyone help
git and vsc have been enough for me rn
that the user aborted a request
^
I am slowly dying inside
how do i put how many servers the bot is in
ping me if u have solution
@earnest phoenix bot.guilds.size returns the number of guilds the bot is in
bot.guilds.cache.size @earnest phoenix
oh yyeah cache
i said u
i said u
@main chasm didnt work
Is there an array method to put item 0 in the last spot and move all items down by one?
what is version discord ?
Is there an array method to put item 0 in the last spot and move all items down by one?
@pure lion array.push(element)
adds an element at the end
array.shift(); first to remove the first element, then array.push() to append it to the end
array.shift() returns the element that got removed
let removedElement = array.shift();
Ah
hello
bot.user.setActivity(`.help | more commands, ${bot.guild.cache.size}) @earnest phoenix now
i know
bot.user.setActivity(`.help | more commands, ${bot.guild.cache.size}) @earnest phoenix
})
now

definetly when cache restarts
one sec
wdym
the code you use to set the bots status
bot.user.setActivity('.help | more commands soon ');

so you didnt add the client.guilds.cache.size stuff
Hey so I want to close the leveling system using a command in another file, how can I access the file leveling system is in?
relative path
Hey so I want to close the leveling system using a command in another file, how can I access the file leveling system is in?
@rancid bramble./someFileInTheSameDirectory
../SomeFileInTheDirectoryAbove
badddddd
raspberry or vps
f*
i dont give a damn but DO N O T USE GLITCH
Impossible.
you wont get a free vps
sure
They could make a vm ig
pc can't host 24/7
Use like Google cloud, you get something like a year for free
what other app is like glitch cuz i guess glitch bad
google cloud fine?
godaddy
any free hosting is bad
heroku and glitch arent meant for discord bots
if you want hosting, get a cheap vps
@earnest phoenix no heroku not bad
yes, heroku is bad
heroku IS bad
nooooooo
I recommend google cloud over aws from my person experience
i hosted my bot from heroku and not any problem very fast
whats a app like glitch
Use heroku then?
yes
and whats wrong with glitch
Glitch has many things wrong with it
@earnest phoenix use heroku
limited hours? cant store shit locally? limited ram?
and conect github
heroku 24/7 but 1m restart
yes
limited hours? cant store shit locally? limited ram? Need uptimers? Possible token leak? Cant use private repos?
i can think of a couple reasons not to use em'

glitch and heroku basically made all free hosts look shit
when some arent
and retards use glitch and heroku so thank u
by buying one
no free
I mean if you're in the hosting industry it's very easy to find free hosts, most aren't going to last as long and going to be as reliable though
lol


Check pins
because of idiots misusing the platform and abusing it for discord bots, glitch and heroku took restrictions on their free tiers and the servers are no longer as powerful as they used to be which sucks for people who actually used them for what they were intended for; websites
For hosting:)
The most basic way to describe it is as "The wrong tool for the job."
he isn't special
a lot of other people do it too
granted, there's a stereotype for those kind of people
its like bragging about me running stuff on windows 98. Does it work? sure. Should u use it? no
the bot is shit and the dev has no clue what they're doing
'my friend hosts on glitch'
its nothing to brag about
if anything you should be ashamed of it
shows they dont care about where they host theier bots in
they donโt care about quality/ping is what it shows me

client.on('message' , msg => {
if(msg.content.startsWith('https://')) {
msg.author.send("my server link")
msg.author.send('check')
// i want when user send link to dm bot bot copy tha link and send to another server bot in
}
})
@main chasm im on the app but idk what to do
just because the content starts with https:// doesn't mean that it's a link
wat
https://
https:// uwu
i donโt get it
are not links
sending 2 messages
noooooooo
i want when user send link to dm bot bot copy tha link and send to another server bot in
Make it then
i know
so many things you ignoring
but
message.channel.type && regex(perhaps) for links in DMS?
Any good free hosting sites?
i want coypy link member and send to another channel
I know replit and glitch

amazon free tier
f1 micro is decent
"free"
aws is reallygood
is actually good
i have like
but 1 year


im so confused on heroku
some are not considered "live"?
they are offline
im so confused on heroku
@earnest phoenix Never had any issues not using Heroku
Auger, check title
@opal plank Non-live streams?
What even is that?
apart from that nuicense everything is fine from the looks
i patched a couple things i overlooked too
its almost 100% done

Yes mr dedo
lo I speak kurdish
Nawm alana ๐คฆ๐ปโโ๏ธ
english here
Iknow ๐
๐ถ
@half lodge baxwa drozni
๐๐๐
Aha great ๐
f*

@faint prism looking better now
indeed, though im not on all streams
which time my bot accept it
currently only at 700
?
cache still going up
though now i got a funny cache behaviour during the re-cache event
Is this correct syntax (js)?
let user = message.mentions.users.first() || message.author || message.member;
@fleet hornet why so much redundancy?
I don't think message.author would ever be empty
can't ping from an embed
let user = message.mentions.users?.first() || message.author!
if(message.mentions.users.size){
let user=message.mentions.users.first()
if(user){
one liner
@fleet hornet
let user = message.mentions.users?.first() || message.author!;
use that instead
actually im not sure if ! is Typescript sytanx only

i would assume not
It's ts only
not Erwin
das me
what does that ! mean in ts?
Fuck Iโm still in development
instead of checking,it means its always there
They ask how's not erwin but they never ask how's erwin
its basically assurance that whatever comes there is always present
Wait this is development
i want if i send channel 1 , 2 , 3 ,4 , 5, , .... add react to any number or message and 18 msg or 18 number max not add react can u help me?
so you dont need to check if it exists or not
i didnt even understand a third of that question
what does that ! mean in ts?
@quartz kindle I assume it's the logical not
i want msg.react 18 react any msg 1 react and 18 msg max bot not add react
1
2
3
18
max
19
Spam?
TS:
E n g l i s h

i want msg.react 18 react any msg 1 react and 18 msg max bot not add react
@main chasm I didn't understand one thing from that
English please
its basically assurance that whatever comes there is always present
npm i english
or html elements
oh so like the <object>?.<property> in C#?
npm i kurdiish v12
props.getByElement('this')!
that assures that it will return so you dont have to do
if() {}
not quite
nice
conditional chaining is different than that
i forgot the proper term for it
but im familiar with its usage
a.b?.c
that checks if b is present
if it is, it tries c
right
else it doesnt(or it would error)
with ! you can directly assure the compiler its there
@main chasm ```js
let collectorMessages = <TextChannel>.createMessageCollector(m => m.content, { max: 18 });
collectorMessages.on("collect", cMRTB => cMRTB.react("๐"));```
its used mostly in calls
then what's the point of it?
@earnest phoenix thank u so much you understand me
see the point?
a
what is (!)
how to make a word command a embed
var b = database.find('a'); //error database undefined
if(b) console.log(b);
//====================
var b = database?.find('a'); //no error, ? checks if database is present
if(b) console.log(b); //logs undefined/null
//====================
var b = database?.find('a')! //checks if database is avaliable, which isnt here, so it doesnt try find('a')
console.log(b)
//====================
var database = postgres
var b = database?.find('a') //checks if database is abaliable, which is is
console.log(b) //errors, b might be undefined
//====================
var database = postgres
var b = database?.find('a')! //checks if database is abaliable, which is is, then assures a exist
console.log(b)
@faint prism
does that make sense?
Did you mean to have an example where it's database.find('a')! ?
I mean in your snippet there isn't an example where you don't use just !
there is
does doesnt use it
b might be undefined
so it errors, though using console for this is bad
@earnest phoenix bro another question
cuz console can log undefined
@faint prism https://youtu.be/BwuLxPH8IDs?t=10834 watch this, i put at right timestamp

client.on('message', async message => {
if(message.channel.name == "suggestions"){
if(message.author.bot) return
message.delete()
if(message.content.toLowerCase() === '?start') {
message.channel.send(' started successfuly :man_biking:')
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(message.channel, filter);
collector.on('collect', (m, col) => {
if(m.content.toLowerCase() === '?stop' && (message.author.id === m.author.id)) {
console.log("Stopped.");
collector.stop();
}
else {
let embed = new Discord.MessageEmbed()
.setDescription(m.content)
.setTimestamp()
.setTitle("Suggestion")
.setAuthor(m.author.tag,m.author.avatarURL({format: "gif"}))
.setColor('#4f65ff')
message.channel.send({embed}).then(embedMessage => {
embedMessage.react("751137346422046738")
embedMessage.react("751137346585493536")
})
}
});
// i want my code work without use ?start or any command just with name channel can u fix ?
when bot ready code work
Just remove the if statement checking for the command
when i remove it i send 1 msg bot reply me 3 msg
@opal plank so basically its the same as !important in css
or something similar
like just do that and dont check anything
kinda
ts is so weird
check this vid
it might provide more insight than me explaining
timestamp already on the proper spot
just watch the following minute or two
i did
its that basically
its good for queries to make sure the compiler knows its there
its like the language is babysitting you and not allowing you to do anything, so then you have to add workarounds to force it to work
thats why i dont like it lmao
if you oversight something, ts might catch it for you
you may end up spending more time fixing ts than your code
its like one wise man once said, would you rather silly bugs in development or insanity inducing errors in production?
you learn from your mistakes
ts is just a stepping stone to elm
learning from mistakes in production sounds like a bad idea overall
in testing? sure
but the whole point of errors is oversight
you dont 'expect them'
the worse the error the stronger the lesson
true
idk,im digging ts quite a bit
its also good if i go for strong typed langs
got a good habit of typing everything
tim
may i ask you for a favor?
depends what lol
@earnest phoenix my code fixed>?

idk
so no?
a!help
i can look, but idk if i can help
@opal plank please just help me for one code
and ubuntu is a pain to attach debuggers on
cuz i gotta expose them somewhere, vsc debugger > everything else
client.on('message', async message => {
if(message.channel.name == "suggestions"){
if(message.author.bot) return
let filter = m => !m.author.bot;
let collector = new Discord.MessageCollector(message.channel, filter);
collector.on('collect', (m, col) => {
let embed = new Discord.MessageEmbed()
.setDescription(m.content)
.setTimestamp()
.setTitle("Suggestion")
.setAuthor(m.author.tag,m.author.avatarURL({format: "gif"}))
.setColor('#4f65ff')
message.channel.send({embed}).then(embedMessage => {
embedMessage.react("751137346422046738")
embedMessage.react("751137346585493536")
})
})
}
});
// now when i send one message bot send 3 message or 4 message why?
it sends a message ervytime amessage is collected
therefore its spam
let filter = m => !m.author.bot;
this is your only filter
if the message isnt from a bot, it sends that embed
its spam
but i want work without command
unprefixed commands = bad
is that bot in multiple servers?
or is that only for YOUR server?
then its fine
yes only my server
spammy, but fine i guess
but when i send 1 message bot reply with embed send 3 or 4 message i want fix it
because you're making it sent 3 or 4 messages
filter should already work but just to be safe doanother bot check inside
Man, reflashing the pi OS, and it's still crashing. Now, it's not even saving mp4 footage anymore either :/
Either the SDcard or the R Pi zero is fugged
somewhere
@opal plank do u want know why i removed prefix?
i know what you trying to do
cuz i can't use db
you want a poll like suggesting
yes
you CAN use db
how
or use mongodb atlas
no
databases are for persistent storage
meaning it doesnt lose its values
just require those values on startup
yess i want it but mongodb free? cuz i want only my server work
thank u for all
i understanded
mongodb is free
yess i want it but mongodb free? cuz i want only my server work
@main chasm yep, atlas is
Hey, I have a web dashboard for my sharded bot. I have to make requests to said bot for fetching the role ids and names in a particular server for the auto roles section. Currently I'm using broadcastEval to fetch a list of roles of every server that matches the target id on each shard, then filtering out the empty results and grabbing the first value. This works, however if the specific shard for that guild is offline, or hasn't been started yet, it will obviously fail and return undefined for the server. I got around this by making it default to an empty role array.
My question is this. Is there a better way to do this? The ideal would be to have a separate client instance for the dashboard that receives no events, but can still use the api to fetch the roles, etc (no cache). Is there any way to achieve that with a sharded bot?







