#development

1 messages · Page 606 of 1

earnest phoenix
#

no

#

100.000 is 100

late hill
#

What if you want the value 120000.5

earnest phoenix
late hill
#

Yes in that example

#

But if number is already a decimal

earnest phoenix
#

he just say 120

#

nice

late hill
#

Your solution won't be right

earnest phoenix
#

because its a decimal

#

if you get to millions e.g

#

1,000,000 and replace it with dots it will become 1.000.000 which is an invalid decimal

#

stop using invalid logic and read what we say

late hill
#

oof that too

earnest phoenix
#

oh yeah

#

its best to do offspring checking

divide by a million, if it returns 1 or above its a million, apply M to the returned number
otherwise divide by a thousand, if it returns 1 or above its a thousand, apply K to the returned number

#

there is probably a way to do this with regex too but writing regex is pain and suffer

late hill
#

I'd probably put the characters in an array like ["k", "m", "b", "..."]
And then loop through them or something
Could use Math.pow() in there to use thousand/million/..

#

I mean if you rly only want k and m, just hardcoding that would probs be faster 🤷

earnest phoenix
mossy vine
#

"pussy grabber"

quartz kindle
#

since we're doing these

#

lul

slim heart
#

Nerd

dull bobcat
#

@jolly zephyr

slim heart
#

@jolly zephyr

rocky gyro
#

mee6 sucks

slim heart
#

Nou

lilac geyser
#

bots can have animated avatar right?

rocky gyro
#

well tell me one thing mee6 does better than any other bot x)

#

should be allowed ye, bots have nitro by default

lilac geyser
#

but why are bots with animated avatars so rare Thonk

mossy vine
#

because they abuse a bug

slender thistle
#

@lilac geyser They can, but that is against Discord ToS etc

lilac geyser
#

wait thats against discord tos Thonk

#

wait can anyone actually show me the document/anything that states that that is not allowed?

earnest phoenix
#

It's common sense

quartz kindle
#

bots dont have nitro afaik

rocky gyro
#

they have

quartz kindle
#

bots have "some nitro features"

#

but its not full nitro

rocky gyro
#

ye true

#

not really full nitro but major features

lilac geyser
#

why is that common sense lol

earnest phoenix
#

Abusing exploits/bugs

#

It's pretty common sense

slender thistle
#

Bots are not supposed to have gif avatars

lilac geyser
#

so i can report bots with animated avatar?

earnest phoenix
#

I guess

slender thistle
#

Pretty much correct

quartz kindle
#

repawted

earnest phoenix
#

Doubt Discord would care about it tbh

slender thistle
#

Wepowted

earnest phoenix
#

But they're not supposed to have gif avatars

lilac geyser
#

oh

slender thistle
#

Bots only have external and animated emojis feature from Nitro, that's it

mossy vine
#

regular users can get animated avatars by abusing this bug

earnest phoenix
#

Yep

#

the way discord handles that format is buggy throught the entire app

lilac geyser
#

wait what

#

whats this bug...? making use of png?

queen prism
#

,

carmine echo
#

Quite a weird question, really. Would it be API abuse if I were to send a message in a channel every 5 minutes? I can't be bothered to set up a database because I literally just want to store one number, so I was thinking of using a channel as a database

lilac geyser
#

no one cares lol?

#

and i would suppose no

earnest phoenix
#

Nope

carmine echo
#

imagine if bots had access to notes

#

this

#

store user data

#

lol

earnest phoenix
#

Oh no

carmine echo
#

It'd be unreliable, yes but it'd honestly be a very easy way to store data

earnest phoenix
#

Indeed

lilac geyser
#

if you fetch notes they will be on memory

#

imagine your whole database on memory

carmine echo
#

persistent though

mossy vine
#

actually no

#

notes are kept

earnest phoenix
#

🤔

mossy vine
#

variables arent

carmine echo
#

how often can I fetch messages in one channel?

#

and how often can I edit a message?

#

5 minutes should be ok, right?

mossy vine
#

it should be, yeh

carmine echo
#

who even needs a database when you can use a channel?!

#

/s

earnest phoenix
#

Duh

mossy vine
#

actually

#

3 years ago someone did just that

carmine echo
#

lol

abstract quarry
#

Does anyone know why it doesn't work?

#

It wont start it

mossy vine
#

whats the error its saying @abstract quarry

abstract quarry
#

it doesn't want to run

mossy vine
#

there is a red line in your code

#

hover over it, and tell me what it says

abstract quarry
#

is it normal?

mossy vine
#

there is a red line in your code
hover over it, and tell me what it says

abstract quarry
#

this?

mossy vine
#

well as it says

#

you must first define the type in its own file

mossy vine
#

i dont even know where to begin with that

grim aspen
#

the hell am i looking at

#

html? @mossy vine

mossy vine
#

xml

grim aspen
#

oh

buoyant wagon
#

porn.xml on the top

mossy vine
#

in an unknown file??

#

with everything being broken??

#

and a typo in the project name??

grim aspen
#

oml

mossy vine
#

and Main.java broken??,

grim aspen
#

i just noticed the porn.xml

buoyant wagon
#

what is the problem

mossy vine
#

its pom

#

not porn

earnest phoenix
#

this is a pom.xml

grim aspen
#

dissapointment.png

mossy vine
#

everything seems broken

#

@earnest phoenix did you write that code?

earnest phoenix
#

no

#

wait a minute

#

I have it from zekroTJA @mossy vine

viral spade
#

Guys i have a strange problem. I use discord js and pm2 on my digitalocean ubuntu vps. Sometimes, (i think after getting an error+ pm2 restart) the bot starts to send messages twice, thrice,.. / two, three,.. bots are running and have the same server on them. The bot is sharded but only running on 1 shard with 1k guilds. What can it be?

restive needle
#

r!

#

r!s

#

r!yardım

#

@red arch

unkempt juniper
#

Guys, how can I get the votes count of my bot using discord.js? I have tried dlb.getVotest().size / .length but it doesn't really work 😅

mossy vine
#

its promise based

unkempt juniper
#

Ok, this show a number

        let votes;
        dbl.getVotes().then(v => {
            votes = v.length;
        });```
But it's bigger than my votes count =/
idle basalt
#

thats not how you write asynchronous code

#

votes will be undefined outside of the .then() callback

#

this could be what youre looking for: const votes = await dbl.getVotes().then(v => v.length)

short portal
#

how do i find out if something is in an array?

if (list.contain("id"))```
quartz kindle
#

.includes

#

or .indexOf

short portal
#

i have tried indexof

uncut magnet
#

filter

quartz kindle
#

includes returns true or false

#

indexof returns the position index, or -1 if not found

frigid juniper
#

Hey, I got a little question for discord.py and python in general. I have a command and I would like to have 2 args but not mandatory : I could write +a, +a arg1 or even +a arg1 arg2 where arg2 would be a mention.

async def a(ctx, *args, *member):
#

How can I do that here ? with 2 mandatory args ?

short portal
#

none of the stuff worked

idle basalt
#

arr.includes('value') will return true or false

#

arr.indexOf('value') will return position or -1

#

exactly as tim said

#

these will both work

#

can you show us what you tried and what the error or unexpected behavior was?

slender thistle
#

@frigid juniper = None for arg to make it optional

#

You can't have two args like *arg btw

idle basalt
#

wish i knew python so i could help more people lol

frigid juniper
#

I know this was a question xD

#

And what do you mean @slender thistle by None ?

#

I've tried something else now but i wonder else

slender thistle
#

arg = None, if arg was not specified, it will be None

frigid juniper
#

Oh yeah like that

#

Maybe it will fail with error handler but idk

frail terrace
#

how can i redact my bot token in git but keep the token in my project?

amber fractal
#

Git ignore, private repos, store it in a different file

idle basalt
#

make a config file (i recommend .env) and put it into your .gitignore file

#

then your bot can use the token from the hidden file but it will be ignored by git and will not be pushed up to your repo

hushed berry
#

generally, it's a bad practice to store configurable data in source code

unreal rampart
#

how does self.client.send_file() work, i cant get it working, i have tried with just the file name, and doing picture = open("example_picture.png", "r")

unique nimbus
#

Is example_picture in the main directory?

unreal rampart
#

yes

#

and this is my error message

unique nimbus
#

Unauthorised

#

Oof

unreal rampart
#

what does that mean?

unique nimbus
#

It's for that url which is unauthorised

#

Idk tbh I just get the url and set it as image

slender thistle
#

Open it in rb mode

unreal rampart
#

get the url and set it as image?

#

@slender thistle you are a legend

slender thistle
#

I would suggest using context manager or at least close()ing your picture variable later :p

vast bay
#

Hi how do i start ?

#

Hi how do i start ?

fiery birch
#

Start what

vast bay
#

I just installed the bot he do i begin

fiery birch
#

Excuse me what?

vast bay
#

How do i start and sellect pokemon?

fiery birch
#

Uhm.

#

What bot is it?

vast bay
#

The command or something

#

Pokecord i think

fiery birch
#

Ok, go to their support server then

#

And this is not development talk, so go to #general

vast bay
#

This is it i just came from there web

#

Can u give me invite link to there serevr

#

Plss

fiery birch
#

No it isn't, go to their page and press Join Support Server

#

No

vast bay
#

Dammm..mthx for the help mcbitch!

dusky marsh
#

Lmao wtf

fiery birch
#

idk how to respond

slender thistle
#

No need, they left

fiery birch
#

thanks @languid dragon

languid dragon
#

you're welcome?

#

OH LOL

fiery birch
#

LMFAO

languid dragon
earnest phoenix
#

mcbitch in mcdonalds eating mcfood

spring wharf
#

Does anyone know what this is actually called (where you have : then another class)

#

Oh, wait nvm its inheritance

#

plus I just realized that's not even what I want to do

unreal rampart
slender thistle
prime cliff
#

@spring wharf do you mean the <>

spring wharf
#

No, I figured it out

#

it is the inheritance

west spoke
#

Hah that pin

#

Good one

slender thistle
fiery stream
#

yo

#

anyone here

hushed berry
#

hi jazz

fiery stream
#

hi

#

@hushed berry can u answer my question

#

?

hushed berry
#

have you even asked a question

fiery stream
#

its simple i should now the answer but

#

do u know the library to generate onetime login token

#

for passport

hushed berry
#

i have no idea what passport is

fiery stream
#

really...

grim aspen
#

like a passport to go out of country?

fiery stream
#

really.. 😂

#

google passport.js

grim aspen
#

i was going to say that might be illegal

amber fractal
#

It's for easy OAuth2

fiery stream
#

no i want to do one time login strategy with that

amber fractal
#

it has something for discord aswell

#

Yes

#

OAuth2

fiery stream
#

not for discord

amber fractal
#

I know

fiery stream
#

u can use it where ever u want

amber fractal
#

I'm saying it has something for discord too

earnest phoenix
#

JWT?

fiery stream
#

JWT?

earnest phoenix
#

google it

#

json web access token

#

it's what many services use today

fiery stream
#

googling

lofty hamlet
#

Hi

#
            message.member.removeRole("502550139693563906").catch(console.error);
            message.member.removeRole("502549651560464395").catch(console.error);
            message.member.removeRole("502550385874173982").catch(console.error);
            message.member.removeRole("502550526538416138").catch(console.error);
            message.member.removeRole("502550706163679233").catch(console.error);
            message.member.removeRole("502550787566600222").catch(console.error);
            message.member.removeRole("502550865639505950").catch(console.error);
            message.member.removeRole("502550943112495105").catch(console.error);```
#

My console send : Role nor a snowflake

fiery stream
#

i used passport auth2 for my discord and passport google for my other proj now i need it to make a photo vault using it

#

so people can login to there vault using one time code

#

@earnest phoenix

earnest phoenix
#

🤷

fiery stream
#

yo

#
opts.issuer = 'accounts.examplesoft.com';
opts.audience = 'yoursite.net';```
#

what email do i need here?

mystic shell
#

ok so i want my bot to be always on, could i just do that with online website hosting?

dusky marsh
#

do you have an error event

#

client.on('error', () => console.error)

#

God Im tired

#

That was the third edit lol

#

Np

#

@mystic shell look at the pins in this channel

#

It has a list of webhosts

mystic shell
#

i can't afford any of those, besides i think i found one that might work (heliohost.org), it has a git repository section, would that be what i need?

dusky marsh
#

You just need something that host your bot which if it can take the code from a git repo and run it, then that'll do

tropic cobalt
#

I have free vps hoster

#

If you want '

mystic shell
#

holy shit that would be great, thank you so much

bright spear
#

u could just use glitch

#

or heroku (ew)

amber fractal
#

Both are equally bad

idle basalt
#

heroku > glitch but theyre both not very good

mystic shell
#

oh wait ive used glitch before

idle basalt
#

i use heroku to host small projects that dont require local storage

mystic shell
#

ok i think i got it, i used repl.it to write my code originally and then i just put the link to run the code into uptimerobot

real portal
#

@idle basalt heroku is ok, but u use free version or other?

#

I use free but I have monthly limit of hours and if bot is not used he has turn off

#

I think that hobby version

slender thistle
#

Limit of hours never mattered for me

#

My bot kept running even when my limit was reached

lament meteor
#

when i used heruko same tbh. the free miners is wried

earnest phoenix
#

or... woah heres a crazy idea, dont use free hosting 😲

idle basalt
#

i use the free version but i just linked a credit card to get 1000 hours

#

thats more than enough for my small crap

slender thistle
#

Nah Imma use my Glitch script that connects to Heroku

#

And all that with public token on GitHub

lament meteor
#

isn't local host ++?

slender thistle
#

Host it twice

#

On Heroku, Glitch and locally

earnest phoenix
#

Heya I want to make my dashboard. I know css / html little but I dont know how I can make it connected with Discord, oauth and other stuff

uncut magnet
#

so funny 😉

#

so i hate turkey

#

you must use ejs / vuejs / others

idle basalt
#

what?

mossy vine
#

Yeah, rendering templates might be usefil but you dont need them

uncut magnet
#

i answer to toasty

idle basalt
#

you dont need any of that stuff 🤔

mossy vine
#

^

uncut magnet
#

yes

#

so i sad others

#

he should use post / get but very hard (long time)

mossy vine
#

You need to set up a webserver that can communicate with your bot, and make the webserver handle the oauth, and requests from the user of the dashboard

earnest phoenix
#

to create something like mee6 has, simply html and css alone won't be enough

mossy vine
#

Html and css is just the frontend

viral spade
#

Guys i have a strange problem. Anyone with discordjs sharding+pm2 knowledge please help!

I use discord js and pm2 on my vps. After getting a crash+ pm2 restart) the bot then sends messages twice/ two bots are running and have the same servers on them.
Even when i do pm2 restart bot the second bot stays alive. Only rebooting will kill it or killing it by process id.
I am using a ecosystem file for pm2, in which i have the option "treekill" activated.
What can it be??

earnest phoenix
#

not even that, you'll have to learn some js frameworks like react or vue due to the complex design of the bot

uncut magnet
#

if you should use rendering templates you can make it easily but if you want use purejs and post/get methods good luck

trail dagger
#

Someone help me setup the API for server count? Discord.py

#

Client is not definded

#

i already tried a few things

magic smelt
slender thistle
#

Don't name your files dbl @trail dagger

trail dagger
#

what should i name it too?

lofty hamlet
#
            message.member.removeRole("502550139693563906").catch(console.error);
            message.member.removeRole("502549651560464395").catch(console.error);
            message.member.removeRole("502550385874173982").catch(console.error);
            message.member.removeRole("502550526538416138").catch(console.error);
            message.member.removeRole("502550706163679233").catch(console.error);
            message.member.removeRole("502550787566600222").catch(console.error);
            message.member.removeRole("502550865639505950").catch(console.error);
            message.member.removeRole("502550943112495105").catch(console.error);```
#

My console send : Role nor a snowflake

slender thistle
#

@trail dagger anything but dbl

trail dagger
#

i did change it

slender thistle
#

Still the same error?

trail dagger
#

no i got this

slender thistle
#

Ah, good old errors

#

I would advice using my fork of dblpy but its docs are a no-go atm

#

Send an HTTP request yourself

pallid zinc
uncut magnet
#

var x = await Client.generateInvite()

#

console.log(x)

#

delete it

#

mustn't share your token

#

delete it

pallid zinc
#

sorry

uncut magnet
#

remove token and resend it

pallid zinc
#
    console.log(`Logged in ${Client.user.tag}\nLink invite: ${await Client.generateInvite()}`)
})```
#

my code

#

thinking its right

uncut magnet
#
Client.login('token').then(async () => {
    var x = await Client.generateInvite()
    console.log(`Logged in ${Client.user.tag}\nLink invite: ${x}`)
})
#

alternative

#
Client.on("ready" () => {
    var x = await Client.generateInvite()
    console.log(`Logged in ${Client.user.tag}\nLink invite: ${x}`)
})
#

if bot login to Discord, ready function works

steel heath
#

how do you install discord.js master now?

pallid zinc
#

why

earnest phoenix
#

what why

late hill
#

Did you regen your token @pallid zinc

#

and those cool kids with client mods that see deleted messages can also get it 9448_fingergun

pallid zinc
#

yup i regen

#

its like i cant add my bot in the server

sinful lotus
#

@steel heath npm i discordjs/discord.js

steel heath
#

thanks

earnest phoenix
#

@coral trellis | @modern sable ^

modern sable
real portal
#

@idle basalt your code is xd

#

(I have 8 votes)

#
bot.on('message', async message => {
    if (message.author.bot) return;
    if (message.content === `${prefix}dev`) {
        const votes = await dbl.getVotes().then(v => v.length);
        message.channel.send(`votes: ${votes}`);
    };
});
#

or maybe to I'm an idiot

#

how this works?

pallid zinc
#

btw

#

    let Activity = [
        `I'm so Dank`,
        `Created by GOD`,
        `${prefix}help • for help`,
        `On ${bot.guilds.size} servers`,
        `~${bot.users.size} user can use me`
    ]
    let ActivityType = [
        "LISTENING",
        "WATCHING"
    ]

   
    bot.user.setActivity(Activity[Math.floor(Math.random() * Activity.length)], {
        type: ActivityType[Math.floor(Math.random() * ActivityType.length)]
    })

    setTimeout(() => {
        BotUserActiviy()
    }, 10 * 1000);
}
#

no err in console

#

but not working

late hill
#

Are you calling the function?

#

Also maybe use setInterval for intervals instead of a reoccuring timeout 👀

gleaming tulip
#

calling the function inside the function

#

also that's considered too quick on discord's api

#

changing the bot's activity every 10 seconds

pallid zinc
#

Hmm

#

Wesley make sence

earnest phoenix
#
        if ctx.message.author.bot:
            pass
        if not ctx.message.author.bot: ```
#

😮

sinful lotus
#

I dont see why you want your bot to have its status change fast

#

not it makes it annoying to use, it also spams discord api

earnest phoenix
#

who u mean?

sinful lotus
#

the god guy

earnest phoenix
#

ah

slender thistle
#

Niko, what is that

earnest phoenix
#

python for blocking other bots response

slender thistle
#

Are you sure that's what you want/need to post/use

#

It's return

#

Not pass

#

pass continues the function, return stops it

earnest phoenix
#

mhh thank you 🤔
i think always it was pass for ignore it

#

have change it now to return

slender thistle
earnest phoenix
#

oh do you use python, too?

slender thistle
#

Yes

earnest phoenix
#

can you help me than with one thing?
i want to show how many members are bots. how i do this?

slender thistle
#

List comprehension with an if checking if member.bot is True

#

while iterating through server.members

earnest phoenix
#

bots = list(member for member in server.members if str(member.bot == True))
this like?

slender thistle
#

Could just do [] instead of list()

#

Also, nope

#

No need for that str

#

(Use is for comparing to True, False and None)

earnest phoenix
#

i use async.
i have try it with is and become a syntax fail in this line

slender thistle
#

Show me what you got there

earnest phoenix
#

thats my list for role perms. it works lol

       l = list(permi for permi, value in role.permissions if str(value)== 'True')```
slender thistle
earnest phoenix
#
        l = list(permi for permi, value in role.permissions if str(value)== 'True')
        i = '\n📍 '.join(l)```
#

the last to make the better format. without the (,)

slender thistle
#

Can you show me the error you get when using the bot members list thing

real portal
#

how to delete party of string in all elements of the array?

const array = [
    "el1.a",
    "el2.a"
]
//how to remove ".a"?
earnest phoenix
#

bad request

#

😮

#

@slender thistle can i invite you to my coding server? than i can show you that

slender thistle
#

In DMs

earnest phoenix
#

sure.

#
how to delete party of string in all elements of the array?
const array = [
    "el1.a",
    "el2.a"
]
//how to remove ".a"?```

use ``.forEach`` and modify each string in the foreach
carmine echo
earnest phoenix
#

use max-height

carmine echo
#

I need it to be responsive, very responsive

earnest phoenix
#

which css framework do you use

carmine echo
#

materializecss

earnest phoenix
#

i suggest not

carmine echo
earnest phoenix
#

materialize is very buggy

#

it's not exactly something to use in production

#

i abandoned it for material ui on react

#

although react is a SPA js framework it has amazing libraries for design, i use https://material-ui.com/ which is basically materialize but actually works

carmine echo
#

That's not the point, I just need 2 divs to have the same height.

#

view-source:https://antiowo.xyz

earnest phoenix
#

sorry, can't help with materialize, it's very buggy

carmine echo
#

although material ui looks very cool

abstract quarry
#

How to use the code box in discord?

carmine echo
#

```language
code()
```

abstract quarry
#

thanks

carmine echo
#

for example

function foo() {}

```js
function foo() {}
```

real portal
#
const directoryPath = path.join(__dirname, 'commands');
fs.readdir(directoryPath, function (err, files) {
    if (err) return console.log('Unable to scan directory: ' + err);
    files.forEach(file => {
        const filenames = file.slice(0,file.length -3);
        const filesarr = [];
        filesarr.push(filenames);
        console.log(filesarr);
        bot.on('message', message => {
          if (message.author.bot) return;
          if (message.content === `${prefix}help2`) {
            const embed = new Discord.RichEmbed()
            .setDescription(filesarr)
            message.channel.send(embed)
          }
        })
    });
});

why this code return all array elements in other message?
I'm blind and don't see this

#

please help me -,-

#

:C

late hill
#

First of all

#

That code adds a message listener for every file in your commands folder

#

Which you shouldn't do 👀

#

That code doesn't even make sense at all

#

What are you trying to do

real portal
#

I trying write names of my files in directory in message

late hill
#

Do you have a message listener for each command 👀

sinful lotus
#

that code is so leak prone

#

that it will not survive 1 hour

late hill
#

^^

#

Your code should only have 1 bot.on('message', message => {

#

If that's not the case, please fix that first

sinful lotus
#

you can have 2 depending on your implementation

#

but usually its 1

late hill
#

In his case 1 would do

#

@real portal I'm pretty sure there's guides for discord.js command handler implementations

#

You should check those out probably

sinful lotus
#

tbh you would be better off learning node.js basics first, it will save you a lot of hassle for future

#

node.js basics !== Javascript Basics

molten kelp
#

Sigh

lean swan
#

How i use the vote api?

slender thistle
#

Webhooks or sending requests to the API?

lean swan
#

Request to api

#

Like check if user vote for this bot before use this command

slender thistle
lean swan
#

Oh

#

Ok!

#

Thank

earnest phoenix
#

in Java (JDA), when I do:

    public void onGuildMessageReceived(GuildMessageReceivedEvent e){

        String[] args = e.getMessage().getContentRaw().split(" ");

        if (args[0].equalsIgnoreCase("hello")){

            e.getChannel().sendMessage("Hello you =)").queue();

        }


    }```
The Bot spam Hello you =). Someone can help me to know why ?
#

you're splitting the entire message by a space, then detecting if the first word is hello, while you're sending a message Hello you which starts with hello, making the message received event loop

#

Oh okk, how can i solve this ?

#

if the bot replies to itself, what do you think you have to do?

#

create a codition who verifie if the author of the message isn't a bot ?

#

correct

#

simply check if the author is a bot

#

if it is you can return out of the method

#

ohh my GAAWWDD it works

trail dagger
uncut magnet
#

eh my opinion is margin top be less

#

emm my english

#

example 12 to 10

real portal
#

@trail dagger u make page in vanilla html/css/js?

trail dagger
#

html and css

fiery birch
#

o its gone

#

nice one

trail dagger
#

Nice save

real portal
#

I don't know what about you speak

fiery birch
real portal
#

@trail dagger so.. u must have some time to do this ;>

trail dagger
#

Yea

lofty hamlet
#
            message.member.removeRole("502550139693563906").catch(console.error);
            message.member.removeRole("502549651560464395").catch(console.error);
            message.member.removeRole("502550385874173982").catch(console.error);
            message.member.removeRole("502550526538416138").catch(console.error);
            message.member.removeRole("502550706163679233").catch(console.error);
            message.member.removeRole("502550787566600222").catch(console.error);
            message.member.removeRole("502550865639505950").catch(console.error);
            message.member.removeRole("502550943112495105").catch(console.error);```

My console send : `Role nor a snowflake`
earnest phoenix
#

how did you get the role ids

ruby dust
#

can't you just remove every role at once? this seems like an api spam

earnest phoenix
#

you cant

#

there isnt an endpoint

ruby dust
steel heath
#
const role = <guild>.roles.get("502550943112495105")
message.member.removeRole(role).catch(() => { // I'd say don't log that });```
earnest phoenix
#

it just loops the remove role method

mossy vine
#

what eggsy said

lofty hamlet
#

Just how i can remove the console log

ruby dust
#

interesting, because I tried it myself by looking at the user's roles, they were all simultaneously removed/added

#

discord.py doesn't even have a way for single roles

#

it's either add_roles or remove_roles

earnest phoenix
#

how many roles at once

ruby dust
#

many, I tried with 13

earnest phoenix
#

🤷

mossy vine
#

d.js also has <GuildMember>.removeRoles()

ruby dust
#

so it can

mossy vine
ruby dust
#

what he does is api spam, a lib wouldn't be encouraging it

earnest phoenix
#

wait nvm you can add many roles at once

#

my b

lofty hamlet
#

Just how i can remove the console log plz 😢 bloblul

fiery birch
#

delete the line that logs it to the console mmLol

ruby dust
#

you start by not removing each role individually, that's spamming

#

use removeRoles instead

lofty hamlet
#

?-?

#

Everything just works that my console spam of: Role nor a snowflake

ruby dust
#

you are spamming discord by removing 9 roles really fast, that's really unnecessary

lofty hamlet
#

For me it's nessecary how i can ?

mossy vine
#

mate

#

do you read

#

i sent you a link to the docs

#

that documentates the function

#

you need to use

lofty hamlet
#

No all

#

Re send ? /LUL

#

Plz

ruby dust
#

just scroll up?

#

discord doesn't purge messages for a reason

earnest phoenix
#

Someone know how to heberg bot on Heroku when we use JDA API ?

spring ember
#

heberg?

earnest phoenix
#

Has anyone found a way to be able to get a bot to DM the owner of the guilds its in when you make updates because atm i have it under a *updates command and when i make changes etc or have to put offline for a short period of time i have noway of informing the guilds owners? also on my *botinfo command i cnt seem to add how many guilds its in

spring ember
#

@earnest phoenix don't do that

#

Or your bot will be kicked

late hill
#

Preferably use your support server for things like this

#

If you feel like it's very important, try to bind it to commonly used commands on your bot

#

People who really care will most likely join your support server

spring ember
#

@lofty hamlet what

#

Did you mean to send a message to a random member to add your bot?

earnest phoenix
#

@spring ember hosts*

spring ember
#

What do you mean has your bot

#

Well yes it is the send method

earnest phoenix
#

i want to host my bot

spring ember
#

Don't forget to await

earnest phoenix
#

free of charge

#

So i have to use Heroku

spring ember
#

Note: This is a list of hosting, not a backing/support for them. You will need to make your own decision.

  • OVH: https://www.ovh.com/us/vps/
    Starting at $3.35/month (USD), 2GB RAM and 10GB storage, high reliability.
  • Digital Ocean: https://m.do.co/
    Starting at $5/month (USD), 1GB RAM and 25GB storage, high reliability.
  • Linode: https://www.linode.com/
    Starting at $5/month (USD), 1GB RAM and 20GB storage.
  • Vultr: https://www.vultr.com/
    Starting at $2.5/month (USD), 512MB RAM and 20GB storage, plan only available on certain regions.
  • Amazon(AWS) Lightsail: https://amazonlightsail.com/
    Starting at $5/month (USD) (first month free), 512MB RAM and 20GB storage, high reliability.
  • Time4VPS: https://www.time4vps.eu/
    Starting at €2.99/month (billed every 4 months for €11.96/quarter), 512MB RAM and 20GB storage, free backups.
  • VIRMACH: http://virmach.com/
    Starting at $1/month (USD), 192MB RAM and 10GB storage, free DDoS protection, 1 CPU core.
  • VPSDime.com https://vpsdime.com/
    Starting at $7/month (USD), 4 CPU Cores, 6GB RAM, 30GB SSD Storage, 2TB Traffic and 10 Gbps Uplink
  • Servercheap https://servercheap.net/
    Starting at $4.50/month (USD), 2 CPU Cores, 2GB RAM, 30GB SSD Storage, Unmetered Bandiwdth
  • Scaleway https://www.scaleway.com/
    Starting at €2.99/month (Euro), 2 CPU Cores, 2GB RAM, 50GB SSD Storage
unique nimbus
#

I use scale way epicly

spring ember
#

This was taken from the pins

earnest phoenix
#

"free of charge"

unique nimbus
#

It's 3 euros

#

A month

earnest phoenix
#

Heroku is free

real portal
#

@earnest phoenix heroku is cool for small bot

spring ember
#

@earnest phoenix free of charge are not reliable

earnest phoenix
#

my bot is small

spring ember
#

And they are not designed for bots

earnest phoenix
#

dude

unique nimbus
#

We don't recommend free vps

real portal
#

so it's great idea to use heroku

spring ember
#

They frequently shut down bots

#

And restart them

earnest phoenix
#

I saw a video where the man host his bot on Heroku

spring ember
#

You should read on how dynos work before

earnest phoenix
#

@unique nimbus ik

unique nimbus
#

Walox do you have another pc at home

earnest phoenix
#

yh but i won't LH

spring ember
unique nimbus
#

Host it at home

#

Very free

earnest phoenix
#

i won't localhost

real portal
#

xd

#

it's veryy free

earnest phoenix
#

i'll read that ty dondish

unique nimbus
#

You literally just need to run the bot that's it

earnest phoenix
#

I know but

spring ember
#

No gateway should ever reside on Heroku

#

Heroku is for micro services

earnest phoenix
#

my bot is a micro service :p

real portal
#

he want to host small bot

unique nimbus
#

My bot is small

#

I got scaleway

#

35 servers its in and barely uses storage its fine

earnest phoenix
#

lol

#

scaleway ?

unique nimbus
#

vps

#

Yes

#

However we all got opinions and we all are saying free vps has a catch

real portal
#

why he must pay to host small bot if he can host on free heroku? xd

unique nimbus
#

Have you read the tos of Heroku?

real portal
#

I use heroku

unique nimbus
#

What about all the other agreements

#

Which you agreed

earnest phoenix
#

I'm no going to waste 1$ for a f-bot wich say "good morning" when user write "hi"

unique nimbus
#

Ofc not

#

Read tos always goos

#

Good

real portal
#

what do u mean boy?

earnest phoenix
#

wdym

#

mor fast

real portal
#

I not use english everyday and idk all shortcuts

late hill
#

terms of service

real portal
#

I know but concret

late hill
#

..

real portal
#

I know what is tos

earnest phoenix
#

using "my bot doesnt crash" for people who justify heroku hosting is probably valid because their bot's guild count is lower than their age

tldr dont use free hosting

unique nimbus
#

A terms of service is basically an agreement which you agree apon

real portal
#

yhhh, you don't underatand

unique nimbus
#

Terms of service (also known as terms of use and terms and conditions, commonly abbreviated as TOS or ToS, ToU or T&C) are rules by which one must agree to abide in order to use a service. Terms of service can also be merely a disclaimer, especially regarding the use of webs...

real portal
#

...

late hill
#

Bet I can host 14 guilds bot on it fingergun

unique nimbus
#

Yes

spring ember
#

@earnest phoenix your bots is 100% not a micro service

real portal
#

I don't have problems with Heroku because I know how it works...

earnest phoenix
#

wtf dondish ?

real portal
#

to my needs heroku is cool idea

earnest phoenix
#
I don't have problems with Heroku because I know how it works...```

you don't have problems with heroku because your guild count is equivalent of human's fingers per hand
spring ember
#

Microservices are a software development technique—a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protoco...

earnest phoenix
#

it's fine for 10 or 15 guilds

real portal
#

XD

earnest phoenix
#

later on it's going to start giving up, dying, disconnecting, underperforming

#

oh we haven't the same def of micro service

spring ember
#

The issue with Heroku is that the free version has specific monthly allowance

earnest phoenix
#

so

real portal
#

do not you understand that we are talking about small bots?

earnest phoenix
#

paid heroku is still a rip off

spring ember
#

@real portal yes it was a reply

earnest phoenix
#

yes i do semadami

unique nimbus
#

Small bits become big

spring ember
#

And as I said the specific monthly allowance thing should make you worried

unique nimbus
#

My bot grew into the 20s in a day

#

And Don can agree its shit

spring ember
#

Because your bot will be offline in some part of the month

earnest phoenix
#

youu advise me what as host (free plz) ?

late hill
#

iirc heroku's monthly hours don't count using worker dyno

earnest phoenix
#
youu advise me what as host (free plz) ?```

there is no good free hosting. if you want a public bot, pay for hosting, otherwise don't run a public bot.
#

besides that, hosting is really cheap nowadays

#

it's like a buck or two

#

for 1 gb machine

#

just for begining i need a free host

#

Yes i can use LH, but i wounld rather not

unique nimbus
#

Do you want me to tell you what I did for host when my bot was new

#

I paid nothing for this

earnest phoenix
unique nimbus
#

I selfhosted

#

When I am home I will host

earnest phoenix
#

selfhosting is better than using free online hosting

unique nimbus
#

Yes

earnest phoenix
#

Well,

#

mm mm mm

real portal
#

if u use lh u must fast websocket

unique nimbus
#

wtf is lh

#

This pops up

earnest phoenix
#

literally don't go out with friends or something for one day and you've already got yourself a machine covered

unique nimbus
#

Luteinizing hormone

real portal
#

what

#

localhost

unique nimbus
#

You know that you can run your not yourself for testing

#

M8 my localhost is shit

#

It's fine for my bot

earnest phoenix
#

@unique nimbus Localhost

unique nimbus
#

Yes

pastel tiger
#

Actually hosting your bot locally is good

#

At least a test version of it

unique nimbus
#

Yes

pastel tiger
#

Allows for quick tesing and easy acces to the logs

earnest phoenix
#

yeah, but on the long term, it's hard

pastel tiger
#

Imagine logging into putty and having to run a restart all the time

unique nimbus
#

Walox what is better

#

Leaving a pc running

earnest phoenix
#

it's not hard at all lol

#

it's easier than using free hosting

unique nimbus
#

Yes

earnest phoenix
#

you don't have to struggle with containers

grim aspen
#

i can agree

late hill
#

localhost 300ms ping CringeHarold

unique nimbus
#

localhost 150ms ping

earnest phoenix
#

ok so i use localhost rn

#

if you mean it's less power efficient, maybe. power bill can get racked up quickly but to start with pcs dont use that much power in the first place.
even if, you can set your pc to lower performance settings, turn off the monitor and close excess programs

#

if somebody spam the bot

#

lol

#

emoji fail x')

#

command cooldowns

#

eaz

real portal
#

if somebody can give me donate for hosting I will happily use it but I don't have money to do that yourself, I have my private needs and other expenses and I live in Poland where earnings are very low and I don't have 7$ per month to buy hosting, heroku is ok for me now

earnest phoenix
#

there isn't command cooldown since.... it's a small bot wtf

#

gg

#

u can get raided boi

#

you should always have command cooldowns

#

don't risk some idiot ratelimiting your bot

#
samedamciToday at 11:59 PM
if somebody can give me donate for hosting I will happily use it but I don't have money to do that yourself, I have my private needs and other expenses and I live in Poland where earnings are very low and I don't have 7$ per month to buy hosting, heroku is ok for me now

hosting is as low as $1 a month

#

or someone here can make a transfer to me like that i can buy a real host

#

literally don't buy gum for like one or two days and you cover hosting

real portal
#

192 mb of RAM?

earnest phoenix
#

i've seen $1 go for 512

real portal
#

I have 512 for free

earnest phoenix
#

if you're lucky you can catch some sales and get $1 for 1 gb

real portal
#

sale for one month

earnest phoenix
#

and no, a vps that has 512mb is not equivalent to heroku 512mb

real portal
#

yeah, on heroku I have 512b...

unique nimbus
#

I got 2gb of ram and 20gb of storage with unlimited bandwidth for 3 euros a month

spring ember
#

Scaleway son

unique nimbus
#

Dad?

spring ember
#

Yes

earnest phoenix
#

my point is; if you can't afford it, don't run a public bot. otherwise, it won't hurt you to literally spend a buck or two a month for a machine

#

it's almost a fact that bots hosted on heroku are mostly shitty and generic

spring ember
#

@earnest phoenix well that's not what they asked

fiery birch
#

oi lads, many people use heroku on such, if the guy wants to do so, dont fucking talk shit about him or his bot

#

either help him, or just dont reply

#

thanks

spring ember
#

And Heroku is not bad

earnest phoenix
#

im talking facts lol

#

heroku is meant for websites

fiery birch
#

im not asking for facts

spring ember
#

It's just not meant for bots

earnest phoenix
#

not bots

fiery birch
#

heroku works for bots though, and that is what he wishes to use

earnest phoenix
#

it can be use for bot

late hill
#

You're not talking facts when you're saying it can only run few guilds

#

Slight exageration

spring ember
#

@earnest phoenix you can use it but it might be asleep later this month

earnest phoenix
#

run a bot on heroku in 50 guilds with more presence changes and let me see how it handles it lol

real portal
#

heroku not without reason can run node.js files

earnest phoenix
#

you're basically telling someone to use a band aid over a proper bandage

#

Heroku is a good example of a good host

spring ember
#

Don't exaggerate

fiery birch
#

heroku is a shit host, but it is usable

#

if money's tight, he will use what he wants

earnest phoenix
#

ohh

late hill
#

Some people here don't even have a credit card

spring ember
#

Heroku is a host for specific things

late hill
#

That shouldn't stop them from developing

earnest phoenix
#

so lets spend 100$ with OVH

fiery birch
#

OVH is hella cheap

spring ember
#

OVH is cheap

unique nimbus
#

Yes

earnest phoenix
#

did you ignore the whole part about telling us that hosting can get as low as $1

fiery birch
#

alright, if you wanna continue arguing over changing his hosts and whatnot rather than helping, im gonna be dishing out mutes

earnest phoenix
#

biased lol

#

ahah

#

what is the cmd for show up the list of host ?

#

they're in pinned messages

#

good point

spring ember
#

Yes

#

You can also scroll up

earnest phoenix
#

lazy

real portal
#

1€ == 4,2 PLN, my parents earn 1500 PLN monthly, food, bills, pleasure.... several dozen PLN are left

spring ember
#

I sent that an hour ago

earnest phoenix
#

we have spoken a lot

#

PLN ?

fiery birch
#

Just press on the Pins button and you can check the hosts

real portal
#

polish currency

earnest phoenix
#

yes kastel

#

k

earnest phoenix
#

wut?

#

if you're 15 or older you can also get a temp job

#

not in france :)

#

offtopic but it's surprising how many people are ashamed to get a temp job; nothing to be a shamed of, it's a way to generate a source of income

real portal
#

job for discord bot which use 10 members

spring ember
#

1500 pln monthly is below minimum wage @real portal

earnest phoenix
#

having a temp job doesnt mean you have to spend all of the money on the hosting lol

#

you get to treat yourself

real portal
#

on hand, gross

earnest phoenix
#

lol

#

With the money I earned i employ a real JS dev for dev my discord bot

real portal
#

or maybe few higher

unique nimbus
#

Jobs are good

real portal
#

let's end up being sorry

earnest phoenix
#

work isn't

unique nimbus
#

Jobs are work

earnest phoenix
unique nimbus
#

I got a job at McDonald's
I work at McDonald's

earnest phoenix
#

Anyway, good night igtg

unique nimbus
#

Night

real portal
#

you can find mushrooms

grim aspen
earnest phoenix
#

i worked at retail for a few months, it drove me actually crazy

real portal
#

😂

spring ember
#

Hey it's development here hello

earnest phoenix
#

touché

grim aspen
#

yeah i can see that

real portal
#

woops

#

anyway, what is the time at yours?

unique nimbus
#

In England its 11:19pm

earnest phoenix
#

00:19

real portal
#

^

#

um, yeah u from france

earnest phoenix
#

GMT+1

real portal
#

mhm

earnest phoenix
#

Wit

unique nimbus
#

GMT

#

For me

earnest phoenix
#

we're not in off topic, we'll get banned

real portal
earnest phoenix
#

Wtf dude

#

your background

real portal
#

🐷 😂

#

I know

#

it is the best on the world

#

good night btw

late hill
#

You haven't seen my weeb background

real portal
#

;-)

fiery birch
#

oi LADS

#

finna dish out these mutes at the speed of light

real portal
#

oh no

earnest phoenix
#

@@late hill Thank you for your input

#

i mean i have a support server and i keep regular updates inside. but also the other guy said my bot will be kicked?

#

But is there a specific way to find out how many guilds my bot is in i mean i have bot info and i can get the uptime to show but it doesnt specify how many days etc just has 4 numbers like 5756 so the things im trying to find out is the how to add the info how many guilds my bots in when you do *botinfo and how long its been on on its uptime

idle basalt
#

i dont know what lib youre using but they all have a way to get your guild total

#

its up to you to interpret the numbers youve been given and turn them into something humans can understand

#

its likely that your uptime is in milliseconds and you can parse those into normal seconds/minutes/hours/days relatively easily (i recommend division)

loud salmon
#

@neat depot we are a coding discord not a hardware support server

neat depot
#

😦

vital flare
#

@neat depot regardless , that seems to be your mouses issue

copper cradle
#

check the up key

vital flare
#

Faulty scroll wheel maybe

copper cradle
#

yeah

#

but also check the up key

vital flare
#

Ive had an issue with scrollwheels and it did stuff like that

#

^^

#

its not broken though

tropic cobalt
#

Who need a free host bot or WEB ?

#

🤔

surreal marsh
#

what’s WEB

kind nexus
#

@bold oxide

#

hehe

#

@fiery birch Hi! How can I get my bot unmuted?

fiery birch
kind nexus
#

$

#

+help

#

That is an oops

#

@bold oxide ping

#

F

undone turtle
#

How would I use HTTP to retrive my bot's votes from the DBL websitewith Java

livid shell
#

How would i go about getting the code from some bots?

fiery birch
#

if they have a GitHub you can

#

otherwise you can't

prime cliff
#

Or you know just code it yourself 🙄

fiery birch
#

yes

livid shell
#

Because hypothetically if I modified it I should be able to set the stuff I need with it right?

#

Like those bots but modified

#

so i could just add or remove code when needed

#

So basically I'm asking if anybody here has links to those bots

#

Code

prime cliff
#

....

livid shell
#

.....

#

I mean unless there is a way to make it so they can't be seen in the discord under the members list

#

@prime cliff

prime cliff
#

The status and game message is global on all servers the bot is in you can never change it for just 1 server

livid shell
#

But is there a way for the bots to not be visible in the members list

#

Without modifying code

prime cliff
#

Just deny it read messages permission in the channel but the bot won't be able to respond in that channel that is all you can do

livid shell
#

Ok

desert lodge
#

Hello

lilac geyser
earnest phoenix
#

someone know how to set a limit in bot.guilds.map, just take 10 guild not all

lament meteor
#

before the .join do .slice()

earnest phoenix
sinful lotus
#
function getGuilds(start_number) {
  const mapped = bots.guilds.map(g => `${g.name}: ${g.memberCount} Members`)
  const end = start_number + 10
  mapped.splice(start_number, end)
  return mapped
}
const mapped_guilds = getGuilds(5)
console.log(mapped_guilds.join('\n'))
#

here an example

#

edited

split lantern
#

Am i allowed to use CSS on my DBL Bot Page ?

slender thistle
#

Yes

split lantern
#

Wasn't that like Certified Devs only sometime

slender thistle
#

It's js

#

HTML and CSS are for any bot on DBL

earnest phoenix
#

helllo 👀 i have a question for python.
what need i write to let the bot know that this user has no perms on the channel?

slender thistle
#

Depends on what perms

earnest phoenix
#

How do you decline Permission to show an error img on command in DBL? (py)

slender thistle
#

Error image?

earnest phoenix
#

thats cancer why would you want that

#

Stfu if I want it I want it

slender thistle
earnest phoenix
#

3.6.5

slender thistle
#

Not python

pallid zinc
lament meteor
#

pls read

earnest phoenix
#

LOl

#

it cannot find module gg

pallid zinc
#

I installed the module

mossy vine
#

@pallid zinc ./ looks for the file in the current directory, if you want to require a module you dont need it

#

Also isnt discordeco deprecated?

pallid zinc
#

Ok I got it

#

No

#

It's not deprecated

earnest phoenix
#

WOuld need some small help would you know how to refer this ```js
else {

    await channel.send(dmEmbed).catch(O_o => console.log({O_o}));
    }
for DMChannel
strange trout
#

?

#

What are you trying to do

#

@earnest phoenix

earnest phoenix
#
const Command = require(`${process.cwd()}/Handler/Command.js`);
const Discord = require(`discord.js`);

class DM extends Command {
    constructor(client) {
        super(client, {
            name:"dm"
        })
    }

    async run(message) {

        const args = message.content.slice().split(/ +/);
        const commandName = args.shift().toLowerCase();
        const client = new Discord.Client();

        if (message.author.id !== "131766624872038400") return;
        let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
        if (!rUser) return message.channel.send("Provide a valid Ping or User ID");
        let reason = args.join(" ").slice(22);

        if (!reason) return message.channel.send("Provide a message!")


        let dmEmbed = new Discord.MessageEmbed()
            .setDescription("DM Message")
            .setColor('RANDOM')
            .setDescription(reason);

        let channel = client.users.get(rUser.id)

        if (!channel) {
            message.channel.send("Can't find a user.")
            return;
        } 
        
        else {
             
        await channel.send(dmEmbed).catch(O_o => console.log({O_o}));
        }
        
    }
}
module.exports = DM;
#

Well the only issue I have is that when I apply a mentioneduser and I provide a message it still returns Can't find a user even if that user is in the server

mossy vine
#

well since you are looking for a GuildMember, you would need message.mentions.members.first()

earnest phoenix
#

I used that here ```js
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));

strange trout
#

Are you having trouble sending the message to the user?

earnest phoenix
#

Yes

quartz kindle
#

message.guild.member(message.mentions.users.first()) is not valid

earnest phoenix
#

Dam for real

quartz kindle
#

either message.guild.members.get() or simply use the mention directly

#

i believe get() accepts both ids and objects, so you can just do .get(...users.first() || args[0])

#

or simply rUser = message.mentions.members.first() || message.guild.members.get(args[0])

earnest phoenix
#

alright I changed it will test run it

#

still not working as a matter of fact the only issue is with this part ```js
else {

    await channel.send(dmEmbed).catch(O_o => console.log({O_o}));
    }
    ```
strange trout
#
  let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));

Don't use channel.send simply use rUser.send

earnest phoenix
#

oh

#

alright thank you

strange trout
#

👍

earnest phoenix
#

dam it still get this

strange trout
#

🤔

#

That's how I have my moderation commands

earnest phoenix
quartz kindle
#

try rUser.user.send() since rUser is a guildmember not a user

earnest phoenix
#

still same issue 😢 bruh I've been trying with this for long time 😄 I think I'll just take a break

quartz kindle
#

how does your full code look like now?

strange trout
#
  let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));

  if(!user) return message.reply("Couldn't find user.");

  if(!message.member.hasPermission("MANAGE_MEMBERS")) return;
  if(user.hasPermission("MANAGE_MESSAGES")) return message.channel.send("Cannot ban that user.");
    const banEmbed = new Discord.RichEmbed()
      .setAuthor(`Ban | ${user.user.tag}`, user.user.displayAvatarURL)
      .addField('User', '<@' + user.id + '>', true)
      .addField('Moderator', '<@' + message.author.id + '>', true)
      .addField('Reason', reason)
      .setFooter(`ID: ${user.id}`)
      .setTimestamp()
   try{
    await user.send(`**You were banned from ${message.guild.name} for**: \`${reason}\`.`)
  }catch(e){
    return;
  } 
 await message.guild.member(user).ban(reason).then(modlogs.send(banEmbed)); 
#

This is my ban command

#

Work fine 🤔

earnest phoenix
#

I got ban kick and all works fine

#

Just DM one

strange trout
#

This one also DM's

earnest phoenix
#
const Command = require(`${process.cwd()}/Handler/Command.js`);
const Discord = require(`discord.js`);

class DM extends Command {
    constructor(client) {
        super(client, {
            name:"dm"
        })
    }

    async run(message) {

        const args = message.content.slice().split(/ +/);
        const commandName = args.shift().toLowerCase();
        const client = new Discord.Client();

        if (message.author.id !== "131766624872038400") return;
        let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
        if (!rUser) return message.channel.send("Provide a valid Ping or User ID");
        let reason = args.join(" ").slice(22);

        if (!reason) return message.channel.send("Provide a message!")


        let dmEmbed = new Discord.MessageEmbed()
            .setDescription("DM Message")
            .setColor('RANDOM')
            .setDescription(reason);

        let channel = client.users.get(rUser.id)

        if (!channel) {
            message.channel.send("Can't find a user.")
            return;
        } 
        
        else {
             
        await rUser.user.send(dmEmbed).catch(O_o => console.log({O_o}));
        }
        
    }
}
module.exports = DM;
#

that's the code rn

quartz kindle
#

well, of course you will get that error

#

you're still checking for channel even though you changed it not to use it anymore

#

if you want to use user.send() remove the channel part

#

and your rUser is still the same as it was before

strange trout
#

Also have to take into account that some users have DM's disabled so make sure to run that in a try catch statement

quartz kindle
#

hes using await catch

#

oh wait

#

thats also wrong lmao

#

if you use await, you should use try catch

#

.catch is only for .then

earnest phoenix
#

o.O

#

Well thank you this is helpfull allot

strange trout
#

What command handler are you using thonkku

earnest phoenix
#

Just toke a break im on later tonight

real portal
#

I have debian on noroot android phone

west spoke
#

Kinda random

magic smelt
#

Why this don't return me id?
Code: const snekfetch = require('snekfetch'); snekfetch.get(`https://api.roblox.com/users/get-by-username?username=Mespeczek`).then(r => { message.channel.send(r.Id); })

amber fractal
#

Snekfetch is old and I think it returns json, never used the roblox api tho

idle basalt
#

console.log(r) and youll find out whats going on

#

also like mentioned above, snekfetch has been deprecated in favor of node-fetch so you should use a different fetch package

fleet glen
#

How does the token for DBL work?

earnest phoenix
#

wym

earnest phoenix
#

hey guys. have any a useable code for the servercount for the dbl in python 3.6?

grim aspen
#

look there

slender thistle
#

Just don't use dblpy

fallow steppe
#

How can I add a command that changes the bot's prefix?

strange trout
#

You have to do that with a database

#

For that type of stuff I'd use enmap @fallow steppe

#

Or what you can do is change it in the json file if you have one

vagrant bison
#

(node:9020) UnhandledPromiseRejectionWarning: Error: Something took too long to                                         do.
    at timeout.client.setTimeout (/home/filemon/node_modules/discord.js/src/clie                                        nt/ClientManager.js:40:57)
    at Timeout.setTimeout [as _onTimeout] (/home/filemon/node_modules/discord.js                                        /src/client/Client.js:433:7)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
(node:9020) 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: 22)
(node:9020) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre                                        cated. In the future, promise rejections that are not handled will terminate the                                         Node.js process with a non-zero exit code.

#

help

strange trout
#

ClientManager.js:40:57

vagrant bison
#

?

#

help me plz

#

root@cba131:/home/filemon# node bot.js
(node:9020) UnhandledPromiseRejectionWarning: Error: Something took too long to                                         do.
    at timeout.client.setTimeout (/home/filemon/node_modules/discord.js/src/clie                                        nt/ClientManager.js:40:57)
    at Timeout.setTimeout [as _onTimeout] (/home/filemon/node_modules/discord.js                                        /src/client/Client.js:433:7)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
(node:9020) 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: 22)
(node:9020) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre                                        cated. In the future, promise rejections that are not handled will terminate the                                         Node.js process with a non-zero exit code.
sullen elm
#

@vagrant bison about discord api

vagrant bison
#

??

strange trout
#

Did you find the issue

vagrant bison
#

What should I do to make my bot take off?

#

no

spring ember
#

@sullen elm you forgot to await

sullen elm
#

oky

strange trout
#

You want to start your bot?

spring ember
#

Wait you might not need to

vagrant bison
#

yes

strange trout
#

client.login('TOKEN')

spring ember
#

@sullen elm nvm might be an issue with the api

vagrant bison
#

and all the time this error pops up as typing node bot.js.

spring ember
#

Or something is blocking the thread

strange trout
#

What's your main files name

sullen elm
vagrant bison
#

settings.json

strange trout
#

?

vagrant bison
#

?

strange trout
#

Where you put client.login()

vagrant bison
#

what?

#

XD

strange trout
#

Have you written any code