#development

1 messages · Page 361 of 1

lilac comet
#

This channel it’s only for discord bots?

quiet bobcat
#

I guess

#

What do you need to know?

neon pasture
#

@lilac comet what is the problem?

lilac comet
#

Im creating a website, and if I have some issues, I will like to have a server where I can ask

sturdy hemlock
#

could someone quickly tell me what the issue with my code is quickly if i send a screenshot.

crimson raft
#

Do you i start with visual studio code to program my bot

mighty barn
#

Yes

crimson raft
#

?

valid holly
#

Visual Studio is good

#

You can try Atom too

#

Some people even use Notepad++

earnest phoenix
#

JETBRAINS

inner jewel
#

I N T E L L I J I D E A

near jasper
#

If anyone need a Translator for Hungarian please dm me

south igloo
#

VI

inner jewel
#

emacs

wicked tartan
#

microsoft word 2010

severe socket
#

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? thonkery

#

Yeah I know that, that's why thonkery

pale light
#

You can submit it with a common account GWjustinBlobLenny

severe socket
#

wait what

#

Never see anything about account sharing at this point

#

Why would we break discord TOS doing that?

pale light
#

its not against tos

#

to share

#

You're just responsible for everything that happens under that account

severe socket
#

yeah we are not selling the account. We just made a new account and we all have the password

pale light
#
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.
severe socket
#

yeah that seems more correct ^

#

Because tbh, it's just like we randomly connect with either one of our pc theshrug

#

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 theshrug

#

Just didn't feel right to quote me as main owner since we started this as a team

languid flicker
#

uhmm

pale light
#

What are you trying to do

languid flicker
#

yes i did npm install

pale light
#

you npm installed discordbotlist?

languid flicker
#

yes

pale light
#

wadu hec

#

are you trying to post server count?

languid flicker
#

yes

pale light
#

thats not how you do it xD

hushed berry
#

wtf are those vars @languid flicker

crimson raft
#

Hi

#

It's the Real Lucas

wooden shoal
#

Those variables omfg

#

Use an array

wicked tartan
#

Omg the variables

weak parrot
#

No needs more vars

heady bough
#

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

austere meadow
#

DELETE FROM [table] WHERE [column] = [value] should do it

#

make sure you include WHERE otherwise it'll delete everything

heady bough
#

Won't that delete every ID I specify?

earnest phoenix
#

that will also delete the original enteries

austere meadow
#

oh

heady bough
#

I just want to remove the duplicates

austere meadow
#

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

heady bough
#

Welp, that'll teach me to sleep and code

#

Thank you anyway :3

austere meadow
#

wait

heady bough
#

hm?

austere meadow
#

do all the entries have the exact same column values as well?

heady bough
#

That I'm... not entirely sure

#

let me look through real quick

austere meadow
#

because you could do WHERE [column1] = [value1] AND [column2] = [value2]

heady bough
#

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

austere meadow
#

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

heady bough
#

It's just the Discord user IDs

#

It's alright, I can just flush the db

austere meadow
#

ah okay

heady bough
#

and reimburse everyone with 500 coins

#

:3

austere meadow
#

alright, sorry if i wasn't much help ive just never had to do something like that before ablobsweats

heady bough
#

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

austere meadow
#

ah :/

heady bough
#

I'm glad I caught it at least

wicked tartan
#
 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

austere meadow
#

you need to do === p sure

#

try using ===

wicked tartan
#

also is there a more efficent way I should be writing that besides a million ||'s?

austere meadow
#

you can put all those filetypes in an array

#

and check if its in the array

wicked tartan
#

oh yeah arrays are a thing

austere meadow
#

lmao

languid dragon
#

['mov', 'mp4', ...].includes(filetype)

austere meadow
#

yes ken genius

wicked tartan
#

oooh efficent

#

lemme try the === first real quick

languid dragon
#

that shouldn't technically make a huge difference

wicked tartan
#

then I'll do that

languid dragon
#

also check the that filetype is actually corrent and outputting the corrent values

wicked tartan
#

hmm its still uploading images

#

filetype is fine

#

spits out the right thing

austere meadow
#

which method are you using the array or the ===

languid dragon
#

show more code?

wicked tartan
#

=== atm

austere meadow
#

=== wont work i just tested it sorry

#

im dum

languid dragon
#

yeah like i said === is like "EXACT VALUE" and == is a little more loose

#

to my knowledge

austere meadow
#

yeah

languid dragon
#

it's good practice to use ===

#

but that wouldn't cause your issue

wicked tartan
#

someting something typechecking

austere meadow
#

i recommend using the array method since its more efficient anyways

languid dragon
#

yeah

#

[].includes would be ur best way of doing it

wicked tartan
#

changing it to that atm

#

still uploading images hmm

austere meadow
#

are you absolutely positive that filetype is what you are expecting? also if possible can we get a bit more code

wicked tartan
#
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
            });
        }
    });

});
austere meadow
#

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))

languid dragon
#

what does filetype output

#

like, console logit and show pls

wicked tartan
#

token?

#

what the hell, console logging the index does not spit out anything

austere meadow
#

like it spits out an empty string or undefined?

wicked tartan
#

nope it just dosent run

austere meadow
#

uh

#

you probably have an error in your code somewhere if its not getting run

#

unless you typed it wrong

wicked tartan
#

omg lol

#

I did something dumb

#

yeah

#

I think I forgot to turn off my heroku app

#

yeah

austere meadow
#

oh did you forget to restart or something

wicked tartan
#

I was just running it locally

austere meadow
#

ah

wicked tartan
#

lemme try

#

its always something dumb as hell

austere meadow
#

hahahaha

wicked tartan
#

it works now

#

smh

#

Thanks friends for bearing with me

#

time to delete 14 pages of pictures from streamable now :^)

austere meadow
#

haha all good blobthumbsup

wicked tartan
#

is it possible to get a server name based off id?

earnest phoenix
#

If your bot can see it, yes

restive silo
#

more like if your bot is in that server

#

but yea

#

it is

wicked tartan
#

Am I missing it in the docs?

earnest phoenix
#

Huh?

wicked tartan
#

yep

#

I was

#

found it

earnest phoenix
earnest phoenix
#

I am looking for a free vps, someone has one?

restive silo
#

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)

mighty barn
#

I've heard about something like "OpenShift", i think it's a trial but can be renewed

#

just what I heard

earnest phoenix
#

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

earnest phoenix
#
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

austere meadow
#

whoops

earnest phoenix
#

Ah

jolly zodiac
#

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.

mighty barn
#

Though the internet usage would highly increase.

#

Especially if it's a music bot

earnest phoenix
#

he does not recognize guild @austere meadow

austere meadow
#

guild isn't defined, you need to use message.guild

jolly zodiac
#

Is it a music bot?

mighty barn
#

Just saying "if"

earnest phoenix
#

Oh ok @austere meadow thanks

austere meadow
#

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

jolly zodiac
#

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.

mighty barn
#

yep ^

jolly zodiac
#

Normal chat bots should be no problem.

mighty barn
#

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)

earnest phoenix
#
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

mighty barn
#

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

earnest phoenix
#

I did not understand

mighty barn
#

Yes, I suck at explaining

austere meadow
#

also
message.channel.send(uinfo_embed)
embeds need to be sent in an object like { embed: uinfo_embed }

mighty barn
#
let Mention = message.mentions.members.first();

Mention.user.id
#

that will get the person mentioned id's

earnest phoenix
#

Ok

mighty barn
#

Hmm, ok, never tried that before

earnest phoenix
#
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)
}
});
jolly zodiac
#

@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

earnest phoenix
#

@mighty barn

mighty barn
#

no

#

Mention.user

earnest phoenix
#

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..

mighty barn
#

have mention.user be Mention.user

#

oh nvm

earnest phoenix
#

But?

austere meadow
mighty barn
#

cowwect ^

restive silo
#

@austere meadow not in newest D.js version

austere meadow
#

oh?

#

on 11.3?

restive silo
#

you can do send(embed) now

earnest phoenix
#

Doesn't it work since 11.2 like that?

austere meadow
#

oh interesting

restive silo
#

yea Ahri

austere meadow
#

alright sorry, was not aware notlikeblob

earnest phoenix
austere meadow
#

no you still need to have () around it

#

message.channel.send({embed: uinfo_embed})

pale light
#

that keyboard though

earnest phoenix
#

@austere meadow ..

#

Nothing

#

😢

austere meadow
#

do you see an error in the console

earnest phoenix
#

Nothing error console

austere meadow
#

maybe theres something wrong with your if statement then

earnest phoenix
#

Well

#

It only works if you don't mention one

austere meadow
#

^

earnest phoenix
#

But you need to mention one for the command itself

austere meadow
#

since you are checking exactly for the string

earnest phoenix
#

@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

austere meadow
#

@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

earnest phoenix
#

@austere meadow
I am a bird I need a person to feed me

austere meadow
mighty barn
#

lol

pale light
austere meadow
#

you can also read the discord.js documentation

#

that will help

#

but we won't just post code for you to use

mighty barn
austere meadow
#

^

#

anidiots.guide

earnest phoenix
#

Or delete my bot

austere meadow
#

well i would highly recommend checking out anidiots.guide as it has discord.js guides as well

frail kestrel
#

@earnest phoenix, startsWith()

#

oof

#

I was gonna link mdn docs for startsWith but I saw Neko handled it already

earnest phoenix
#

Yes, delete your bot.

frail kestrel
#

yes

#

delete it

earnest phoenix
#

Xd

steel bone
#

@earnest phoenix Tu fais un bot en scala ?

earnest phoenix
#

Non en js @steel bone

primal compass
#

NameError: name 'member' is not defined 😦 why?

fathom pebble
#

because its not defined

raven hawk
#

it might be a typo

primal compass
#

if member.id == " ":
await.bot.say(ctx.message.author.mention + " ")

severe socket
#

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

fathom pebble
frigid juniper
#

Or dépend if cmd is a ctx

#

If yes : ctx.message.author.id

#

if you want the name it's name

radiant basin
#

Which library?

frigid juniper
#

Python

radiant basin
#

Oh.

frigid juniper
#

But maybe its same else

primal compass
#

oh sry back

#

@fathom pebble sure thx will try that

#

@frigid juniper k cool ty

frigid juniper
#

Np

opal jasper
#

Anyone have any luck with PUBGStats API?

earnest phoenix
#

pubg

latent copper
#

The tracker one? It's offline I think

weak parrot
#

I can't get anyone with it so

#

¯_(ツ)_/¯

glass inlet
#
{"server_count":1}
{"error":"Required parameter server_count or shards missing"}

what am I doing wrong?

uncut slate
#

Chances are you're not posting it right

glass inlet
#

posted as raw json

#

lolwut...

#

application/json works
application/json; breaks

quiet bobcat
bitter sundial
#

application/json; is not valid lul

glass inlet
#

I see

scenic crest
#

@earnest phoenix what library are you using?

earnest phoenix
#

Hey

#

My phone

#

What lol

scenic crest
#

so just to clarify -- you're coding a bot?

earnest phoenix
#

No

glossy sand
#

user clients cannot send embeds

earnest phoenix
#

It’s so I can send a role picking message

#

Uh what

glossy sand
#

if someone's sending an embed on a user account, they're breaking ToS

earnest phoenix
#

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

glossy sand
#

doesn't matter

earnest phoenix
#

K

#

Get a bot account and do it with the bot account.

glossy sand
#

if a discord staffer finds out about that, they're banned for sure

earnest phoenix
#

K

glossy sand
#

i would not follow in their footsteps

earnest phoenix
#

Rip his money on nitro

#

Want a link to his server

#

It’s verified server

#

With like a name

inner jewel
earnest phoenix
#

Both work

wicked tartan
#

seems like an interesting thing to be against ToS

jagged plume
#

you'd have to selfbot/userbot to post them

#

selfbots not allowed

restive silo
#

banne™

pale light
#

beanne™

elder rapids
#

So what about our friendly mod EGGSY then? 👀

#

He posted an embed

jolly zodiac
#

Selfbots are tolerated so long as only the owner can trigger them with commands AFAIK.

unique star
#

no

#

selfbots are fully disallowed

jolly zodiac
#

Oh, are they. Huh.

unique star
jolly zodiac
#

But in the end, if the selfbot is subtle enough, you won't be able to tell the difference anyway.

unique star
#

no but if someone does and reports you or a dev notices

#

you are fucked

heady zinc
#

they are indeed fully forbidden

#

and they indeed can't be able to tell the difference

#

not a reason to use it tho

jolly zodiac
#

You could be using a custom client, after all.

#

Which, for example, supports sending embeds

inner jewel
#

custom clients are also disallowed

#

sending an embed is the easiest way to get banned

unique star
#

^

inner jewel
#

because it's instant ban when sent by an user account

topaz fjord
#

can someone halp me

topaz fjord
#
//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

jolly zodiac
#

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?

heady zinc
#

because your client use the api?

inner jewel
#

^

#

fyi just using the login endpoints outside the official client is extremely bannable

#

using the MFA endpoint is an instant ban

unique star
#

automating /login or /mfa is basically saying "hey b1nzy ban me"

jolly zodiac
#

I need to look that up.

unique star
elder rapids
#

#BanEggsy

bright spear
#

How would I get a list of users who have upvoted the bot?

#

btw @inner jewel people do send embeds and not get banned Thonk

heady zinc
inner jewel
#

if they get reported

heady zinc
#

because bans are not automated

inner jewel
#

they will be banned

#

also discord is free to implement autoban on user accounts sending embeds

heady zinc
#

well they're free to do pmuch whatever they want

inner jewel
#

they could even ban you for not liking your id

#

¯_(ツ)_/¯

bright spear
#

@heady zinc but it's for the bot owner only, how do I make it know its me? I'm getting Unauthorized

heady zinc
#

send your token along with the Authorization header

#

your bot's token*

jagged plume
#

the dbl one

heady zinc
#

^

bright spear
#

sends my own discord token bloblul

severe socket
bright spear
#

oh hi khaaz

severe socket
#

hi advaith

bright spear
#

thanks @heady zinc!

heady zinc
#

np but you're not forced to ping me at each message tho

bright spear
#

sorry

earnest phoenix
#

.

wicked tartan
#

someone wanna demonstrate a code snippet to get a guilds name

quiet bobcat
#

What lib?

wicked tartan
#

djs

quiet bobcat
#
const guilds = client.guilds.map(x => x.name).join('\n');```
wicked tartan
#

sick, thanks famsquad

bitter sundial
#

a specific guild?

quiet bobcat
#

np

wicked tartan
#

@bitter sundial that'd be good to know too

bitter sundial
#

<Guild>.name

wicked tartan
#

tyty

earnest phoenix
#

Hi

potent lily
#

Embed.setthumbnail()

#

You try with with URL ( ending ) is a .png for exemple or is an oder type

earnest phoenix
#

When Im using
.setThumbnail("any image url")
Then it's showing image thumbnail

potent lily
#

Yep but ?

#

Whats wrong

earnest phoenix
#

But I want current song thumbnail

potent lily
#

Hum

earnest phoenix
#

It should get it from yt

#

What should I do now ?

potent lily
#

I Google 5m didnt find good luck i need to work now x)

#

See ya GL

wicked tartan
#

is it possible to get author in the format of 'Shuii#9701'?

#

or just the id?

quiet bobcat
#
message.channel.send(`${message.author.username}#${message.author.discriminator}`)```
#

@wicked tartan

wicked tartan
#

my guy

quiet bobcat
wicked tartan
#

what's it like being dope as hell?

#

ily

quiet bobcat
#

lol

austere meadow
#

you can just do message.author.tag as well jsyk

quiet bobcat
#

You can?

#

🤔

austere meadow
#

yeah

quiet bobcat
#

ok

wicked tartan
#

sickk

quiet bobcat
#

ah

#

I see it on the docs

#

I'll be using that from now on, ty Blake

austere meadow
#

all good :]

earnest phoenix
#

k @M - Julien '^'#8236 im waiting

wicked tartan
#

small issue with listing guilds, it's returning empty

#

I know its in at least three

quiet bobcat
#

hm

#

What did you do?

austere meadow
#

^

#

@earnest phoenix also whats up

#

what issue are you having

wicked tartan
#

just console.log(bot.guilds) rn

quiet bobcat
#

Well that's not going to work

austere meadow
#

you need to use bot.guilds.size

earnest phoenix
#

how to get yt thumbnail?
I was tried
.setThumbnail(thumbnails.high.url)
.setThumbnail(thumbnails)
.setThumbnail(thumbnails.url)
But they all are not working

austere meadow
#

bot.guilds is a GuildStore

#

@earnest phoenix are you using ytdl-core?

earnest phoenix
#

Yes bro

quiet bobcat
#

What api to search videos?

earnest phoenix
#

Google api

austere meadow
quiet bobcat
#

@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

earnest phoenix
#

@austere meadow now what should I do?

austere meadow
#

they have an example folder on the github

quiet bobcat
#

and then just console log guilds

austere meadow
#

you can view some examples there

earnest phoenix
#

K I'm trying to se

#

Thanks

austere meadow
wicked tartan
#

oh I see why it wasn't working

earnest phoenix
#

Ok thanks man

wicked tartan
#

Im using ES5 btw

austere meadow
#

no problem

#

:)

quiet bobcat
#

es5?

austere meadow
#

what

earnest phoenix
#

Y

austere meadow
#

why are you using ES5

wicked tartan
#

shhh

earnest phoenix
#

Use 6 🤢

wicked tartan
#

not important

#

👀

earnest phoenix
#

Xd es5

#

On one of my servers, we call es5 users noobs xD

wicked tartan
#

thats fair

earnest phoenix
#

Hehhe

austere meadow
#

@wicked tartan did you get it fixed?

wicked tartan
#

working on rn

earnest phoenix
#

But to each their own

wicked tartan
#

its all i've used in the past

earnest phoenix
#

🤷

wicked tartan
#

I ought to upgrade tho

earnest phoenix
#

Well, I should get to sleep now. Gotta go to work in the morning. Ttyl

austere meadow
#

cya

wicked tartan
#

yep got it now

quiet bobcat
#

ok nice

wicked tartan
#

I just forgot how2transpile arrow functions

earnest phoenix
#

Dude that examples are not good

austere meadow
#
ytdl.getInfo(id, (err, info) => {
info.thumbnail_url
});

@earnest phoenix that should work

earnest phoenix
#

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;
austere meadow
#

what

#

did you try it

earnest phoenix
#

no

#

ill

austere meadow
#

can you

#

do that

#

cheers

earnest phoenix
#

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

austere meadow
#

yeah

earnest phoenix
#

@austere meadow bro

austere meadow
#

you set it as song.thumbnail

earnest phoenix
#

ohk

#

thank you

austere meadow
#

no problem

glossy rose
#

One question: How should I deal with missing permissions? Especially when my bot doesn't have to "Send Message" permission?

tawny lava
#

check if it has permissions to send messages before running a command

glossy rose
#

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...

wicked tartan
#

Last question for tonight: what's the best way to do server specific settings? any good tutorials/examples I'm missing?

radiant basin
#

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.

mental geyser
#

How do I make it so I can do /calc and it will calculate things in discord.js

wicked tartan
#

just like normal arithmetic functions?

mental geyser
#

yes

wicked tartan
#

First you wanna check if the first word is /calc, know how to do that?

mental geyser
#

Uhm sorry, I am new to coding and don't know how everything works yet 😬. Could you please explain?

wicked tartan
#

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:

mental geyser
#

oh wait

#

you mean for example this

#

if (message.content.startsWith(prefix + 'info')) {
message.channel.sendMessage('idk');

wicked tartan
#

yeah

mental geyser
#

oh then yes

wicked tartan
#

ok cool

#

then you want to get the second part of the message after that

mental geyser
#

mhm

wicked tartan
#

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));

mental geyser
#

ah okay

languid dragon
#

what permission do u need to view auditlogs

uncut slate
#

VIEW_AUDIT_LOGS IIRC

#

there's an explicit one

languid dragon
#

OKAY_THANK_YOU

uncut slate
#

Y_WE_TALKIN_LIKE_THIS

austere meadow
#

lmao

languid dragon
#

YOU_WERE_SHOUTING_AT_ME

uncut slate
#

THATS_JUST_HOW_I_WRITE_OUT_MY_PERMISSIONS

austere meadow
#

btw its VIEW_AUDIT_LOG not LOGS

languid dragon
#

OKAY_I_GUESS_IM_SORRY_FOR_FREAKING_OUT

uncut slate
#

same

languid dragon
#

thanks aetheryx

#

u fucking twat

austere meadow
#

oof

languid dragon
uncut slate
#

also doesn't dicksword.js use camelcase versions

languid dragon
#

wat

wicked tartan
#

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();

uncut slate
#

it doesn't nvm

languid dragon
#

sweeeet

#

no more errors

wicked tartan
#

@mental geyser

languid dragon
#

almost

mental geyser
#

k

wicked tartan
#

@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"); };

}```

potent lily
#

Why the api ask for administrator perms if you want to manage_messages ? Thats normal or its d.py making some sh***

heady zinc
#

either d.py or you doing something wrong

mighty barn
#

Or both

potent lily
#

Is the api respond, "Missing permission"

mighty barn
#

Maybe your bot is on a server where it doesn't have the manage_messages permission

potent lily
#

After try to delete a message work great with admin perms

#

He have for sure

mighty barn
#

Hmmm How are you sure about that? Is it only on one guild or others of yours?

potent lily
#

The owner is a friend and de do some test

mighty barn
#

Hmm, if it's not in any other guilds, idk

potent lily
#

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 ^-^

languid dragon
#
    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

heady zinc
#

because

#

wait

#

is this d.js

earnest phoenix
#

Yes

languid dragon
#

yes

heady zinc
#

in that case yes, because arrow_right isn't a thing

earnest phoenix
#

Probably because it's a hell

heady zinc
#

emoji.name is the unicode

languid dragon
#

it didn't work with just the things either

#

yeah that didn't work either

#

1 sec

heady zinc
#

lemme quickly check the code i had

languid dragon
#

nvm i got it

#

so i wentback a step and replace \⬅ etc

#

then realised my actually if statements were reversed

#

nice™

heady zinc
languid dragon
#

ty anyway LOL

#

no00b question

earnest phoenix
#

No

languid dragon
earnest phoenix
#

Never ever in any language.

languid dragon
#

ty

uncut slate
#

[a,b].includes(c)

earnest phoenix
#

Hey

earnest phoenix
#

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?

glossy sand
#

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

frigid juniper
#

Or : mystr.split("/", 999)

#

999 to split a maximal of times if str is big

earnest phoenix
#

that acheives nothing

frigid juniper
#

Realy ?

#

It works i use that

earnest phoenix
#

that is just gonna split at every /

#

Not what I want at all

frigid juniper
#

Ah

earnest phoenix
#

Fanta's method works

frigid juniper
#

Do 1 instead of 999

#

it keeps the first word

earnest phoenix
#

That'll just split at the first /

#

Again not what I wanted

#

😂

frigid juniper
#

Wtf

#

you said beginning at left

earnest phoenix
#

nearest to an index on the left

heady zinc
#

oh

frigid juniper
#

Ah ok sorry

heady zinc
#

phanta's stuff is very smart

earnest phoenix
#

text wrapping with a custom break char essentially

glossy sand
#

tfw you accidentally write a text wrapping algorithm

earnest phoenix
#

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
glossy sand
#

what's the point of unsafe = string?

#

you could just call the parameter unsafe right

earnest phoenix
#

I was gonna use string again later

#

never did

glossy sand
#

also there's no reason for this to be a member method

#

it should be static

earnest phoenix
#

tru

opaque bison
#

So my nginx makes my site work both with IP and Domain even though I've stated server_name

#

any idea why?

glossy sand
#

because that's just how DNS works?

#

all your requests are eventually resolved to IP addresses

inner jewel
#

^

opaque bison
#

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

inner jewel
#

try checking the nginx error log

#

what happened to me once was that one app errored so nginx used the default one

opaque bison
#

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

earnest phoenix
#

wtf are u hosting

opaque bison
#

an express website and api

earnest phoenix
#

o

opaque bison
#

but it's just showing offline

mighty barn
#

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

gusty topaz
#

circular bot icons

#

please don't 😦

mighty barn
#

While they do not fit with some bot icons, some do

primal compass
#

I keep seeing turtles everywhere

#

Oh nvm its you 🙄

#

Yourself

earnest phoenix
#

I'll get those circular bot icons as soon as my bot is certified. So probably never.

trim steppe
#

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);
#

Im not sure whether or not I should allow all authentication requests

glossy sand
#

well if it's a public address the answer is probably to disable auth

glossy sand
#

actually auth is probably important

#

i really have no clue how the email protocol works

trim steppe
#

Can't really auth a random SMTP server

earnest phoenix
#

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();```
outer kettle
#

actually same i need help to...

earnest phoenix
#

ya

#

help eachother?

outer kettle
#

huh me???

earnest phoenix
#

ya

outer kettle
#

well ummm I can try bc I mean I haven't code in a long time

earnest phoenix
#

oh lol

pale light
#

this js?

earnest phoenix
#

discord.js yes

#

halp me plz

topaz fjord
#

@earnest phoenix learn js syntax pls

earnest phoenix
#

ok

#

lol

#

srry

#

i made my bot like a week ago so

undone plover
#

anyone know how to get the x and y of an image? please tag me

inner jewel
#

define "x and y"

deep parrot
#

it takes the bug part with it :/

inner jewel
#

substrings

topaz fjord
#

^

wicked tartan
#

best way to store server-specific configurations for a bot (like custom commands) just stick it in a json file?

glossy sand
#

the best way would be to use a database

#

but if your bot is small, you probably don't need that

wicked tartan
#

yeh it smol

glossy sand
#

then a json document is perfectly fine for the time being

wicked tartan
#

ok dope ty famsquad

earnest phoenix
#

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.

elder rapids
#

JSON file for storing data

#

🤢

glossy sand
#

for the time being

elder rapids
#

Regardless of everything else

#

pls db

wicked tartan
#

its just one variable per server and its in like 11 servers total

#

and I assume it won't be changed often

earnest phoenix
#

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 @_@

pale light
#

json is susceptible to corruption but sure

#

I wouldn't store it all in just one huge json

heady zinc
#

i wouldn't recommend json

#

what language do you use?

earnest phoenix
#

hmm.. any suggestions for better methods?

#

i use python primarily but i also know javascript

heady zinc
#

the bot is written in?

earnest phoenix
#

python

heady zinc
#

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 thonkku

#

or SQL but its a real pain to use

abstract mango
#

python can use rethinkdb, it has driver libs

#

idk though

#

I haven't used it

#

there's also sql libs for python

heady zinc
#

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

abstract mango
#

you've got:

  • asyncpg (recommended, for postgres ofc)
  • sqlite3 (built in, bit hard to use)
  • rethinkdb (yeah it's just rethink)
#

and others

#

probably

earnest phoenix
#

hmm i see

#

How would I go about making a command so the bots volume itself changes? Or is that not possible

heady zinc
#

its your bot, you should know about it Thonk

earnest phoenix
#

Not that

#

Like the actual volume slider

heady zinc
#

oh

#

no only users can change that

earnest phoenix
#

Ah

#

Ik that bots used to be able somehow

heady zinc
#

no?

earnest phoenix
#

Hmmmm

#

Fredboat

heady zinc
#

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

earnest phoenix
#

Hmm ok I get it

wicked tartan
#

how check if bot is mentioned

#

@ me

wicked tartan
#

Djs btw

pale light
#

if a bot is mentioned?

#

msg.mentions.users.first().bot should work

wicked tartan
#

Oh ok, is there a reasonable way to do it with isMentioned ?

pale light
#

not sure

junior lily
#

@wicked tartan Ah, do this

if (message.isMentioned(client.user)) {
//do something
}
wicked tartan
#

yeah I got it lol

#

ty tho

earnest phoenix
#

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

prime cliff
#

Yes you can still use it

earnest phoenix
#

Didn't want it to mess with anything, thanks 😛

#

I forgot I had request already defined 🤔

#

const reqquest = require('request');

#

Would that work?

#

🤔

heady zinc
#

why would you define it two times

earnest phoenix
#

Well

#

In the API it needs request

#

Just wondering

heady zinc
#

wat

earnest phoenix
heady zinc
#

lmao

earnest phoenix
#

😛

heady zinc
#

but yeah

earnest phoenix
#

I gotta get this done before I go to bed 😛 which I have 20 minutes

heady zinc
#

it would work

#

you can rename it to whatever you want

earnest phoenix
#

I thought so, but I thought it would break it for some odd reason 🤦

#

Best name

tawny lava
#

reqsouth

earnest phoenix
#

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

frigid juniper
#

I have a command displaying server count, what's wrong ? Do I need to display it on my website ?

weak parrot
#

No you need to post it to DBLs site

frigid juniper
#

What's DBL

#

Oh ok

weak parrot
#

Discord bot list

frigid juniper
#

but where ?

frigid juniper
#

But I dont understand how do I apply this

median isle
#

what lib is your bot in?

frigid juniper
#

Py

mighty barn
#

Server count basically shows your server count on DBL's website (Your bot page).

median isle
#

scroll to hugops example

#

should work

frigid juniper
#

Yes but do I need to put this code to my bot ?

median isle
#

yes

#

i put mine in on_ready, on_guild_join, and on_guild_remove

frigid juniper
#

Ah to update count everytime ?

median isle
#

mhm

mighty barn
#

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

frigid juniper
#

OK thanks a lot 😁

weak parrot
#

My bot posts once and that's when it starts up bloblul

frigid juniper
#

Lol

quasi marsh
#

Oof

#

Couldn’t you run it on set intervals?

#

Once every minute shouldn’t get to the rate limit afaik

earnest phoenix
#

If you post once a minute tonk will kill you

prime cliff
#

Isnt it 10 per minute

earnest phoenix
#

That's the ratelimit

#

One a minute is still excessive af

upbeat hemlock
#

Anyone have any Bot who can Welcome any Online user & chat with them???

earnest phoenix
#

Welcomer..?

mighty barn
#

Doesn't chat with them tho.

earnest phoenix
#

Oh

#

So a cleverbot bot

#

Hm

#

Matbot has cleverbot

heady zinc
#

as far as i remember best practice is still to post on guildadd and guildleave

#

any excessive growth still won't hit the ratelimit

mighty barn
#

The ratelimit is 10 per minute, right?

heady zinc
#

yeah

#

posting when the bot join or leave won't get you anywhere near that

mighty barn
#

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

heady zinc
#

wat

earnest phoenix
#

not posting periodically

heady zinc
#

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

austere meadow
#

i do it once every 30 minutes myself

earnest phoenix
#

@heady zinc That's once per hour

heady zinc
#

@earnest phoenix and?

earnest phoenix
#

posting ms

heady zinc
#

cuz its more meaningful

earnest phoenix
#

Then post pico seconds or something

heady zinc
#

you use ms in the code

earnest phoenix
#

I don't.

heady zinc
#

so why the heck

earnest phoenix
#

Don't use my code

heady zinc
#

making it human readable

#

by you i meant peoples

austere meadow
#

@restive silo sorry if im being annoying but do you know why the API is returning this?

earnest phoenix
#

what does your body look like?

restive silo
#

needs to be a json

austere meadow
#

im probably doing it wrong

#

first time using postman

#

sorry

restive silo
#

i actuall dont know i just used curl ablobsweats

earnest phoenix
#

i'd send raw json, its easier

austere meadow
#

alright

#

thanks for the help blobthumbsup

earnest phoenix
#

You need to send raw json

austere meadow
#

ah okay

#

alright got it working, thanks everyone blobsmilehappy

prime cliff
#

@earnest phoenix I wonder if that method ^ can bypass if you dont have nitro zoomeyes

restive silo
#

no

#

you get an Discord API Error

earnest phoenix
#

^

#

400

restive silo
#

yup

prime cliff
#

Wew LUL

mental geyser
#

can I have a calculator command code for discord.js plz

mighty barn
#

People wont mind giving you ideas on how to do it, but not give you any code

potent lily
#

If you want copy paste just clone a GitHub rep and you are done...

#

🤷

north fog
#

javascript

#

use eval()

earnest phoenix
#

@mental geyser Use eval

potent lily
#

Just eval(string) ?

earnest phoenix
#

Yes

uncut slate
#

oh boi.

restive silo
#

banne

mental geyser
#

?

severe socket
upper ember
#

how am I do such thing?

restive silo
#

if you mean the text style, css

earnest phoenix
#
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

pale light
#

where

#

pls crop code block

restive silo
#

and use syntax highlight

earnest phoenix
#

@restive silo how?

restive silo
unique star
#

also friendly reminder that rainbow roles are bannable

upper ember
unique star
#

grab the element hide it and :after to change it

upper ember
#

how? I am html/css dumb

unique star
#

google

#

no one is just gonna show you the code

#

¯_(ツ)_/¯

tame rivet
#

anyone here a python wizard?

earnest phoenix
#
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

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

earnest phoenix
#

x(

upper ember
#
#bot-details-page .lib {
    display: none;
}
#bot-details-page .lib:after {
    content: "text";
}
#

how do I fix that?

glossy sand
#

@tame rivet python sorcerer on duty

#

@upper ember you don't?

tame rivet
#

dw i added a try statement

#

also

glossy sand
#

:after is a child of its parent always

tame rivet
#

on a side note

#

actually nvm

glossy sand
#

ok lol

upper ember
#
}
#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?

glossy sand
#

what are you even trying to accomplish

upper ember
#

remove the discord.js and put my lib name

glossy sand
#

.......why

upper ember
#

this is the thing I get

glossy sand
#

you can set a custom lib you know

upper ember
#

and because I am not using discord.js.... and I don't want it to say otehr

#

other*

glossy sand
#

there's zero reason to do this

upper ember
#

what is the fastest way to replace the text of this shit?

glossy sand
#

to not do that

#

set a custom lib name if your lib isn't listed

upper ember
#

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"

glossy sand
#

uhh i recall there was same way around it

#

modifying the input element so you post a custom lib name...?

earnest phoenix
potent lily
#

@earnest phoenix You can do it for sure just find the way to do it good luck

earnest phoenix
#

Bro @potent lily can you help me plz

radiant basin
#

What about asking your question?

glossy sand
#

hello quick web dev question

radiant basin
#

Quick answer.

earnest phoenix
#

How to get youtube video duration?

glossy sand
#

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

earnest phoenix
#

@radiant basin \

glossy sand
#

errrr I think I solved my own problem

earnest phoenix
#

How to get youtube video duration?

glossy sand
#

rubber ducky debugging

#

@earnest phoenix you can use ytdl to query

earnest phoenix
#

Yes I'm using ytdl

#

But how to get duration

glossy sand
#

haaaaave you read the docs?

earnest phoenix
#

I tried contentDetails.duration but not working it is on at yt api Webpage

glossy sand
#

wait are you talking about the ytdl command line program

earnest phoenix
#

Yes

glossy sand
#

if you just read the docs, you would see this line

#
--get-duration                   Simulate, quiet but print video length
earnest phoenix
#

Why

#

Because you fucked up

glossy sand
pale light
#

lmao wrong chat

earnest phoenix
#

I need help

quiet bobcat
#

With?

earnest phoenix
#

THAT

#

omg

quiet bobcat
#

Send code?

earnest phoenix
#
    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;