#development
1 messages · Page 1124 of 1
oh look stackoverflow is super cool
just pass it in the params directly
if(member.guild.me.hasPermission("MANAGE_ROLES"))
i'd replace whatever i want to be there btw
thats bad
plus that condition will return true if the bot has permission to manage channels in the channel, so you sort of have it backwards
that doesn consider final permissions
aka channel overrides
its preferably to use channel final permissions over guild permissions
i don't plan to have the bot function without administrator permis
bad
Is there anyone in here fluent in Js/C#/Kotlin who can create an example block of code for requesting info from this API endpoint? https://nekos.club/api/sfw-nekos
@earnest phoenix that api will get you removed from top.gg as it can bring results of minors
you should have a good reason for having admin rather than lazy coding
also just do it yourself 
Its Nekos.club, not Nekos.life
ohh okay
And I rather have someone who knows the languages do it for me
well an api is pretty simple tbh
assuming
that it’s just. A simple here’s your image
@earnest phoenix I know JS and Kotlin. Kotlin not so much in HTTP requests, but in JS just use the fetch API or whatever library you want to use.
I like node fetch as it's consistent with JavaScript's fetch API
i see what you mean by channel being undefined, if i defined a variable for channel then it would be successful right?
huh?
const channel = client.channels.cache.get(message.channel.id) or something like that, i'm reciting off memory
that's unnecessary
then if(member.guild.me.hasPermission("MANAGE_ROLES"))
message.channel is already a channel
woops
Your getting a channel you already have
i t i s
unless you need a channel different than the one your message is coming from, no need to use that
const theGuild = message.guild
if(message.channel.permissionsFor(theGuild.me).has("MANAGE_CHANNELS")) {
message.reply("I can't use this!")
} else {
// do the code
} (this is my last attempt before i do trial and error)
you're already doing trial and error
just pass it directly onto the parameter
also you need to invert that
if (has permission) reply(cant do this)
thats what you're doing basically
got 1 more question:
if a user has a role with just administrator as a permission, does discord (a discord bot) see them as having just that permission or all? (example: checking if they have manage messages with just administrator)
Your library will handle the member as having all the permissions, but you can override that behavior to my knowledge.
The second argument of <Permission>.has accepts a boolean called checkAdmin which is true by default.
doesnt member have the bit resolveable?
this
i assumed it'd have this and the methods just test for the proper value on the integer
Did it reconnect?
yes
That's normal
ok
i can't invite bot
what is the message?
how do i create a web dashboard for my bot
how do i create a web dashboard for my bot
@ivory seal use discord identify Oauth
what do u mean
i want to invite bot
but I can't any thing problem with mobile users to invite bot
only pc can invite
<@&265158261945270273>

i can't invite bot in my server @thick gull
nop@thick gull
then you should start with the basics of JavaScript if your doing discordJS before trying to make a bot
???
for example i want to invite this bot in server i can't @thick gull
@ivory seal which channel i should go
hey i m new to mongo how to create a url of mongo i m confused
can u explain whats the clusters tab

ok w8 i got it
ok and sorry @opal plank



are you new to programming?
learn basics first before trying to make a bot
@radiant kraken I want to learn.
what programming language?
Choose a language and read docs @summer ferry
there are a lot of languages and libraries to choose from
you should learn your languages base before reading docs for discord
@surreal notch Do you know the BDFD app
Bot designer for discord?
yep @radiant kraken
yes
yes, try reading the bdfd docs first
@radiant kraken Did you make a bot?
yes, but i code it not on bdfd 
Everyone here with that green color have made a bot
sorry i can't help you because i am not a bdfd developer :(

@radiant kraken Not on an app, but on what you want.
well, at least they are asking how to make one and not coming here after they copied a shit bot from github/youtube asking 'why it errors, fiz pliz'
still a bit salty from earlier on
@surreal notch On what platform did you make a bot?
You can choose anything like visual studio or sublime text but if you wanted to make it online you need to host it
#memes-and-media message
dont make a bot just for badge ^^^^
And if you want hosting and coding both on one platform then maybe use Glitch
@restive pebble
How to get me data base name
means where i can find it
I have sucessfully connected it
Well depend in what kind of file the data is storaged
Huh
oof did i ask u
how can I set a avatar webhook with a url from google
throw new MongooseError('The `uri` parameter to `openUri()` must be a ' +
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
at NativeConnection.Connection.openUri (/home/container/node_modules/mongoose/lib/connection.js:581:11)
at Mongoose.connect (/home/container/node_modules/mongoose/lib/index.js:335:15)
at Object.<anonymous> (/home/container/index.js:18:10)```
I m new to mongo so explain me where i m doing wrong
Says you provided undefined where it expected a uri
throw new MongooseError('The `uri` parameter to `openUri()` must be a ' +
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()`
I need help
In Visual Studio Code and I open the terminal and type node .
it gives me a error
Heres the error
Epic error
woo
Uhh hi?
10 woobux says its package.json cant find the main file
Where's tim when you need him
hibernating
hey
hello
how do i make my bots status be "watching" + client.guilds.users.cache.size
is that is
client.guilds.users.cache.size
just len(client.guilds)
len(client.users) ¯_(ツ)_/¯
how do i put my bot in the digitalcloud vps
client.user.setActivity(len(client.users) + " members!", { type: "Watching"});
you evaporate it and then the micro particles go into the air
how do i put my bot in the digitalcloud vps
@ivory seal pls help
Digitalcloud?
digitalocean
You still have to do some things on the vps
like?
The guide explains it
ya so......
I thought it would tell you how to host it
it’s your average how to make an if statement
@thick gull exactly
im not really sure tbh you can try asking their support
they have a discord channel?
not sure
who can I remove mentions in a message using dpy @everyone
pinging everyone doesnt work because you dont have the permissions
yeah I know
who can I remove mentions in a message using dpy
who can I remove mentions in a message using dpy
lul
can you format your question into a readable English question
sorry
who can I remove mentions in a message using dpy
@wanton anvil like what
how can I remove mentions in a message using dpy
@radiant kraken
bots cannot edit other message
they can
no:
..if they have permission
with adminstrator role bots can edit
huh? i didn't know that
u edit and blame on users
i didn't ask for a message edit
what u think discord wont prevent that lul
are you trying to turn @sonic lodge into @OOPLED
i asked how can I changed the message that I got from the user
I think he’s trying to post a message and remove any mentions in his own post
so it doesn’t ping anything
I want remove first mention of message
ur bot's message or some other user's?
not possible then
? ? ?
you can't edit another user's message
yes
99% sure we have a language barrier here
how else are you going to remove a mention from another user's message
then delete the message if it has any
you can only delete them
somebody who is professional in dpy can you come to my server and see how my bot is working
idk python rip
???
you want to remove a mention from another user's message
what does Harry Potter have to do with dpy
you simply can't do that
see? I took a message of some other user and I am trying to send it with bot with removing first mention of message got it @sonic lodge
or you can delete other users message and resending the content without mention
ah, you wanted to DELETE the message that contained the mention
everyone here thought you wanted to remove the mention by changing the message's content
i am thoroughly confused
I was saying that
@wanton anvil are you using message.reply?
what are you trying to do?
should i have to explain again??
yes I just got here
he is trying to remove a mention from a user sent message
and or is that true
as an alternative, you can just remove the message
@sonic lodge yeah correct and I want to send it through bot
however that would cause alot of ghost pings
yeah that's what i thought
sad
my bot is going tto be verified before 4+ week when it will be verified
it just been 4+ yesterday
you got it @thick gull
I don’t know anything about dpy
@earnest phoenix they say you were declined
get the content of the user's message, and replace occurences of mentions, which appear in the form <@user_id> with nothing
and then send the newly formatted message
or resend it as an embed
I’ll write out piece of the code. you do the rest
oh yah an embed works as well
he speaks hindi my guess
yeah
i aslo lol
i can’t type Hindi though so I’m like
same country

if (message.mentions.users.first) {
// You do the rest
}
message.mentions returns a list/array
you can use message.mentions[0] to get the user
not working @radiant kraken
this is discord.py
not at all @earnest phoenix
you use discord.py right
yes
hi
I know @earnest phoenix you think I am a fool?
try message.mentions[0], it should work @wanton anvil
not working @radiant kraken
what is the error?
nonetype
it's because the message didn't mention any user @wanton anvil
@surreal notch certifications are closed rn
Y
sure np @wanton anvil
Not aure
-servercount @scarlet folio
@scarlet folio
To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.
cool thanks!
You're welcome!
@earnest phoenix learn the rest of js 
Hmmm
@pure lion what would you want out of a bot?
did someone got a idea how to increment a value in a subarray in a Mongoose Schema?
votes: [
{ String, Number},
{ String, Number},
{ String, Number},
{ String, Number}
]
```my array in the Schema Looks like this. i know i can use the $inc operator but cant figure out how to define the Field i want to update (check where string = string and then update the number for it)
isNaN to check and if it is update the number next to it?
you cant use isNaN inside a Mongodb Query
O
So uh, I am new to discord.js
And I entered some code, but I also need to somehow make the command work.
Like, <help it will respond with an embed, but idk how to make command triggers...
Does anyone know?
@pure lion found a way to solve it
you are comepletelly new to whole js then, i guess 🤷, but make a message listener and then check if the message content matches the content you want it to be
Who can help me ?
@pure lion Dice?
dont ask to ask
await Poll.updateOne({"pollmessageid":message,"votes.vote":vot},{$inc:{"votes.$.votes":1}});
|-> Primary key | | | | | |
|-> Key for the Item in the object |
|-> Increment | |
|->Object Field
|-> Replaces the Index number
|-> Field Name in the Object to update
|->Amount to Increment

votes: [{vote:String, votes:Number}], this is the line for this in my Schema
O w O
if it is array just .push() it
Why push into an array when you can increment a single ID'd value
But maps and arrays are good at what they're made for
or .find
it is good 2
if ur array has object inside
Guys idk how Ultron got vertified dev role
like he asking the most basic things in djs
@earnest phoenix hbd
n0 aDvErTiSiNg!1!!!1
Use webhooks smh
^
my mistake, 🤦♂️ thought you were saying "add the bot", not "add this feature"
:))
USE WEBHOOKS
can anyone say me what is best api for random memes
ksoft
reddit api
thanks
Hey, so I made gay command and the percentage is same all the time. How can I make it same per user? (discord.js v12)
Code:
if (message.content.startsWith(prefix + "gay")) {
let embed = new Discord.MessageEmbed()
.setDescription(`${message.author}, you are ` + Math.floor(Math.random() * 25) + `% gay. :rainbow_flag:`)
.setColor("#A4C9F6")
message.channel.send(embed)
message.delete()
}});```
😄
or switch lib
Hey, so I made gay command and the percentage is same all the time. How can I make it same per user? (discord.js v12)
Code:if (message.content.startsWith(prefix + "gay")) { let embed = new Discord.MessageEmbed() .setDescription(`${message.author}, you are ` + Math.floor(Math.random() * 25) + `% gay. 🏳️🌈`) .setColor("#A4C9F6") message.channel.send(embed) message.delete() }});```
@ember oak database
how can I do that? I started coding few weeks ago so I'm kinda new here
can anyone say me what is best api for random memes
@wanton anvil
I'm using the heroku one (https://meme-api.herokuapp.com/gimme/)
ok
You shouldn't rely on an API that's on heroku
It could go down at any moment
oh they actually have their own? whoops
Yeah
if (message.content.startsWith(prefix + "meme")) {
const api = require('imageapi.js');
let subreddits = [
"pewdiepiesubmissions",
"dankmemes",
]
let subreddit = subreddits[Math.floor(Math.random()*(subreddits.length)-1)]
let image = await api(subreddit)
let embed = new Discord.MessageEmbed()
.setTitle(`Random meme from r/${subreddit}`)
.setURL(`https://reddit.com/r/${subreddit}`)
.setImage(image)
.setColor("#A4C9F6")
message.channel.send(embed)
}}); ```
what lang do you use?? @cerulean venture
They do
Random meme from reddit code
that heroku one uses reddit api thp
imageapi.js is unrealiable
what lang do you use?? @cerulean venture
@wanton anvil nodejs
just go with node-fetch
oh
Plus it's just a port of random-puppy
ah
I use python
@ember oak database
@restive furnace for something like this you actually don't need a database, you can create an algorithm working from the user's id
mobile ;(
well, thats another possibility
I made that mistake once with like 7 people
creating an algorithm is literally just doing math
Who were pinged in the message
you can do anything you want with the user id
Every single ID is a special little snowflake
So I actually have a question.
I stored user id's in a database and now I wanna check if the id is actually on the server where the bot would @ them. How would I do that?
could probably loop through them I guess?
fetch the user from the guild
you aren't sure if they're cached or not so looping through cached members would not be reliable
hmm true
you need to loop -> if not found make a request to get the user -> if not found they don't exist in the guild anymore
if you're using djs, the fetch method does exactly that
oh neat
if you're using djs, the fetch method does exactly that
that actually helped a lot 🙂 thanks
what do the different http requests do?
yep
how do i remove the first 5 letters of a string?
more specifically i want to remove the ;vote from the first choice
k
what do the different http requests do?
@earnest phoenix
they're just indicators on what to do, some (like POST) allow providing content in the body, see https://restfulapi.net/http-methods/
wtf is rest
thishappended
@mild flower happeneded
thishappened
@mild flower you wrote your code wrong
?
show it
wait
just recomment for functions
@earnest phoenix i am using it from last 1 month lmaoa
a
what?
Bruh
REST is an architecture meant to standardize how APIs are provided and used
what the heck
Subatring doesn't return an array
is that code
Yoir getting the first letter of the string
epic gamer code
and instead of doing like that
Look at this:
var votefinal = (smth).substring(5);
votefinal[1]
Which just gets the second letter of the string
then how do i fix that
don't put [1]
;-; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
duh
Bye
Hello Devs
Does someone knows how to see over how many members you bot is watching, I know how to do with servers
Well here I am again with another question.
I'm trying to use node-cron in my index.js to be precise in my on("message".
Somehow its just doing nothing, it gave me a few errors before so I know it's actually getting called but somehow it just does nothing?
https://pastebin.com/wW9qVSs7 <- that's the cronjob, has anyone any clue why that happens?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
<client>.users.cache.size;
Nearly as i said
wym be Reduce?
loop = more api requests = Ratelimit = F'ed up
if i am not wrong
i had ;-;
so i want to be on safer side
const type = channel.type === 'text' ? 'SEND_MESSAGES' : 'CONNECT';
const locked = await chan.createOverwrite(chan.guild.roles.cache.find(r => r.name === '@everyone').id, {
[type]: null
});``` it also makes the channel read message as null
how do I make it only change send message to null
?
not you
i just posted minecraft coords lol
lmao
YES I DID IT
Hi!!!!
i did epic gamer moment with le substring
lol
yEA BOI
didnt work
``let votesplit = votechoice.split(',')
if(!votesplit[1]) return message.channel.send(Evote);
let votechoice1 = votesplit[0].substring(5)``
wrong gif
You could just do - if not sharded:
amount = 0;
<client>.guilds.cache.forEach((guild) => {
amount = amount + guild.memberCount;
});
or reduce it as somebody sent above as well
anyone know how to check if someone has a specified role, i've looked everywhere and cant seem to find one. im using disc js
k\
a + b.memberCount, huh?
or
js guildsCache.reduce((a, b) => a.memberCount + b.memberCount)
@restive furnace this works
things inside [] in the dlcs are optional
ok fair enough srry
embed.setDescription(*Name: @${message.author.tag}*)
^^^ How do I ping someone ^^^
but that wont work @restive furnace
messageAuthor#mention @serene echo
or @${msg.author.id}
they're on Eris?
no, eris doesnt have embed constructors
that's not a good idea
@pale vessel
Thanks so much it works.
user info embeds will ping roles and users
only description right
that's going to be a massive disaster
yee
When you cant figure out why your changes on the code wont change the behavior of the expected output and you realize after 20 minutes you upload the wrong file all the time
nvm
yeh
yeh
Maybe a few other servers
Discord bot land
yd
my bot is in 447 servers
Wich bot is that?
There is nothing wired some guilds could have 20k users
black sheep
^^
K
Please include a bot mention or ID
-bots @delicate shore
that
but you did it anyway, what a madlad
-botinfo @outer marsh
Please include a bot mention or ID
oh
dude
but you did it anyway, what a madlad
@pale vessel me?
How to make bot loop
Like Loop Script ( Discord.js )
basic javascriåt
not only discord.js
but fine: js for (let thing of client.users) { console.log(thing.tag); } for example.
theres 2 other types too of loops in js. for loop and forEach.
quick google search hould cover that up
while?
-bots
well its not recommended for especially for beginners, since there can come memory leaks and etc.
Hello Pro-devs how do I make changing status?
You guys are insane
like PRO devs
no
iterate through array, and then set it to bot status, but dont change it like 30 times / min
make some cooldown
but thats basically how to make it
use setInterval..
what
the
fack
indeed
add them to a map or set
and check if the map or set contains something specific
what?
hes talking about changing presnece
you dont need map or set for that
uhh
he said "how do i put cooldown"
you don't even need map for cooldown
^
just use normal objects and delete
no an interval will work best
how
what? and how?
thats what you said free
you misread the question
setInterval(() =>
{
<clientUser>#setPresence(object.n);
}, 30000);
// i assume you are using discord.js, alternative for eris is <client>#editStatus(object)```
you misread the question
@pale vessel oke
Ok first of all, if you haven't learnt basics of the language, I recommend you to learn the basics. Second, dont ask to ask, thank you.
Help
thats not development question
read what is says
with your eyes
where you start your commands with
read what the say
How do i put cooldown
@earnest phoenix there are multiple ways i can teach you the method i use
@earnest phoenix your token is on github
@normal ether did you even make a bot?
@earnest phoenix and dont create 4389248932 message listeners
Yes
you only need 1
wtf
@normal ether so you made a bot account

not the actual bot
yeah
Yes
you need to learn
you have to code an actual bot before adding it
how to speak english
else you're basically adding a dead bot what will be declined
Ok
there is a joke server nuker bot
Ok first of all, if you haven't learnt basics of the language, I recommend you to learn the basics. Second, dont ask to ask, thank you.
@restive furnace third, you dont start making bot by posting it to top.gg
yep
Ok
you dunno if you'll finish it before they review it
but that's an AWESOME timesaver
tbh
Ok
So can someone just help me code a bot
yep
this is the chanenl
for help
but we won't help if you ask us to make your bot or demand help
play it cool and everyone will help you
i would help, but my requirements for helping someone to create a bot are that he can knowledge about the basics of the lamguage
just realized i am kinda minimodding
f
i would help, but my requirements for helping someone to create a bot are that he can knowledge about the basics of the lamguage
he can know ledge
i dont think so
i am telling you to fix your grammar
ok sorry for small mistakes when im writing fast, and "very funny" lol

And auto correct
lol
ok
Yes
which one?
ok i could install grammarly for no mistakes but nah, and auto correct annyoing
Python probably
Java
java or javascript?
IT'S NOT REAL
how
so you know how to code in java?
HOW DID THEY TEACH YOU THE HARDEST LANGUAGE IN THE WORLD DEFINETELY NOT SUITABLE FOR BEGINNERS
It’s all I focused on
bye guys
java or js?
seems legit
Java
me gonna die
okay
Ok
Ok
well, theres others, but jda has best docu
from google
@normal ether if you know how to program with java, check out the JDA library
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - DV8FromTheWorld/JDA
Yeah
github the bet
You can use anything to disguise on grabify
*best
you cant
It's a direct link to github
and why would tim grab your ip uhh
You can use anything to disguise on grabify
BRO DOMAINS ARE BOUGHT BY GITHUB
1000 IQ verified
lol
can't have shit in detroit
Bruh
how do i know that's not xyz
you read the url, you hover over the url and read the hyperlink on the bottom left corner of your browser if you dont believe the url
var phin = require("phin");
phin({
url : "https://discord.com",
method: "get"
});
Yeah bro
what does the get method do
then you did something dumb
please stop swearing it makes me uncomfortable
anyway just google JDA discord
the get method is the same as opening the link in a browser
so it basically grabs informations?
it doesnt store it lol
it basically stores it in RAM right?
is that why discord destroys my broswer
broswer
yes, but only while you're using it
once it goes out of scope, it will be garbage collected
representational state transfer
lul
idk wtf i just said
its basically a stateless request
meaning that the request can be done from any computer at any time without any precondition and it will work
for example, it doesnt require logins, nor account sessions
cool
so i can't use REST stuff for the Discord API because some stuff requires my client secret
please say i understood right
Then that means me using OAuth2 for my API/website makes it non-REST, correct?
umm
discord has a REST API, which works anywhere from any computer, as long as each and every request includes an authorization key
you dont need to login beforehand
like this?
Oh, I see
<url>/file.html?stuff=stuffvalue
that's PHP right
man why does repl.it take forever to load
I JUST WANNA FIX A CORRUPT FILE
and they present me with a captcha
those are called "query parameters" or "url parameters" or "query strings"
?bla=2&etc=3
yes
yeet
php is server side, and jquery is client side (ie, inside your browser)
and nodejs is both
nodejs is server side
there is no nodejs inside your browser, but browsers have their own built-in js engine
they are both javascript engines
gay gapple got it wrong
a miracle just happened
repl.it loaded without presenting me with a reeeeeeeeeeeeeeeeCAPTCHA
also imma go embed my whole freaking bot website as my bot description 
btw
if i do:
var phin = require("phin");
async var potato = await phin({
url : "potato.com"
method : "get",
parse : "json"
});
potato.com returns:
<!DOCTYPE html>
<html>
<body>
<pre>
{
"yeet":"yeet"
}
</pre>
</body>
</html>
Will it "parse" the "JSON" on the page and potato.yeet will return yeet?
I assume it will attempt to parse the whole response as JSON
that will include all HTML
yes
what is json?
to parse a website response as json, it needs to send the response as json, not as html
javascript object notation
When you put a try{} catch(err){} function on your whole bot.on("message") function
ram and cpu wasted
Is it our browsers parsing JSON responses under <p> elements, actually?
because my ide automatically detects syntax errors
and i rarely make any other errors
json is a portable way to represent basic javascript objects in plain text, in order to export them and transfer them to other programs and even other languages
what are JS objects
instances of classes
let object = {
a:10,
b:20
}
``` this is an object
5 is an instance of integer, technically
other languages
me who's learning python for no reason: aah that killed me
Thank you
They're dictionaries in Python
why is this.client undefined
Very much
who
are you using classes
what would this be
No
or just doing random stuff
I’m thanking
ok welcome
You help me make my boy

Bot
What is this in py?
self
you're welcome and good luck using JDA
this means this
Oh
usually self but you can make it anything
It’s really easy
Thanks null and shiv
no
sure yw
I don't exactly remember if it's PEP or just people's preferences
If you pass computer science
don't lie that Java is easy HAIL JAVASCRIPT
me in high skool
Anything is easy if you have experience working with it






what type of bot should i make?
