#development
1 messages ยท Page 332 of 1
bots can't speak here
also
@prime cliff @trim steppe @jagged plume discord fucks up presences for sharded bots if you can see more than one shard
Ah ok
If you don't know already (I think you should):
One astrick (*) at the beginning and end of the word makes it in italics. EX: Bots are fun!
Also,
Just telling you.
๐
do you mind
this is for development purposes
and from what i know you're not a bot developer, web developer or even a roblox developer
In regex, how would you replace _ or - with spaces?
What language?
String.replace(/[_-]/g, " ")
or that
I already got it ignoring the IDs and idk where to fit that
String.replace(<@!?[0-9]+>/g, ' ')
i still need help lol
@lime falcon
no
now you have to use _ or - for a space between words in captions of the picture
like this: it is now ppmemegen top_caption | bottom_caption instead of ppmemegen top caption | bottom caption
If you want it to do the same as the above, but also replace [_-], then you just need to tack on |[_-] to the existing RegExp
String.replace(/<@!?[0-9]+>/g, ' ') // Matches a mention, replaces with a space
String.replace(/<@!?[0-9]+>|[_-]/g, ' ') // Matches a mention OR an _ or - and will replace either with a space
Welcome
Welp. I honestly am not a JS master and I'm not sure what kind of error that is. Aside from 'The Promise errored'
ok i see
internet is rip
I have a question xD : how do I get my bot's client ID?
Thank you
np
f**k you ISP https://circuit.is-the-me.me/5089ea0.png
what
can't install eslint
npm i -g eslint
gib errors
errors are for nubs anyways
ive been stuck on this one fucking thing for a couple hours now and if anyone could lend a quick hand that would be splendid
basically i want
http://my.daddy.solace.is.a.thiccbit.ch/47030.png
this to somehow return the invite code as a string
createInvite returns a promise
so you'll have to await it or use .then
@languid dragon
var invite_code = client.guilds.get(users[1].details.server).channels.first().createInvite().then(e => console.log(e.url))
Should work
I dont wanna console log it
I wanna store it as a variable and use it somewhere else
var invite_code = await client.guilds.get(users[1].details.server).channels.first().createInvite()
do that
Ok ill try after my shit
^^^^
Thank dad xox
yes
๐
@tawny lava i fucking love you, im so annoyed that all i was missing was await LMFAO
if only i could get those 2 hours of my life back
lul
lmao
np xd
lmao
@sinful meadow JS and Java
Mind helping me real quick
ok
๐ค
Do you tag by ids?
Explain why you want to do that
I dont know
yes
To create a tag, not sure how embeds interact with role tags, but that's how you'd do it
kek
How do I fix this? Error: SQLITE_BUSY: database is locked. I have shards, discord.js
I know it means that your database is opened some where else, but I don't know how to fix it.
@neon pasture Discord.js creates a process per shard, and if you have a sqlite connection for your bot.js file, that means you're opening an SQLite connection per shard
Make a standalone class
in c# that would be a static class
dunno in other languages
Using Discord.js sharding, I believe you can't.
You might be able to work with multiple connections at the same time though, I think @earnest phoenix mentioned it being possible to have multiple connection as long as they're all SQLite
They are all SQLite connections
Yeah I'm not sure myself, but if you're getting that error I'm lead to believe it's not possible to have multiple connections
but SQLite locks the database for a short time when is something changed.
So you would have to do what Erlite is doing and add your own IPC framework to the Discord.js shard manager (which is going to be a massive pain in the dick)
or Find out how to have multiple connections somehow
or Pick a new database that doesn't use an in-process connections
or Use Eris
When I use Eris, I can still use SQLite?
fuck discord.js, hello Eris
Ay. I used to use Discord.js for all of my projects, honestly it's a pain in the dick for bigger bots.
Was trying to work with Eris, but it's hard to understand.
It is quite a bit more raw, yeah. Discord.js has lots of utility to make it easier for you.
Dont use js then
I made one command, just a simple embed. Took me 2 hours.
I just moved to Eris on my main project yesterday - the libs are quite a bit more similar than you'd think
in .net it would be as simple as adding the static keyword to a class lol
Most of it is changing msg.guild to msg.channel.guild and msg.channel.send and msg.channel.createMessage
But I like that you have a cooldown funtion
What else?
isn't commando fine?
The CommandClient thing is 100% optional
you can use it if you want to, I don't like it
Simplicity isn't my concern, it's just a thing I'd way rather do myself than have taken care of
How do u purge msg from a user
ban the user
Ye thts wsy but im mking a purge cmd
python ftw
how do I send a message to a certain channel in Discord.Bat?
How to set that a command is only usable with a user that has a cerrtain role?
Anybody got a bot were on a command it set a role
Discord.js
Set a role? What you mean
Like ~>bb (task: set role to user)
Add someone to a role?
;(cmd)
Added user to role
But in a cutom command
Thats easy on discord.js
Like ;updates on
Or ;updates off
I dont want that im looking for a bot that does it
Idk what you mean
๐คฆ
Ur explaining it like your talking with mouth closed
I want a bot where you can set a custom command like update on/off and it sets/removes a role from them
There i dumbed it down for you
Ok?
Still dont get it do you
What tou mean by update? On/off?
You have the AI of a fish
-_-
Omg why did it come a "?" i meant what do u mean by update on/off
That has nothing to do with ut
My keyboard sucks
Well there r many bots which can set a role
You mean like a self role?
hey guys if anyone is able to be a bot dev in my server (needed only one command else u want to do more) then DM me, thanks
@neon pasture It is possible to use SQLite on all shards
It worked great for me
I don't know why you are having an issue
When I did have SQLite at one point, I don't know if I had multiple shards or not... ๐ค
What I meant was my bot was sharded, but I don't know if my bot had more than one shard.
Eww autoshard
message.channel.fetchMessages({limit: 100})```
How can I make it so the bot can fetch more messages than 100?
You cant
The hardlimit on Discord is 100
@earnest phoenix did you use discord.js?
alright
const amount = 250;
let lastID = msg.id;
let messages = [];
var nums = [];
while (amount > 0) {
nums.push(Math.min(amount, 100));
amount = amount - 100;
}
function next() {
msg.channel.fetchMessages({
limit: nums[i],
before: lastID
}).then((msgs) => {
msgs.map(v => messages.push(v));
nums.splice(0, 1);
lastID = msgs[msgs.length - 1].id;
if (nums.length > 0) return setTimeout(next, 0);
messages.map(m => {
m.delete();
if (messages.indexOf(m) === messages.length - 1) {
msg.channel.send({
embed: {
title: "Pruned!",
color: 3066993,
description: "Pruned `" + messages.length + "` messages."
}
})
}
});
}).catch((error) => {
// error
});
}
next();```
@lethal sun
I haven't tested this, but it should work
the amount variable should be changed to the amount of messages the user wants to prune, so an argument
wot
go away
lul
Is it possible in discord.js that it writes data to a .json file? Im using this for custom commands that are addable
K
And JSON has memory leaks.
not if you do it right
but still, do yourself and all of us a favor and don't use json files as a replacement for a db
so just a quick question, so Is it like possible to set up pm2 so I push my files with git into it, and then I can restart and it loads the changes? If so how do i set it up/links?. (Please mention me)
you can just make an command what execute git pull and then exit the process so PM2 restart it @clear kernel
From inside the bot or like on webhook or something
ok so just exec git pull and then wait and restart? ok
exec git pull wait until its done if no err => process.exit so PM2 will restart it
or you can use --watch, but that's less than ideal
yea
yeah i use nodemon earlier, but I don't want to edit files and then auto restart and fuck up someone using the bot (even tho no one uses it )
nodemon is shit
how
hmm worked fine for me
It works sometimes
never tried nodemon, never had to, pm2 is pretty gud
^
ugh my whole setup is weird. I'm dev locally, with a local version of my files on my computer. Then I SFTP upload to my vps, and I also with vs code can git push to bitbucket.
Now uh how would I set it up so (vps) reads from bitbucket remote repo (using git pull/fetch)
@trim steppe My bot has changeable prefix [prefix X you can change it to something not starting in [ to fix the issue
#mod-logs
Case:982
no.
and how i can solve that?
fix your scuffed code
I fixed the issue @trim steppe .the bot will send this message and i will get deleted after 5 seconds. Is it ok?
vps reads from bitbucket?
@clear kernel you mean so it would auto sftp?
No
Kinda yeah, like I want it so once I type a command ;update or something it will automatically pull the changes and restart
Don't error to the user
Ok
Error to you
@clear kernel ohhhhhhh
i do something VERY similair actually
I use a docker container i made to run my bots
@void phoenix
@unique bronze
i need help with a eval command djs v.12
so i can just do docker restart spacebot and wait like 10secs done updated.
There fixed @trim steppe
hmm I tried reading how to make it a remote or shit but didnt want to cause master already defined
What does it do now
nothing
O.o
I think i was just doing it wroing or soemthing
yeah
I think I'm doing something that I really don't need to do (clone into a non-empty dir)
I really only know how to very basic git -_-
mhm
shit i need to prob disable the sftp upload
well fuck, I also did git in the wrong directory
jackz@vps137730:/var/node/untitled$ git remote set-url origin https://Jackz@bitbucket.org/Jackz/insertbotnamehere-code.git
fatal: No such remote 'origin'
(i just did git init above)
should I do git add instead? Ok.. Let me try doing this. I think i got it down?
Ok. So I did:
git init
git remote add origin <the link>``` and tried doing ```git log```
but it says your current branch 'master' doesnt have commits
So I assumed that, somehow master !== origin, and did:
```[branch "master"]
remote = origin
merge = refs/heads/master``` and same error
I'm just simplying trying to make the main branch be a remote branch to bitbucket, which i can git pull.

thanks for the help
no prob
i still cant make server_count work
my api page doesnt even have a server_count thing
wait do you have to be certified before you can start using server_count ?
no
then why doesnt mine work..
i didnt though?
post code
async def post_stats():
await bot.wait_until_ready()
while True:
num_servers = len(bot.guilds)
headers = {"Authorization" : config.statToken,'Content-Type': 'application/json'}
data = {"server_count" : int(num_servers)}
url ="http://discordbots.org/api/bots/340354052715970563/stats"
r = requests.post(url, data=json.dumps(data), headers=headers)
print(r.status_code)
asyncio.sleep(3600) #1 hour
it doesnt return any errors , it tells me it worked
weird
it simply does not work
cough /stats cough
no idea what you mean bty that
but i do see a #312614469819826177
which is new
so ill try that
after adapting it because the py3 version isnt using extcommands...
yea...when i added it to my code it was new and the #312614469819826177 channel didnt exist..
also like the reaction images say these are blocking calls so i have to write around that and i dont know how
exec git pull wait until its done if no err => process.exit so PM2 will restart it
@restive silo The problem is, what if there is any local file changes? I don't want to overwrite them. I don't think its efficient/correct to commit locally and merge, (kinda a noob at git)
I don't think git pull --hard is correct either?
i appreciate the total lack of help tho guys thankz
@clear kernel just do git pull and its fine there is no efficient bonus at all from merging local
ok but local changes would be fine? like a new file or a temp json db ?
(when i do git pull --hard, as I need to)
why do hard
just do a git pull 
I can't
why
Updating 6e64227..e1102a8
error: Your local changes to the following files would be overwritten by merge:
package.json
Please, commit your changes or stash them before you can merge.
Aborting
i did edit package.json on my vps as I couldn't do it from local (issues with installing packages)
oh wait, wouldnt the .gitignore on .json file not affect that?
Do you guys know in js whats the code to remove all roles from a user?
@clear kernel oh well then do -hard i guess
Ok. I got the whole git thing setup, and now down to the code update system. Getting fatal: Could not read from remote repository. 3|InsertBo | Please make sure you have the correct access rights 3|InsertBo | and the repository exists. . It works fine from putty: git pull origin master
do I need the ssh key somewhere else for nodejs?
Can you use MySQL with sharded Eris?
Umm
I use SQLite, and when you have multiple connections, your database will be locked.
So was thinking it's the same with MySql
MySQL has a server and uses querries so that shouldn't be a problem

SQLite dont have a server
SQLite isn't made for concurrent access
it's made to be embedded
for small applications to store their data
Ok, I tried everything to get git pull origin master to work. Works fine from putty/ssh, but from node exec it just says the error i sent above. I have added the private key to ~/.ssh/id_rsa
Somehow my permissions aren't setup for node exec, thats all i know -_-
Just curious with d.js does the autosharders do it at a certain number of guilds?
does pm2 not auto git fetch???
They can if they want @delicate zephyr
Yea, Im just wondering if it has a default @sinful meadow
No
I mean
you can if you want
But if you want you can creat a AUTO shard script
or function
@earnest phoenix are there any good imaging libs for Java?
i'm sorry to disturb you if I did
ok
thank you
you just prevented me from switching to Python @inner jewel
(that's a good thing)
i am making a blob emoji avatar cmd
Question, what is the purpose of the Embed 'provider' field?
Can someone help me out
How would one check if the youtube video is a live broadcast on youtube through the link
JavaScript
either use the yt api or do some scrapping
@delicate zephyr cannot through the link, but if you use the api/whatever, it returns a weird lenght
like 9 quantillion ms or smth lol
or -1, don't remember exactly what the api gives
@cosmic plover I got it
Im using youtube-node module
got it working after like 2 hours
pat
Im sad because I was trying my best to avoid fixing this bug
then 60 people complained at once
notlikethis
would anyone be able to help me possibly with doing self assignable roles?
i have the storage part set up already i just can't get the role assigning to actually work
i'm using discord.js/klasa

I need some help with this exec command. when I try to exec anything, no output comes out
here's code:
const { exec } = require('child_process')
const settings = require('../../settings.json')
exports.run = async (client, msg, args) => {
if (msg.author !== settings.ownerid) return;
exec(args.join(" "), function(error, stdout, stderr){
try {
msg.channel.send(`\`\`xl\n${clean(stdout)}\n\`\`\``)
} catch (error) {
msg.channel.send(`\`\`xl\n${clean(error)}\n\`\`\``)
}
});
function clean(text) {
if (typeof(text) === "string")
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
else {
return text;
}
}
}
nah, it's fine
exec(args.join(" "), function(error, stdout, stderr){
let result = (stdout || stderr);
message.channel.send(clean(result), { code: 'xl' });
}```
try that
thanks, lizard
np
Can someone answer to me why the fuck this doesnt work ```js
let a = parseInt(args[1])
if(a === NaN) return message.channel.send('test')
@low niche ?????
isNaN(a)
np xox
@tawny lava still not working
what error do you get? 
wyd
it would do the same
my whole exports.run:
const { exec } = require('child_process')
const settings = require('../../settings.json')
exports.run = async (client, msg, args) => {
if(msg.author !== settings.ownerid) return;
exec(args.join(" "), function(error, stdout, stderr) {
let result = (stdout || stderr);
msg.channel.send(clean(result), { code: 'xl' });
});
function clean(text) {
if (typeof(text) === "string")
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
else {
return text;
}
}
}
try it without the clean function
not sure if it will make a differnece tho
probably not
but taht looks correct
still doesn't work
i fixed
just need to remove the [object Object] msg on outpt and error
here's code https://haste.passthemayo.space/fifitejojo.go
now I'm trying to remove this https://circuit.is-the-me.me/2eb9dc4.png
json.stringify?
it ain't json tho
i tried ยฏ_(ใ)_/ยฏ
if it's an object you can make it into viewable json with JSON.stringify
well it printed this https://circuit.is-the-me.me/7826069.png
print it to the console and then get what you need from the console?
same output
i dont think so i use that for my eval so it shows objects
ยฏ_(ใ)_/ยฏ
you didn't used it properly
I fixed anyway
Anyone use Jimp?
Use canvas
canvas is for web-based javascript not server based?
@languid dragon there is an canvas npm package to use in node.js 
-bots @austere valley
@ember flare
what
that's what i was thinking
Hey guys, in python commands.ext rewrite this command does not work (no error msg tho)
elif ctx.message.channel.id == 364841014239821825:
await ctx.message.delete()```
Anyone knows how to create a leveling system in discord.js? Dm me.
sure i do but there a tons of web sources which tells you how to do

look at anidiotguides
he did some tutorials
Also looking for someone that knows how to do the draw on pircture thing in discord.js
thats canvas
you must install that yourself not an d.js thing more like an node.js package
or Jimp works also

Jimp seems to have more features
Yeah, Jimp is better than canvas
canvas is fine for me tho
does a bot token work for the rest of the site?
dbl toke or discord token?
can i get a eval command d.js v.12 ?
same as one for v11 
someone help me:
i did public static Guild g;
then System.out.println("Command: !!help was used in " + g.getName()); and it errors
java is that btw
Did you actually instantiate g?
sorry I'm new to discord jda wym?
did you assign a guild object to g
o
i think it was <MessageReceivedEvent>.getMessage().getGuild(); idk
simply doing public static Guild g; does not make an object there, you need to set it to a Guild object.
can you give me that what I need to add?
I don't know, I don't use that library
fuck
Circuit mentioned something about the event, probably that
k
how can you do a server count in discord.js
also, how can i add a welcome message when my bot joins a server
use the guildCreate event I suppose
nice idea 7coil
3.5coil*
TRADUZ-ME SEMPAI
traduz-mos
@restive silo ur here too 
๐
I need nytro
nitro*
@trim steppe should i translate "footer_copyright" or nah?
If you can find a word that means copyright, you can replace that
Don't translate and replace legal declarations like copyright, have it in multiple languages if needed
Just advice from not a lawyer
ok moose lawyer
@trim steppe will i get credit$ for the translation, or not at all..? xD
Feel free to add your name inside the help menu, and ask for extra translated aliases for commands to better suit the language's audience.
๐
oh no it's on both
@trim steppe i've done pt-pt.json, now what?
is there anything more to translate?

im sorry you have to edit using the online github editor
wait
wrong person
did you do that tho
i don't think so
when making that, you can add your name at the top or bottom
wow thanks
there shouldn't be anuthing more
send a pull request, and i'll mark it as hacktober if you want a tshirt

@earnest phoenix to get certified, should your bot have a currency of some sort and levels?
like would it help?
if its original and not buggy, it might ยฏ_(ใ)_/ยฏ
๐ค i guess
if i have any tips, make something thats new and people can love, something people want in their server for a long period of time, something people would enjoy and something thats somewhat original compared to the thousands already in here.
OR be better than the original
It's not impossible, it's just gonna take a lotta planning and thinking
๐ค like a discord game?? ๐ฎ
Also if you dont want people copying you, develop the entire bot and test on a private server, dont expose it to public discord bot lists until you've got a stable and complete version you're happy with, yano?
Oh yeah! thats good idea ;3
ill probs use that
WAIT
@languid dragon is it original to do that?
to do what?
the bot thing private
creating a bot in a private discord server has nothing to do with originality lmfao
Cya ๐
Hello can someone help me in making process.exit run by pm2
I am trying to make a restart bot command
My purpose is making the bot stay online 24/7 even when my pc is powered off
buy one ๐
Heroku is bleugh
heroku can't handle almost anything
search on the internet
^^
blame mobile
There should be tutorials on how to do it with the VPS provider
Ok
1
free is worse then payed
Ugh look at my bot fisrt
and free has a lot of draw backs
-bots @shy flicker
@gentle ether
what ??
@shrewd field OVH is so freaking cheap
$3 and good specs sorta
and they have amazing support
ok thanks that is what i have chosen
How do I start sharding on Eris?
Morning everyone
@neon pasture in your eris client options you can set maxShards to the number of shards
you can also set maxShards to auto to use the recommended discord amount
and that is 2.5k right?
discord recommends a shard every 1k guilds, but you don't have to shard at all until you hit 2.5k
and you guys would recommend 1.5k right?
eh its best to shard around 2100-2200, bc u start getting dead guilds around there
Everyone told me to start sharding with 1k guilds.
But where do I place maxShards?
Inside new eris?
Is there a doc for?
Isn't Eris notorious for bad documentation?
eh eris docs are alright
compared to D.js docs, eris docs are trash, but eris docs are fine to me
d.js docs are so nice
I have: maxShards: 2, but it only send the bot.on message once.
Doesn't it need to send it twice?
^
So I can count up all the guilds with client.guilds.size? right?
there is nothing you need to do for sharding specifically other than set your config.shardCount to auto
client.guilds.size
That is so simple then
set maxShards to auto (or your own value) and that's all you need to worry about
way better then discord.js
that's cool
yeah
Thanks for helping me*
don't worry you'll probably have more questions
United States call before you dig
safe digging.
why lol
Why doesn't this return client.shards.size + client.guilds.size; work?
I wouldn't say that's a good way to display them either
right next to each other like that
Was testing
var test = `${client.shards.size} ${client.guilds.size}`; return test;
This should work right?
hey i have an unban command but it only works on one person whom i put his id in and the reason doesnt appear.
how can i make it to unban an id that i put and send the user u have been unbanned from ${guild.name}. Thank you
discord.js?
yep
You know we can't spoon-feed right?
i know
okay good
Wouldn't ask help to me if I was you ๐
He has been spoonfed too much tbh why cant you figure out something so simple?
message.channel.send
send what
ok
What is the error btw?
how can i make it do a person's id
arguments
@shrewd field Let me guess you want to get the banned user by id?
Yea but you want to get the username of a person by banned id
you do message.content === prefix + "unban"
ya
which makes it impossible to receive args
why u need args
i dont get it
split the message content
Oh
on spaces
Oh lol nice one @inner jewel
if the first part is === prefix + "unban"
the id is the second
check if the second actually exists tho
then
u mean
prefix + "unban" then message.content.fetchID
or something like that
You need to get the argument from the message.content @shrewd field
what argument
๐คฆ
can u give examples
I'm so nub lol, I used .client. When I have this: var bot = new Eris.CommandClient.
@inner jewel i explained it to him in a simple way and he still dosent get it ;-;
which way
ok
so i need to do this
let args = message.content.split(" ").slice(1);
args are explained there
what do i do after reading
you edit your code
and add
add what the stuff from there
Hi deni
hi
I finally got custom playing messages to work on my PC ๐
don't keep asking for spoonfeeding, that will get you nowhere
sending a gateway presence update
when i do client.setgame("Playing in 2 servers") it wont work
maxShards: 'auto'
Settings > Games > Select app > Rename > Turn on overlay @shrewd field
ok then
wait why turn on overlay?
ya
Idk but i did and it work so
humans
that's not for bots lul
it's Presence#setGame(Game.of("Thrones")) for me
i was wondering what is for bots
:^)
ok
yeah that
no it won't work for you
that's not discord.js
^
so it won't work for you
what is discord.js
ik
this
read the docs
n.js
i user node.js (discord.js)
read it
client.user.setPresence({ game: { name: "Use--help to get started || Playing on 44 servers" } });
this
hardcoding guild count in the string
i did
you dont put the server count if you want it auto wait and ill look on my bot
i lost my usb...
fu*k
...
This guy is so dense >_<
maybe because setPresence returns nothing
please, go learn JS basics
you'll get nowhere without learning at least that
setPresence returns a promise, which is recognized as an object by Discord.js
if your object doesn't have a content, embed or file key (which a promise doesn't) you have no message content
It doesn't, at least your screenshot there doesn't
I mean what I just said. Read it.
how could i make it have
What do you want the content to be?
im a bot now :P#
ok
What is .setGame in Eris?
beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep
editStatus @neon pasture
Thank you
Do a reaction
D??help
no
D??help
no
gg bad bot
D??help
delete
mmm bot speaks here
LIES
needs mute
...
yes
autoresponds
yes
shitpost mute too
...
same
Wish i never did that
sad
sentient bot
hey
I think I'm doing something wrong bot.user.editStatus("online", "Testing");
SSD 1
better
I only use 100MB
is it enough for a bot
I use 300mb but I have the 4gb ssd 2 for some reason
that is not like a professtional bot
Your choice
send private message in jda?
JDA - Java wrapper for the popular chat & VOIP service: Discord https://discordapp.com
k thanks
What does my playing message say to you?
@earnest phoenix visual studio code v2
ok
How to make so when you start up the bot the console send a message with the server count? Discord.js
or even send a message in a guild with the server count
not dbl server count
@lethal sun not sure but the client should have a ready event that fires
And what computerfreaker said
do you even d.js
token: "token here",
id: "id here"
})
dbclient.postStats("17", (err, res) => {
if(err) {
console.error(err)
} else {
console.log(res)
}
})```
any ide why it shows a error
"17"
because you're using some weird package 
pretty sure in the server count example it says it needs to be a number not a string





