#development
1 messages · Page 1635 of 1
same

I'm using Glitch
Oh
Because my credit card is gay
I sell credit cards.



I have 2000 nitro codes
checked?
yes, me I wait to fix oof
7 times checked
send dm one nitro code oof
G

lol
how do i make my bot server mute
what happend with #development uff
you want to mute other users in Text channels?
Hi!
So I'm having this weird error with fs look..
code:
const fs = require("fs")
exports.twitch = async(bot) => {
const files = await fs.readdirSync("../commands/twitch/").filter(f => f.endsWith(".js") || f.endsWith(".ts"))
for(const file of files){
const command = require(`../commands/twitch/${file}`)
bot.tcommands.set(commands.name, command)
if(command.aliases) command.aliases.forEach(alias => {
bot.tcommands.set(alias, command)
});
}
}
exports.discord = async(bot) => {
const files = await fs.readdirSync("../commands/discord/").filter(f => f.endsWith(".js") || f.endsWith(".ts"))
for(const file of files){
const command = require(`../commands/discord/${file}`)
bot.dcommands.set(commands.name, command)
if(command.aliases) command.aliases.forEach(alias => {
bot.dcommands.set(alias, command)
});
}
}
Errors:
(node:10636) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '../commands/twitch/'
(node:10636) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '../commands/discord/'```
file tree:
in which file is this code written in?
commands.js
fs uses your project root directory
so i should just remove the dots?
remove the ../
no i want the bot to server deafen
does anyone know how to write a script that will auto type the text in c#?
putting the UserManager.fetch method inside a try catch block
yes true
👍
Error ---> https://sourceb.in/BQrjDx1FDj
Code ---->https://sourceb.in/D8zrsQGDO4
It says "is not defined" and idk how to fix it :/
await m.message.guild.members.fetch(deger.replace(/[<@!>]/g, ""), { cache: false, withPresences: true }).catch(() => {})
async (message) =>
ok i'm just dumb
const client = require('../index')
const Discord = require('discord.js')
const logs = require('../models/logs')
client.on("messageUpdate", async (oldMessage, newMessage) => {
//const channel = oldMessage.guild.channels.cache
const channel = oldMessage.channels
if (oldMessage.content === newMessage.content) return;
//const oldchannel = oldMessage.channel.id;
const data = await logs.findOne({
guildID: newMessage.guild.id,
channelID: channel.id,
MessageUpdate: true
});
//const channell = await logs.findOne({
// channelID: newMessage.channel.id
// });
//const channel = client.channels.cache.get(scheme);
if (data) {
const targetchannel = newMessage.guild.channels.cache.get(`${data.channelID}`)
const embed = new Discord.MessageEmbed()
.setAuthor('A message has been edited!')
.setThumbnail(oldMessage.author.displayAvatarURL({ dynamic: true }))
.setColor('#FF0000')
.addField("Edited by:", oldMessage.author.tag)
.addField("Edited in:", oldMessage.channel)
.addField("Edited at:", oldMessage.createdAt)
.addField("Before:", oldMessage.content)
.addField("After:", newMessage.content)
.addField("URL:", `[Click Me](${oldMessage.url})`)
.setTitle('Message Edited!')
.setTimestamp()
targetchannel.send(embed)
} else {
return
}
})```
https://media.discordapp.net/attachments/766116919983079434/818131355048083476/unknown.png
My dumbness is unmetered
Change channels to channel
THEN IT WILL say cant access channel before intallization
Well channels isn’t a property on a message lol
did you get the channel as partial?
lol
uh wat?
client.on(“message”, (message) => {
// code here
})
Those quotes are apples quotes so no work in code
He did
ah ill scroll up
Scroll up and replace channels with channel
const client = require('../index')
const Discord = require('discord.js')
const logs = require('../models/logs')
client.on("messageUpdate", async (oldMessage, newMessage) => {
//const channel = oldMessage.guild.channels.cache
const channel = oldMessage.guild.channel
if (oldMessage.content === newMessage.content) return;
//const oldchannel = oldMessage.channel.id;
const data = await logs.findOne({
guildID: newMessage.guild.id,
channelID: channel.id,
MessageUpdate: true
});
//const channell = await logs.findOne({
// channelID: newMessage.channel.id
// });
//const channel = client.channels.cache.get(scheme);
console.log(data.channelID)
if (data) {
const targetchannel = newMessage.guild.channels.cache.get(`${data.channelID}`)
const embed = new Discord.MessageEmbed()
.setAuthor('A message has been edited!')
.setThumbnail(oldMessage.author.displayAvatarURL({ dynamic: true }))
.setColor('#FF0000')
.addField("Edited by:", oldMessage.author.tag)
.addField("Edited in:", oldMessage.channel)
.addField("Edited at:", oldMessage.createdAt)
.addField("Before:", oldMessage.content)
.addField("After:", newMessage.content)
.addField("URL:", `[Click Me](${oldMessage.url})`)
.setTitle('Message Edited!')
.setTimestamp()
targetchannel.send(embed)
} else {
return
}
})```
k
instead of const channel = oldMessage.guild.channel
guild.channel is not valid, its a manager if you use channels
targetchannel is not defined
it is
bcs newmassge.guild.channel is not a thing
?
guild only got the channels property and this is a manager
this is basic d.js
const client = require('../index')
const Discord = require('discord.js')
const logs = require('../models/logs')
client.on("messageUpdate", async (oldMessage, newMessage) => {
const channel = oldMessage.channel
if (oldMessage.content === newMessage.content) return;
const data = await logs.findOne({
guildID: newMessage.guild.id,
channelID: channel.id,
MessageUpdate: true
});
console.log(data.channelID)
if (data) {
const targetchannel = newMessage.guild.channels.cache.get(`${data.channelID}`)
const embed = new Discord.MessageEmbed()
.setAuthor('A message has been edited!')
.setThumbnail(oldMessage.author.displayAvatarURL({ dynamic: true }))
.setColor('#FF0000')
.addField("Edited by:", oldMessage.author.tag)
.addField("Edited in:", oldMessage.channel)
.addField("Edited at:", oldMessage.createdAt)
.addField("Before:", oldMessage.content)
.addField("After:", newMessage.content)
.addField("URL:", `[Click Me](${oldMessage.url})`)
.setTitle('Message Edited!')
.setTimestamp()
targetchannel.send(embed)
} else {
return
}
})```
here edit my code and give pls
we are not allowed to spoonfeed
x)
k
give what?
so how can i fix it?
fix my code and give
I can't fix the code and give as that is a violation to #rules-and-info .
but i use python thats why its going above my knowledge
😋
Does this work for normal if statements as well?
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=hasPermission
Example pseudo
if(check /* but if user is admin or owner, return false*/)
where does it break now? does it log the channel id?
also you dont need to pass the channelid as a string in your case
this could be the issue
const targetchannel = newMessage.guild.channels.cache.get(data.channelID)
try this
also make sure the channel is cached, otherwise you have to fetch the channel
yes, but haspermission is deprecated, use permission.has
umk
For example
i have the same thing smh
if (!message.member.permissions.has("ADMINISTRATOR"))
the check returns a boolean
if(/*if the user doesn't have a specific role, it would return as true, otherwise, if the user is an admin, it would return false*/)
this is possible
Yes, but I want the second part of the pseudo.
in your snipped you pass it to a string for some reason
message.member.permissions.has("ADMINISTRATOR") ? false : true something like this could work there is probably a more elegant way for this but it will return false if the message author got Admin permissions and true if the author doesnt have Admin permission
Ah,
I did do this tho in pseudo
if(!userHasNoRole) {
return "oh damn, has no role"
} else /* if the user is an admin or an owner*/ then it would continue and bypass the check.
Didn't figure out the second part.
then you dont need the last snipped ive send
just use the Aministrator check
i dont think you need to check for Owner since the Guild owner usually got instantly Full permissions
if you mean Bot owner you can just add a check for this
I know, but I want it to return if the user is not an admin.
No, guild owner.
if (message.member.permissions.has("ADMINISTRATOR")) -> returns true if the author got Admin permissions
That is the else statement.
and false if not
also you could make your code maybe a bit nicer
Indeed, one second.
what did you want to check? if a user got certain role or is Admin it runs the code?
if(!message.member.roles.cache.has(server.moderatorRole)) {
embedError.setDescription(noModerator);
return await message.channel.send(embedError);
};
If the user is an admin, then it would bypass the above if statement.
I'm trying to do that.
you can use a logical and to check if the user doesn't have admin permissions in that if statement
That would make me shift the rest of the code inside that.
There isn't any other way to bypass the if statement if the user is an admin?
Wait, can I do it like this?
wrap all the stuff inside a other if statement
Yes.
but this method above is more efficent
if(the user is not an admin) {
if(!message.member.roles.cache.has(server.moderatorRole)) {
embedError.setDescription(noModerator);
return await message.channel.send(embedError);
};
}
I don't think that would work.
why do you have return await 
That's literally the easiest way I can think of you could do that???
I'm giving you an answer to your question.
if (not a mod and not an admin) error
condition: they are a mod
if (false && not an admin) error
short stopped and fall to the else
condition: they are an admin
if (true && false) error
// not true. && checks for truthiness of multiple values. true && false returns false
condition: they are neither
if (true && true) error
self explanatory
condition: they are both
if (false && false) error
Short stopped by first false and falls to the else
your else should have code to run if they do have permissions
um...... so pls tell how to fix it
const client = require('../index')
const Discord = require('discord.js')
const logs = require('../models/logs')
client.on("messageUpdate", async (oldMessage, newMessage) => {
const channel = oldMessage.channel
if (oldMessage.content === newMessage.content) return;
const data = await logs.findOne({
guildID: newMessage.guild.id,
channelID: channel.id,
MessageUpdate: true
});
console.log(data.channelID)
if (data) {
const targetchannel = newMessage.guild.channels.cache.get(data.channelID)
const embed = new Discord.MessageEmbed()
.setAuthor('A message has been edited!')
.setThumbnail(oldMessage.author.displayAvatarURL({ dynamic: true }))
.setColor('#FF0000')
.addField("Edited by:", oldMessage.author.tag)
.addField("Edited in:", oldMessage.channel)
.addField("Edited at:", oldMessage.createdAt)
.addField("Before:", oldMessage.content)
.addField("After:", newMessage.content)
.addField("URL:", `[Click Me](${oldMessage.url})`)
.setTitle('Message Edited!')
.setTimestamp()
targetchannel.send(embed)
} else {
return
}
})```
Thanks! :)
Because: #development message
because the return type of execute will be Promise<Message> and not Promise<Promise<Message>>
console.log your targetchannel and see if its cached if not add a check for it and if it fails fetch
I have a question, wdym by async execute()
hm?
Do you mean the module.exports.run?
Yes.
I did this as an example.
const { MessageEmbed } = require("discord.js");
const { cyan } = require("../../other/colors.json");
module.exports = {
config: {... config stuff ...),
run: async (bot, message, args) => {
if(!message.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
const dice = Math.floor(Math.random() * 5) + 1;
const embed = new MessageEmbed()
.setDescription(`Your dice landed on ${dice}!`)
.setColor(cyan)
return await message.channel.send(embed);
},
};
Is that correct?
returns undefined right?
return await has no effect on that expression there
yessirr
huh? but it is in mongo
like how can i fetch it?
Go ahead.
i asked you to console.log the channel
const targetchannel = newMessage.guild.channels.fetch(data.channelID)
also why did you get the channelid from MongoDB? you get it already from the event
instead of stacking arguments in your run method, create a context object and pass that in, so your code would look like this
//in your command handler
command.run({
bot: yourbot,
message: msg,
args: args
//... add as many properties as you'd like
});
//in your command file
run: async (context) => {
//context.bot ...
}
ppl can set it like f!log set <channel>
i have same thing
are you sure?
this will not only clean up your command handler but you prevent the chance of confusing the argument order
ig
Ooo, alright!
bcs your snippet only uses cache.get
Yes!
But yo, cry. Is return await message.... something bad or?
i just tested it out
it's redundant
it isn't bad, it's just redundant
js really does not make sense at all
how
...
you'll still have to await it when executing the function
i guess it's the promises being stacked
so it's redundant
yeah, you'd expect run (without return await) to return a Promise<Promise<Message>> because it's an underlying one
Do I keep it as return await? or what should I do?
your choice really
What is better?
Any other important difference?
no
So writing await or without it literally does the same thing except it would await for the things before it to execute before doing this, right?
that's not doing the same thing - they both do the same thing because js allows promise chaining
but you're not catching it
Oh, so the difference is what, in conclusion?
If I type await, will it decrease the promise chaining?
hi
returning an awaited promise means you manually resolve it
returning an unawaited promise means the top level await will resolve it
returning an unawaited promise is basically doing this
await run().then(x => djs internal code here);
where then is the send method
so there's no difference
both do the same thing, except one is with async/await and the other is promise pattern
// your command file
{
async run() {
return message.channel.send("text");
}
}
// your handler
try {
await command.run();
}
catch (error) {
// handle
}```does the same thing, whether you put `await` before return or not. if it returns a promise, it'll catch the error. if not (`return await`), it'll still catch it since you're `await`ing the function. the only important part is the `await` in your handler (`await command.run()`)
Everyone starts somewhere
oh.
// Before.
if(commandfile) commandfile.run(bot, message, args);
// After
if(commandfile) await commandfile.run(bot, message, args);
?
yes, and use try/catch or promise.catch()
did you got it figured out?
if(commandfile) try {
await commandfile.run(bot, message, args);
} catch (error) {
console.log(error);
}
Question.
Does this mean I have to remove all my return await message.chan..
const deger = "Veld#0001";
await m.message.guild.members.fetch({ cache: false, query: deger, limit: 1 })
no results are returned. how can i search by the user's tag.
Or Do I keep them?
you can remove them to make your code less redundant
it doesn't matter
but you still have to await your promises inside your commands so that your handler can catch errors
this is only redundant when returning
Do you mean when it performs an action?
Example
just any promise
await perform();
Like that? If it didn't work, what does it do? Does it error?
if it returns a promise, await it
your handler will catch it and you can handle the error
otherwise it might stop the node process (not sure what node version you're running)
if(message.content === "lol hi") {
message.channel.startTyping()
message.channel.send("Hi")
message.channel.stopTyping()
}```
Is this correct?
v12
it might start typing and stop at the same time since you're not awaiting the send method
that's a pretty old node.js version
Oh then what is correct?
await the send method so that it stops typing after it sends the message
Ohok
Just to be clear, returning a promise meaning returning an action that the bot would perform, right?
I have a problem
const Discord = require("discord.js")
const db = require("quick.db")
module.exports = async (client, message) => {
if (!message.guild || message.channel.type === "dm") return;
if (message.author === client.user) return;
db.set(`snipe.${message.guild.id}.content`, message.content);
db.set(`snipe.${message.guild.id}.channel`, message.channel.id);
db.set(`snipe.${message.guild.id}.user`, message.author);
setTimeout(function() {
db.delete(`snipe.${message.guild.id}`);
}, 600000);
let data = db.get(`snipe.${message.guild.id}`);
let content = data.content;
let user = data.user;
let channel = data.channel;
const logsmessagedelete = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
const entry = await message.guild.fetchAuditLogs({limit: 1, type: 'MESSAGE_DELETE'}).then(audit => audit.entries.first())
if (user.id === message.author.id){
const userembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimé a été retrouvé !")
.setDescription(`J'ai retrouvé un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimé par : <@${user.id}>`);
logsmessagedelete.send(userembed)
}else{
const anotheruserembed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTimestamp()
.setTitle("Un message supprimé a été retrouvé !")
.setDescription(`J'ai retrouvé un message de <@${user.id}> dans le channel <#${channel}> !\n\n${content}\n\nSupprimé par : <@${entry.executor.id}>`);
logsmessagedelete.send(anotheruserembed)
}
}
oh
My messagedelete.js have a problem with embeds
the problem is:
When I delete my own message, the bot says another user deleted my message
Yes but so is executing a method that returns a promise
or other, when someone delete my message, the bot says I deleted my own message
pls help
where is the event?
code
messageDelete
at events
the bot sends embed
is this?
but when he needs to declare who deleted the message, its wrong
yes
ohh wait you get it this way, try client.channels.fetch()
you could try to resolve the channel tho with your way
um where should i add ths
Ok, to conclude things up. I have putted the await command.run() thing and I have also kept all the return awaits.
where you get your channel where you want to send your message
const targetchannel = client.channels.fetch(data.channelID)
All right
If you use any methods that return a promise, make sure to await them too
try and see
Alright, so I do keep the return await message.chan?
client.channels.fetch().send() would also work or client.channels.fetch().then(c=>c.send())
Wait...
This works?
yes?
I faced some issues when I did this in node 12 and didn't put in then
Sure, again, it doesn't matter since you're returning it
.then should work for sure, fetch.send im not 100% sure but i know that it works with cache.get() so i dont see a reason why they would not allow it with fetch
it doesn't cause fetch returns a promise
yes
await fetch('https://google.com ').json()
Didn't work for me
does it error?
const { data } = await fetch('https://google.com').then(response => response.json());this works for me
Yes that will work
or like this
(await fetch('https://google.com ')).json()
Let me eval that
that isn't equivalent to what superbrain sent
Oh
use fetch(blabla).then(x => x.json())
I know
I was discussing whether this works or not
Btw, if I dragged if(!message.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return; to my message.js, does it check for all of my commands?
SyntaxError: Unexpected identifier
hm
hasPermission is still deprecated
On which program can i programing a bot ?
anything that is capable of writing to a file
visual studio code is good
Ok thx
np
notepad best
This won't work
Use .then
.send i know, but then should
why is this happening
const x = fs.readFileSync(__dirname+"/../meta.json", "utf-8");
x.prefix = args;
fs.writeFileSync(__dirname+"/../meta.json", JSON.stringify(x, null, 4));
it won't work cause the promise won't be resolved
stop using json as your database
i know
read this
people think they "save" time by using json as a database, but they are just lazy
honestly, json databases seem like more work
is quick.db a good option too for beginners?
idk ive suggested someone else here to switch to a proper db asap and he said: nah im fine i will do it when im ready for it
setting it up takes less time than a proper database
but making json databases actually work properly is going to take more time than just setting up a proper database and forgetting about it
I have Intel j idea is that good ?
Indeed! 😂
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ perhaps
The best option for beginners and intermediates is Josh
Legit, SQLite takes about 3 lines to setup and thats it
enmap is nice, but can be quite heavy to run
Yeah thats why we use Josh 😂
your answer was to not use a json database
JSON moment
quick.db is a database
"doctor!! my leg is broken!! why???"
"you should stop jumping off high structures"
"WELL THAT DOESN'T ANSWER MY QUESTION WHY IS MY LEG BROKEN!!"
good if you start out, but if you want to grow large dont use it i would say, sqlite can work if you know what you do
its not my first or second choice using quick.db, but it works.
it is easy to use and works
@vivid fulcrum are you mentally challenged
quick.db is ok, but enmap is better (in that it has more features)
no, are you?
Though, obviously, my opinion on that matter is highly biased.
but if you want to get most out of sqlite you are better of using native sqlite
gives you way more controll
What happened evie ? Green today?
the SQLite syntax generally is very easy aswell as it has a more minified versions of the SQL spec by default (extensions go brrr)
it seems fine to me, is there any problem your having or?
removed from my post due to behavioural issues but I`m still here to help with dev at least 😄
well, it's escaping the string 
No
the output you have at the bottom is what it generally should look like
thats what he will get if he uses it
the file is actually
\"\\r\\n\" etc...
the bottom is what was returned using it

He should just make an object and then toJson it
^ yeah probably best option
or he should just use an actual db 
Aight so I lost my thought process, How would I be able to get a bot to find a specific guild using a ID to then in that guild find the id of a channel in the guild?
dont forget to backup your db periodically since json isnt stable
preferably automatically every few minutes
thats massive overkill lol
client.guilds.cache.get(id)
"find" how?
JSON files are bad but they're not that bad lol
U want guild or channel?
tell that to all the gigabytes of data that have been lost over the years by amateur developers that don`t want to listen people talking about possible corruption
Well, Not like that since I do not want to specify the id of the channel, but I do want to specify the guilds ID, Then while having specified the guilds id, Find a channel in that guild.
if channel then go for
client.channels.cache.get(id)
This will also have guild
channel#guild
their issue is the fact that they're slow and eat memory, not so much the corruption issues, as long as you read and write the file sanely or if your framework is nice then your corruption chance isnt massive
Then see my previous reply
we get reports of json db corruption in this channel quite a lot
Oh are we assuming people don't just do JSON.parse() and JSON.stringify? LOL. They do. They don't actually use frameworks. If they did, we would never have this discussion
few times a month atleast.
with prefix's imo thats data you dont want to ever lose.
Something like;
client.guilds.cache.get('ID').channels.find(Find string here).send("message)
I mean i never said that people weren't idiots
or the fact that JS just goes "yeah... you deal with it"
weren't*
Yes
damn only problem was i didnt .parse it when reading xd
Yes
It't not about stupidity here - it's about inexperience (and some amount of arrogance/dunning-kruger, beginners thinking they actually know better)
what do you mean my 40GB json file cant be opened on my 4GB ram machine
oh and how could I specify what type of channel it should find?
Yes it can't be opened
just buy a better VPS
technically it can be opened but it cant be parsed by most parsers
Just use an actual db
read streams are cool
nah get a dual Socket Epyc CPU equiped Server with 4TB ram to open your Json DB
there are some JSON parsers that allow for partial data extraction but they assume that the context outside of the data given to them does not matter
4tb of ram is key
I love the smell of "But if I can use JSON after 10 years of programming experience, everyone should be able to!" discussions in the morning.
Always gotta be people arguing on both sides. Can't ever mention JSON without this debate happening!
Over exaggeration much 🤣
node is pretty heavily single threaded. Would like to see someone make something numa aware
JSON is fine for static stuff, not for dynamic stuff
Dont use json
json configs are fine
i mean JS is fundamentally build around being single threaded
Yes that's another way of sayign "don't use JSON as a database"
Use js module exports objects
it's just it's nature just like Python
WebJS threads and worker_threads are cool
i dont care anymore about people using json as a database, they will land on theyre face soon or later and then ask here again why they have some funky errors when reading theyre json file
write sql parser with json as backend!!!
json only contains prefix doubt its gonna be a massive problem
this is how it usually starts. its "only" a prefix. then after a few weeks its "only" a prefix and a few channel ids
after a month for some reason your bot gets popular and you try to load a 1 GB json file
I'm working on my userinfo command and adding a special case for when multiple members with the same username/nickname could be found via searching. I almost have the implementation, but I feel my wording is off: ```txt
A list of members with similar names were found.
- Lite#6155 (Lite)
- Bot1#0001 (Bot1)
- Bot2#0002 (Bot2)
Select a number between 1 and 3. This will timeout in 30 seconds.
What's a better way of writing this?
prefix's are important.
if a server changes a prefix, and then that prefix stops working they might just kick the bot because it doesnt work.
Await the promise and .then it
channels.cache.find
How do you mean?
I'll try that.
Use this
unrealistic, I've been doing this for 3-4 years and my bot is in less than 5k guilds
its private bot tho idk why everyone screaming about json 💩
😂
At 2k guilds my json db was 15mb big
i saw people here writing some pokecord clones who gained 1k guilds in 2 weeks, so its possible
That was probably when the demand was high for a poke bot since one of the big ones shut down or had issues. idk
My jesus bot gained something dumb like 1.5k servers in 3 days 
jesus
turns out people seem to like a bot that shouts the bible at you every time you say some profanity
My bot gained over 1000 whenever YT started to ban IPs, so all the big bots got fucked and mine survived
if you find some thing you could do with a bot and it creates a demand no one knew they want it you can gain a lot of guilds quickly
Just add a webpanel to your bot.... your guilds would increase drastically cause most people don't like command configuration
Easier said than done
true and true
i work on this now for almost 8 Months
Web dev sucks
end users are as smart as an insect
No
An insect is smarter
JS time baby
Woo
Insects can find food kilometers away
Lol
Well JS is disabled
theoretical a Panda would be fitting, they are sort of dying out bcs they dont want to reproduce either in a Zoo or in the wilderness
I thought it was disabled cause of xss
Ok
You can do a lot of cool shit with css only
spot the iframe 
One message removed from a suspended account.
One message removed from a suspended account.
also this btw
i got locked out of my main and it's been over a week since i sent an email to support
One message removed from a suspended account.
no response whatsoever
One message removed from a suspended account.
One message removed from a suspended account.
i got logged out on all devices
then when i tried logging back in, it asked for 2fa
i don't have the device i had my 2fa on anymore
Rip
One message removed from a suspended account.
One message removed from a suspended account.
no backup codes saved?
nope
rip
Sed
yup i'm using authy on this account
One message removed from a suspended account.
No
I dont think it does
One message removed from a suspended account.
One message removed from a suspended account.
I got rid of mine
randomly happend to me a while ago, too... no clue why all my sessions got lost
and fucking Discord required SMS authentication
fucking forced me to use and rent a sms online io service to get my Discord account back
unbelivable 
discord's whole login system is absolute trash
aye, it is
the reason why they added qr code login is because the desktop login would log you out randomly so frequently
What code (permissions=?) do I need in the bot invite url for all perms?
One message removed from a suspended account.
8
can someone point me to the guy that works with adding new tokens
thinking I provide them my real phone number... bullshit
?
Weird cause I've never experienced any issues with discord's login system
One message removed from a suspended account.
but that's admin only, I mean how to set all opt-in at the role settings
Wdym adding new tokens
One message removed from a suspended account.
oh right, use https://discordapi.com/permissions.html
to the tipcc bot
One message removed from a suspended account.
Wrong server?
One message removed from a suspended account.
One message removed from a suspended account.
even more frustrating is the fact if you wanna disable 2fa or simply logout on the same device you have been logged in for weeks/months it even requires 2fa again
pain in the ass to rent a random number always just to receive a stupid verification code even if you disabled that shit
Can you make it send an sms to another number?
sure... imma using (payed) local SMS APIs to receive infos about my server monitoring or messages where ever I've included it into my code to stay about to date about things
it's been used to send/receive SMS using random numbers as sender, a costum name etc.
I had tons of issues with some stuff because my phone number was not available outside of the country
So i couldnt receive verification smss
well and I don't wanna share my number online so I've choosed one from GB this time, PL last time, US before... Discord doesn't give a fuck if geo location has changed during verifications
tried some free online available numbers before, but most of them are blocked, not so payed services offering SMS(ervices) for 24h/7d ... for a few bucks
some of these services even accept bitcoins just to stay a little more "anon"
Btc and eth suck so much for payments these days
wouldn't make sense to provide my credit card to a strange service just because I don't wanna provide my phone nr to Discord 
Transaction fees are ridiculous
can't complain yet, but I know what u mean, yeah
isnt the transaction fees so high because mining is so profitable?
hmm "profitable"... got a little more so since the chart is going up
Its not exacty profitable anymore
not for you and me, but for someone with a ton of money it is right?
if you steal the energy somewhere and don't have to pay for the hardware... I'm sure it is
Well yeah, with the right equipment and low power cost
there are apartments with no electricity bill in my area 👀
move in, start mining, ez profit
They will kick you out fast

I wonder what you could reasonably mine before being noticed.
test it out lol
like, 4gpus, would you get away with it 👀
The most profitable coin atm is ravencoin i think
Or ethereum
I ran some simulations, and my laptop could earn about 10 bucks a month from mining
After energy bills
not really a fan of these second-rate products
for a laptop that seems good
power bills are low in my area since we are a huge provider of coal for the country.
guess it would be -100 where I live
XD
might sound funny but it actually isn't...
this may sound stupid but it's actually complicated for some reason; how the fuck do I check if a reaction is a heart reaction
just shithole countries and states everywhere... gonna create my own
It does work with unicode
but it doesn't
that's mostly an indication of you're doing something wrong
\❤️
The extra unicode is the color selector
i am stil not sure where to add it
If you escape built in emojis, Discord gives you a clean version you can copy which is raw unicode
The color of the heart is defined with the extra unicode
I see,
there are mutiple ways to handle it. you can use await for the fetch or use it in one line where you send the embed
like after you make your embed use client.channels.fetch(channelID).then(c=>c.send(embed))
how can i get all users? there are currently no users in my cache
when do you access the cache? It must be after the client has logged in
so after the ready event gets fired
ok I did it. i was making a mistake
no
i don't get any users and emojis cached
that wasn't a boolean question
you're supposed to replace channelId with a valid variable or a string literal
data.channelID?
man i am very bad at db
maybe? I don't know how your code looks
Does anyone know how to show database ping in mongodb?
data.channelId isn't a valid channel id
it is chaning the last 3 digits of the id
even if i change in it manually it becomes that
smh
You send the server a request which returns a minimal amount of data which isn't hard to select, then just take a timestamp from when you sent the request to when it responds and do some math
Store IDs as a string in your db
huh?
But I wanna do it with eval
you're storing them as an integer, that's why they're getting rounded
You can do it with eval 
store them as a string
u want to make it string?
maybe, I don't know what db you're using
mongo
const { Schema, model } = require("mongoose");
module.exports = model(
"logging",
new Schema({
req: {
required: true,
type: Boolean,
default: false
},
channelID: {
type: String
},
guildID: {
type: Number
},
MessageUpdate: {
required: true,
type: Boolean,
default: false
},
MessageDelete: {
required: true,
type: Boolean,
default: false
}
})
);```
umk
hope it works
trin to fix it since 3 days
ngl
Javascript doesnt normally support big numbers like discord ids, thats why
Doing pings in eval and anywhere else follows the same logic 
Numbers that are too large get rounded
which one?
which code?
const { Schema, model } = require("mongoose");
module.exports = model(
"logging",
new Schema({
req: {
required: true,
type: Boolean,
default: false
},
channelID: {
type: String
},
guildID: {
type: String
},
MessageUpdate: {
required: true,
type: Boolean,
default: false
},
MessageDelete: {
required: true,
type: Boolean,
default: false
}
})
);```
date - user_id 
The code that is causing the error
a get from database usually returns an entry or null if the key doesn't exist in the database
msgedit.js
k
const client = require('../index')
const Discord = require('discord.js')
const logs = require('../models/logs')
client.on("messageUpdate", async (oldMessage, newMessage) => {
const channel = oldMessage.channel
if (oldMessage.content === newMessage.content) return;
const data = await logs.findOne({
guildID: newMessage.guild.id,
channelID: channel.id,
MessageUpdate: true
});
console.log(data.channelID)
if (data) {
//const targetchannel = client.channels.fetch(data.channelID)
//console.log(targetchannel)
const embed = new Discord.MessageEmbed()
.setAuthor('A message has been edited!')
.setThumbnail(oldMessage.author.displayAvatarURL({ dynamic: true }))
.setColor('#FF0000')
.addField("Edited by:", oldMessage.author.tag)
.addField("Edited in:", oldMessage.channel)
.addField("Edited at:", oldMessage.createdAt)
.addField("Before:", oldMessage.content)
.addField("After:", newMessage.content)
.addField("URL:", `[Click Me](${oldMessage.url})`)
.setTitle('Message Edited!')
.setTimestamp()
client.channels.fetch(data.channelID).then(c=>c.send(embed))
} else {
return
}
})```
you probably have to empty the data inside your current database
because guild and channel ids are stored as numbers
i did
my cmd ^^
see its changed
@quartz kindle here
Guys
at that config part..
I tryed everything
../config.json
/config.json
../../config.json
./config.json
I know how it works
But...
rn
" " `
How do I define channel?
😐
I never defined channel...
It usally defineded it self..
opinions on this system? http://cdn.yxri.dev/u/175924070321.mp4
looks good.
The issue is likely the message not the channel
@quartz kindle
logs.findOne did not find anything
The error says data is null
but how?
console.log data
Mongodb 
@quartz kindle uwu green name
uwu
lol, you "models/logs" file does not have .js property ?! 
in discordjs-light is there some way to use the GuildMember.hasPermission function without cacheRoles: true option?
you have to fetch all roles, to check member perms, do you just want message.guild.me?
ask tim he is the dev of the lib
i was using the msg.guild.me object originally, but i believe that required caching. now i do this const client = await discordClientPromise; const me = await msg.guild.members.fetch({user: client.user.id});
me.hasPermission("MANAGE_ROLES")
and cache role makes just 10% difference
but iirc you need to have the roles cached
guilds cache already fetches message.guild.me
10% can be a lot
.hasPermission is depreceated use .permissions.has
max 10%, some bots uses less
the permissions field is a 0 bitwise unless i add the caching
role caching?
yeah
then you probably need it, I use rolecaching too, made a very less difference
You can fetch roles without caching, if you dont mind hitting the api more often
If your commands are not being used lots of times per second it should be fine
Another alternative is to manually manage the permissions for the bot member
By keeping them synced using memberUpdate and the role events
But it wont be easy because discord.js roles are a clusterfuck
i should be okay with only the cacheRoles and cacheGuilds options enabled. my memory usage with discord.js was getting out of control so hopefully this will be enough
Yes, should be fine like that, roles are relatively cheap to cache
I would
a discord.js-superlite. In which you have a constant.js file where you can customize what to cache. There are some properties you never need lol
i noticed that the memory usage with discord.js doesn't grow instantly. right after a restart it only takes up about <100mb. after a day it's at about 200mb. hopefully it's discord.js cache issue and not a memory leak issue with my code
Same happening here. Takes 200mb once it starts up then next day about 370mb.
on how many servers?

thats a lot
tim uses more than 3x less than that for 7k
Somehow my users cache (1 month ago) decreased from 220k members to 50k so it started using less which is about 300mb maximum.
i'm basically getting the same ram usage for the same server count
you cache members?
thats the reason
discord.js-light is going to solve all my problems
I use djs-light and I’ve got 100mb for 430 servers
Difference?
discord.js-light lets you control what is cached
i got 190 mb for 800+
That happened because of the new rules with intents
What do you mean, exactly, as I never got any information about it.
Everyone
discord.js-light
discord doesnt give you online members anymore without the intent
Before you would receive all online members at bot start
Now you only receive members in voice channels and the bot itself
Unless you explicitly ask for members with the intent
I have both presence and guild intents, does that affect anything or yet, same?
If you enabled both of them, then your members should be like before
Back to 200k? Nope, that never happened.
It's yet at 60k.
Did you use fetchAllMembers before?
I don't think so, no.
Hmm weird
That's how I get the number.
Ah i know why
Go ahead.
Well my bot's cache remained the same for about 3 weeks then it decreased.
Why that huge delay, though?
Was it trying to remove from the cache?
what does the bot attitude do, and which unique feature does it have?
I am to lazy to invite it xD
I restart it every 2 days or a day or so.
Then idk
which bots 
All bots
Morning buddy.
Sa
you mean on this discord server?
Indeed.
mass kick 
😂
or they asked Discord xD
Lol. I've got 80MB for 3k servers :)
Nice
on discord.js-light?
machine learning is pog
No lol
using my own modular interfaces and wrapping it through a layer similar to discord.js
and it has permission check 
Yes 👀
LMao
do you use your own api or a public one like dialogflow?
oh no i pinged them 
Is this free or does it cost something?
it's free
Gg veld.
it's just a C# library
And your not planing making it opensource ?
bad for me, I am just a poor js dev lol
are you using a jupyter notebook to do machine learning in?
ive submitted a bot yesterday that would flag you for this
ML.net is free, its like Tensorflow for JS and py
They are open source https://github.com/AmandaDiscord
Why is it like this?
empty embed?
when you did not define any propertie of embeds
or did you send a Image?
No.
bcs this looks also like a Invalid image url
I have a .setDesription
only the Description?
show your code
const embedTwo = new MessageEmbed()
.setColor(cyan)
if(boxes === 1) {
embedTwo.setDescription(`You collected your weekly reward of **$${reward}** and **${boxes} Mystery Box**. Your new balance is **$${data.money}**!`);
} else if(boxes >= 2 && boxes <= 3) {
embedTwo.setDescription(`You collected your weekly reward of **$${reward}** and **${boxes} Mystery Boxes**. Your new balance is **$${data.money}**!`);
};
message.channel.send(embedTwo);
none of those statements were true so the description wasn't set
always, np
😀
Also doing all that just do make a single word plural...
.setDescription(`.... and ${reward} Mystery Box${boxes === 1 ? "":"es"}`);
return message.channel.send(new MessageEmbed().setColor("BLUE").setDescription("3 karakterden uzun bir prefix oluşturamazsın!"));
}``` is there an error here? I saw an error called "length of undefined" on the console
Check if args[0] exists before doing anything with it
return message.channel.send(new MessageEmbed().setColor("BLUE").setDescription("Lütfen bir prefix giriniz."));
}```
yeah that works
already existed 😄
Hello Can soemone help me with my bot i cant have node.js and the other one. can someone pls help.
what is the issue
Yeh I wanna add it to the list
i just deployed the discord.js-light library update and it is now taking up 67 mb right after boot with discord.js-light. it was taking up 87mb on startup before. hopefully the memory doesn't grow too much. thanks Tim
can u tell me what it starts with
scroll and you'll see
Up or down
✨ brain exercises ✨
gotta flex that brain
literally just read the blue text and find one that relates to your issue
K
If you had done so since the beginning instead of asking, it would have been faster and less effort
So youre not actually lazy
what
Hi
Hmm
I want to make a bot
And i will learn jave script
So
Where can i learn it?
on youtube you can find a lot of material
w3school js, google it
is this a good idea to use raspberry pi for 7/24 working discord bot?
If your internet is good, yes @wanton prism
unfortunately very true
idk guys kinda strange question, but... So I am using discord.py and I have the following error: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions. I read the docs and as it turned out the bot has to be upper than the highest role of the member, I am trying to change the nickname of. So here is the actual question: How to make the bot set his role higher itself, or the admins must do it themselves? Yeah I know idiot question but pls help lol
i am working on a clear command but i want it to clear a certain user that's been pinged. How am i supposed to do that
Admins must do it
okay thank you
what kind of internet we talking about? How many mbps?
Mbps, ping, stability
@quartz kindle** Why do the "Internal_Server_Error" occur?**
One of the main advantages of paying for a vps is that they have super good internet
some bots uses a lot of internet, some very less.
A 10mbs connection is minimum
Stability is the most important thing
realistically no
Even if your bot doesnt use a lot
my bot doesn't use nearly 10mbps
Neither does mine
how much does your lol and my question above lol 
more or less?
way less
About 5KB/s which is about 40kbps
ok i got 34mpbs and 4 ping, no packet loss
lol
then its ok
chip's dedi is only using 50mbps up and down
you generate the astrology things and upload them, how can this be so less?
With hundreds of music streams?
200kb, I downloaded them
idk if ll does things differently tho
ok well I do mine ~60 tims are 200
even then
tims bot isnt the biggest
When an is sent yes it uses about 200kb per image, but commands are not run that ofteb
wait tim did your images require basic trig knowledge to make?
Sometimes i get 10 commands per minute, other times 1 command in 5 minutes
Yes, everything is made on canvas, there are no background images
lol you gave it in sec 
that seems like fun /s
Yes /s
That was the average when running nethogs
my bot going to do less but just collect some points per command, then 34 mpbs is ok i think
nope upload is 5 mpbs
Should still be fine
104 gb traffic in a month lul
But watching netflix will likely interfere with your bots stability
no one saw that
circle avatar lol
raspberry pis are nice but realistically the upfront cost and power will cost more than a cheap vps
Someone hosted on their Rpi 8gb ram a 12k bot lol
Im getting around 8-10gb per month of traffic
lol
realistically my 4gb one can handle 30k guilds

Depends what it does
not on djs tho
sure but monthly charge is bothering me and i can use raspberry for other things
just the way my bot is written
yea, its a bit annoying being forced into paying kinda
Paying per year is nicer
Gives you peace of mind plus you get discounts
yeah I think I could save ~20 if I payed by the year
its kinda hard for me to make some updates
Pay nothing 
thats why raspberry way easier i think
create a git pull command
I could use it but im not gonna risk hosting things on my home network
if I accidentally post my vps ip somewhere idc
but home ip
yikes
Run it on a vpn 
- then I would need a vpn
- added ping




which is how it works for me

