#development
1 messages · Page 1653 of 1
prefixes[guildID] does not exist
what do you mean?
this is only in the console
log the guild ID
I checked
The property (guild ID) doesn't exist
That's why it errored
how can I fix that?
or at least why is it even calling that guild id, if it's not in the prefix.json?
you never handled it
it'll still call it if it doesn't exist
use dict.get() instead to avoid KeyError and provide a fallback prefix
alternatives to rabbitmq in order to facilitate communication between multiple processes in the same server? ping if you have ideas
hmmm
i don't wanna set up rabbit mq
usher
rabbit mq is so annoying to setup
it's such a heavy thing for such a smol thing
I understand the pain :painsive:
no
its really easy
its just paid for past 200k requests
What're you using RMQ for?
sorry iara I cant help
my fingers are locking up because its cold
so I can't give suggestions
oh yeah i have enough then LMAOO


past that pusher is $49 / million a day
i only have to do 1 message per hour per cluster + 1 message per day per cluster + 1 message per week per cluster
which would be
24 * 70 + 70 + 10 / 7
which is less than 2k

STONKS

thanks smaule ily
stonks
ily iara
@spare goblet I understand your pain with RMQ, its docs are really awful too
advantage is its free, but its just 
@drifting shell it
s
not gonna work for me

only allows 100 concurrent connections
which means per cluster i have to use at least one connection right

im already at close to 70 clusters

and at this rate of growth i only have 4 months before i reach 100 clusters
😭
😔
I mean, couldn't you join the clusters with an internal ws?
or even a webhook
IPC? 
@spare goblet

what're you sending the messages for?
roleincome
honestly at this rate
i'm ready to just
setInterval(() => {
})
this crap

but scalability 
hmmm, i have another idea tho and im pretty sure this has definitely crossed your mind
in java you can do
executorService.scheduleAtFixedRate(runnable, delay, frequency)
isnt that setinterval
kind of, but not quite
yeah thats why js is kinda stinky
but, you could just set the task to run after a delay period, and then get it to rerun again at the desired period
,hello,Muted how would i remove the comma's from a string like this?
if(message.content.startsWith("!add")){
const result = message.content.slice(4).split(/ +/);
const z24 = message.content.slice(auth.prefix.length).split(/ +/);
const z25 = z24.slice(z24.length)
fs.appendFileSync("./keywords1.json", result + " " + z25 + "\n");
}```
remove it entirely?
as i said the reason why i wanted to do this in the first place is to avoid it 
replaceAll("," "")
i know

is it just JS's lack of multi threading that's making you need 70 clusters?
no, it's because of how large my bot is
i could probably change to like 30 clusters
or 40
yeah I just meant like why does it need 70 clusters, if you know what's actually causing your need for it
that didn't work
you're trying to remove , right?
it needs clusters to split the load
also
pusher can't publish directly from code?

it said that it wasn't a function
Guys, how come I got this error?
replaceAll is not working cause it's not supported by node.js yet
use replace with a regular expression
pusher.trigger('my-channel', 'my-event', {
"message": "hello world"
});
``` 

message.channel.send(pages[0]).then( async message => {
await message.react('◀️');
await message.react('▶️');
await message.react('🗑️');
var collector = message.createReactionCollector(
// only collect left and right arrow reactions from the message author
(reaction, user) => ['◀️', '▶️'].includes(reaction.emoji.name) && user.id === author.id,
// time out after a minute
{ time: 600000 }
)
let currentIndex = 0
collector.on('collect', reaction => {
reaction.emoji.name === '◀️' ? currentIndex -= 1 : currentIndex += 1;
if (currentIndex < 0) {
currentIndex += 1;
}
if (currentIndex + 1 > pages.length) {
currentIndex -= 1;
}
if (reaction.content === '🗑️') {
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
}``` ok so i added ```js
if (reaction.content === '🗑️') {
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
}``` im trying to remove all the reactions with the trash can only im stupid so can someone help me
@spare goblet for 37k servers albeit I know yours is like 6* that, my bot happily runs on 1 2vcpu vps 
amogus bot
couldnt find it
just go to top.gg/user/id
You're trying to do something which requires 2-factor authorization
some method you're trying to do is user account only

didnt work haha
Does this applies to other servers too?
Can someone please fast write a give role code?
This is the list of the servers that bot joined:
reaction.emoji.name is correct. unicode emojis have the unicode in the reaction.emoji.name
Your issue is most likely a logical issue elsewhere
yeah, the filter function
you're not collecting the remove all reaction
probably, try again later
if that's your actual IP you should delete the screenshot
okay
It doesn't matter where you use it, your bot is not authorized to use the feature
What are you trying to do?
virtual cpu
its not a dedi so its not dedicated cpui
either 2 vCores or a server with 2 numa nodes
around 7-30% cpu steadily, 8 cores
around 30 gb of ram
Ok I got it. thx

hi i would have a quick question.
how can i get the names of the guild rooms?
Here is my code
(guildCreate EVENT)
var channelsNumber = guild.channels.cache.filter(m => m.type === 'text').size;
for (let i = 0; i <= channelsNumber; i++) {
console.log(guild.channels.cache.name)
}```
So what you are trying to do is console.log(); the guild name, which was added, right?
If you want to loop through the guilds to get the name, you can use collection.values() and a for loop or use collection.map()
i see how many text channels there are and i run a formal to write the name of those console log ba
forEach would work aswell, i asume.
yeah
which code?
same here, the code block font in sans instead of monospace
Unfortunately, i still don't understand what your problem is?
but then how can I do it now to write out the names of all the found text channels?
instead of using collection.size, use collection.map with the function to return the channel name (and index if you need that too)
sorry for my bad english
you will only need it once because it will be a database upload
guilds.channels.cache.forEach(channel => console.log(channel.name));
This should work, if this is what you need.
E
Not just that since they filter the guild for text channels
they need to forEach the filtered collection
Sure.
also, your casing for forEach was incorrect
Explain me.
forEach
not foreach
Oh, typo, my bad.
thanks dude is perfect
what is the problem
Could you please make your font size a lil bigger, really hard to read.
okay wait
seems fine on mobile
Opening original file fixed it, no need.
Don't use dblapi.js since it's deprecated, use @top-gg/sdk
and make sure you provide the correct token
this problem occurred yesterday
don't use dblapi.js
const Discord = require('discord.js')
exports.run = async (client, message, args) => {
let user = message.mentions.users.first() || message.author
let author = message.author.tag
const embed = new Discord.MessageEmbed()
.setDescription(`**<@${user.id}> İşte Avatarın!**`)
.setColor(`RANDOM`)
.setFooter(`${author} Tarafından İstendi.`)
.setImage(user.avatarURL({ dynamic: true, size: 1024 }));
message.channel.send(embed)
}
exports.conf = {
enabled: true,
guildOnly: true,
aliases: ["pp"],
permLevel: 0
};
exports.help = {
name: "avatar",
description: "",
usage: ""
};```
@earnest phoenix
pp code
why do all that when you can just do math.random
true
Lmao pp/900000000
So you want to do it based on the user's id
You could just get the first two numbers from the id, add them, and divide by 2
There are other ways to do it ofc
(node:25452) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit (Use node --trace-warnings ...to show where the warning was created)
How to fix
But basically if you joined early = you have a smaller pp
Lmao
this
Read the error
ids are not really random
computers don't make random numbers
its impossible
lol
truly random sources are for example when discord servers break
or when a windows update publishes

(Number(pp[0]) + Number(pp[1])) / 2
computers are not made to generate randomness
they can't generate randomness
its impossible for computers to do
even if it seems random
its technically not
?
s
Okay what the hell.
I can't take this seriously
same
Because that's how you convert inches to cm
true random does not exist in the context of computers. Computers are designed to execute exact instructions. Anything led to make you believe otherwise is false. computers are able to seemingly generate random numbers by a concept called psuedo-randomness. In the case of languages offering random numbers, the logic behind those methods is that you have a seed which is what the math is based off of to present a number. Most seeds are the computer's Date time which updates constantly and would produce different outputs most of the time
is there a benefit to marking a web socket connection as AFK / idle?
I guess you can also add the third number and divide by 3
then you'll get slightly bigger pps
but also slightly smaller
i'm dying reading this
Just multiply by 2.54 what's the problem
is there a benefit to marking a web socket connection as AFK / idle? someone help 
You'll still get relatively less than average pps
You can also do the smartest thing and store PP sizes in a database
so you don't have to do shit like this, just generate a random number if the user's PP size isn't in a database already
and put it in the database
yes, you can set a timeout to destroy the socket connection if your intention is to preserve resources
but my pp will be forever short if it's stored in a db
That was uncalled for
Maybe make the numbers increase over time
lmao you'll make it stop after the 18th year
store the pp and timestamp
What the fuck are you people doing
i think you're on to something here
you don't even have to store the timestamp, use the user's account creation timestap
I cannot take this convo seriously
You don't need a database for this. You can do all of the math based on timestamps
Not really, your pp isn't a fixed length based on your date of birth
you'll need a random value
mhm, nice
was there any outcome?
@quartz kindle helo sir, big fan, long time no see, do you have an answer to this?^
lol its 8 in the morning for him
where does he live?
maybe he is at work or still sleeping
you are a bit confused right? USA use 12h format
There's no way it's 5 pm in russia
[Math.floor(Math.random() * whateverarray.length)]
Math.floor(Math.random() * 100) - 1
breh, python is for the weak
am i right @slender thistle ?
because from 1 to 100 its 101 numbers
i mean, how do i explain
Is doubts about webhooks allowed here?
no that's 1-98
Do not make fun of languages
They all have their own uses
breh, read the name development we can even help you with girl talking skills
you can use Math.ceil() and not use 101 - 1
all kind of development are allowed
I'm sceptic of JS with all the idiotic packages people made for fun
welp yes
I prefer not to waste time arguing which is best, however
but js looks better and it is funner
That's subjective
yes ig
Ok, then pls tell me, I host my bot on heroku. So how will my webhook be like when I enter it in top.gg bot edit page?
wot?
The skepticism is reasonable, but it still gets it's job done pretty efficiently depending on the developer's proficiency
You know webhooks right?
what webhooks, discord or some other?
Why complain, they are both high level languages
Do not discriminate/harass (hate speec, arguing, etc). This includes but not limited to:
c. Programming languages
ah, go to #topgg-api for it then ig
Some people might like the more object oriented approach JS takes while python seems a bit more functional in contrast
we are just having a friendly discussion, which will develop our debating skills
we are just having a friendly discussion, which will develop our debating skills
read the name breh, #development
we are developing as one
smh
That's the prob, no one is there, it's like ded... So I thought to come here, now here also... Omg
blocked
Bruh
lol
breh
Wtf
Nobody cares
Good
Pretty much. Though, at this point I refuse to move away from Python because I'm too used to it 
This
No complaining really
Same thing
I feel the same about JS. I really wanted to try CS or Java, but I can't get into it. Java for understandable reasons, but CS is good
There isn't any complaining about languages, though. My personal preference is Python because that's what I've worked with for years, and at this point it's hard to get into another language that I can use primarily
Oh, C# feels like a godsend
Though, yeah, I don't feel like I was cut out to use it as my main language 
fair
That's a good way to start
You usually want to refer to official documentation on top of "stealing" code
stole*
With a timer
steals code from stack overflow
so I got this code from the docs
setInterval(function() { client.user.setPresence(...) }, 60000);

milliseconds
^here
The example is literally given there
you already have your "stolen code" (client.user.setPresence)
Just put this around it
I would recommend putting it into your client.on('ready')-event so it doesnt error out when your bot is not logged in yet
nobody is gonna say anything when you do it every minute
yeah discord presence every minute is fine.
Do you mean this lol
Presence ratelimits are very lenient on top of that so doing it every minute is more of a common sense move
So currently my discord bot is hosted on heroku but there's size limit of 500 MB. Is there any other platform where I can host my bot for free with no size limit?
no, there are always limits, even with paid hosts
Is there any platform where I can store images and get my bot to send images from that when the user type a command? Like if I could upload my folder filled with images on google drive then it will save some space but could bot read the image from google drive or any suitable platform for that?
can someone help me with this poll? if i place the question i want the bot to remove my questions after the polls is posted? anyone who willing to help me out?
imgur, but do note that they remove less accessed images
for(let languages in obj){
if(languages != "execute"){
if(obj[languages]){
obj.aliases.push(...obj[languages].config.aliases) }
}
}
show the definition of "obj"
the definition, not obj itself
wdym?
like, where you do let obj = ...
ah ok
if you do console.log(obj) right before you push to the aliases what does it show?
Is it considered a privacy breach if im implementing a command to count my Database documents to display the number of botusers?
Or is this information oke?
So like the amount of users of all the guilds your bot is in?
Ok even if it's not that ^ it's fine. Because it's just a number
Each user gets an unique db entry and i would count this number and display it
yeah perfectly fine
thanks 
anyone who willing to help me out? trying get t his poll to work when you have it setup it removes the messages you typed? 😄
omfg why is that file so long?
me?
yes
we have a serious contest between bdfd and dbm
can't choose which one is worst
but anyway, where am I supposed to look?
discord bot maker?
that for all languages?
nvm fixed
yes, like, why not just do javascript?
im trying to make multi -lang
what was the issue?
I'm trying to make a vote to release commands but I don't know how to start or how to do it
what language?
d
// only collect left and right arrow reactions from the message author
(reaction, user) => ['◀️', '▶️','🗑️'].includes(reaction.emoji.name) && user.id === author.id,
// time out after a minute
{ time: 600000 }
)
let currentIndex = 0
collector.on('collect', reaction => {
reaction.users.remove(message.author.id)
reaction.emoji.name === '◀️' ? currentIndex -= 1 : currentIndex += 1;
if (currentIndex < 0) {
currentIndex += 1;
}
if (currentIndex + 1 > pages.length) {
currentIndex -= 1;
}
if (reaction.emoji.name === '🗑️') {
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
}``` i added `reaction.users.remove(message.author.id)` so it removes the user reaction but instead it deletes the reaction that the bot added?? how can i fix this
method not allowed means you're doing a GET request on a POST endpoint or the inverse
the message author is the bot
use user.id instead
Sadly when i do that it just doesnt respond
you start by showing index.js at line 180
permission issue
Nope otherwise it would have given me a permission error
@earnest phoenix you're trying to modify the webhook?
(node:20404) UnhandledPromiseRejectionWarning: ReferenceError: db is not defined at Client.<anonymous> (\index.js:180:19) at Client.emit (events.js:327:22) Console error how to fix?
I already answered
edit follow-up message?
like, webhooks are a one-way trip
you can't retrieve messages with it
ik
but still, webhooks are send-only
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
how i make this
Read the error db is not defined
anyone know how can you make your bot leave every guild at once?
(Discord.js)
I have no idea then, check if your request is being sent as actual PATCH
const db = require("what ever db you are usin")?```
bot.guilds.cache.get(id).leave()
.catch(err => {
console.log(`there was an error leaving the guild: \n ${err.message}`);
}```
would this work?
true but my bot is only in 6 so that will be easy
Get an array of the guilds by guilds = client.guilds.cache.array()
Loops through it calling guilds[i].leave()
client.guilds.forEach(g -> g.leave())
why bother with optimization if it's just a one-time thing?
// only collect left and right arrow reactions from the message author
(reaction, user) => ['◀️', '▶️','🗑️'].includes(reaction.emoji.name) && user.id === author.id,
// time out after a minute
{ time: 600000 }
)
let currentIndex = 0
collector.on('collect', reaction => {
reaction.users.remove(message.author.id)
reaction.emoji.name === '◀️' ? currentIndex -= 1 : currentIndex += 1;
if (currentIndex < 0) {
currentIndex += 1;
}
if (currentIndex + 1 > pages.length) {
currentIndex -= 1;
}
if (reaction.emoji.name === '🗑️') {
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
}``` i added `reaction.users.remove(message.author.id)` so it removes the user reaction but instead it deletes the reaction that the bot added?? how can i fix this
these are the intents of my txt file
i tried getting the size of it
so how many words there are in the txt file
7
it gave me 25 eventually witht his code: if(message.content == "!count"){ const count1 = fs .readFileSync("./keywords1.txt", "utf8") count1res = count1.length;
pretty sure that it isn't right
yeah like it should be
that gives you the total amount of characters
you're counting the chars, yeah
or regex
\b should catch everything thats non symbol type
just check size after that
my bad
\s
@eternal osprey
if you want ALL characters(including spaces and newlines) you do <str>.length
if you want JUST the characters
[a-zA-Z] in a regex capture group
if you want ONLY digits \d
theres plenty of ways to do count like you want
this i would consider a decent case for regex as checking for every character would be annoying as fuck
they want to count the words
@lyric mountain can pm?
line 180, file index.js
about?
discord.js
then ask #topgg-api how to proceed if you still have questions after reading the docs
is there any efficient way without fetching mongodb on every message
Storing in cache and editing the data when users want to edit it
What is this happening?
429 meaning ratelimited
atm i have caching with changestream ,which gets updated,but often it gets corrupted
Corrupted how
yea but i have 2 apps same db :c
that something does not get deleted
So what I should do to fix this?
wait until ratelimit is over
ik a solution
also fix whatever is causing ratelimit spam in a single minute
is there any efficient way without fetching mongodb atm i have caching with changestream
use actual object caches
i use it but sometimes delete does not work
it still stays in cache
Sounds like an issue with code
and if the document create are too fast it does not catch
lol
don't cache streams, they're supposed to have a beginning and an ending
cache their values
make a map/collection/whateveryourlanguses and store key-value pairs there
with the key being whatever u use to access in mongo docs
and the value being whatever you'd retrieve from there
do note, however, that this is trading RAM for storage
more ram = less cache | more transactions
more performance = more cache | less transactions
const message = "lol";
const embed = new MessageEmbed()
.setColor(red)
.setDescription(`${message} Hello`)
How do I make it for example, If message is equal to "lol", it would add the ${message} before Hello but if it was not equal to "lol" or like if it was false, then it won't add.
I'm pretty sure there is a way.
yea you need to collect the message
I would of done it with message.content if you put it into a message event
yea
He can do : if message.author.includes message no?
Ok.
like lmao lol
What if it was this?
you cant do message.author as he has defined message as lol
const lol = message.member.roles.cache.has(server.moderatorRole);
const embed = new MessageEmbed()
.setColor(red)
.setDescription(`${lol} Hello`)
// If the user has the role, it would add the ${lol} but if it was false, then it won't add.
this is what I would of done if it was inside a message event
//code with lol
} else {
//code without lol
}```
ahh yes
Bruh.
yep
this will work
That will not work if you have multiple ${} at the same line at the same time
As you can have 1 true, 2 true, 3 true, or at any time any of them can change.
What about this?
Can anyone help me?
I didn't even ask if it is a function or not.
Nevermind.
best test it
What?
the command
What do you mean, this?
That wasn't what I was looking for.
maybe if you actually said about roles my answer would of been different
Well, I guess I sent that 1 second before you sent your answer.

const check = message.member.roles.cache.has(server.moderatorRole);
const emoji = "😀";
const anotherCheck = message.member.roles.cache.has(server.mainRole);
const emojiTwo = "😉"
const embed = new MessageEmbed()
.setColor(red)
.setDescription(`${emoji} ${emojiTwo} Hello`)
// If the user has the role, it would add the emoji before the Hello
Like this.
if check was ture, it adds emoji, if anotherCheck was true, it adds emojiTwo, if not, it won't add.
the cache stream updates the cache if a document on the other side like on my website got changed
the problem is if many users delete a document it does not receive all streams
i mean this https://docs.mongodb.com/manual/changeStreams/
this is the stream
changestream.on("change", function (change) {
if (change.operationType === "update") {
var removeIndex = cache.map(function (item) { return item.token; }).indexOf(change.fullDocument.token);
cache.splice(removeIndex, 1);
cache.push(change.fullDocument) ;
}
if (change.operationType === "delete") {
/*let index = cache.findIndex(x => x._id === change.documentKey._id)
console.log(index)
if (!index) return;*/
var removeIndex = cache.map(function (item) { return item._id; }).indexOf(change.documentKey._id);
// remove object
cache.splice(removeIndex, 1);
}
if (change.operationType === "insert") {
cache.push(change.fullDocument)
}
})```
cache is a object
rn have to go off
just ping me so i can read it later
data retrieval
bot ──> cache ──> is cached? ┬─> yes ──> return value
│ ↑
└─> no ──> retrieve from db
@earnest phoenix
data edit
bot ──> update database ──> is cached? ┬─> yes ──> delete entry
│ ↓
└─> no ──> add to cache
"cache" being a map/collection
ooof, i wonder how much time did it take you to make it
I never remember the unicode codes
me2
Hey
I want to add this:
if (result.includes("A")) result = result.replace("A", " ∀");
if (result.includes("a")) result = result.replace("a", " ɐ");
But I don't want to add this 50 times
How to compress this?
wdym
for loop + switch is one of the alternative ways to do it
not sure if you can do it with regex
do you want it to replace every single occurrence of it?
if so then a regex should do
/A/g
/a/g
but he would still need to do it 50 times for the others...
and that'll replace every single A in your string
that's what he doesn't want to do.
what-
^
...
He doesn't want to have 50 different if statements for each letter, at least that's what I'm getting from it
yes?
oh euhh
In the alphabet, there is 26 letters
and I need to add this
min and maj
alr then gfeud was right
for char in someMap
string.replaceAll(char, someMap[char])
It would probably be better to reconstruct the string instead of using replace, though not sure
oh
Can't you use a Map here
no
but my script is better oof
but I don't want to add 50 times the line
O_O
I'm sorry but how does a Map not apply here

A Map consisting of char to be replaced as a key and a char to replace with as a value
smth like this
const thingsToChange = {a: "Some weird A", b: "Some weird B", ...};
let res = "";
for (let i=0; i < str.length; i++) {
if (thingsToChange[char]) res[i] += thingsToChange[str[i]];
else res[i] +=str[i];
}
okay I test
inb4 they just copy the code googlefeud sent and say it doesn't work
When writing an inline if statement.
.setTitle(`${premium ? supporter : }`)
After : I want it to return or not set a value
Do I put '' only?
an empty string
'' only.
that's not called an inline if statment, that's a ternary operator, just use "", yeah
Oh, alright. Called it wrong.
Thanks!
don't worry
.setTitle(`${premium ? supporter : ""} ${earlySupporter ? earlySupporterBadge : ""}`)
I think if the first one is false, it will put as an empty string, but you see the space between } and $, I guess that makes a problem?
in js, you can just do ${premium && supporter}
no need for a ternary
I need a ternary for a check.
well premium && supporter || ""
you don't need in that case
That actually won't work in their case because if they don't have the premium badge the earlySupporterBadge won't show either
ternary is the cleanest option

like
Exactly.
I'm trying to figure out how the 'voiceStateUpdate' event works but I have no idea. Is there a way to check if the newMember or the oldMember arent just muting or deafening themselves and just check if they joined left a channel?
If premium is false, it won't show anything, if early supporter badge is false, it won't show anything.
just use ternary
Ternary it is for now.
You can still use && but differently
I'm not sure what you mean by this
I'd use ternary too but that should also work
.setTitle((premium && supporter) + " " + (earlySupporter && earlySupporterBadge))?
lmao
or it'd still stringify false?
From what I've read it's triggered in all this scenarios:
Oh wait yours will actually work, I thought supporter was also a bool mb
Yes, it indeed worked.
😀
Ayy, it works amazing, thank you all, though.
best case system would be creating a new entry into the db with each case author, and the reason with the number correct?
if(!oldMessage.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
Cannot read property "me" of null
oldMessage.guild is undefined - either it's not a message, or it's a message that's not from a guild.
module.exports = async (bot, oldMessage, newMessage) => {
// Checks if the bot has permissions to send messages or embed links to the channel.
if(!oldMessage.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
// Checks if the bot has permissions to send messages or embed links to the channel.
if(!newMessage.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
};
It's for the messageUpdate event.
Just add a condition to return if there's no guild, should be simple enough
// If the message was from a direct message.
if(oldMessage.channel.type === "dm" || newMessage.channel.type === "dm") return;
// If the message was from a bot, it would return.
if(oldMessage.author.bot || newMessage.author.bot) return;
// If the message has no guild.
if(!message.guild) return;
// Check if there is a message content.
if(!oldMessage.content || newMessage.content) return;
// If the bot was offline or restarting and the bot could not cache the message, it will return so it can not return as "undefined".
if(oldMessage.partial || newMessage.partial) return;
// Checks if the bot has permissions to send messages or embed links to the channel.
if(!oldMessage.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"]) || !newMessage.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
// We need to check if the actual message is a blank message, so it can return.
if(oldMessage.content.includes(["_ _"]) || oldMessage.content.includes(["_ _"])) return;
That is a lot of checks! 👀
thats no tooooo bad
Aw.
I worked on a bot years ago with some friends and literally a single command had the BIGGEST if statements ever
did you want to send a message inside a command block with the bot or here on discord?
for our deal
could be worse, ask the Tsundere Dev, his game is 90% a single if then else statement
Idk him.
🤷♂️
idk one of them
😂
but yea the game is a joke
runs like you would expect if you saw the leaked code
yo guys
if(typeof(input) !== "String") throw new Error(`Expected a string! For example - "This is a message" or "https://youtube.com/user/rickastley"`)
Haven't coded in months, I have forgotten everything 
const {isRick} = require("rickroll-detector")
let thing = "https://youtube.com......"
console.log(isRick(thing))
this is the code
ohh
Yo, does discord allow you to use any chats while you're watching a stream?


ah right
if(!input) throw new Error("No Input provided!")
if(typeof(input) !== "string") throw new Error(`Expected a string! For example - "This is a message" or "https://youtube.com/user/rickastley" but recieved ${typeof input}`)
request(input), function (error, response, body) {
console.error('error:', error)
let body2 = body.toString()
let body3 = body2.toLowerCase()
if(body3.includes("rick roll") || body3.includes("rick astley") || body3.includes("never gonna") ){
return("Yep, This is a RickRoll!")
}else{
return("Nope, This ain't a RickRoll")
}
}
😩
its not that
he's returning inside a function scope
first, your return is in brackets
second
even if it didnt
your return fullfills this function
not the one you originated from
you need to read on how functions and scopes work
also request is a promise
Idk
your function should be using async/await
read upon that as well
i also formatted it for you since you dont seem to be using a linter, this should show how poorly this code was written
if (!input) throw new Error('No Input provided!');
if (typeof input !== 'string')
throw new Error(
`Expected a string! For example - "This is a message" or "https://youtube.com/user/rickastley" but recieved ${typeof input}`
);
request(input),
function (error, response, body) {
console.error('error:', error);
let body2 = body.toString();
let body3 = body2.toLowerCase();
if (
body3.includes('rick roll') ||
body3.includes('rick astley') ||
body3.includes('never gonna')
) {
return 'Yep, This is a RickRoll!';
} else {
return "Nope, This ain't a RickRoll";
}
};```
request() missing a parenthesis
return scope blocked
theres a lot of mistakes here
hey, I'm working on my bots page currently and hit a problem: I somehow can't change the text-align argument of h5s
this is what I'm trying but it still looks like in the screenshot below. It also shows that it works fine with normal text
.entity-content__description h5 {
color: #eeeeee
text-align: center;
}```
is h5 a child of entity-content__description
yeah I just noticed when posting haha
thanks anyways
page looks nice c:
thanks :D
I'm not sure tho if I should really only align the titles and main description tho since it looks kinda weird with the rest
still looks quite readable imo
but just aligning the white title and the text right below looks kinda weird
that's not center-aligned
I didn't mean normal alignment
there, edited the message
see how it looks with the title only centered
Text is a beautiful thing. It not only has function, but form as well. When you're creating text, it's likely that you're not only thinking about what your text should say, but how it should look. On the web, centered and left aligned text are the most widely used text alignments. How you use these text […]
basically
I did but it only looks good if the description is one line or longer
imo, make the titles larger and keep everything on the left
you could also use columns
Holy
so I'm planning on making something with lua
but all libraries I need are outdated
lua's only purpose is to be used in OpenComputers for minecraft, thats it
useless lang 
imagine starting arrays at 1
rgb mouse programming
What is the best way to delete an embed of a message with java and JDA and jda-utilities? im using suppressembeds()and im checking the permissions before executing the command i got an rest action failure missing access
oh wait let me checked that, i tried it with manage message
also for E2 Chips in Gmod and Automation Blocks in from the Depths and in Space Engineers.
what is the Messae Read permission in discord "view channel"?
use ctrl + space pls
java gave u intellisense, use it
i mean in discord itself to remove the permission of the bot
trying to reproduce the error
yeah, view channel
but arrays at 1 kills it right away 
well its better than adding stuff that needs more efford to learn into games
what library are you using
Im kinda lost how to catch that case 😟 im using the eventwaiter from the jda utilities and listen for reactions to that message, but when the bot sent the message, reacts under it and you remove the bot permission to read messages on that message afterwards and react its throwing an exception
oh wait im getting an idea 
if you want to see server's name so you need to make eval command.
@earnest phoenix you do know you're replying to a message, not only from yesterday, but one that was already answered too, right?

which db supports change streams? without mongodb
seems to be a Mongo Spezific feature, cant find any other DB supporting it
hey umm
/\{(.*?)\}/gm,
y('$1')
)```
in my func y the value passed is "$1" instead of the 5 which the replace method would give with the $1 syntax. im sure im doing it wrong here. anyway to get the 5?
you can't do that
so how would i set a variable in a description string
use js "hello world {5}".replace( /\{(.*?)\}/gm, match => y(match) )
wait whats match here?
a string
the syntax for replace is '$1' to get the value
it's the string that the expression matched
and im sure you cant pass a func like that
you can
const lookup = {
1: "oof"
}
var variable = 1;
console.log(lookup[variable])
console.log(look.variable) // <-- How does this not work..
nono
look is not even defined?
it's a function
yeah im passing a func
'$1" => is not a valid function
that's a string
(param) => doSomething()
that's an arrow function
ye it says i cant pass functions
to replace
wait nvm
but its still passing "$1" into the function
instead of 5
ok its passing the whole {5}
instead of jsut 5
The first one is getting the property with the key being the value of variable, the second one is getting the property with thekey being variable
Oh, damn, i literally forgot.
I forgot that the [variable] is telling it about the value and not the name of the property itself.
Thank you.
If i make a music bot he would need a DataBase?
i mean, the * typically means return what ever is between {}
which is this case is 5
ah
What would you store in the database?
The queue
how would i strip the number lel
Why do you need to store the queue there?
I there another way?
just slice the brackets
You could just store it in the code, no? Unless you plan on having the queue save despite your bot going offline
I can store in the code, I didn't know that. Thanks

bot.on("message", async message => { // Her mesaj atıldığında tetiklenen message eventi.
^
ReferenceError: bot is not defined
at Object.<anonymous> (C:\Users\Hp\Desktop\Bot(2)\deneme.js:14:1)
←[90m at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m
PS C:\Users\Hp\Desktop\Bot(2)>
where is my fault
Was that really necessary
Ghost ping?
@dusky harness can you not
-m @dusky harness mass-pinging staff for attention | 2d
🤐 Muted Ϟ EFEILGAZHD#9321 (@dusky harness)
@dusky harness Ghost ping Yapma
that works too
Cant deal with it now god damnit
added it to the spreadsheet
How can i do a only VIPs command?
depends on how you define vip
Like, i want to make where only persons who pay can take acess to a specific command
well, how are you accepting money for vip?
like, patreon, paypal, custom subscriptions, or whatever?
Im thinking with paypal
I can save in my code?
thats probably a bad option, it means taking down your bot each time a new vip is added.
Yeah you right... I need to add a DB to my bot, and see how that works, thank you
@spare goblet pls dm
Don't ping community managers please, what is your issue?
hi i cant figure out how to actually make a kick cmd with discord.py any tips?
there is a method you can use called Member.kick(reason="reason here")
Keep in mind that your bot also needs the "KICK MEMBERS" permission to execute that
كود
#general-int for other languages please
Code
Hello:
const className = `${pages[page].title.charAt(0).toLowerCase() + pages[page].title.substring(1, pages[page].title.length)}`;
console.log(pages[page].title.charAt(0).toLowerCase() + pages[page].title.substring(1, pages[page].title.length));
console.log(arena.className.price);
I am trying to access a price from my json file. Arena is a json file.
When I run arena.healer.price it works, but when I run arena.className.price it gives me undefined. And the className variable when logged shows healer...
Code free fire server mena
me don't speak tchakatchaka, me speak english
@winter bear have you ever used a database?
nop
so your best bet is spending some time learning about databases.
databases are too big of a topic to explain them here 👀
if you want something easy, mongodb is quite easy.
https://docs.mongodb.com/manual/tutorial/getting-started/
or if you want something super easy, quick.db is very simple stuff.
https://www.npmjs.com/package/quick.db
quick.db isnt the best though, itll work, but just be aware its kinda limited
but pretty much, what youll be doing, in the webhook event(when you receive a vote) you will be saving that vote in the database.
that entry you can set to auto delete after 12 hours(ttl).
whenever someone runs a vote locked command, youll check the database and see if its in the database, if it is, let them run it.
What would be the best DB for my bot?
depends
relational, non relational? are you worried about scalability? what are you comfortable with?
its something you can spend a lot of time researching
I'm thinking about MySQL
if you go for sql based, i'd go with postgres
Is that an online database?
im highly biased on postgres and redis
no, its a normal database
you install it and use it
Oh I prefer a online DB because I just have one computer and have the database always running, i do t know
mySQL as you wanted, isnt online
I prefer managed databases too but my wallet disagrees with me
postgres keydb redis or cassandra
those are the only ones i would personally use
postgres as a utility one, it has basically everything you need
redis keydb as super performance dbs
or cassandra which offers great and easy scalability
did you mean "I'm not thinking about mysql"?
i mean people here talk about scalability when they're running databases with less than a million rows lol
I saw MongoDB but seems very confusing
this
I'm running above that 
i dont think anyone here would reaslistically need for performance bots
not below 100k servers at the very least
just get a single postgres instance and you're not gonna run into issues for a long time
and even at those ranges you'd need a lot of queries to manage to abuse it
though in fairnes postgres offers clustering too
i was checking upon that a while ago
same for redis
I wouldn’t charge the amount of rows for a talk about scaling but how much clients access the database and how much requests are done per second.
it's very tempting to play with different toys but these scalability databases really don't make any noticable difference for the kind of data you and I work with, not even at top.gg even
the only reason i had to even bother checking on scaling was leviathan, which legit pulled 98% of twitch's global traffic
and i was querying on every message
I mean I can't think of many instances where your database access doesn't grow with the size of your data
i think i was looking at around 120k queries per second
I'm going to try KeyDB seems to me a very good DB
just... pick up a relational database first
vanilla redis would be better
Hi
You’re speaking about data collection but I’m speaking about static database content such as hash lookup tables etc.
when it comes to databases, your data design and structure matters 95% of your performance
Help
the software you use matters 5%
this
Yeah that’s true for sure
and what queries you're using too
no bro nosql very fast brrrr

with that said
I will just use the database to VIP commands
sqlite > all
İm created a bot i can no invite
:^)
burn the sinner
let's not talk about twitch 
use relational database = very stink, not good performance
use nosql = instantly good performance and better in every way pog
shush its a valid example
normally nobody would ever deal with that much traffic




