#development
1 messages · Page 1095 of 1
Mentions can be
<@id> or <@!id>
that seems about right
Does anyone have a basic embed reaction menu for discord.js?
const Discord = require("discord.js");
const db = require('quick.db')
const { default_prefix } = require('../../config.json')
module.exports = {
name: "prefix",
description: "Changing prefix",
run: async (message, args, bot) => {
if (!message.member.hasPermission("ADMINISTRATOR")) {
can any1 help ?
line 7 or 8?
same
but red x
is
Date.now() - message.createdTimeStamp;
not the right code for an API "ping"? it keeps coming out negative
huh
I fixed it
but thanks anyway
the only problem I have right now is with making a dynamic embedded help message, with different commands separated into categories
I have a dynamic help message, but it's just plain text and looks ugly
I don't know how to list the commands by their category
that wouldn't be dynamic
adds the new commands itself when they're created, so I don't have to edit the help embed everytime a command is added
for the plain-text one or the embedded one?
all I've done so far is set up the embed
lemme ss
in the original one, I had it map over the commands collection and list them all by name, but I can't figure out how to do that by category so that I could list utility commands under utility, etc.
@earnest phoenix Ok, what do you need?
@earnest phoenix Well, I have a bot, it has been under verification for a long time, I would like to know if anyone knows how long it takes to verify, does anyone know?
3 weeks or more
@earnest phoenix Around 3+ weeks
@earnest phoenix 1 month then right, ok thanks for the help man!
would that mess up this?
or does it search the entire commands folder, regardless if there's other folders in it
how can I edit this code to also search through the other folders? sorry I'm very new to this
Can someone help me debug why https://pastebin.com/Hp2azQW1 isnt working?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
its a reaction menu
ah thank you blu
It just doesn't work @earnest phoenix ...idk if that's helpful lol
There isn't any error
Yo @earnest phoenix
I mean if anyone has a basic reaction menu that works it would rlly help for me to start
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
What all parameters does data have ?
I want to access user's name who voted.
@cunning gorge I can teach you something similar
@earnest phoenix Would be great!
awesome thx
Ping me if anyone helps.
Ping for fun
Reaction menus are just a set of embeds in an array, when the author reacts with an emoji move forward a page.
When the author reacts back, move back
its annoying right
Not really, its just editing an embed.
const command = args.shift().toLowerCase();
client.commands.find(command => command.aliases && command.aliases).execute(message);
if (!command) return;
I have only 1 command with alias which is bottleflip now every command will run the bottleflip.js . Any help?
well you tell your bot to only execute aliases
More of just a curious question but how do I make a !ping command to check the latency of the bot
client.ws.ping <- console.log this (d.js)
this shows the ping to the API. if you want the ping between user and bot create a timestamp on command execution and compare it with the message created timestamp of the command message
How? Can I have an example, I’m a little new to this :/
js?
oh shi
const botping = new Date() - message.createdAt;
im stoopid
message is your command message
Someone know what this problem say ?
Ty
you growed to fast. now you need to wait until you reach 250 Guilds
idk if it helps if you contact Discord Support
My bot has 11, rip
@lusty quest you lie
And half of them are weird dead set ers
2|Music-bo | - /root/Music-bot/index.js
2|Music-bo | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
2|Music-bo | at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:61:29)
2|Music-bo | at require (internal/modules/cjs/helpers.js:72:18)
2|Music-bo | at Object.<anonymous> (/root/Music-bot/index.js:12:20)
2|Music-bo | at Module._compile (internal/modules/cjs/loader.js:1138:30)
2|Music-bo | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2|Music-bo | at Module.load (internal/modules/cjs/loader.js:986:32)
2|Music-bo | at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2|Music-bo | at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:32:23)
2|Music-bo | at Module._compile (internal/modules/cjs/loader.js:1138:30) {
2|Music-bo | code: 'MODULE_NOT_FOUND',
2|Music-bo | requireStack: [ '/root/Music-bot/index.js' ]
2|Music-bo | }```
What does the bot do? I’ll consider
Im contact him
why do i lie? you Growed to fast to 75
No..
if this happens they flag you and you need to reach 250 Guilds
@earnest phoenix install the missing Module
I have done all
well you tell your bot to only execute aliases
@lusty quest
const command = args.shift().toLowerCase();
client.commands.find(command => command.aliases && command.name).execute(message);
if (!command) return;
this also has the same result. always runs bottleflip.js
where
instead of && try ||
let command;
if (bot.commands.has(cmd)) {
command = bot.commands.get(cmd)
} else if (bot.aliases.has(cmd)) {
command = bot.commands.get(bot.aliases.get(cmd))
} else return
try {
command.run(bot, message, args)
} catch (err) {
console.log(err)
}
``` i used this in a older bot
now everything is running the 8ball.js
there is probably a way to do it in a single line but i never really cared about aliases
what do i do now
try the example i gave you 4 massages above
ok wait
/root/.pm2/logs/Music-bot-out.log last 15 lines:
/root/.pm2/logs/Music-bot-error.log last 15 lines:
2|Music-bo | code: 'MODULE_NOT_FOUND',
2|Music-bo | requireStack: [ '/root/Music-bot/index.js' ]
2|Music-bo | }
2|Music-bo | [Error: ENOENT: no such file or directory, scandir './events/'] {
2|Music-bo | errno: -2,
2|Music-bo | code: 'ENOENT',
2|Music-bo | syscall: 'scandir',
2|Music-bo | path: './events/'
2|Music-bo | }
2|Music-bo | [Error: ENOENT: no such file or directory, scandir './commands/'] {
2|Music-bo | errno: -2,
2|Music-bo | code: 'ENOENT',
2|Music-bo | syscall: 'scandir',
2|Music-bo | path: './commands/'
2|Music-bo | }```
Huh 😀
I have installed all modules
you're trying to access a nonexistent directory
Huh
./events/ and ./commands/ do not exist
It's exist
what does the file structure look like?
@earnest phoenix uh can I see your folder settings in you programming application
(ex. VSC, Atom, etc...)
Umm I am new but I have a question
I'm having trouble adding bots to my server and was wondering if anyone here knew how to help me or at least explain why I can add them
-.-
Um ....
That didn't help nor did it make sense -.-
don't ask to ask, just ask your damn question properly
I did
;-;
i unfortunately do not have a crystal ball and cannot see what is inside of your mind so you'll have to put in a bit more effort to explain your problem
what error do you get, what exactly doesn't work
I'm having trouble adding bots to my server I have an Android so usually I have to open it in a browser but the browser won't open instead it brings me back to the homepage of that particular bot and it says something like they're making improvements but I wanted to know if the improvements will affect people making it so not everyone will be able to add bots.....is that better?( ̄ヘ ̄;)
then you cant add that particular bot
this also isn't development related
Oh I'm sorry
Thank you so much for your patience but I think it's best if I go ( ̄ヘ ̄;)
Hey! How do I make people list by roles command? I don't know how to explain so there's example:
you growed to fast. now you need to wait until you reach 250 Guilds
@lusty quest my bot is in 217
guilds now
but i already applied
for verification
it happens only if you get flagged @delicate shore
if you have normal growth you can apply at 75
gg
CSS @cursive merlin
where ?
¯_(ツ)_/¯
the long description
it was allowed ?
yep
it was and still is 😎
thx
Can anyone help me with that code? I asked above about it
Yeah could you please clarify it
do you mean like do -roleinfo @role and it will say who has the role?
also what lang are you using?
discord.js v12
one second
This is example what I want
oh u sent a link
thank u
Uhh, I'm still a bit confused. Could u send example code?
I m using this guild for member count but it isnt working its saying undefined ${member.guild.membercount}
Try:
${guild.memberCount}
Lemme check
let chx = db.get(`welchannel_${member.guild.id}`);
if(chx === null) {
return;
}
let wembed = new discord.MessageEmbed()
.setColor("RANDOM")
.setImage("https://cdn.discordapp.com/attachments/718902845612621874/719226739061948477/unnamed.gif")
.setThumbnail(member.user.avatarURL())
.setDescription(`** Welcome <@${member.user.id}> To our Server** ${guild.memberCount}
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**Make sure to**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**Read and Follow our Rules.**
**Be upto date with our announcements.**
**Make new friends in the chat and be active.**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**We hope that u have fun in the server**!`);
client.channels.cache.get(chx).send(wembed)
})
client.login(token)```
this is my code
bro
message.guild?

you don't have a message object there
what's message gonna be
you're getting a member object from the event callback
so you should use that member object
but its giving error'
now, member objects have guild properties
console.log(JSON.stringify(member.guild))
Oi boss man @quartz kindle explain to this guy in a human way what he's doing wrong
can I edit only 1 field of the embed, or do I have to edit the whole embed, in DJS
I've never really worked too much with message editing, and especially not embed editing.
discord offers no support to edit a single property of an embed
so yes you will have to reconstruct the entire embed
ok then,
i suggest having helper methods for something like this cause less effort in the longrun
But I'd suppose I would be able to fetch the embed from the message id
Anyone here know a lot about heroku and Dyno sleeping? If I have a randomInterval function running every 20 sec, does it use Dyno hours?
correct, aprixia
I suppose, editing a field from that would be difficult, so the closest thing I could do would be to copy the information, information which however I already have in my database in the object including the message id, hence it making it easier to construct a new embed.
Hey!
So I'm trying to make roster for discord server and I don't know how. I need that it will be like this:
https://i.stack.imgur.com/1gr8B.png (I can't post images sorry)
Please someone help me with this.
bruh
I'm new to coding. I really need help with this.
:)
thanks
do you think i should migrate my bot's database to mongodb?
I was undecided
i switched to mongo
and now i switched back to json
lmao
i prefer json because of its simplicity - but ima need a lot of files to make it scalable
im doing 1 file per guild
my friends say mongo.db
Json is not a database and should not be used as one
Json is good to be used for static data
Many people uses MongoDB here and that should be used as a database
json is great for starting out, especially if you're new to databases and/or making a new bot, but going long term your best bet would be to use a database
(I didn't say it was a database)
you stated that its great if you are new to databases
and making a new bot
so I assumed json files
anyways let me rephrase that, if you only need to keep mostly long-term persistent data that doesn't need to be updated regularly, you could use json files
like server configs
bad experience using mongodb on either c# or java using default drivers
i got it to work somehow lol
There are other databases not just mongo
like fuckin sql
lmao
but
json is good for static data
it is not good for adding/changing/removing data constantly as that can make it corrupted
especially if you don't use it correctly
its not going to get corrupted smh
and it is scalable, you just need to separate it into many files so you can keep them under 4MB
1 file per guild or user in my case
dont need a database lmao
@earnest phoenix can you please tell Rigi why its not a good idea
seperate files does not even make it scalable either
it just makes a mess
@unique nimbus how about you just let me write my DB however tf I want and back off
You know nothing about my code
how about 
Blocking someone because you don't want an opinion you don't want is laughable
nmp
I'm ready
Blocking someone because you don't want an opinion you don't want is laughable
^
mmmmmm
i just cause a arguement- sorry-
its not your fault
If you want to use a database
you mongo
json is not used for a database
its good for fixed data
its also fine to shut the fuck up
when the requests gets bigger
it will corrupt
I know this
as a fact
I did the same thing as you
then oh no
my data is unrecoverable
so please listen @earnest phoenix use a proper database like mongodb
sql, sqlite etc etc
"my data is unrecoverable"
i have 20 backups
and im not doing multiprocessed opening of the same file bs
neither did I
My json got corrupted
Trust me
i have 20 backups
real db -> 1 backup max required, since they corrupt like in 1:82727828282882828828282882 or just something awful happens
o-ok
^
Normal mongo?
I use mongoose for js as its more simple than the official one imo
what's good mongodb driver for java?
default?
why it says embed is not defined
I'm not even going to answer that
the embed is inside the else statement
while message.channel.send is outside it
sooo
@wheat hornet v12 or v11?
idk man i got mongodb from github education, that's why i use it
srry my bad the bracket was fucking
v11: message.channel.send({embed})
v12: message.channel.send(embed)
in v11, <m>#<c>#send(embed) worked sometimes, and sometimes not :D
v12 use a plain object lol
simpler
message.channel.send({
embed: {
color: 0xFF00FF,
title: "This is easy",
description: "Yayeet"
}
});```
yes and not eating ram/cpu power for creating embeds ^
and it works in v11 as well ^
I'd say speed isn't a factor here use whichever you find easier to read / use
I use it
function emded(a, b, c) {
var _embed = new Discord.MessageEmbed()
.setColor('#fffffff')
.SetTitle(`${a}, ${b}, ${c}`)
return _embed
}
message.channel.send(await embed(1, 2, 3))
I need to recreate embed with different values several times
v11: message.channel.send({embed})
v12: message.channel.send(embed)
Erm no?
They're both the same
Maybe I'm wrong
working on an avatar command but it keeps saying the image part of the embed does not have a well formed URL?
module.exports = {
name: 'avatar',
description: 'Responds either with the avatar of the mentioned user (or the command user if nobody is mentioned)',
aliases: [ 'pfp', 'profilepic', 'pic'],
usage: '[user mention]',
execute(client, message, args) {
if (!message.mentions.users.size) {
const avatarembed = new Discord.MessageEmbed()
.setImage(`${message.author.AvatarURL}`);
message.channel.send(avatarembed);
}
}
}```
same result
Are you sure?
yup
still same
your code is wrong
how so
if (!message.mentions.users.size) { why are u using this?
if you just want to show message author's avatar?
haven't added the rest yet
I'm going to have it send the mentioned users pfp's if there are any
but
I wanted to get the embed out of the way first
and it's not working
lol

cause apparently a URL isn't a valid url 😛
yes, undefined is not a valid URL
and it's avatarURL() but you should use displayAvatarURL() so that it works with people with no profile pictures
.setImage(message.author.displayAvatarURL({ format: 'png' }));
you're on v11, he's on v12
png is recommended
if you use jpg you might as well use webp, the default format
(imho)
he sent it
o
I m using this code to create role but it is not making as the admin thinks text named role is created what to do?
const fs = require("fs");
exports.run = (client, message, args) => {
if (!args[1]) return message.reply("Please add a message");
let text = args.slice(1).join(" ");
message.channel.send(text);
};
exports.help = {
name: "createrole"
};
exports.run = (client, message, args) => {
if (!args[1]) return message.reply("Please add the name of the role");
let text = args.slice(1).join(" ");
const role = message.guild.createRole({
name: "text",
color: "RANDOM",
permissions:[]
})
}
exports.help = {
name: "createrole"
};```
not role named by his message
Anyone?
V11?
:D?
?
And why u using twice run?
wt
that arg one?
it's just not even responding now... not even giving errors
I'd like to do spoonfeed, but i won't xd
got it
you really need to rewrite your code
:/
can u tell me what to do
i want my code to make it named by The command author
but it is making text named role
Anyone?
Is it a good time to connect to mongoose before an oauth req or after?
Hello, can someone help me understand how to install and run darkbot ?
What
I'm trying to run darkbot and I'm extracting the files like it says but anything beyond that I can't seem to figure out on my own.
How do I find shit from my mongodb?
I'm doing this in a separate workspace from my bot btw^
by finding
I'm trying to run darkbot and I'm extracting the files like it says but anything beyond that I can't seem to figure out on my own.
@prisma frigate ah, we don’t provide support for running code
How find
aren't you using mongoose? if so, you can use model.findOne(filter)or model.find() for all
Can someone help me with webhooks?
const dbl = new DBL('secret', { webhookPort: 5000, webhookAuth: 'secret' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
//Logs:
//Webhook running at http://0.0.0.0:5000/dblwebhook
But this doesn't seem right..
it’s actually hardcoded into dblapi.js
dbl.webhook.on('vote', vote => {
let channelGeneral = client.channels.cache.find(channel => channel.id === "378181731867688962");
channelGeneral.send(`<@${vote.user}> has voter for ZooBot!`)
});
It also doesn't send the vote..
Bc the webhook is wrong I think
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
This is the official example on https://top.gg/api/docs#jslib
Spice up your Discord experience with our diverse range of Discord bots
okay so my webhook is okay?
dbl.webhook.on('vote', vote => {
let channelGeneral = client.channels.cache.find(channel => channel.id === "378181731867688962");
channelGeneral.send(`<@${vote.user}> has voter for ZooBot!`)
});
This still doesn't work.
try getting channel instead of finding it
yes
I really don't know
that’s not the webhook link
Hello, guys! I have a quick question, how can the bot count the total messages that was sent in a specific server?
it’s generally http://your.vps.ip.address:port/dblwebhook no / before port
@feral aspen You can loop over message.channel.messages.cache, i've never tested this before though so this method isn't guaranteed
I am trying to modify a object inside of an array inside of an object in mongo, and I log the result both before and after and show that it's saved, but the values doesn't update within the object I am modifying.
the path is just res.modCases[/*num*/]
@feral aspen You can loop over message.channel.messages.cache, i've never tested this before though so this method isn't guaranteed
@slow fable How is that?
Ofcourse it does require databases or stuff
Nope
let index = res.modCases.indexOf(modCase);
console.log(index)
res.modCases[index].reason = reason;
console.log(res.modCases[index])
utils.saveDB(res).catch(err => console.error(err));
Oh you were saying in a server? Sorry i don't know how to do that.
Oh you were saying in a server? Sorry i don't know how to do that.
@slow fable Yea, in a server. 😛
Ok.
All in a server? lol
No
Like it will calculate the total messages that was sent in a specific server and save it into some file or something
It's ok
@feral aspen are you trying to get the total amount of messages in a server?
@feral aspen are you trying to get the total amount of messages in a server?
@summer acorn Yes.
Cannot read property 'forEach' of undefined
@silver dust Send code
screenshot.
okay
Hello, guys! I have a quick question, how can the bot count the total messages that was sent in a specific server?
@feral aspen
this is something that is theoretically possible but in practice impossible. you would have to spam GET messages endpoint until you hit the beginning of the channel for every single text channel in the guild. this can lead to an API ban or account termination.
TLDR; there isnt a way to do that
https://hastebin.com/ @silver dust
Oh jeez
@earnest phoenix why is there bots who does that
😛
Like giveaway bots or something
Try forEaching the channels, then fetch all the messages in each channel, then add their length up to a variable outside of the forEach @feral aspen
i doubt there are
i doubt there are
@earnest phoenix So.. why not consequences for them?
A bot like Boat Bot
some might track messages after they're added (due to receiving the event) however backtracking is practically impossible without being api banned
https://hastebin.com/kusokewipi.js
@silver dust
Frisky Tool Bot
which features
?
which exact feature is it that tracks messages like that
I actually don't know, but I see some servers sent messages having it track messages
and for the Boat bot
when you do a!server , it will send a statistics showing how many messages was sent
then it isn't backtracking, it's tracking new messages
in that server
then it isn't backtracking, it's tracking new messages
@earnest phoenix 😐 What's the difference.
@silver dust I am not an expert, but I don't think both reducing and forEaching an array is a thing, to be honest.
you receive MESSAGE_CREATE as long as you can see the channel
const $ = fn => {
const path = [];
const proxy = new Proxy(fn.bind(path), {
get: (obj, prop) => {
path.push(prop);
return proxy;
}
});
return proxy;
};
$(function(...args) {
console.log(args, this);
}).hello.world.and.proxy(1, 2, 3);
// [1, 2, 3] ["hello", "world", "and", "proxy"]```
mm lol
MESSAGE_CREATE does not occur for past messages which is why you need to GET them in the first place
you receive MESSAGE_CREATE as long as you can see the channel
@earnest phoenix Oh.
spamming that GET request leads to an automatic API ban, hit the ban more than once and you'll experience account termination
@earnest phoenix you could make it not be against rate limits by adding your own rate limits to it
huh??
oh you mean adding a delay between each request
how to make an Embed that will look like that
yeah but that can potentially take days to finish
for example, limiting it to 1/10 of what is maximum allowed
Yes, but still
That would give them what they want
how to make an Embed that will look like that
@stiff stream Bro, Brainstorm Please.
Didn't they say they would store the amount in a txt file?
¯\_(ツ)_/¯
but then again
they'd have to store the id instead
an array of message ids
so that it doesn't re-do a lot of them upon restart
you would have to account for bot downtime, then refetch messages again
it simply isn't reliable and you cannot do that
I know it isn't reliable, though message ids would be the most reliable method
if you simply want to count them, just store the delimiter id for each request
in a database or something
it will likely still take days
lol
I just realized, I had an issue myself
I am trying to modify a object inside of an array inside of an object in mongo, and I log the result both before and after and show that it's saved, but the values doesn't update within the object I am modifying.
https://cdn.discordapp.com/attachments/272764566411149314/737961797474189393/unknown.png
the path is just res.modCases[/*num*/]
this is the code I use
let index = res.modCases.indexOf(modCase);
console.log(index)
res.modCases[index].reason = reason;
console.log(res.modCases[index])
utils.saveDB(res).catch(err => console.error(err));
it dont show the icon instead it is sending the url help
they won't magically parse into images
so what should i do
or embed.setImage()
ok let me try
Thumbnail is generally cleaner imo
setImage is used in #starboard
it's meant for larger displays
thumbnail is a square
erroir
https://discordapp.com/channels/264445053596991498/272764566411149314/737966787924197467 here is the object inside of the mongodb compass right now as well
gotta be discord cdn, I believe, @wheat hornet
@summer acorn how'd I find that without access to schema or models? Other people were kinda unclear
i dont know what the api they're using returns though so can't help with that
I mean through node
so can i fix this or no hope
well I mean like, splicing it works fine, but modifying the reason apparently wont save.
@wheat hornet probably... but we cant help if you dont give us more information
https://discordapp.com/channels/264445053596991498/272764566411149314/737968622852374599 I am still having this issue. here is the whole command https://hastebin.com/erinenufud.js
I don't get what to do, the logs says it's changed but then I go look at it in the mongodb compass or run the command again, and it's not changed.
the place where the issue is occurring, is line 49 to line 53
@mild flower you don't need async for that
do what, a custom prefix?
yes
for what
?
I suggest first learning how to work with databases.
do you have any links from where i could learn about databases without async?
Once you learn that, the answer will become very clear to you.
also node.js has top-level await, means you DONT need to use async with async db's :DD
(in 14.6.0)
Depends on what you'll use. I use mongoose, which connects to mongodb.
The response you get with it is pretty much JSON
I don't even know if there is any mongoose guides
...
Their are tons of tuts on yt
it's extremely beginner friendly
literally just findOne and .save()
anyhow, I've been trying to get help with this issue for more than an hour, and it just keeps getting buried away https://discordapp.com/channels/264445053596991498/272764566411149314/737978019376791603
I tried this:
let sentMessage = message.reply("x");
setTimeout(function(){
sentMessage.edit("e");
});
But it is throwing the error:
TypeError: sentMessage.edit is not a function
Help
message.reply().then(msg => {})
ok thx
you can't use let, var, or const to get a message object when sending
because it's possible
or let m = await <m>#reply(pars)
and then m#edit(pars)
edit() is a method, not a value
she's talking to me
I said that to code
I eat gapples
what's wrong ?
let prefix = db.get(prefix.${message.guild.id})
Template string
what?
I mean, that's the only place I've found it work
[${}]
<m>#<g>#id is string
no, john
?
that doesnt work
inb4 they create prefix_<id> collections
let prefix = db.get(prefix[message.guild.id])
~db.get(`prefix.${message.guild.id}`) yes spoonfeed sorry :((`
like this ?
that is better, john
that is how you find a value in a object by using a variable
remember it
Object[variable]
thx
anyhow, this got buried a fourth or fifth time https://discordapp.com/channels/264445053596991498/272764566411149314/737979752203288587
I really need to solve that issue
Breathes in CLIENT MODS
@viral iris the prefix isn't stored for the guild
so i want a message to auto-edit every 5 seconds to display the new position in the song (its for music), but i dont know how to handle what happens when the message is deleted aka when the song ends. any idea?
https://discordapp.com/channels/264445053596991498/272764566411149314/737966787924197467 here is the object inside of the mongodb compass right now as well
@summer acorn
@viral iris these are your problems:
there is no template string so ${message.guild.id} is not stored as 457384563859 smth so it is global
there is no key defined so it returns nothing
just getting the message
if you are doing this let prefix = db.get(prefix[message.guild.id]) this is wrong lol
if(prefix === null)prefix = "-";
I am trying to modify a object inside of an array inside of an object in mongo, and I log the result both before and after and show that it's saved, but the values doesn't update within the object I am modifying.
https://cdn.discordapp.com/attachments/272764566411149314/737961797474189393/unknown.png
the path is justres.modCases[/*num*/]
this is the code I uselet index = res.modCases.indexOf(modCase); console.log(index) res.modCases[index].reason = reason; console.log(res.modCases[index]) utils.saveDB(res).catch(err => console.error(err)); ```@summer acorn
@tight plinth You could rely on the messageDelete event to check if the message was deleted
That only checks cached messages
...or even fetch the message in the interval?
i tried to do try/catch but it doesnt seems to work
dont compare with null, just check if its falsey if(!prefix)
what arev you tryna do?
if(prefix === null)prefix = "-";
@viral iris bruh then the prefix will get yeeted when your bot goes offline and it is global so it doesn't apply to a single server
read the docs
but why not i'll try
i tried to do try/catch but it doesnt seems to work
@tight plinth what are u tryna do
its to display song position over time
so i want a message to auto-edit every 5 seconds to display the new position in the song (its for music), but i dont know how to handle what happens when the message is deleted aka when the song ends. any idea?
@tight plinth you use lavalink so you can do it when player.on("end")
so
That might not be a good idea though
trim the song into clips of 5 seconds
@tight plinth you could kill the interval
it will destroy the music quality tho but use an insanely fast vps
there is a method for that
whats the method
idk
hold on
and that's spoonfeeding
and that's spoonfeeding
@earnest phoenix no
just link the docs
clearInterval(intervalname)
hm k
also should i add music commands to my bot which has average ping times of 2 ms
I used it in my osu! bot
var timer = setTimeout(() => {
try {
this.code(lobby, queue, null, channel);
} catch (error) {
console.error(error);
}
}, 120000);
lobby.on("beatmapid", beatmap => {
clearTimeout(timer);
something like this @tight plinth
wtf
but interval
k
how can i make a blacklist command on my bot
when does quick.db ever work
good point tim
quick.db is good but not scalable, you should use mongo db or proper sql they are much more scalable. There are wrappers for mongo that make it like quick.db, I have made one and so have many other people.
@golden condor any solution for my issue?
I have never seen that before
ah
But can you show your code?
(sorry if you already did, I didn't see it)
@summer acorn so im trying to do your method but the try/catch dont seems to work, the "404 message not found" triggers before the catch can do smth
oh wait i have an idea
@tight plinth that code was just a direct copy from my osu! bot
what is utils.saveDB ?
it doesn't work like that for discord bots the way you want it to
hm
uh ok hold on I'll send my functions file
i have an idea
Also, that may be API abuse
You can do this instead:
https://corynth.is-inside.me/cuFwIMS1.png (don't question the videos I typed test and random text)
quick.db is good but not scalable, you should use mongo db or proper sql they are much more scalable. There are wrappers for mongo that make it like quick.db, I have made one and so have many other people.
i use quick.db because i store everything on a single machine
Mongo would be better as you can use it across multiple machins
yes
wdym discord uses it too i've never seen "Checking your browser" messages
yes they are optional
That is under attack mode.
@summer acorn You never do newDB.save() which you have to do
nvm
Mongo would be better as you can use it across multiple machins
@golden condor what if you use repl.it because you don't have any money to do that technical stufffffffffff
||or because you're lazy||
MongoDB clusters my friend
as on repl, you risk data getting lost when storing it directly
why not use mongoose's built in functions? This just over complicates things
i make 100 backups
on 100 code hosting services
including github with the code archiver program
well, remember you only have 512 mb
A backup of my discord bot Codeco. discord.gg/NZYPF23. bit.ly/InviteCodecoBot - code913/codeco-backup-repo
and @golden condor because secure functions are good
well, remember you only have 512 mb
||yes||
that's the most formatting you can do
on a single piece of shit text
wrong
did you... just make your entire bot's database public?
you forgot crossover
did you... just make your entire bot's database public?
i store the userIDS so no witchhunting and i'm gonna encrypt the files before uploading them
but still.. not a good idea
also
uhh one file bot
potato
const http = require("http");
setInterval(() => {
http.get(`http://codecodiscordbot.glitch.me/`);
}, 280000);```This'll get ur project banned.
uhh one file bot
because YES
const http = require("http");
setInterval(() => {
http.get(`http://codecodiscordbot.glitch.me/`);
}, 280000);```This'll get ur project banned.
oh yeah lol i forgot to remove it when i moved from glitch to repl.it
use LOC instead
Anyway I'm gonna go code my own database
i still want to figure out what lib to use for a bot in C#. Discord.net or Csharp+
There's also Disqord iirc
also i'm deleting every single comment in my files so noobs can't steal my source ||makes bot source intentionally public||
there is a small YT Tutorial series that uses Csharp+ and for now it looks pretty much braindead to use. like compared to JS its so easy to use
lol if you want to be evil just make it buggy AF
ty guys, it worked❤️
how do i check if the person has their dms open or not
try {
message.author.send("the stuff you wanna send");
} catch (err){
message.reply("you don't have your dms open :/");
}
is my statement correct?
warned.send(Ewarn).catch(() => message.reply("Dms closed!"));this correct?
show your code
we don't know what those variables do
i know
what they do
and its correct
thank you anyways
and its correct
i meant the variables

so why you asking us if you know what you're doing is correct
PS a gapple didn't tell you to https://tryitands.ee
@golden condor
he's a potato
what do u mean export mongodb?
What I did, was I used compass
wait why second ping
export the contents
eh
collections
And exported it to json
i just said the variables are correct
Copy pasted the content
yeah, compass
And the put it into my db
how am i meant to copy paste it
me?
Lmao
yeah
are you have the retardness shadowblazer
@digital ibex what did i do
for backups as im stupid and i dont want to yeet a db again
nothing wrong with copy and pasting data
is it a good idea for me to use CryptoJS to encrypt my quick.db stuff and store the password in .env? it will slow down some stuff probably
it will slow down stuff since encrypting and decrypting takes some time
why do u wanna encrypt stuff @earnest phoenix ?
also you use a local db so no need for it
if you would use a external DB i would encrypt Names atleast
what do u need?
lol i did wrong this
why do u wanna encrypt stuff @earnest phoenix ?
@digital ibex i made my bot code open source and licensed it under the MIT license and the json.sqlite file of quick.db is included in it...
What is a gitignore and what does it do
Also hi lost how long did it take for your LOC acc to be made?
@pure lion .gitignore prevents it from cloning specific files when someone git clones your repo
gitignore ignores specified files to be uploaded in github
all it does is not allow you to commit the file/folders to the repo
ok
pathetic people
of course
i added it because gh desktop kept trying to push it to my dashboard
u can create one on the hosting site that u will use
hosting site?
@pure lion oh. i thought i answered, ask there not here pls :)
glitch isnt a host tho
my hosting provider is localhost 
yeah but people use it like one
yeah
Heya.
I have a question:
If i try to do that: ```js
model.updateOne({'id' : userID}, {$set: {'url' : url}})
I get this error:
(node:3184) UnhandledPromiseRejectionWarning: Error: cyclic dependency detected
But if i do anything else it works completely fine
If i try to set f.e. the Name it works fine
so it seems that this setInterval stops working after like 10 or 15 seconds, any idea why? https://lumap.is-inside.me/rv91sd04.png
Ratelimit i think
only executes once every 5 seconds so should be fine with ratemimits
try every 30
context: this edits the "now playing" message to display the timestamp of the song (like 0:05/3:33)
so every 30 seconds would be too much
Lemme google sth
i'll try every 10
Wh-why do I have 2 pings?
Each 5 secs u can do 5 things on the server
Running the code for my bot on my PC seems to work fine but when I run it off my pi, all the event functions take hours to load. I'm guessing there's some sort of connection issue, any ideas?
shouldnt be a connection issue because its local, for the pi
not sure why thats happening, have you tried contacting your provider?
There is no error message, the code is this bit:
async def on_ready():
print("Bot is online")
# update_bm.start()```
It will work if I wait long enough. I'm hosting it on my Internet so that's why im guessing something is blocking the pi
All the other bot commands work too but anything defined as @bot.event doesn't fire
Show your full code
@sterile minnow same thing if i try to edit it every 10 seconds
It's 3k lines long, it's a full bot
single-file?
but there it inly edit once before stopping
You could just hastebin it 
my commits be like:
it's split into a few files but main is long anyway
Hmmm. Try 15 or sth
thats not helpful......
is it still a bad idea to put those stuff
put what stuff?
the stuff i just took a screenshot of
it stops editing it after ~10 seconds so i dont think it would help
||(just tryna not get warned for posting that here instead of #memes-and-media)||
I know it's definitely not an issue with the code since running the exact same code from my pc works fine
all the packages are on the right versions and all that too
phelp
when i run npm rebuild it gives a heckton of errors with quick.db but when i install everything individually no errors occur
smh
:SMH:
k so now it stops after 15 seconds for some reason
how can i check if a map is empty?
so restarting the bot enough times seemed to get it to connect in the end 
yo
this sounds very much spoonfeeding but
is there anyway i can encrypt the data before saving it in quick.db
with the password as the variable password
you dont need to encrypt it, you've already been told
why
my source is visible to everyone
and i have cross server robbing users of coins
and we told you what a gitignore does
add the file where it has sensitive data to the gitginore
i didn't upload it to github and added it to gitignore
what is better Quick.db or MongoDB ?
but the json.sqlite file is still visible on my repl.it
what is better Quick.db or MongoDB ?
quick.db for beginners and mongodb for advanced
use a .env, repl.it automatically hides the data from in that file who aren't the owner
theres no correlation between mongodb and quick.db apart from it ofc storing data, afaik
and mongodb is better im sure in everyones opinion
lemme try :
JSONSQLITE=json.sqlite
it doesnt work like that
this is my current .env file:
TOKEN=HEY
yes
it doesnt work like that
so
and underneath add ur other data
./json.sqlite
no..
idk whatever you're saying i have only one brain cell
this should be ur .env: ```
TOKEN= UR TOKEN
JSONSQLITE= PASSWORD OR SOMETHING
moyai
???
i said the .env file
ye
not json.sqilite
lmao @silent socket why are you in #General and muted when there is no one else
An easy solution to your problem would be to use a VPS, nobody would be able to access any files you've got on there unless you tell them the password. I don't think there's a way to hide files in repl (other than your .env file which is automatically hidden)
which it says google your problem
something
i wanna say it to someone
the imgur link
but i made my bot's code open source
/tenor google
why
because yes
It doesn't have to be on repl.it in order to be open source, you can use github / gitlab
what is better Quick.db or MongoDB ?
@earnest phoenix not a question. mongodb
use a gitignore
and i said i added a gitignore on my github repo but i can still see it on repl.it
@knotty steeple wdym it is not a question
what did i say about the .env file?



