#development
1 messages · Page 347 of 1
@inner jewel @sinful meadow So can VSC
:P
didnt know that @earnest phoenix
lol
master? 
Yep
The staff there say its message embed 👀
Well rip
npm i discord.js will give you the latest stable version
Lemme see how you get master
To install and use the Discord.js master branch:
Without voice support: npm i -S hydrabolt/discord.js
With voice support (node-opus): npm i -S hydrabolt/discord.js node-opus
With voice support (opusscript): npm i -S hydrabolt/discord.js opusscript
If you use yarn:
Without voice support: yarn add hydrabolt/discord.js
With voice support (node-opus): yarn add hydrabolt/discord.js node-opus
With voice support (opusscript): yarn add hydrabolt/discord.js opusscript
You need Git for this to work:
Ubuntu/Debian: sudo apt-get install git
Windows: https://git-scm.com/download/win
Documentation: https://discord.js.org/#/docs/main/master/
@sinful meadow
Copy paste hehe
thanks mate
hey guys, who would my music not be working? here's what it throws at me when i try playing:
is taking guild names and owners on which the bot is against TOS?
i think without perms yes
ok
@native steeple Explain more
lol
and the command sends list of servers on which the bot is
and sends owner name too
@native steeple That is fine
I had that command but my bot got over 90 servers and hit the character limit xD
ok 😃
@sinful meadow you didn't split it?
No since then i would have a giant spam of servers @quasi marsh
Heh
that's only fine if you explicitly say you do that @native steeple @sinful meadow
eg on a join message
How do I check if there's a channel in a server when I only have the channel ID?
O wait, there's guild.channels.
Donut, you can't read commands? You are supposed to type the initial command and one of the following commands from the list underneath it
@earnest phoenix ^
Wise wizard
if commands can't be easily used by a web mod, normal discord users have no hope
^
I dont just add, read prefix and try stupid shit, I do actually red...
@waxen heart actually
I do...
I did try what you said
so...
What do you expect me to do
@umbral pelican
Lol
anyone have experience in modifying role permissions with discord.py?
lol
🤔
How to make a bot run without having to have your computer on and connected to the Internet?
Google VPS
thx
@smoky rampart me
why is my bot @velvet mesa not working?
it should be online...
it says it is but it isnt here...
now it online
hi
How do I add multiple prefixes? So like one is l. another one is L. and another one is @smoky plinth ?
I have a case system and I am using d.js
I currently have this if (!message.content.startsWith(Prefix)) return;
So I just do if (!message.content.startsWith("l.", "L.", "@Lion#7616")) return; or am I getting this wrong?
I literally gave you the code to use 🤔
prefixes.some
if(!["a", "b", "c"].some(prefix=>message.content.startsWith(prefix))) return;
could also use map eg prefixes.map(prefix=>message.content.startsWith(prefix) && message.replace(prefix, "")).filter(messagewithoutprefix=>typeof messagewithoutprefix === "string").first()
or something like that
hey does anyone know why this won't work
if (message.content === (prefix + "bcc")) {
let args = message.content.split(' ').slice(1).join(' ')
if (!args) return (message.channel.send("You need something to brodcast!"))
message.guild.members.forEach(m => {
let bc = new Discord.RichEmbed()
.setTitle("Brodcasted Message!!")
.addField('**● | The Guild**', `${message.guild.name}`, true)
.addField('**● | The Author **', `${message.author.username}#${message.author.discriminator}`, true)
.addField('**● | The Message** ', args)
.setThumbnail(message.guild.iconURL);
// message.guild.members.forEach(m => {
// m.send(`${m}`);
//message.author.send(`${m}`);
message.channel.send({ embed: bc });
})
}
})```
wat
wat wat
if the message is "<prefix>bcc"
it won't have any args
but will be true on that if
if it has args
it won't be equal to that anymore
it is <prefix>bcc <args>
(╯°□°)╯︵ ┻━┻
it's not <prefix>bcc anymore
rip
you check if the message === "<prefix>bcc", you should split it with space or something and change the first split
lul
fail
@abstract aspen eval let prefix = "<prefix>"
"<prefix>bcc <args>" === (prefix+"bcc")
Input: let prefix = "<prefix>"
"<prefix>bcc <args>" === (prefix+"bcc")
Result: false
instead
- You send the message
<prefix><command><args> - "If statement" is looking for
<prefix><command>EXACTLY and nothing else - You try defining args even though if you wrote only
<prefix><command>there would be NO args. - You need to check if the message STARTS WITH
<prefix><command>
now
what ken said
i dont understand what to do
You do what i told you to do
deni pls just go learn js
ok
4. You need to check if the message STARTS WITH <prefix> <command>
🥄
doing "<prefix>bcc <args>" === (prefix+"bcc") is basically asking if apples are onions for the computer
which is false
wait, there did genral go
but then if you check if the onion is round like an apple it's true 
so startswith is true
if it actually starts with it
ok
@4JR#2713 could you show me how it's done I can't find anything about it and nothing I try seems to work
rip
wut
maybe it returns a bool 
I feel like I'm opening a can of worms, but when working with Java, do people prefer JDA or D4J?
i've only used JDA
ninjad
git gud
Oh, and to ammend to my question, if I want to try to use Kotlin (want to just do a small project to teach myself and check out Kotlin and have fun) does that influence which one I should choose to work with?
I also saw D4J has D4K.
Does it just come down to a matter of preference? Are both maintained equally as well (the base, not the Kotlin extensions)?
Arlight, thanks for the advice.
guyz im noob need help with music commands for discordjs
specifics
my ting works but sometimes it crash cuz of memory
i dont need queue or anything like that yet
just want to play one music with no crash
you try and play one music file and it crashes cuz of memory 
are you trying to download the video

msg.member.voiceChannel.queue.songs..
oo
const ytdl = require('ytdl-core');
const voiceChan = <Message>.member.voiceChannel; // <Message> is your bot.on('message');
if (!voiceChan) return;
voiceChan.join().then((connection => {
});```
ive got that
guys my blargbot is not working do you know anything about this
and I see memes
@west hollow Can it send messages?
umm
i got it thx
$string = "yeet" . "." . "lmao";
Would return "yeet.lmao"
return $new;
<?php
$config = include('i/config.php');
$key = $config['secure_key'];
$uploadhost = $config['output_url'];
$redirect = $config['redirect_url'];
if ($_SERVER["REQUEST_URI"] == "/robot.txt") { die("User-agent: *\nDisallow: /"); }
if (isset($_POST['key'])) {
if ($_POST['key'] == $key) {
$parts = explode(".", $_FILES["d"]["name"]);
$target = getcwd() . "/i/" . $_POST['name'] . "." . end($parts);
if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
$target_parts = explode("/i/", $target);
echo $uploadhost . end($target_parts);
} else {
echo "Sorry, there was a problem uploading your file. (Ensure your directory has 777 permissions)";
}
} else {
header('Location: '.$redirect);
}
} else {
header('Location: '.$redirect);
}
?>
<?php
return array(
/* This is a secure key that only you should know, an added layer of security for the image upload */
'secure_key' => 'somerandomlongstringoftextforkey',
/* This is the url your output will be, usually http://www.domain.com/i/, also going to this url will be the gallery page */
'output_url' => 'http://example.com/i/',
/* This is a redirect url if the script is accessed directly */
'redirect_url' => 'http://example.com/',
/* This is a list of IPs that can access the gallery page (Leave empty for universal access) */
'allowed_ips' => array('192.168.0.0', '0.0.0.0'),
/* Page title of the gallery page */
'page_title' => 'My Upload Site',
/* Heading text at the top of the gallery page */
'heading_text' => 'Uploading Site',
);
$domains = array('http://oliy-wants-to.thebostontea.party/', 'http://liberals-did.thebostontea.party/', 'http://dev1nee-drank-tea-from-the-water-right-after.thebostontea.party/');
$dindex= array_rand($domains);
$domain = $domains[$dindex];
$key = "your special key lmao";
$uploadto = $domain . "/images/";
$redirect = $domain;
if(isset($_POST['key'])){
if($_POST['key'] == $key){
$parts = explode(".", $_FILES["d"]["name"]);
$target = getcwd() . "/i/" . $_POST['name'] . "." . end($parts);
if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
$target_parts = explode("/i/", $target);
echo $domain . end($target_parts);
} else {
echo "Sorry, there was a problem uploading your file. (Ensure your directory has 777 permissions)";
}
}else{
header("Location: INVALID_KEY");
}
}else{
header("Location: NO_KEY");
}
?>
@languid dragon WuT is dat lib ;-;
PHP, unrelated to bot making lmao

not "lib"
sry
It's just a sharex related image uploader for PHP
k...
does any discord.js programmers knows what does this warning is and how to fix it?
(node:3468) DeprecationWarning: Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.
its kinda self explanatory
you cant use defaultChannel anymore as it is deprecated
what to use instead?
so whatever you're trying to do with a default channel, you'd need to find an alternative like channels.first()
and/or just skip the entire defaultChannel process altogether
or alternatively you can look for "#general"
channels.filter(channel=>canSendMessagesIn(channel)).first()
^
ok, i guess
Example code
<client>.user.setPresence({
status: "online",
activity: {
name: "Donut: Rainbow Six",
type: 0,
url: "https://www.twitch.tv/discorddonut/"
}
})
Types
Type 0: Game / playing
Type 1: Stream / streaming
Type 2: Listen / listening to
Type 3: Watch / watching
This is for people who constantly as me how to do the other status
@undone plover Get the links to pop up?
with the specific text yes
@undone plover This: [link](text) I believe
mk
First one is text
okie
for any langauge?
and does this only work in embeds?
nvm
it works
Thanks!
How would I post my servercount to the API? I was reading the docs and came across this:
{
"server_count": 666
}
but I'm not sure how to use it.
Thank you.
You're welcome
i need help to create to my discord bot a music feature
I need help with my bot on dbl
on the website, instead of saying online or offline it says ???
@young wind that's because the bot isn't in this server
Can someone help me use a background on dbl?
Like instead of using bg.png it also works on dbl
Why does it say this?
It's listing DiscordClient as an error
same as LogMessageEventArgs
try googling the error
.3.
I'm trying to get my bot to respond to mentions like @smoky plinth help.
I dont know how
That is a mention prefix
Yes
Ok
@earnest phoenix give me mention prefix code
@quiet bobcat Check if the message starts with "@smoky plinth "
or "@smoky plinth "
Both
yes, check both
Ok
One is for nickname and the other for non-nickname
^
make sure to check if there is a space after the mention, or else your bot will only work if it sees this: @smoky plinthhelp
or?
I have my bot checking for prefix/mention prefix and custom prefix if set 😄
wdym return
Continue
yes
ok
This is all I use to check if it's a command:
let prefix = ((msg.content.startsWith(((msg.channel.guild) ? bot.prefixes[msg.channel.guild.id] : config.prefix))) ? ((msg.channel.guild) ? bot.prefixes[msg.channel.guild.id] : config.prefix) : ((msg.content.startsWith("<@" + bot.user.id + ">")) ? "<@" + bot.user.id + "> " : ((msg.content.startsWith("<@!" + bot.user.id + ">")) ? "<@!" + bot.user.id + "> " : null)));
if (!prefix) return;```
kinda long
but it works
bot.prefixes is an object with guild ID keys and prefix values
if the guild has no custom prefix set, then it's default
wew
but for every guild the bot is in, there should be a value within bot.prefixes
PassTheLongCode
True
It doesnt work
if(!["l.", "L.", message.content.startsWith("<@" + bot.user.id + ">"), message.content.startsWith("<@!" + bot.user.id + ">")].some(prefix=>message.content.startsWith(prefix))) return;
Thats my code
for it
I see why
Why?
if(!["l.", "L.", "<@" + bot.user.id + ">", "<@!" + bot.user.id + ">"].some(prefix => message.content.startsWith(prefix))) return;```
There is a fix
should work
The third and fourth value of your array would be true
but that's incorrect checking
Does it work? @quiet bobcat
No
:/
I have this after it const args = message.content.substring(Prefix.length).split(" ")
And for that to work I need to define Prefix
And I cant define prefix as "l.", "L.", "<@" + bot.user.id + ">", "<@!" + bot.user.id + ">"
lol
yay
I broke my bot
😃
ok so l. and L. works, but @smoky plinth doesnt @earnest phoenix
yup
How do you get a role id?
idk
lul
k
\@role
I am confused...
Here is some code I made in Visual Studios and it says this
Error Log ^^^
This is the CS file it is getting the errors
@lethal hamlet read the docs
Maybe I am trying and shut it.... I asked for help and I just found what it is... I am MORE basic than you so I usually will use examples for a while and make it more complex overtime
//Actually, newer releases of Discord.NET (>0.9) no longer use DiscordClient. You have to use ``DiscordSocketClient`` instead.
Thats as far as i know
And it will require this
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Discord;
using Discord.Commands;
using Discord.WebSocket;```
I was thinking about that
shut up
svmem(total=10682740736, available=5945892864, percent=44.3, used=4736847872, free=5945892864)
oh?
i wanna get the percent from the tuple
jqwiljdd
well thats not a tuple
Says the one who has no role
what you would probably do
cuz its in BYTES
I am coding still
lol
yep
that all you need?
yep thx
What do I do for a replacement as code LogMessageEventArgs
As I got code from before Discord.Net 0.9
Oh wait....
@_@ I forgot to try installing it in older versions
Read the docs for v2 its really simple
I can't find it ...
@strange lintel so for no = psutil.virtual_memory() i would do no.percent?
Also there is a CommandService to use
I am new to programming in C#
I can tell that lol
I am trying to make it so the bot will come online
Here
hmmmmmmmmm
{
class MyBot
{
DiscordClient discord;
public MyBot()
{
discord = new DiscordClient(x =>
{
x.LogLevel = LogSeverity.Info;
x.LogHandler = Log;
});
discord.ExecuteAndWait(async () =>
{
await discord.Connect("SECRET TOKEN HERE");
});
}
private void Log(object sender, LogMessageEventArgs e)
{
Console.WriteLine(e.Message);
}
}
}```
@patent reef worked?
OOF...
I forgot about putting using DSharpPlus
OOF...
I am stupid
Af
What about ExecuteAndWait
Hey
How can I make the Rich Presence for a bot in js?
discord-rpc
^
snekfetch.post(`https://discordbots.org/api/bots/386510361152585738/stats`)
.set('Authorization', key)
.send({ server_count: bot.guilds.size, shard_count: bot.shard.size, shard_id: bot.shard.id })
.then(() => console.log(`Posted to dbl.`))
.catch((e) => e);
It already says
Your shards are null
aka you don't have any shards
Did you spawn them?
i think its bot.shard.count
Yeah its .size
And I was using bot.js over shard.js by accident :/
lmao
Error was fixed now
anyone knows how can I use inline of RichEmbed using Discord.js to inline them 2 by 2? I can only put 1 or 3 on each row and I want 2... am I missing something?
yeah i have same problem ;-;
@earnest phoenix solved it by adding an inline blank field as the 3rd in the line 😄
oh
embed.addBlankField
and to make it inline
you add true as an argument
embed.addBlankField() for a whole blank row and embed.addBlankField(true) just for a "block"
np 😄
What's the script for "ram usage" thing for discord.js? Please mention me when you say something to me.
Wut

someone can jhelp me ?
With what
^
i get some bot files in the gifhub
And what do you wanna do with those files
and put on my bot name
Is it a redbot?

rebot is better?
Are you cloning? lol
Show us the github?

Oh
Post the github here?
i thing thats files
are verry old
i seaching for new bot files
you can segest some ?
Show us the github
🤦

I suggest you end your cloning career
@worthy flicker you do know that bot isnt really yours
i dont made the code
but i can use the files
dont ?
is wrong use that files ? is ilegal ?
not very welcome on bot lists
^
is develpment if dont works perfect 😛
No
Yea you should really join rhinos support server @worthy flicker
if you want it for private use, go ahead
Not ask in here
just don't try adding it here
^
it won't get accepted
Yeah
Oof
}``` hm
but add my bot here is not important to me
But you shouldn't ask here
Using someone else's code isn't really development now is it? 
rules here, rules there 😦 i hate thats rules
How did you even get here 
bUt rUlEs kEeP oUr gUilD sAfE aNd sOunD
@inner jewel cough cough
@cosmic plover @unique star come see this 
memes
i love jesus
@low niche this meme lol

@colt_letter#1455
what ?
why are you untaggable
i have no idea, if you are god and dont, what i can do ?
mobile is bugged
@colt_letter#1455
same
@worthy flicker
@colt_letter#1455
@colt_letter#1455
^ Crazy person
not soo much
then
why i have to development my bot from zero, if have alot good codes waiting for me ?
why not only add funcions
or remove some
You cant take all the code from someone else and claim yourself a developer @worthy flicker
^
i dont do that
Thats not how it works
i could be your father

#memes-and-media worthy
You aren't even a developer lol, you are just using rhinobot's files
yeah, whats the problem
is ilegal ?
is ilegal dont be developer ?
i think no... then
you can suggest a good bot files name
to me? i using Windows
and i think my bot problems is because that
i just need a webadhook
i dont will learning anything about that just for 1 thing
then is more easy, and smart, get files
i thinking in install Linux on my old Nintendo Wii
and make my bot server on Wii
How do i make my bot customisable per guild? Do i have to do new Array() ?
Lol
Wouldn't the arrays reset every time the bot restarts?
What you need is a database
A guildsettting file you mean?
I would need to create a new file and require it., Store it all there?
Elaborate
like sql or something
ugh ffs
I mean you can store it in an array if you want your "database" to reset after every bot reboot

I will respectfully leave this room and move to general
k
No, that wouldnt be good
What is meant with sending the shard_id to the API?
Should it be the shard that has this guild in it?
per shard, you give the number of guilds connected to it
Using discord.py[rewrite], it will combine them tho, to just give me all guilds with len(client.guilds)
Should i just send shard 0 then?
Since 0 is the DM/global shard I reckon
How can I record a vc, then give the user a mp3 of their chitter chatter?
discord.js
Hey guys, how do you test for a negative number in javascript?
number < 0
Thx
wew
Errr one last question
How would I reference roles in a mention statement
I tried message.mentions.first().role
But it comes up undefined
Also message.mentions.roles.first().role
message.roles.find('name', 'name');
message.roles.find('id');
No im like trying to find role positions
So, for example
If this role is above that role
Then do this
Hm
let rolecompare = message.mentions.roles.first().comparePositions(message.author.role, message.mentions.roles.first())
or the official discord server
???
But then what is this channel for...
development
Wait I got it I was doing something stupid
not failing at development 😂
twas a mem
0|joebot | DiscordAPIError: undefined
0|joebot | at item.request.gen.end (/home/justin/joe-bot/node_modules/disc ord.js/src/client/rest/RequestHandlers/Sequential.js:68:65)
0|joebot | at then (/home/justin/joe-bot/node_modules/snekfetch/src/index. js:257:21)
0|joebot | at <anonymous>
0|joebot | at process._tickDomainCallback (internal/process/next_tick.js:2 28:7)
🤔
I think someone was trying to access the bot while the channel he/she was trying to access had read_message premission for bot but no send_permission for bot
attempted return statements when bot did not have send message perms on the channels but still seems to return unhandled rejection even after attempting throw error
nvm just checked thru channel perms
.catch() is bae
more like .catch(e => console.error(e))
.catch(console.log)
.catch(STDs)
thonk
I got this error on Visual Studio...
welp
ima uninstall
wow that was the fastest unistall
wow
okay soo im having trouble getting json objects inside like i want json.house inside of a embed which works, but the problem is I can't have any if satements inside of my embed javascript name: 'Type:', value: json.house, inline: true this is the plain I dont want that i want javascript { name: 'Type:', value: if(json.house == 0){ console.log("this is house 0") } else if (json.house == 1) { console.log("this is house 1") } else { console.log("cannot find the next house") }, inline: true }
^ you cant put if statements inside a json object
let ting
if(json.house == 0) return ting = 'this house is 0'
{
name: 'Type: ',
value: ting
}```
ip checker via iphub
why dont you do the checks outside of the object
What's the HEX for BPurple?
I believe you can find that on discordapp.com
or: #6B82D3 / #6F84D3 / #7187D8
one of those
#7289DA I think its this one though <
what am i doing wrong?
anyone knows why this happens? https://this-is.definitely-not-a-sketchy.host/9c301b4896.png https://this-is.definitely-not-a-sketchy.host/a04d55f101.png
first one is localhost
second one is on my vps
it's the same file
are your stylesheets synced properly
your vps copy looks like it's missing a white space rule on the code block
oh
it was cloudflare being retarded
adding a page rule to disable performance fixed it
yeah
If youre trying to send a message to the author do
message.author.send
@wise nexus
wrong
No?
Lmao
how should i post stats? i tried Token and Authorization in post request and it gives me out: {"error":"Unauthorized"}
found it out yeah, ty anyway 😃
Anyone know a better npm for a music bot because ytdl-core is trash
youtube-dl?
@bitter sundial Thats what ytdl-core is
It streams from youtube
And its really trash

tru
hey
but other is just that and other is core
anyone know googie from discord bots server
all i see is downloading lmao @bitter sundial
it has the readme with examples there
Just wondering, anyone who has experience with rethink and has SSL/certs enabled, where do you store it? Anywhere? The docs kind conflict
yo famsquad im making a bot and im making an 8ball function and it only poops out yeds
yes
move balloutput = ... inside the command
@glossy sand the code is python not c
@inner jewel you mean like this?
yes
¯_(ツ)_/¯
😦
ball[Math.floor(Math.random() * ball.length)];
this is python @vital lark
your python
woo fixed it
how do I get an user from an user ID?
thx anyway ^_^
Np
Does anybody know I can ban all mentioned users in a message?
Well, by I i mean my bot
I think its something like forEach
I dont know how to write the full code tho :L
for what lib?
^
i'd add it for a troll command
or nuke
or use it to kick instead of ban all users within a join time
anyone facing problems with discord.io library and 4012 disconnect?
How
i have a sql license from Oracle itself 😛
same
they aren't
nothing is free
^
no database research would be done if databases are free
Get aids already youtube
rekt
nobody does work without getting paid
so true
someone needs to do the research before they can even start coding
and that costs time
and time is money
Lol
it's the truth though
someone has done the research before they started there project
and that costs a lot of time
python
yeap
probably all letters and numbers
I remember seeing something somewhere
only letters
@pseudo inlet if you never figured it out all indentation in the same block needs to match
When you download a video with ytdl-core, does the file save on your vps?
how?
currently I have this const stream = ytdl(url, { filter: 'audioonly' });
how's this not save then?
just wondering
o lol, I was reading it wrong
okay, thanks
Thanks for helping
from a object.toString
Lol
you need to read the File parameter, not the .toString()
or remove the file parameter
im sure that it isnt a valid array
oh dear
IDE?
Integrated development environment?
Do you mean what am I designing this for?
Well, alone, I did get this working.
No the program you are using to write the code
Sublime
@spiral trail this one is good for javascript developent, it tells you what errors that you are making https://www.jetbrains.com/webstorm/
MY EYES!
White theme
MY FUCKING EYES!
yes, your indents
Hello
Guys I have an error missing catch or finally after try I don't know why I have it?
because you missed a catch after a try
or finally ❗
I do have a catch
show kode, kthx
show error
show nudes
let role = message.guild.roles.find("name" , "Muted");
if(!role) {
try {
role = message.guild.createRole({
name: "Muted",
color: "#000000",
permissions: []
})
});
}
catch(err) {
console.log(err)
}
}
Error is missing catch or finally after try
pretty sure your brackets don't match up
wtf is that 
its a masterpiece
that's orgasmic
Wtf is what
its trying to explain to a child what the heck is wrong with your code
Ok
let role = message.guild.roles.find("name" , "Muted");
if(!role) {
try {
role = message.guild.createRole({
name: "Muted",
color: "#000000",
permissions: []
}
}
})
catch(err) {
console.log(err)
}
}
if you actually studied your own code, you'd find the error 
Now
kek
Correct ya
try it
K
oh no
and sort the identation out
Oh no what
"oh no", it's even worse than before
learn javascript before you use javascript
these errors are way too basic
we're not here to spoonfeed
Whta
other than spoonfeeding a lizard
Ya


