#development

1 messages ยท Page 333 of 1

fleet epoch
#

what

#

ok in console i get a new thingy, {}

#

but it worked lol

carmine berry
#

reading wouldve helped you there but yea you did it

fleet epoch
#

i read but i thought "" was needed

carmine berry
#

it said it needed to be a number not a string

#

and ""makes it a string

fleet epoch
#

ohhhhhhhhh

#

wait

#

can i just do client.guild.size in there?

carmine berry
#

yes but if it returns it as a string you got to parseInt() it

fleet epoch
#

do i have to have it log in consle at the part

#
       console.log(res)
   }```
carmine berry
#

logging is all up to you

umbral pelican
#

u wot
.size returns an int

carmine berry
#

ยฏ_(ใƒ„)_/ยฏ

#

many ways to do something

fleet epoch
#

hmm dosent show a nunber on website

carmine berry
#

idk

fleet epoch
#

so i should do parseInt(client.guild.size?)

carmine berry
#

why not use snekfetch

#

much easier lmao

fleet epoch
#

i dont have it and idk about it lol

carmine berry
#

you using djs?

fleet epoch
#

mhm

carmine berry
#

djs uses snekfetch i thought...

umbral pelican
#

it does

fleet epoch
#

it does

carmine berry
#

therefor you got it

#

just require it

fleet epoch
#

what does it do?

carmine berry
umbral pelican
#

why would use dependancy that uses request to post server count when you could just use snek .__.

#

use/look at the one tonkku posted

carmine berry
#

mhm snek way easier

fleet epoch
#

oh easy lol

#

why is snekfetch in my node modules folder and yet i i dident install it?

umbral pelican
#

;-;

carmine berry
#

cause djs uses it

fleet epoch
#

discord.js comes with it>

#

oh

carmine berry
#

yes

fleet epoch
#

error lol

#

cant read id

#

@hollow zephyr

umbral pelican
#

you probably called it bot instead of client

#

๐Ÿคท

fleet epoch
#

i called it client

#

we need the master on lol

umbral pelican
#

wut

fleet epoch
#

idk

umbral pelican
#

where are you putting the code?

fleet epoch
#

index file just above login at the bottem of the page

umbral pelican
#

has to be after the ready event has been called

fleet epoch
#

its after it, not in it

umbral pelican
#

but shove it in guildCreate and guildDelete

#

becausse that's when the server count changes ;-;

fleet epoch
#

i dont have that i dont think lol

umbral pelican
#

have it then

fleet epoch
#

wait just put it in ym ready stetement?

umbral pelican
#

the client has no properties before the ready event

#

you could, but it would only post the server count once - when your bots starts

fleet epoch
#

thats fine

#

thx

topaz fjord
#

any of you know d.js and sqlite

prime cliff
#

Im pretty sure a person called Google knows how to ๐Ÿ˜

topaz fjord
#

i wanna know how to define prefix outside of this

fleet epoch
#

xD

topaz fjord
#
    sql.get(`SELECT * FROM guildsettings WHERE guildID = ${message.guild.id}`).then(row => {
            const prefix = `${row.prefix}`        
    })
prime cliff
#

Urm.. just make it a string outside of the sql statement then use prefix =

topaz fjord
#

but the how would i set prefix = ${row.prefix}

inner jewel
#

process the command inside the callback

topaz fjord
#

?

uncut slate
#

@topaz fjord prepared statements

umbral pelican
#

lol

topaz fjord
#

@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 
```\
uncut slate
#

yeah no

#

console.error; doesn't do anything there

topaz fjord
#

why not

uncut slate
#

also use prepared statements

topaz fjord
#

wdym

earnest phoenix
#

anyone? how do I send a message to a certain channel in Discord.Bat?

median lintel
#

Discord.Bat?

earnest phoenix
#

ya, its a lib.

#

Lol

prime cliff
#

Oh god who made that lib im gonna hunt them down and......

inner jewel
#

:^)

surreal peak
#

dont unless you want a ban

#

๐Ÿ˜

stone kiln
#

wew

jagged plume
#

owo

earnest phoenix
#

does anyone knows how to make the bot post an image with the avatar and text in javascript?

languid dragon
#

do you mean an embed?

earnest phoenix
#

no not an embed

#

an example

languid dragon
#

oh lmao, you'd need an image manipulator

earnest phoenix
#

how do i do that?

languid dragon
earnest phoenix
#

thanks

bitter ember
#

someone knows a good image search api?

restive silo
#

pixabay is okay imo

#

they have an api eyesFlipped

scenic crest
#

@topaz fjord do you use ${blah} for all of your queries?

#

because that smells like SQL injection to me

inner jewel
#

!prefix set '); DROP * --

scenic crest
#

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

inner jewel
#

uhm lol

#

i did thst

#

and received exactly the same responses from 2 bots

weak parrot
#

Lol

sinful meadow
#

bloblul ๐Ÿ”ซ

topaz fjord
#

@scenic crest if you mean that I'm using the sqlite mom package the yes..

#

And also

#

Why arraying

#

Why

shrewd field
#

guys

#

if i want to get an id i do it by args then the command

#

right

prime cliff
#

What kind of ID? user/message/emoji

scenic crest
#

@topaz fjord why wat

topaz fjord
#

I saw you added my bot the removed it

scenic crest
#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

how do you make the bot show a random image by adding tags from what url?

earnest phoenix
#

no one's gonna help?

scenic crest
#

no idea what you mean tbh

karmic parcel
#

same

earnest phoenix
#

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

karmic parcel
#

that is called an API

earnest phoenix
#

i know, but i don't find it

karmic parcel
#

it's literally random.cat

#

I think

#

<cat

#

o

#

no boats here, forgot

scenic crest
karmic parcel
#

yeah

scenic crest
#

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

earnest phoenix
#

ok, thanks i guess

karmic parcel
#

he literally explained what you wanted lol

#

I guess

earnest phoenix
#

i wanted to have it extended to more than just cats

karmic parcel
#

so you need to look for more apis

scenic crest
#

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

earnest phoenix
#

ok thanks

earnest phoenix
#

@earnest phoenix i made a new welcome image

earnest phoenix
#

With Canvas or jimp ?

karmic parcel
inner jewel
clear kernel
inner jewel
#

microsoft.paint

earnest phoenix
#

xD

prime cliff
#

@low niche

#

Use search for in: development from: Deni#0274

#

Have fun

low niche
#

I already did kek

#

Look at the reply in the other server

earnest phoenix
#
    @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?

languid dragon
#

the bot would need to be in every one of your servers im pretty sure

earnest phoenix
#

Ah rip

languid dragon
#

besides that only your client would be able to do that

earnest phoenix
#

I thought so, wasn't sure

#

Thank you for the clarification

languid dragon
#

yeeet no problem dood

silk smelt
#

n!test

low niche
#

Not here kek

low niche
#

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 Thonk

uncut slate
#

.catch(string) is invalid, I'm pretty sure?

#

Error is probably due to no color arg

clear kernel
#

color: hex? it says in the error its not an int

stone kiln
#

just need to parse it

#
newNumber = parseInt(hexString, 16);```
earnest phoenix
#

@low niche error catching js wrong

#

.catch((e) => console.warn(e))

#

Or if you wanna ignore it totally

#

.catch(() => null)

shrewd field
#

hey does anyone know how can i make an eval command

#

i tried this but it wont work

shrewd field
#

i think u should put then and then the send part

#

try

tawny lava
#

you're checking if the message content equals the prefix + eval @shrewd field

#

that won't work with args

shrewd field
#

then what will work

bitter sundial
#

that channel doesn't exist

potent anchor
#

guild.channels.get('370563395784671244').send(`i have joined a server ${guild.name} `);

tawny lava
#

the channel does not exist

potent anchor
#

im making the bot send it to my server

shrewd field
#

lac

potent anchor
#

if it has joined a server

shrewd field
#

what should i put instead of message.content

shrewd field
#

thanks everyone i figured it out

#

example

earnest phoenix
#

@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

shrewd field
#

to me

#

or him

earnest phoenix
#

him

shrewd field
#

k

earnest phoenix
#

that is why I pinged him ๐Ÿคฆ

potent anchor
#

i fixed it

earnest phoenix
#

๐Ÿ‘

shrewd field
#

mayo

potent anchor
#

code error

earnest phoenix
#

yes

shrewd field
#

can u help

earnest phoenix
#

prob

potent anchor
#

thanks passthemayo

earnest phoenix
#

np

shrewd field
earnest phoenix
#

store log channel ID in database

#

then send to it upon ban

#

ez

shrewd field
#

ok how to make a database

earnest phoenix
#

use rethinkdb

shrewd field
#

and how can i make the case

#

rethinkdb

#

what is that

earnest phoenix
#

A database

#

๐Ÿคฆ

#

Google this shit

shrewd field
#

how can i get it

#

ok

earnest phoenix
#

GOOGLE IT

shrewd field
#

for the case part

earnest phoenix
#

Jesus

shrewd field
#

what do i do

earnest phoenix
#

GOOGLE!!!

shrewd field
#

k

uncut slate
#

calm down, mayo

shrewd field
#

dont be mad dude

uncut slate
#

He is right though, Deni.

shrewd field
#

ok

uncut slate
#

You can't expect someone to be there, holding your hand, throughout everything

shrewd field
#

sorry

#

ok

#

aeth

uncut slate
#

No.

shrewd field
#

goes to google

uncut slate
#

Good.

shrewd field
#

aeth i mean ok thnks

ruby copper
#

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.

pastel epoch
#

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

dim beacon
#

๐Ÿ˜

pastel epoch
#

And couldnt find many online examples

#

Just asking what i need to do to make it work

dim beacon
inner jewel
#

your.client.guilds.size

pastel epoch
#

@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?

earnest phoenix
pastel epoch
#

I know

earnest phoenix
#

Vampire help...

pastel epoch
#

i said i used that

#

just confused about where to put my server count

#

@earnest phoenix

earnest phoenix
#

mobile atm

#

"your bot's server count" - this seem very obvious

#

put it there

#

๐Ÿคฆ

pastel epoch
#

@earnest phoenix can i just put client.guilds.size there?

earnest phoenix
#

yes

slim solar
#

@mabixj$$

#

@manoxk

earnest phoenix
slim solar
#

Oh sorry

pastel epoch
#

@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)
    }
})
scenic crest
#

print out client.guilds.size imo

#

while logging it

earnest phoenix
#

It says it needs to be a string

#

The guild count

scenic crest
#

wew python

earnest phoenix
#

put .toString() after it

scenic crest
#

or JS

earnest phoenix
#

JS

scenic crest
#

curly braces and I thought it was python, time to sleep

earnest phoenix
#

Arrow functions tho

scenic crest
#

anyhow it says it must be a number but you said it needs to be a string?

earnest phoenix
#

that's not python

#

OH

#

it must be a number

#

I thought it must be a string

#

I'm blind

scenic crest
#

happens to the best of us

earnest phoenix
#

lol

scenic crest
#

again print out the guild size before posting

earnest phoenix
#

^

scenic crest
#

I feel like client isn't initialized or something

#

idk JS though so

pastel epoch
#

@earnest phoenix you said print it out while logging it, can you please explain a bit? Iโ€™m still quite new to javascript

scenic crest
#

console.log(clients.guilds.size)

#

something along those lines

pastel epoch
#
dblclient.postStats(console.log(client.guilds.size), (err, res) => {
    if(err) {
        console.error(err)
    } else {
        console.log(res)
    }
})
#

@scenic crest like this?

scenic crest
#

nono

pastel epoch
#

I thought so

#

lol

scenic crest
#

before dblclient

pastel epoch
#

oh

scenic crest
#

console.log(blah)
discordclient.blah

#

*dblclient ^

pastel epoch
#

@scenic crest ?

scenic crest
#

๐Ÿ‘€

#

hmm no idea then

bitter sundial
#

0

#

do you really have 0 servers

umbral pelican
#

eww, it's that cancerous npm package again GWlgbtqpFeelsthinkingman

#

-bots Sayajiaji

gilded plankBOT
#
Sayajiaji#1154
Bots

@dapper snow

scenic crest
#

wall bot has more than 0 servers, I can confirm that

umbral pelican
#

@pastel epoch use the one ToooOOOoonkku posted in #312614469819826177, and put the code in ready, guildCreate and guildDelete events

pastel epoch
#

@umbral pelican thanks! That one worked!

umbral pelican
#

๐Ÿ‘Œ

fleet epoch
#
    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
earnest phoenix
#

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

inner jewel
#

it works for me

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

๐Ÿ˜ญ

#
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?

inner jewel
#

ยฏ_(ใƒ„)_/ยฏ

#

print response

earnest phoenix
#

you don't help at all...

umbral pelican
scenic crest
#

he's helping

earnest phoenix
#

it's been like this for few days already, no one knows what happened?

scenic crest
#

print the response there is

earnest phoenix
#

what do you mean?

inner jewel
#

i've never used whatever http lib you're using

scenic crest
#

you get a JSON response from sending the request

#

called "response" I think something like that

inner jewel
#

print response and body

scenic crest
#

print it out

inner jewel
#

if there was an error

#

it will be there

earnest phoenix
#

can you show me how?

scenic crest
#

you have a response variable

#

and you need to print this

inner jewel
#
function (error, response, body) {
    if (error) return console.error("!!!"+error+"!!!");
console.log(response);
console.log(body);
  }```
scenic crest
#

stop spoonfeeding

#

bad natan!

#

but yeah do that ^^

rain tendon
#

-bots

gilded plankBOT
#
Dingus#6977
Bots

@high briar

earnest phoenix
#

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...

rain tendon
#

Need to build a good readme and website for this bot lol

scenic crest
#

anyhow golden uh

#

are you sure you're using a new token

earnest phoenix
#

yes, i clicked on the generate new token

scenic crest
earnest phoenix
#

ok

#

didn't work -_-

inner jewel
#

use a bot specific token

earnest phoenix
#

?

earnest phoenix
#

ok, it works now

#

idk why suddenly, i repeated the same thing until it worked lmao

scenic crest
#

๐Ÿ˜‰

earnest phoenix
#

thanks

cold sentinel
#

helo

scenic crest
#

๐Ÿ‘‹

cold sentinel
#

what i do after i type +settings

scenic crest
#

for which bot is this?

cold sentinel
#

welcome msg

#

tying set up the image

scenic crest
#

You mean @worn relic ?

trim steppe
#

Welcomer?

cold sentinel
#

yes

scenic crest
#

have you asked in the welcomer support guild?

trim steppe
#

the support server is on the "visit website" buddon

cold sentinel
#

yes i added the bot

trim steppe
#

the support server is on the "visit website" buddon

cold sentinel
#

ok

earnest phoenix
#

any suggestions on things I should add to a user profile?
I'm making it using PIL, so something not lengthy

karmic lake
#

umm

#

a description?

#

ยฏ_(ใƒ„)_/ยฏ

stone kiln
#

names in rainbow colors

karmic lake
#

^^^^

#

i like colours

#

๐Ÿ‘

topaz fjord
#

@earnest phoenix

steep warren
#

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");
               });
        }
    });
earnest phoenix
#

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.

potent anchor
#
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"
}
}
});
}
});```
carmine berry
#

what lib are you using

restive silo
#

that looks like d.js

#

you must define guild by member.guild

#

@potent anchor

potent anchor
#

ok

#

yeah i did it its working

restive silo
sinful meadow
#

Im guesing you are defining gco as the client? @potent anchor

potent anchor
#

yes

sinful meadow
#

Did you get it fixed

earnest phoenix
#

@cunning ocean help

#

eh its muted

ornate shadow
#

is there a way to return to console a list of all the servers in which my bot is in?

jagged plume
#

what lib

ornate shadow
#

discord.js

jagged plume
#

console.log(<Client>.guilds.map(g=>g.name))

#

or something like that

ornate shadow
#

๐Ÿ˜ฎ ok

#

thanks!

jagged plume
#

only they wont have spaces

#

so you could do

#

console.log(<Client>.guilds.map(g=>g.name).join(", "))

#

to append a comma

ornate shadow
#

nice! thanks!

slim solar
#

/warn

karmic lake
#

yo

lethal sun
#

Anyone knows how to create a leveling system in discord.js? Or has any good tutorials?

earnest phoenix
lethal sun
#

Yes, it's goood

lime falcon
#

Cool. I tend to use the embed visualizer

tawny dawn
#

is a snowflake just an id?

#

(message id, guild id, user id, etc)

inner jewel
#

yes

tawny dawn
#

that answered so many questions i had XD thanks

scenic crest
#

@tawny dawn snowflake indicates that it's unique

tawny dawn
#

Which is are I thought

#

IDs*

earnest phoenix
#

Snowflakes are generated based on time stamps

fiery quail
#

My code won't send to the api.

#

Its saying its Unauthorized to post

#

Nvm I fixed it.

tawny dawn
#

So a snowflake is an id based on time stamps? so that would only be certain ids like messages then?

clear kernel
#

No, just like you said message, guild, user ids are all snowflakes, all based on timestamp

tawny dawn
#

Ok. Learned something new. thanks

uncut delta
#

How do I can make a leaderboard for my bot whose database is in json?

tawny lava
#

Impossible

#

Nobody has mastered the art of JSON databases

weak parrot
#

Lol

graceful plume
#

hlow

#

hlow HlOw HLOW

#

hello?

bitter sundial
#

includes doesn't return a Promise, it returns a Boolean

#

you also dont need the toString because it's already a string

languid dragon
#

yh i told him

#

angery.

graceful plume
#

๐Ÿ‘€

lethal sun
#

Anyone knows how to setup a full working leveling system in discord.js in a easy way?

languid dragon
#

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

thorny hinge
#

Best way would be using a database in my opinion

mighty barn
#

databases are easiest for doing stuff that has to be memorized imo

inner jewel
#

inb4 json files

languid dragon
#

when my bot actually uses json

potent anchor
#

can anyone help me in my bot hosting on glitch

uncut slate
#

@lethal sun json db is best db, don't listen anyone. dude it's literally JAVASCRIPT Object Notation ofc it's the best

frigid bay
#

Can you help me ? I would like to know how to see who voted for my bot using the Discord Bot List API

uncut slate
#

json db is easiest to use & d fastest

sinful meadow
#

Language? @frigid bay

frigid bay
#

I use Discord.js and nodejs

sinful meadow
#

Do you know how to use snekfetch

#

(Npm)

frigid bay
#

no :/

sinful meadow
#

1 sec

frigid bay
#

I managed to display the number of my servers on the site

sinful meadow
#

shite

#

1 sec

#

Watch that

#

Its a start for snekfetch

frigid bay
#

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

earnest phoenix
#

don't use got

#

use snekfetch

frigid bay
#

I will try thank you

earnest phoenix
#

np

sinful meadow
#

i was going to say the same

#

Hey @frigid bay

#

and look for discord.js snekfetch

#

Snekfetch is waaay easy

#

for starting out

frigid bay
#

Okay thank ๐Ÿ˜‰

sinful meadow
#

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

frigid bay
#
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'));
sinful meadow
#

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

frigid bay
#

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?

sinful meadow
#

Yes you can

#

you would maybe have to do it inside some vent

#

evnet*

#

event*

frigid bay
#

even make an order that lists all who voted?

sinful meadow
#

You would have to figure that out yourself

languid dragon
#

Anyone know much about child_processes in Node.js?

stiff bramble
#

Hello?

uncut slate
#

hello

stiff bramble
#

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

hushed oyster
#

By the picture, I think it censors the word

#

in the channel

stiff bramble
#

Oh ok

#

Thanks

faint jetty
earnest phoenix
#

hello

karmic lake
#

oops

solar field
#

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 ?

cold turret
#

Hey Guys

quaint nimbus
#

Does anyone know how to use ${ } in embed messages? (discord.js)

#

/help

inner jewel
#
const myVar = 10
const myString = "myvar is ${myVar}"```
restive silo
#

@inner jewel wrong

#

you cant use ${} with "

#

you are forced to use `

inner jewel
#

ยฏ_(ใƒ„)_/ยฏ

#

i don't code in js

restive silo
#

well

#

thats fine just corrected it so nobody is confused

inner jewel
#

when i do that it's scala val myVal = 10 val myString = s"myVal is $myVal"

restive silo
#

wat

inner jewel
#

scala

restive silo
#

oh

#

heh

inner jewel
#

s"string" is a compiler hack

#

but you can have custom ones

#

iirc the format one is a macro

median lintel
#
const myVar = 10
const myString = `myvar is ${myVar}`

or

const myVar = 10
const myString = "myvar is " + myVar
inner jewel
#

others are regular methods

#

no

restive silo
#

wat

inner jewel
#

second one won't work

restive silo
#

^

#

yep

#

now

#

hehe

#

edited LUL

lethal sun
#

How to change the color of the buttons on the bot page?

median lintel
#

get the classes of the buttons

#

change the color of the background

viral mauve
#

hi

#

greetings everyone

#

pls i need an assistance

#

i need someone to help me set bots on my discord channel

hushed oyster
#

#general would be a better place for that question

restive silo
#

no ads FeelsRageMan Banhammer

hushed oyster
#

rip

restive silo
#

wasn't that your bot? SmugNep

hushed oyster
#

no

#

it was some random bot I saw on the front page of discordbots

restive silo
#

really Think

hushed oyster
#

yes

restive silo
#

lol

median lintel
rugged girder
#

hey, does anyone know if Discord can help with changing a bot name without removing it from all servers and starting over?

median lintel
#

what library

jagged plume
#

Ye you can do it through your code

median lintel
#

cuz if u do it on the application page it wont change the bot name really

topaz fjord
#

oh heck yes

earnest phoenix
#

@rugged girder are you using discord.js

rugged girder
#

I already got it figured it out from the API server, thanks though!

low niche
#

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)

karmic lake
low niche
#

I was trying to eval members in a guild

karmic lake
#

Thonk ยฏ_(ใƒ„)_/ยฏ

low niche
#

That happened

winged osprey
#

@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

low niche
#

Ok I see

#

Apparently, not a promise @winged osprey

winged osprey
#

hm

low niche
#

Not working rip

potent anchor
#
.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)```
vital lark
#

npm install weather-js

#

โญ | If x module not found: do npm install x

shrewd field
#

Hey guys I made an eval command but it won't work

#

No errors just nothing happens

inner jewel
#

inb4 no args

amber snow
#

Show me the code Deni

earnest phoenix
#

I am in need of help

#

it's hopefully a really simple problem for those experienced with discord bots

clear kernel
#

well.. people would help you if you shared with what you need help with here...

median lintel
#

...

earnest phoenix
#

well I just wanted to see if people were wiling to help first

#

can someone explain what this means

rich kiln
#

message***.content***

uncut slate
#

um, no

stone kiln
#

@earnest phoenix that is what it will do with the message/command it got from the user

earnest phoenix
#

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"

wooden shoal
#

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);
}

}

earnest phoenix
#

Ohhh

#

Thanks a lot man

wooden shoal
#

no prob

shrewd field
#

Hey guys I made an eval command but it won't work
No errors just nothing happens

wooden shoal
#

hm

#

javascript?

winged osprey
#

@shrewd field show code

wooden shoal
#

^

shrewd field
#

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");
  }
wooden shoal
#

pretty sure you ned : after an if

#

need*

#

if ():
return;

#

actually idk

#

is this python?

tawny lava
thorny hinge
#

Looks like discord.js

#

@shrewd field Do you have the clean function defined? Thonk

winged osprey
#

@shrewd field is there an error

shrewd field
#

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;
}; ```
thorny hinge
#

Hmm

#

So no errors and the bot just ignores you?

shrewd field
#

yep

#

i did

#

eval "test"

#

nothing happened

thorny hinge
#

only thing I can think of is the config.ownerID being wrong Thonk

earnest phoenix
#

Is Discord.Bat the best lib?

shrewd field
#

it is correct

thorny hinge
#

hmm

earnest phoenix
#

it says its the easiest

#

and you can code in bach

#

batch*

thorny hinge
#

It depends whats easiest for you

earnest phoenix
#

well batch is easy

#

so

#

im choosing discord.bat

thorny hinge
#

Alright

shrewd field
#

hmm

earnest phoenix
#

ok, how do i login with my token in discord.bat?

#

theres no lib..

restive silo
#

there is

#

b1nzy made one

earnest phoenix
#

but where is it?

shrewd field
#

hey

earnest phoenix
#

hi

shrewd field
#

i suddenly

#

got this error

#

does anyone know why

earnest phoenix
#

Your config isn't parsed correctly GWchadThinkeyes

karmic lake
#

lol

#

EWW

#

get dat outta here

tawny lava
#

lol

karmic lake
#

sharex wont copy it with the s onto my clipboard so i have to add the s Thonk

tawny lava
#

cuz you didn't set it up correctly gg

sinful meadow
#

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

uncut slate
#

eh, no. That would eval a promise, doing effectively nothing

sinful meadow
#

Weird because for me it works

uncut slate
#

actually

#

it wouldn't do anything at all, eval requires a string

sinful meadow
#

since this is my code lmao

#
let evalText = message.content.split(" ").slice(1).join(' ');
eval(evalText)
#

lmao

uncut slate
#

yes

#

that's something completely different

sinful meadow
#

how?

uncut slate
#

it wouldn't

sinful meadow
#

ik i forgot the '

#

Thats besides the point

uncut slate
#

right

karmic lake
#

xD

earnest phoenix
#
  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

ebon apex
#

You should never have a failed permission message in a bot

earnest phoenix
#

^^

#

^^^^

ebon apex
#

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.

patent reef
#

xD

#

xD

#

xD

#

xD

#

xD

#

๐Ÿ˜‚

earnest phoenix
#

.-.

#

O.o

#

Sad

earnest phoenix
#

I need help with Js!
How can my bot DM a user when the bot joined a new guild?

clear kernel
#

<user>.send('message').

earnest phoenix
#

so it would be member.send?

clear kernel
#

yes

earnest phoenix
#

kk ty ๐Ÿ˜ƒ

clear kernel
#

Also they may have DMS disabled so make sure to catch it

earnest phoenix
#

kk

#

Nope, Member is not defined

#

@clear kernel

#

guild.member?

clear kernel
#

well you have to define member. I was assuming you had it defined.

earnest phoenix
#

No, its in an event

clear kernel
#

Who are you trying to exactly send it to? You need to get the user

#

guildCreate event?

#

The other variable you get is guild

earnest phoenix
#

When the bot joins a new guild. It must send a message to the person who invited him

clear kernel
#

That's not possible. Can only send to the owner I believe. (which would be guild.owner)

earnest phoenix
#

kk

#

Well why is it, when I invite other bots to my friends guild. It DM's me?

clear kernel
#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

@earnest phoenix Maybe it DMs more people than you

#

meh

#

Because yep, it's impossible for the bot to tell who added it

#

kk

earnest phoenix
#

can anyone help me make a poll command?

wanton nova
#

ok

earnest phoenix
#

dm

restive silo
#

ask on a server for help
wants to start a dm instead
Thonk

mystic stone
#

@earnest phoenix i can help

#

we talkking a reaction poll or?

#

like this kind:

#

poll: hello

earnest phoenix
#

yep

#

@mystic stone yep

mystic stone
earnest phoenix
#

umm.

#

..

#

i do java script XD

#

your python

mystic stone
#

well my algorithms may be helpful to you

earnest phoenix
#

well can anyone else help me make a poll command (javaScript)

sinful meadow
#

@earnest phoenix Use .split()

earnest phoenix
#

waht is taht

languid dragon
earnest phoenix
#

i just want someone to show me how to make one

languid dragon
#

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 ๐Ÿ‘€

earnest phoenix
#

ok

languid dragon
#

if you're using discord.js

earnest phoenix
#

just askin

languid dragon
earnest phoenix
#

how do you add a reation to a message

#

?

#

like the code for it

languid dragon
#

are you using Discord.JS?

frail terrace
#

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.

gaunt vine
#

is this only dev chat?

earnest phoenix
#

its a discord client related problem,
so ask discord support not here

#

@gaunt vine

gaunt vine
#

kk

#

thx

#

i thought that this was like a server for help

earnest phoenix
#

it doesn't return errors

karmic lake
#

hmm

earnest phoenix
#

but it doesn't create the file

cerulean zinc
#

Hmm

karmic lake
#

hmmm

earnest phoenix
#

and only returns my domain

cerulean zinc
#

Strange

karmic lake
#

well uh

#

im not good with php

#

so

#

im srry moose bb

cerulean zinc
#

Same

karmic lake
#

โค

#

maybe next time

cerulean zinc
#

bing yahoo ask.com Google is your friend

earnest phoenix
cerulean zinc
#

Hmmm

#

You should try to use https so your isp can't see everything

earnest phoenix
#

i know

karmic lake
#

moose

earnest phoenix
#

but for now

#

thats not the issue

karmic lake
#

moose ppl are bullying me ;-;

#

what do i do

#

;-;

earnest phoenix
#

He picked a fight.

cerulean zinc
#

Maybe it's your site that osint responding with the right thing moose

earnest phoenix
#

Sadly he will not win this one.

#

i checked the dir

#

Already got his coordsl

#

there aren't any images

cerulean zinc
#

Hmm

#

Maybe it doesn't have write access?

karmic lake
#

ooh yah

#

chmod 777 it

#

that might be why

cerulean zinc
#

Maybe

earnest phoenix
cerulean zinc
#

Try again

#

Try again

#

That's not how a URL worls

#

Nvm

earnest phoenix
#

heyyyyy

cerulean zinc
#

What

karmic lake
#

xD

#

lmao

cerulean zinc
karmic lake
#

lol

#

moose

#

you might

#

wanna fix that

earnest phoenix
#

guys

#

i think

#

i made

#

it

#

work

karmic lake
#

moose

#

help

cerulean zinc
karmic lake
#

please

earnest phoenix
#

yes!

#

whats up?

cerulean zinc
#

There is something known as blovking @karmic lake

karmic lake
#

xD

#

this is hilarious

#

moose

#

be my lawyer

earnest phoenix
#

i need help with the on_guild_join aommand

#

command*

languid dragon
#

wat lib

earnest phoenix
#

Python

languid dragon
#

๐Ÿ‘‹ goodlucc xox

earnest phoenix
#

XD

#

I have the command it just wont read it

languid dragon
#

I'd love 2 help i just dont know py lmfao ur welcome to show ur code and ill take a look /shrug

earnest phoenix
#
@bot.event
async def on_guild_join(self, guild):
   await guild.owner.send("test")```
languid dragon
#

this?

earnest phoenix
languid dragon
#

ok well i found that

#

maybe try using on_server_join?

earnest phoenix
#

kk

#

i have so much other stuff to code

languid dragon
#

i think py references guilds as servers

earnest phoenix
#

but i get stuck on this

languid dragon
#

LOL

#

we all get that lil moment ๐Ÿ˜—

earnest phoenix
#

im so cut

#

XD

languid dragon
#

any luck?

earnest phoenix
#

no

languid dragon
#

aw sry, i tried

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

wait i think i type something wrong

languid dragon
#

is python ezpz?

earnest phoenix
#

Meh

#

in a way

#

Yeah no luck

languid dragon
#

ah shit

#

show me agin? xox

earnest phoenix
#

What code?

#

Old or new?

languid dragon
#

both

earnest phoenix
#
    @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")```
languid dragon
#

i think it might be because the only uh

#

variable that passes through on_server_join()

#

is the server

#

so maybe removing self,

earnest phoenix
#

just a sec

#

Didnt work

#

i changed guild to server

languid dragon
#

show again?

earnest phoenix
#
    @bot.event
    async def on_server_join(server):
       await guild.owner.send("test")```
languid dragon
#

change guild to server

#

LOL

#
   @bot.event
    async def on_server_join(server):
       await server.owner.send("test")
#

that should work

earnest phoenix
#

i did

#

XD

languid dragon
earnest phoenix
#

oh wait

#

i

#

have

#

autism

languid dragon
#

REEEEEEEE

earnest phoenix
#

Project Autism

languid dragon
#

working now? x

earnest phoenix
#

Nope

languid dragon
#

o really

#

send again?

earnest phoenix
#
    @bot.event
    async def on_server_join(server):
       await server.owner.send("test")```
languid dragon
#

is it send_message() ?

#

im seeing a lot of send_message() in the docs and no send()

earnest phoenix
#

hmm

#
    @bot.event
    async def on_server_join(server):
       await send.message("test")```
languid dragon
#

nah

#

it would be uh

earnest phoenix
#

oh

#

_

languid dragon
#
    @bot.event
    async def on_server_join(server):
       await bot.send_message(server.owner.id, "test")
#

I THINK

#

lemme check

earnest phoenix
#

tbh i never did this efore

languid dragon
#

new for us both HEH

earnest phoenix
#

so im learning with you

languid dragon
#

sounds good, im thinking of jumping into python later on

earnest phoenix
#

its good if you want my opinion

languid dragon
#

try that

#

remove .id tho

#

so

#
    @bot.event
    async def on_server_join(server):
       await bot.send_message(server.owner, "test")
earnest phoenix
#

no work

languid dragon
#

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

earnest phoenix
#

its k

#

my friend back

compact scaffold
#

Can anyone tell how to manage per server prefixes?

languid dragon
#

What lib?

compact scaffold
#

Python

languid dragon
#

Try some sort of database
ngl not sure how python works but yeah

compact scaffold
#

I was trying with json files but it won't open it to save the data

languid dragon
#

yeah a database would probably be better, just in case your bot gets a lot of servers

compact scaffold
#

I'll see what I can do