#development
1 messages ¡ Page 1759 of 1
u can probably do something like that
thats the closest you'll get without crating something from scratch
There's a npm lib called discord-archive or something like that
Imagine being stalked by Germans... Germans! 
Depends on usage
Again, depends on usage. Your bot may be in couple hundred servers, but it depends on how many of those servers are using the bot
And if it has a cuing system or not
and most of all, it depends how many of them are actually listening to music, and how much audio is your library buffering
hey there, do you know what it is with discord.py?
or does one have to wait an estimated 5 months for intent 
really? mine have never been too laggy
What đ
apparently estimated intents wait time is 5 months or so I hear
For verified bots?
yep
ah so no workaround
or does one have to wait an estimated 5 months for intent
You can already use intents with discord.py
Are you referring to Discord's verification process?
Nah
no the bot is already verified, therein lies the issue it seems because we need members intent
Yeah u need to reach out to Discord and it seems that the wait is very long đ
ur name sounds fake ngl
yea is crazy, thanks for the help though
I shall come back in 5 months 
and yes i make the funniest jokes in the universe
Yeah no worries and good luck
Hmm this isn't racism... so maybe 'namecism' ? 
I'm just confused since discord.py documents and has it
yeah but discord needs to give permission for verified bots it appears for you to be able to use intents
yeah
You sure it's that long or did something happened
is what I heard since discord hasn't responded after 4-5 weeks even upon further enquiry
I tried that now, 2 hours later ._., but didn't work
Oof
Not an expert in html, but have you tried <li> or using the nav-bar class and identifing them as nav-item?
yeah <li> is the thing i use for this
I already have a navbar and idrk how it works, since null made it
I think there might be something else let me get it rq
<dl> and <dd> I believe it is?
Maybe that might work.
I mean it's on repl, i could just simply send you an invite so you can take a look at the code
(<dl> and <dd> didn't work either)
Hey i want to start a project soon and need an bot dev who knows how to setup and code a bot im new and want to learn and need someone who can help me to create and make an stats bot đ
What do you mean a "stats bot"?
you know like game stats or social media stats
Ah, I sadly don't know how to code those :c
np
I wanna start with coding bots
and learn
mby making an nice bot cuz i got a nice idea wich could be get famous

If anybody can teach me how to code bots pls dm me and if needed i can pay for you
2 things i should cut out right away, for your own good.
- i would highly disencourage you to make bots with the intent of getting famous OR getting paid
- while you shouldnt ask for coaches here, even if you were allowed to, this would be a very bad place to ask for hlep regarding that.
You should code a bot "just because". Wanna learn? amazing, go for it, we'll help you if u get stuck somewhere. Bored and wanna work on a project? sure, bots can be fun to make. But i would not recommend going with the mentality of fame or money for bots at all, that will only lead to dissapointment
i would recommend reading the guides we usually share here instead of hiring someone
Well said
being a dev requires you "to have your own 2 legs", meaning, you need to learn how to handle yourself, otherwise you're gonna be dependant for a long time on other devs to solve problems for you
H
would recommend picking one of those.
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
Bots are not built as profitable endeavors
thanks @crimson vapor
Ups
So itâs not a great idea to build one with profit in mind

nor fame, specially if you got for multi purpose or music bots
focus on an area that there arent many or any bots , and work on that area
be specific, target a specific audience
go for music and you'll be crushed, for example, rythm with 17 MILLION servers
same for moderation like mee6 with 15 million
TLDR: go in areas without competition if you have a hint of desire to have your bot grow
wdym?
idk, they were thanking random people, thought i'd join in it too
#development message edited
they pinged the 7sukoyomi guy
Can someone help me with this? The Bot works perfectly fine when i run it through VS Code but when i run it here it gives me this error
Can you show us your directory
My bots main.js?
you need to know this
The error?
you need to share your code
Is the config file json?
Um. Why js and not json?
Why not js?
because both work lol
Show how you include the config file. It probably has something to do with that
Show me where you import / require the file
Where is this file located?
main.js
I donât see why this wouldnât work without testing and Iâm on my phone rn. Hopefully someone else knows.
Hmm
I normally donât use configs this way. You can take a look at the NPM package âdotenvâ. I use that and a lot of other developers do aswell.
Hmm
When are you saving it to mongodb?
they aren't
oooh, it wasn't saving on mongo
xd, i don't remember to save
Sorry for the inconvenience
Am I allowed to add something like this to the help menu? it will show only in the testing server 
I think repl.it has a feature for storing databases (not directly in your project).
Of course, you can use external hosts to write to your database, but you probably wouldn't be on repl.it otherwise
i can't install it
to install pm2 you need to install nodejs
nodejs has a list of ways to install based on operating system
i mean
screen is preinstalled on DO machines
why not just use that
and save your resources while you're at it
Didnât we discuss that already?
Or just a service to make sure the app is still running after a crash or reboot
hi, i am using digital ocean to host a discord.py bot
so i used tmux to run it after connecting to the droplit
it was working fine i assume
then i wanted to upload new changes to the files
so i deleted the session from tmux and made a new one
but now it only runs some files from the cogs
and completely ignore the others
I
if someone knows abt db, is it possible to have multiple conitions? like SELECT * FROM <table> WHERE <value>=<value> AND WHERE <value>=<value>?
and if i can use data from same database
like if the column has the keys of id, maxmembers, membercount
then i can do WHERE id='99' AND WHERE membercount< maxmembers
so yes, i can compare values from a row with another value from the same row?
just not add sing quotes
Yeah I'm pretty sure you can, I'm on my phone rn so you will have to Google how to though
thx
last thing, if you know how, how would I get the first row that satisfies the given requirements?
about my code, i managed to center all of that stuff, but now i need to make spaces pain
English, please.
The first row only?
Just by defining a limit for example LIMIT 1
After sorting the rows you like to
am i able to get the random of the to p3 most populated servers or something lmao
or like for example
the one that has the most membercount but the member count is less that the max
ty !
am i able to get the random of the to p3 most populated servers or something
Not with SQL only but yeah you're able to.
SELECT member_count FROM servers WHERE is_active = 1 ORDER BY member_count DESC LIMIT 3
Just as example...
Assuming a columnis_activeexists as well asmember_count
You sort the table by themember_countin descending order and limit the result to 3 rows.
Just pick one element out of the result (array) for example. Math.random...
for examlpe could i do
SELECT * FROM " + ConfigManager.getDbTable() + " WHERE gameType = '" + gamemode + "' AND playerCount < maxPlayers AND playerCount > 0 ORDER BY playercount DESC LIMIT 1
the table and gamemode thingy are variables
and then how do i actually get the data? (java)
The SQL syntax is right, yeah. If the column names and vars are accurate it should work.
Can't help you with JAVA, sorry. Will never touch that shit.
kk
If the actual player count may reaches your max players var you should change the condition to AND playerCount <= maxPlayers
And make sure the column names are accurate (case sensitive) ORDER BY playercount should be playerCount in your provided example
You can also use the case insensitive mode if your gamemode var may contain different characters than the rows have.
WHERE gameType LIKE '" + gamemode + "'
For Postgres, should you login as postgres or create a new user (e.g. my name)?
always create a new user and limit it's permissions
I would limit the root access to a database always to the local system
if the playercount == max players i dont want to send them to that server
Sure, was just an example
how to know in which server my bot is ?
breach of privacy alert?
like i think you cant do that
listing what server has ur bot
ok then if i want to leave bot from that dc server then ?
why would you do that
not now when my bot will lag.
You can also use filters like IS NOT for example, WHERE gameType <> 'whatever'
The SQL syntax doesn't know !=
<> is the equivalent
how mmuch ram required for dc music bot 24/7 stay in vc
The servers your bot is in are usually cached if you use a common library.
ohkk
Additional to that all of them will be passed in the READY event.
?
he's saying it depends how many servers your bot is being used in
How long do I need to eat ice cream?
**
**
Nobody knows, right? You need to calculate it your own.
when you're happy 0, else 100

1 gm ram is good for music discord bot 24/7 stay in vc
who knows
As @boreal iron already mentioned, it depends on how many servers your bot is being used in.
I would be more worried about the CPU and bandwidth usage
Just rent a scalable cloud server to adjust the system hardware at any time
If youâre going to be using Lavalink, not really especially if itâs in a high amount of servers playing music in multiple VCs
also that command is considered api abuse, since according to that it dms everyone in the server
Ram usage could also be a concern considering how much of the stream is buffered or how many songs in the queue are pre-fetched
um so this always happens to me im just confused because big bots dosent get affected by this is this because they have clusters?
and is so what are clusters for and how to make one?
just need help ;-;
read the error
are you using repl?
yes
well thats the reason
thats what can i use since heruko is bad
why
shared ips
oh
use a vps
I think you misunderstand what a cluster is. Your issue is that you have logged in more than 1000 times within the past day. This can be resolved by improving your logic and handling errors which would otherwise crash your process. There are also techniques to maintain uptime such as dropping module caches and re-requiring and using the updated cached values. The methods for doing this may vary on the language.
As for what a cluster is, I'll pre-face by saying that even large bots have issues when it comes to logging in. They practice rolling releases to not log in too many times in a day when making changes that require a restart which is why some shards may have some changes before others. LARGE bots also have a higher limit on identify calls because of the fact that they need to login more shards.
A cluster is self explanatory based on the name. It's a cluster of shards. Shards can be clustered in different ways. Either in the same process or in separate processes on the same VM. having multiple shards in the same process and having computationally expensive tasks executed on different threads is my preferred method, but it's easier to just spawn a bunch of different processes with the same code
if you have a credit card you can use google cloud and oracle cloud
otherwise you'll have to pay
oh
i dont have, i have paypal but im 13 also i dont have card
đ
thx
ÂŻ_(ă)_/ÂŻ
yeah. One more thing. Don't shard unless you're in at minimum 1500 guilds. Don't even consider it because it offers no benefit
You have a LONG way to go
does sharding have any benefits at all?
sharding is only for discord, right?
it would be a form of clustering that benefits the bots, right?
It's more of a matter up to the developer
Usually it's just "turn it on and don't think again"
then you'll need a small vps
Enforcing "multi-threading" practices which is easier than actually attempting to understand multi-threading. The issue comes down to when you have to process a bunch of socket messages, depending on the encoding, things can become computationally expensive and the thread that processing is done it won't leave much headroom for the client code base
efficient multi-threading is somewhat advanced but very important to know
sharding also doesn't only apply to Discord bots. Clustering/Sharding is also applied in other places such as Databases. The concept of master-slave database structures exist for a reason. The slaves act as workers to perform the ops the master requests of them while the master processes requests as a centralized hub for handling and also keeps track of which data is where or doesn't depending on if data redundancy is enforced
Oke so react Devs help me and share the resources to learn react js
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
To get started, literally follow the official react "Getting Started" guide. It is absolutely the best beginner resource.
anyone know how to remove the reactions that the bot placed itself
ive tried a few different ways but they all seem to not work so
does the bot got the Manage Messages permission?
wait nvm its only for reactions from others
String code = emote.isEmote()
? emote.getName() + ":" + emote.getId()
: MiscUtil.encodeUTF8(emote.getName());
Route.CompiledRoute route;
if (user.equals(getJDA().getSelfUser()))
``` this is for removing reactions.
well did you mentioned a language?
i know
if no i pick a random language and paste the solution for it.
thank you for the suggestion but I need python support
though im assuming im just using message.remove_reaction() incorrectly
you probably have to define what reaction to remove
in the first parameter it requests an emoji object? im presuming
idk i dont use py
How would i go about getting that with just the string
message.reactions.remove("your-client-id")
@dense spire
is there a simple remove all reactions?
would that auto go through the list?
u want to remove all reactions from the message or, just a single reaction?
all
but pretty sure the clear() was only part of a single reaction object right
and message.reactions gives a list
so im assuming that clear() would run through every element of that list
yeah, u need to iterate it one by one
for reaction in message.reactions:
reaction.clear()
any errors
ooh yes. there u go
ok thats works
await
okay what to do if the command is decided by the user
what to name the file inside the command folder?
let getPrice = async () => {
let result = await fetch(`https://api.wazirx.com/api/v2/tickers/${command}`)
let json = await result.json()
return json
}
let com = await getPrice()```
in this case the command becomes the last endpoint of the api
@vagrant sorrel I would recommend to think of a command starter en then use the first parameter for the currency. So instead of !btc do !price btc. This way your bot wonât interfere that fast with other bots.
Naming convention is totally up to you, there is no good or bad way I guess. The only good way is the way in which you and other programmers that work in the project can find their way through the codebase.
that's a good thought
so what i could so is instead of this .s btcinr i could do this .s price btcinr so my price become the command and btcinr becomes the arg which i can use for fetching purpose?
Ah no .s btc should be fine. I thought you were going to do something like .btc that way your bot will be listening to everything starting with .
@opal plank does detritus have a embed constructor? the docs doesnt give me any result if i search for embed.
i think this idea isnt half bad?
i would need a lot of commands to hear for .
It would work! It would also be easier for you I think, but the command would be longer for the user.
yes, i will try both methods then
Good luck!
thanks!!
console.log(name)
{
let name = "ABC"
console.log(name)
}
console.log(name)
some context?
t r y i t
i just did
I started learning JS
Who knows the regexp for a youtube link please?
gosh no not regex
how so? @spare badger
My worst nightmare
..
const fetch = require('node-fetch');
class InfoCommand extends Command {
constructor() {
super('info', {
aliases: ['info', 'i'],
channel: 'guild',
category: 'Utilities',
description: {
content: 'This provides the description/info of a coin'
},
args: [
{
coin: 'code',
}
]
});
}
async exec(message, { coin }) {
const getInfo = async () => {
const result = await fetch(`https://api.coingecko.com/api/v3/coins/${coin}`)
const json = await result.json()
return json
}
const com = await getInfo()
console.log(com)
if ((com.description.en).length > 2000) {
result = com.description.en;
info = result.slice(0, result.length - 100);
console.log(info)
message.reply(`
info: ${info}
`)
}
}
}
module.exports = InfoCommand;
normal or shortened ?
all but i have found
/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/
when I use .s bitcoin info it shows no error but doesnt return anything either, when i use .s info bitcoin it say that it cannot get the value. I get it that it needs to fetch the api first and then it can use the info arg. But the former statement used to work without error now it doesnt.
learn how to debug. add break points, and there are many other ways
^(https?:\/\/)?(www\.)?(m\.)?(youtube\.com|youtu\.?be)\/.+$/gi
This should work for both
well its a quite important part of coding lol
i just had to learn how to debug
bro I tried a loootttttt, and only after I fail I come here for help
does the API got a info endpoint?
NO
then it cant return anything
bitcoin is the endpoint
did you checked the path inside the json you get?
then i do bitcoin.description.en to get the info
i tried console logging it but then it says json is undefined
well then the entire thing will fail
first make sure that you handle if the api returns proper data or undefined stuff
yea lemme see brb
put the url in <>
Ok thx ^*
tried this on console
How do u get a guild member of a user that ran an interaction
then handle the errors properly
same gif from above.
the api dosen't seem to work.
gimme the link I'll try with postman
okay wait
ive called it with a browser and worked just fine for me
you probably add some whitespace to it
What does fetch do
its a lib for making web requests
@vagrant sorrel
{
"error": "Incorrect path. Please check https://www.coingecko.com/api/"
}
I'm a python guy đ¤ˇââď¸
it's like request
Yeah in Python we'd do requests.get
did you run my code?
works fine for me, with postman and browser
yea the api is fine
soemthing is wrong with my function
browser (running from console) is going to block the fetch request because of CORS
Can you copy and paste this code here?
Is there like a fetch.get function or something? Or is fetch the actual correct function
just sent get request in that url with postman
this is the whole code, something is wrong with this, can anyone create a command file and try this out?
Yea this is the only thing I could think of aswell
const result = await fetch(`https://api.coingecko.com/api/v3/coins/${coin}`)
const json = await result.json()
return json
}
const com = await getInfo()
console.log(com)```
works for me
as i said 10 times before
the api works fine
something is wrong with my function or logic
i guess your coin value is badly configured
console.log coin and see how its formated
this is my command handler file of info command
okay
Yea its not CORS.
what's the error you get in the first place
This is his error
Sure seems like something's wrong with fetch to me
that's CORS because it's being ran in the browser console
It's not. I tried.
what's the actual error in the node app
without the node-fetch package
node-fetch is a node port of the browser fetch API, browsers have fetch natively
when i run .s bitcoin info (here bitcoin is the {coin} and info is the command) it doesnt console log anythingggg
i have 3 consolelogs
why do you think it's the api request that's causing the problems
seems to me you have a misconfigured command handler
but when i do .s info bitcoin it says:
Invalid Date
(node:6032) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'buy' of undefined
at PriceCommand.exec (C:\Users\hp\Desktop\Stonks\commands\Public\price.js:40:29)```
console.log what it returns
Console log the URL
but my guess is that you send the wrong stuff
and that 'buy' thing is some other api command i have named price
i think 2 commands are interfering
oka forget that info.js, i deleted it
@vagrant sorrel the code you gave actually works
here is a command that used to work and now it doesnt
why doesnt it work for me?
const { Command } = require('discord-akairo');
const fetch = require('node-fetch');
class PriceCommand extends Command {
constructor() {
super('price', {
aliases: ['price', 'p'],
channel: 'guild',
category: 'Utilities',
description: {
content: 'This provides the price and other details of a specific coin'
},
args: [
{
coin: 'code',
}
]
});
}
async exec(message,{coin}) {
const getPrice = async () => {
const result = await fetch(`https://api.wazirx.com/api/v2/tickers/${coin}`)
const json = await result.json()
return json
}
let com = await getPrice()
console.log(com)
const stamp = new Date(com.at * 1000);
const time = stamp.toLocaleString(undefined, { timeZone: 'Asia/Kolkata' });
console.log(time)
message.reply(`
Buy: ${com.ticker.buy}
Sell: ${com.ticker.sell}
Low: ${com.ticker.low}
High: ${com.ticker.high}
Last: ${com.ticker.last}
Vol: ${com.ticker.vol}
at: ${time}
`)
}
}
module.exports = PriceCommand;
try this
IDK
I changed it a little to work for me
Its not just for bitcoin. it for all 324 coins. whatever the user types becomes the url
for testing
this used to work, now it doesnt. when i execute it, it logs nothing on the console
if you're not happy then fine I added coin name support
you probably aren't executing the command in the first place
your command handler is fucked
directory: path.join(__dirname, '..', 'commands/'),
prefix: message =>
message.guild ? message.guild.prefix : defaultPrefix,
commandUtil: true
});```
simple commands work
How can I get the all event handlers and their args on discord.js?
You will find the rest here: https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
Hey is there any thing like webhook service from reddit?
Where I can get notified everytime someone posts on a specific sub?
All I want to do is
Post that submission in a discord channel once it's uploaded on sub-reddit
IFTTT can do it
So, I'm using Python to make a bot but it's showing Syntax error whenever it's at the Async line
Show your source code
@client.command()
async def hi(ctx):
Await ctx.send(bla bla bla)
Async shouldn't be capital.
And you're missing the colon after the function parameter list (def hi(ctx):).
Ik I'm using phone to write on discord so auto caps and stuff
Syntax error...
embedVar.set_author(f'{user.name}', url=f'https://discord.com/users/{user.id}', icon_url=user.avatar_url)
Why doesn't this work? Discord.py
What error are you getting?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: set_author() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given
If your code is structured like this in your source code: ```py
@client.command()
async def hi(ctx):
await ctx.send(...)
There's a chance your Python version doesn't support the async/await keywords.
aka python 2
But it used to work
nah like before 3.3 I think
I have python 3.8 or 3.7 I guess
Oh yaeh
Do you know the difference between positional and keyword-only arguments?
no
Well you've either structured it incorrectly or your Python version doesn't support itâone of the two.
As the names suggest, a positional argument is defined by its position, and a keyword-only argument is specified by a keyword explicitly
ok
Positional:
my_function(positional_argument)
Keyword-only:
my_function(keyword_parameters=keywoord_only_argument)
cool
translation: i dont understand a thing
there are too many peopole here
Lmao
Hi comhad
I don't know if discord.js has something specificly for pings
Hi :D
no me neither
Do you remember me?
But i do know if you put <@ before and > after a user id it will form a ping
yeah
I think so, discordbotlist.com server?
so like
how would i get the bot to recognise who typed in the command and respond with their name, maybe not specifically a ping but their username
yeah
I don't know discord.js, sorry, i was just adding that in because i thought you wanted to ping someone
@mental raven Going back to your case, set_author does not require any positional arguments, meaning all of the arguments you listed must be specified with keywords
In your case you have one positional argument set, which I assume is the name argument
It does but i wouldnt use it personally
figured it out already
Hello
Someone helps me in awaitMessage filter?
const filter = (m) => m.author.id === mentioned.id
message.channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] })
.then(async collected => {
if(collected.first().content.toUpperCase() == "YES") {
//something
}
});
});
And what's the issue?
im fine with it for now. had some issues that it crashed the entire process. but apperently detritus doesnt like it if you try to send a object as string without stringifying it
What did you define mentioned as?
message.mentions.users.first()
but the debugger. i wish i used it for ever. makes debugging so much better.
Trying logging something inside the .then() block and see if it logs anything
okay
hey how do i push a sentence seperated by a comma to an object?
so test1, test2, hey i love coding, test3
all need to be pushed in the form of: ["test", "test2", "hey i love cats"]
"push"?
yeah but wouldn't that ive me somethin like this:
["test1, test2, hey i love coding, test3"]
{
x: [...]
}``` you mean like this?
no
just like this:
So you just want to push a sentence seperated by commas to an array?
yeah
@opal plank you use postgres right?
<Array>.push(...sentenceSeperatedByCommas)```
alright so if i get it right, i should use test.push(...args(for example))
yes
alright, thanks
x.push(...args) yes
Sounds about right
Yup
if anybody has used canvas here , can he recommend some nice font for profile card?
i am having a few problems here
const description = args.toString().substring(m)
console.log(description)
const f = description.replace(/,/g , " ");
console.log(f)``` i've used split and eventually map
so i could read the contents better
but now it returns this: testing,this,out,,will,it,work?,,not,sure
after sepearting with comma;'s
how annoying is it to use?
i then used regex to remove the comma's
Not at all
but that left me with: testing this out will it work? not sure
I have contributed to the Luca repository, how do I get the role?
nice
How do you contribute to a meme repo
how can i remove those double spaces and replace it with a ,
args.join(" ");
why don't you use this
instead of .toString()
connection Pool or normal client?
basically this joins the arrays (here args)
i already just used regex
to remove the double spaces and replace it with ,
why use regex when you can use that instead
testing this out, will it work?, not sure i am left with this now.
i mean, it works so i don't know if it matters.
yeah, was just easing your business
because i actually want to seperate the messages
how do i make a vote count like in a channl it displays the user who voted vote count
and push them to the array
...split? lol
["testing this out", "will it work?", "not sure"]
yeah, so where's the problem
it actually pushes like this: ["testing this out, will it work , not sure"]
@opal plank are there typings for node-postgres?
const d = f.replace(/ /g , ", ");
console.log(d)
if(args[0][1] == 'Booster'){
array1.push(...description);
fs.writeFileSync("./array1.json", JSON.stringify(array1))
message.channel.send("**Your collection entry has been saved to the ``Booster`` section!**")
}
if(args[0][1] == 'Free'){
array2.push(d);
fs.writeFileSync("./array2.json", JSON.stringify(array2))
message.channel.send("**Your collection entry has been saved to the ``Free`` section!**")
}```
yeah i don't believe you but whatever floats your boat
what does d output
in the console
that code is so messy
i can't tell what is what
wait you still use json dbs?
testing this out, will it work?, not sure
this is literally for personal use to store info that can help me out. My main bot is already migrated to mongo
i would just use sqlite instead of json
Don't replace at all, just use split with the regular expression
yeah i tried that
const final = d.split(', '); but this eventually adds it like this: [["testing", "hello"]]
so if i want to add anything esle
it returns:
[["testing", "hello"], ["anything else", "test2"]]
vote count or who voted ?
pool
use pg
this is node-postgres
im aware, im telling you to use pg instead
Although it's called node-postgres, it's dependency is pg
yea i know
its much better to use pg right away
i remember some annoying af things with types before with that other one
SQLite is nice too
wrong ping anyone that knows why this is writing a nested [] in the json file?
vote count
one thing i not really get are queries, atleast for now
like creating a table with mutiple rows
install pgadmin
tis what i do
i dislike creating tables and all that jazz with code
having a UI helps, then its just INSERT, UPDATE, DELETE queries
what are they called in pg? mongo got documents
nvm found the query tool
in postgres its all under a schema => then you got tables, then each table has rows and columns
thats about it
yea havent used a sql based database for a while
if u have pgAdmin, the only thing you'll need is
INSERT, UPDATE, SELECT, DELETE
thats about it
if u need help with the querries lmk
thx
np
@opal plank would it be the smartest to Map the argumet from ParsedArgs first or just deconstruct the object? im dumb sry for the ping
@opal plank does Detritus have something like d.js awaitmessages?
that and reaction reaction collectors arent a thing, luckily i provided in the detritus server the way i handle that
here
@lusty quest #651168338189484043 message
thx
np
if its confusing let me know
but the idea is simple
theres even a paginator in it
well i just want to collect messages, dont need pagination.
well then i have to do the stuff in a more annoying way i guess
fucking hell why is keydb so hard to setup
you forgot your keys
only took me like 4 hours to get it running
i would have been annoyed enough after 1 hour to just run it inside docker. did the same with MongoDB
this isnt even docker
remove the second parameter, thats na array of EditPayloads
lmao
or just provide an empty array
i know, but you can probably run it inside docker
i take a break, im a bit tired and got some headache already. its a sign for me to to stop
fair
nah fuck docker lmao
ye with only another layer of virtualization on top of an already existing one
how deep are we gonna go?
docker is relatively lightweight tho
but yea run a container inside a container running on a VM running inside a Container
can you run docker inside docker?
can you run docker inside kvm inside docker inside kvm?
can kvm run inside kvm tho?
but running docker on a KVM running inside a KVM is possible i think
only the other way around
but docker is nice stuff if you have to run a ton of stuff inside VMs
way less overhead and more efficent resource usage since its dynamic
i usually use it if im to lazy to setup something, like Database server
its way easier to just run one command and you are done
can docker expose a sock file to another docker?
you could use docker networks for communicating between containers
but can they run on sockets or only tcp?
you can expose the socket, but its not recommended
you could probably expose a socket within docker, but not the docker socket itself since it would entirely defeat the purpose of virtualisation of the containers
nah just block all ports and allow ssh only from your IP
well, then use a VPN to get access
its no joke lol, when i where sysadmin for a small hoster we had locked the entire Backend behind a private network and to get ssh access you needed to run a VPN to a server inside the Private network
you cant have enough security
One message removed from a suspended account.
but is there any example of ssh keys being broken before?
icba setting up that much security
One message removed from a suspended account.
probably not bcs it takes ages to break them. but dont underestimate the dedication of people
or just run the basic stuff like, changing SSH port, installing fail2ban, using ssh keys
the best counter to people who tried to get into servers where that they where locked in a infinite login
WHY DOES SPHINX NOT ALLOW DEFAULT VALUES
usually they have just a pc running that bruteforces into the connection, but the script never logs you in properly without ssh key so they are stuck in a infinite login loop
but doesnt that cost resources?
keydb with tcp = 27k ops
keydb with sock = 40k ops
yes, its not ment for production servers
that'd just be a sort algo, you don't need a dict
i get that theres not much reason NOT to, but do you really think you'll be using any more than 10k ops?
I've decided to use socket.io for my minigame
unless there's a better alternative to it in another language that offers the same kinds of abstractions
One message removed from a suspended account.
dictionaries are for key-value storage
is there any resources for an sql database? i watched a couple videos but im not really sure how to continue from there
I always believe the best way to learn, is to struggle and find the answers your own way
But, if you're not that type of person, then I'd recommend looking at simple things, for example, insert, delete, where, or and order by queries
This is bit more complex, but really useful, insert or update (on duplication) query
Close to what I believe except I believe the best way is always actually doing something with the language in question. start off by looking at pre-made code etc
i have a db.py folder made and it has scriptexec and updates and everything just the issue is idk where to go from there
I don't like looking at pre-made code, I think it pushes people away from coding, since they look at it and starts to worry about how hard it actually is
well theres that then they say "well... if the code is already made no point in making it myself right?"
only downside is you tend to lean more to use the ways youve seen throughout that code
which could sometimes not be the best
I've learnt by struggling tbh
but you'll realize eventually
i have my entire db made and i have my sql file but thats all they taught us and now im like just trying to figure out a way how to make a table that works for me and how to import it to my main file and make commands out of it
but there is highly limited d.py support as i see nobody really doing it anymore
I'm afraid we might need some more context to it
i have everything setup my database is made
yeah and its garbage
@zinc wharf@earnest phoenix@visual goblet or you could do the way sane developers learn. By reading the docs https://dev.mysql.com/doc/
not really, Dani himself helps people out there
maybe youre in the wrong server?
the people in the server arent helpful whatsoever and when i was starting out they made fun of me lmao
worst "support" server ive ever seen
Can back this up
I don't read docs tbh, too much stuff to read through most of the time. For stuff like that, I use a chrome extension called Grepper
@opal plank Yeah docs... I'm afraid that's the kind of things they start by schools and univs only

The official support server is just toxic and unwelcoming
sane devs don't start off by docs
d.js was garbage too they all ganged up on me
well to learn somethin you've gotta read the docs

yeah but not to start with
Not me 
any SANE dev will read the docs. only people who starded developing for less than 2 weeks wont do it
if (args[0][1] == 'Booster') {
console.log(name)
if(!database1[name]) database1[name] = {
names: []
};
database1[name].names.push(...final);
fs.writeFileSync("./database1.json", JSON.stringify(database1))
message.channel.send("**Your collection entry has been saved to the ``Booster`` generator!**")
}```why is my json file not being overwritten?
It just sends no error, no outputs.
yeah so ive been on my own just asking my friends and reading the docs but im kinda struggling rn so i came here
\wut
I read detritus docs and flip table

you can safelly screech at cake for using generated instead of typed docs
I've been coding for years, but all the stuff I code, its mostly all the same, so I just copy and paste code from my past projects, change few variable names over and job done. For stuff I don't know, I do read the docs ish, but mainly Grepper brings up the answer for me
that i WILL give you
@visual goblet if you could show us some more context or code maybe we can help you a bit more
Json wtf?
thats the problem im afraid i dont know where to begin
i mean thats fine in its own way, but realistically you should be reading the docs or using intellisense
i have my database created but thats legit all
You want to use your SQL database to create commands?
Begin by describing what you have, and then what you need and finally what you don't understand
huh

to store command data*
Oh, I see
yeah man i dont know what the hell im doing LMAO but thats how we learn
I mean still mate, the documentation has everything you'd ever need
we just fuck up and fix it
i am storing strings. personal use
I'd suggest getting a hang of SQL and working with it, especially the SQLite dialect
you shouldnt, either way
you could use keyv dbs
but i am not saving important data
Once that's done, you can go on to create your table. That's where it gets tricky. Make sure you analyze what you need to store and in what data type
json isn't reliable
just some little things
you shouldnt either way
keyv dbs are easy as cake
yeah im trying to just mess around and have a bit of fun while learning everything
yeah of course i have a good idea on data types and all that im just confused on how the tables work and how to import the database to my file and set it up to save the command data
if you don't want to use this
you could use https://npmjs.com/enmap
I think you're confusing importing with querying
its my first time with a database so im trying to get some good sources to see who can help me out with explaining it in a simple way
but please avoid using json as database
then i can mess around
problems with this. first, what are args[0][1]? normally this would be a single letter, also check with === not ==
second, what is that indentation?
third, await and catch your promises
fourth dont use json to store shit. period. It clearly shows you arent worrying about atomic operations whatosever.
please keep consistency in ur code. why'd you use ; and stopped mid way?
Json as a database is a big no no
i highly agree with this
I suggest using this package https://github.com/omnilib/aiosqlite if you're more or less well-versed with the sqlite3 package itself. It's asynchronous (meaning running its methods won't block your main thread) and seems to be trusted, although I haven't used it personally.
buddy of mine stored data with a json and he fucked up with some code and his entire json data just wiped and his bot became less popular to the point where he quit
I personally use MySQL, mainly because I can access it from anywhere. Discord Bot, website, software, mobile apps, helpful to link everything together
JSON as a database is not necessarily bad. It just requires careful handling since there's a lot of stuff that can go wrong
ini as db
It's like they say, "It's not bad if you have any clue wtf you are doing"
i used json as a db for a year đł
oh thank you i appreciate it its my first db so i just need a little guidance
i have my db all set just the issue is tables so i need to work on that but ive looked for sources and the only thing people seem to want a db for is a knock off mee6 tutorial
We all need a little guidance at some point, even the best of us đ
best way to learn it is to mess around w it and look at docs
ive only used a json file once for custom prefixes but it didnt even work lmao
I assume you want to make a public bot?
yeah its actually already public in 17 servers and counting
i shouldve waited but i didnt
nobody really uses it for moderation since theres way better bots but id like to just have mod stuff just to learn really

đ
seek help
I'm not that much familiar with SQL so I can't exactly give much guidance here
i will revoke your coding license if you dont fix that shit in the next 2 days
You might want to look into foreign keys, that could be helpful
what guidance needed though?
you've been warned
yeah the issue with a database is theres so much i need to know and i cant really find what i need so i came here for sources and to see what i need to know
and what exactly do you need to know?
its my first one ive been working on it for a week and im so fucking confused LMAO
i use PostgreSQL so i can give some insight
are you using nodejs?
Is there any free database providers with limited storage?
You don't necessarily need to start by learning about foreign keys
i am a python man
that can come later
mongodb cloud
True
i just need some recources to gain an understanding of making a simple database and how to put it into my main files and make it function
i dont really know much about tables
what wrong with is header p {
color: black
}
did you know that there's something called sqlalchemy in python?
can anyone here easily explain the difference between: unique keys, primary keys and foreign keys in 6 sentence?
yea but thats not a benefit to the dev, only to discord. From what I can tell, sharding's only benefit is that it forces the developer to scale at one point or another
I think you should be literally good to go if you read about INSERT UPDATE AND DELETE from w 3 school
i did not know that i only know about mongodb and sqlite3
but i do know theres a lot more db out there
its just meant for sql
help
donât forget select
oh yeah hehe
i know theres a bunch of different ig you can say versions of sqlite3 but im just trying to see what would work for a beginner and how i should go about this
w3schools website is a great inspiration for me idk about y'all
like what sql dialect?
Sometimes the Dev has advantage since he can use workers to split up the bot ,which is not possible without shards
yea but other than that sharding does nothing
you can just make the I'd column auto increment and forget abt it
One message removed from a suspended account.
sharding is just for discord's sake
what do you mean?
split the shit between different websockets
itâs probably something to do w sending out huge amounts of data to one process
yes
there are different "dialects" of sql, like mysql, postgres, cockroach etc etc
rethinkdb is not sql, is it?
meh
oh im pretty sure im just using the standard version if thats what you call it like im not suing postgres rethink mysql im just using sqlite3 if thats any help at all
oh well that might be easy than, I mean I basically thought you were talking about mysql or some larger dialect of sql. In that case, sqlite has its own pypi package thus, you would have much of an issue
read this for a try https://www.tutorialspoint.com/sqlite/sqlite_python.htm
SQLite - Python - In this chapter, you will learn how to use SQLite in Python programs.
i have a db.py folder with all the needed information and then i have a build.sql folder for tables and other info but the problem is that is all i know so im needing to see if theres any recommended tutorial videos or even just reading websites to learn how to use tables
then ill have to figure out how to use that database to collect command data and store it then have it used when someone calls it through the command but thats later on i dont need to worry about that right now
this
ill take a look thanks
Hey need one help
I want to give a member a role on voting
And I'm giving it in the webhook receiving function
What is the best method of removing it after 12 hours?
I tried await asyncio.sleep(42300)
But it's not reliable
Any other method without storing it?
oh man i feel kinda dumb right now
i thought discord.py would handle databases differently and ive only looked for discord.py database tutorials
when in reality i dont think thats how it works
me to i just how make it
discord.py is just a Discord API wrapper in Python
It doesn't use databases, yeah
yeah i feel dumb thinking that way LMAO
Store the vote time in database and have a cron job pull all vote data and check if a vote is expired
Every minute?
Ehh...
check if expired
wouldnt you do it every hour?
Every hour is fine
if you want it removed every 12 hours check every hour
Okay fine
What I used to do personally is run a d.py task run every hour and get the votes from my bot object's cache
Both in database and cache
btw how you store in bot variable
bot.x = {}
Cache isn't permanent, that's why I stored everything in a database and cache
Yeah how long do you think the cache will keep it without we doing anything to it
As long as you don't restart your bot
You pull the votes from database, store them in cache. When you edit vote data (aka delete it), you delete it from the cache and database
i usually check every hour and update it that way
with a simple timeout and interval
the database entries are loaded on startup
whenver someone votes, it refreshed their last_voted
thats about it
any checks u need you'll just check if their last timestamp has more than 24h's worth of miliseconds
hey so a question for anyone familiar with the d.py docs
is there a documentation on databases as ive heard that is really good to read?
A what
Discord.py has no relation to databases.
You'll need another package for database logic.
There's no general documentation on databases, especially on discord.py docs page
ah okay
If you want to start somewhere, Python has a built-in module for SQLite
yeah im using sqlite3 and i have a documentation for it
just working on learning about tables
and how i can change data from a command
Sounds like you're looking for the Discord Developers server
lol
go on the application on the discord website and find the verify button
bro
i need help in wright this
canât u just write it in your native language
iâm sure theyâll have a translator
my language is hindi
i cnt wright in text
bro
will google translate help?
bro icnt poosible
this is a lot more simple than i made it out to be
wait i show my language
चŕĽŕ¤˛ŕĽ एŕĽŕ¤ ऌŕĽŕ¤ľ
this is my language
i cnt wright it
so tuff
bro
main help kar sattahu
lekin
bhie apko bhola baba na baja ha
tumko o lekhna chahiyein
dms ayo bhia
b r u h
main indian nehin hu
ik ik I just speak his language
dm
hello @pale vessel
How can I get all the values of 490 + 500
Like 490 + 500 + 500 + 500 + 500 + 500 + 500
i can define a table in a cog right?
i dont really need a build.sql folder for tables as that just seems annoying
sup
what
that example doesn't help at all
do i need a build path with sqlite3? i was wanting to put everything in just their cog
but im just making sure i dont need this before i delete it
.catch(err => runErrorHandler(err, cmd)); //Put this on your command handler, for example, if(commandfile) commandfile.run(client, message, args, ops).catch(err => runErrorHandler(err, cmd));
let date_ob = new Date();
let hours = date_ob.getHours();
let minutes = date_ob.getMinutes();
let seconds = date_ob.getSeconds();
let day = date_ob.getDate();
let month = date_ob.getMonth();
let year = date_ob.getFullYear();
client.channels.cache.get("channel ID").send({
"content": "Any tag",
"embed": {
"description": `Something went wrong with a command, here are the details.\n\n__**Error**__\n${err}`,
"color": 16711680,
"author": {
"name": "Command Error"
},
"fields": [
{
"name": "Random title",
"value": `Random field with random information`,
"inline": true
}
]
}
})
}
^^ Javascript (Discord.JS V12)
You'd need to catch the error (e.g. through a command error) and send it to the channel.
However, I recommend you don't use Discord as a logging service. It may be convenient, but it's not appropriate. I recommend you save your logs in files (recommended) or use an external service.
100%
If you want the more advanced route, then MySQL đ
hey, just why -
client.on('guildMemberAdd', member => {
isn't working with me
Do you have the required intent enabled?
requires member intend
yeb
on the dashboard and in your source code?
yeb -
do u mean like client.on('guildMemberAdd', require(member) => {
?
in the discord developers dashboard you have to enable the intend
what
idk
no its a thing you have to enable
you need server members intent
can u show me ? -
enable the member intent
sqlite3 isnt a very long term solution as ive heard is that true? if so should i cancel using sqlite3 and try something better?
It is not a long-term solution because it's better for smaller collections.
depends




