#development
1 messages · Page 1123 of 1
Convert it before it is sent
toString is kinda a weird thing in js
i feel like it should be called something else
like what
translateToString()
message.delete()
it more seems like the string representation of said object, like how python has __str__
Lmao
sex me daddy
no color will give you 0
S e X m e D a D D y
that's why i said padStart
OMG
idk what to do wid dat
Fetch message by ID => delete
I don't think you should color it like that. You'll end up with some bad contrast between the text and the background color
If the colour is above/below X amount of brightness set the text colour to Y
css can auto adjust for dark backgrounds cant it?
yeah. im gonna try and make the background colour the inverse of the role colour but look nice somehow
yeah the servers just cancer its all good
check if the color is light. if so use, black as text
how would i do this?
can't you somehow measure the hex and check? dunno
If thingy to string sex me daddy > number
Then you just end up with inconsistent text coloring which is just as bad in my opinion
you could put a box next to each one with the color
Kind of how discord does roles
the idea was to try and make it look like the way mee6 has it with sumthing but in an option select thingy but ofc it flopped
then dont
store the bots sent message in a variable
and then do .delete on that variable
asks how
WHAT
Woooooooot
message.author.bot would be a bool of if the author is a bot
Silly names aside I just did what Discord does
alexis u 2 gud with ui
let botsMessage = await message.send()
Bulma 
botmsg.delete
more u go into the website, the more u see the level of effort go ⬇️
@earnest phoenix did you open a dm channel to yourself
when im(or the docs are) refering to message, i mean a class message, not the variable message
Same Lost. I'm not very happy with my website right now
<User>.createDM()
Considering commissioning someone to make some mockups because frontend development isn't my thing
you can only use await in async functions
you can use .then if you dont want to use async, or you can use async await. really up to you
no ones good at frontend ;p
what's the error, missing permissions?
i know a guy who im making a smol project with is really good at frontend
Thanks haha
GOd what i put on this?
2 people but one im working with
is he like the tim, but with frontend
their dms are probably closed
front end tim
better™️
Which one are you using @dire obsidian
Frontend tim
well none of these
hm
nah
Then put None of these
if tim got into frontend, they'd be on the same level for sure
@earnest phoenix the error is here
Google it
you add async before function
having a decent grip on async and promises is probably a good idea
especially when working with bots
discord.js is promised based so f
^
It doesn't take any params
tf
you named your function async
You're using the incorrect method @earnest phoenix
not made it async
oohhh, @earnest phoenix the bot is trying to dm itself
i think you mean client.users.fetch('id')
client.user is your bot
https://discord.js.org/#/docs/main/stable/class/UserManager?scrollTo=fetch @earnest phoenix for more info
async function functionName() {}
@earnest phoenix didn't I tell you to learn JS?
I'm not sure what the issue is here
Site (in case the console is useful): https://ale-bot.xyz
my nginx website config file:
server {
listen 443 ssl http2;
listen ...
huh
never used peer.js
🤷♂️
peer-to-peer data, video, and audio calls.
wait
video calls
pog
ur text editor is maybe fooked
video calls
Yes
or what is botmsg ?
to this point idk what you're doing
delete will always be any right?
what is botmsg ?
Wd72j8ejirnfiejedjrie272828282727272u2
What is botmsg defined as
@pure lion it would be nice if you didn't write some next bs.
Where
here
Also people will help you on stackoverflow when they can.
its ur text editor, even if it doesn't have jsdoc, it should say promise void or some shit
any type is normal for delete()
where are you sending the message?
i mean, it shouldn't
and what message are you sending?
it must have jsdoc, and it takes parameters
your calling .delete on the function
Did you just copy shivaco's code
not the message
@earnest phoenix
please learn js
just basic js so that you can troubleshoot your issues
<Message>.delete()
Woo istg
yeah, im out. we tried
i find my command handler: discord.js-commando
Omh
i only disable some things and ya
Is that even supported anymore
you know, the first result on google for fs getting all folders in directory is what you want?
Klasa and Akairo are the two frameworks I recommend
i told you to look it up without specifying djs because its more of an fs issue than a djs issue.
Its like a movie, I’m having fun while watching. Is it always likr that?
so bascially how you code is that you save the code as strings in a script then you write the strings to files and then you execute the file names with exec
bascic multi file scripting
Its like a movie, I’m having fun while watching. Is it always likr that?
@gusty patrol yes, development is more hellhole than #memes-and-media
lol
m
no
doing random things doesnt work
your just adding random things one by one asking if its right
I'm out
my bot is done
@earnest phoenix I don’t think so
@pure lion so, are you going to actually have p2p video calls?
Yeah
pretty cool
That's kinda the entire idea of my site
anyone know what a nonce is? i've read the discord docs but still confusion


but you're right
XD
ooo nonce
npm i pedophile
do you even need to deal with them?
a nonce is a integer / string used to validate if a message was sent
your calling .delete on a function
J a v a s c r I p t
not Message class
time to let my uncle know he's not a nonce thanks m8
lmao
@earnest phoenix Dice is gonna kill you, I prefer you to go. Really
Lmaoo
me as a brit
most people here are i think
me as a brit
Same tho
ay
gettem dice
so no?
@earnest phoenix are you asking lol
confirmed retard 101
// Send the message (returns a promise);
<Channel>.send('your message');
// resolve the promise and then
<Message>.delete();
mmm I love me some @earnest phoenix soup
@pure lion I CAN LEARN JS TOMORROW
@earnest phoenix When you learn, plz tag me too.
web related?
Yeah
make me look ugly cuz ha lol impossibel
Okay I'm done
video calls is pretty cool, if it could support screensharing that would be amazing.
@earnest phoenix eat sosig
Anyone know how to do a truth table in a k map?
Have you looked in the docs of d.js yet?
probably would have to be an app at that point
Okay I'm done
@pure lion hey hey hey calm down easy man
video calls is pretty cool, if it could support screensharing that would be amazing
I'll look into that
this started by pointing him at djs docs. the exact page that explains how to do it @vernal rivet
Oofers
Ngl I could go all out with this app
we did
everyone knows how to, we just cant spoonfeed you the answer
Yea
You have to learn beginner to intermediate level JavaScript concepts
^^^^^^
And tomorrow you'll get the same answers
No
I should have a basic bot tutorial with code setup by tomorrow then
And ill give you free codes

@queen moss no
inb4 just copy pastes code
If you're not willing to learn how to code then go look for an open source project online and use that
there's always
d i s c o r d b o t m a k e r
If you really need to check d.js guides. They will explain a lot of things, but it is best you learn J's first before jumping in
*cries in how the fuck do I fix my issue*

Not gonna lie I earned how to code by making a Discord bot
I have this command handler (https://hastebin.com/opigasatez.js)
Whenever I update one of the commands, it logs perfectly fine "Updated command: balance", but it does not actually use the new changes when I use the command, something between lines 22 and 30 is not right. Anyone know?
reloading commands has to be done in kind of a specific way
God what is that name
with bulma, any1 know how i can remove the dropdown arrow thingy? i could've sworn i saw it before.. im here https://bulma.io/documentation/form/select/
I need music bot in my discord server how can invite any discord Music bot
People with unicode symbols in their name give my db hell
Lmaoooo
reloading commands has to be done in kind of a specific way
@solemn latch how so
I need music bot in my discord server how can invite any discord Music bot
the command has to be deleted from the require cache first
@placid iron ID and username#discrim
People with unicode symbols in their name give my db hell
@faint prism thats why i use id
then if you need the name you can fetch it using the client and the id
oof, fuck what am I doing then lmao
@digital ibex dunno about forms but I know that you can use is-arrowless for the nav bar. Try that maybe?
I need music bot in my discord server how can invite any discord Music bot
@rapid heath SOMEONE ANSWERED FOR GOD SAKE
Please help I need music bot in my discord server how can invite any discord Music bot
delete require.cache[key];
you
moment there @faint prism lmao
bruh im done
When you run your code, you run an instance of the code. If you try changing it, you have to create a new instance of the code. Idk what the method is for reloading commands, but that is why it doesn't use changes
Ok
https://top.gg/tag/music @rapid heath
No way that name is allowed here
you :2Head: moment there @faint prism lmao
@placid iron I had a :2Head: moment since the beginning of the project
XD
its not, a mod just hasnt seen it yet
edah, i tried it but it didn't change anything :(
???
oh i put dropless instead of appleless
prefix indeed
1 sec
both dont work :/
Just remove it yourself then
dis what i put html <select class="select-role is-arrowless" name="role"> <% roles.forEach((role) => { %> <option value="<%- role.id %>"><%- role.name %></option> <% }) %> </select>
@placid iron Well I store it because I return a list of available users on a command. Wouldn't it be slower to use getUsername or whatever instead of IO?
how?
Your own css
replicate the bulma one but without arrow?
@solemn latch https://i.callumdev.pw/urn1i.png
And I do have delete require.cache[file_dir]
Anyone know how to fix my issue? It's been 4 days and fuck it's awful
I'm not sure what the issue is here
Site (in case the console is useful): https://ale-bot.xyz
my nginx website config file:
server {
listen 443 ssl http2;
listen ...
@faint prism it would be slower by like, not much. but you save the disk space and you have to do less IO which i think is better
oh im retarded
im not sure then
well same thing:/
Give me link music bot
!help
oh im retarded
@digital ibex lovely announcement
@graceful quarry no on 2 counts
I'm all for less data. I'll look into it
yeah
Give me link music bot
@rapid heath no i literally sent you a link to look for yourself
oh im retarded
Same
Just ignore him
kl
if the member is cached in your client then the get_member should be faster than io i assume
@earnest phoenix Where there haven't any music bot
chip??/
take your pick
this stupid arrow is giving me ptsd
https://top.gg/bot/614109280508968980 use this bot 
its good music bot

@solemn latch thank you love you bro
O w O
I mean, that's about it
Or you could Google it 
Oh yeah
Theres that, & redirects, such as nekos.club goes to --> www.nekos.club or whatever you want really
i am
how would i make a randomised response section in the code
@gleaming steeple an array
thx
loop through it and bam
array[randomNum]
@coral lichen so
bot.on("guildMemberAdd", (member, message, member.guild) => {
let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));
let grade = gradenew[message.guild.id].grade;
member.roles.add(grade);
})
??
Oh 😐
is that a json database
bot.on("guildMemberAdd", (member) => {
let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));
let grade = gradenew[member.guild.id].grade;
member.roles.add(grade);
})
there you go
when a guild member is created/joins
rool 4
it doesnt supply a message or a guild
I see nothing wrong with having a json file containing four million lines of settings & data

I see nothing wrong with having a json file containing four million lines of settings & data
@earnest phoenix acc yea same

or mongodb
Well i cant find what i want
mongo's cool too ye
@marsh sapphire what are you looking for

Thx @coral lichen ! 🙂
Anti links
there's websockets then that's wss://
So
www. is a subdomain
there can be any number of subdomains
there are a ton of example regex's online for getting links
mongo's cool too ye
remove the "too" because quick.db is not cool
For people starting out, it's a good db to use
mongoose is sexy
being able to reference other documents in one is tasty
and everyone else is wrong
something sql databases lack sadly
no mongodb is best driver
^^^
bot.on('message', (message) => {
if (message.content === `@echo shale`) {
const verification = new MessageEmbed()
.setColor("GREEN")
.setAuthor("This verification becomes invaid after 30s")
.setDescription(`Do you want to kick ${toKick}?`);
message.channel.send(verification).then(msg => {
msg.react(":white_check_mark:")
msg.react(":x:")
});
const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' message.delete();
message.channel.send(`@versed oracle`);
} else if const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' msg.delete();
message.reply("Alert canceled...");
}
}
});``` Code ^^
```js
/home/container/Draits-Utilities/index.js:51
const filter = (reaction, user) => reaction.emoji.name === '✅' message.delete();
^^^^^^^
SyntaxError: Unexpected identifier
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
``` My error ^^
you aren't supposed to delete that in the filter
hmm?
else if const filter is not valid
its not valid code
ok
an if expects a condition inside parens
like this
else if(something) { do something else }
you cannot do else if something
bye

BYE
👋
i sometimes wonder if any of the people in here know the lang they're developing in lmao
i dont
ok goodbye
Lol
"I'm a master in C++" big lie
py = poopy yeah
py = programming yeah
sa
C = cock
java = ()
{
}
vsfd= fuck the administration give me adm 😎
you need some help?
Ye
what with
Wait
how do i make a folder
Where do I make folder?
Lemme check its javascript bcs im not sure
desktop
Ye it is
im so lost, how do you start programming and not know what language it is
im so lost, how do you start programming and not know what language it is
@solemn latch whitename. thats how
i've seen some people say "english"
Oof
like do you just hello bot, i want you to listen for messages, if the message is the ban command, make sure the member has the ban permission, check the roles too, and if that all clears, ban them, then try sending a message, saying they were banned, in a channel called mod-log
lol
Hi everyone, I'm searching how to get a role ID by mentioning it but I don't find how... can someone help me ?
how are you using it
What language?
that too
Big question
lol
Do @role
sorry
discord.js
Have you check the docs?
it's in message.mentions.roles
i've seen some people say "english"
@misty sigil I've heard that a lot
Yes I did@vernal rivet
nah i found out https://canary.discordapp.com/channels/264445053596991498/272764566411149314/741040262687752284 its this
thats how they code in english
it's in
message.mentions.roles
Ty I'll check
coding is technically english
yes
yes
igg
Ty very much Ruchurd
ima sleep its 11:30 pm gn
English is an actual programming language. It's a esolang tho
you don't just say oi computer do that and do that
applescript™️
you don't just say oi computer do that and do that
oi mate write 'hello world' ya lazy fuck
^^^^^1 ^^^^2 ^^^^^^^^^3 ^^^^^^^^^^4
1: process.stdout
2: .write
3: string
4: async
aren't there meme-like languages like that
Uh
lolcode
Python: how do i let my bot send + instead of space?
?
what
.replace?
use strings lul
Ah yes
how?
Fix for me
we dont do that here
how r u sending it?
*yeet into websocket*
@earnest phoenix your code is a mess
its not even that bad
the only questionable thing is just js const args = message.content.slice(prefix.length + arg[0].length).split(" ").join(" "); if(message.author.bot) { return; } if(message.content.startsWith(prefix)){ return; }
wait
thats if it starts with prefix
so thats exactly the opposite of what you want
lmfao
lol
Python: how do i let my bot send + instead of space??
how are u sending the message with the + ?
learn python
What do you mean by "sending + instead of spaces"
so i send a text with a lot of spaces it should put instead of the spaces, +
it should repeat what i write
Can you physically replace them?
<string>.replace(' ', '+') ?
no its random
well yeah then Lost's way
its a thing in python too
one of the first things i learnt when learning python :yike:
k didnt know
pls dank
but you'd need regex to make it go for every space though
regex is unnecessary in this case though
the 3rd parameter is optional
learn python
@tight plinth YES
O_O
Hey !
module.exports.run = async (bot, message, args) => {
let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));
let roles = message.mentions.roles.first() || bot.roles.get(args[0]);
if(!message.member.hasPermission("MANAGE_GUILD")) return message.reply("Désoler, vous n'avez pas la permission de faire cela.");
if(!args[0]) return message.reply("Merci de mettre mettre un grade.");
gradenew[message.guild.id] = {
grade: args[0]
}
fs.writeFile("./gradenew.json", JSON.stringify(gradenew), (err) => {
if (err) console.log(err)
});
let grade = gradenew[message.guild.id].grade;
let embed = new Discord.MessageEmbed()
embed.setColor(colors.green);
embed.setTitle("Succes");
embed.setDescription(`Nouveau Grade: ${args[0]}`);
message.channel.send(embed);
}
The ID of my roles have symbol, how I can dont have that ?
ummmm String.replace();
Euh I dont understand
what exactly are u trying to do?
are you talking about <@id>
Yes @vernal rivet
String.replace() will work then
But why
wait why are you needing to remove the symbols? message.mentions.roles.first() searches for mentioned roles in the message
A proper role mention is <@&ID>
Is there any way i can make my bot create a role and make overwrittes for the role in all the channels (muted role)
yes
Iterate over channels and apply overwrites for the muted role
@vernal rivet for a autorole, I cant give a role with <@&id>
are you using an id that was passed as an argument?
I just need id, not <@&id> and I dont know how I can just have the id
you don't need to do extra steps if you are using one that was passed in as an argument, then the Role object already has a property called id. it will give you the id. There is no reason to do anything complicated
Because member.roles.add(); dont work with symbol
yes
No
My error
Supplied roles is not an Role, Snowflake or Array or Collection of Roles or Snowflakes
Well you've already been given the answer. string.replace
that error is pretty descriptive
dumb regex question... how can I make it get the code and not the first part
Post that regex real quick
Regex in a nutshell is just /(ahifnsjfens)+700\/[big, balls]/+g\
/(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li)|discordapp\.com\/invite)\/.+[a-z]/g
I would use (?:https?:\/\/)?(?:www\.)?(?:discord\.(?:gg|io|me|li)|discordapp\.com\/invite)\/(.+) and get the group https://oliy.is-just-a.dev/se361_5445.png
oh yeah true, didn't even think about that lmao
or is there a regex thingy for urlencoded
no, there isnt, as far as google says
would be a good thing like a \U
for any non urlencoded char
let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));
let roles = message.mentions.roles.first() || bot.roles.get(args[0]);
if(!message.member.hasPermission("MANAGE_GUILD")) return message.reply("Désoler, vous n'avez pas la permission de faire cela.");
if(!args[0]) return message.reply("Merci de mettre mettre un grade.");
gradenew[message.guild.id] = {
grade: args[0]
}
fs.writeFile("./gradenew.json", JSON.stringify(gradenew), (err) => {
if (err) console.log(err)
});
let grade = gradenew[message.guild.id].grade;
let embed = new Discord.MessageEmbed()
embed.setColor(colors.green);
embed.setTitle("Succes");
embed.setDescription(`Nouveau Grade: ${args[0]}`);
message.channel.send(embed);
}
Where I need put String.replqce(); ??? 😭
i fock up, im focked up, all is fock up
you can put String.replace() anywhere you want to replace something
May even want to use (?:https?:\/\/)?(?:www\.)?(?:discord\.(?:gg|io|me|li)|discordapp\.com\/invite)\/((?:[0-9]|\w|-)+) so you dont get people trying to use things like ? query params to mess with the code
String.replace() is just method for strings.
you can only use it for string variables.
I dont know where I need put 😭
im not sure what your trying to replace
The <@&> of the id
but like i said, you have a Role object. You don't need to use String.replace. The Role object literary has a property called id, that is a Snowflake, which is what is need to add a role to a user
I dont wqnt <@&> when I take
then where ever your id with <@&> is used, you should replace it.
or store it in a variable
he is trying to replace something that doesnt exist woo. he is having the command to search for a mentioned role. That makes the variable into a Role object
Yes but Im fatiguer and I dont know how I can work de autorole 😭
I work this of 3 hours
if your trying to get it from args, i think this will help you.
https://discordjs.guide/miscellaneous/parsing-mention-arguments.html#using-regular-expressions
when a user joins, give them a role
thats kind of unnecessary to do woo. he has a variable called roles that is type of Role.
/**
* @type {Role}
*/
let roles = message.mentions.roles.first() || bot.roles.get(args[0]);
//<@&id>
roles.id; // id
any form to disable the defaut commands of discord.js-commando?
or the discord.js server
wot
i didnt even look at the code ngl
im using the nodejs mysql thingy, but i cant seem to be able to use ? to define the rows i want to change
oofers
it adds ' before the items and mysql rejects the syntax
await connection.query("UPDATE balances SET ?=?+? WHERE id=?", [coin.ticker,coin.ticker,amount,message.author.id])
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''doge'='doge'+873 WHERE id='430117093573394442'' at line 1",
sqlState: '42000',
index: 0,
sql: "UPDATE balances SET 'doge'='doge'+873 WHERE id='430117093573394442'"
}
he was trying to do
/**
* @typedef {Role} roles
*/
roles.replace("<@$", "").replace(">", "");
how can I make it not add the '
that's what it will always do if the items in the array are strings
ah
uhhhhh
xD
not literally the str type itself
@halcyon ember it seems that doge in your case is a column name?
you can use two question marks ?? and mysql recognizes it as an identifier instead
@stable grail str.replace() does not modify the original string
hello, in the description of my bot on top.gg i have done one styling to test this out but it doesnt change the button color, anyone know why?
<style>
.votebutton btn btn-orange btn-2x {
color: #004ecc;
}
</style>
it doesnt seem that your code is correct
something wrong with it?
[08/06/2020 00:04:59] - (WARNING) Unknown Guild (GUILD_MEMBER_REMOVE Guild=GUILDID).```
I need to add handling for this, so it will delete user records that no longer exist in any guilds
But I don't store guild Ids with user records currently
yes
.votebutton {
background-color: #0f0f0a !important;
color: #1abc9c !important;
border-radius: 3px !important;
color: #3955c6 !important;
}```
heres my code
fuck you discord formatting
.votebutton btn btn-orange btn-2x
would look for the class votebutton thats a <btn btn-orange btn-2x></btn btn-orange btn-2x> right?
btn btn-orange btn-2x
those are all elements to css syntax
since you didnt prefix them
with a selector
e
How can I put a custom emoji in a embed title?
If you're using the title field, you can insert an emoji like normal. Emojis are like <:name:id>, but will be <a:name:id> for animated emojis.
Keep in mind you can't use emojis in the author name field, footer, and some other places.
can you show?
just as :pepeOK:?
does your bot have access to the server it came from?
yeah it's a discord bot just for my server
and in the embed it says :pepeOK:
nothing else
I think this should clean up any user records left over if my bot is removed from a guild :)
private Task LeftGuildHandler(SocketGuild arg)
{
IUserRecordsRepository userRecordsRepository = _userRecordsContext.GetUserRecordsRepository();
userRecordsRepository.UserRecords.ForEach(user =>
{
if(arg.GetUser(user.UserId).MutualGuilds.Count == 0)
_userRecordsContext.RemoveRecord(user.UserId);
});
return Task.CompletedTask;
}
does your bot have access to the server it came from?
@sudden geyser what should I do?
is the emoji animated? just in case
No
can you show your embed code?
let voteEmbed = new Discord.MessageEmbed()
.setColor(guild.me.displayHexColor)
.setTitle(':pepeOK: New Vote!')
.setDescription(`<@${voter.id}> is amazing!\nYou can vote for Astro too [here](https://discord.boats/bot/715621848489918495/vote)`)
.setFooter('Thank you for supporting Astro!');```
why does it show as :pepeOk: inside the codeblock
Idk discord I guess
i can try fetching it like that
const emoji = guild.emojis.resolve('7406311010265530307');
and then use emoji.toString() right?
Wrong chat I think .
I am trying a new way to delete channels. This looks good. I dont get any errors( I will include the console.log). Yet, it doesnt delete my channel.
The count is 0 in my log. What am I missing?
client.on('voiceStateUpdate',(newMember) => {
const voiceChannels = client.channels.cache.filter(c =>(c.parentID=="731406241665908776")?c.type === 'voice': null)
let count = 0;
for (const [id, voiceChannel] of voiceChannels) count += voiceChannel.members.size;
(count!=0)?console.log("connected"):voiceChannels.delete({ timeout: 10000, reason: 'It had to be done.' })
console.log(voiceChannels)
console.log(count) })
why are you using !count==0
connect_error() takes 0 positional arguments but 1 was given
@socket.event
def connect_error():
print("The connection failed!")

maybe it's @socket.event
-caching issue
-youre using it with one argument somewhere
-you probably missed smth
I assume @socket.event is trying to call it
It happens on connection, actually
knowing how smart you are, its probably not you. what even is socket.event
socket = socketio.Client()
it's a decorator I got from the example for python-socketio
Well, scrapping that event until further notice
Tfw forgot to add logging for a new update that purged half my db (as intended, but I would have liked to know who)
rip
Hello!
Hey
How to get Bot developer?
K thanks
that shouldn’t be your goal but you do you, make a bot and develop it
there are many resources online
Hi! It seems like you are looking for information on how to get your bot verified.
Once your bot reaches 75 servers or more, you are eligible for bot verification. On October 7, 2020, bots with 100 servers or more that are not verified will not be able to be invited to any more servers. You verify your bot on your bot's application page, under the "Bot" section in the sidebar.
If you need more information, check out this article written by Discord about The Future of Bots on Discord and you can ask questions in the Discord Developer Server.
We cannot provide support on how to get your bot verified.
upgrade node
^
I did so many times
what version
it's at version 10.21 rn
youre using a version of node lower than 12
Discordjs v12 requires node v12
no odd numbers!
also you should use node version manager
Use 14, its not an odd number
i cant use 14 with sqlite
Wait really
yep npm refuses to download it
I mean I can
iirc
Oh god, I wiped my db. Rip
Does this affect anything regarding having the bot listed on the DBL?
Turns out the GetUser() docs state that it will return null if any user is offline on a large server.
@quartz kindle as u are here, sry for the ping, but maybe you are able to help me^^ I have already asked people, but nobody answered me.(some tried to help me, thanks for that, but it didn work.)
So. I am using the event:VoiceStateUpdate.
My goal is: my bot should delete the voice channels, that have 0 users.
I think it is pretty clear, what I am trying to do, when you see the code.
client.on('voiceStateUpdate',(newMember) => {
const voiceChannels = client.channels.cache.filter(c =>(c.parentID=="731406241665908776")?c.type === 'voice': null)
let count = 0;
for (const [id, voiceChannel] of voiceChannels) count += voiceChannel.members.size;
(count!=0)?console.log("connected"):voiceChannels.delete({ timeout: 10000, reason: 'It had to be done.' })
console.log(voiceChannels)
console.log(count) })
My console log shows me the count of people when they join/leave the channels, but it doesnt react to the condition when there are 0 users.
Sry ,for ping, but I am a little bit overworked^^ I am working on it since hours now, but I dont see what I am doing wrong.
your code makes no sense
the voice state update gives 2 voice states
one before, one after
you're exclusively working with the one before
you're getting a collection of voice channels under the same category, then sum up all their members, then try to delete the collection?
That is they key part. I am trying to delete the channels, when their sum is zero. If I join a channel and log out in that category, I get this log. I am only trying to find a way to delete those channels, as soon as the sum is 0. So, I guess, I am simply deleting the wrong thing and not the "channels". That is the problem I am facing. What I am not understand.
Cry, I think you are right, I guess, I have to work with 2 voice states. Wont work otherwise.
when I join and leave a channel in a category
but ok
so you want to delete the entire category with all channels included?
oh so just the channels
yeees
then you need to loop over them and delete one by one
Well my bot is going like 2m to turn on, is that a problem?
seems like a problem with your internet speed lad
god how inefficient is your code 
Ah im stupid
why
I dont add a ready event
you dummkopf
No wait
let count = voiceChannels.reduce((a,b) => a + b.members.size, 0)
if(!count) {
for(let channel of voiceChannels.values()) {
await channel.delete()
}
}
Yes i add it
add
Looks quite good. Hopefully this will work in the event. Thanks TIM for your help
I was like 10m here and dont do anything
which library btw, sqlite or sqlite3 @tight plinth
or better-sqlite3
it worked
yeah
thanks
My bot isnt get online help
a lot
I was here 12m and console dont show ready!
are you sure there isn't a problem in your ready code
I have an array of objects, every object is like identifier: score
identifier is the user identifier and can always change instead score is a number
Every time a user scores I need to add 1 to the score, would this code work?
array[identifier]++;
Probably not, what is the correct way of doing this?
are you sure there isn't a problem in your ready code
@misty sigil no there isnt
show it
@opaque seal it should
@fluid basin a guy said that array[index][identifier] ++;
But I don't know the index
show us some examples of your code that uses that line
me?
ye
client.once('ready', () => {
console.log('ready!');
});
Thats it
But nothing on console
await client.guildSchema.findOne({ guildID: guild.id }, async (err, res) => {
if (!res) {
const newGuildSchema = new client.guildSchema({
guildID: guild.id,
bans: [],
kicks: [],
mutes: [],
votes: [{ voterID: 1 }],
});
await newGuildSchema.save().catch(err => console.log(err));
}
else {
let votes = res.votes;
votes[voter.id]++;
}
});```
yes, you're not logging in to discord
Nothing
That's some confident logging lol
yes
@opaque seal where is the definition for votes?
the line where the variable is created
alguien español que me ayude
You have it not in another event right?
#rules-and-info @remote reef English only on this channel please
@opaque seal where is the definition for
votes?
@fluid basin it's created when if(!res) ...
The number of times I've seen people do client.login in an event that cannot happen until the clients logged in already is scary
You have it not in another event right?
@solemn latch well i have a command handler but in the same bot.js i have it, the ready event and client.login
I just want to get a list of all the users who vote for my bot and how many times they do
is an array of objects good for that
after you update the value, save it to the database
or is there a better way?
after you update the value, save it to the database
@fluid basin Ik, I just miss the part where I add 1 to the user
Ufff
wtf it takes that long
@fluid basin Ik, I just miss the part where I add 1 to the user
Idk how to do that part
Someone recommend me a type of database
Sql
there isn't a problem there, if you console log votes[id] it should show the correct value
sqlite or SQL?
@opaque seal I would need to know what is running that part of the code, is it in a loop?
Now idk if wait anothers 15m to turn bot on
and mongo is good
Maybe its just me, but I'd avoid quick.db.
It seems to be the db with the most issues that no one seems to know how to solve
use updateOne
Yeah I wouldn't use quick.db
^ i reccomend sqlite using enmap or keyv
mongodb is fairly easy to use as well
though you will need a running database server, either hosted on your server or using something like mongodb cloud
Dunno about keyv but I'm pretty sure enmap is a sqlite wrapper too so I'd also advice against using it
Im confused, maybe someone could enlighten me? https://im.farfrom.world/kswthuuheu.png
I'd just use PostgreSQL with an ORM like TypeORM or Sequelize
Or MongoDB if you want NoSQL
@spice pier What API are you making a request to?
discord?
Do you know which part of your code is causing the error?
its all in the screenshot
im posting to https://discord.com/api/v6/channels/680603868790259762/messages with correct headers
this is the body {"content":"Pong!","tts":false}
- are you using a library?
- is this a bot or a user?
- Why does it matter?
- A bot.
a library makes things easier
well in that case you should scrutinise the docs carefully
have you considered using a webhook then if it is possible for your use case
A bot using webhooks? hmmm
you need to have a websocket connection established
for a bot to work
and send messages
It is
Did you connect to the gateway
How do you think im triggering my code
alright
interesting then
can someone help me set a time to use the command again in js?
does the http library you are using have a default user-agent, or does it not have one? @spice pier
The default one is v.http
well.. this issue seems weird, might need to do some debugging
400
And who decided that?
REST api spec
it's supposed to be returning a json response
anyways
the headers might be case sensitive
try using Content-Type instead of lowercase
funfact: you dont need to be connected to the ws to send messages
and it isnt case sensitive
I found the response weird
the response is from google
btw what is this
it's a response from google
the entire response is from google, you can see that from the hrefs referencing google resources
was able to post and send a message
something fishy is going on here lol
Yeah
found out what was the problem, unsure how it happened in the first place tho
What was it?
using post instead of POST as the method
I didn't make the code base, so that'd be from the other people who contributed
how do i check bot permissions?
I have a command that edits channel permissions, but i can't figure out how to make it so the bot doesn't shut down if it is missing perms
discord.js btw
You can use <GuildChannel>.permissionsFor(...) with ... being GuildMemberResolvable. For example, you could use <Guild>.me and pass that.
Then you can just do .has("MANAGE_CHANNELS") to see if it has permission to edit said channel
would this work: ```javascript
const theGuild = message.guild
if(!theGuild.me.has("MANAGE_CHANNELS")) {
message.reply("I can't use this!")
} else {
// do the code
}
No, it should look like channel.permissionsFor(guild.me).has("MANAGE_CHANNELS")
so:
const theGuild = message.guild
if(channel.permissionsFor(theGuild.me).has("MANAGE_CHANNELS")) {
message.reply("I can't use this!")
} else {
// do the code
}
would work? i'm just putting two and two toghet here
i can't find any better names for variables
Still wouldn't (assuming channel isn't defined), but you can always trial and error.






