#development
1 messages · Page 1467 of 1
Lol
well redis is a Database designed to hold more or less temporary stuff
or might this be a better background?
i think that i like this one more.
more simple
poggers I got redis cache working for files
how do you do that?
I think that works better with the colors
How cache files :o
const { Router } = require('express');
const router = Router();
router.get('/files/:id', async (req, res) => {
const fileID = req.params.id;
if(fileID) {
const domain = req.domain;
let subdomain = req.subdomains.join(' ');
subdomain = subdomain ? subdomain : '@';
const databaseID = domain.subdomains[subdomain] + ':' + fileID;
const fileData = await req.app.server.models.FileModel.findOne({ id: databaseID });
if(fileData) {
await req.app.server.models.FileModel.updateOne(fileData, { 'stats.views': fileData.stats.views + 1 });
const redisFile = await process.f.redis.get('files.' + databaseID);
if(redisFile) {
res.end(Buffer.from(JSON.parse(redisFile)), 'binary');
} else {
const file = await req.app.server.storage.getFile(fileData.node.file_id, fileData.node.node_id);
await process.f.redis.set('files.' + databaseID, JSON.stringify(file));
res.end(file, 'binary');
}
return;
} else res.render('pages/error.ejs', { message: 'File Not Found', error: 404, user: undefined });
} else res.render('pages/error.ejs', { message: 'File Not Found', error: 404, user: undefined });
return;
});
module.exports = router;
oh god
const file = await req.app.server.storage.getFile(fileData.node.file_id, fileData.node.node_id);
await process.f.redis.set('files.' + databaseID, JSON.stringify(file));```
idk tbh
it works tho 
yep
If you don't know who does
That is tho
how can i put a background on the page?
CSS
im hosting the server on my pc but the files on my vps
"hosting the server" đ
nice ip mil
y I'm getting this error in typescript?
cache uses a lot of ram rigth?
Is that a good idea
only if you cache big files
Shouldn't you store your files somewhere else
or data
no im making node based storage for a reason lmfao
What if there were like three levels of storage
@rocky hearth
interface String<T> { // document extended functions here }
then fuck you @tawdry oracle because i was right
well in best case you just store keys in ram
yes files that are big will probably be stored in a tmp folder
Alerady did that. That's y I'm not getting red lines
but the rest will be cached
just remove the local storage to get probably better performance
yes 300ms better
But next level caching ;(
use different tiers of caching
How
use one SSD for longish term Caching and Ram for stuff that gets frequently used
Ooohh
this is how most servers do it.
Remote ssd?
local?
where
this is just local caching
I thought you just said not to use local
Why use an ssd or a hard drive when you can use a usb stick
Loll
just get a new one
Rip data
nah
so you want to send a new USB stick to your datacenter every 4 Months
second reload cached
yea
why not buy a SSD that will hold way longer
also cheaper within 4 years
I boot my laptop off a USB
Because memes
well Booting and using it as Storage is a difference
usb stick for the win
Everyone knows the fast read and write speed of usb
^
my NAS also Boots of a USB drive but uses HDDs for long term storage and a SSD for frequently used stuff
nah use a Tapedrive
what NAS do you have? or custom built?
ive took a random old PC ive had lying around and now it runs a OS for NAS systems
also got a 2nd proper nas ive decomissioned bcs its to slow
Does anybody know how to create the slash commands? I have been reading the documentation but I have no idea what to do.
loggers
@crimson vapor you know you can store images in mongo
thats dumb
How
GridFS
you can store images in Firebase đź
https://docs.mongodb.com/manual/core/gridfs/ @crimson vapor
I mean instead of storing it as a file
So..one if statement?
correct
Makes sense
it does indeed
lmao
my bot wasn't online when it was supposed to be
cause the leveling system was being fucky wucky
I never had issues with mine
lmao its not the leveling system itself technically
its the sql connection
but i just removed it
oh lmao
how big of a file is too big to cache?
strange
why did you use quick-db if you installed quick.db?
@mellow kelp how big is too big for caching files?
ima do 4mb
Hey, I'm trying to set up the webhook to show users that have voted for my server.
We have our own bot.
In order to do this, am I going to need to submit that bot also to top.gg? This isn't a public bot and solely used for our own server.
I think we need an auth code? I'm not quite sure, I'm no developer.
Any help would be appreciated
you should just be able to make a request to the api
its kinda easy
servers get keys?
Because I just want the webhook to show when people vote. Someone else codes our server's bot, not me. I'm just trying to find out what they need to make this happen
you would need a developer to make a web server for you
actually, it looks better if the featured bot does that
I don't want to fill the sever with yet more random bots, if I can help it.
We have our own bot, just trying to work out how we can do this.
well then hire a dev to make a web server for detecting votes
create a source at Pipedream
copy and paste the endpoint link in DBL
create an SSL event listener in the main bot file
code what you want to do when you receive a vote (the code has to identify if it's a vote or not)
and voilĂ
@outer perch Thankyou, I'll pass this on and see if we can work it out from there. :D
đđ»
I am stuck at around 63-68 servers, does anyone have any tips to grow?
idk what language you use. d.js doesnt got the support for it. for now
advertise on top.gg, gained my bot 100 guilds within a week
i know some people here also use ads on Facebook
What tags to you reccmond? My bot is pure economy
well good luck. economy tag is one of the Big boy tags.
I see
ive used warframe back then bcs my bot is mostly themed around the game
Any idea on when DJS will gain support?
when its ready -D.js Dev Team
there is a PR for that
K
hey peeps
i am trying to get a string from a map i made
let result = familymap.get(args)```
Wdym slash commands
i am tryin to use ars
but it won't work as i need to add ' '.
how would i implement that?
@celest schooner /cmd
enum CommandTypes {
SUB_COMMAND = 1,
SUB_COMMAND_GROUP = 2,
STRING = 3,
INTEGER = 4,
BOOLEAN = 5,
USER = 6,
CHANNEL = 7,
ROLE = 8,
}
```i have this enum because big brain
but
im not sure i completely understand how they work
when i do CommandTypes[bla] it throws a typerror
/cmd
anyone?
yes
Wait you can add those now?
yea
with difficulty
they're pretty much useless but they're a thing
how can i add '' to an existing args?
join(" ") doesnt work?
Krista are you making communist discord
CommandTypes.SUB_COMMAND
nvm i fixed it
what
not you lol
config.options.forEach(opt => opt.type = CommandTypes[opt.type])
```this is the kinda thing im trying to do
opt.type is a string
}
if (message.content.startsWith == `${prefix}oogkleur`){
let args = message.content.slice(prefix.length)
let result = familymap.get("'"+ args + "'")
message.channel.send(result)
}```why is my bot not showin results?
switch (tempVars("gg")) {
case fb: var t = "fenerbahce"; break;
case gs: var t = "galatasaray"; break;
}
this.storeValue(t, 1, 'yazı', cache);
can anyone help ?
what's the error?
and please use command block.
its give undefined
what gives undefined
its not work case text:
state out the whole error
whatâs familymap
just a map i made
oowh
!abc abc
so it actually takes abc abc
it would return abc abc instead abc
how would i trim that?
since your doing string.slice() rn
switch (tempVars("gg")) {
case fb: var t = "fenerbahce"; break;
case gs: var t = "galatasaray"; break;
}
this.storeValue(t, 1, 'yazı', cache);
I think you can split the message content with a space
and then remove the first element of the array
then the array would be args
and then you can do args.join(" ") for all of them
Thatâs what Iâm doing
you can also just slice the length of prefix + command + a space
Can someone help me with this error? for ts
yeah that's what would be best
Alr
I canât see sht srry
Iâm on my phone
but how would i slice the command?
.isLowerCase() isn't a string property
you'd need to botch that in yourself
But I've defined that. Look carefully
And I'm not getting any red lines in the editor
well you would need to know the command first
then get the length of oogkleur
yeah the size
itâs length for strings I think
Youâd also probably have to remove a space too
because args would return " abc"
just trim it
how can i get from an enum without calling a .
hey
how can i make my server get a custom invite code?
like discord
.gg
/Barnie
yea this
30 boosts
Oh
yeah
if (message.content.startsWith == `${prefix}oogkleur`){
let args = message.content.slice(10)
console.log(args)
let result = familymap.get("'"+ args + "'")
message.channel.send(result)
}```
uhhm logging args showed me absolutely nothin
it just didn't work and logged nothing.
What are you running
wdym?
like the command
maybe you should
const args = message.content.split(/ +/g)
which will split at every space
couldnât u also just .split(" ")
!oogkleur (name)
hmm
" " is fine but / +/g will account for multiple spaces
ahh smart
it's only usin 1 space
some people will be stupid
use \s+ if you want it to support other variant of spaces
who the heck would use other space
tabs?
flaz do you know how to get from enums without doing enum.prop
I donât think tabs work in discord
some languages use a different kind of space
I guess
they do
likeăthis
thicc
like you
anime pfps scare me
strange! My bot still doesn't log anything.
code?
if (message.content.startsWith == `${prefix}oogkleur`){
const args = message.content.split(/ +/g)
console.log(args)
let result = familymap.get("'"+ args + "'")
message.channel.send(result)
}```
haven't changed much
because it didn't trigger that if block
does it even log []
are you using that font
oh crap
not a text
I updated the code for my bot on heroku, but now my bot is offline... do yall know whats causing this?
did the code work
Yea the code was working fine
enum CommandTypes {
SUB_COMMAND = 1,
SUB_COMMAND_GROUP = 2,
STRING = 3,
INTEGER = 4,
BOOLEAN = 5,
USER = 6,
CHANNEL = 7,
ROLE = 8,
}
```Will CommandTypes.SUB_COMMAND return 1?
but the bot is offline
Iâve never used heroku srry
no
alr
top.gg only lists info and invite link
so itâs like a poster for a barber shop
sorry for botherin you guys so much but: js if (message.content.startsWith(`${prefix}oogkleur`)){ const args = message.content.split(/ +/g) console.log(args) const args2 = args[1] let result = familymap.get("'"+ args2 + "'") message.channel.send(result) } the message isn't being sent as its empty. Why tho?
it should return the name
even args2 is showin up with Bilal
how did you store stuff in the map?
why do i even answer?
you should you know, try more before asking
Sometimes it helps to just spell out the problem in front of you
yeah sorry guys!
Anyone know how i can auth the spotify api
How i can get the token
i got my client secret here but it doesn't works
@pale vessel can you help me?
Read their docs?
You will most likely need to send the secret in the Authorization header
at Client.<anonymous> (/home/container/index.js:42:53)
at Client.emit (events.js:326:22)
at WebSocketManager.triggerClientReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:433:17)
at WebSocketManager.checkShardsReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:417:10)
at WebSocketShard.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:199:14)
at WebSocketShard.emit (events.js:314:20)
at WebSocketShard.checkReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:467:12)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:439:16)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:125:16)
(node:13) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:13) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Api doesnt work
```dbl.postStats(client.guilds.size, client.shards.id, client.shards.total);``` someone?
bruh
your client probably doesn't have shards
remove the client.shards
https://cdn.discordapp.com/attachments/732072413969383447/789947428517576754/unknown.png
https://cdn.discordapp.com/attachments/732072413969383447/789947554635710514/unknown.png
(node:1277) UnhandledPromiseRejectionWarning: Error: ENOTDIR: not a directory, scandir './img/newplot.png' anyone know why this is happening?
You mean readFileSync()?
@pale vessel what scopes for spotify you use ?
readdirSync() reads a directory, returning an array of string
You can't set an image to an array
?
Client credentials iirc
ok
i want to check if an array doesnt have stuff:
if (!config.options.every(conf => conf.name) || !config.options.every(conf => conf.description) || !config.options.every(conf => conf.typeID))```
but it doesnt work
the stuff is there
you could also try array.some
Which ubuntu version on a vps would you guys prefer for bots?
the latest?
windows 9
Lmao
hey guys
I use centOs cus it's more Light Ubuntu is more for a pc in my opinion
is it possible to make a bot use a slash command
yeah
how
this was what i was trying to do
everytime this bot talks i use a slash command
const result = await fetch('https://accounts.spotify.com/api/token', {
method: "POST",
headers: {
'Content-Type': 'application/json',
'Authorization': `Basic ${btoa(process.env.spotifyId+":"+process.env.spotifySec)}`
},
body: 'grant_type=client_credentials'
});
I have done something like this but it is not working
[Symbol(Response internals)]: {
url: 'https://accounts.spotify.com/api/token',
status: 415,
statusText: 'Unsupported Media Type',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
af
ah
the application/json
can someone help me
add slash commands to my bot
lik e i just want one simple command
and i can expand from ther
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
well i should correct myself
i made a slash command
but its not connected to the server
does anyone have a simple slash command code
like for maybe
a ping command?
anyone đŠ
it is a new feature tho
Most libs don't have support for it
really?
yea ik that
theyre aren't any packages that package it
but how do u make it
raw code
hey so how do i make my bot direct message a member that just joined like i can make my bot direct message when someone asks him (aka using the prefix with command) and do something when someone jo0ins the server but i cannot mix both
like i think i maade one
You write it the same as any other code
but i can't connect it
its super hard but u can get there there is so litle info about it since its a new feature
It doesnt seem super hard đ€
its a bit
It seems rather straightforward to me
it isn't from what i see
well i only saw info on discord dev portal
but the connection i cannot understand
so it didnt help me
just use normal commands
but like i wanna understand dude
yea ik
u have to also add application.commands
i gave it that oauth
so when u invite the bot
yea i did
well i think i did
what are the requirements to add a bot?
this bot has acces to / commands
Add a bot to top.gg?
have a working help screen and some commands
yea
can someone help me now tyho?
tho*
only that?
oh, ez
Use the guildMemberAdd event or your libs equivalent
ik
but like dm the person
it cant
User.send()
help my bot does not send the welcome msg already activated intents
did u code it?
Use that websites api typically
yeah if its your website u have to do that api and then use it
its not my website so idk
this idea is so complex lol
How to get my bot on the website?
idek if its possible
u cant?
or u mean put a link where people can add him?
Yes
let myguild = await bot.guilds.cache.get("789603347849543681");
let canal = await bot.channels.cache.get("789603688837939210");
const embed = new Discord.MessageEmbed()
.setTitle(' - Welcome
(a)')
.addField(`Welcome to my support server! have fun with our community, read the rules to avoid severe punishments! Did you know you formed $ {member.memberCount}?`)
canal.send(embed)
})```
@earnest phoenix how to add it?
were are u hosting your website
google sites
or your own

or any other
?
I dont have one
then where are u thijking on add it
ohhhhhhh
Yah.

gg ez
ye
mafe?
idk
ye
Its for listing bots
I can't find where I can add it.
lmao
go to https://top.gg
yeah or that
@earnest phoenix what did you name the variable from the event?
please remove the embed
client.on('guildMemberAdd', () => {
user.send("message here");
});```
You need to define the variable in the event handler
But you just posted it
Your not defining a variable named user
and what do i define it for?
discord.js never asked me to define user
it wqas always alredy defined
It never is auto defined.
Its just typing user into the functions parameters ().
what I need to do here: Detailed description of your bot *
A description of at least 300 characters of what your bot does. HTML, CSS and Markdown allowed. Javascript will be removed.
write about your bot
honestly this is a pain
damn idk how to do this at all. someone pm me about this i need some serious help
ik
i was just dinering
Do what
whats the website
just tell me
what does this wbsite do?
(i will not click since it can be a virus)
its called a virtual stable for race horses. tells u there results, and all that. i want it to send me that stuff in a discord bot instead of notifactions to an email
me who already clicked it 
its not a virus i promise lmao i really need help with this lol
lol
just tell
me
but yea its not a virus
yes, but i need it to send notifications to discord instead of an email
i want it to take a certain horse i pick and upload that info for my other discord people in it
would anyone point me to example how to make multiple instances of the same bot to respond only once? i'm using discord.py
what the
i dont use discord.py
if u dont then dont answer with useless responses
so idk how to do this at all
yeah u right
btw why are u hgere lol
looking for help with smt smh
time
?
that wheel
your verified bot is on alredy how many servers? just asking
cool
btw can u go to ruffus server (on 4NG3L)?
bro this is #development
Thats not enough information to give you a definite answer, but there are several ways to approach it.
If you already receive emails, you could setup an email server that triggers webhooks to your bot. Alternatively, if the website requires logging in to access the information you want, you will need a headless browser such as pupeteer, cheerio or zombie.
Not much else we can say without looking at how the website works
isnt the point of a WEBHOOK
to hook info from the WEB
lol
nice
mice
oof
but i do have youtube search and play
when you would do +play never gonna give you up rick astley it would send the searches
like 8 times
so if you dont have a link to it you can just type the name
but mine is seperate lol
and then it gives a list
and then if you do ~play 2
itll play the second search results
mhm
still need to fix queue đ
i dont need damn cheerios i need a discord bot, idk wtf those 3 things were u said lol , but you do not need to login to access the information, you can get it directly off the website
Then you can scrape it, which page has the info you want?
the main page of the horse i want the info from https://www.equibase.com/profiles/Results.cfm?type=Horse&refno=10285652®istry=T&rbt=TB
?
but i have this vision and i need one made lmfao
Looks pretty straight forward
You will need to download the page and parse it as html
Have you ever done coding before?
none
so how about when things are live updated on the website ? will it still pull info then ?
i mean
i know its not, i would hire somebody lmao
u don't tech need to download it
if somebody made this for me, id definitely make it worth it, just pm
wait so WHEN the results happen
u want it to be sent?
wait thats more complicated than i thought now that i think abt it
yes in a discord chat page.
so say a horse does a workout, it will say this on the website
I only work for people who like paying, ive had my fair share of annoying clients who ask for a billion things then dont pay or pay almost nothing lul
lmao id like to pay, im an honest guy, no owrries with that
so when the horse trains, itll post the info like Track Date Course Distance Time Note Rank
i see
Laurel Park 11/15/2020 Dirt 3F 35.60 Handily 1/20
and i just need his info updated to my discord when it happens on the site
so idk shits way to complicated for me
the thing is
i might be able to do it
but youll need to host the bot
(basically just run an exe file)
for however long you'd want ur bot to be up
wanna come over & do it for me xd
what the hosting?
Come over?
well id want it to always be up id suppose xd
Yea come over?
yeah to my place lmfoa im joking
Also this channel isn't for hiring people
^
So you'll have to ask somewhere else
lmao okay ill go ask somewhere else
Im thinking about converting my whole bot to slash commands
But havent looked into them yet to see if its feasible
Limit is 25 commands I think
Thats plenty enough for me
My bottleneck is command complexity
You can literally use up all 2k chars in a single command if you want to
the real thing im looking at
is guild commands
that way i can custom make commands for my friend's servers
and maybe get a little $$ custom making commands for other servers
Hmmm
My bot can take more than 10 options per command
But 10 is a reasonable limit
I can work with it
10 choices per option is good too as long as it accepts free written choices
Because otherwise i have options with literally millions of choices
Nvm then lol
hmmm?
why did you take out leveling
Nah
and im gonna fix it
smh
in another script
rule numbe rone
before readding it
Sql for leveling would be so easy
it is
rule number one*
never use one database for everything
thats just stupid smh
it prob was mised space and stuff
i have atleast 4 databases lol
but it was bugging me
That's not even a thing
bruh i do too
You have too many databases
nah
4 databases?
Why not a single database lol
Can you name each one
yes
I really hope you mean tables
i have a database for warnings
And not databases
and a table for each guild
MoonSQL, ikigai.josn mongo.db and quick.db
I mean, if its different apps sure, but you dont need multiple dbs for a single app
easy
Wtf
If you're using MongoDB you don't need the other 3
Ik MoonSQL is yours, dunno why you would be using it tho
i use it for most of my bot tbh
So why use quick.db if you're using "MoonSQL"
Lol
Quick.db isn't a cache
mainly for the keys doe
What makes sense is a database and a cache
Ngl that sounds like a clusterfuck
No more
i manage it
Yes but it would be easier without
I just use sqlite flr everything
eh
Rule #1 always go for what's simpler
i might remove them all besides moonsql tbh
See that makes sense
https://hatebin.com/frniphvcpn events loader
https://hatebin.com/rqjkgvvhev ready.js
error TypeError: Cannot read property 'tag' of undefined
what am I doing wrong?
if anyone can help mention me
console.log(Luni)
user: ClientUser {
id: 'id Bot',
system: null,
locale: null,
flags: null,
username: 'Name Bot',
bot: true,
discriminator: '6495',
avatar: '079798043de15b2ffe157e96d292a808',
lastMessageID: null,
lastMessageChannelID: null,
verified: true,
mfaEnabled: true,
_typing: Map(0) {}
},```
i would add 3 more just to be save :3
but i like having 8 databases
i can see me saving a database in a database ina database smh
Idek know what that json thing is
really?
postgres ftw
Obviously, no DB is going to be slow
It's just that you want to go for what's fastest
i already spent a good part of 1 week
eh
Sql uses a table with columns and rows
debugging and transfering
It's not hard
if you try to edit a thing like that in sql you get disk malformed
Slow where lol, its fast af
it depends what u mean scale
i do not expect my bot to go to 10k-100k servers
if it does
ill adjust it then
It dpesnt scale well only when you need multiprocess and web support
web support?
idk
i should make a mute command
but i want it like how lucas is
where you go like
+mute reason | time
or something
Nothing is hard đ©
Well something is hard now đ
đ
help pls
this tbh
leveling should be easier
but has more corners that i need to check
and music i still don't have a good queue command đ
the leveling it selft isnt hard
but goddam thats a good leveling card
mine is way more simple
Remote access
đ€
@drifting wedge you still down for web development?
for wat?
im thinking about buying a domain for my bottums lol
ooo
make sure status is public
lmao
what do u need help in 0exe
ah i see
public static void main(String[] args){
should be ur header
@drifting wedge don't use vsc for Java lol
^^ use eclips
what are you trying to do?
Intellij better
just run it
print hello world
well
0exe
umm
replace ur header
why
Eclipse is poggers
it should
It does
cause of overloading
o
in java
But yes it should be java public static void main(String[] args){}
Because jvm needs to pass args to the main method
to know a lang, you need to be decent at it by the way
learnt python, doing js, cpp and java rn
The main method has to have the parameters.
I don't like when people say they know a bunch of languages then ask for help on simple things
errored
whats the error?
Hi, Does anyone know how to connect the top.gg site to discord so the bot can count if you vote for the bot there and thus give rewards etc?
java*

webhooks, #topgg-api
What ide?
vsc 
Ah
Don't use vsc for java
Where can i find the info on those @crimson vapor
use eclipse at worse
?
#topgg-api can help
0Exe it still didnt work
ok thank u
??
Intellij is the best for java
Either one works
does what it needs to
Dis u write exactly public static void main(String[] args)?
But not vsc
even after u changed it didn't work ? @drifting wedge
Like, EXACTLY like that
and html and css im iffy
no lang wars today
html isnt really a lang tho
I know J's, java, c#, and some cpp, and rust 
Html is technically is a language. It's considered a scripting language
lmao all I know is basic js
@drifting wedge dms?
scripting language isn't really a language
fight me
I mean esolang shouldn't exist but it does
scratch best language
That's awesome, I'd love to be able to learn that in school. Unfortunately my teacher is teaching FLASH next year :\
fuck you
Flash?
wait what
How are u even going to test flash?
flash dies in like 1 month
Uh huh
Like, browsers don't even run it anymore
You can see why I'd be mad now
Lol
flash is a dead language like latin


