#development
1 messages · Page 361 of 1
@lilac comet what is the problem?
Im creating a website, and if I have some issues, I will like to have a server where I can ask
could someone quickly tell me what the issue with my code is quickly if i send a screenshot.
Do you i start with visual studio code to program my bot
Yes
?
JETBRAINS
I N T E L L I J I D E A
If anyone need a Translator for Hungarian please dm me
VI
emacs
microsoft word 2010
Hey there I have a question regarding submiting a bot.
I still didn't add my bot here yet. We are 6 owners. Is that fine if I add the bot with a common account we share?
Anyway so we are all quoted as developers in the bot profile? Or maybe at least that we all get the rank? 
Yeah I know that, that's why 
You can submit it with a common account 
wait what
Never see anything about account sharing at this point
Why would we break discord TOS doing that?
its not against tos
to share
You're just responsible for everything that happens under that account
yeah we are not selling the account. We just made a new account and we all have the password
You are responsible for your log-in credentials and for any activity resulting from the use of your log-in credentials or other activity on your account (“Account”) on the Service.
yeah that seems more correct ^
Because tbh, it's just like we randomly connect with either one of our pc 
Okey well i'll add it with our common account then
That's also what I did in the second discord bot
Well okey for that then. Too bad but we will deal with it 
Just didn't feel right to quote me as main owner since we started this as a team
What are you trying to do
yes i did npm install
you npm installed discordbotlist?
yes
yes
wtf are those vars @languid flicker
Omg the variables
No needs more vars
I have several duplicate entries in my SQLite db, due to a programming error. They all have the same ID. What query can I do to erase the duplicates?
userid I mean
DELETE FROM [table] WHERE [column] = [value] should do it
make sure you include WHERE otherwise it'll delete everything
Won't that delete every ID I specify?
that will also delete the original enteries
oh
I just want to remove the duplicates
sorry i misunderstood
hmm last time i encountered something like that i just manually deleted the entries so im not sure sorry
there probably is some kind of query to do it but im not aware of it
wait
hm?
do all the entries have the exact same column values as well?
because you could do WHERE [column1] = [value1] AND [column2] = [value2]
that would still erase the original
I'm tempted to just flush the db and start over, but at the same time, I kinda want to keep some of the top levels
hmm
do you store an ID in the table alongside the userid, or is it just the userid?
like do you have sequential ID's as well as Discord user ID's
ah okay
alright, sorry if i wasn't much help ive just never had to do something like that before 
It's fiiine
It was my dumb fault for accidentally leaving a copypasta'd piece of code in that wrote the duplicate entries in the FIRST place
ah :/
I'm glad I caught it at least
var filetype = attachment.filename.split('.').pop();
if (filetype == 'mov' || filetype == 'mp4' || filetype== 'mpeg4' || filetype== 'avi' || filetype== 'wmv' || filetype== 'flv' || filetype== '3gp' || filetype == 'mpegs' || filetype =='webm') {}
why are all filetypes accepting
also is there a more efficent way I should be writing that besides a million ||'s?
oh yeah arrays are a thing
lmao
['mov', 'mp4', ...].includes(filetype)
yes ken genius
that shouldn't technically make a huge difference
then I'll do that
also check the that filetype is actually corrent and outputting the corrent values
which method are you using the array or the ===
show more code?
=== atm
yeah like i said === is like "EXACT VALUE" and == is a little more loose
to my knowledge
yeah
someting something typechecking
i recommend using the array method since its more efficient anyways
are you absolutely positive that filetype is what you are expecting? also if possible can we get a bit more code
const bot = new Discord.Client();
var movieFormats = ['mov', 'mp4', 'mpeg4', 'avi', 'wmv', 'flv', '3gp', 'mpegs', 'webm' ];
bot.login(config.token);
bot.on('message', function (message) {
//Ignore other bots
if(message.author.bot) return;
//Look for video attachments and download them
var Attachment = (message.attachments).array();
Attachment.forEach(function(attachment) {
var filetype = attachment.filename.split('.').pop().toLowerCase();
var filename = attachment.filename.substr(0, attachment.filename.indexOf('.'));
console.log(filetype);
if(movieFormats.includes(filetype)){
request.get({
//send stuff
}, function (error, response, body) {
//get stuff
});
}
});
});
hmm that is odd
maybe instead of if (movieFormats.includes(filetype)) you could try if (movieFormats.indexOf(filetype) !== -1)
which is not only better then "includes" but then you can also see exactly what index it appears at if it does happen to be true
you can do console.log(movieFormats.indexOf(filetype))
png after uploading this image
token?
what the hell, console logging the index does not spit out anything
nope it just dosent run
uh
you probably have an error in your code somewhere if its not getting run
unless you typed it wrong
omg lol
I did something dumb
yeah
I think I forgot to turn off my heroku app
yeah
oh did you forget to restart or something
I was just running it locally
ah
hahahaha
it works now
smh
Thanks friends for bearing with me
time to delete 14 pages of pictures from streamable now :^)
haha all good 
is it possible to get a server name based off id?
If your bot can see it, yes
Am I missing it in the docs?
Huh?

I am looking for a free vps, someone has one?
there is no free vps
pay money or get a free solution like heroku or glitch, but both are pretty bad for Discord bot hosting (atleast if your bot is public and or has a music feature)
I've heard about something like "OpenShift", i think it's a trial but can be renewed
just what I heard
aws offers one year trial
if you're a student you can join the github education program and claim your pack, you get $50 on DO which is enough for 10 months on the lowest plan
DO is shite
client.on('message', message => {
if(message.content === prefix + "serverinfo") {
var serverinfo_embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField('**Nom**', guild.name)
.addField('**ID**', guild.id)
.addField('**Créé le**', guild.createdAt)
.addFieod('**Membres**', guild.memberCount)
.addField('**Owner**', guild.owner)
.addField('**Channels**', guild.channels)
message.channel.send(serverinfo_embed)
}
});
What is error
Ah
If you're only planning on hosting Discord bots, you could also just use a Raspberry Pi you have laying around or a computer in your house that's running all the time anyways. @earnest phoenix
You don't need a static IP or open ports for (most) Discord bots.
he does not recognize guild @austere meadow
guild isn't defined, you need to use message.guild
Is it a music bot?
Just saying "if"
Oh ok @austere meadow thanks
i recommend you look at the d.js docs if you want more information about how to use it
https://discord.js.org/#/docs/main/stable/general/welcome
Okay, then: If it's not sending large amount of data across the internet (like music or images) or your internet connection can handle it, you can just use a local machine.
yep ^
Normal chat bots should be no problem.
And if you have some images to send maybe try uploading them to a image hosting site and get the url. (Or just send it on discord and copy the url)
client.on('message', message => {
if(message.content === prefix + "userinfo") {
var uinfo_embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField("**Pseudonyme**",`${message.author.username}#${message.author.discriminator}`)
.addField("**ID**", message.author.id)
.addField("**Date De Création**", message.author.createdAt)
.addField("**Url Avatar**", message.author.displayAvatarURL)
message.channel.send(uinfo_embed)
}
});
I can not do this on someone
It is possible, just get the first mention in the users message
and then replace message.author with <Usermention(aka what you defined as the first mention)>.user.id and stuff like that
I did not understand
Yes, I suck at explaining
also
message.channel.send(uinfo_embed)
embeds need to be sent in an object like { embed: uinfo_embed }
let Mention = message.mentions.members.first();
Mention.user.id
that will get the person mentioned id's
Ok
Hmm, ok, never tried that before
client.on('message', message => {
if(message.content === prefix + "userinfo") {
let Mention = message.mentions.members.first();
var uinfo_embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField("**Pseudonyme**",`${mention.author.username}#${mention.author.discriminator}`)
.addField("**ID**", mention.author.id)
.addField("**Date De Création**", mention.author.createdAt)
.addField("**Url Avatar**", mention.author.displayAvatarURL)
message.channel.send(uinfo_embed)
}
});
@neon pasture That's why I was talking about a Pi they might have lying around.
In that case, it wouldn't really cost anything
@mighty barn
Ok
client.on('message', message => {
if(message.content === prefix + "userinfo") {
let Mention = message.mentions.members.first();
var uinfo_embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField("**Pseudonyme**",`${mention.user.username}#${mention.user.discriminator}`)
.addField("**ID**", mention.user.id)
.addField("**Date De Création**", mention.user.createdAt)
.addField("**Url Avatar**", mention.user.displayAvatarURL)
message.channel.send(uinfo_embed)
}
});
``` @mighty barn
Mention != mention
? I dit no understand @earnest phoenix
JavaScript is case sensitive.
You define your variable as Mention but you use mention.
To JavaScript these are two different variables.
client.on('message', message => {
if(message.content === prefix + "userinfo") {
let mention = message.mentions.members.first();
var uinfo_embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField("**Pseudonyme**",`${mention.user.username}#${mention.user.discriminator}`)
.addField("**ID**", mention.user.id)
.addField("**Date De Création**", mention.user.createdAt)
.addField("**Url Avatar**", mention.user.displayAvatarURL)
message.channel.send(uinfo_embed)
}
});
@earnest phoenix
Have you tried it?
Yes
But..
@earnest phoenix https://please.zbot.me/ujoY2obV.png
cowwect ^
@austere meadow not in newest D.js version
you can do send(embed) now
Doesn't it work since 11.2 like that?
oh interesting
yea Ahri
alright sorry, was not aware 
@austere meadow
no you still need to have () around it
message.channel.send({embed: uinfo_embed})
that keyboard though
do you see an error in the console
Nothing error console
maybe theres something wrong with your if statement then
^
But you need to mention one for the command itself
since you are checking exactly for the string
@earnest phoenix yes
I mention me
Yes and that doesn't work, because the mention is in the message content
what should I do then
Use startsWith
Ok
still not working @earnest phoenix
Post code
client.on('message', message => {
if(message.startsWith === prefix + "userinfo") {
let mention = message.mentions.members.first();
var uinfo_embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField("**Pseudonyme**",`${mention.user.username}#${mention.user.discriminator}`)
.addField("**ID**", mention.user.id)
.addField("**Date De Création**", mention.user.createdAt)
.addField("**Url Avatar**", mention.user.displayAvatarURL)
message.channel.send({embed: uinfo_embed})
}
});
@earnest phoenix
@earnest phoenix look i dont mean to be rude but you cant expect us to spoon feed you
you need to just look at your code and understand what it's doing, or look at a tutorial to help you
read the page that Ahri sent you, it will help you understand how to use startsWith
@austere meadow
I am a bird I need a person to feed me

lol

you can also read the discord.js documentation
that will help
but we won't just post code for you to use
or follow anidiotsguid.com or smth
Or delete my bot
well i would highly recommend checking out anidiots.guide as it has discord.js guides as well
@earnest phoenix, startsWith()
oof
I was gonna link mdn docs for startsWith but I saw Neko handled it already
Yes, delete your bot.
Xd
@earnest phoenix Tu fais un bot en scala ?
Non en js @steel bone
NameError: name 'member' is not defined 😦 why?
because its not defined
it might be a typo
i don't do python and I don't know the lib but wouldn't it be message.member or smthing like that?
or ctx.message.member
idk
@Bee#5480 maybe try message.author.id or something?
Or dépend if cmd is a ctx
If yes : ctx.message.author.id
if you want the name it's name
Which library?
Python
Oh.
But maybe its same else
Np
Anyone have any luck with PUBGStats API?
The tracker one? It's offline I think
{"server_count":1}
{"error":"Required parameter server_count or shards missing"}
what am I doing wrong?
Chances are you're not posting it right

application/json; is not valid lul
I see
@earnest phoenix what library are you using?
so just to clarify -- you're coding a bot?
No
user clients cannot send embeds
if someone's sending an embed on a user account, they're breaking ToS
This
Breaking ToS lul
Is that bannable
Yes
It’s his own server
It's against ToS
Oh
He has nitro
Doesn't matter
Does that matter or no
doesn't matter
if a discord staffer finds out about that, they're banned for sure
K
i would not follow in their footsteps
Rip his money on nitro
Want a link to his server
It’s verified server
support@discordapp.com is interested
With like a name
Both work
seems like an interesting thing to be against ToS
banne™
beanne™
Selfbots are tolerated so long as only the owner can trigger them with commands AFAIK.
Oh, are they. Huh.
But in the end, if the selfbot is subtle enough, you won't be able to tell the difference anyway.
they are indeed fully forbidden
and they indeed can't be able to tell the difference
not a reason to use it tho
You could be using a custom client, after all.
Which, for example, supports sending embeds
custom clients are also disallowed
sending an embed is the easiest way to get banned
^
because it's instant ban when sent by an user account
can someone halp me
//play song
async function play(guild, song) {
const serverQueue = queue.get(guild.id)
// console.log(serverQueue.songs)
const player = await bot.player.join(guild.id, message.member.voiceChannel.id)
await player.play(song.track, { region: message.guild.region });
player.on("end", async (data) => {
if(data.reason && data.reason === 'REPLACED') console.log('Song ended.');
else console.log(data);
serverQueue.songs.shift();
console.log(serverQueue.songs)
await play(message.guild, serverQueue.songs[0]);
});
serverQueue.textChannel.send(`🎶 Now playing: **${song.info.title}**`);
}
}
Ive got this play function, it shifts the second song in the queue to the first spot, but when it gets to playing that newly shifted song is just hangs there and gives me a timeout.
:/
btw this is lavalink.js
If they didn't allow custom clients, why would they make it possible to log in via the public API with a normal user account in the first place?
because your client use the api?
^
fyi just using the login endpoints outside the official client is extremely bannable
using the MFA endpoint is an instant ban
automating /login or /mfa is basically saying "hey b1nzy ban me"
I need to look that up.
#BanEggsy
How would I get a list of users who have upvoted the bot?
btw @inner jewel people do send embeds and not get banned 
if they get reported
because bans are not automated
they will be banned
also discord is free to implement autoban on user accounts sending embeds
well they're free to do pmuch whatever they want
@heady zinc but it's for the bot owner only, how do I make it know its me? I'm getting Unauthorized
the dbl one
^
sends my own discord token 

oh hi khaaz
hi advaith
thanks @heady zinc!
np but you're not forced to ping me at each message tho
sorry
.
someone wanna demonstrate a code snippet to get a guilds name
What lib?
djs
const guilds = client.guilds.map(x => x.name).join('\n');```
sick, thanks famsquad
a specific guild?
np
@bitter sundial that'd be good to know too
<Guild>.name
tyty
Hi
Embed.setthumbnail()
You try with with URL ( ending ) is a .png for exemple or is an oder type
When Im using
.setThumbnail("any image url")
Then it's showing image thumbnail
But I want current song thumbnail
Hum
message.channel.send(`${message.author.username}#${message.author.discriminator}`)```
@wicked tartan
my guy

lol
you can just do message.author.tag as well jsyk
yeah
ok
sickk
all good :]
k @M - Julien '^'#8236 im waiting
small issue with listing guilds, it's returning empty
I know its in at least three
just console.log(bot.guilds) rn
Well that's not going to work
you need to use bot.guilds.size
how to get yt thumbnail?
I was tried
.setThumbnail(thumbnails.high.url)
.setThumbnail(thumbnails)
.setThumbnail(thumbnails.url)
But they all are not working
Yes bro
What api to search videos?
Google api
i dont use ytdl-core personally but https://github.com/fent/node-ytdl-core
theres the documentation for it
@wicked tartan you need to map the guilds
var guilds = client.guilds.map(guild => guild.name).join('\n');```
That's a way to do it
@austere meadow now what should I do?
they have an example folder on the github
and then just console log guilds
you can view some examples there
@earnest phoenix this may have information you want https://github.com/fent/node-ytdl-core/blob/master/example/info.json
oh I see why it wasn't working
Ok thanks man
Im using ES5 btw
es5?
what
Y
why are you using ES5
shhh
Use 6 🤢
thats fair
Hehhe
@wicked tartan did you get it fixed?
working on rn
But to each their own
its all i've used in the past
🤷
I ought to upgrade tho
Well, I should get to sleep now. Gotta go to work in the morning. Ttyl
cya
yep got it now
ok nice
I just forgot how2transpile arrow functions
Dude that examples are not good
ytdl.getInfo(id, (err, info) => {
info.thumbnail_url
});
@earnest phoenix that should work
K thanks
@austere meadow bro check it right or not
ytdl.getInfo(url).then(function(info) {
var song = {};
song.thumbnail = info.thumbnail_url;
song.title = info.title;
song.url = url;
song.user = message.author.username;
song.usravatar = message.author.avatarURL;
yup
ytdl.getInfo(url).then(function(info) {
var song = {};
song.thumbnail = info.thumbnail_url;
song.title = info.title;
song.url = url;
song.user = message.author.username;
song.usravatar = message.author.avatarURL;
.setThumbnail(`${thumbnail}`)
ReferenceError: thumbnail is not defined
yeah
@austere meadow bro
you set it as song.thumbnail
no problem
One question: How should I deal with missing permissions? Especially when my bot doesn't have to "Send Message" permission?
check if it has permissions to send messages before running a command
Seems right. Currently Im just trying to send the message and when it doesn't work Im catching the exception. Im just wondering if I should try to somehow tell the guy who wrote the command for my bot that it can't reply in that channel...
Last question for tonight: what's the best way to do server specific settings? any good tutorials/examples I'm missing?
You could look into the docs of your library.
Like i'm using discord.js and the docs shows all methods and properties available for the guild class.
How do I make it so I can do /calc and it will calculate things in discord.js
just like normal arithmetic functions?
yes
First you wanna check if the first word is /calc, know how to do that?
Uhm sorry, I am new to coding and don't know how everything works yet 😬. Could you please explain?
no worries 😃
gimmie one second
here's a video that shows you how to set up a discord and have your bot check for incoming messages:
Premiere is a dream to edit in, and discord.js is very simple to teach. Looking forward to the future of this series! Downloads: ❯❯ Visual Studio Code: https...
oh wait
you mean for example this
if (message.content.startsWith(prefix + 'info')) {
message.channel.sendMessage('idk');
yeah
oh then yes
mhm
I'm slow give me a second 😬
I'm brainfarting on parsing super hard right now feelsbad, but once you get the math expression isolated you can just use the javascript function eval() which returns the answer so something like ```
message.reply(eval(myexpression));
ah okay
what permission do u need to view auditlogs
OKAY_THANK_YOU
Y_WE_TALKIN_LIKE_THIS
lmao
THATS_JUST_HOW_I_WRITE_OUT_MY_PERMISSIONS
btw its VIEW_AUDIT_LOG not LOGS
OKAY_I_GUESS_IM_SORRY_FOR_FREAKING_OUT
same
oof

also doesn't dicksword.js use camelcase versions
wat
for parsing, this is probably not the best way but something like ```
//splits words by space and stores in array
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
//remove the first word
args.splice(0,1);
//join remaining array into a string
var doMathOnMe = args.join();
it doesn't nvm
@mental geyser
almost
k
@mental geyser wait don't use eval() , its dangerous.. Use this function instead: ```function mathEval (exp) {
var reg = /(?:[a-z$][a-z0-9$]*)|(?:[;={}[]"'!&<>^\?:])/ig,
valid = true;
// Detect valid JS identifier names and replace them
exp = exp.replace(reg, function ($0) {
// If the name is a direct member of Math, allow
if (Math.hasOwnProperty($0))
return "Math."+$0;
// Otherwise the expression is invalid
else
valid = false;
});
// Don't eval if our replace function flagged as invalid
if (!valid)
alert("Invalid arithmetic expression");
else
try { alert(eval(exp)); } catch (e) { alert("Invalid arithmetic expression"); };
}```
or any of the libraries mentioned here: https://stackoverflow.com/questions/5066824/safe-evaluation-of-arithmetic-expressions-in-javascript
Why the api ask for administrator perms if you want to manage_messages ? Thats normal or its d.py making some sh***
Or both
Is the api respond, "Missing permission"
Maybe your bot is on a server where it doesn't have the manage_messages permission
Hmmm How are you sure about that? Is it only on one guild or others of yours?
The owner is a friend and de do some test
Hmm, if it's not in any other guilds, idk
He's on 7
I don't execute the command if i don't have X permission
Np Thanks for the help ^^
If someone got the same issue poke me ^-^
let pages = []
for (let page in Help) {
pages.push(Help[page])
}
let currentPage = 0
function DisplayHelp (currentPage) {
return message.channel.send(pages[currentPage])
.then((HD)=>{
HD.react('⬅').then(()=>HD.react('➡')).then(()=>{
let collected = false
const filter = (r, u) => ((r.emoji.name === 'arrow_left' || r.emoji.name === 'arrow_right') && u.id === message.author.id)
const collector = HD.createReactionCollector(filter, { time: 300000 })
collector.on('collect', (r) => {
if (r.emoji.name === 'arrow_left'){
if (currentPage <= 0) {
currentPage--
collected = true
return collector.stop()
}
}
if (r.emoji.name === 'arrow_right'){
if (currentPage >= pages.length) {
currentPage++
collected = true
return collector.stop()
}
}
return collector.stop()
})
collector.on('end', (c) => {
if (collected) {
DisplayHelp(currentPage);
} else {
HD.edit('Bye', {})
}
})
})
})
}
DisplayHelp(currentPage);
why wont this work lmao
Yes
yes
in that case yes, because arrow_right isn't a thing
Probably because it's a hell
emoji.name is the unicode
lemme quickly check the code i had
nvm i got it
so i wentback a step and replace \⬅ etc
then realised my actually if statements were reversed
nice™

No

Never ever in any language.
ty
[a,b].includes(c)
Hey
Anyone here a python nerd?
Say I have a string "testing 12 / test / hi"
I have the index 15 (char s of test)
How would I split the string at the nearest "/" to the left of that index?
I would do something along the lines of
def split_at_slash(s, index):
slash_index = s.rfind('/', 0, index)
return (s[0:slash_index], s[slash_index + 1:])
you use rfind bounded on the area left of your index
then use your subscript operators to split the string into two parts
@earnest phoenix
that acheives nothing
Ah
Fanta's method works
nearest to an index on the left
oh
Ah ok sorry
text wrapping with a custom break char essentially
tfw you accidentally write a text wrapping algorithm
You wrote the start
def wrap(self, string, length, break_char):
safe_lines = []
unsafe = string
while len(unsafe) > length:
slash_index = unsafe.rfind(break_char, 0, length)
if slash_index == -1:
break
safe_lines.append(unsafe[0:slash_index].strip())
unsafe = unsafe[slash_index + 1:].strip()
safe_lines.append(unsafe)
return safe_lines
tru
So my nginx makes my site work both with IP and Domain even though I've stated server_name
any idea why?
because that's just how DNS works?
all your requests are eventually resolved to IP addresses
^
got it but now when I'm trying to create new config for another node_js application as a proxy_pass and putting my serverip:port in then it's redirecting to another site I've set in nginx
try checking the nginx error log
what happened to me once was that one app errored so nginx used the default one
ahh I see
Got it, it's because my node.js apps are running on localhost as well and when I'm trying to use them in proxy_pass as 127.0.0.1:port it's giving a already in use error
but that's just for one app
I have 2 node.js apps and only one of them is erroring
the other one is showing a 521 error
now that I've removed the port issues it's still showing a 521 error
wtf are u hosting
an express website and api
o
but it's just showing offline
Is there a class for the bot icon on the website? I don't seem to be able to use border-radius on it?
nvm
While they do not fit with some bot icons, some do
I'll get those circular bot icons as soon as my bot is certified. So probably never.
People are pros in dealing with E-Mails right?
Great, I need help
const { SMTPServer } = require('smtp-server');
const fs = require('fs');
const config = require('config');
const server = new SMTPServer({
key: fs.readFileSync(config.get('certificate').key),
cert: fs.readFileSync(config.get('certificate').cert),
onData(stream, session, callback) {
stream.pipe(process.stdout);
stream.on('end', callback);
}
});
server.listen(25);
The SMTP server works, but gmail says:
Im not sure whether or not I should allow all authentication requests
well if it's a public address the answer is probably to disable auth
actually auth is probably important
i really have no clue how the email protocol works
Can't really auth a random SMTP server
help me plz
message.channel.bulkDelete(fetched)
const swearWords = ["damn", "shit", "fuck", "bitch", "dick"];
if( swearWords.some(word => message.content.includes(word)) ) {
message.reply("No cusswords ${message.author}"});
// Or just do message.delete();```
actually same i need help to...
huh me???
ya
well ummm I can try bc I mean I haven't code in a long time
oh lol
this js?
@earnest phoenix learn js syntax pls
anyone know how to get the x and y of an image? please tag me
define "x and y"
anyone here knows how to fix this? http://prntscr.com/i56rpt lib is discord.js
it takes the bug part with it :/
substrings
^
best way to store server-specific configurations for a bot (like custom commands) just stick it in a json file?
the best way would be to use a database
but if your bot is small, you probably don't need that
yeh it smol
then a json document is perfectly fine for the time being
ok dope ty famsquad
One of my bots is in 3 guilds and uses a SQL db. Another one uses a JSON file for 420+ guilds to store a channel id. So shrug. If you expect more than one write per a few seconds, use a DB.
for the time being
its just one variable per server and its in like 11 servers total
and I assume it won't be changed often
i'm working on a new bot and i'm thinking about how i'm going to manage the data. but i don't really have experience with large amounts of data. will keeping track of all user's inventories and information in one huge json file pose any potential issues? idk sorry if this sounds dumb aha @_@
json is susceptible to corruption but sure
I wouldn't store it all in just one huge json
hmm.. any suggestions for better methods?
i use python primarily but i also know javascript
the bot is written in?
python
ah i don't know any specific database for python
so far i've heard a lot of good feedbacks about rethinkdb
i think you can use it with python 
or SQL but its a real pain to use
python can use rethinkdb, it has driver libs
idk though
I haven't used it
there's also sql libs for python
then again if you don't feel confident enough, you can start with a json file, you just need to make backups regularly in case it gets corrupted
you've got:
- asyncpg (recommended, for postgres ofc)
- sqlite3 (built in, bit hard to use)
- rethinkdb (yeah it's just rethink)
and others
probably
hmm i see
How would I go about making a command so the bots volume itself changes? Or is that not possible
its your bot, you should know about it 
no?
fredboat doesn't "change the volume slider"
it changes what it sends to discord
the volume command re-encode the song with the appropriate volume
and then send it to discord
Hmm ok I get it
Djs btw
Oh ok, is there a reasonable way to do it with isMentioned ?
not sure
@wicked tartan Ah, do this
if (message.isMentioned(client.user)) {
//do something
}
If I have a ready event for my bot already, can I still use the <Client>.on('ready', update); event again? 🤔
Or should I just add update into the event
Yes you can still use it
Didn't want it to mess with anything, thanks 😛
I forgot I had request already defined 🤔
const reqquest = require('request');
Would that work?
🤔
wat
lmao
😛
but yeah
I gotta get this done before I go to bed 😛 which I have 20 minutes
reqsouth
I keep laughing for some reason 🤣
I guess I'm just tired
Ok, I hope this doesn't break my bot
😛
Woot, didn't break
I have a command displaying server count, what's wrong ? Do I need to display it on my website ?
No you need to post it to DBLs site
Discord bot list
but where ?
But I dont understand how do I apply this
what lib is your bot in?
Py
Server count basically shows your server count on DBL's website (Your bot page).
Yes but do I need to put this code to my bot ?
Ah to update count everytime ?
mhm
Yes but if your bot has high number of guilds, and joins and leaves alot of guilds, Preferable not to post it on guild_join and remove
OK thanks a lot 😁
My bot posts once and that's when it starts up 
Lol
Oof
Couldn’t you run it on set intervals?
Once every minute shouldn’t get to the rate limit afaik
If you post once a minute tonk will kill you
Anyone have any Bot who can Welcome any Online user & chat with them???
Welcomer..?
Doesn't chat with them tho.
as far as i remember best practice is still to post on guildadd and guildleave
any excessive growth still won't hit the ratelimit
The ratelimit is 10 per minute, right?
Rethinking it, actually yes, it's the matter of the speed your bot join guilds not the number of guilds your bot joins in a minute
wat
not posting periodically
but yeah
i post everytime a guild event is fired
never did any excessive posting even days my shit was on the front page
i do not own rythm tho so i guess there's that
tonkku's official stance is posting periodically every 3600000ms afaik
i do it once every 30 minutes myself
@heady zinc That's once per hour
@earnest phoenix and?
posting ms
cuz its more meaningful
Then post pico seconds or something
you use ms in the code
I don't.
so why the heck
Don't use my code
@restive silo sorry if im being annoying but do you know why the API is returning this?
what does your body look like?
needs to be a json
i actuall dont know i just used curl 
i'd send raw json, its easier
You need to send raw json
@earnest phoenix I wonder if that method ^ can bypass if you dont have nitro 
yup
Wew 
can I have a calculator command code for discord.js plz
People wont mind giving you ideas on how to do it, but not give you any code
@mental geyser Use eval
Just eval(string) ?
Yes
oh boi.
banne
?

if you mean the text style, css
const rainbow = new Array(size);
for (var i=0; i<size; i++) {
var red = sin_to_hex(i, 0 * Math.PI * 2/3); // 0 deg
var blue = sin_to_hex(i, 1 * Math.PI * 2/3); // 120 deg
var green = sin_to_hex(i, 2 * Math.PI * 2/3); // 240 deg
rainbow[i] = '#'+ red + green + blue;
}
function sin_to_hex(i, phase) {
var sin = Math.sin(Math.PI / size * 2 * i + phase);
var int = Math.floor(sin * 127) + 128;
var hex = int.toString(16);
return hex.length === 1 ? '0'+hex : hex;
}
let place = 0;
const servers = "404571284555694090";
function changeColor() {
for (let index = 0; index < servers.length; ++index) {
client.guilds.get(servers[index]).roles.find('name', "#rainbow").setColor(rainbow[place])
.catch(console.error);
if(config.logging){
console.log(`[ColorChanger] Changed color to ${rainbow[place]} in server: ${servers[index]}`);
}
if(place == (size - 1)){
place = 0;
}else{
place++;
}
}
}
client.on('ready', () => {
console.log(`Logged in as ${client.user.username}!`);
if(config.speed < 60000){console.log("The minimum speed is 60.000, if this gets abused your bot might get IP-banned"); process.exit(1);}
setInterval(changeColor, config.speed);
});
Help me pls {size} is not defined
and use syntax highlight
@restive silo how?
also friendly reminder that rainbow roles are bannable
https://gyazo.com/60b952040a134377c84d987430ae8a51
how am I do it? gimme da code lol
grab the element hide it and :after to change it
how? I am html/css dumb
anyone here a python wizard?
const rainbow = new Array(size);
for (var i=0; i<size; i++) {
var red = sin_to_hex(i, 0 * Math.PI * 2/3); // 0 deg
var blue = sin_to_hex(i, 1 * Math.PI * 2/3); // 120 deg
var green = sin_to_hex(i, 2 * Math.PI * 2/3); // 240 deg
rainbow[i] = '#'+ red + green + blue;
}
function sin_to_hex(i, phase) {
var sin = Math.sin(Math.PI / size * 2 * i + phase);
var int = Math.floor(sin * 127) + 128;
var hex = int.toString(16);
return hex.length === 1 ? '0'+hex : hex;
}
let place = 0;
const servers = "404571284555694090";
function changeColor() {
for (let index = 0; index < servers.length; ++index) {
client.guilds.get(servers[index]).roles.find('name', "#rainbow").setColor(rainbow[place])
.catch(console.error);
if(config.logging){
console.log(`[ColorChanger] Changed color to ${rainbow[place]} in server: ${servers[index]}`);
}
if(place == (size - 1)){
place = 0;
}else{
place++;
}
}
}
client.on('ready', () => {
console.log(`Logged in as ${client.user.username}!`);
if(config.speed < 60000){console.log("The minimum speed is 60.000, if this gets abused your bot might get IP-banned"); process.exit(1);}
setInterval(changeColor, config.speed);
});
Help me pls {size} is not defined @restive silo
could you stop mention me, and also i wont help you making a rainbow roles bot since that is api abuse and bannable
x(
#bot-details-page .lib {
display: none;
}
#bot-details-page .lib:after {
content: "text";
}
how do I fix that?
:after is a child of its parent always
ok lol
}
#bot-details-page .lib {
display: none;
}
#bot-details-page .lib:after {
content: "text";
}
this is the best I made, this is shows both...
also any HTML is needed?
what are you even trying to accomplish
remove the discord.js and put my lib name
.......why
you can set a custom lib you know
there's zero reason to do this
what is the fastest way to replace the text of this shit?
I'm dealing with something that's supposed to be just too long and it drives me nuts
And I know there's a way to do that because I've seen a bot doing it
but then it will say "other"
uhh i recall there was same way around it
modifying the input element so you post a custom lib name...?

@earnest phoenix You can do it for sure just find the way to do it good luck
Bro @potent lily can you help me plz
What about asking your question?
hello quick web dev question
Quick answer.
How to get youtube video duration?
I have a sort of "component" thing going on in my web app where I need modular-ish component things to be displayed on the client
a component being a bit of html + css
but I need the components to also have behaviour attached to them in the form of some js or something
and I also need to be able to swap out components on the fly
@radiant basin \
errrr I think I solved my own problem
How to get youtube video duration?
haaaaave you read the docs?
I tried contentDetails.duration but not working it is on at yt api Webpage
wait are you talking about the ytdl command line program
Yes
if you just read the docs, you would see this line
--get-duration Simulate, quiet but print video length
hello welcome to #development
I need help
With?
Send code?
ytdl.getInfo(url).then(function(info) {
var song = {};
song.thumbnail = info.thumbnail_url;
song.title = info.title;
song.url = url;
song.user = message.author.username;
song.usravatar = message.author.avatarURL;


