#development
1 messages ยท Page 467 of 1
syntax highlighting
code completion
dark theme
sftp plugin
linting 
Honestly
must be N++
notepad++ is good, very customizable, supports themes and custom color schemes as well
no reason not to go with it
Ok
Hello, how can we do (javascript / discord.js) an option to delete messages because of words, can I or they are?
Exmple, I want to delete all the messages that contain the word "pizza", and that I say "I like cold pizza" (sorry for the example) what will the code please?
@restive panther we arent gonna spoon feed you
is message a string? @restive panther
no
SHHH ๐ก
you have to check message content
๐ก
its not spoonfeed but ok
Sure ? it does not work if it's in the middle of a sentence!
send code
pretty sure includes is for arrays btw
wait
but idk it works with a string
yes it does

Ho , yes , thanks
yea i know
and ?
im not talking to u xd
Nice visual @earnest phoenix
just helping people learn to think with their head
cuz my badges are a string and i use includes to check if someone has that badge already
like "
which property could be the content of the message?"
if not give badge
So ??? I must do what ๐ญ
you must use .includes on the message content
and check if it includes your desired substring
Uh
you must use .includes on the message content
message
content
message isnt message content
no no no stops
boi
you cant check if a function is true lul
@restive panther message is not a string like a word
you can
๐ญ
?
poor guy never learned what a string is 
But content returns a string ay?
oof
ye
And delete doesnt return a boolean either
if (message.content.includes("pizza") ?
yes
ok !
syntax error expected ) 
You missed a ) luuul
tanks
but uh ur missing a )
Ok
i wonder if he knows how to delete the message
So , for delete the message is " if (message.content.includes("pizza")).clear !
@_@
Basically i dont do it aleardy cause i dont know how to remove tr bot from all servers
Or make a mensage appear in all servers
@quartz kindle same tbh
@knotty steeple you had to teach my the same thing

There is no away to remove my bot from all servers?
there is
delete it
loop through guilds
You delet the bot from discordapp.com
what if he doesnt want to delete it
Im talking about a command
but you can't use you too
Example
why would you want a command like that
loop through guilds and remove
holy poggers batman
portugal caralho remove what? leave the server?
Yup
remove the bot from the server
@quartz kindle tuga?
idk about python but uh
+/-, also english only here
To be honest my bot is running in a server and idk how to shutdown it ๐ ๐
guild.leave() 
Server.leave
lol just
foreach(SocketGuild guild in Context.Client.Guilds)
await guild.LeaveAsync();
wait fuck you use python
but it really is as simple as that loop
if you're actually proficient at python then you should easily he able to translate an idea in one language into another
if you cant help dont
how did my bot get approved when I forgot
if (msg.author.bot) return;
@earnest phoenix cause it's not required
mods dont decline bots if they respond to other bots
im pretty sure they didnt
Why has every rule changed
they require a bot filter for cert
not approval
and if they did change the approval rules then it's probably because the average competence of bot developers has dropped massively lately
thanks djs
I will do a 'bot' to remove it from all servers and let a message
^^
cant code
mass message
leaving all servers
whitename
totally not a compromised bot 
must be DBL dev chat
guild.leave()
This is a thing right
Yup
Only one who really helped ^^
can we pin what tom just said
so , how I need to do ๐
if (message.content.includes("pizza")) {
message.delete()
} ??????
Rewrite Version: guild.leave()
Await Version: server.leave()
yea thats right
because it's don't work
its good
wait isn't the await lib deprecated af
Await is the stable one i think
what
I simple do pip install discord.py
no
You could use the in operator instead of includes.
ok
no .includes is correct
Anyway i use await
MDN string prototype includes
Any example for a cooldown system?
Async* ๐ฉ and need to await server.leave() too
thanks @earnest phoenix
delete is a function
๐ญ
@commands.cooldown(1, 5, commands.BucketType.user)
Python?
Yes
Ok tyy
lmao
Wait
I dont use commands
how do you make cooldowns in djs
I use client.event
So , what I need to do PLEAS

well what i do is
Universally you need to store when the user used it and if they use it again check the time difference.
i make a set and then when someone runs a command add them to the set then if they try to run the command and they are in the set return a cooldown message
@solid cliff that dont work to client.event?
@earnest phoenix pseudocode:
on message
if using a command
has this user ID used this command x number of times in the last y number of seconds?
return;
and i use settimeout to remove them from the set after a couple of seconds
Won't work needs commands to be used
And i died
thats how my cooldown works 
Can implement your own by getting last command use time and current
Too much advanced to me but i will search
if (message.content.includes("pizza"))message.delete; d'ont work
crash all the time
You need space
if (message.content.includes("pizza")) {message.delete}
sure ?
It works too
that works for me
if (message.content.includes("pizza")) message.delete
ok
Should work
delete is a function 
Oh
so ?
Shouldn't it be .delete()
it should
message.delete
not working
@restive panther i have a class for you
if(code) {msg.delete();}
?
there is this thing called sololearn
-_-
im learning python with sololearn also lmao
ok
i used tutorials to learn js
I'll probs learn Java on sololearn
make a game in java
i mean once u know one programming language learning another is so easy
^
problem with all these online tutorials is most people 1) dont bother actually finishing or understanding them
- most are 12yo makign discord bots and dont have the capacity
We all have to learn from the creator of the language
@earnest phoenix
yes
lmao
no
...
im gonna go work on my thing
its basically starboard except its not
@earnest phoenix it's @grave sonnet
did u read it? 
I think I need another bot my main one if ruined
if u did and u dont get it, send here
and we will help
error pls
i mean the first if will always be true
becaise args[0] is most likely a string
so isNaN will be true
client.users.get(${args[0]}).send(embed);
it cant get the user
you are getting a user that doesnt exist
most likely
send the error
the stack trace yes
do I make a premium version of my bot?
why would someone pay for NSFW
ok so channel is undefined @earnest phoenix on line 3
are you sure that message is a message obejct
so no
what are you passing to the command as message
aka where are you using .run(...) for that command
yes but where are you using it in your command handler/mssage evvent or whatever
ok so send the line where you use it
ok so you are passing 5 arguments
...
exports.run = (client, args, message) => {
...
...
commands.run(client, message, args, ops, func, prefix);
...
so you are passing it in the wrong order
no, just look
they need to be in the same order 
great, i got a dm 
no from the president
๐
how do i make my bot play local music file in a voice chat
and then leave when the file ends?
- what lang + lib
- what have you tried
- are you getting an error
discord.js
Have you tried anything?
nop
Well
im trying rn
here @lone orchid this might put you on the right track https://img.69420.me/3qQfFAvn.mp4
thru ffmpeg
y discord ๐ก
?
my video didnt send nvm discord being stupid
Does anyone know how to make command for getting mentioned user avatar and sending it on chat?
.py
rip somebody else can help :p
Oof never done py
well never done discord.py or whatever lib
code blocks?
?
anyone here use canvasjs for charts and know how to make it not make the canvas styled as position: relative; ?
@vagrant pumice Commands extension or event on_message? @vagrant pumice
on_message
Well, remove the <@ and > from the mention and you get the ID, then use get_user or get_member on it
Docs for more info :v)
what do you mean @earnest phoenix
I have no idea what your command name is :^)
@quartz kindle well basically you give ID of a div and it puts the canvas inside, but sets it to relative/absolute for some reason
really? never happened to me

are you working with a blank/unstyled page/container?
no
then check the css hierarchy, maybe there is some css rule assigning that to it
nah its the divs created by canvasjs
children of the one i give
and its stylign them that way
ah the canvasjs lib
i havent used it, but i assume they do it for a reason. regardless you can override css styles set by packages
yeah i could
i mean only issue is that it goes over my navbar since its fixed position
but i acn just increase z-index i guess ๐คท
bandaid it lmao
does it have negative top position? its position should be based on the nearest "relative" element
the navbar? no its top:0, and the canvas is wrapped in an inline-block div
i dont think i use relative anywhere else on my page at all
well i'd have to see the structure you're using, but if navbar is already absolute, then yes you should use z-index
no its fixed
the canvas should be inside a relative element, so its position is based on it, and not the page or whatever comes before
same for fixed, any of them will remove the navbar from the document flow, so anything else you have there will overlap it
if you have a fixed navbar, have the next element have a margin-top equal to the navbar height
yeah it is
i mean the positioning of the navbar and page is fine, just bugs me that the canvas overlaps if i scroll down
ahh ok ๐ thanks
or make the canvas part of the document flow by removing "position"
i would but it automatically makes those divs so z index works for me
alright
btw, how do you organize your z-indexes? its funny to see how people do it xD
some people use: 1,2,3,4,-1, etc. other people use: 9,99,9999,999999 lmao
well if any real planing went into my page i would come up with some standard for my site
but rn i dont do it any particular way
i do the 999 thing lmao
.
HI
I'm completely new to jda and have no idea what I'm doing, and it turns out I can't even import the lib without it saying it doesn't exist
I've set up gradle and it should add it but nope https://discord-is-down.party/Kx95MGtD.png
what's the output of gradlew build?
there's a button to the left of that which changes to text output
can you run gradlew build (or ./gradlew build if you're on *nix) in the project root?
can you echo the JAVA_HOME env var?
might also need an IDE restart to refresh env vars
I'll just restart intellij
that's not much different https://discord-is-down.party/m5Y8cEP6.png
litfam yeet
thanks sanae
so I'm having some trouble getting a switch case statement use a command with arguments correctly.
what I have is:
const args = message.content.slice(config.prefix.length).trim().split(/ + /g);
//const command = args.shift().toLowerCase();
switch (args) {
// Grimtooth's Info (aka, Grimtooth's Arrogance); working
case "info" :
Info.run(message);
break;
case "type" :
var typeSearch = Type.run(args[1]);
console.log("Origin: " + typeSearch[0] + "\n" +
"Name: " + typeSearch[1] + "\n" +
"Suggested Biome(s): " + typeSearch[2] + "\n" +
"Trap Type: " + typeSearch[3] + "\n" +
"Trap Subtype: " + typeSearch[4] + "\n" +
"Deadliness: " + typeSearch[5] + "/5");
break;```
then in the file it's calling to, I have:
```const List1 = require('../traparray.js');
module.exports.run = (args) =>{
// makes a variable with what follows the command
var trtype = args[1];
// check to make sure this makes a list of results by search
console.log("the slice worked.");
const search = List1.run("fill").filter(result => result[3].find(thing => thing.includes(trtype)));;
var rand = search[Math.floor(Math.random() * search.length)];
return rand;
}```
the List1 is a 2 dimensional array, however the argument is to help it search for any rows that have a matching element in them, then choose one at random from that new list. I've tried the switch with (command), it won't do anything unless it's specifically ";type" all alone in 1 comment.
you're giving it an array and then having cases based on strings
you need to do something like this javascript switch(args[0]) { case "type": blah blah blah code here break; }
actually, you're not even capturing what the command is
I've temporarily commented out command, because it was looking at args[0] exclusively
basically, a test
o
so I had the switch(args) changed to switch(args[0]). It's doing the same thing that would happen with switch(command), where it wouldn't allow an argument to follow behind
you should do the switch only on the command and pass the arguments later in the case block if you need them.
for example to get the text after a command (after the first space) you could define a extra variable:
let text = message.content.split(/[ ](.+)/)[1];
How do you make clickable links in richembed? like text is "Hello" you click hello it takes u to a website
also, pretty sure they are call just embeds... If not, then show me an example of a poor embed
@neon swift there real name is Rich/MessageEmbed
I think it's actually a meme, but yeah, calling it richembed is just a waste of 4 characters
looks like in the developer documentation they use both "Embed" and "rich embed"
we all know it as an embed tho
so Xavin, any idea what that stuff in .split() does?
yes it splits the string on the first space and takes index 1 (aka the right side of the split) if you ask about the var text =...
alright, so if I did var search = file.run(text);, would that work?
idk what your file.run() method is but text will be for example if you type this:
<prefix>command hi there this is text --> var text will be 'hi there this is text'
try this and see what happens (replace the prefix and "command1" ofc)
//split message by space
let args = message.content.split(/[ ]+/);
//split on first space to get the text
let text = message.content.split(/[ ](.+)/)[1];
let cmd = message.content.startsWith(prefix) ? args[0].substring(prefix.length).toLowerCase() : undefined;
switch (cmd) {
case "command1":
console.log(cmd);
console.log(text);
break;
}
it doesn't return anything when text trails after the first space, however when there's nothing after it, it returns
" command1
undefined"
How could you check if a user has voted for your bot using the dblpy lib?
@sturdy chasm is shows you undefined bcs the text would be undefined in that case if you just use your command without anything after
I think the limiting factor may just be that the switch is looking for any message that matches the command to a T. In other words, it'll ignore ";command message", but it'll register ";command" as a success
that is bcs you have your args defined differently than in my example
oh! I have this above it!
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
do you think this may have something to do with it?
@cold harness thats more of an #topgg-api question but maybe its this https://dblpy.readthedocs.io/en/v0.1.6/api.html#dbl.Client.get_upvote_info
@sturdy chasm no it doesnt i gave you a functional example and it works totally fine for me and i told you what you do different than in my example
why regex split for a single space
rather than just use an actual space
if ur using regex, do it for all whitespace chars or soething lmao
y its just a example there is more than 1 way
alright, well I'll try looking to see where I have args defined differently, but I actually did change it to what you had.
let text = message.content.split(/[ ](.+)/)[1];
let command = message.content.startsWith(config.prefix) ? args[0].substring(config.prefix.length).toLowerCase() : undefined;
switch (command) {
case "type":
console.log(command);
console.log(text);
break;
}```
yeah like .split(' ') ๐
you messed up the args split by adding additional spaces in your regex
solution: dont use regex to split space only
y'know Tom, it makes me laugh at it all. I just tried the .split(' ') on args to go on a whim, and that solved it.
thanks, both of you. Now I'll be looking up why it thinks ".find" doesn't exist in my original code
Hey
I haven't made a bot in .py before
How can I learn, or get the code to get it online?
get python online?
you learn python just like you learned the other language 
Oooh
I think it is https:/discord.py.org
Ok
its actually https://discordpy.readthedocs.io/en/latest/
yes that's async
well don't mislead our fellow here, apparently he can take a discord lib as a site already
ok fren
is "latest" rewrite?
then what is latest and stable?
well whatever, I haven't checked any other versions but rewrite and a little bit of async
no shit
it is
@ruby dust nou
how do you know js kid
yes really
cause I said not really to the second one
both
oh
rewrite is 1.0.0a+
Would anyone know a good open source paginators for d.js?
Or just javascript in general
nope
make it yourself
I already did sis
what
Anyway nevermind
..ok
Anyone able to deeply help me with API, I need to make a API bot but im completely unfamilier with how to do so
you already posted that in #topgg-api
I know, just seeing if anyone in this channel also knew
its not like the channels are limited
I know, but some people just sit in this channel
after addding a bug command which reports a bug to me, whenever i run node index.js it gives me the error UnhandlesPromisRejectionWarning: Error: 502 Bad GateWay
any ideas why?
has to do with connection
5xx errors are server errors
hmm, how would i fix that
you don't
you cant
unless you own whatever is throwing 502
as in what's in the other end of the connection
rip
are you sure its after you added the bug command
try rolling back to see if the error pops up again
by do you own it, do you mean the server?
cuase i self host
rolling back doesnt fix it
so what do i do, wait?
@inner jewel do you mean if i self host?
5xx are http status codes
an http request is failing due to a server error on the other end
ok, so i just have to wait and hope it gets fixed?
most likely
so would it be one of the apis that is broken?
the line after the error is at ImcomingMessage.res.on(dbl api's index.js directory)
DBL is down
oh rip
and would that make it possible to break other commands?
oh wait nvm, i see what i did for that command
im trying to make my testing/beta bot only reply to donators, and for some reason this if statement - if (message.author.roles.includes('480177630864211988')) { . . . is throwing me this error - ```
if (message.author.roles.includes('480177630864211988')) {
^
TypeError: Cannot read property 'includes' of undefined```
d.js?
ye
its message.member.roles
yw
now its giving me message.member.roles.includes is not a function
.roles is a collection and .includes is a thing so idk whats wrong with it
isnt .includes supposed to be for a string
oh, what would i do for a collection
thanks, srry im a rlly bad programmer and i rlly dont deserve to have s successful bot
lmao
-bots @viscid falcon
@dusky helm

srry
yo dogs
-bots @primal ferry
@tulip trellis
OK
Hi,
ive got this error (node:24246) DeprecationWarning: Collection#find: pass a function instead
My code is ; message.guild.roles.find("name", role)
can someone help me ?
@primal ferry change it to js message.guild.roles.find(role => role.name === 'name')
Now cant find role
if(message.guild.roles.find(role => role.name === 'name'))
@bright spear
What bot tells when someone in the server change his pfp
pfp whats this ?
profile picture @primal ferry
@fossil oxide i wanted you to decline my bot. I was asking before to decline but you never answered. Thanks
@floral helm dont ping oliy -.-
hey, i've built a dashboard for my bot, and i need to register a redirect URI with discord, but the developer portal won't let me. can someone explain how i would do this?
ty. i'll give it a shot
@bright spear im guessing the oauth secret would just be the client secret right?
uh not sure
How i can get AvatarURL By user id ?
i did it
client.users.get(user.id).avatarURL
@earnest phoenix
๐
Any way to access APIs using a proxy in NodeJS?
Several proxies/new IPs will be needed.
does anyone know why my discord bot keeps performing my commands twice
i am self hosting rn
i use Visual Studio Code
Lang : Python Rewrite
Win64
When This Happened:
it happened when i was trying to upgrade my python fro 3.6 to 3.7 now, its keeps doing this
What is the best free meme api?
-bots @earnest phoenix
@manic grove
@stray hatch
@hybrid pulsar
#memes-and-media or #commands @earnest phoenix
@earnest phoenix are you sure you're not running two instances?
^
also when upgrading python
it tends to bug out and try and run the same running application that is currently being ran in the background
you need to fully close out and re-open
Guys what is this /dev/sdal folder and how to remove it?
My server doesn't have space and mysql isn't starting
client.user.setStatus('online');
for do not disturb, is it client.user.setStatus('do not disturb'); or client.user.setStatus('dnd');
'do not disturb' doesn't work
someone knows how to tell if "kick_member" on audit logs was added just a second ago then do something?
like if(auditDate === Date.now()) or something
@bright spear will tis work:
if (command === ('botinvisible')) { client.user.setStatus('invisible'); }
is it ok to list events like that?
how do you make a list in .js and pick a random value
where do you put the list entries there?
you make an array
const array = ['some', 'array', 'elements', 1, 2, 3];
you look how to get a random number:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
then you think "
... if I pick a random index from 0 up to the arrays length, then I can get a random array element"
So you generate a number from 0 to the length like:
~~(array.length * Math.random())
Then pick that element:
array[~~(array.length * Math.random())]; //you will get a random element
Then, you remember that this is simple coding knowledge and you should hit up https://google.com instead of asking for 
The Math.random() function returns a floating-point, pseudo-random number in the range 0โ1 (inclusive of 0, but not 1) with approximately uniform distribution over that range โ which you can then scale to your desired range. The implementation selects the initial seed to ...
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
so replace the 'some' with the text
if u dont know what an array is ur out of luck
but is that right?
so erm, you'd have to scrape data from a website if they don't have an api right?
yes
yeah
fun
will any method work or is there like, a fast way of doing it?
the site i want data from is really really really messy code wise
use cheerio if ur in js
if the content is pre-rendered, use an http library with cheerio (personal recommendation)
if it's not, use phantomjs or headless chromium
i'm guessing the site being loaded by a app.js file in the rclick->view page source screen means it's pre-rendered right?
how do you pick a random value from "array"
math.random
already explained it
yes where array is the name of ur array
If my bot was kicked, how can I re-add it here?
Ask why your bot was kicked to begin with, then fix the mistakes and try again
Hello
Why am I getting this error?
I think something about .js
discord.js
Is there anyone there?
Both of them
message.guild.roles.find(role => role.name === 'roleName')```
let gonderilecek = guru.channels.find(id, raporkanallarฤฑ[msg.guild.id]);
This is mine.
you are on master, right?
๐ Do not wave D. I just started these things.
message.guild.channels.find(channel => channel.id === raporkanallarฤฑ[msg.guild.id])
Oh. No problem. Thank you.
The problem did not change.
Do I send the codes?
mmm. ๐ค
Help me.
Pls.
if you have a channel id already just use <Client>.channels.get("channelid")
..
Hey, how can you do it that when a user upvotes on discordbots.org that the user who upvoted gets somthing?
its in their api
Found it ty. โค
np
@bright spear yeah i found out the i used bot.process commands in a cog lol
Sorry for the ping if you didnt want it
@earnest phoenix
Use the kick/ban command of your api and check that the user entering the command has kick/ban permission
Im not a .js guy, try read their doc
@earnest phoenix how do you check if the user has ban / kick perms?
what lib
.js
oh
What library
Bruh
idk
What library
you don't know what library you have
no
ok
i do not
Are you using discord.js
yeah
i said that at the start tho
no
but how do i do it
you just said .js
anyways its
if(message.author.hasPermission("BAN_MEMBERS")) return ("some no permission thing")
if i send the edit link, can you check if i am doing it right?
Create an alt an test kick/ban on it ๐ค
now
if (command === ('ban'))
{
const User = args.join(' ');
}```
what is the command to ban ${user} ?
oof
so member.ban(User)?
User.ban
ok
User.ban()
if (command === ('ban'))
{
const User = args.join(' ');
User.ban()
}```
does that work?
can i get somebody to test it on?
can someone pls explain how do I make my bot online?
pls
@quartz dune developer?
bot developers?
pls
@light tangle what are you using to run the bot
I don't know I just wan't to make my bot online!
We cant help you if you dont even know what you are using
wait let me check
im using discord
this is the client btw 480214315530715176
where you copy bot from? that would help
you mean the link?
Yes
....
what?
@light tangle
https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/getting-started/the-long-version.html
^
wth
What program/app are you using to make/run the bot or any kind of website that showed you
read the guide it will help clear up all your questions
does someone know how i can send a message to all servers the bot is in with the command !sendmessage
btw does that count as api abuse?
well would depend on the size of your not
bot*
but doubtfully
most bots do it
what language
yes it does count as api abuse in most cases
there are a lot of bots that send out messages to servers
it's not okay in any way
^
Why not send a message when you run the bot then
just set up some flag the the bot started running because you restarted it
It just set status saying bot is restarting
If you want to send that message to all servers it will be counted as API abuse
i mean wouldnโt that depend on 2 servers vs 1000 tbh
hi i wanna send a message to every server my bot in 
oof
Client.on(eventName, event.bind(null, Client));
^
TypeError: event.bind is not a function```
it works for all other events
but the disconnect event
nvm
my friend spelt module.exports wrong smh
if it was a toggled event then they would be safe like, guild setting the option to allow updates
hey, i get this when i go to my bot's dashboard: http://dashboard.minime.fun/
the code can be found here: https://github.com/mini-me-makers/mini-me/blob/master/addons/dashboard.js
is there a code to know who is bot owner ? (discord js)
I know this question already exist but I didn't find an answer...
Which then returns Oauth2Application
And OAuth2Application has a property .owner
How do I send a dm to a specific Id?
@topaz fjord do you know how can I do this ?
.fetchApplication() requires an id so you have to put the bot id
Super thanks a lot ๐
Hey,I got this ``` Ignoring exception in command serverchannels
Traceback (most recent call last):
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "C:\Users\Gebruiker\Desktop\Rex\Official bot\Bot.py", line 103, in serverchannels
await bot.say("I counted {} channels in this discord!".format(ctx.message.server.channels))
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 309, in _augmented_msg
msg = yield from coro
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)```
when I executed the command that has this code:
@bot.command(pass_context=True)
async def serverchannels(ctx):
await bot.say("I counted {} channels in this discord!".format(ctx.message.server.channels))
(Python)
Does anyone know how to fix this?
Counting... but ctx.message.server.channels is not a number 
Forgot len()
should i integrate https://www.npmjs.com/package/dblapi.js into my bot now, while im waiting to be accepted/declined or should i do it after my bot has been approved
after
um, strange
Anybody have any easy ways to make a dashboard for a bot written in d.js?
@opaque trail you can only get a token after your bot has been approved
You can start on the code but testing isn't possible
ah right alright
hi
/app/events/guildMemberAdd.js:4
2018-08-21T18:32:49.605436+00:00 app[worker.1]: member.guild.defaultChannel.send('hg '+username+'');
2018-08-21T18:32:49.605438+00:00 app[worker.1]: ^
2018-08-21T18:32:49.605440+00:00 app[worker.1]:
2018-08-21T18:32:49.605442+00:00 app[worker.1]: TypeError: Cannot read property 'send' of undefined
2018-08-21T18:32:49.605444+00:00 app[worker.1]: at Client.module.exports.member (/app/events/guildMemberAdd.js:4:33)
2018-08-21T18:32:49.605445+00:00 app[worker.1]: at emitOne (events.js:116:13)
2018-08-21T18:32:49.605447+00:00 app[worker.1]: at Client.emit (events.js:211:7)
2018-08-21T18:32:49.605449+00:00 app[worker.1]: at Guild._addMember (/app/node_modules/discord.js/src/structures/Guild.js:1192:19)
How can I fix the problem?
defaultChannel isnt a thing anymore
please write more descriptive
guildmemberadd.js code
module.exports = member => {
let username = member.user.username;
member.sendMessage('Hoล geldin ' + username + '!');
member.guild.defaultChannel.send('hg '+username+'');
};
uhh can any1 help me, I have a problem
I have a mute command, it creates a role, but not what I specified in the code..
Whats your code, what language, what exactly are you trying to do, etc
discord.js (master)
good
I tried creating a role with the name "Muted" but it doesnt rename it like that
it just creates "new role"
muterole = await message.guild.roles.create({
name: "Muted",
color: "#818386",
permissions:[]
})```
First off, I strongly discourage the use of await
why?
Because promises are better for JS when possible
await is good

Also @earnest phoenix look at this example
// Create a new role with data and a reason
guild.roles.create({
data: {
name: 'Super Cool People',
color: 'BLUE',
},
reason: 'we needed a role for Super Cool People',
})
.then(console.log)
.catch(console.error);
Taken from https://discord.js.org/#/docs/main/master/class/RoleStore?scrollTo=create
Thanks
lmfao
ยฏ_(ใ)_/ยฏ
where'd you hear that bullshit
that doesn't mean you should use promises when possible (aka always)
But what's wrong with promises
How are you doing it
there's nothing wrong with promises but it can sometimes make a mess while async would be so much clearer
That doesn't look right
@earnest phoenix Which line is it throwing an error
38:22
yep
1 sec
@earnest phoenix In your command, did you mention a user?
Or did you supply an ID
ok so
let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
That looks off to me
heat added those then and catches
it's returning undefined to the await because of that
so, remove lines 22 and 23
@earnest phoenix Can you add a
console.log(tomute.id)
before the role adding?
To see if its setting the user
No
uhh stable didn't send that many errors
Stable is more stable
@earnest phoenix soo
revert anything derp told you to do, he's completely off track
what's the version (commit hash) of your d.js, you could look for this in package-lock.json
master
heh, master isn't enough
"version": "github:hydrabolt/discord.js#19c298f5cc131f152befa80eb4e956e52feaa778",
oh yea I see
you should create a data object around it
and that'll be it
muterole = await guild.roles.create({
data: {
name: ...,
color: ...,
}
})
anyone here can tell me if bot.channels.find() can find for nsfw channel?
bot.channels.filter(c => c.nsfw === false)
Well the filtered would get you all the channels that are marked nsfw
If you want it for a command, then do if (message.channel.nsfw) { //Code here }
Np
client.sendMessage({
to: channelID,
message: embed
});
can anyone help now?
TypeError: client.sendMessage is not a function
no?
@grizzled isle
message.channel.send(your message here)
i leteraly copy pasted that part
yes but i want to dont show the link
and as far as i know thats the unique away
?
as it says, client.sendMessage is not a thing
you can look at the channel.send docs https://discord.js.org/#/docs/main/master/class/TextChannel?scrollTo=send
and client.sendFIle to
but here suposts to
you set the file in the options of channel.send, as it shows in the examples https://math.is-rocket.science/481559203144794116.png
then use a different language?
yo @bright spear is that vscode? sexy af
That's discord docs
thats the examples on discord.js.org
lol
lmfao
var http = require('https');
var options = {
host: '',
path: ''
};
var req = http.get(options, function(res) {
// Buffer the body entirely for processing as a whole.
var bodyChunks = [];
res.on('data', function(chunk) {
// You can process streamed parts here...
bodyChunks.push(chunk);
}).on('end', function() {
var body = Buffer.concat(bodyChunks);```
that could be in python
d=requests.get()
all that gigant block
nobody actually uses http.get
Most people Ik use snekfetch
^
@earnest phoenix you want to show the server count on DBL?
also dont channel hop pls
@earnest phoenix what language do you use

see if you can use https://discordbots.org/api/docs#jslib @earnest phoenix
or you can use https://www.npmjs.com/package/blapi which supports multiple bot lists
idk if they'll work with DBM tho
can you edit the bot code?
Hi ho
wow









