#development
1 messages ยท Page 341 of 1
How do I turn message.content into an array?
Like args?
const args = message.content.slice(ur prefix.length).trim().split(/ +/g);
Alright thank you!

@edgy dew
i have python but I dont have an code
Do you know python
nope ;-;
Welp
You wanna make one?
yes
;-;
ik tht
my friend told me to do python and if I had an code
Hey
Uh I have another question
ok
How do I put a space as a .split() seporater?
.;-;
Thought this group was supposed to help ):<
It is
Wait
So you need to learn how to code a bot with python?
yas
:/
Hold on
Just for an xp bot
Wait
Here
***Please replace pickle with json any time you see it in the code and also change the rb and wb to r and w respectively. With pickles you are able to execut...
Okay
Anybody
How do I use a space for a .split() method
Is it even possible
And everyone left again
Dont
Use regex
Wot
But if for some reason you do need to use split it would be <string>.split(" ")
Google it
Okay
I tried that
It still seporated with a comma
Im so confused ๐
@earnest phoenix
const args = message.content.slice('afk'.length).trim().split(" ");
Wait
Idea
Nope
Still doesnt work
Help ;-;
What language?
@earnest phoenix
Javascript
d.js is the lib
Do you have this file uploaded to any website?
No...
Wait
If you mean connected yes
To discord
But no I didnt upload it anywhere
Im using VCS
Link?
Why would you need the link?
I told you its not on a website
:/
I need help still I made the bot but python wont work );
We cant help with that
Its a python problem then
;-;
Wait
It just helps me to see what JAva is concerned
about
@earnest phoenix
Heres the documentation
Here is an example of that line you posted earlier! https://i.imgur.com/ythAMg7.png
I did that
It still came up with commas as seporators
https://gist.github.com/eslachance/3349734a98d30011bb202f47342601d3 Line 50 of the file after README.md
It kinda worked
But now its repeating the same thing twice
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
It's making me use multiple prefixes.
"prefix.length" = 2
"~>" = 2
"!!" = 2
ect.
Try That
Nvm
Stupid mistake, left the debug console open
Thank you tho!
Your Welcome~!
wait
One last question sir
Nevermind
afk
Also make sure to not switch to switch/case
@earnest phoenix
?
Wot
Im not using switch and case
Okay.
Wait
@trim steppe
welcome to biscord dots 24/7 technical support
Uh you up for a question?
Okay
use switch and case

My question is how do I make javascript ignore capital and lowercase letters?
You really can't
Loli, You just wanna see him freak out...
Just installing Python, I forgot I need all the software Bots need
<h2 class = "underline">Modertaion Commands</h2>
<ul>
<li>Antelope</li>
<li>Bison</li>
<li>Camel</li>
<li>Deer</li>
<li>Eland</li>
<li>Gazelle</li>
</ul>
<style>
ul {
float: left;
width: 20em;
margin: 0;
padding: 0;
list-style: none;
text-align: center;
}
li {
float: left;
width: 6em;
margin: 0;
padding: 0;
text-align: center;
}
h2 {
color: gray
}
.underline {
text-decoration: underline;
}
</style>
is there a way
yo make the list stay in the center
cause rn
it looks like this
try "gravity: center"
in what?
put it in after lines with "text-align"
Try making a vertical layout.
@topaz fjord <center>
You also spelled Moderation wrong
kek
lol
Also, why are you doing text-decoration: underline; when you could use <u>...</u>
????
addicted to css
Mayo...
Yes
Labels can hurt
wdym
lol
what would u use to edit the bot prefix part
edit the bot
^, most libraries allow you to change the prefix
Hello?
Erm I have a question
Well
I need help
Anybody?
Annnddd nobody is here
Yes
Many times
And its still not working
message.content.toLowerCase();
This for some reason
Doesnt work
For that to work
it returns the new value
if(message.content.toLowerCase() === "ping") {
// code here
}
It converts the captial letters to
lower case
Are you using c#?
No
js
Yeah
Instead of changing it?
both
Oh wot
capital and lowercase
Okay thank you
Hm?
if(message.content.toLowerCase().startsWith("ping")) {
//insert code here
}
Anytime. ^^
Sure
I have an embed system thats gonna be used for afk messages
But
Something keeps coming up undefined
Hmm
May I have a look at your afk message code?
xD
lol
client.on("message", (message) => {
const args = message.content.slice('afk'.length).trim().split(/ + /g)
if (message.content.toLowerCase().startsWith('afk')) {
var Embed = new Discord.RichEmbed().addField(`Reason: ${args}`).setColor('BLUE').setTitle(`${message.author.username} is afk!`).setTimestamp(message.createdAt);
message.channel.sendEmbed(Embed);
}
});
Here ya go lmao
Hmmm
hm
"Reason: k"
Its an arg system
Where?
Do you have a prefix?
This doesnt use my prefix tho
It just uses a simple message
Oh
the top part is the title
OHHH
Wait what would the value be?
Thanks for pointing that out
Yep thank you
You could either do
np
Doooo what?
just use .setDescription
^
Wait I tried that tho ;-;
?
Huh?
didn't work?
Ill show you
Okay
I added setDescription
Hmm
are you sure?
Yes
client.on("message", (message) => {
const args = message.content.slice('afk'.length).trim().split(/ + /g)
if (message.content.toLowerCase().startsWith('afk')) {
var Embed = new Discord.RichEmbed().setDescription('test').addField(`Reason: ${args}`).setColor('BLUE').setTitle(`${message.author.username} is afk!`).setTimestamp(message.createdAt);
message.channel.sendEmbed(Embed);
}
});
but then it works doesn't it
Then its args
OH
OHHHH
"\n"
I get what you mean
Thanks!
np
Lol i find it funny how \n is a new line
lol
Wait
?
Okay
Wait
When I try to add a field its still coming up
I seporated the "reason:"
Hmm
Into the description
Take .addField out
Okay
if you haven't
Break Line
Okay thank you again lmao
Yes
i was sleeping my dood @The Darkness Soldier#1418
@The Darkness Soldier#1418
rip?
@The Darkness Soldier#1418
He either keeps leaving (that is third time) or invisible @sinful meadow
still here
kek
Is there something like fetchUser but then for Eris?
ive searched for something similar but cant find it
lemme know if you do find it though 
i think it was like getapiuser
getRESTUser
havent found anything else than that
Thanks, i will take a better look then
i think that requires a certain setting
Wow
@jagged plume First you have to enable restMode on the client options, then you have to use getRESTUser(userId)
I still need to add commands on my bot
You need to learn code and decide on a lib
^
Your opening the site as a file?
instead of fetching info you are trying to read it as a file
private static JSONArray getArray(String userpass, String u){
try {
URL url = new URL (u);
String encoding = Base64.getEncoder().encodeToString(userpass.getBytes());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty ("Authorization", "Basic " + encoding);
InputStream content = connection.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader(content));
StringBuilder b = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
b.append(line);
System.out.println(line);
}
return new JSONArray(b.toString());
} catch(Exception e) {
e.printStackTrace();
}
return null;
}```
I didn't read it as a file
WAIT
REQUEST METHOD
๐คฆ
I'm dumb
it needs to be GET
LOL
lol
GG
eval this.class
java.io.IOException: Server returned HTTP response code: 401 for URL: https://discordbots.org/api/bots/364678314108911616/votes?onlyids=true
error
@woven drum
can u help ๐ ?
I put my token
-bots @merry yoke
@full whale
which means you either didn't specify a key, or it's invalid
^
did you use your bot api key
yeah
private static JSONArray getArray(String userpass, String u){
try {
URL url = new URL (u);
String encoding = Base64.getEncoder().encodeToString(userpass.getBytes());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setRequestProperty ("Authorization", "Basic " + encoding);
InputStream content = connection.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader(content));
StringBuilder b = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
b.append(line);
System.out.println(line);
}
return new JSONArray(b.toString());
} catch(Exception e) {
e.printStackTrace();
}
return null;
}```
code to get the upvote list
@abstract mango I did auth, so you know whats wrong here?
k
remove the "Basic "
lemme try
private static JSONArray getArray(String userpass, String u){
try {
URL url = new URL (u);
String encoding = Base64.getEncoder().encodeToString(userpass.getBytes());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setRequestProperty ("Authorization", encoding);
InputStream content = connection.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader(content));
StringBuilder b = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
b.append(line);
System.out.println(line);
}
return new JSONArray(b.toString());
} catch(Exception e) {
e.printStackTrace();
}
return null;
}```
@woven drum doesn't work
how it does not work?
woah...
I have no idea how that doesn't work
No errors?
that... that... that... that coding... i have no clue how. but i could learn... :/
-bots VRCube | Cubxity
@full whale
returns 401 for that url
-botinfo @full whale
hmm
@merry yoke send me the whole code w/ tokens and all in dms
so that i can check
why with token
no
snekfetch.post(`https://discordbots.org/api/bots/${client.user.id}/stats`)
.set('Authorization', dbotstoken)
.send({ server_count: client.guilds.size })
.then(console.log('Updated dbots.org status.'))
^ my code
no?
ya
@grand tulip
:>
Lel
@glossy steeple
How do I make so when my bot joins a guild it shows it in the console?
๐คฆ thats too easy
ik ๐ฆ
listen to event -> log
well the have the same guild event ๐
oh
๐
at Object.exports.run (/root/Ignore/Ken-Kaneki/commands/info.js:25:64)
at Client.client.on.err (/root/Ignore/Ken-Kaneki/ken-kaneki.js:58:19)
at emitOne (events.js:96:13)
at Client.emit (events.js:188:7)
at MessageCreateHandler.handle (/root/Ignore/Ken-Kaneki/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/Ignore/Ken-Kaneki/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/root/Ignore/Ken-Kaneki/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35)
at WebSocketConnection.onMessage (/root/Ignore/Ken-Kaneki/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:293:17)
at WebSocket.onMessage (/root/Ignore/Ken-Kaneki/node_modules/ws/lib/EventTarget.js:99:16)
at emitOne (events.js:96:13)``` any1?
.addField(`My status is currently:`, `${client.presence.status}`, true) this is the erroring line
Lol
d.js?
๐ ๐ซ
i do multi languages but k
client.user.presence.status
thank you
๐
Np
@neat falcon
Do you actually want to lock a command or is it a troll
or lock it for upvotes
I cant really tell if your joking or not
i'm not
i want to do it for @grand tulip
because i want to have 10x more upvotes :^)
and to lock my eval command as a joke
lmao
Anyways i mean i can help
do you care if you use snekfetch
since thats how i did it
I wonder, if I can make a event of memberKick
There is no event for that
Yea there is
i think there is
Unless we hardcode it or something?
This is the ban one https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=guildBanAdd
thanks
Np lmao
now to lock all commands but help
xDDD
inb4 mee6 does that
lmfao
instantly 100000000k upvotes
lmao
When do you look a certiacations? cause i have waited a day @fossil oxide
Waited only a day ahahaha boi
@olive juniper
@tawny plover
@gilded plank
@finite olive
@exotic kite
Reee the pings
@neat pawn
@wind fossil
๐
Demi-lea๐
#7951's bots:
@neat pawn @wind fossil
lel
@gilded plank's Commands:
Luca works with the prefix of - or @gilded plank
- botinfo @bot Click the bot name at the top to go to the website. Do not use this command for advertising or checking your server count in #general
- bots <user>*
- owner / -owners @bot*
- prefix @bot
- nsfw Hide the #306891333405245450 channel if you are under 18 and/or you don't want to accidentally go there after clicking through the warning (please use this command in testing)
@earnest phoenix
lol
-botinfo @gilded plank
-botinfo @Zocket!
Please include a bot mention
:/
-botinfo @<373451764667777024>
Please include a bot mention
wew
You gotta
<@InsertID>
-botinfo @storm fossil
m8
kewl
I needz help ;-;
Hm?
with what?
I cant reference the discord.richembed client outside of the index.js file
You gotta define Discord as well
yup
So var Discord = Discord.Client?
const
Doesnt rlly matter
yeah
?
Does anyone have experience with converting letsencrypt ssl files to a .jks file?
it would be var client = new disocrd.client
Yeah
k
I had module exports before, but now I use a single file.
๐
I prefer different files for commands
ok
That's your opinion ^-^
Wait
Hm?
ive never gotten that to work for me ๐
So const Discord = require('discord.js');
Yeah
๐
^
"Hey-hi".split("-")
Will give "Hey,hi"
But how can I get the first thing only 
[0] โฌ
what lang is this
Python probably
not python https://oh-no-its.theworstme.me/d612c2.png
not python and even then
you wouldn't use split
not like that at least
(not without specifying a limit)
Its javascript...
Python 3.5.3 (default, Sep 14 2017, 22:58:41)
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> "Hey-hi".split("-")
['Hey', 'hi']
>>>
python as well

r = requests.post("https://discordbots.org/bots/{}/stats".format(bot.user.id), json={"server_count": len(bot.guilds)}, headers={"Authorization":config.orgtoken})
does it take a long time to post or is there something wrong with this
It's almost instant so something is up with ur code
But I don't do the snake lang
Lol
idk what could be up with it because it's working for discord.pw
Hm
i'll keep trying other stuff
Ok
it's doing this step but then it still doesn't show up on the site
it's working now
idk what fixed it but i randomly started changing stuff and now its working ยฏ_(ใ)_/ยฏ

lol
Help
pls
Im getting a memory leak error
@sinful meadow
Bro?
.>
@here
Anyone?
.>
close it
are you using request?
No require
var request = require('request') ?
Nope
yeah ok
But thats it
idk about the specifics
but you should take a nice look through your code, cause theres an error in there somewhere
.>
I think it just reached the max amount of listeners
It says I can reset the limit but im not sure how to set that up
Wait
Lemme try something
Great I got an import error
How can you be getting a memory leak @earnest phoenix
Wait
i think i know why
You may have too many events when the bot is launched
you should only allow nsfw content in channels that start with nsfw- right?
Yep
How do I fix it ;-;
Uh
Suuh
Its still coming up with an error
Delete all the events that you dont need
you're welcome ari
You might be talking about a message Collector
Well, like
A message is said and a code is run
Then it waits for another message
And then runs more code
Is that what it is?
Yea
Okay
Then use something like message Collector on the d.js and wait for a reply
or something idk
idk
๐

@storm fossil
who can help me? how do I put this in embed? https://hastebin.com/zusupozaho.bash
@earnest phoenix What lib?
discord.js
Ok
var embed = new Discord.RichEmbed()
addField(output)
message.channel.send(embed)```
idk if that works
or not
it should be .addField but it wouldnt let me
If that didnt help check this https://anidiotsguide.gitbooks.io/discord-js-bot-guide/examples/using-embeds-in-messages.html
@earnest phoenix
noh
if (command == "test") {
if(message.mentions.users.first()) {
let user = message.mentions.users.first()
let output = user.avatarURL
var embed = new Discord.RichEmbed()
.addField(output)
message.channel.send(embed)
}}```
Try that
@earnest phoenix
idk :)))
if (command == "test") {
if(message.mentions.users.first()) {
let user = message.mentions.users.first()
let output = user.avatarURL
var embed = new Discord.RichEmbed()
.setAuthor("Avatar")
.setDescription("[Avatar Link](output)")
message.channel.send(embed)
}}```
Maybe try that
@earnest phoenix
noh ๐ฆ
my bot is not in the server :
@earnest phoenix change addField to setImage
I am Groot
Np
but np
how do I make it link text?
[my bot]
Hello normal people and of course our developers ๐
I am very happy to announce that after our whole ChatWithUs company network (only servers) have crashed and that we have recovered everything, so @gritty dirge is finally up again! I hope you will have some fun with it again ๐
Thanks to @earnest phoenix and some other people, including @upper ember for helping to get everything up again and just helping with the code ๐
I will soon add an option to report bugs, submit wanted improvements and a lot of other stuff, with that release, you will also get an option to host (only one part of the code for now, sorry ๐ญ) it yourself ๐
Enjoy life if and when you still have it ๐
:)
๐ ๐ ๐ ๐
@quiet bobcat you have no idea what you're doing ๐ค
I know
ok
@uncut slate I suck at coding 
How r u here tyen lol
๐
hmm not exactly sure how to use the discordbot api for posting server count
hmm not exactly sure how to use the discordbot api for posting server count
hmm not exactly sure how to use the discordbot api for posting server count
You need to send a POST request also look in ^
ooh tyty
Any idea how I would get my bot to send a message to a random channel when it first joins a guild?
JavaScript
Completely random, or a first channel that it has permission to send to?
first channel its got perms to
Iterate through the chans till you find one you have perms
Send message
Then break the for loop
im not smart like that xD I dont know how to code shit like that but ill give it a go ๐
msg.guild.channels.filter(v => v.type ===
"text").first().send(yourMessageGoesHere)```
that's a start
that checks if its a text channel
and then you need to add a check if the bot has permission to send_messages, and you might want to catch errors
inb4 no channels
then you just raid it and spam the owner duh
good strategy
What is this suppost to mean??? http://prntscr.com/hakxvu
This is what I have http://prntscr.com/hakyvx
Oh
vscode or atom? that theme is familiar
So still that error means ur trying to access something u dont have perms to view 
vscode
ahh
what method do you use?
I just used a random d.js one lol
But try putting that id in a string

Or what I am assuming is an id
okay I will try that.
It wants a value not a string.
@thorny hinge Do you know what d.js thing u use if you know?
const snekfetch = require('snekfetch')
snekfetch.post(`https://discordbots.org/api/bots/${client.user.id}/stats`)
.set('Authorization', 'YOUR DISCORDBOTS.ORG API TOKEN')
.send({ server_count: client.guilds.size })
.then(() => console.log('Updated discordbots.org stats.'))
.catch(err => console.error(`Whoops something went wrong: ${err.body}`));
ty
๐
do I need to download an npm called snekfetch?
Yeah
okay
Wait
Yes
Okay ty so much
u have been a life saver
lol
lol
on point
Can I have my bot tested here
@edgy dew
wut
no there not .js is way more object orentated then .io
Sup
String!
Hey man
Sup bro
look up the byte numbers thats what you wanna check
I needz a bit of help
Whats ya trying to do
@earnest phoenix ```js
if(message.member.hasPermission("KICK_MEMBER")){ message.channel.send("YOU HAVE PERMISSION KICK_MEMBERS")}else{message.reply("Fuck off you dont have KICK_MEMBERS")}
ยฏ_(ใ)_/ยฏ
You cant use author because that isnt a guild object
member is a guild object which is like author
Yea
welcome to bot developers life
ranageError 
What did you put
KICK_MEMBERS?
add a s
Forgot the S
lool
Lmao
Well good for them
Lel
Wait
How would I reference my bot as a member ๐
TypeError: Cannot read property 'hasPermission' of undefined
shit
um
do this
.member(client.user)
or if you didnt say client do .member(bot.user)
Wait I has fixed it
I just needed to define discord client and discord again
Thx tho!
And now its silent
With no errors and still not working
๐
@sinful meadow >.>
const Discord = require('discord.js');
const client = new Discord.Client();
client.on("message", (message) => {
let args = [message.content]
if(message.member.hasPermission("BAN_MEMBERS") && client.member.hasPermission("BAN_MEMBERS")){
if (message.content.startsWith('---ban')) {
if(!message.guild) return;
if(message.mentions.users.size === 0) {
return;
}
message.channel.send(`${message.mentions.members.first().user.username} has been banned!`)
message.mentions.members.first().ban(args[1]);
console.log(`Command run: Ban in ${message.guild.name} in ${message.channel.name} by ${message.author.username}`)
}
} else if (!message.member.hasPermission("BAN_MEMBERS") && message.content.startsWith('---ban')) {
message.channel.send('You do not have permission to run this command!')
} else if (!client.member.hasPermission('BAN_MEMBERS' && message.content.startsWith('---ban'))) {
message.channel.send('The bot does not have the required permissions to do this!')
}
});
Ill run the debugger
becuase client.member isn't a thing



