#development
1 messages ยท Page 316 of 1
well too late XD
bruuuh
I am just joking
how did you make your bot then
Lol
XD
** j o k i n g**
Do token leaks always get posted in #moderators ๐
```m.channel.sendMessage(client.guilds.map(g => '' + ${g.name} | ${g.memberCount} + '')).catch(console.error);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected string
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3```
wtf
this was working before
...
eww js
xdx (im so bored rn
Are you concatenating strings? Wut
Good job
took me like 1 hour talking to the devs of discord.js
since noone knew the error XD
xD
really i talked like 1 hour to them
The nobody know the error part is what i was referring to xD
xd
knowing*
it had nothing to do with the error somehow
xlel
mmmmmmmmmmmmmmmmmmmmmmeeeeeeow
facepalm how long does getting a disscord app (from the developer page xD) to succeed? taking me a while xx
d
huh normally this should go instantly (or am i getting something wrong here)
@rustic grove plz fix that string concatenation. Is no good
its good already
gigantic facepalm
@lost crane 5 seconds to open dev menu and create app with token
that includes filling details
u also need to click "Create Bot user " or sth like that
facepalm again

or still struggling?
I'm still waiting for it to succeed so that I can create a bot user xD (the video I watched to get some help went instantly xd)

lul it shouldnt take that long 
ok
so
click "New App"
fill details
and click "Create App"
then you should land on the app page
then click on "Create a Bot User"
in the popup click on "Yes, do it!"
after that where it says "Token: click to reveal" click on that
still taking a while (no app page yet xD maybe its my internet service)
and there is your token
if it's your internet service, how are you on here?
also lul when your app is called "test" https://s.theak.io/p4Xba
rip
meow~

wew your internet must be slow
or lagging af
or you have no internet and this is a dream
************************************************facecooooooooooooouch
ugh
??
No comment please...lel
What do I do now that I filled everything in and hit the create app button xD It's supposed to go instantly right? well its not, so much for even TRYING

๐ค
XD
@earnest phoenix oh hi discod.js is bad
fake
d.js is great if you have great memory control skills
also search for your mem leak code all the time
:P
driving in my car BEEP BEEP
your reason is almost full story
whta
Ee..eris? GOD PLZ NO
@earnest phoenix yes?
thanks for taking a picture of code
its javascript
lol
"eris is a meme"
to who
discord.js is the meme around discord
:waitwhat:
wtf is that ?
(its also javascript like what you i said above)
avait 
@sinful jolt wtf is that?
python
whats the code
@earnest phoenix I am
That's easy.
Data is an array
each value is an object
ez
for (datapacket in <datapacket>) ?
Oh yeah, if it only returns 1 object then use that
^
i use promisified stuff with mysql
what it returns for me is always a row array
but even without promisify with "mysql" you get (error, rows, fields) afaik
but u may use another mysql lib idk
promisified? just make your own promise
Are you using async/await? It looks like you're pulling data which could take a bit of time to deliver to you
why not use full features of ecmascript 6
https://ropestore.should-be.legal/40b258.png
hmm good question
i dont approve that shit code!!!
-_-
module.exports = { query } !!!!
y-yyyyes m-mm-mastterrr 
๐ค
Common sense would tell you no
Do a check
if (results[0] == null)
== null checks for undefined && null
?
if (!results[0]) kthx
everyone has different styles -_-
TypeError: Cannot read property 'roles' of undefined o n line 48
https://gist.github.com/itskiru/137bd6fcd3ba8de039225068583dfbf5
That the log of flairs > args.type & flairs[args.type] https://vgy.me/SJh04H.png
@vital lark I just got an error

That's not really usefull...
Shouldn't type: '' be role 
what's wrong
sure wait
@bitter sundial That the flair : https://vgy.me/Y97seL.png
That log of flairs, settings and flairs[args.type] https://hastebin.com/fanuvisiye.rb
and args.role.id?
@bitter sundial the id.

How can I check to see what servers my bot is in?
Oh. That works too. xD Thank you
I see that someone in the discord.js server had said to do client.guilds.size just like you had but I'm a little stumped on where I would put that to be completely honest.
@vital lark
Just anywhere in the code? ๐
I'll message you the code?
how would i create #312248702733516802 in discord.js?
@fiery goblet Im making a starboard bot called starboat ๐ but if you wanted to make your own have fun dealing with reactions and such xD
im dumb
Yea
Kek
Mfw I've already finished mine 
https://lolis.ml/img-3b869l9Mm54.png Lel that discrim
Mines more of a meme for my server anyway http://i.imgur.com/wI5Ubrk.png
plays all star remixes
Nice xD
-botinfo @weak jay
Library other prefix D: ok that checks out
Other means that it is a different type of programmed bot
That's a redbot clone
well, it's still good for starters
No. you cannot submit clones unless they're heavily edited. These commands are PRETTY similar 
Also, that would make it d.py, not "other"
You can't just disable a few cogs and say it's your own bot
I didn't see that
?
On help command
Well, go look then lol
I have lol
?
Can we not have this discussion.
Yes, thats a clone. Of redbot.
You need to change stuff or it's going to get removed. @earnest phoenix
You can't pass others work off as your own @earnest phoenix
Like, HEAVILY change stuff
Just ban him and kick the bot lol
Damn
I use a few red cogs like the economy but there completely rewrote to use rethinkdb and non blocking methods almost all red stuff is useless for any kinda high guild/user count or any kind of high cocurrency
kek 200k ids in json = 45sec commands
lol gg
@tame rivet the the soft ban on the original mod has been broken forever doesn't send a invite I made a pr long time ago something about needing to be tested before approved still broken ๐
"referenced before assignment"
ayyyy its yuki
i haven't talked to her in like months
@tame rivet i have a non blocking ver of that speed test should i make a pr?
probably, but the repo isnt listed
meh i always searched git hub "red cogs" when i ran a red
i dont think they changed much
same
i havnt followed much
the red server is kinda toxic
i asked for help once was told to google it
ye, but there are some talented devs who i feel are a) lazy or b) being held back
so i deleted red and made my own
ye
bots here?
nop
i need the fecking code to find a server
hmm?
o
no idea
i get by id
!debug bot.get_guild(224946732113330177). default_channel.send('@everyone ๐บ')
ayy they listen here
ye but idk id
you know the name?
guild = discord.utils.get(bot.guilds, name='Mew') sould work if you do
in theory anyway
Anyone else have install issues with libsodium?
discord.js is ๐ฉ
-bots @cyan wedge
@nocturne kelp
-botinfo @nocturne kelp
close ahhhahha
what @fiery goblet
saying discord.js is ๐ฉ and ur using a lib very close to it
eris is ๐ฉ it rips your MEM
there is no
lib
@indigo notch you're dumb
what do you mean "rips your MEM"
have you even compared the memory usage between discord.js and eris
@fiery goblet same language
doesn't mean much
@indigo notch what leaks
tbh
please tell me
mem leaks
2 weeks ago
( อกยฐ อส อกยฐ)
no it doesn't
lel
10k servers and I only use .8gb
if it leaks why are big bots like dyno and tatsu fine with memory
Ruby > js
assembly >>>>>
I don't think the api tells you that
unless
you get how many times an invite has been used and cache that and then check again and see what changed 
^
how do I get my bot's memory usage?

Eris
That's what I actually do with py is cache the invites ๐คท๐ผโโ๏ธ I don't think discord it's self stores the info
@earnest phoenix Your SQLite handler is heavy looking for me. Is it all neccesary?
Or can I write my own that's not as complicated?
I just don't know enough about SQL to know what I need lol
where is the SQLite handler
yay my bot is now 24/7!!!!
congratz
hacker
gratz
Lol, wanna explain it to me then? ๐คฃ
I'm still confused about putting a server counter on the API
Use the first one in #312614469819826177
What's confusing about it 


const exec = require('child_process').exec;
exec(`curl -X POST -H "AUTHORIZATION KEY GOES HERE" -H "Content-type: application/json" -d '{"server_count": "${client.guilds.size}"}' "https://discordbots.org/api/bots/${client.user.id}/stats"`);
Thats what I find
Shove this in guildCreate and guildDelete events
Get key from website
const snekfetch = require('snekfetch')
snekfetch.post(`https://discordbots.org/api/bots/${client.user.id}/stats`)
.set('Authorization', 'UR DBOTS.ORG KEY')
.send({ server_count: client.guilds.size })
.then(console.log('Updated dbots.org status.'))
.catch(e => console.warn('dbots.org down spam @oliy'));
it's already included
dude lol


๐คฆ


๐คฆ


Can anyone help me fix my splitting up the prefix and command so it will work with words and letters
I can only do like a 1 symbol one rn.
let content = message.content;
let text = content.toLowerCase();
let author = message.author;
let member = message.member;
let args = content.split(" ");
let argsLower = text.split(" ");
let command = argsLower[0].replace(config.prefix, "");
just check if it starts with the prefix
let args = content.split(" ").slice(1);
let argsLower = args.join(" ").toLowerCase().split(" ");
let command = content.split(" ")[0].replace(config.prefix, "");```
@fiery quail
content.substring(0, prefix.length) === prefix
if (!content.startsWith(config.prefix)) return;
Its a multifile
make sure you have that
I have that.
ok?
Wait so
if (!message.content.startsWith(config.prefix)) return;
let content = message.content;
let text = content.toLowerCase();
let author = message.author;
let member = message.member;
let args = content.split(" ").slice(1);
let argsLower = args.join(" ").toLowerCase().split(" ");
let command = content.split(" ")[0].replace(config.prefix, "");
yes it does
kek
JavaScript.
wew since when
return "Hi".startsWith("H");```
Evaluated successfully:
true```
copied from java
there it didnt work
even the name is a copy
that's why
fail
sry i started with javascript when ecmascript2015 wasnt a thing
return "Kek".charAt(0) == 'K';```
Evaluated successfully:
true```
ok
import json
import aiohttp
uri = 'https://discordbots.org/api'
class botsorgapi:
def __init__(self, bot):
self.bot = bot
self.session = aiohttp.ClientSession()
def __unload(self):
self.bot.loop.create_task(self.session.close())
async def send(self):
dump = json.dumps({
'server_count': len(self.bot.servers)
})
head = {
'authorization': 'token',
'content-type' : 'application/json'
}
url = '{0}/bots/327955834975813632/stats'.format(uri)
async with self.session.post(url, data=dump, headers=head) as resp:
print('returned {0.status} for {1}'.format(resp, dump))
async def on_server_join(self, server):
await self.send()
async def on_server_remove(self, server):
await self.send()
async def on_ready(self):
await self.send()
def setup(bot):
bot.add_cog(botsorgapi(bot))
ok
Wait what don't that work for you?
the uri
url = '{0}/bots/327955834975813632/stats'.format(uri)
That's what I'm using
Hmm
yeah
yeah
thingy
So that's all right ๐ค
yeah
hmm
in another word
Site issue?
the API isn't receiving it
yep
I mean mine works*
oh
It's odd you'res doesn't
whats the issue?
daddy is the issue
@scenic crest is the issue
ye
@keen anvil
U people are really unhelpful
lol
It's really REALLY not our job to be helpful. Go buy a spoon to feed yourself.
^
Just because you're ginger ;)
Yes
Thing is @keen anvil he is sending Server count that same way I do and getting a 200 but the site doesn't change I tried to help figure it out but I'm at a loss just as well
Anyone know how to use MongoDB and Node.js together?
tons and tons of tutorials out there since MEAN is big in webdev @fiery quail
google is your bff
I did
I didn't see anything
Mabye you can halp <3
Well I found this.
var MongoClient = require('mongodb').MongoClient,
test = require('assert');
// Connection url
var url = 'mongodb://localhost:27017/test';
// Connect using MongoClient
MongoClient.connect(url, function(err, db) {
// Get an additional db
var testDb = db.db('test');
db.close();
});
would that be correct?
There's your problem
you're using Python
switch to JavaScript and you'll be ๐
I hope it's a selfbot
but is it on a seperate account
oh ok
anyways, I've never tinkered with get_user_info()
are you using the pip version?
oh ok
This can only be used by bot accounts.
(this means you have to use it on a discord api application's bot user)
using System.Net.Http.Headers;
using System.Text;
using (var client = new HttpClient())
using (var content = new StringContent($"{{ \"server_count\": {client.Guilds.Count}}}", Encoding.UTF8, "application/json"))
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token");
HttpResponseMessage response = await client.PostAsync("https://discordbots.org/api/bots/YOUR_BOT_ID_HERE/stats", content);
}```
what's wrong here? this thing doesn't work for me.
do they mean by client the http client or
or discord client
Ow
this "/*using (var client = new HttpClient())"
?
well if the "new AuthenticationHeaderValue("token");" "token" should be replaced to the real token and BotId replaced as well
and all the script stay as it is
...
It still doesn't work.
@earnest phoenix what exactly where you trying to do?
It isn't working for me either but then again that's my own fault for making a bot in 0.9.6
update naw then
No cause my current shit doesn't work in 1.0 xD. Already started on a version to update it to 1.0 but I haven't worked much on that yet.
-bots @weak parrot
@outer granite
-botinfo @outer granite
Easy be able to make them commands again
There are more then just the ones shown by the <help command. That is why the bot says <info instead of <help
Plus I don't really mind it too much
About?
It not posting server count
Because someone could always just use the command and see the server count
you need to post server count to get certified
I know but my bot isn't gonna get certified anyway.
same
i know what bot i will make after video calls
pornhub bot that will stream porn over video calls
Sounds like a good idea ( อกยฐ อส อกยฐ)
i want it
keep your browser search history forever safe again with using discord pornhub bot today
no history or cookies or anything more just porn over video call
we arent responsible for any data leaks like who watches porn or other stuff like that
except your Discord cache, which is no longer safe from your parents
how will discord cache leak you are watching video
videos are streamed and dont get saved
Discord stores everything in cache. If you're looking at pictures, they get saved in cache as a random name without an extension
not streams tho
~~pictures go for @woven verge
~~
bbsendnudes
hentai
hentaiheaven
animesexscenes
Whenever I send n my servercount, it says that it cannot send the message
<@&304313580025544704>
@sacred spade If you want us to help you, you must give us more information about what hapenned.
You cant just say "It didn't work"
I was catching errors and then I get "DiscordAPI error: Cannot send message" all of the sudden
Ok?
and don't ping all the mods for that shit
...
and it was that
discord.js uses snekfetch as it's primary way to connect with discord
BUT thats what its trying to send, the server count
but it cant
bc of some person blocking it or something
DiscordAPI error: Cannot send message
This does not mean it can't post to Discord Bots List API
that means it cant send a message to a channel
please use the stackstrace to locate what is trying to send using snekfetch before assuming
sounds like a lack of permissions in a guild
was my bot the only bot who had a high ping and was not working or some time cuz its fixed for some reason now
how to splice?
I'm making an afk command with json database but like the thing is I want to only splice the users afk status not like a whole bunch of them.
splice?
You get the index of that user, and then splice 1
afk.splice(afk.indexOf(msg.author.id), 1)
how do I setup rethonkdb 
tank im thonk that through
I want to create a 'verification' system, when someone changes too many things (ban, server icon, change name role) that ban him...
That's dumb
waddle waddle
But if you really want to create a shitty bot look for event handlers
waddle waddle
yes waddle waddle
@surreal peak An admin/friend of a server asked me to do it
waddle waddle
Can someone help me?
https://cdn.discordapp.com/attachments/331114862652555264/331115007632736267/unknown.png
https://cdn.discordapp.com/attachments/331114862652555264/331115277641056266/unknown.png
My token is right so that when my bot binds this error do not know what it can be
@sullen wasp try going to #312614469819826177 
how in the name of fuck is that authorization?
and still, why 2 headers

@sullen wasp show me the whole code if you have it, without the token ofc
everything looks just so wrong
No need but I was able to connect the token on the site
Ok
hey how i get bot send in 1 chat but not default chat like example #alert-stream chat, im making alerts from streamjar site i want know how make them alerts say in that channel only
@spare spruce what lang and lib
idk how to do this :/
const client = new Discord.Client();
const prefix = 'kk.'
const orders = [];
client.on("ready", () => {
console.log('Ready!');
})
client.on("message", m => {
if (!m.guild) return;
let args = m.content.split(' ').slice(1).join(' ');
if (m.content.startsWith(prefix + 'order')) {
const order_id = Math.floor(Math.random()*9999*Math.random());
orders.push(order_id)
client.guilds.find('id','332086216138686475').defaultChannel.send(`Order: ${args} \norder id: ${order_id} \nFrom user ${m.author.username}`)
}
if (m.content.startsWith(prefix + 'decline')) {
if (m.author.id === '206510551898128384' | m.author.id === '229563674375749633') {
if (orders.includes(args)) {
m.channel.send('test')
}else {
m.channel.send('failed')
}
}
}```
can someone help me
the decline part
it responds with failed
;-;
its discordjs v11.1 @earnest phoenix
._.
?
@rustic grove learn js thats how2 fix :_;
^
@spare spruce well find or get that channel id and use it
Anyone using socketio and flask?
No.....?
@keen anvil Choose the cheapest one
Node.js uses almost nothing
I am running 3 bots and 3 minecraft servers on my VPS, and only using 0.25% CPU usage
but you have a god vps
No
send me a thing to check cpu i want to check howmuch mine uses ;3 ( me no has pm2 )
but i have allt of other things running too
Ok also running a music bot
i think dst server web thigns and stuff
I'm*
node & my bots are taking up 0.01% CPU and 0.5% MEM
;D
and one of my 2 boats has been up for 6 days ;3
require('os').loadavg()[0]
0
Yea
s*eval require('os').loadavg()[0]
Lol
nice
i mean selfboat
wuts on ur vps?
Input:
require('os').loadavg().join('\n')
Output:
0
0.02587890625
0
Input:
require("os").loadavg()
Output:
[ 0.31494140625, 0.25341796875, 0.20458984375 ]
require('os').loadavg().join('\n')
0
0
0
Mmmm
hmm
cuz it's only my selfboat on it
@earnest phoenix my CPU usage is at max lol. When you have image generation, music playback, and spam it tends to go up
@earnest phoenix they're the same price anyway lol
I probably have to get a vps for my bot
Is that wholesale?
[help
don't work here just try in testing channels
i know ๐
GET /api/bots/:id
snekfetch im guessing idk i dont js
lol
lib doesn't matter
ยฏ_(ใ)_/ยฏ
xd
lib is not the language
it only provides stuff for you that deals with discord
o fancy
so you should use snekfetch
browsers suck
why can bots even see this channel

Wait, why I get this ? http://i.imgur.com/IMTWtAa.png
http://i.imgur.com/Ko3u7MQ.png

discORD
ye
dickordโข
Dickswordโข
Hi
@dreamy temple this one, i need to know how to mention an user with custom commands

-owners @dreamy temple
ask him
If i want the bot to mention me, i can use this <@{{.User.ID}}>, but how can i mention other users?
Should i mention jonas or Luca actually mentioned him?
yo
Hi
He need help with your bot
he wants to mention another user using custom commands?
yep
like a fixed user? same user every time?
yep
then you can just use a normal discord mention
@sacred gull
put a \ in front of the mention and copy the result like i did above
yep
yeah
do the same thing, put a \ in front of the mention and copy the result
okay, thanks ^^
Anyone have any idea how you do embeds in Python? I tried but I am getting strange results. Can't find anything on the internet :/
Does discord.py allow you to send raw JSON as a message? @cinder sleet
Like not the content of the message, but message data.
@earnest phoenix I think so
lol
If you can, visit the Channel category under the Discord Developers docs. It shows how to send an embed.
Actually, it shows the format for the JSON to send.
Ok
@earnest phoenix no
@cinder sleet python embeds are ez give me a sec I'll get you a example
Ok thanks @sinful jolt
embed = discord.Embed(description="ayy embed", colour=discord.Colour.magenta())
embed.set_author(name='sweet',
icon_url='http://someimageurl')
await bot.say(embed=embed)
Thanks

anyone familiar with POSTing to this api?
i'm not getting any errors
idk what i'm doing wrong
What lib/lang are you using?
Where in the code are you posting the request?
It cant get a server count if you're loading the code before the ready event goes off
so it'd look like this:
client.on('ready', () => {
let request = require("superagent");
let dbots_token = "token_here"
request.post(`https://discordbots.org/api/bots/bot_id_here/stats`)
.set('Authorization', dbots_token)
.send({server_count: client.guilds.size})
.end();
});
If your post is launching after it successfully logs into Discord, the only other thing i could think is wrong is your bot not being approved first. Because it wont post if the bot isn't approved
still no errors
and nothing
the api docs show :clientid
idk if i literally need to put a colon
or if that shows you need to fill it in
still nothing
And do a console.log('updated')..'
it's not actually showing up on the site
-bots @brittle kernel
@open oar 
-bots @brittle kernel
@open oar 
-bots
@silver marsh
@forest lark
@serene drum
Fuck
it is
Ok but console.log at the end pls
PLS DO IT
show us the code
but the site won't update
//eslint-disable-next-line
const request = require('superagent');
const dbotsToken = 'mytoken'
request.post('https://discordbots.org/api/290228059599142913/stats')
.set('Authorization', dbotsToken)
.send({ 'server_count': 48 })
.end();
console.log('done')```
Replace 48 with client.guilds.size, so its easier later on and you dont have to keep filling it in
Also where is that in the code
It'd be better to just put it in your ready listener and have it launch there and post with client.guilds.size
wait
Look where ur posting to
Ur posting to api/bot_id
instead of api/bots/bot_id
nic
i show error if u want me to
pls
k
is it because the if statement has no brackets
?
I think that's why, because it's expanding over one line with that if statement
without brackets
you cant let an embed twice
u can
You should be able to
they are different scopes
it also cuz i coded it on my ipad
but yeah you could do a let embed = undefined on top or something
trying to find excuses
but I don't think the let = would make a difference, idk I don't do that but I dont' see why it wouldn't work

how do i grab kicks, bans from audit logs also with the reason?
fetch audit logs 
me 
but if they used another bot to kick, ban. how would i grab that
by fetching audit logs....
ik but how?
what lib?
cant help
read that
rtfd

no, u can talk about developing ur life here
I'm not going crazy, am I? setInterval(function () { dogapi.metric.send_all(metrics) }, 2000) this will execute dogapi.metric.send_all(metrics) every 2 seconds, correct? js btw
Yea
Then why tf is it not working ahhhhhhh
setInterval(dogapi.metric.send_all(metrics), 2000) should work too
mm true
so in theory
client.once('ready', () => {
console.log(`[${new Date()}] ${client.user.username} loaded successfully.`)
client.indexes = {
'meme': {},
'shitpost': {}
}
setInterval(dogapi.metric.send_all(metrics), 2000)
client.user.setGame('plz help', 'https://www.twitch.tv/melmsie')
})
``` Once the bot connects, it should run that until the bot disconnects
yep
is metrics defined first?
metrics is a global array of objects, yes
const guilds = client.guilds.size
const largeGuilds = client.guilds.filter(m => m.large).size
const users = client.users.size
const ram = (process.memoryUsage().rss / 1048576).toFixed()
const now = parseInt(new Date().getTime() / 1000)
const metrics = [{
metric: 'jr.guilds',
points: [now, guilds]
},
{
metric: 'jr.users',
points: [now, users]
},
{
metric: 'jr.largeGuilds',
points: largeGuilds
},
{
metric: `jr.ram`,
points: [now, ram]
}
]
ram usage is getting posted, but not any other metrics
๐ค
Is that outside the client.on?
woah
Because if it runs outside the bots actual load it wont work
you are calling the function as you're creating the interval














