#development
1 messages · Page 705 of 1
Redirect uri is already for callback
I think dbl would have you lock it to nsfw channels tho
I mean like after all the login is over, atm it goes to the home page
It redirects with a query param in the url doesnt it?
I did oauth stuff like 5 months ago, I forgot how it worked though
I don’t think it passes on the query from previous if it just passes on code
what do you want to actually do
because this is most likely a case of http://xyproblem.info/
Asking about your attempted solution rather than your actual problem
Sorry. Sooo, ok, people can go straight to my dashboard with server already filled in. If they’re not logged in or login fails it redirects to the oauth login to properly login. I want to make it so ONCE they properly login, if they logged in through that, redirect them back to that page they originally weren’t logged into rather than just redirects back to home
i keep on getting bash: null: command not found
on glitch... anyone know how to fix it? (discord.js)
how are you getting it
well whats your bash script
help pls
whats a basg script?
Did you mean bash?
lol
Yeah, bash
const mongoose = require("mongoose");
const botconfig = require("../botconfig.json");
mongoose.connect(botconfig.database, { useNewUrlParser: true }, err => {
if (err) console.error(err);
console.log(mongoose);
});
const RP = require("../models/rp.js");
exports.run = async (neko, message, args) => {
const user = message.mentions.users.first() || message.author;
RP.findOne(
{
serverID: message.guild.id,
userID: user.id
},
(err, bio) => {
if (err) console.error(err);
if (!bio) {
const NewBio = new RP({
bio: args[1],
userID: user.id,
serverID: message.guild.id
});
NewBio.save().catch(e => message.channel.send(e));
}
if (bio) {
const Bio = new RP({
username: user.username,
userID: user.id,
bio: args[0]
});
Bio.update().catch(e => console.log(e));
}
}
);
};
module.exports.help = {
name: "setbio",
aliases: []
};
so i tried some ways now to update something if it already exists. None of them worked. Please Help
why dont you use updateOne
https://mongoosejs.com/docs/api/model.html#model_Model.updateOne
So my friend had a question and I just wanted to ask here because i'm not sure with it
His professor told me to make a discord bot that lists out 3 most popular discord servers when you write a subject
So for example, if you write Physics, it's gonna send 3 most popular servers about Physics server
I told him its impossible, literally impossible but can someone clarify
not really impossible, but you need to gather a database of servers. you would essentially be making a server list but in a discord bot
oh
how can we even do that
like the possibility is probably getting 3 popular servers for every subject?
find servers related to the subject, and ask the owner(s) if they are fine with your bot including the server in its list
then its as simple as sorting them by member count or whatever you define as popular
^
ok thanks guys
@mossy vine so at if (bio) change Update to updateOne()?
@outer tulip lmao your Professor told you to make an dc bot?
updateOne finds and updates the document
@stray garnet no its my friend who was told, he made a music bot and the professor said to make a bot that lists server cuz making music bot is "too easy"
i mean yea, you just connect to google console APIs
get youtube data api
ez clap
but yea thats what he was told to do
Saying something is easy is different per person
Everyone has their own experiences
tru dat
@mossy vine
try commenting out the entire thing and using updateOne
it does what you want to do but in 1 function basically
i keep on getting bash: null: command not found
on glitch... anyone know how to fix it? (discord.js)
https://cdn.discordapp.com/attachments/272764566411149314/628947525239308300/unknown.png
if any of want to take a look of the bot code or package.json tell me
This isn’t glitch support
For bots
it is a problem with my bot
But it’s not really development it’s a platform issue
there is no platform channel tho
That you should bring up with the people who actually use the platform because it’s not your bot that’s the issue
so its not a problem with the code?
Yes that’s why you go to glitch support
Your bot shouldn’t be running any bash commands so best bet is yes this has nothing to do with the code
can you give me an example of bash command realy quick? so i can check if i used any
It’s literally just a command ran in bash. I can guarantee pretty much that you have not because it’s not even starting in the first place
It’s a glitch issue bring it to glitch please
i will. thanks
Does anybody know any general tips to help reduce memory usage with discord.js?
Sweep caches regularly
^
oh uh
thats something
I forgot to add
😳
thanks for the info tho @smoky spire
wait... how do i do it? im using discord.js too
Collection#sweep
tnx
Is it normal that my bot with 5k servers needs approx. 3gb of memory after a few hours and rises to 6gb within a few days? Or do i have a memory leak?
Is it normal? Yes, should it be the case? No. Like what was just said, sweep caches regularly
I'm kind of confused on that, is it like, a manual thing you should do through commands, or should it be automated in some way, I honestly have no idea
there are many ways to optimize djs
but its not an easy thing to do
my bot uses 60mb ram with 1600 guilds
djs caches everything by default
including users, members, guilds, channels, emojis, roles, presences, voice states
thats what i did
but you have to know what you're doing
for example, disabling roles, will also break all permission checking methods
disabling channels caching will break sending and receiving messages
Is eris better
i made a library that handles most of those problems, at the cost of losing some features
Eris doesn't cache at all, so memory-wise yes
Yeah
and its structure is different
i prefer djs because i've learned it well enough to modify it to my own needs
if anyone is interested in the changes i did, my library is on github lul
dm me a link @quartz kindle
timotejroiko/djs-shenanigans
@quartz kindle for the most part, could I easily switch to that instead of djs, without doing much rewrite?
I mean my bot's pretty basic, mainly consisting of sending embeds
Anyone know a way I can get the bot to run for longer in this code?
how to make a bot send an error message if the bot isn't in a nsfw channel? (I use discord.js)
possibly yes, as it says, you have to test it extensively to make sure everything works as it should
`import discord
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('HELLO'):
await message.channel.send('Hello!')
client.run('token')`
Forgot to say it's python
you can run a second bot on the same token with a different prefix to test it, thats what i do lul
to run for longer in this code? What do you mean?
Where are you hosting your bot
glitch probably
Um. So far I've just made the bot and ran the code
locally?
Yeah
It must get off when u run some command
probably erroring out
I haven't found a place to properly host this code other than the place I'm coding it
BTW I'm on mobile
What's your discord.py version?
I will check
Uhh that might be the cause
message.channel.send() exist in python??
hey, i have a question.
how to make a bot sends an error message if the bot isn't in a nsfw channel? (I use discord.js)
1.2
Yes that's valid syntax starting from discord.py 1.0
Idk how to change it
@celest spear TextChannel should have nsfw property
I'm using pydroid
oh god
that is supposed to return a boolean value

Ehhh... not familiar with pydroid personally, sorry
honestly if shivaco wouldnt hurt me, I would reccomend async version. It works best in pydroid imo
Since rewrite styling is.... weird
rewrite is more OOP 
I swear Neko I'll try to host a bot with pydroid just to show you it's easy
someday

Tim and Iawa thanks for your responses. i will add a cronjob to sweep the cache for now.
I don't really want to poke holes in the ground with just my hands
I'm not familiar with pydroid but at least your code is alright
Anyone know if a while loop would work in the code I showed before and where would be a good place to put it?
Hm I'm trying to get it to run for longer so I thought while something is equal to something, it would run for longer
Ehhh
Idk
Not sure that'd help
it doesnt need a while loop because the problem is probably not code related
a discord library does not exit for no reason, it keeps listening to discord messages forever
your program is exiting for some reason, you have to find out what it is, it can be disconnections / network issues
check if your library has some sort of debug events that might inform you of whats going on
your process might also be killed by your system for some reason, too much memory/cpu usage, or any other weird reason
Oh okay
memory leak doesnt actually sound all that unlikely
How do I do to keep my bot online ?
keep the program running
dont turn it off lol
Yeah
lmfao
Because you shut your pc off
You need a vps
And a process maanager
Or leave your pc on 24/7 and hog bandwidth
bots dont really use a lot of bandwidth lmao
they do
especially with guild_subscriptions enabled
at some point my bot was using 400gb per month lmao
disabling guild subscriptions cuts its bandwidth usage by like 10-20x but you lose member join/leave events (hopefully discord fixes this)
I've received 5.8gb and transmitted 2.8gb
Idk how to check just bandwidth in linux 
i used nethogs
Do I need to download that or is that just in linux
I don't know really know what is an VPS, can you explain me
vps means virtual private server
its like a computer that you rent somewhere
then you connect to it and control it through the internet
an entry level vps costs around 3-5 bucks a month
and it runs 24/7
you can then install programs on it, upload files to it, etc
most of us use a vps to run our bots
google and amazon offer a free for 12 months deal
Nice 😮
so you could potentially have a vps completely free for 2 years, if you switch between them
but you need a credit card to create an account
there are also services such as glitch and heroku which have free plans, but they may have some limits and weird things
might be good for a start, but most developers dont recommend those
there are also many companies that have special offers for students
including free vps's
p!-BOT - [02.10.2019 21:41:32] warn: Attempting to register an invalid command object: [object Object]; skipping.
p!-BOT - [02.10.2019 21:41:32] warn: Attempting to register an invalid command object: [object Object]; skipping.
p!-BOT - [02.10.2019 21:41:32] warn: Attempting to register an invalid command object: [object Object]; skipping.
The bot is getting crashed because of this error. Who knows the solution? discord.js-commando
Anyone knows a good anime api?
@tulip ledge i use nekos.life
bwahhahhaa
@tulip ledge what do u need it for
hey, so i got a problem, my prefix does not work...(partly) the prefix is 'k!', now, what does not work? basicly i have to write 2 charcters(could be anything like '23', 'kr', '!%' or anything with 2 charcters in it) and the commend would work, how do i fix it to only work with the prefix k!
if(prefix !== "k!") return;
tnx
@tulip ledge what type of anime api?
images can be nekos.life
anime stats can be anilist
pynter put it where you check the length
instead of the length?
taking a while... is the anyway to do it with out hastebin?
hastebin isnt working from some reason...
@narrow kettle you are not doing any kind of checking
i realised that, i have no idea how to check the prefix, i tried and the bot just didnt react
you remove the prefix from the message, then continue the processing, but you never check if the message actually starts with a valid prefix
how do i check if its the actual prefix?
one way is to use javascript's string.startsWith() method
I use if(!message.content.startsWith(prefix) prefix being the variable that holds my prefix
can you show me where exactly do i need to put it
@short forge
i dont know if i should put it in the args or switch or anytthing like that
Well think about it logically, where would you want it to check
does anyone here know how to move windows quick.db to linux quick.db
what
i guess before the switch
wait nvm
Fixed?
its not bot related
Try it and test, all part of the developer experience
It can still go here
lets ask on the official discord
It's still part of a bot
alright but i just read "Channel for chatting about (bot) development."
so does anyone here know how to move windows quick.db to linux quick.db
Bot is in brackets
what does that mean
But yeah
what do you mean with "move"?
Basically
what backend are you using with quick.db?
We've been programming a bot for Windows and we're moving to raspberry pi
But the code has no errors on windows, and quickdb gives errors on raspi
what backend/database are you using with quick.db?
do you need to use paths
better-sqlite3 (if i understand you correctly)
because paths are \ on windows but on linux its /
then you can move the sqlite file
then you just need to install everything correctly
well, the paths are fine
and yes, change all your paths, although windows supports / as well
what error are you getting on quickdb?
"promisify" isnt a function
maybe util isnt installed or node is outdated yes
let me check
its above ten
i know that
but for some reason an error reporter said it wasnt when node said it was
check again
nope... cant get it to work
ok so its 7.7.2 yet i tried to update it and it said it was done
linux repositories do not update node that often
you have to install node from a proper source
instead of using apt
thats what i tried to do
i saw that, i did it, refreshed the terminal and nothing happened (i'll try again though)
nevermind
@grizzled jackal it tells me there is no such thing as startwith
let args = message.content.startWith(PREFIX).split(" ");
switch (args[0]) {
thats the only part that is relevant
how can i get the icon url of a guild with no icon as in like the ones with the abbreviated guild names
there isn't one
the thing you see on your client is just css
you have to generate an image
idek how to go about doing that
Is the font known for that
is there a better way of just somehow signifying the guilds name in icon form for guilds without icons for my dashboard server select?
idk css that well ooof
like i got this far
but the text just escapes the the circle
its an alt which is probably the issue
i can just make it a different element cuz ejs
@narrow kettle its not startWith
did you read the link i sent you?
everything is explained there, learn how to read documentation, its an invaluable skill to have
ik, im fixing it rn
and it works
so you cannot use .split on it
yeah it told me that but the main problem was just a typo
i wrote startwith instead of startswith
@narrow kettle https://discordjs.guide I highly recommend you read this guide, I think it should be able to help you out a lot
A guide made by the community of discord.js for its users.
would probobly help me, im new to javascript and discord bots
how can i fit the font to actually fit in the circle?
check the width of the text compared to the width of the circle?
i dont think there is a way to measure text width in css
you'd need js for that
you can define font sizes in percentages, but thats it
you don't need to measure anything
wrap the text in a span element
you can then play around with the line-height property
i understood he wanted to dynamically change font-size to keep it inside regardless of amount of characters
ah
that's bad UX design
you want to display as less text as possible to the user - so in this case just the relevant letters
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
the other issue is keeping the circle an actual circle
huh
what's your css for the circle
the behind one or the image one?
ill just send the whole thing here
body {
background-color: #2C2F33;
}
.guild {
float: left;
background-color: #23272A;
border-radius: 60px;
}
.guildPicture {
border-radius: 64px;
width: 100px;
height: 100px;
border: 1px black solid;
}
.guildText {
font-size: 1.5vw;
padding-left: 15%;
padding-top: 5%;
width: 100px;
height: 35px;
}```
oh
usually gives a circle 100% of the time
getting this on my laptop now
also are you sure you want font-size 1.5vw?
its just to hold onto it for now until i start styling the text lol
idek what i would set that too some article i found said to use it
the circle is like that because of the text padding
removing it just moves the text
you're giving the text a fixed 100px width plus 15% padding, that padding will be added to the fixed width, making the total width bigger than the 100px of the circle
removing the padding does nothing but move the text out
and on laptop the same thing
then you have some other shit going on lul
i have this which affects the size of the circle
issue is when i try to use perfects it make literally no difference
check out the fiddle i posted above
i would put the text inside a div with 50% size
circle => width: 100px
divInCircle => width:50%, display block, text align center
textInDiv => overflow: hidden, text-overflow: ellipsis
something like that
mmk ill see
margin 0 auto, and some fiddling around
to center it
there are many ways of doing it
im adding little tool tip things to pop out the name on hover and theres these lines idk what they are and how to get rid of them?
nvrm found out
I have a stupid question can you use more than one API with a discord bot
@earnest phoenix what does that mean
like if i want to use discords API and then another API within the same bot
That's possible but you will have to use HTTP libraries
is it possible to use both of them at the same time?
One message removed from a suspended account.
you can run as many things as you want in the same process
as long as you have cpu/ram for it
the only restriction is that you cannot bind to the same port multiple times, but thats only relevant if you're running multiple webservers or similar
I'm trying to brush up on my long-forgotten react skills... what am I doing wrong here?
https://gist.github.com/SinistreCyborg/c72a159dddc5b5427921dc9b733607b3
Nvm I just misunderstood the JSON result from Reddit
It goes json { "body": { "data": { "children": [ "data": {} ] } } }
I forgot that data object within the items of children
HTML is easy, CSS is the hardest part
css is not that hard
technically js is harder than css, because js is an actual programming language, while css isnt
css is your best friend when it comes to error handling
what are we talking about exactly
that was react
also css is easier than html
all you need to know is the syntax... how css selectors work, etc, and maybe some functions like translate(), etc... rest of it is just looking up selectors and what they do in the docs
no way html is harder than css, html is literally just tags inside tags
css can be really ass
If you think HTML is no more than just "tags inside tags", then CSS is also just "properties for selectors" @quartz kindle
what is css and html, I just use pen and paper
Lmao
"HTML" also encompasses web standards like open graph protocol, SEO, and memorizing how each family of browsers and engines render different tags and which ones they support in the first place...
JavaScript is a lot more than just variables and if statements. Similarly, HTML is a lot more than just nesting tags.
CSS properties and flexbox and CSS grid are all really intuitive concepts that any serious person can pick up in roughly a day of solid learning.
css is definitely more complicated than html
everything that you just said about html applies to css twofold
you have to know even more properties and even more about browser support
If people wanted to donate money to your bot, what would be a good method to go about this, is it even possible, I'm assuming it is, or should it be more of an external thing, like on a website, you could click donate for example
@earnest phoenix I use https://ko-fi.com for one time payments / tips. Patreon is fine but the integrations with discord suck ass and they clip off a significant chunk of your earnings. For subscription, both groovy and mee6 use https://www.chargebee.com/. I haven't worked with them at all but nik is very helpful and I'm sure he is able to answer any questions you have.
There is also donatebot
thats gae
Thanks spider
you should use those <> things
@low wasp I would warn against any/all usage of donatebot
How to show this?
Post your server count, refer to API docs for more info
this is real odd, some song ids return data fine
but.. some dont?
ok turns out it's a 403 from cloudfront.. ok
vtandard Time)
(node:22275) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
where am i ment to look?
@unreal junco update discord.js / check your token
How to I make my but say he is playing (whatever)
What library
Discord js
What version
Newest
Master?
I'm lost, what's master?
I need help :(
woah surprise
ikr?
Wait wat you mean run discord.version
@narrow kettle what version of Discord.js are you using?
11.5.1?
12.0.0?
11.4.2?
Probably 11.5.1?
i have an avatar command and I want the embed to be the coulour of my bot, how tf do i get my bots colour i'm like retarded rn
I'm not home rn so I can't check
What version yasmoon
Should be the most recent one tho
of 🅱iscord.js
@narrow kettle look into this https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setPresence
Second one is more recommended since the first one is deprecated
Tnx
the newest I guess
@granite tartan you can check for the bot's highest role (<GuildMember>.roles.highest) and then just use .hexColor
And set that color for the color of your embed
but be careful because the highest role doesn't always have a colour
True, so you can add || <A hex color you like>
assuming people always use
messagesmh timo
shush
I did read a lot
and I couldnt find shit
but thanks thats what I was missing lol
@sick cloud oh well excuse me
msg.guild.me
message.guild.me
yardim.guild.me
myfunnyvariable.guild.me
oh right
messageum.guildum.meum
then it's msg.guild.me for you
Yep that works
cant wait till I'm a proper bot dev in here and dont have to live off from others adding me to their bot just so I'm not a white name 👀
How to do serialization? to make a backup system
explain better
which language, library, database, backup of what, serialization of what?
javascript, json, backup servers system, serialization of servers datas so that after being able to restore them
you want to backup the entire server?
most vps providers have backups
or you can just copy all your files somewhere, or setup something like google drive
Backup servers discords
you're not making any sense
you mean guild configuration?
like prefixes and member settings?
store them in a database
like sqlite
save it in a database
The goal is to be able to backup the servers and restore them
Yes
I know this lol
you can use JSON.stringify with a filter
Yes, I was planning to use json
or you can use one of the many json serializers on npm
But do you have any idea how to backup a server?
make a table for backups, give it columns like "guildid","timestamp","data"
then store them in that table
Hi the team
I have a problem with my bot, which would be where it came from ^^
Can you show us your 'help' command?
me is undefined
Lol
He use the atlantabot source
yes
You won't be able to publish your bot because of the use of a source
she is sharing ^^
hiiih
so you copy paste it
hi
Even, a source betting on another bot brings the rejection of the bot
oooff HI
hey
Your bot will be refused.
not me
can you please stop using caps
how old are you again
im 14
How is he still on here?
this channel is the funniest shit ever sometimes
@mossy vine lmfao
yes i am aware, anyways what do you need help with in <HTML>
yeah
arrow buttons huh
Lmfao
what?
wait you dont even need the img
const mongoose = require("mongoose");
const botconfig = require("../botconfig.json");
mongoose.connect(botconfig.database, { useNewUrlParser: true }, err => {
if (err) console.error(err);
console.log(mongoose);
});
const Money = require("../models/money.js");
const Bank = require("../models/bank.js");
exports.run = async (client, message, args) => {
const user = message.mentions.users.first() || message.author;
let amount = args[1];
Bank.findOne(
{
userID: user.id,
serverID: message.guild.id
},
(err, bank) => {
if (err) console.error(err);
Money.findOne(
{
userID: user.id,
serverID: message.guild.id
},
(err, money) => {
if (err) console.error(err);
bank.bank = bank.bank + amount;
bank
.save()
.then(result => console.log(result))
.catch(err => console.error(err));
money.money = money.money - amount;
money
.save()
.then(result => console.log(result))
.catch(err => console.error(err));
}
);
}
);
};
module.exports.help = {
name: "deposit",
aliases: []
};
When i deposit for example 1000 it outputs me that
just add a background-image property with css to the div
this
where did you find that
Logic
okay.. right click the image, click copy link address, and use it as your background-image for the div
it needs a function on click
@stray garnet make sure amount is a numbero
well uh i just throught that myself
bruh
Uh how can i check that again? @quartz kindle
lose my brain cells
@stray garnet Number(amount)
i dea
Please learn proper HTML
can an a tag have a background image? if yes, you can just use that instead of the div
problem fixed
And then do it
cool
i can use this imag as hyperlink then it will go ti next page
lol IM SMART
THUG LIFE
yes thats what i was about to say
..what
?
lol
Tone down the cringe lol
Also, #memes-and-media exists
though NICE
If you dont have any more development questions, you should probably move therw
-m @near igloo shitposting and spamming in #development | 3 days
🤐 Muted Pgoldy#0229 (@near igloo)
thank you
Oof
probably 12 might agebait later idk
lmao
What do you mean
So it shows me undefined, and i need to delete now data out of my Database, hoe can i do that
Cuz before i did that it was 0
You probably have to loop over all entries and update them all to 0
In sql its easy to do that, idk mongo
Any of you have a guild about how to clear cache?(I'm using glitch until bot is done so I'm realy limited with space and such)
Probably v11 lol
Nah it's master
@sweet oak
eb.addField("Shards:", e.getJDA().getShardInfo().getShardTotal()+"", true);
eb.addField("Current Shard:", e.getJDA().getShardInfo().getShardTotal()+"", true);
That's a drastically different edit lol
'e' is the event, so whatever you created the event object is
I copy pasta'd from my info command and grabbed one of the wrong lines.
@marsh frost thank you I'll try that
It's pretty straight forward
yep looks like it !
Do collections and maps really use up a lot of ram, because I seem to be experiencing higher ran usage after using them, djs btw
They probably use more than arrays and objects
const mongoose = require("mongoose");
const botconfig = require("../botconfig.json");
mongoose.connect(botconfig.database, { useNewUrlParser: true }, err => {
if (err) console.error(err);
console.log(mongoose);
});
const Money = require("../models/money.js");
const Bank = require("../models/rp.js");
exports.run = async (neko, message, args) => {
const user = message.mentions.users.first() || message.author;
if (!args) {
return message.reply(`Why you wan't do Deposit Air? Enter An Number`);
}
const A = parseInt(args[1]);
if (isNaN(A)) {
const embed = new Discord.RichEmbed()
.setAuthor("Error: isNaN")
.setColor(0xff0000)
.setDescription(`The Argument **${args[0]}** is Not a Number! Please enter a valid Number for the amount of Coins you want to gamble.`)
return message.reply(embed);
}
message.channel.send(A)
Bank.findOne(
{
serverID: message.guild.id,
userID: user.id
},
(err, bank) => {
if (err) console.error(err);
Money.findOne(
{
serverID: message.guild.id,
userID: user.id
},
(err, money) => {
if (err) console.error(err);
bank.bank = bank.bank + A;
money
.save()
.then(result => console.log(result))
.catch(err => console.error(err));
money.money = money.money - A;
money
.save()
.then(result => console.log(result))
.catch(err => console.error(err));
}
);
}
);
};
module.exports.help = {
name: "deposit",
aliases: ["dep"]
};
it dont saves anything. help
maybe its just the way I do it but don't you need a file[object] kind of thing first
or maybe im not understanding
but
i tried
oh true
Still @quartz kindle
Then idk, log bank and money before and after adding A
basically im using a command handler, fs.readdir("./commands/", kind of thing, should that actually be placed inside the ready function, so they are all gotten on ready? Or should I keep that outside of other functions, again, discordjs
How do u create a premium Command after we click the emoji
How to make it another embed
@earnest phoenix
Or anyone can help me
don't @ me for that
@earnest phoenix it doesnt matter afaik
just because i'm an embed god I'm not gonna help smh
oh
thats good
@buoyant onyx I use https://ko-fi.com/ for one time payments / tips. Patreon is fine but the integrations with discord suck ass and they clip off a significant chunk of your earnings. For subscription, both groovy and mee6 use https://www.chargebee.com/. I haven't worked with them at all but nik is very helpful and I'm sure he is able to answer any questions you have. I asked a similar thing yesterday, spider sent this
But I saw some people they make like then add an emoji check mark for payment after that it automatic activate
The premium
How to do then
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
what do you want to do exactly
The premium funtion
For the premium user
And blocked some command for normal user
Thought they wanted a collector function
Wait I got some screenshots
How they make like this
This just some thai bot maker
They have there cpu
And memory usage
The link you send can refer right @mossy vine
wha
And then how they make database inside the visual private sefver
Server
I want to make the level bot also
how long have you been making bots for?
5month
That's a lot of different things you want lmao
^
😂
Is there a specific reason maybe internally that my bot keeps restarting randomly for no reason.
I thought maybe there was something before I go yell at the other dev
are you using glitch/heroku/free hosting
yeah there could be hundreds if not thousands of things causing that
maybe there is a loop running that calls process.exit
Cry I’m using a shared virtual machine.
Just keeps going online and online for no reason
Process.exit is the restart command Cyber
is it just gateway disconnects?
Hi , is rainbow roles against TOS?
yes as its api abuse
What if it’s at 60s
it is still abuse
2min,
bruh
Bro you're too fast.
rainbow roles with a big delay aren't api abuse... or rainbow roles at that point
Ok, so I’ll have to wait. There’s logs I can’t see on my phone
Seems to be on server.
So I can do 1min
It says 10 on one and 9 on the other login.
Would that mean a server is having issues?
So am I allowed do 1Min ??
Ya now I’m hella confused
Are spaces in channel names allowed or is it considered api abuse? I've seen a few bots doing this and was wondering if it's even allowed
Edit: pretty sure it's just some unicode character
Is it possible to use a command to make all members in one group active in another?
Yeah you can lol
It's not a space then
So it's allowed?
I dont see why it wouldnt be
is it an actual space or just a dumbass unicode character that looks like a space?
But tbh not sure
Ok lol
All it does is make it hard for users to mention.
Its a unicode character, you can do many cool things with it
(also abusive things)
http://jkorpela.fi/chars/spaces.html discord doesn't check for 90% of these
i mean, the client does, the api doesn't
Gotta be careful though, some phones (mine lol) render them as x boxes.
The char im talking about is not in that list
are you referring to zalgo text
Nop
huh ok then 🤷
the same effect can be accomplished with the chars in the list if your aim is to just have spaces in channel names
@earnest phoenix rainbow roles of any kind are frowned upon. the only one that I have seen a developer approve of is one color per day.
lol
const mongoose = require("mongoose");
const botconfig = require("../botconfig.json");
mongoose.connect(botconfig.database, { useNewUrlParser: true }, err => {
if (err) console.error(err);
console.log(mongoose);
});
const Money = require("../models/money.js");
const Bank = require("../models/rp.js");
exports.run = async (neko, message, args) => {
const user = message.mentions.users.first() || message.author;
if (!args) {
return message.reply(`Why you wan't do Deposit Air? Enter An Number`);
}
const A = parseInt(args[1]);
if (isNaN(A)) {
const embed = new Discord.RichEmbed()
.setAuthor("Error: isNaN")
.setColor(0xff0000)
.setDescription(`The Argument **${args[0]}** is Not a Number! Please enter a valid Number for the amount of Coins you want to gamble.`)
return message.reply(embed);
}
message.channel.send(A)
Bank.findOne(
{
serverID: message.guild.id,
userID: user.id
},
(err, bank) => {
if (err) console.error(err);
Money.findOne(
{
serverID: message.guild.id,
userID: user.id
},
(err, money) => {
if (err) console.error(err);
bank.bank = bank.bank + A;
bank
.save()
.then(result => console.log(result))
.catch(err => console.error(err));
money.money = money.money - A;
money
.save()
.then(result => console.log(result))
.catch(err => console.error(err));
}
);
}
);
};
module.exports.help = {
name: "deposit",
aliases: ["dep"]
};```
it dont saves anything. help
why are you still not using updateOne anyways
Instead of findOne, updateOne or what
instead of your findOne findOne save save mess
Aside from all that, why it dont saves the coins?
i have no idea
:/
When i do n.dep 1000 or sth i need to mention my Bot that i can use my bot again
so?
Hello, may I ask if a bot starts to get a lot of servers, are there any ways to make revenue?
Add premium features that are only available to donators
patreon, microtransactions, web perks
Okay, thank you very much!
I also wanted to ask what sort of results people get from auctions?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
lmao
Just put in lootboxes that require micro transactions where you can unlock random commands 🤣
I was going to make a bot dedicated to lootboxes and fake micro transactions
please name the bot EA
It was going to be called "Surprise Mechanics"
Exports is better than one file
exports?
Apparently "node-fetch" isn't secure, and npm wont let me download (debian linux)
Most developers will have one file per command
"CERT_UNTRUSTED"
wait what... you mean a whole file just for ONE command?
which url?
Yes @narrow kettle
why?
Most developers will use one file per command
isnt it way too much work
easier?
yep
because commands are complex
It's organized
say you have a 100 line command, would you rly want to try and search for another one, it is all clustered at that point
commands can grow large, and having it per-file will organize it
just used npm i node-fetch, the url was registry.npmjs.org/node-fetch
my commands have hundreds of lines
so basicly just so it would be more orginized for you?
yep
You can reload commands as well, turn them off for a time while you work on them, etc.
and more efficient
oh yea, reloading and disabling is good
@short forge wait the npm install itself is failing with unsecure? check your system date
3rd october 2019, time is right as well
i mean... im used to having realy long comands on switch so it feels orginized for me not matter what... is there any benefit from doing it?
npm error: CERT_UNTRUSTED
(i can disable commands with switch too)
@short forge whats your node and npm versions?
i guess so, but making a file for each command feels like it gonna take me days just to make the files... i will have over 60 commands...
probobly well over 100
And then you wont ever find them in a switch command
i have less than 10, but some of my commands take multiple files
the template is 4-10 lines of code, depending on your templating

@short forge wtf
1.3.2 for npm
thats like prehistoric node
12.11.1 is node rn
lmfao
Thats not even version 1
wow raspbian is broken then
i can orginize the switch... i hope, the orginize thing does not matter to me too much at this point... but what are the benefits from making so many files?
i intalled 12 eailer with nvm and it said it was 12
if your operating system is old, then its repository also contains old versions. and node is known to be outdated in most repositories anyway
os is latest in terms of updates
you installed with nvm?
yep
did you do nvm use 12.x.x?
yep
if you dont know then you're not lol
can any of you tell me the benefits that you get from making a file for each command(that swithc does not have)
@short forge try restarting your pi
waht do you mean easier to maintain?
It's typically just regarded as a good practice as well.
Single file bots are commonly looked down upon
file for each command
-proper structure
-easier to understand
-if one command breaks, usually the others wont
-faster and more efficient
-more organized
when you say one command, do you mean lets say, !help (!help commands, !help donations, !help developers, !help bugs...on and on)
or literlly just one of them as !help commands or one of the other once
faster and more efficient thats not necessarily true
Each file can export a help object
My commands have a run, aliases and help
you can do it however you want
You can sort the help by category, single command, or nothing and it will just show all
It's all modular too
i think i will go with a file for each catagory cuz i know i will have well over 100 commands and my bot would look fkd up if i do a file for each command?
command handlers are probably faster since it's not a check every message kinda thing (sort of)
my handler doesnt have aliases, because i dont see a need for them
remember the sort of is important
you cant not check every message lol, all handlers do that at some level
even tho, i will still need to use switch for each catagory, it would just be like 10x smaller switch then the one i have now
Switch per cat?
You can have one folder per category, and one file per command in that folder
switch per catagory
That's a good practice too
cuz rn i have one switch for the whole bot
I know, You don't require to make a switch though.
@narrow kettle what you're refering to as category is just the command itself right? like !command
we refer to that as command, and whatever comes after as arguments
!thisisacommand thisisanargument
we dont usually make separate files for arguments
lets say the whole !help catagory(!help commands, !help developers, !help donations...) or !market(!market list, !market buy)....
but depends on what the commands to anyway
that what i mean as a catagory
Yeah, That doesn't require a switch though.
thats what we refer to as "command"
oh, i was thinking that you mean just ONE command, like !market list
i would refer to that as "market command" with a "list" argument
but its still fine if i use switch for each catagory right? (each diffrent command file)
im new to java script so its not like i know too much about other commands
so i will probobly stick to that for now, thanks guys!
my first bot was also a gigantic chaotic file, everything felt much better after i started splitting the code into smaller files
its something you do to feel good about it, and feel more organized, not to please anyone, and not for performance reasons
i feel like even after spliting it all it would still be some how chaotic but meh, at least less chaotic then just one file
its still a step forward, slowly you learn how to organize it more efficiently
do any of you have guilds about how to make "items", "charcters" and such on discord.js
or a big project like this would realy be no good as first project?
guilds?
yeah, guildsm tutorials, what ever teach me how to do it
RPG esk games?
also, there are better things to do than a switch statement
kinda
like?
@warm marsh basicly is make a bot somewhere between @earnest phoenix and @earnest phoenix but with original content(that i thought of) and it would be based on anime
and ik it would be a big project so yeah... i gonna have a bad time
That would fairly easy, Just your imagination that would make it severely challenging.
As you can always ask for code sided help within this channel.
i already thought about the whole bot and system, even tho i dont have any idea how to code most of it
like, market, monsters and warriors appering... exploring(to get items)
one common example that most command handlers do looks like this ```js
client.on("message", message => {
// do basic checking like bots and prefixes
let cmd = message.content.slice(prefix.length).split(" ")[0]; // example for extracting the command from the message content
if(commands.has(cmd)) { commands.get(cmd).run() }
});
then all your commands are organized into a big Map() object
and you dont need a switch to check each and every one of them
Map, Aren't collections better because of their extra methods.
you just check if the map contains it, and then run its code/file
collections are maps, if you need the extra features, use them
if you dont, then stick with maps
i mean, it doesnt matter, but you're bloating your code with unneeded features
mhm
my first attempt at a command handler was way more rudimentary than that, it was basically an array of commands
commands = ["command1","command2","etc"];
client.on("message", message => {
if(commands.includes(cmd)) {
// run command
}
})```
i basicly have only 3 of my most simple commands and it takes like 100 lines
Oh no.
I mean, that works
anything that takes lots of if/else or switch entries can be converted into some sort of looping
but luckly, i got experince with c# and java so i know programming, just dont know to much about javascript
so i can use stuff like [] or switch or stuff like that
I currently loop through every file inside my commands folder, if a "command" equals one of the one in that folder it runs that command
of course, if/else/switch are faster than loops, but you probably dont need those extra nanoseconds, and you can potentially reduce your line count by thousands of lines
Are maps faster than loops?
maps.has() (checking if a map contains an item) is a loop. it internally loops over all items looking for a match
same with array.includes()
i do it cuz im more used to it and it feels comfortable
by chance you're used to it because of Java?
that too, but even more from c#
of course you can also go the traditional way js for(item in array) { if item matches, do stuff }
or even for(i = 0; i < array.length; i++)
Probably should break if matches.
yeah
in my case, i had no idea where to put a certain condition in the switch, so i just putted the condition in if
(the prefix condition)
thats fine
Depending on the amount of commands you have that can get very hard to keep track of.
what im talking about is trying to match a long list of things, in your case a long list of commands in a switch statement
my bot do feel kinda slow tho... anyreason or its just my server? (half gv ram)
you can safely devise a way to do that matching in a loop instead of a long switch
Your bot won't use half GB ram unless you're doing something mad.
my bot uses 60mb on 1600 guilds lol
D.Js?
oh boi, that means i will have ot buy a server at some point
but because i made a heavily optimized lib for it
Cough heavily modified discord.js Cough
yes, it runs on d.js as a base
Nice.
One message removed from a suspended account.
lib?
I lost all interest in bot development so I just stopped.
One message removed from a suspended account.
sure, its on github
One message removed from a suspended account.
but it may break your bot
One message removed from a suspended account.
lul
yeah but how do you use it? is it like ytdl and such?
What version of base djs?
timotejroiko/djs-shenanigans
My bot uses 300MB of RAM on 900 servers, but it's a music bot
v12
While playing music on 7 servers
brb :/


