#development

1 messages · Page 507 of 1

quartz kindle
#

it has a 2 level specificity

#

columns and bot-img

#

if you do just bot-img, it will get replaced by this

#

so bot-img has to be more specific

#

by naming the parents that it is in

#

to at least the same level

#

how to make it more specific?

#

if you want an ultra specific rule that overrides everything without fail

#

body .page .wrapper-page #details .container .columns .column .bot-img {}

#

Lol

#

understand? the more specific you are regarding parents and childen elements, the stronger specificity your rule has, and will override less specific rules

languid dragon
#

lel

mild lily
#

im setting up a daily command but i want it where they have to upvote the bot to claim how would i do that?

earnest phoenix
#

a small question
Somebody know how is to create a bot who pick the last topic and paste it in a channel, for example named "resources"?

languid dragon
#

@mild lily Set up a webhook and do it using that, check out the API docs and ask in #topgg-api for more information on that

#

@earnest phoenix What do you mean exactly?

earnest phoenix
#

(the link)

#

and paste it into a channel

#

specific

languid dragon
#

That's something you'd need to find using the documentation for the library you're using

earnest phoenix
#

.........

#

i can't find it

#
async def info(ctx, user: discord.Member):
    await bot.say("The users name is: {}".format(user.name))
    await bot.say("The users ID is: {}".format(user.id))
    await bot.say("The users status is: {}".format(user.status))
    await bot.say("The users highest role is: {}".format(user.top_role))
    await bot.say("The user joined at: {}".format(user.joined_at))```
#

how do i turn this into 1 text?

#

so I dont abuse the API

#

before or after?

tame tide
#

can any one help me out im making a bot with c#, i want to make a command to let the bot greet people but i dont know how and if i search for it i only find java script.

earnest phoenix
#

oh

#

then this doesnt help

#

i use python

#

oh

#

I still dont understand where to add \n

#

await bot.say("The users name is: {}".format(user.name))

#

thisis one line

tame tide
#

"Current commands that are added to the bot are: \n" +
"!Leroy_Jenkis \n" +
"!LeroyJenkisMemeVid");

earnest phoenix
#

where do I add it

tame tide
#

like this "Current commands that are added to the bot are: \n" +
"!Leroy_Jenkis \n" +
"!LeroyJenkisMemeVid");

#

that is how i did it

earnest phoenix
#

alright i'll try it out

#

ty

#

so one big line

#

ah alright thanks

rotund sierra
#

Can someone help me with this.? When a server joins, i want the server id to be recorded into an array.

#

No clue on how to do it.

quartz kindle
#

use the guild create event

torpid birch
#

hi, which version should I use to code a bot in python

quartz kindle
#

most people seem to recommend rewrite

torpid birch
#

I 've tried 3.7 but doesn't work

cursive dagger
#

@torpid birch 3.7 is not supported. 3.6.6 is the latest stable version

torpid birch
#

ty

#

which is best? code in python or javascript, kotlin?

#

to build a bot

quartz kindle
#

whatever you prefer

#

stick with the language you know best

raven torrent
#

If I use await asyncio.sleep(99999)

#

will my bot getting terminated for spamming discord api

earnest phoenix
#

how can i make it so if i type --testmode then whenever someone uses a command it says testmode enabled, commands are unavailable and they only work for me

mild lily
#

what is your bot code written in?

#

javascript c# or python?

#

@earnest phoenix

wooden shoal
#

well here's a global answer. For whatever language you are using, just google how to find text in a string. You can use that to find if --testmode is in the message. ex. (pseudo code)

message = "!test --testmode";
if (message.hasInside("--testmode")) {

}
earnest phoenix
#

@mild lily JavaScript

mild lily
#

what you could do is make a command and do like ```if(msg === ${prefix}TESTMODE){
testmode=true
}

and then on the bot.on message do
```if(msg.startsWith(prefix) && testmode === true){return message.channel.send('testmode is on the commands are unavailable for now' )}```
earnest phoenix
#

And That Will Definitely Work?

#

I mean, don't just copy it

#

Edit it to your specific needs and wants

#

duh

#

would this be okay

#

for the command part

#

Hastebin please 🙈

#

No, it won't work

#

No, it won't work

#

If you look, you can see testmode which is undefined

#

then how i make it work?

#

TBH I wouldn't even use this code

#

do u know any documentation that would show how to do this then

#

Save the variable to a JSON and check that in the command you want

topaz fjord
#

chaining ifs

prime cliff
#

Easy way to setup a test instance would be to add t to the prefix i have 4 bots that use w/ h/ s/ mc/ but if i run the test instance on my computer it goes to tw/ th/ you get the point kek

topaz fjord
#

You would either have to make the testmode var in the message event and use it in the commanf

#

Command

solemn linden
#

hm

mild quarry
earnest phoenix
#

...

#

Don't store information by username.

mild quarry
#

Well, sort the lines by the currency amount

#

Ok...

earnest phoenix
#

Make it into a SQL database then come back.

#

Text will break your bot, trust me.

#

How would I call this function?
http://prntscr.com/l9mn5i

I tried


const database = require('./index.js')

const table = new database("datatest01")

console.log(database)
console.log(table)```

but none of the functions are popping up
Lightshot

Captured with Lightshot

#

would I use db = (class) then DB.fetch()?

#

Because I'm getting this from that example code

#
[Function: DB]
DB { name: 'datatest01' }```
topaz fjord
#

does class DB have a constructor

earnest phoenix
#

Yeah it does

topaz fjord
#

I also need to see more code because that snippet doesn't help

earnest phoenix
#

There

#

thats all the code for the index file

topaz fjord
#

why is the constructor at the bottom

earnest phoenix
#

I put it there because I thought thats why the functions weren't showing up

#

It used to be at the top 😂

#

@topaz fjord you see anything wrong..?

topaz fjord
#

not much

#

nothing really

earnest phoenix
#

Where are those functions going GWfroggyBlobWokeThink

raven torrent
#

is there a way to get the main channel to create an invite link with ctx.message.server...

earnest phoenix
#

How do i print the server list the bot is in?

quartz kindle
#

loop over each server and print its name

earnest phoenix
#

@earnest phoenix Yes

warm marsh
#

So, How to code a discord bot?

#

I wanna use lisp

ruby dust
#

never heard of that before

warm marsh
#

Lisp, Is a language used in the world. Its an advancedish language

topaz fjord
#

go > *

warm marsh
#

Sorry?

#

I wanna stay

topaz fjord
#

golang

warm marsh
#

Oh

#

lmao

#

Well, im not the best coder so is there any languages that are fairly easy to code a discord bot in?

earnest phoenix
#

lisp looks old and gay lmao

warm marsh
#

Its old, like 50 years almost or more maybe

ruby dust
#

well first off you need a wrapper for discord, and considering how lisp is so unknown you have very little chances on discord bots with it

warm marsh
#

Ok, any language you suggest?

earnest phoenix
#

@warm marsh did you mean the programming language lisp?

ruby dust
#

I'm not joining any sides, use your own preference what you like the most

warm marsh
#

Yes

#

Lmao

west raptor
#

@warm marsh what languages do you know?

earnest phoenix
#

that shit old

warm marsh
#

not many

#

but i will learn myself

earnest phoenix
#

you can't make anything with that

warm marsh
#

i just wanna make a bot they look cool

#

Lisp is used for making ai

west raptor
#

(No bias) Javascript might be a good choice

warm marsh
#

Ok

#

i will have to google

ruby dust
#

tip: python and js have beginner-friendly wrappers, just so you know

west raptor
#

^

warm marsh
#

is there a library?

earnest phoenix
#

@warm marsh learn a programming language liie JavaScript or Python (mostly java)

warm marsh
#

i need

topaz fjord
#

@earnest phoenix by far the most enthusiastic person I've ever met lmao

warm marsh
#

I will use js for now

west raptor
#

discord.js or eris

ruby dust
#

there's discord.js lib

warm marsh
#

ok i will read up

ruby dust
#

gl

warm marsh
#

is there a way to get in here, or do you have to pay?

earnest phoenix
ruby dust
#

where?

topaz fjord
#

d.js and eris are free

#

wdym by get in here

west raptor
#
topaz fjord
#

they both require node.js

warm marsh
#

I mean bot in here

topaz fjord
#

oh

#

once you create your bot, you can add it to the site and wait for it to get verified

#

if it's verified then you get the role

#

no cost

warm marsh
#

oh ok

#

node you said?

topaz fjord
#

ye

ruby dust
#

you don't have to pay a website just to list your bot LUL

topaz fjord
#

I suggest you take some node.js courses because they will be pretty helpful when making a bot

warm marsh
#

ok

#

I just install that yes?

topaz fjord
#

ye

warm marsh
#

i can send photos?

#

Ok that website is what im on

#

I am just downloading it

#

I will learn js later as goto go now. but thanks for help! 😄

topaz fjord
#

np

#

👋

warm marsh
#

👋

lament ledge
#

Any idea for noobs?

bright spear
#

?

mild lily
#

👋

#

and Dilzster why does your profile show the code that will console.log x as 2 two times if true and console.log 1 if false

quartz kindle
#

it will always console log 2, then console log 1

#

because if(true) is always true, and the let x doesnt replace the previous one

raven torrent
#

question

#

for embed things

#

for the clickable text

#

it's like this: [Text](website here)

#

right?

quartz kindle
#

i believe so yes

bright spear
#

yes it is

rotund sierra
#

Is there a way to get a server id that the bot has been kicked from?

west raptor
#

No

#

Afaik

sick cloud
#

if you log guild joins/leaves

#

you can make it show the id

rotund sierra
#

Well i made an array that saves all server id

#

but idk how to compare it when it gets kicked

sick cloud
#

do you have permission from the guild owners to store those

#

also just use the guildRemove event or whatever it is

rotund sierra
#

Is this the one you're talking about?

#

Client_LeftGuild
private async Task Client_LeftGuild(SocketGuild arg)
{

    }
sick cloud
#

i guess, i use js not python

#

but yeah

rotund sierra
#

Its c#

sick cloud
#

oh lol

rotund sierra
#

xD

sick cloud
#

well if you get the guild property there then your good

rotund sierra
#

alright ill try it out

sick cloud
#

anybody able to try explain why my leaderboard isn't working?

#
        const users = await msg.client.r.table('users');
        const user = await msg.client.r.table('users').get(msg.author.id);

        const top = users.sort((a, b) => a.current - b.current).splice(0, 10);
        
        const embed = new MessageEmbed()
        .setTitle(`Bread Leaderboard`)
        .setDescription(`Showing the top 10 users with the most bread globally.\n\n${top.map(u => (top.indexOf(u) == 0 ? '![goldenBread](https://cdn.discordapp.com/emojis/504454287061942302.webp?size=128 "goldenBread")' : '🍞' + ` #${top.indexOf(u) + 1} with \\🍞${u.current}`)).join('\n')}`)
        .setFooter(`You are #${users.indexOf(user) + 1} on the leaderboard.`)

        return msg.channel.send({ embed: embed });
#

it's providing them out of order and adding a blank field

quartz kindle
#

what is the content of users and user?

sick cloud
#

users is an array of all user objects in the db

#

user is the object for the msg author

#

and thats the user objects

quartz kindle
#

this part is one of the problems ${top.map(u => (top.indexOf(u) == 0 ? ':goldenBread:' : '🍞' + #${top.indexOf(u) + 1} with \🍞${u.current})).join('\n')}

#

you're checking if index == 0, and if it does, print golden bread emoji, else print the emoji + the rest

#

you dont need that check, just do top.indexOf(u)+1

#

as for the sort, if the order is inverted, just swap a and b

sick cloud
#

ohh

kind nexus
#

Yo guys, I already have the performed role established, but how would I get the bot to search for everyone that has that specific role and remove the role from them?

kind nexus
#

I'm in C#

earnest phoenix
#

i have a music bot and it works on my windows pc fine but when i try to run it on a ubuntu machine it doesnt work

#

anyone?

quartz kindle
#

errors?

steep wagon
#

How do i make a bot?

lean tinsel
#

how can i run my bot 24/7?

fluid basin
#

like I said you would need a server or a PC that can be left on and connected to the internet 24/7

lean tinsel
#

or host it online?

fluid basin
#

host it online?

#

I assume you meant servers

lean tinsel
#

like buy servers

#

online

#

so i dont have them at my home

fluid basin
#

yeah you can buy servers online and they will keep your bot running 24/7

lean tinsel
#

yea

fluid basin
#

there are some good and relatively cheap ones in the pinned messages of this channel

lean tinsel
#

any ideas?

fluid basin
#

you can take a look at those

earnest phoenix
#

Can somebody tell me why do I get a error that says Error: Cannot find module ‘discord.js’. Please help me

#

I have discord.js installed already but that still show up

mossy vine
#

@earnest phoenix make sure to run npm i discord.js in your project folder

visual zenith
#

keeps on getting 👇
/opt/watcher/app-types/node/start.sh: line 43: 4265 Killed
and 👇

(node:2658) UnhandledPromiseRejectionWarning: Error: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (/rbd/pnpm-volume/5085597d-a62b-4ab0-a7db-b53a0e8be772/node_modules/.registry.npmjs.org/@jimp/core/0.5.4/node_modules/@jimp/core/dist/utils/image-bitmap.js:108:15)
    at Jimp.parseBitmap (/rbd/pnpm-volume/5085597d-a62b-4ab0-a7db-b53a0e8be772/node_modules/.registry.npmjs.org/@jimp/core/0.5.4/node_modules/@jimp/core/dist/index.js:498:32)
    at /rbd/pnpm-volume/5085597d-a62b-4ab0-a7db-b53a0e8be772/node_modules/.registry.npmjs.org/@jimp/core/0.5.4/node_modules/@jimp/core/dist/index.js:440:15
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
(node:2658) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2658) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
``` someone please help me
earnest phoenix
#

Could not find MIME for Buffer <null>

#

jimp cant figure out what to do / what file type ur giving it

#

because ur giving it null data

visual zenith
#

do u need the source code to tell me what is returning as null ? @earnest phoenix

#

becuz i can just give it to u now

visual zenith
#

anyone?

lament meteor
#

hi

#

what coding lang

#

make a function

#

that wont work

#

it isnt returning anything

#
function booltostr(bool) {
let returnthis = ''
if (bool === true) returnthis = 'yes'
if (bool === false) returnthis = 'no'
return returnthis
}```
#

something like that should work

#

no prob @earnest phoenix

earnest phoenix
#

bool ? 'yes' : 'no'

languid dragon
#

why did you bold everything

#

:^)

coral trellis
#

So it looks clearer uhm

languid dragon
#

maybe

earnest phoenix
#

Hi, how would I tell whether a user has actually voted for my bot when they do >vote so I can give them some currency?

#

It's for a friend

#

Why doesn't your friend ask 🤔

#

Cos he has a thing against asking for help

#

Idk y though

#

Can u help?

#

@earnest phoenix "they" can always use the api

#

Link?

#

Thanks

topaz path
#
Bot.on(`message`, async message => {
    if(message.content === Prefix + "shutdown") { 
  if (message.author.id === "336127427443032068") {

How would I make other people be allowed to use the command?

earnest phoenix
#

but if you remove it entirely, then anyone can use it

#

if ([ ids ].indexOf(message.author.id) > -1) { ... }

topaz path
#

Okay thanks.

knotty steeple
#

what process manager thing can i use for node.js apps

#

besides pm2 because thats broken af for me

#

and i already tried forever i fucking hate it

earnest phoenix
#

[ ...ids ]

#

soooooo

#

ids

lean tinsel
#

who is the dev of @rough quest ?

coral trellis
#

-owners @rough quest

gilded plankBOT
amber junco
#

hello?

#

So my bot cant send non jpg ulr`s

#

is there a command or a way to let your bot send non jpg s

#

also I cant find an image that is jpg

quartz kindle
#

what do you mean?

#

you should be able to send any format, png, gif, webp, etc..

amber junco
#

No

#

I added a link form google and a website @quartz kindle

#

And it give a blank

#

I tried the link out on google and it WORKS!

gilded gazelle
#

how do i do something like this on my bot's page

amber junco
#

@gilded gazelle A lot of HTML, a lot

gilded gazelle
#

nvm lol

#

i'm dumb i forgot about iframes

abstract crystal
#

@coral trellis you have a fan uwu

coral trellis
tribal dagger
#

@gilded gazelle html tables and js if wanted.

abstract crystal
#

you can only add js if you have a certified bot

lean tinsel
#

anyone that can make me a bot? please dm me 😄

manic badger
#

@gilded gazelle ... use wix.com, it actually works

#

mods

#

im not advertising

gilded gazelle
#

lol

#

i feel like if i use wix it's like kinda being lazy and i want to play with html lol

strange spear
#

bhi

mild lily
#

im trying to make a system like there is a chance for something to spawn and you can fight it or run. i got the spawn down but the thing is the run part and the fight part will only take action if you the thing spawned from the message you sent so if you send the message hi and the thing spawned you would not be able to do anything but if it spawned from the message ;run or ;fight then the command will run how can i fix that?

earnest phoenix
#

What does
Error: socket hang up mean?

#

It keeps crashing my bot every 5 minutes

ruby dust
#

without context, it means that the socket hang up

earnest phoenix
#

How do I fix I

#

It

#

Even if I use pm2 to restart auto it still crashes

ruby dust
#

still no context provided

earnest phoenix
#
Error: socket hang up
    at createHangUpError (_http_client.js:322:15)
    at TLSSocket.socketOnEnd (_http_client.js:425:23)
    at TLSSocket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1092:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)```
trim saddle
#

uwu eval 15 + 2

untold cloak
#

I’m not sure if this is the right place to put it but - I got denied bc apparently my token was leaked? But I don’t know how, when my code is privately hosted and I’m not sure where the token got leaked at or how to even fix it. Can someone assist or guide me somehow?

earnest phoenix
#

:C

trim saddle
#

uwu ping

#

thecc

earnest phoenix
#

@untold cloak where do you host/put your code?

ruby dust
#

u sure bots can chat here?

earnest phoenix
#

any websites

trim saddle
#

oof

#

i uhh

earnest phoenix
#

no bots can

trim saddle
#

@ruby dust i was never here

untold cloak
#

It’s hosted on pythonanywhere

earnest phoenix
#

link

#

and ill check

untold cloak
#

Link to my code? Gimme a sec I gotta pull it up on my computer bc the website on mobile is awful

earnest phoenix
#

well if you've put it on any websites link me the page

#

.

#

@untold cloak

untold cloak
#

Sorry I’m in class but I actually think I might have figured it out sorry for bothering you 😅

wide ruin
#

Just a quick one

#

In discord.js

#

message.mentions(...

#

Do you use an id?

#

Just need it to check if the bot is mentioned

latent willow
#

@wide ruin
i did it like that dunno if its good practice though

const prefixMention = new RegExp(`^<@!?${client.user.id}>`);

// and later in the code when you get a message
if ( message.content.match(prefixMention) )
wide ruin
#

Is there a way to just get a Boolean

earnest phoenix
#

.test regex method

#

regex.test(str)

wide ruin
#

regex.test(<@bot id>)?

neat falcon
#

hello qts i got a qt problemo:

what im trying to do: update the now playing thing every so seconds after grabbing the json data
what works: window.onload, works like a charm
what doesn't work: set timeout, does nothing.

my code:

window.onload = function qtqt(){
    let client = new HttpClient();
    client.get('http://ip/getSongData', function(res) { //this works gucci
        let obj = JSON.parse(res);
        document.getElementById("nowPlaying").textContent = obj.message.nowPlaying;
    });
}

setTimeout(function(){
    let client = new HttpClient();
    client.get('http://ip/getSongData', function(res) { 
        let obj = JSON.parse(res);
        document.getElementById("nowPlaying").textContent = obj.message.nowPlaying;
    });
}, 15e3);```
wide ruin
#

No codebox. Strange

neat falcon
#

w0T

wide ruin
#

There is no code box on the code

neat falcon
#

my code?

wide ruin
#

Yes

neat falcon
#

appears for me

wide ruin
neat falcon
#

o

#

i'll hastebin link

wide ruin
#

So where is the mention bit?

neat falcon
#

wdym

#

i don't get what question is this

#

im gonna go back to lurking and see if i can fix my shit

wide ruin
#

Ok

#

Oh wait

#

I get it now

#

Ignore me.......

earnest phoenix
#

setTimeout will only go once, so u need setInterval for updating more than once @neat falcon

neat falcon
#

yeah just realised that

earnest phoenix
#

any error in console of browser dev tools?

neat falcon
#

nope

#

gonna test interval now

wide ruin
#

@earnest phoenix regex isn't defined

earnest phoenix
#

unlucky

wide ruin
#

What do I define it as?

neat falcon
#

OWO IT WORKS

earnest phoenix
#

👌

neat falcon
#

arigato qts im a weeb coder DabBear

warm marsh
#

hey i require help

#

i have started coding a discord bot in js. I dont really know any languages i just started js today

#

So can someone tell me if this is correct?

#
const discord = requrie('discord.js');
const client = new discord.Client();
const cfg = require('./config.json');
const prefix = ".";

client.on('ready', async () => {
    console.log("Logged in as %s", client.user.tag);
});

client.on('message', async message => {
    var args = String.prototpe.slice.call(message.content, prefix.length).trim().split(' ');
    var command = Array.prototype.shift.call(args).toLowerCase();

    if (command == "ping")
        return message.channel.send("Pong!");


});

client.on(cfg.token).catch(e => console.log("Invalid Token"));```
#

because when i try use ping command it not work

topaz fjord
#

try logging command and seeing what it comes out as

warm marsh
#

i noticed an error

#

bot wasnt online

topaz fjord
#

👀

warm marsh
#

i have client.on instead of client.login

#

at bottom

topaz fjord
#

ye

warm marsh
#

ok bot come online

#

i will try command

topaz fjord
#

ok

warm marsh
#

it not work, i followed video correctly

#

but it doesnt work

#

ok it worked

#

How to make external commands?

#

i heard it on video

earnest phoenix
#

well

#

fixed.. changed from default allocation of memory to 8GB

earnest phoenix
#

how can i add make a timer so when a command is run, if they run it again it says how much time until they can again? i have the response set up, just dont know how to get the timer

#

Can anyone help? I need some sorta bot where players in my server can write some info about themselves and the bot will store them and a command to post them.

As i'm looking to create a Fortnite Free Agent server and this will be useful as players can find info about each other easier for example my info would be !info Steady#1586 then it would show their stats, achievements etc

earnest phoenix
#

guys im big nub
how do i do this
store the time when they did a cmd store the time they should wait such as 6000 = 6s you then check the stored date subtract it by today's date - the cooldown

#

and have it so if they run the cmd it says how much time is left

warm marsh
#

What?

#

in simple english?

#

@earnest phoenix

earnest phoenix
#

that is simple english but okay, i want a timer on a command and if they run it twice under the timer it says how long is left for the timer, in minutes and seconds

warm marsh
#

Oh ok

#

What language?

earnest phoenix
#

JS

warm marsh
#

discord.js?

earnest phoenix
#

yup

warm marsh
#

give me a second and i will try help you. i am not the best as i just started

earnest phoenix
#

ok

warm marsh
#

Im sorry im not the best, i will try as fast as i can

earnest phoenix
#

oke

#

xd

patent dust
#

Help meeeee

#

TypeError: command.run is not a function

#
    try {
        console.log(cmd);

        delete require.cache[require.resolve(`./Commands/${cmd}.js`)];

        let command = require(`./Commands/${cmd}.js`);
        command.run(client, message, args, ops, eEmb);

    } catch(e) {
        console.log(e.stack);
    }```
earnest phoenix
#

command.run is not a function

#

error is in the error

#

you've done soemthing wrong with the code thats why

patent dust
#

BUT

#

what

#

🤔

earnest phoenix
#

it doesn't exist

#

you cannot do that

patent dust
#

it exists

#

becuase I defined it in the previous line

#

🤔

#

and ive done exactly the same in a previous bot

earnest phoenix
#

you defined a file

#

I mean, check if it's defined?

patent dust
#

Yeah

#

And the file is there

earnest phoenix
#

But the error seems to say that it isn't defined

west raptor
#

You deleted the command out of the cache?

patent dust
#

yeah

earnest phoenix
#

@warm marsh u get anywhere with the timer thing

warm marsh
#

yeah almost done

earnest phoenix
#

oke

warm marsh
#

ok done

#

@earnest phoenix

earnest phoenix
#

o

#

l

#

k*

#

dm it

warm marsh
#

ok

steel heath
#

Anyone here using d.js master?

west raptor
#

ye i use it

steel heath
#

whats up with .addRole()? its not working anymore and idk whats the updated one of it

#

cant find it

west raptor
#

@steel heath

steel heath
#

ah thanks

west raptor
#

yw

steel heath
#

going to update my code from 11.3 to master, tonight will be hard i need someone

west raptor
#

Okay

steel heath
#

how do you get presence game's name now

west raptor
steel heath
#

thanks

west raptor
#

yw

earnest phoenix
west raptor
#
var to = ms(cooldown - (Date.now() - lastBump));
let timeString = `${to.hours} : ${to.minutes} : ${to.seconds}`;``` where exactly are you geting `hours`, `minutes` and `seconds` from?
earnest phoenix
#

@warm marsh

west raptor
#

Ah so you were spoonfeed

earnest phoenix
#

no

west raptor
#

Yes

earnest phoenix
#

no

warm marsh
#

Im not good coder

earnest phoenix
#

he just helped

warm marsh
#

but hours are coming from to variable

west raptor
#

@warm marsh It's fine, at least you made it

#

Also

#

how?

warm marsh
#

ms is a variable up top which is a module called parse-ms

west raptor
#

Try logging to

warm marsh
#

and it turns a millisecond time and formats it so get hours seconds and mins

west raptor
#

It might be undefined

warm marsh
#

yeah worked fine when i did it

quartz kindle
#

just console.log(to)

warm marsh
#

module

quartz kindle
#

that way you can see whats wrong

earnest phoenix
#

ayy fixed it

#

i was using ms instead of parse-ms

warm marsh
#

oh you dont have the var at top named ms

drowsy wedge
#

hello, i am trying to make a discord.js bot with a command that can send a random file. code:

    if (message.content.toUpperCase() === `${prefix}RAND`) {
      const path = 'C:/<my path here>';
      const fs = require('fs');

      fs.readdirSync(path).forEach(file => {
          ranfile = Math.floor(Math.random()*file.length);
          message.channel.send(ranfile);
      })

      return;
 }```
however, when i run this and enter the command, it sends random numbers, and the amount of messages is based on how much files are in the folder it seems. does anyone know how to solve this?
warm marsh
#

Em

#

Remove sync first

drowsy wedge
#

ok GWseremePeepoThink

wheat marten
#

Could somebody tell me how I upload my bot to glitch?

warm marsh
#

Dont

#

Discord bans glitch ips

#

use heroku

drowsy wedge
#

alright removed and did the command, got this error:

                      ^

TypeError: Cannot read property 'forEach' of undefined```
wheat marten
#

but heroku costs

drowsy wedge
#

does it?

#

i thought it doesn't GWchadMEGATHINK

warm marsh
#

no

#

its free but you get cons

#

like sleeps 1 hour per day

#

limited space

#

and so on

drowsy wedge
#

so i removed the sync

earnest phoenix
#

why does this not work for me

.addField("Server Name: `" + `${message.guild.name}` + "` \nServer Members " + `${message.users.size}` + "` Channels: `" + `${message.channels.size}` + "`")
quartz kindle
#

@drowsy wedge first of all, you shouldnt read an entire folder like that

#

you should read it once when the bot starts for example

#

and save the list in a variable

warm marsh
#

xD

#

.size

#

and users

earnest phoenix
#

@drowsy wedge make sure the folder has something in it, i had that prob before

#

ok, but why does it now show up still

drowsy wedge
#

ye, it does, and alright

quartz kindle
#

then you get a random file name/path from the list you already have in memory

wheat marten
#

So I signed up for heroku what do I do next?

quartz kindle
#

then you need to actually upload the file to discord, to send it

#

in that code you're just sending the random number, not the actual file

warm marsh
#

that link

inner jewel
#

heroku can only handle really small bots btw

#

and don't even think of running music bots on it

earnest phoenix
#

@warm marsh why does this not work, it should, its in the code we where doing, the other embed parts work

.addField("Server Name: `" + `${message.guild.name}` + "` \nServer Members " + `${message.users.size}` + "` Channels: `" + `${message.channels.size}` + "`")
drowsy wedge
#

sendFile?

inner jewel
#
`${message.guild.name}` ``` is the same as just `message.guild.name`
#

no need to add interpolation for that

earnest phoenix
#

yes, i like it that way, that still would not stop it from working

wheat marten
#

so I should not use Heroku?

earnest phoenix
#

i use heroku for @heavy thistle

inner jewel
#

also

#

message.channels.size message.users.size

#

a) messages don't have channels
b) messages don't have users

drowsy wedge
#

same

earnest phoenix
#

how do i make it so it send the certain members from a server into another server then

#

nvm ignore that

inner jewel
#

you need to get the guild object

earnest phoenix
#

still no idea why it isnt showing in the embed

inner jewel
#

because that code throws

warm marsh
#

rich embed

earnest phoenix
#

ok i fixed code errors, why is it still not working GWsocksAngeryBob

#

it should work now

#
            message.channel.createInvite({ maxAge: 0 }).then(invite => {
                let bumpSend = new Discord.RichEmbed()
                    .setAuthor("New Bumped Server")
                    .addDescription("Server Name: `" + `${client.guild.name}` + "` \nServer Members " + `${client.users.size}` + "` Channels: `" + `${client.channels.size}` + "`")
                    .setColor("RANDOM")
                    .setFooter(footer)
                client.channels.get('504747695794290700').send(bumpSend);
                client.channels.get('504747695794290700').send(`${invite}`)
            });
#

still not working..

quartz kindle
#

you're not getting the server members and channels, you're getting ALL members and ALL channels of all servers combined lol

earnest phoenix
#

ffs

quartz kindle
#

also, you dont have any guild specified

earnest phoenix
#

but would that be why its not showing up in embed?

#

wym no guild specified

warm marsh
#

no

quartz kindle
#

you're creating an invite, then passing the invite on, but you're not passing anything to define which guild you're working on

warm marsh
#

That doesnt matter

earnest phoenix
#

it works

warm marsh
#

hes not even sending the embed

earnest phoenix
#

The embed sends u stoopid people

#

it works, its just the embed field that doesnt show

quartz kindle
#

if you're working on the same guild where you're getting the message from, then get information from the message

#

also, you dont need send(${invite})

#

just do send(invite) lol

steel heath
quartz kindle
#

and as Natan said, using + together with ${} defeats the whole purpose of ${} even existing

#

sure you can, it says there you can

steel heath
#

i mean, it goes png for all, i want it to be gif if picture is animated and do not want to be webp

quartz kindle
#

hmm idk then

#

is there a way to check if its animated or not?

inner jewel
#

if the hash starts with a_ it's animated

steel heath
#

i want to fast check it

west raptor
#

What's the recommended messageCacheMaxSize and messageCacheLifetime?

#

For discord.js

bright spear
#

probably the defaults

west raptor
#

okay

ruby dust
#

5000 sounds like a too big number for Max messages in d.py imo

#

Also that's the default value

quartz kindle
#

default should be 0, unless needed

#

i dont see why such high default values for bots that wont ever need to fetch past messages

restive silo
#

in d.js default is 200 per channel whats still a bit high so i would go with what Tim said

quartz kindle
#

does d.js have any way of handling user cache?

#

or eris?

#

afaik it still caches users as they come online, and doesnt uncache them

keen drift
#

Not really, but there are several PRs/issues open for them

#

The only thing now is wait for v12 and see what's implemented

restive silo
#

you can uncache them yourself tho

#

its not like thats not possible

#

you can clear/sweep them

keen drift
#

Yeah just unsure what the rest of the lib behavior is without them cached

restive silo
#

well for members atleast thats not a problem since i fetch them anyway if not there

#

so i clear members which didn't send a message in the last 30 min

#

same for emojis

keen drift
#

there's a PR regarding disabling store, so I'm waiting for some of that

restive silo
#

i c

quartz kindle
#

whats the proper way to clear user cache?

keen drift
#

Iterate, check whatever condition and delete from collection

#

there's no built in sweeper like the message store

restive silo
#

@keen drift there is Thonk Client#users is a UserStore what extend Store and Store has a sweep method

#

like messages

keen drift
#

Yeah that could serve as a wrapper for removing

#

but I'm more specifically talking about the sweeper builtin for messages (set max sizes, duration, sweep interval)

quartz kindle
#

so one could do client.users.sweep(options)?

keen drift
#

sweep takes fn

#

it's basically an iterator

quartz kindle
#

ah i see

#

could sweep if user is offline for example

keen drift
#

Yeah iirc, that's only if you enable presenceupdate in your events, can't remember

quartz kindle
#

no but you could use set interval to sweep offline users by matching their status in the sweep fn no?

keen drift
#

Yes, that's the theory

quartz kindle
#

yeah so an interval of 30-60 min or something

keen drift
#

But for people with presence disabled, it might not be possible

quartz kindle
#

if presence is disabled it doesnt show up in the user collection either?

keen drift
#

nvm just ignore it

restive silo
#

enable presence and then sweep it aswell afterwords

keen drift
#

you don't need to worry about it if you didn't disable it manually

restive silo
#

ez fix

earnest phoenix
#

any cheap vps recommend?

keen drift
#

hmmmmmmmmmmmmmm

#

what have you tried so far

earnest phoenix
#

i only tried skysilk

#

but its a bit laggy atm

quartz kindle
#

galaxygate seems to be the most recommended around here

#

im on google gce though

keen drift
#

o yike

earnest phoenix
#

is it like $5 a month?

quartz kindle
#

they have 3$ and 5$

earnest phoenix
#

hmmm

quartz kindle
#

and more of course

keen drift
#

where is galaxygate located?

earnest phoenix
#

should i do $3

#

a month

drowsy yew
#

heck

#

I need to get my bot online

keen drift
#

h e c k

drowsy yew
#

But I don't have my laptop

keen drift
#

that's fun

drowsy yew
#

So I can only use VS

keen drift
#

huh

drowsy yew
#

Virtual Studio

earnest phoenix
#

cuz i only have 100$ in my debit card XD

keen drift
#

@quartz kindle ay, where is galaxygate located

earnest phoenix
#

should i change

quartz kindle
#

idk, US i think

#

how big is your bot Nut?

keen drift
#

o yikes, no looking glass

earnest phoenix
#

284 servers

keen drift
#

yeah that's more than sufficient

quartz kindle
#

the $3 should be enough

keen drift
#

infact, this one would also work, and may be cheaper

drowsy yew
#

Anybody know the code to get bots online?

quartz kindle
#

im on google free tier, 600mb ram, and my bot runs nice on 400 servers

earnest phoenix
#

with $100 it will last me 2 years right?

#

XD

keen drift
earnest phoenix
#

that or galaxygate?

keen drift
#

@quartz kindle wait what, google free tier has 600mb for ram?

#

w h e r e

quartz kindle
#

@drowsy yew you need to code a bot, or you just want it to be online and do nothing?

#

yes, 600mb ram

earnest phoenix
#

free teir?

drowsy yew
#

Online

keen drift
#

link me

drowsy yew
#

I can do the code tommo

keen drift
#

about to use the 600mb to host a file directory for myself

drowsy yew
#

I just need it online atm, so I can insert the first few commands @quartz kindle

keen drift
#

insert commands

#

what

drowsy yew
#

The help command.

keen drift
#

what help command

drowsy yew
#

the one almost every bot has

keen drift
#

But you don't even have a bot?

drowsy yew
#

I do

#

Im coding it

earnest phoenix
#

ok?

keen drift
#

now i'm really confused on the request

drowsy yew
#

But I'm trying to get it online

earnest phoenix
#

what do you want?

#

ahhh

drowsy yew
#

I need to get it online

keen drift
#

so spin it up?

#

do you not know how to start your own bot

earnest phoenix
#

client.login(token);

#

XD

#

thats how you get it online

keen drift
quartz kindle
drowsy yew
#

the main problem is

#

Im not on my computer

earnest phoenix
#

how much does it cost?

drowsy yew
#

And theres only like one software on this laptop

quartz kindle
#

the software you use doesnt matter

#

where is your bot code gonna be?

drowsy yew
#

Virtual Studio

earnest phoenix
#

tim is it only for 12 months?

keen drift
#

vscode is only an editor, fyi

quartz kindle
#

if you make it in your laptop, it will only work while your laptop is on, until you transfer it to another machine

drowsy yew
#

Oh.

#

I have a USB injected anyways

keen drift
#

@quartz kindle is the 1GB of egress enough for you?

quartz kindle
#

nope

keen drift
#

So do you get charged extra

earnest phoenix
#

wait how much does it cost?

keen drift
#

the free tier is free

#

but it's quite low spec

quartz kindle
#

you get 12 months + 300 usd credit to get started

keen drift
#

So you are just using the 300 usd credit?

quartz kindle
#

but the micro F1 server is always free

inner jewel
#

GCP has a forever free tier ^

keen drift
#

not the actual free compute tier

quartz kindle
#

and im using the 300 credit for egress yes

keen drift
#

alright yeah

#

I was like, no way 1gb is enough

drowsy yew
#

What I'm mainly asking, is what code gets it online.

quartz kindle
#

it costs me like 1$ a month in egress fees

earnest phoenix
#

im using skysilk $1 a month vps, its meh

keen drift
#

@drowsy yew well you didn't even tell us what language, what framework you would be using, nor what steps you have taken to get it online

quartz kindle
#

^

#

which programming language are you using?

drowsy yew
#

C# I think

#

Brb

keen drift
#

kek

#

i think

earnest phoenix
#

lul

quartz kindle
#

do you even know how to use it? :^)

earnest phoenix
#

im looking to buy a vps

#

but

keen drift
#

Try Hetzner I linked

#

It's in Europe

earnest phoenix
#

how much does it cost?

quartz kindle
#

how much ram/hd is hetzner?

earnest phoenix
#

rip

#

im in canda

inner jewel
#

isn't hetzner still voice banned from discord

earnest phoenix
#

XD

keen drift
#

But it's like $3 for 1vCPU and 2GB of ram

quartz kindle
#

oh wow

keen drift
#

20GB of ssd & 20TB traffic

earnest phoenix
#

im trying to find one close to me

keen drift
#

I have my bot in Europe because latency on my bot doesn't matter

#

it still gets around 100ms ping

earnest phoenix
#

should i get this?

keen drift
#

if it works for you

#

there's also OVH btw

#

that's in Canada

earnest phoenix
#

hmmm

keen drift
#

they have US DC, but that's expensive

quartz kindle
#

hetzner looks nice

earnest phoenix
#

4.49 a month

keen drift
#

I love Hetzner because of their auctions

#

Cheap server auctions, quite affordable

earnest phoenix
#

is there any like $3< cuz im broke XD

keen drift
#

lmao

earnest phoenix
#

only 100$ in my debit card

#

XD

keen drift
#

yeah not really

drowsy yew
#

Back

keen drift
#

Hosting a bot is bound to cost money

earnest phoenix
#

no

#

i got it for free

drowsy yew
#

Im too lazy to do it now, so I'll do it when I get my computer back.. lol.

earnest phoenix
#

by working at a hosting company

#

lmfao

keen drift
#

gimme discount

earnest phoenix
#

XD

keen drift
earnest phoenix
#

same

#

i dont work there anymore

#

lmfao

keen drift
#

l a m e

earnest phoenix
#

rip

#

nnn

quartz kindle
#

@earnest phoenix if you're tight on money, go for google gce

earnest phoenix
#

alright

quartz kindle
#

im on it for almost a year and didnt spend a single cent

earnest phoenix
#

really?

quartz kindle
#

and still have like 280 left from the free credit

earnest phoenix
#

isnt the vps you use like virtual machine?

quartz kindle
#

yeah, its a vps

keen drift
#

Patrons support my bot's cost, so I'm good

earnest phoenix
#

i mean

#

umm

#

with like a windows os

#

and interface

keen drift
#

wind0ws

#

i nt e r f a ce

#

w h a t

quartz kindle
#

well, you can install windows on it, but its not recommended

earnest phoenix
#

ahh

keen drift
#

isn't there a yearly license fee

quartz kindle
#

vps are best using linux

keen drift
#

there's also aws

#

free tier for a year

earnest phoenix
#

after the year how much does it cost?

keen drift
#

too much

quartz kindle
#

lmao

keen drift
#

so I'd ditch after that year

earnest phoenix
#

XD

quartz kindle
#

just go for google, i havent had any problems with it so far

keen drift
#

alternative solution: buy a pi

#

home host

quartz kindle
#

depends

#

only if you live in 1st world country and have fiber connection

earnest phoenix
#

XD

quartz kindle
#

and have your parents pay the electicity bill

#

xD

earnest phoenix
#

no chance

#

didnt rythme use galaxygate?

quartz kindle
#

yes

earnest phoenix
#

but doesnt use anymore

#

?

keen drift
#

what does rythm use now

quartz kindle
#

they changed?

earnest phoenix
#

yea

quartz kindle
#

@drowsy yew again, to get the bot online you need to know a programming language and install a discord library

earnest phoenix
#

^^^^

drowsy yew
#

I know

#

Im going to do it tomorrow instead

#

I'm way too lazy, and I'm tired.

quartz kindle
#

alright

earnest phoenix
#

rip im using this atm

quartz kindle
#

thats the cheapest you can probably get

#

unless you go for a free tier

earnest phoenix
#

i got the beta discount

#

so i pay 0.75

#

XD

quartz kindle
#

nice

earnest phoenix
#

If anyone really needs free hosting, they can share my low powered vps.

keen drift
#

@earnest phoenix owo, link me that

earnest phoenix
#

XD

#

depends the specs

keen drift
#

i need that $1

#

I'ma use for some small work

earnest phoenix
#

it lags abit but its ok if you broke af

keen drift
#

i'm not broke froggyjerry

#

but I just need cheap vm to host a directory

#

which should consume like 10mb of ram at max

earnest phoenix
#

can you use my ref link? if you want to use it?

#

XD

keen drift
#

sure

earnest phoenix
#

thats the website

keen drift
#

let's see

earnest phoenix
#

it itsnt that great

#

but works

#

😄

keen drift
#

oh wait a minute

#

I have a beta account

earnest phoenix
#

then you will get a discount

#

use that account instead

#

its a 20% discount

keen drift
#

how much is 500 skypoints worth

earnest phoenix
#

5$

#

i just need people to use my ref link cuz it gives me $25 and i can use that to pay for the host, but also gives the person 10$ im pretty sure

dapper fiber
#

Hey Nut

earnest phoenix
#

yea?

#

oh blaze

#

hello

wheat marten
#

What happens if my bot is offline when they're testing it???

earnest phoenix
#

deny

#

!

#

your bot gets rejected

#

lmao

#

why are you sending that?

#

lMaO

#

LmAo?!

keen drift
#

sweet, 75 cents small vm

#

actually lost my ssh key, so I had to reimport into gpg then re export and convert

wheat marten
#

I am hosting my bot with heroku right now

#

once I get more bot users i'll make a switch

#

Wait could I host my bot with firebase?

keen drift
#

i'd assume firebase has compute units

bright spear
#

@wheat marten not with the free firebase version

wheat marten
#

What is a good service to host my bot with?

#

That is free

bright spear
#

glitch or maybe heroku

wheat marten
#

Glitch was blocked by discord

bright spear
#

not anymore

wheat marten
#

??

bright spear
#

that was only for a few days

wheat marten
#

Why

quartz kindle
#

google gce is free

wheat marten
#

It costs

fluid basin
#

glitch works fine, maybe only that one or two IPs that are blocked, just depends on luck tbh

#

if its blocked just create a new one ¯_(ツ)_/¯

bright spear
#

If you somehow get a blocked IP iirc they'll move the project to a different one if you ask them

ruby talon
#

phelp

opal arch
#

Does anyone have an idea why a bot would send a message twice? It happens randomly on a server channel but never in a dm.

astral quail
#

Can you show me your code?

#

and what lib are you using?

opal arch
#

discord.js. Should I post it here or on pastebin?

astral quail
#

pastebin.

earnest phoenix
#

I don't have permissions to edit the url https://discordbots.org/api/bots/493045795445276682/check?userId=?

#

the JSON

#

Because I'd want to change the "voted" from 1 to 0, after they've comfirmed voting, as a check

bitter sundial
#

yeah you can't change stuff on our servers

tawdry anchor
#

How can I certify my bot?

#

Okay. Thanks.

#

Just to prepare. What are main requirements, any idea?

ruby dust
#

100 servers, 20 total upvotes, posting server count to API, post a widget for your bot somewhere visible (github is enough)

#

that's the basic minimal reqs

coral trellis
#

Requirements are being changed for the new Cert program but those were the previous requirements

earnest phoenix
#

does anyone know how to put an embed json thing in a config file

#

nvm i figured it out

ivory cobalt
#

Is there a way you can allow a webhook to use custom emojis?

tawdry anchor
lament meteor
#

@ivory cobalt not sure but u may just be able to use the emojis that is provided by discord. not sure but it is possible to allow emojis in the guild

manic badger
#

Yeet, just made my working eval command!!!!!

tawdry anchor
#

If I will certify my bot, then My account will be certified automatically or how it works?

earnest phoenix
#

quick question

#

i am hacking a code

#

and

#

i need help[

#

i need something that can read this

#

because notepad cant do it

astral quail
#

hacking code or skidding code?

earnest phoenix
#

hacking in my term of editing code

#

that isnt meant to be edited by the person who created it

earnest phoenix
#

all good guys

#

figured it out

shell blade
#

How do I change a role's permission in a channel using Discord.js?

warm marsh
#

@shell blade

shell blade
#

I tried using that but just got errors.

lost scarab
bitter sundial
#

and do you have more information on what is not working

lost scarab
#

return is outside of function

bitter sundial
#

that's the error?

lost scarab
#

yep

bitter sundial
#

this is not the whole file, right

summer escarp
#

Can someone make me a custom bot fit for some needs

earnest phoenix
#

Don't think you should be soliciting bot services here

late hill
#

If you give me robux, it's a deal.

summer escarp
#

Ok @late hill

late hill
#

Oh

earnest phoenix
#

i would trade you a discord bot of your liking for some united states cash

late hill
#

thonkku n

gray obsidian
#

what are the requeriments for certificate a bot? Cause I want to get ready for november

drowsy yew
#

Heck

#

I need help

#

Im using JS

#

Im trying to make my bot reply when somebody says "Hello"

#

But it wont

#

After everything I tried

west raptor
#

Your if statement is wrong

drowsy yew
#

Oh

#

What about it do I fix?

west raptor
#

Do you see it?

#

oh

#

uhm

drowsy yew
#

It's 2 =='s right?

west raptor
#

yes

#

or

#

wait

#

just ===

#

either works

drowsy yew
#

Ok

#

Thanks

#

Still wont work

quartz kindle
#

to help making it clear: = means you assign a value to it, == means you compare a value to it in a non-strict manner (for example "0" with 0), === means you compare a value to it in a strict manner (both values must be the same type)

drowsy yew
#

So what about it do I fix?

quartz kindle
#

did you change = to === and it still doesnt work?

#

make sure your bot can see the channel. you can do console.log(message.content) right before your if to see if your bot is receiving the messages