#development
1 messages ยท Page 333 of 1
reading wouldve helped you there but yea you did it
i read but i thought "" was needed
yes but if it returns it as a string you got to parseInt() it
logging is all up to you
u wot
.size returns an int
hmm dosent show a nunber on website
idk
so i should do parseInt(client.guild.size?)
i dont have it and idk about it lol
you using djs?
mhm
djs uses snekfetch i thought...
it does
it does
what does it do?
why would use dependancy that uses request to post server count when you could just use snek .__.
there's 2 examples in #312614469819826177
use/look at the one tonkku posted
mhm snek way easier
oh easy lol
why is snekfetch in my node modules folder and yet i i dident install it?
;-;
cause djs uses it
yes
wut
idk
where are you putting the code?
index file just above login at the bottem of the page
has to be after the ready event has been called
its after it, not in it
but shove it in guildCreate and guildDelete
becausse that's when the server count changes ;-;
i dont have that i dont think lol
have it then
wait just put it in ym ready stetement?
the client has no properties before the ready event
you could, but it would only post the server count once - when your bots starts
any of you know d.js and sqlite
Im pretty sure a person called Google knows how to ๐
i wanna know how to define prefix outside of this
xD
sql.get(`SELECT * FROM guildsettings WHERE guildID = ${message.guild.id}`).then(row => {
const prefix = `${row.prefix}`
})
Urm.. just make it a string outside of the sql statement then use prefix =
but the how would i set prefix = ${row.prefix}
process the command inside the callback
?
@topaz fjord prepared statements
lol
@uncut slate i did this
sql.get(`SELECT * FROM guildsettings WHERE guildID = ${message.guild.id}`).then(row => {
if (!row) {
sql.run("INSERT INTO guildsettings (guildID, modlogchannel, memberlogchannel, prefix) VALUES (?, ?, ?, ?)", [message.guild.id, 'mod-log', 'member-log', "tb!!"]);
}
}).catch(() => {
console.error;
sql.run("CREATE TABLE IF NOT EXISTS guildsettings (guildID TEXT, modlogchannel TEXT, memberlogchannel TEXT, prefix TEXT)").then(() => {
sql.run("INSERT INTO guildsettings (guildID, modlogchannel, memberlogchannel, prefix) VALUES (?, ?, ?, ?)", [message.guild.id, 'mod-log', 'member-log', "tb!!"]);
});
});
const row = await sql.get(`SELECT * FROM guildsettings WHERE guildID = ${message.guild.id}`)
const prefix = row.prefix
```\
why not
also use prepared statements
wdym
anyone? how do I send a message to a certain channel in Discord.Bat?
Discord.Bat?
Oh god who made that lib im gonna hunt them down and......
wew
owo
does anyone knows how to make the bot post an image with the avatar and text in javascript?
do you mean an embed?
oh lmao, you'd need an image manipulator
how do i do that?
thanks
someone knows a good image search api?
@topaz fjord do you use ${blah} for all of your queries?
because that smells like SQL injection to me
!prefix set '); DROP * --
that's no fun
why not give yourself some money
either way yeah it's really dangerous to do that, look into using prepared statements
Lol
๐ซ
@scenic crest if you mean that I'm using the sqlite mom package the yes..
And also
Why arraying
Why
What kind of ID? user/message/emoji
@topaz fjord why wat
I saw you added my bot the removed it
ยฏ_(ใ)_/ยฏ
how do you make the bot show a random image by adding tags from what url?
no one's gonna help?
no idea what you mean tbh
same
like tatsumaki shows a random cat, i want my bot to do the same, but it will also be possible to have tags for the image for example spongwbob for spongebob images
that is called an API
i know, but i don't find it
yeah
fetch the JSON content of that site
it'll give you an URL to an image
you can send it to the chat (discord will embed if you have perms) or you can get the image content and send it as a file
ok, thanks i guess
i wanted to have it extended to more than just cats
so you need to look for more apis
create an array of different API endpoints and the respective JSON key for that endpoint to get the image URL
then get a random member of that array
then get the JSON from the url and get the image URL with the key that's also present in the API
ok thanks
@earnest phoenix i made a new welcome image
microsoft.paint
xD
@commands.command(pass_context=True)
async def userservers(self, ctx):
"""counts all servers user is in"""
author = ctx.message.author
servers = author.servers
await self.bot.say("{}, you are in {} servers.").format(author), (servers)
Trying to make a command that has the bot tell you how many servers you're on.
Currently getting an error "member has no attribute 'servers'"
Can someone correct me?
the bot would need to be in every one of your servers im pretty sure
Ah rip
besides that only your client would be able to do that
yeeet no problem dood
n!test
Not here kek
I'm getting this error https://circuit.is-the-me.me/2f82508.png from this code below
exports.run = async (client, msg, args) => {
let name = args.join(' ')
let hex = args.slice(1).join(' ')
let color;
color = msg.guild.createRole({
name: `${name}`,
color: hex,
permissions: []
})
.then(role => "Created role " + role)
.catch("We got an error!")
}
invalid form body 
color: hex? it says in the error its not an int
@low niche error catching js wrong
.catch((e) => console.warn(e))
Or if you wanna ignore it totally
.catch(() => null)
you're checking if the message content equals the prefix + eval @shrewd field
that won't work with args
then what will work
that channel doesn't exist
guild.channels.get('370563395784671244').send(`i have joined a server ${guild.name} `);
the channel does not exist
im making the bot send it to my server
lac
if it has joined a server
what should i put instead of message.content
@potent anchor the channel it's trying to send to does not exist
that is why it's giving an error
We've said that 3 times
him
k
that is why I pinged him ๐คฆ
i fixed it
๐
mayo
code error
yes
can u help
prob
thanks passthemayo
np
Hey I am wondering does anyone know how can i make cases that will be sent into a logging channel.
example
http://prntscr.com/gze32i
ok how to make a database
use rethinkdb
GOOGLE IT
for the case part
Jesus
what do i do
GOOGLE!!!
k
calm down, mayo
dont be mad dude
He is right though, Deni.
ok
You can't expect someone to be there, holding your hand, throughout everything
No.
goes to google
Good.
aeth i mean ok thnks
You need to spend some time doing the research/work @shrewd field , nobody is going to give it to you for free when they went and did their own work.
All the info is out there, roll up your sleeves and read and then use your brain to figure it out.
Hey, i need some help getting the disocrd bot list api to work
i have installed discord-bot-list and have this in my code:
const dbl = require("discord-bot-list")
const dblclient = new dbl({
token: โi put my bot api token here",
id: "358336480755580939"
})
dblclient.postStats("Your bot's server count, MUST be a number, not a string", (err, res) => {
if(err) {
console.error(err)
} else {
console.log(res)
}
})
Where exactly do i put my bot servercount
Im using discord.js
๐
I looked through #312614469819826177
And couldnt find many online examples
Just asking what i need to do to make it work
for one you need to fix this quote
your.client.guilds.size
@dim beacon probably i acidentally typed it when copying
immon mobile
@inner jewel where do i put it though
Can i see a code example from someone who has done this?
I know
Vampire help...
i said i used that
just confused about where to put my server count
@earnest phoenix
mobile atm
"your bot's server count" - this seem very obvious
put it there
๐คฆ
@earnest phoenix can i just put client.guilds.size there?
yes
Oh sorry
@earnest phoenix in my logs it says server_count: 0 even though my bot is in 22 servers
dblclient.postStats(client.guilds.size, (err, res) => {
if(err) {
console.error(err)
} else {
console.log(res)
}
})
wew python
put .toString() after it
or JS
JS
curly braces and I thought it was python, time to sleep
Arrow functions tho
anyhow it says it must be a number but you said it needs to be a string?
that's not python
OH
it must be a number
I thought it must be a string
I'm blind
happens to the best of us
lol
again print out the guild size before posting
^
@earnest phoenix you said print it out while logging it, can you please explain a bit? Iโm still quite new to javascript
dblclient.postStats(console.log(client.guilds.size), (err, res) => {
if(err) {
console.error(err)
} else {
console.log(res)
}
})
@scenic crest like this?
nono
before dblclient
oh
console.log(client.guilds.size);
dblclient.postStats(client.guilds.size, (err, res) => {
if(err) {
console.error(err)
} else {
console.log(res)
}
})
@scenic crest ?
@dapper snow
wall bot has more than 0 servers, I can confirm that
@pastel epoch use the one ToooOOOoonkku posted in #312614469819826177, and put the code in ready, guildCreate and guildDelete events
@umbral pelican thanks! That one worked!
๐
const member = yourGuild.members.get(message.author.id);
if (!member || !member.roles.has('370650109244997633')) {
return message.reply('You have not donated!');
} else {
music(client);
}``` this always comes out as the i habe not donated statement eveen when i have all the stuff
what's wrong with the server count api here? it doesn't change its number and when i checked, it's not the same number as it is currently
๐ญ
request({
method: 'POST',
uri: 'https://discordbots.org/api/bots/'+ client.user.id +'/stats',
headers: {'Authorization': dbotstokens[0]},
json: {server_count : client.guilds.size}
},
function (error, response, body) {
if (error) return console.error("!!!"+error+"!!!");
});
is there something wrong with it?
you don't help at all...

he's helping
it's been like this for few days already, no one knows what happened?
print the response there is
what do you mean?
i've never used whatever http lib you're using
you get a JSON response from sending the request
called "response" I think something like that
print response and body
print it out
can you show me how?
function (error, response, body) {
if (error) return console.error("!!!"+error+"!!!");
console.log(response);
console.log(body);
}```
-bots
@high briar
it told me to generate a new token in the error, i did it to both my bot's token and the api's token, still shows the error...
Need to build a good readme and website for this bot lol
yes, i clicked on the generate new token
generate it again and make sure it's for discordbots.org
use a bot specific token
?
ok, it works now
idk why suddenly, i repeated the same thing until it worked lmao
๐
thanks
helo
๐
what i do after i type +settings
for which bot is this?
You mean @worn relic ?
Welcomer?
yes
have you asked in the welcomer support guild?
yes i added the bot
the support server is on the "visit website" buddon
ok
any suggestions on things I should add to a user profile?
I'm making it using PIL, so something not lengthy
names in rainbow colors
@earnest phoenix
how i edit a embed in a event
like
messageReactionAdd
bot.on('messageReactionAdd', (reaction, user) => {
if (reaction.emoji.name === "2โฃ" && user.id === message.author.id) {
message.channel.fetchMessage(bot.user.lastMessageID)
.then(message => {
message.edit("teste");
});
}
});
We have a ZERO TOLERANCE policy when dealing with illegal material such as child pornagraphy. Distributing, uploading, sharing or attempting to view or interact with child pornagraphy is against Discord Terms of Service, our rules, and illegal in most places in the world. Punishment is a non-negotiable ban as well as a report to Hammer & Chisel.
gco.on("guildMemberAdd", member => {
console.log(`welcome to ${member.guild} hope he stays there for a long time `);
const welcomechannel = member.guild.channels.find('name', 'general');
if (welcomechannel) {
welcomechannel.send({embed: {
color: 0xd800ff,
author: {
name: gco.user.username,
icon_url: gco.user.avatarURL
},
title: "joined server",
description: `olรก.. welcome ${member.user.tag} to ${guild.name} this is the best guild`,
fields: [{
name:"** come and stay **",
value:"**GCO is always happy **"
}
],
timestamp: new Date(),
footer: {
icon_url: gco.user.avatarURL,
text: "bot made by Reuben Fernandes"
}
}
});
}
});```
what lib are you using

Im guesing you are defining gco as the client? @potent anchor
yes
Did you get it fixed
is there a way to return to console a list of all the servers in which my bot is in?
what lib
discord.js
only they wont have spaces
so you could do
console.log(<Client>.guilds.map(g=>g.name).join(", "))
to append a comma
nice! thanks!
/warn
yo
Anyone knows how to create a leveling system in discord.js? Or has any good tutorials?
For those who haven't seen this before, there's a cool site that generates an embed for you in Python.
https://cog-creators.github.io/discord-embed-sandbox/
Yes, it's goood
Cool. I tend to use the embed visualizer
yes
that answered so many questions i had XD thanks
@tawny dawn snowflake indicates that it's unique
Snowflakes are generated based on time stamps
My code won't send to the api.
Its saying its Unauthorized to post
Nvm I fixed it.
So a snowflake is an id based on time stamps? so that would only be certain ids like messages then?
No, just like you said message, guild, user ids are all snowflakes, all based on timestamp
Ok. Learned something new. thanks
How do I can make a leaderboard for my bot whose database is in json?
Lol
hlow
hlow HlOw HLOW
hello?
i am having a lil trouble http://im.a.thiccbit.ch/83092.png apparently not a function? been looking at it for ages cant find anything wrong plz help
includes doesn't return a Promise, it returns a Boolean
you also dont need the toString because it's already a string
๐
Anyone knows how to setup a full working leveling system in discord.js in a easy way?
I know but it depends on how you want it, regardless it could be done easily with a database, common sense, logic and a fair understanding of javascript
Best way would be using a database in my opinion
databases are easiest for doing stuff that has to be memorized imo
inb4 json files
when my bot actually uses json
can anyone help me in my bot hosting on glitch
@lethal sun json db is best db, don't listen anyone. dude it's literally JAVASCRIPT Object Notation ofc it's the best
Can you help me ? I would like to know how to see who voted for my bot using the Discord Bot List API
json db is easiest to use & d fastest
Language? @frigid bay
I use Discord.js and nodejs
no :/
1 sec
I managed to display the number of my servers on the site
shite
1 sec
#roadtodiscordpartner It's been a while. Today we're going to add commands to manipulate JSON APIs using SnekFetch, learn how to manipulate user mentions in ...
Watch that
Its a start for snekfetch
I have already seen this video but I did not really understand how to display the votes, I am French so I sometimes have trouble with English
const got = require('got');
const dBotsKey = 'api';
got(`https://discordbots.org/api/bots/${client.user.id}/stats`, {
method: 'POST',
headers: {
Authorization: dBotsKey, 'Content-Type': 'application/json'},
body: JSON.stringify({server_count: client.guilds.size})
}).then(() => {
console.log('Successfully posted to discordbots.org');
}).catch(err => console.log(err));
For the number of players I did that
I will try thank you
np
i was going to say the same
Hey @frigid bay
Go into #312614469819826177 and scroll allll the way up
and look for discord.js snekfetch
Snekfetch is waaay easy
for starting out
Okay thank ๐
which tbh i like snekfetch until i find something else that is easy but faster @frigid bay
i used snekfetch for a few of my commands
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'));
Yep
Now
Find a way
to get votes
Which
That is kinda it
kinda
but for getting upvotes or people for upvotes
do this
const snekfetch = require('snekfetch')
snekfetch.post(`https://discordbots.org/api/bots/${client.user.id}/votes`)
.set('Authorization', 'UR DBOTS.ORG KEY').then(e =>{
dsajgdshjagdsjahdgsjh
});
the gibberish
is where you can try and find a upvote
or somthing
And thanks to that I will be able to make that my bot sends a message in my server every time a person votes for my bot?
even make an order that lists all who voted?
You would have to figure that out yourself
Anyone know much about child_processes in Node.js?
Hello?
hello
Sorry to ask but what are filters??
I have a bot named now live. And i use it to notify me when a person go live on twitch
And theres a command that says
hello
oops
i'm so confused on what i am doing wrong
const generate = () => {
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 100, 260, 200, 200);
ctx.arc(100, 100, 150, 0, Math.PI * 2, true);
ctx.closePath();
};
i am trying to use this to round an image, yet it does not round the corners at all
its canvas btw, so what i am doing wrong ?
Hey Guys
const myVar = 10
const myString = "myvar is ${myVar}"```
when i do that it's scala val myVal = 10 val myString = s"myVal is $myVal"
scala
s"string" is a compiler hack
but you can have custom ones
iirc the format one is a macro
const myVar = 10
const myString = `myvar is ${myVar}`
or
const myVar = 10
const myString = "myvar is " + myVar
wat
second one won't work
How to change the color of the buttons on the bot page?
hi
greetings everyone
pls i need an assistance
i need someone to help me set bots on my discord channel
no ads

rip
wasn't that your bot? 
really 
yes
lol
hey, does anyone know if Discord can help with changing a bot name without removing it from all servers and starting over?
what library
Ye you can do it through your code
cuz if u do it on the application page it wont change the bot name really
oh heck yes
@rugged girder are you using discord.js
I already got it figured it out from the API server, thanks though!
client.guilds.get('350888950078111745').fetchMembers().then(members=>{ var thing = await members.map(m => m.id); return message.channel.send(thing)}); this bork (unexpected identifier apparently)

I was trying to eval members in a guild
ยฏ_(ใ)_/ยฏ
@low niche the function passed to the .then isn't an async function
so u can't use await
but there's no need to await .map(), it doesn't return a promise
hm
Not working rip
.env: line 8: fggfh1277: command not found
module.js:491
throw err;
^
Error: Cannot find module 'weather-js'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/app.js:5:17)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)```
inb4 no args
Show me the code Deni
I am in need of help
it's hopefully a really simple problem for those experienced with discord bots
well.. people would help you if you shared with what you need help with here...
...
well I just wanted to see if people were wiling to help first
can someone explain what this means
message***.content***
um, no
@earnest phoenix that is what it will do with the message/command it got from the user
If I type "u" to the bot it is active for commands
but it's not just me who can activate it even though I entered my user ID
and I can't type anything with more than one letter like "ready" instead of "u"
the way its set up, it looks like you have to use * instead of spaces, and u is the prefix
and you should have an if statement checking if your id is the userID
otherwise its setting the id to yours, and always will run since you don't have anything telling it not
to
it should look like this ```
bot.on('message', function (user, userID, channelID, message, evt) {
if (message.substring(0,1) == "u" && userID="YOUR_ID_HERE") {
var args = message.substring(1).split('*');
var cmd = args[0];
args = args.splice(1);
}
}
no prob
Hey guys I made an eval command but it won't work
No errors just nothing happens
@shrewd field show code
^
ok
code
if (message.content.startsWith(prefix + "eval")) {
if(message.author.id !== config.ownerID) return;
const args = message.content.split(" ").slice(1);
try {
const code = args.join(" ");
let evaled = eval(code);
if (typeof evaled !== "string")
evaled = require("util").inspect(evaled);
message.channel.send(clean(evaled), {code:"xl"});
message.channel.send("if this works u will see this msg if not u will see bee");
} catch (err) {
message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
} message.channel.send("bee");
}
pretty sure you ned : after an if
need*
if ():
return;
actually idk
is this python?

@shrewd field is there an error
no
there is no error
yep
i have the clean function defined
const clean = text => {
if (typeof(text) === "string")
return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
else
return text;
}; ```
only thing I can think of is the config.ownerID being wrong 
Is Discord.Bat the best lib?
it is correct
hmm
It depends whats easiest for you
Alright
hmm
but where is it?
hey
hi
Your config isn't parsed correctly 
lol
sharex wont copy it with the s onto my clipboard so i have to add the s 
cuz you didn't set it up correctly gg
hey deni @shrewd field i hope you know
you dont need a advanced eval
lmao
you can legit do eval(message.channel.send('test'))
and it would work
eh, no. That would eval a promise, doing effectively nothing
Weird because for me it works
since this is my code lmao
let evalText = message.content.split(" ").slice(1).join(' ');
eval(evalText)
lmao
how?
right
xD
if (message.content === '/test'){
if message.author.id == '345603711416139777' {
message.channel.sendMessage('TESTSTTS')
}
}
})```
like that?
@patent reef
if (msg.author.id !== '263548443639808001') return;
if (msg.content.toLowerCase() == '/test') {
msg.channel.send('TESTSTTS')
}
else {
msg.channel.send(`You Don't Have Permissions!`)
}
})```
@earnest phoenix sorry for mentioning, but how can i make else?
.-.
msg.channel.send(You Don't Have Permissions!)
is not best bot practices
You should never have a failed permission message in a bot
You just agreed with us that the message should not be there... Are you okay? If you know it's wrong then what the fuck is it there for.
I need help with Js!
How can my bot DM a user when the bot joined a new guild?
<user>.send('message').
so it would be member.send?
yes
kk ty ๐
Also they may have DMS disabled so make sure to catch it
well you have to define member. I was assuming you had it defined.
No, its in an event
Who are you trying to exactly send it to? You need to get the user
guildCreate event?
The other variable you get is guild
When the bot joins a new guild. It must send a message to the person who invited him
That's not possible. Can only send to the owner I believe. (which would be guild.owner)
ยฏ_(ใ)_/ยฏ
@earnest phoenix Maybe it DMs more people than you
meh
Because yep, it's impossible for the bot to tell who added it
kk
can anyone help me make a poll command?
ok
dm
ask on a server for help
wants to start a dm instead
@earnest phoenix i can help
we talkking a reaction poll or?
like this kind:
poll: hello
well my algorithms may be helpful to you
well can anyone else help me make a poll command (javaScript)
@earnest phoenix Use .split()
waht is taht
i just want someone to show me how to make one
nobody here is going to "just show you" how to code
that's why i linked documentation
it's common sense, and if you know javascript it wouldn't be too hard ๐
ok
if you're using discord.js
just askin
My bot used to work with mentioning users, but now it throws the error "Input string was not in a correct format." I'm using Discord.Net 1.0.2.
is this only dev chat?
its a discord client related problem,
so ask discord support not here
@gaunt vine
hmm
but it doesn't create the file
Hmm
hmmm
and only returns my domain
Strange
Same
bing yahoo ask.com Google is your friend
i know
moose
He picked a fight.
Maybe it's your site that osint responding with the right thing moose
Sadly he will not win this one.
i checked the dir
Already got his coordsl
there aren't any images
Maybe
heyyyyy
What
Is it supposed to show a directory?
Hmmm
please
There is something known as blovking @karmic lake
wat lib
Python
๐ goodlucc xox
I'd love 2 help i just dont know py lmfao ur welcome to show ur code and ill take a look /shrug
@bot.event
async def on_guild_join(self, guild):
await guild.owner.send("test")```
i think py references guilds as servers
but i get stuck on this
any luck?
no
wait i think i type something wrong
is python ezpz?
both
@bot.event
async def on_server_join(self, guild):
await guild.owner.send("test")```
@bot.event
async def on_guild_join(self, guild):
await guild.owner.send("test")```
i think it might be because the only uh
variable that passes through on_server_join()
is the server
so maybe removing self,
show again?
@bot.event
async def on_server_join(server):
await guild.owner.send("test")```
change guild to server
LOL
@bot.event
async def on_server_join(server):
await server.owner.send("test")
that should work
REEEEEEEE
Project Autism
working now? x
Nope
@bot.event
async def on_server_join(server):
await server.owner.send("test")```
is it send_message() ?
im seeing a lot of send_message() in the docs and no send()
@bot.event
async def on_server_join(server):
await bot.send_message(server.owner.id, "test")
I THINK
lemme check
tbh i never did this efore
new for us both HEH
so im learning with you
sounds good, im thinking of jumping into python later on
its good if you want my opinion
try that
remove .id tho
so
@bot.event
async def on_server_join(server):
await bot.send_message(server.owner, "test")
no work
REEEEE
i got an idea
will make it easier for testing
do
bot.on_message(message)
and use that to test
get the user and all that
see if you can get it to send a message
it might be something like
message.author.send_message("blah blah").
idk
LOL
Can anyone tell how to manage per server prefixes?
What lib?
Try some sort of database
ngl not sure how python works but yeah
I was trying with json files but it won't open it to save the data
yeah a database would probably be better, just in case your bot gets a lot of servers
I'll see what I can do




