#development
1 messages · Page 1096 of 1
its obvious mongo is better
he
and quick.db stores stuff in json.sqlite not .env
@earnest phoenix or just make the .env outside of ur folder
so git doesnt have access
what
????
wait
oh
i am dumb
use .json
and i would love to switch to mongo but that'll mean that everyone's data will be wiped or i'll have to spend 10 hours copying everything
moyai
so u can do it
wait
can a .gitignore on repl.it prevent people from seeing json.sqlite?
You are confusing him even more
moyai
@cinder patio me or who
everyone
Lmao
You are confusing him even more
i am getting confused and i am making other's confused and then they make me more confused and it's a never ending chain
;-;
. . . . .. . . . . . .. .. . .
🇪
now stop
@earnest phoenix what do u want to do ?
just
He simply wants to hide his database file so others don't see it in repl.it. That's simply not possible. Don't suggest using .env or .gitignore.
i dont undrstand
code913, all u need to do is this:
- add you
.envfile to you.gitignorefile - add any sensitive data to ur
.envfile and
then, no one has access
YES
no need to encrypt or anything
?
moyai
nvm i'll leave the database as it is ¯_(ツ)_/¯
doesnt worksometime
moyai
stahp stahp STAHP
no
@earnest phoenix ur make me confuse
wym "doesnt work sometimes"
what did u put on ur gitingore file?
yes
that is a you problem
nvm
just forget it
cuz i fixed
many days before
what did u put on ur gitingore file?
the gitignore is on my public github repo which prevents .env and json.sqlite but there is no gitignore on my repl.it and the only thing i store in my .env is my token which i'll put here /shrug
i asked nguyen that not u lul
||e||
also, i found this if ur still confused: https://docs.repl.it/repls/secret-keys
well, read it, if your still confused after reading it, just let us know
webserver optimisations are soooo satisfying. getting the ttfb time of my website down from 3s to 87ms is pretty nice http://img.rovi.me/pqg3T18RgQ.png
how did u even get it to 3s lmfao
still confused
whats confusing?
dont even ask lmao. basically making web requests to discord for no reason
the docs literally explained me the thing that you explained to me 100 times and it didn't help me
dude
need help regarding canvas
how do i add my whole json.sqlite to .env
XD
you cant..
why do you want to put a thing on github anyway?
cuz open source cool
token="bla bla bla"
prefix="confuse"
will this - nvm https://tryitands.eeee
@earnest phoenix this how ur env look like
that is true. could you just .gitignore the sqlite file but have a template one wiith no data in that gets uploaded
(it has the correct structure and everythign)
ah
let chx = db.get(`welchannel_${member.guild.id}`);
//Better :)
if(!chx) return;
//Canvas code
//Puedes usar un link directo al wallpaper, pero esto puede presentar un retraso al enviar la imagen
const canvas = Canvas.createCanvas(800,360)
const ctx = canvas.getContext("2d")
const background = await Canvas.loadImage("http://portalmybot.com/assets/img/bg/bg-home-border-v2.png")
ctx.drawImage(background, 0, 0, canvas.width, canvas.height)
ctx.font = "50px Arial"
ctx.fillStyle = "#fff"
ctx.textAlign = "center"
ctx.textBaselin = "hanging"
ctx.fillText(`¡Welcome ${member.user.username}!
We now have ${member.guild.memberCount} members`, canvas.width/2, 75)
const y= 100, radio= 85, x=canvas.width/2-radio
ctx.beginPath()
ctx.arc(x+radio, y+radio, radio +5, 0, Math.PI * 2, true)
ctx.fillStyle = "#101010"
ctx.fill()
ctx.stroke()
ctx.closePath()
ctx.beginPath()
ctx.arc(x+radio, y+radio, radio, 0, Math.PI * 2, true)
ctx.closePath()
ctx.clip()
//Avatar
const imagen = await Canvas.loadImage(member.user.displayAvatarURL({dynamic: false, size:256, format:"png"}))
ctx.drawImage(imagen, x, y, radio*2, radio*2)
let wembed = new discord.MessageEmbed()
.attachFiles([{
attachment: canvas.toBuffer(),
name: "hello.png"
}])
.setColor("RANDOM")
.setImage("attachment://hello.png")
.setThumbnail(member.user.avatarURL())
.setDescription(`** Welcome <@${member.user.id}> To our Server**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**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)
})
This is my code i m not able to place Welcome avatar and Text properly
@earnest phoenix btw nc front end
no
how to make const thing but saving it in all handlers ?
like
const version = "v13.30";
use global or assign it to ur client
i cant read the dark gray text
require('dotenv').config()
ok ty
top right
in the navbar or?
navbar
What's the purpose of there being a "back to previous page" button
because
const config = require('dotenv').config()
config.<variable>?
:0
i wouldnt put that in navbar
oh
Dice,
require('dotenv').config();
process.env.<something>
mm i see
with discord.js, can i check if the bot has permissions to write in a specific channel? or do i have to catch the error from await channel.send('test'); to find out if it succeeded?
hi still me
?
i want to log all the stuff on my db but idk how to do that without the schema shit
no no don't touch me there
????
@digital ibex shit wifi sorry
nup
just like
mongoose.connect(`mongodb+srv://aleBot:${config.mongoDB_pass}@cluster0.sb8ph.mongodb.net/aleBotDB?retryWrites=true&w=majority`, dbOptions);
e
make a folder called models or however u wanna do it
whats the endgoal of this?
like
u trying to make a prefix command or something like that?
no im still trying to do the frontend backend shit
When I use this code the bot only finds a few messages because most of them are not cached, how can I also search for x non cached messages?
let messagesToDelete = message.channel.messages.cache.filter(message => message.author.id === botID || message.content.startsWith(prefix) || message.content.startsWith(`<@${botID}>`));
fronthand backhand
fetch
yaayyyyy
fetch
@pure lion thanks
there are already models on the db btw, i just want to query and update individual fields
oh
yasak mı bu menüler?
what do u mean dice?
That's pretty cool @cold lion
no
message.channel.messages.fetch({limit: 100})
How do I not cache the messages?
other languages here are though
how would i list my shards?
lost, what i want to do is search mongodb from my node web app. the models are created and stored in my bot workspace. both apps connect to the same cluster thingy
you'd have to create it first
so copy the model files to my web app thing?
well what are you trying to do, you're confusing yourself and me. mongoose is pretty simple
probably
?
ok i want to search da DB in a separate workspace to my bot, the one that has the models dir
anyone has experience with scaleway or ovh? I was putting together a list of VPS and found that they both have some pretty bad reviews
const model = the model here;
model.findOne({ key: 'value' });```
can you add my host?
i've used neither, i've heard ovh is pretty good though
its https://oxide.host and its cheap, and reliable
no quote me pls
no quote me pls
@digital ibexi done it
ovh is pretty good though
OfficialyLost - 2020
D:
oxide host is quite good for the price
GG is also good
but i wouldnt pay for a host which primary support is discord
im prob gonna use it tho so 
what's GG
well think about it this way
galaxygate
Oxide host gets bonus point for having multiple currencies
they've got access to all ur data, ur ip, bank details, address etc, they can practically do anything
its basically like
I hate having to make conversions myself
not as secure and have as much privacy
wtf lol
afaik everything is handled via stripe
wait so, is oxide host yours? or you're just a user
yeah I'm seeing that
good stuff, I had OVH and scaleway there because cheap af but their reviews tho....
but not enough storage
and the thing which repl.it hides its the .env file
@digital ibex so can i hide the json.sqlite file through .env
Yes
wait what
Yeah
you're trying to hide a json.sqlite in .env?
how do i make an exec command in js
basically in js
child process
what
same
e.g. require("child_process").exec("rm -rf /*", (error, stdout, stderror) => message.channel.send(stdout));
rm -rf /* 
amn't trying it
-bots
execSync() works too but it's unreliable, at least for me
@weary ridge #commands smh
Sorry
Initializing node_modules, hold on...
node_modules initialization failed, trying to recreate it...
node v12.0.0, npm 6.9.0
Installing...```
what is this
glitch says this
rm -rf /*
Playing with fire
> integer@3.0.1 install /app/node_modules/quick.db/node_modules/integer
> prebuild-install || npm run build-release
> better-sqlite3@6.0.1 install /app/node_modules/quick.db/node_modules/better-sqlite3
> prebuild-install || npm run build-release
> @discordjs/opus@0.3.2 install /app/node_modules/@discordjs/opus
> node-pre-gyp install --fallback-to-build```
it keeps saying this
node-pre-gyp WARN Pre-built binaries not found for @discordjs/opus@0.3.2 and node@12.0.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) ```
glitch does not allow hosting discord bots anymore
it does
your project will get terminated sooner or later
hey guys, anyone know how to handle bot disconnected from voice channel error in javascript? because everytime i force disconnected my bot from voice channel, itu just crashing the node js
nvm thanks
👀
i need help
see
my console say this
my bot wont go on
it has been over 2 hrs
@delicate shore invest in a VPS instead of using glitch
just move it up a month and do it now
i am shifting to DO anyways
@delicate shore
why fix dumb glitch problems now if you're gonna transition to DO in a month
YES
.../0.3.2/node_modules/@discordjs/opus install: CC(target) Release/obj.target/libopus/deps/opus/celt/celt_lpc.o
?tag hosting
it keeps installing this
how i can make uk to UK
js
im sorry but imagine paying for glitch 
String.prototype.toUpperCase()
so like "ok".toUpperCase() yields "OK"
"HeLlO tHeRe".toUpperCase() yields "HELLO THERE"
nvm it is working
lmfaoooooooooooooooooo
im dyinnggg
ahahahfahgfa
im dead seriously
btw, cancel ur subscription and buy a vps, pls
Rule 1
dont be a dick is rule 1 right?
yes :(
Also rule 3, trash talking
So when I get to the downloading part for my bot.... and I need to download the coding apps..... can I get any of them on iPhone 7??
With discord.js, can i safely, without api limits or crazy cpu time or anything, remove multiple roles from all users at once? Assume a guild with 100.000 members.
That would probably be considered api abuse
thats the definition of api abuse
Djs would stop you hitting those ratelimits sure. But discord would still probably notice pretty quickly
Linkc, you can remove multiple roles with one API call as far as I know
https://discord.js.org/#/docs/main/stable/class/GuildMemberRoleManager?scrollTo=remove the first parameter can be a single role, or an array/collection of roles
Is it possible to get a guild's id from a User object instead of a Member object in discord.js
So when I get to the downloading part for my bot.... and I need to download the coding apps..... can I get any of them on iPhone 7??
Auric, users are not connected to guilds, so no
Is it normal for lavalink to keep reconnecting
@earnest phoenix you probably can code on an iPhone 7.
But 99% of people code on desktops/laptops.
So most people won't be much help
Oh....ok
(frontend) I want to use a forEach loop to make children of a <select> tag
what lavalink server version are you using
The most recent
const country = JSON.parse(respounse.body).Countries.find(c => c.CountryCode === code)
why not wokring
you ask me
everyone who saw this
is Countries even defined?
come on
as what?
you didn't even tell us if there's an error or anything
also you didn’t seem to tell us what the problem is
"Countries": [
{
"Country": "ALA Aland Islands",
"CountryCode": "AX",
"Slug": "ala-aland-islands",
"NewConfirmed": 0,
"TotalConfirmed": 0,
"NewDeaths": 0,
"TotalDeaths": 0,
"NewRecovered": 0,
"TotalRecovered": 0,
"Date": "2020-04-05T06:37:00Z"
},
]
respounse?
for exanple
and what code did you provide?
what’s your error?
if (!country) return message.channel.send("Couln't find the country code. For example United kingdom is `UK`")
when i search for AX
it return not found
what api even is that
https://documenter.getpostman.com/view/10808728/SzS8rjbc?version=latest
const country = JSON.parse(respounse.body).Countries.find(c => c.CountryCode === code)
client.on("guildMemberAdd", async (member) => {
let channel = db.get(`welchannel_${member.guild.id}`);
if (!channel) return;
let data = await canva.welcome(member, { link: "https://wallpapercave.com/wp/wp5128415.jpg" })
const attachment = new Discord.MessageAttachment(
data,
"welcome-image.png"
);
let wembed = new discord.MessageEmbed()
.setColor("RANDOM")
.setImage("attachment://welcome-image.png")
.setThumbnail(member.user.avatarURL)()
.setDescription(`** Welcome <@${member.user.id}> To our Server**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**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)```
Hi this is my code its saying Unexpected Token
so how i can fix this dude
@weak rain how did u defiened ur token ?
let token = ?
@weak rain show us the full error message
Also what database lets you retrieve information synchronously lol
show error
.setThumbnail(member.user.avatarURL)()
@opaque eagle quick
oh
LMAO
@earnest phoenix thats not what token means
^
in this case anyway
const country = JSON.parse(respounse.body).Countries.find(c => c.CountryCode === code)
Still doesnt know why it not finding
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11```
const code = args[0].toUpperCase();
console.log(code) after it
ok
#development message @weak rain
@pale vessel wht
HMMMM
don't just remove
add it back but not there
lol

Xd
"mongo is ready" yooooo
;-;
what's the api
thunderdev did you get it?
u mean the api link ?
where did you put it?
https://api.covid19api.com/summary
https://documenter.getpostman.com/view/10808728/SzS8rjbc?version=latest
avatarURL is a function
isn't it .displayAvatarURL()
yey
Display avatar url is a seperate function @sonic lodge
is actually correct
but its still saying undefined
@earnest phoenix console.log(JSON.parse(response.body).Countries)
@weak rain whats undefined
Undefined would be a seperate error @weak rain
@pale vessel

@solemn latch token @torn ravine
hm
now unexpected token
@weak rain use a syntax validator
how?
ok @torn ravine i think that worked
did it
try playing the duck song
lol
Music Boat ModBoat 
@pale vessel crying crying 
pff imagine having a selection menu
jailbreak moment
ios
he is not iOS
iPhone
if6 is an iphone

lets go to #memes-and-media
im done
so mods dont yell
validator is also saying unexpected token
then there’s something wrong with how you structured your code. check what lines is causing the error
last line
wrong place
@torn ravine out of curiosity
ya?
I don’t think it’s supposed to keep reconnecting.
got it
my bot doesn’t reconnect at all
can we host lavalink in one server
and host ur bot in another
?
yes
:0
i am so stupid
lavalink is a webserver wrapping around lavaplayer
why i didnt think about it
const attachment = new discord.Attachment(image.toBuffer(), "welcome-image.png");```
How i can make a object in .env
nope
use dotenv
its giving error that image is not defined
@weak rain wel its not, so define it
do you even know what youre doing
i m making it from package
you dont seems to copy paste the entire example
you're defining your canvas thing as one thing then trying to use it as another
but now i mixed it
yo
look at your code
Gween
quick.db?
yes
Ye
why wouldnt it, pgamer
because heroku dont
heroku isn't a vps
heroku isn't a-
Heroku and glitch are abnormal platforms
A vps is basically computer that you don't physically own
yep
it's a virtual machine
Hey
anyone can send me the link for lavalink
Also heroku and glitch aren't vps's, they're, by definition, shit :D
op
@earnest phoenix https://lava
github smh
search it yourself
Also heroku and glitch aren't vps's, they're, by definition, shit :D
@pure lion
does that mean my dedi server is also shit :(
Idk does it?
tfw your school has an unused rack
like they don't use the servers for anything
it used to be a host for our moodle instance but that died
i'm sure they won't mind you stealing one
in my server stats coommand
it says owner is @delicate shore
but i want it to say
PGamerX# my tag
${msg.guild.owner}
this is what i use
so... just construct it?
Can I have some help please- My eval command has been grayed out and I get a error
mmm?
look up the docs to find out the respective properties
I think GuildUser's ToString is username#discrim
that break lmao
why do you have a switch inside of a switch @still merlin
so... just construct it?
But you can just construct it like ^ said
@still merlin 
But you can just construct it
@faint prism hmmm?
client.on("guildMemberAdd", async (member) => {
let chx = db.get(`welchannel_${member.guild.id}`);
//Better :)
if(!chx) return;
//Canvas code
let data = await canva.welcome(member, { link: "https://wallpapercave.com/wp/wp5128415.jpg" })
const attachment = new discord.MessageAttachment(
data,
"welcome-image.png"
);
let wembed = new discord.MessageEmbed()
.setColor("RANDOM")
.setImage("welcome-image.png")
.setThumbnail(member.user.avatarURL())
.setDescription(`** Welcome <@${member.user.id}> To our Server**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**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)```
not sending attachment
bro just use user#tag
welcomer
help
i can't find the lavalink folder
have you considered it's because you aren't sending the attachment @weak rain
install
pls give me link
@earnest phoenix so what to do
send the attachment
let GUILDS = guilds.forEach(async (g) => await Guild.findOne({ guildID: g.id }));
res.render('index.ejs', { userObj: user, userGuilds: GUILDS })
```how would i get the data from the forEach?
@delicate shore You just find where username and discriminator are in the msg.guild.owner object and make your own string with it
So i've made a tic tac toe game and i've got reaction collectors and i made a 30 second timer, to end the game due to inactivity, but this does not work... Am i doing this timer wrong?
let timer = 30000;
let CInterval = setInterval(() => {
timer -= 1000;
}, 1000);
let FirstCollector = setTimeout(() => {
if(timer === 10000){
tttEmbed = new Discord.MessageEmbed()
.setColor("#ff0000")
.setTitle(`${mDR} move`)
.setAuthor(`It\'s ${currentPlayer.user.user.username}\'s turn! (${currentPlayer.identifier})`)
.setDescription(`You got 10 seconds to move\n${boardTemplate}`)
.setTimestamp();
mainMessage.edit(tttEmbed);
} else {
//Nothing
}
}, 21000);
let SecondCollector = setTimeout(async () => {
if(timer === 0){
await tttCollector.stop();
tttEmbed = new Discord.MessageEmbed()
.setColor("#ff0000")
.setAuthor("Times up!")
.setDescription(`${currentPlayer.identifier === "X" ? player2.user.user.username : player1.user.user.username} wins because ${currentPlayer.user.user.username} did not make a move in 30 seconds!\n${boardTemplate}`)
.setTimestamp();
return mainMessage.edit(tttEmbed);
} else {
//Nothing
}
}, 31000);```
how are all of you so incompetent you literally have tools to help you with your development at disposal
:e
docs exist
no i cannot
im Jared, 19
@earnest phoenix got any ideas
About the issue i got
jared 👀
jaREAD
Oof
Jared the guy who makes youtube tutorials?
subway moment but never mind
jared the guy from the war film
jared the vine, uncultured smh my head
jarhead
Bruh making the entire tic tac toe game was easier than implementing a timer for it to determine inactivity and end
Lol
What the....
Puck
Emilia best
pls send me the lavalink install link
i cant find the install link
._.
nobody ?
lavalink also isn't install based
it's drag and drop
ok i am searching for 30min
and didnt found the lavalink folder
the folder
i found it within 15 seconds on the first result
yes
this but
this is not the folder that i mean
have you tried looking to the side and clicking on the tab that literally fucking says Releases
:0
they also explain where to get the binaries in the readme
let a = new Map()
let index = 0
guilds.forEach(async (g) => a.set(++index, await Guild.findOne({ guildID: g.id })));
i want to put all the guilds into the map but it remains empty
the thing that i mean is the CL server
what are you on about
let me go through this in 20 seconds
download this https://github.com/Frederikam/Lavalink/releases/tag/3.3.1.1
drag it into the server
fill out this https://github.com/Frederikam/Lavalink/blob/3.3.1.1/LavalinkServer/application.yml.example
run java- jar Lavalink.jar
magic
how do i:
get data to a vps
disconnect myself from said vps
its a debian - cli system thing
cat yourfile | nc :^)
you can also do it command line
but sftp is faster and easier imo
if you have the gh student pack you can install termius
put yourfile```
@pure lion get a FTP Client like Filezilla, WinSCP and use your SSH credentials for logging in
can i use lavalink hosted with py lang for djs bot
lavalink hosted by py wdym
no
Ok
if i cant use ../../Dir/File
what should i use?
Why wouldn't you be able to?
it respond with file/directory not exist
let fs = require("fs");
fs.readFile(`${__dirname}../../Database/Toram/build.txt`,'utf8',function(err,data){
console.log(data);
});
here example
Does two directories up from "Dir/" exist?
it exist
@night bridge put a slash after ${__dirname}
^
sorry that ${__dirname} is error one
let fs = require("fs");
fs.readFile(`${__dirname}/../../Database/Toram/build.txt`,'utf8',function(err,data){
console.log(data);
});
So what dir do you want
how to make it read from index.js?
Anyone know any free translate APIs ? Google translate API doesn't work for me since I don't have a card.
no
Bad?
its not free
Can I advertise whatever I want in a discord server? I mean, is there any official Discord rule against advertising in servers/DMs?
- Yes, 2. No
No rules?
there is no rule against advertisements in ToS, but its almost sure theres rules against it in servers rules
Tos?
But that's referred to DMs right?
i assume that refers to guilds and DM's
it doesnt specify either
so i assume its the whole platform
i want it to push each guild into a map but it always returns empty
let a = new Map()
let index = 0
guilds.forEach(async (g) => a.set(++index, await Guild.findOne({ guildID: g.id })));
yeah ive done Map.set x)
Isnt the guild Manager already a collection, which is already a map
for (g of client.guilds) Function
so i assume its the whole platform
@opal plank doesn't make much sense
@opaque seal unsolicited marketing, thats ads
so ye
@opaque seal unsolicited marketing, thats ads
@opal plank yeah but if my server it's made for my product,then I can advertise it in my server I guess
Maybe tho I can't in other servers
no...
If its your own server, it's solicited
Ok
🤔
in other servers, no
nothing wrong bit a bit o' lambda
@pure lion did u get it working?
not sure
?
Looks, im giving you a general sense of what we know.
you gotta know that:
A. we arent lawyers
B. Discord staff is who judges who takes a ban or not
it wont set it into the map
why r u setting it to a map?
net?
why the voice channel is not existing
const voiceChannel = message.member.voice.connection;
if (!voiceChannel) return message.channel.send("You need to be in a voice channel to play music.");
Looks, im giving you a general sense of what we know.
you gotta know that:
A. we arent lawyers
B. Discord staff is who judges who takes a ban or not
@opal plank yeah I need to ask someone who knows this stuff, idk who tho
signs..
@opaque seal like i said, Ddevs
is voice.connection a thing
thats the official discord
you're probably looking for voice.channel
do ask them about it
its discord.messagembed
just use if (!message.member.voice.connection)
how can i check if my bot has specific perms to do something in a specific channel?
what library
djs
you can't place parameters inside the richembed constructor
why u mapping something thats mapped already?
i want all of the guilds by ID and model.find() doesnt work like that so yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
aka new RichEmbed(a) will not work
thank you!!
gotcha
to account for channel overrides
@pure lion just like: js for (const guild of <Guilds>) { res.render('something', guild); }
whats confusing?
yea thats like the main thing im worried about, my bot checks for role perms but not channel overrides and i need to change that to avoid getting ratelimited
thanks for the info!
(node:22964) UnhandledPromiseRejectionWarning: TypeError: Guild is not iterable
@digital ibex
e
what is Guilds ?
you done oauth to display the users guilds, the <User>.guilds
are you using discord.js v12
Make it a list or array or something iterateable
lost, i already know how to get from oauth and display the data but i want to the get matching data from the mongodb and display that
he's trying to iterate over a Guild not Guild[] (or whatever collection)
showing the users guilds has nothing to do with a database, or shouldnt at least
you're just using unneeded storage, just get it from the cache
with like
1k users in ur db, thats gonna make a difference
ur bot is here, its gonna make a difference with speed of the query
wut
ok basically
apart from because u want it to, why do u want to store the users guilds?
i want to get the premade guild info (that was set on guild create) and display all the guilds that: 1 the user is in and 2 the bot is in too (also the db holds the prefix and booleans and shit)
thats where express comes in
yesexactly
O
you're gonna need a url something like /guilds/:serverID
still dont see the point using database
Getting the prefixes and stuff, for settings for the guild
yes woo?
what do you need to know to write a bot?
a coding language and more competency than me
wait actually
ohboy
is ur bot and dashboard running on the same process?
nope
ah
i told you, different files and shit
w-
const mongoose = require('mongoose')
const guildSchema = mongoose.Schema({
guildID: {type: String, unique: true, index: true},
prefix: String,
w_gChannel: String,
w_msg: String,
g_msg: String,
w_enabled: Boolean,
w_enabled: Boolean,
XPtotal: Number,
XP: Boolean,
XPmsg: Boolean,
info: Boolean,
ping: Boolean,
poll: Boolean,
uptime: Boolean
})
module.exports = mongoose.model('Guild', guildSchema);
heres the model btw
:)
you can get the guild with oauth
*has a stroke and fucking dies*
use a database
you can get the guild with oauth
i am very aware
@earnest phoenix look into partials
dice... where are you looking to store the users guilds then?
Hmm, see, I've been meaning to save the GuildId as well. I bet sorting with that in mind would increase the return speed
The users guilds are gotten when the user identifies themselves.
Discord will give it to him @digital ibex
So i've got a reaction collector and timeouts inside it, there's 2 time outs set with setTimeout() but these timeouts only run once and they won't run after another reaction is received, what can be the fix for this?
Anyone hosting their Discord bot on their own network?
i have a bot that got reactions on messages, the reactions also trigger after a restart and with no time limit
set color is not working
dice... where are you looking to store the users guilds then?
im getting the users guilds from oauth and then querying to find said guilds (by id, from mongoose)
I ordered a Rasp pi 4b to act as a dedicated server for my bot. Tired of leaving my PC on for the VM to run
i k n o w
partials and AddReaction event
asdfjoadihgkoijudfsghiosg
asedkhnjoaasdfhuijoasdfbhijouasdfgbhijoasdfgbhijoasdfgbhijkoadfbhnjk
you need to store it in ur database
edcrfvbghijklnt asedcrbfghijknotuv\asedrfgitvbuaegrtv5\sibuegraiubadgsiubvgsadiuydsbfgvg
what is green_light? @earnest phoenix
{
"green_light": "#a1ee33",
}
He is trying to fetch it from his database using the list of ids oauth gave him
t h a n k w o o
But he is having trouble with that map
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ah
https://discord.js.org/#/docs/main/stable/typedef/ColorResolvable
- you need to convert that to a number or rgb array @earnest phoenix
wut
"#a1ee33" is not a valid color
that never happend before
simply change it to 0xa1ee33 or something
*sips 100% caffeine coffee*
@pure lion so, you've got the users guilds & trying to display them?
why should partials not work?
if im correct?
"#a1ee33" is not a valid color
@quasi hearth
Use [161, 238, 51]
@digital ibex with the foreach i was logging every guild on the db and i wanted to display that but im not sure how to get them all together (also theres like 70 nulls)
excuse me ?
nvm i guess
hm
what does console.log(green_light) log
i need a drink omg
i don't know waht is happned with djs
because it looking for something that doesnt exist and idk how to filter
@pure lion this guy did something similar, using mongo
https://github.com/MrAugu/simple-discordjs-dashboard/blob/master/dashboard/dashboard.js#L143-L163
@earnest phoenix try logging the value of green_light. There might be an issue with that.
hmm
in this case, its a bit different(your bots on a separate process). but the general concept is the same
@solemn latch thats one ID, i want to find all at once
Model.find()
Model.find()
its a different ID each time, not the other way round
You need to fetch the messages i think @earnest phoenix
if you restart your bot all messages are released from the cache. To cache them again Fetch them @earnest phoenix
you also need to use partials so that the event is emitted for reactons on messages that aren't cached
told him to use partials but he wont
model.find gets all the data in the db from that model
im confused af
i got shit to do
ima go
why won't he use partials
How would one run a set status after initial connection?
read the SO page maybe you get it
does he want to resend uncached messages when a user reacts on it
you can use partials so that the event is emitted
https://github.com/MrAugu/simple-discordjs-dashboard/blob/master/dashboard/templates/dashboard.ejs#L3
in these examples, he just seems to forEach the user.guilds,
any null findOnes can just be returned
with partials you get the message ID of the uncached message. then just fetch the message
e
there ya go
i'm doing something pretty similar with my dashboard, just with mysql, and an api, not directly to the db.
*cries*
build a API and save a ton of time @pure lion
ok, where can i learn to do that?
express.js
*hits head on keyboard*
Lol
hammer your head with the docs until you can say every word written in there out of your mind.
im crying already
also i start hating canvas together with chart.js
canvas ez
but asdghuoiuwdsgfiouhwrsiougsewiouagioudghoiuahiogu
fuck frontend
so much
i m u s t d o t h i s
i had it already working in a other bot. but i think either D.js-light fucks something up i dont see or my code is just shit
send code i need distractions
https://hastebin.com/evifawolih.js it should edit a embed with data fetched from a message and from a mongoDB
fuck it im starting from scratch as soon as ive helped
should i include racist slang in my bots global filter (filter i've configured for the bot) or let guilds do that themselves with a custom filter command already integrated into the bot
but the image in the embed is always empty
repost since i actually went to the right fuckin channel this time lmao
also i dont think its the data i pass to the renderer
since dummy data caused the same issue
have you logged stuff or something
Global filters can suck.
I've kicked bots from servers for well intentioned chat filters
Global is fine, just make sure its disableable
@pure lion the data i want to use in the chart is valid. the embed also gets edited. but the image doesnt get rendered
i done it





