#development

1 messages · Page 608 of 1

west raptor
#

uhh

#

change module to commonjs?

mossy vine
#

yeah that uh

#

seems to work

#

at least its working

#

thanks

west raptor
#

np

#

you can change target to es6 for cleanerish code

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

split lantern
#

idk

#

try it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

hErEs A gReAt GuId-

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

that code is correct

#

provided you close the if statement

dull bobcat
#
client.on('message', message => {
    if (!message.guild) return;
    if (message.content.startsWith('y?latency')) {
        message.channel.send(`${client.ping}ms`)
    }

This would be right @sage bobcat

grim aspen
#

i see a missing part

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

grim aspen
#
    if (!message.guild) return;
    if (message.content.startsWith('y?latency')) {
        message.channel.send(`${client.ping}ms`)
    }
});```
sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

You have to close a if statement

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

No

sage bobcat
#

One message removed from a suspended account.

grim aspen
#

ThroughFacePalm not only that @dull bobcat

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

The difference from Creeper, mine and yours is that we close the if statement and event, but you dont close it

grim aspen
#

you have to put }); at the end

dull bobcat
#

@grim aspen why did you mention me?

grim aspen
#

i pressed enter too quickly

dull bobcat
#

Did you mean DV5?

#

Instead of me?

grim aspen
#

you were also forgetting that }); needs to be in there to match with client.on line

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

@sage bobcat You don't need semicolons in JavaScript so no that was not your problem, your problem was that you didnt close a if statement and the event

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

dull bobcat
#

No you dont

grim aspen
#

}

#

oops

dull bobcat
#

You don't need semicolons in javascript

mossy vine
#

actually

dull bobcat
#

Just in few very rare cases where semicolons might be needed

mossy vine
#
for(let i = 0; i <=3; i++){
    //doshit
}```
dull bobcat
#

Yeah cases like that ^

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

dull bobcat
#

What are you talking about

#

Learn JavaScript

hushed berry
#

they're also required for stuff like minification where linebreaks are removed

dull bobcat
#
let hw = "hello world"
console.log(hw)

This works @sage bobcat without any semicolon

#

You dont need semicolons to end a line on javascript

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

Yeah thats something good to get used to

#

What I am saying is that you dont need semicolons in JavaScript

#

And apparently you don't agree with that

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

You dont need semicolons on javascript and python

#

So far what i know

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

Well then you have learned something new, google it up if you want a better explination

unique nimbus
#

in python you don't need semicolons

dry wadi
#

how to welcomer enebal

dull bobcat
#

Same with JavaScript @unique nimbus

grim aspen
#

what

#

^^^

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dull bobcat
dry wadi
#

how to enable welcomer

sage bobcat
#

One message removed from a suspended account.

dry wadi
#

hindi

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dull bobcat
#

@sage bobcat U probably should read the link I sent you before actually helping someone 😉

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed berry
#

hes probably trying to use the Welcomer bot 😑

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

dull bobcat
#

@hushed berry Yeah...

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

lol

late hill
#

he left dab

dull bobcat
#

How come he cant even manage typing the help command lmfao?

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

Well anyways @sage bobcat did you read the link i sent you?

#

If not please do

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed berry
#

christ guys

dull bobcat
#

Oh ok ur busy, but you help people with their development?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

@dull bobcat what do u need bro

sage bobcat
#

One message removed from a suspended account.

dull bobcat
#

@earnest phoenix Wdym what i need?

#

@sage bobcat Then dont chat in Discord lol

earnest phoenix
#

You need help?

dull bobcat
#

No dude wtf can you read anything? Scroll up lmfao im helping people not asking for help

earnest phoenix
#

Cool

dull bobcat
#

DV5 thought you need semicolons to end a line in JavaScript and he kept argumenting with me about it, so I sent him a link where they explain that you dont need semicolons and now he doesn't open it

#

That's whats going on if you are too lazy to read

zealous veldt
#

Wow

earnest phoenix
#

Just stay cool, dont attack people i'm just asking a question

zealous veldt
#

Semicolons best

dull bobcat
#

Yeah they are

#

It's very good to get used to ending lines with semicolons, especially in js since they dont do any harm or anything

#

But what I were trying to say is that you don't need semicolons in js but nooo no one believed me xDDD

zealous veldt
#

And make code more readable

hushed berry
#

jeeeeeeeeeeeeeeeeeeeeeeez guys

zealous veldt
#

Hi nik

hushed berry
#

hewo

frail anchor
#

hi

dull bobcat
#

@frail anchor As

idle basalt
#

semis are optional?

#

only optional in golf kannapolice semis are great

dull bobcat
#

That's what i've been saying lmao

idle basalt
#

stupid argument

dull bobcat
#

He's the one being a ignorant lmao

earnest phoenix
#

what is the problem ?

#

In footer

smoky spire
#

Footers don't support markdown

earnest phoenix
#

ok

buoyant wagon
#

and titles

#

wait no

earnest phoenix
#

In the setDescription its works?

buoyant wagon
#

yes

earnest phoenix
#

thx

buoyant wagon
#

title doesnt support links but supports markdown

late hill
#

^Doesn't even support markdown on mobile afaik

earnest phoenix
#

I do how if I do not want to put a description to an .addField ?

late hill
#

You can use a zero width space

#

\u200B

earnest phoenix
#

what ?

late hill
#

It's a character which doesn't show

earnest phoenix
#

As its: ""

late hill
#

yes

earnest phoenix
#

ok

#

thx

late hill
#

Field titles don't fully support markdown either if that's what you're about to do^^

kind nexus
#

Hello, I’m coding in C# and I’m using discord.net, and I need some help. When I ban someone with my bot, I get their account through the server members. If they’re not in the server I can’t get it. How can I ban someone that’s not in the server?

earnest phoenix
#

It's good:
.addField("TEXT", "")
?

hushed berry
#

you might be able to ban via their user id

kind nexus
#

I can’t ban with id’s, I have to ban with an account

hushed berry
#

if the lib does not support that, then you may just be out of luck

kind nexus
#

Yeah I’ve asked all my friends and they don’t know

late hill
#

You can't just put nothing @earnest phoenix

hushed berry
late hill
#

.addField("TITLE_HERE", "\u200B")

kind nexus
#

Oh

#

How do I get there? @hushed berry

late hill
#

discord.js even has an addBlankField afaik

#

Which probably does the same

#

Or maybe that one is fully blank idk

hushed berry
#

i dunno

#

you could also try their discord api channel

#

which semes like its their home

idle basalt
#

addBlankField is just blank

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

idle basalt
#

its bad

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed berry
#

You shouldnt have a listener for every command

idle basalt
#

you have like 5 message events

#

this is terrible

sage bobcat
#

One message removed from a suspended account.

hushed berry
#

you have the prefix hardcoded

idle basalt
#

no lol

sage bobcat
#

One message removed from a suspended account.

idle basalt
#

put everything into one message event

#

the way events work is they fire when something happens

so when the bot "sees" a message, the code in your message event runs

sage bobcat
#

One message removed from a suspended account.

idle basalt
#

having 1000 message events is pointless

#

it just leaks memory

#

to change something being "hardcoded" you make it variable

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

idle basalt
#

const prefix = 'y?'

#

now you can use prefix instead of y?

sage bobcat
#

One message removed from a suspended account.

idle basalt
#

it can be whatever you want

#

and now that its in a variable, you can easily change it by just changing the variable instead of changing every single command

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

idle basalt
sage bobcat
#

One message removed from a suspended account.

idle basalt
#

no

#

also you do other unnecessary things like requiring discord multiple times

#

read the guide

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Who knows about music commands?

blazing peak
#

me!

idle basalt
#

thats a vague question

#

so yes

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Who else knows how to music commands ?

mossy vine
#

what do you mean

earnest phoenix
#

I explain the worries:

#

I just have a problem, when I make the play command with the YouTube link of my music wanted, the bot joins the vocal and leaves the vocal 2 seconds after.

#

And I have the coding part where it bugs, you want it?

mossy vine
#

sure, send it

earnest phoenix
#

In private message or here ?

mossy vine
#

here

earnest phoenix
#

ok

#

wait

mossy vine
#

so if i cant help, someone else can

earnest phoenix
#

ok

#
const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
          .on('end', reason => {
        message.channel.send('``The music is over .``');
              if (reason === 'Stream is not generating quickly enough.') console.log('End of music .');
              else console.log(reason);
              serverQueue.songs.shift();
              play(guild, serverQueue.songs[0]);
          })
          .on('error', error => console.error(error));
      dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
  
      serverQueue.textChannel.send(`?? Start of the music: : **${song.title}**`);
  }
  
  });
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

where?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

There is still coding at the top of what I sent. about 1000 lines

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

I know

#

But there is that part that I have send that bug

winged river
#

My bot has suddenly start giving this error:

#

Error: Cannot find module './src/config.json'

#

The error is directed to this line of code:

#

const config = require('./src/config.json');

sage bobcat
#

One message removed from a suspended account.

winged river
#

I have.

#

It still says that for some reason.

sage bobcat
#

One message removed from a suspended account.

late hill
#

Did you change your project structure

#

^

winged river
#

no

late hill
#

Show project tree?

winged river
#

k

sage bobcat
#

One message removed from a suspended account.

winged river
#

I did.

late hill
#

oof

winged river
#

Error: Cannot find module './src/config.json'

at Function.Module._resolveFilename (module.js:548:15)

at Function.Module._load (module.js:475:25)

at Module.require (module.js:597:17)

at require (internal/module.js:11:18)

at Object.<anonymous> (/app/src/alexi5.js:8:16)

at Module._compile (module.js:653:30)

at Object.Module._extensions..js (module.js:664:10)

at Module.load (module.js:566:32)

at tryModuleLoad (module.js:506:12)

at Function.Module._load (module.js:498:3)
#

🤣 😦

late hill
#

You're linking to it from alexi5.js

#

?

winged river
#

Yea.

late hill
#

They are in the same directory

#

so just ./config.json

winged river
#

ok

sage bobcat
#

One message removed from a suspended account.

winged river
#

Thanks for the help @late hill My bot is up and running now.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

unreal rampart
#

how do i call a function defined inside a function from outside all of those functions

opaque eagle
#

Show the full line of code @sage bobcat

earnest phoenix
#

client.shard.fetchClientValues('guilds.size')
.then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.size)
})
.size gives error
I am trying to get the number of all servers located in shard.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Well yes, you didn't have an initializer when you destructured it...

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

inner jewel
#

const { Client, Attachment } = SOMETHING

#

you need to put some value there

#

they won't be magically set to the right thing

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Where do Client and Attachment come from?

earnest phoenix
#
async function postToDBL() {
client.shard.fetchClientValues('guilds.size')
.then(results => {
    dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.size)
})
client.logger.info(`Anlık bilgiler başarıyla discordbots.org'a gönderildi.`)
}
});
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

1|shard | Uncaught Promise Error:
1|shard | TypeError: Cannot read property 'size' of undefined

#

help pls

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

Where

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

Where

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Well if you're destructuring it from somewhere, it means you're pulling it in from somewhere else

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

That's not defining the class

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

I suppose you wanted to do js const { Client, Attachment } = require("discord.js");

#

Yes, you are...

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Why?

inner jewel
#

then don't remove

#

that's not how it works

sage bobcat
#

One message removed from a suspended account.

inner jewel
#

you can't remove random stuff and expect it to work

#

require() caches anyway

opaque eagle
#

Then destructure it from the first import

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

require("discord.js");

#

You can't destructure from a string...

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

If you did it the way we said, then yes.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Cool

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

I don't seem to see a help command there, but ok...

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#
if (message.content === `${prefix}help`) {
   // handle it however u wish
}```
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

It wouldn't hurt to brush up on it, would it?
And yes, the Discord.js part is understandable.

#

A lot of things have changed since "a few years" ago, and D.js (non-DOM/node) tutorials in-general tend to follow the latest ECMAScript standards like template literals, object destructuring, arrow functions, etc...

earnest phoenix
#

client.shard.fetchClientValues('guilds.size')
.then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.size)
})
.size gives error
I am trying to get the number of all servers located in shard.

amber fractal
#

Is the error "Cannot read property size of undefined"

#

Well Ill just outright say it. There is no client.shards

upper hemlock
#

.

amber fractal
#

No dots please

trail dagger
#

What is a good bot status?

amber fractal
#

Online?

trail dagger
#

I mean playing status

amber fractal
#

I use my bots main prefix

trail dagger
#

k

left forge
#

hi lam new

#

lol

trail dagger
#

@modern sable

left forge
#

,

trail dagger
#

Ban!

left forge
#

!ban

trail dagger
#

U gonna get banned kid

#

Bye bye 👋

upper hemlock
#

Give Me Bot Developer

slim heart
#
if(arg[i].length == 1 && arg[i+1].length == 1) {
                for(q=0;q<3;q++) {
                    if(arg[i+q]) {
                        if(arg[i+q].length == 1) {
                            result += arg[i+q];
                            arg[i+q] = "";
                            ki = q;
                        } else break;
                    } else break;
                }
            }
            if(ki) { arg[i+ki] = result};``` why is this causing a memory heap?
earnest phoenix
#

How do I set that my bot can use emojis are especially to servers?

slim heart
#

@earnest phoenix what lib

earnest phoenix
#

discord.js

grim aspen
slim heart
#

do client.emojis.get("emojiid")

upper hemlock
#

There is a situation that someone sends me the commands of welcome

slim heart
#

then you can send it along as a string

earnest phoenix
#

Oh, ty

#

As client.emojis.get("tickYes") ?

slim heart
#

no

earnest phoenix
#

or "tickYes"

slim heart
#

get the id of the emoji for server specific emojis

#

like this

earnest phoenix
#

Oh, ok

#

Ty

slim heart
#

@earnest phoenix

earnest phoenix
#

Ty dude

slim heart
#

yup

amber fractal
#

Or ![tickYes](https://cdn.discordapp.com/emojis/315009125694177281.webp?size=128 "tickYes")

brave anvil
#

Is IDEA ide program?

idle basalt
#

um... sure?

#

its an ide not a "bot making program" lol

cold harness
#

Lol yeah ^

scarlet phoenix
#

Yeah, it's the best for Java or kotlin development in my experience. There are a lot of plugins that add support for more languages that work well too.

brave anvil
#

Mhmm

chilly sequoia
#

so here's a question since Kotlin was brought up. I've seen a friends java bot (a while back, no longer friends) use java and kotlin together. Whats the point of that? is there a steep advantage to using both? or is it just preference?

spring ember
#

Just preference

earnest phoenix
#

When I do + play on my music bot, he joins the vocal but leaves right after.

#

How do I do that?

indigo crane
#

Music is ez

spring ember
#

@earnest phoenix well can you show the code for the play command?

#

Please in a paste service

#

Like hastebin

earnest phoenix
earnest phoenix
#

I have a question, in the console it tell me Unexpected token
at :

let embed = new Discord.RichEmbed()
        .setAuthor(`${message.author.tag}`, message.author.displayAvatarURL);
        .setDescription(`${message.author}, you are worked. You earn ${amount}$`) 
        .setColor("RANDOM")
     message.channel.send(embed)
mossy vine
#

You have an unneeded semicolob after displayAvatarURL)

earnest phoenix
#

OK thx

spring ember
#

don't forget to await the message.channel.send

#

or return the promise

earnest phoenix
#

Other worries, I can't install the module quick. DB, who can install it and give it to me please?

#

Where must I set message client.emojis.get("emojiid") ? To the bot.js?

#

What do you want to do? @earnest phoenix

#

Using special emojis

#

Especially to the servers

#

ok

#

Oh, and what can I write to the detailed description? I wrote information about bot.

#

Are you on PC?

#

No, mobile

#

Ah, it's not going to be possible because we can do that on PC. at least make the command \:you emoji:

#

Oh ok

#

I'm saved this message

#

Ask someone who is on PC to help you. I personally am on mobile here

#

Okay

#

I asked "where can I write clients.emojis.get command?".

#

You must have friends on computer, ask them and then you will have to put at the beginning of a line a .setDescription or other

#

Oh ok

#

example:

.setDescription("<a![flechegif](https://cdn.discordapp.com/emojis/563806746964131840.webp?size=128 "flechegif")563806746964131840> Title or other

#

Okay

#

Ty dude

#

What's glitch?

#

It runs nodejs over Linux

pallid zinc
#

How to host on glitch

earnest phoenix
#

Free hosting?

#

Yes

pallid zinc
#

My bot go off after some time

earnest phoenix
#

I'll find out

#

I like this website

lament meteor
pallid zinc
#

Matrix can you help?

earnest phoenix
#

Because it's easily and I haven't memory on my PC

#

Okay

#

Register to the glitch

pallid zinc
#

How can I host on glitch

#

Done

earnest phoenix
#

Okay and after create hello-express

pallid zinc
#

My bot go offline after some time

#

Ok

#

Drag and drop my file

earnest phoenix
#

If you keep online glitch.com, it never goes offline

lament meteor
#

@pallid zinc u need to use uptimerobot and ping the project thru the project

earnest phoenix
#

Oh yes

#

Im using

pallid zinc
#

Ok thanks

earnest phoenix
#

@pallid zinc and code as nodejs dude :)

pallid zinc
#

Is it safe to host on glitch

earnest phoenix
#

There are risks..

#

Yes of course

pallid zinc
#

I code node.js only

earnest phoenix
#

No, glitch is very safe

#

Yes

pallid zinc
#

Ok try

earnest phoenix
#

You are sure?

#

Yes

#

Anyway I already have a free host and H24 online

#

Many people use and share glitch

#

Im using uptimerobot for keep bot online always

#

you speak French?

#

No

#

ok

#

Not even a little?

#

No, Im just know bonjour 😆

#

And I can errors on English, if I did, sorry

#

Because English isn't my mother tongue

#

All right. If you say Bonjour, je suis très gentil et très sociable.
That means in English Hello, I am very kind and very sociable.

#

Wow

#

yes

#

And the word

#

anti-constantitually is said anticonstantitutionnellement in French. The longest word in the world ^^

#

Oh :D

#

Let's talk about it in general channel

#

I can't

#

why ?

#

Because Im afk for codding

#

ok

chilly sequoia
#

Supercalifragilisticexpialidocious is longest word

earnest phoenix
#

No

chilly sequoia
#

¯_(ツ)_/¯

earnest phoenix
#

In your country.

#

And in mine, no

#

I did not even know the existence of this word xD

slender thistle
chilly sequoia
#

i know it just the only time that word can be used outside of the movie lol i'm know its not

#

yes my bad, didnt see the channel name

earnest phoenix
#

Are there any computer users?

pallid zinc
#

@earnest phoenix showing Error: An invalid token was provided.

earnest phoenix
#

Ss

pallid zinc
#

ss mean

earnest phoenix
#

screenshot

pallid zinc
#

of what

#

env

#

index.js

earnest phoenix
#

Hmm

#

Maybe I cant help you

#

Because Im using Turkish words

#

Example: settings.json is ayarlar.json (bot's token, ID and owner info page)

pallid zinc
#

solved my problem no. one

earnest phoenix
#

Hm

pallid zinc
#

how to prevent bot go off

earnest phoenix
#

Use node.js app

pallid zinc
#

how to use it

earnest phoenix
#

An application

#

For javascript codes

#

Download to pc

pallid zinc
#

i have node.js

#

i use it to code

#

@earnest phoenix whats that website you are talking about

earnest phoenix
#

Hm

#

I dont know dude sorry

pallid zinc
ruby dust
#

regarding sqlite, if I'll assign a primary key to more than 1 column (for example 2), does that mean that unique values can't be a combination of the same value of both columns?

#

well for example, if in 1 column I have a value of 25 and in the second column a value of 1, can I still assign the value 25 in the first one if at least the second column has a different value?

pallid zinc
#

console log Cannot read property 'avatarURL' of undefined

#
          var member = message.mentions.members.firt
          message.channel.send(embed
        .setImage(message.user.avatarURL)
        .setColor('#275BF0')
          )
        }

#

command

earnest phoenix
#

reread your code very carefully

pallid zinc
#

sorry

#

given worng code

#

if (message.content === `${prefix}avatar`) { message.reply(message.author.avatarURL); } }); Cannot read property 'avatarURL' of undefined console log

#

this is right one

abstract quarry
next wedge
earnest phoenix
#

Can someone recommend me a image manipulation api that can let me insert images into a large image (Node.JS)?

trail dagger
wraith cipher
next wedge
#

Oh

#

ok

#

ty

split juniper
#

Anyone else getting a crap ton of socket hang up errors on sharded bots?

inner jewel
#

i'm having a lot of disconnects

#

but they're all resuming so w/e

slim heart
#

Yea

earnest phoenix
#

@slim heart dude where I can type client.emojis.get("emojiid")?

winged river
#
const hastebin = require('hastebin-gen');
module.exports.run = async (bot, message, args) => {
    let users = bot.users;

    let searchTerm = args[0];
    if(!searchTerm) return message.channel.send("Please provide a search term.");
  
    let matches = users.filter(u => u.tag.toLowerCase().includes(searchTerm.toLowerCase()));
  let bestMatch = matches.map(u => u.tag).join("\n");
  if(bestMatch.length > 1000){
    hastebin(bestMatch, "txt").then(r => {
    message.channel.send(`Output was too large. Data was exported to hastebin! ${r}`)
}).catch(console.error);
  
  }else{
  const embed = new Discord.RichEmbed()
            .setTitle("All the users found.")
            .setColor(0x26a98b)
            .setDescription(bestMatch);
        message.channel.send(embed);
  }

}
 
module.exports.help = {
  name: "find"
}``` it finds all members in guilds i want it to be in only 1 guild when you search for members.
slim heart
#

@earnest phoenix save it as a variable and then when sending a message / putting it in a string just do (`${variable u store the emoji in} etc. etc`)

flint trellis
#

@winged river so instead of bot.users to msg.guild.members

#

and adjust your code

winged river
#

k

flint trellis
#

unless you want to supply a server id, you can use your arguments

winged river
#

msg isnt denified

neat falcon
#

Bruh

flint trellis
neat falcon
#

module.exports.run = async (bot, message, args) => {

flint trellis
#

you pass it as message

winged river
#

@flint trellis

#

let users = msg.guild.members; msg isnt definied.

split lantern
#

FIX IT THEN, you were told what to do like by 3 people

flint trellis
#

assess the rest of your code

grim aspen
#

use **message**

#

message

winged river
#

on what.

grim aspen
#

i mean

winged river
#

you aint specifing.

#

oh

#

fixed it

#

lemme test brb

amber fractal
#

Is there a reason this is still collecting all reactions? I have the max as 1 and if someone that isnt user reacts it still goes through const filter = (reaction, user1) => reaction.emoji.name == '✅' || reaction.emoji.name == '❌' && user1.id === user.id that is how you set up the filter right?

split lantern
#

ea

winged river
#

No output after sc!find uwu is now given.

split lantern
#

true || false && false

#

will give true

amber fractal
#

What?

#

Oh shi

split lantern
#

(reaction.emoji.name == '✅' || reaction.emoji.name == '❌' ) && ..

amber fractal
#

js why you do this to me

#

Ye

flint trellis
#

the or operator (||) will rely on the first supplied paramater that is true

split lantern
#

@winged river Because you are now filtering trough a Collection of Members

amber fractal
#

Ye, I always forgot how js handles it like that

flint trellis
#
true || false //true
false || true //true
false || false //false
idle basalt
#

imagine fyko answering something like this 👀

smoky spire
#

imagine fyko 👀

dull bobcat
#

How come JS don't convert the code to a machine language? How tf does our computer understand the code?

mossy vine
#

its called an interpreter mmLol

#

it can be compiled to say an executable, or interpreted as it goes

dull bobcat
#

What?

#

Im talking about nodejs

mossy vine
#

im talking about nodejs as well

#

look into how v8 works

#

its what nodejs uses now

dull bobcat
#

I asked a question

#

Could you answer me question?

#

If not dont bother giving suggestions about reading how something works

#

Because I didn't ask my question to learn something big, I simply wanted to know if JS has a compiler or something because on the tutorials it says JS dont

#

But then how does the machine understand the code?

cold harness
#

JS, like python is interpreted

late hill
#

@amber fractal That's just how boolean logic works afaik

amber fractal
#

Thanks for the late ping

late hill
#

It's like that for most coding languages basically

amber fractal
#

It was fixed already

cold harness
#

it's read line by line and converted to machine code, while it's completed in a session @dull bobcat

late hill
#

I know but you said "I forgot js did that"

amber fractal
#

I just forgot I needed parentheses on those

dull bobcat
#

@cold harness Well apparently it isn't?

grim aspen
#

what isn't

dull bobcat
#

Read ^

#

Use your eyes and brain

amber fractal
#

(edited)

dull bobcat
#

So what?

amber fractal
#

You can't be insulting someone then make a mistake yourself, it just doesn't work

dull bobcat
#

There is a difference between a mistake and a typo bud

#

And i din't insult any1

grim aspen
#

it is not a compiled language, it's a interpreted language. a compiler is separate, the code is put through that compiler and it's translated to bytecode, to which the machine can understand. I would also like you to not be rude to the developers. i don't fucking care about what you try to correct me with, i am trying to help people with coding, and this type of attitude is not appreciated for the developers who try to help

ruby dust
#

I've been thinking, what's the best way to commit changes to db? I've been doing that on possibly every insert/update since it was a small bot anyway, but do big companies commit on an interval or something?

quartz kindle
#

google "eventual consistency"

ruby dust
#

the most difficult part is how should a non english native should be able to understand what is explained like that? any example you can give?

quartz kindle
#

basically, eventual consistency runs on one or multiple caches

#

data exchange is made with caches, and caches write to database on an interval

#

that way you can have for example 10 caches receiving requests, and those 10 caches then merge with the database on an interval

#

this is often used for things like view count, likes, etc

#

likes are stored to caches, and only merged to the main database every once in a while, hence why views and likes tend to be inconsistent when accessed

#

this model cannot be used when you need your data to be consistent and accurate everywhere though

ruby dust
#

hm, alright thanks

scarlet phoenix
#

@ruby dust For individual writes for a small 1db instance application goes, I would use any sort of transactional logic your db engine allows to make sure that the writes complete. As far as distributed db clusters go, at my workplace we use both eventual and strong consistency depending on the use case.

ruby dust
#

understood

spring drift
#

Will the a bot notify me when my bot has been reviewed im guessing yes but i would like to know for sure

grim aspen
#

yes

spring drift
#

Ok ty

cold harness
#

@abstract quarry text works like this <p align="right">This is some text in a paragraph.</p>

#

so i assume you can do the same

abstract quarry
#

let me try

cold harness
#

like <p align="right"><a href="LINK"></p>

abstract quarry
#

it works

#

thank you

#

no first you do <a href="LINK"> <p style="text-align: center> test </p> </a>

cold harness
#

oooh right

#

i haven't done html in a while

abstract quarry
#

ok

#

thank you

cold harness
#

np

abstract quarry
#

Does someone know how to align a picture in HTML?

cold harness
#

you don't

#

use CSS

abstract quarry
#

hmm....

#

thank you

quartz kindle
#

you can use inline css

#

<img style="css here" src="image.jpg">

abstract quarry
#

but how xd

#

ok let me try

#

noup

#

did I write something wrong in css?

quartz kindle
#

thats not inline css, thats a class

#

classes can only be used in <style> tags or in a css file

abstract quarry
#

wait

#

<div class="right">
<img src="img name">
</div>

quartz kindle
#
<!-- embedded css -->
<style>
    .position {
        position: absolute;
    }
</style>
<img class="position">

<!-- inline css -->
<img style="position: absolute">
abstract quarry
#

k wait

#

idk it doesn't work for me

#

but thanks for helping

quartz kindle
#

then you're doing something wrong

abstract quarry
#

i did it

#

I did something....

#

I used div class

#

now its on the right side

quartz kindle
#

remove the style="" if you're not using it

abstract quarry
#

I will

#

I need to remove the border from the class

quartz kindle
#

also, you dont need a container, you can apply the class directly to the img

#

<img class="right"

abstract quarry
#

Ok I didn't knew that. Thank you.

quartz kindle
#

also, if you want to center it, you wont be able to do it with float

#

you can try display: block and margin: 0 auto

abstract quarry
#

Ok, but at the moment I don't need to center images.

earnest phoenix
#

how can you check whether the type of a channel is nsfw or not
.nsfw doesn't seem to work

dusky marsh
#

message.channel.nsfw returns a bool value in d.js

earnest phoenix
#

yeah ik but

#

that doesn't seem to work for a checker

potent verge
#

I'm using discord.js.
can anyone help me set 2 prefixes?
"^" and "slave."

#

this is what I have right now

#

I already tried js let prefix = "^" || "slave." but it doesn't work

dusky marsh
#

Use an array of prefixes

#

And then check if the message includes a prefix from the array

potent verge
#

hhhhhhhuh

#

im pretty new to javascript sorry

slender thistle
#

yayeet^brokeyourcommand

mossy vine
#

let prefix = "^" || "slave." makes no actual sense

potent verge
#

ok

#

sorry it was one |

split lantern
#

that makes even less sense

potent verge
#

thank you for the positivity

split lantern
#

| is bitwise or

amber fractal
#

Could regex mmLol

#

If you know how to work that

split lantern
#

^ i would recommend that

#

because you then also could easily add mention prefix with it and not have any problems with cutting away the prefix

potent verge
#

also tried this

idle basalt
#

getting closer

#

thats correct (i would name it prefixes since its multiple) but now you need a different check for that

buoyant wagon
#

you can try

#
let prefix = ["^", "slave."];
let sw = false;
prefix.forEach(function (pr) {
    if (message.content.startsWith(pr)) sw = true;
});
if (!sw) return;``` @potent verge
earnest phoenix
#

json lang?

dusky marsh
#

json lang

#

Lmao

mossy vine
#

lmao

earnest phoenix
#

what is so funny?

mossy vine
#

thats not even json

#

plus json isnt even a language

earnest phoenix
#

i don´t programm with it. i just ask 😂

mossy vine
#

mate its not a programming language

#

9k iq

dusky marsh
#

^

mossy vine
#

In computing, JavaScript Object Notation or JSON is an open-standard file format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types.

fierce thorn
#

if (message.content.startsWith("something") || message.content.startsWith("something2"))

scarlet phoenix
#

No no no, Im sure he mean Jason Lange, the journalist

earnest phoenix
#

hahaha and html works only when a profi write this (its a joke who don´t check it)

buoyant wagon
#

Jay's son

earnest phoenix
#

🙄

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Like make sure that people of a specific id can't run a command?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Show me the code for the command that you want to restrict

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

where?

sage bobcat
#

One message removed from a suspended account.

grim aspen
#

which library are you using again?

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

That's... not a command... it runs when the client starts.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opaque eagle
#

Put it in your message event...

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

Ya know, I still highly recommend you follow a tutorial...

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

Yes, it is...

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

You probably skipped around instead of reading it page by page

sage bobcat
#

One message removed from a suspended account.

opaque eagle
#

You should really start from the very beginning and go on from there

#

It helps you with best practices, etc...

quick ginkgo
#

WAIT

#

What is json if its not a language

amber fractal
inner jewel
#

it's not a programming language

#

it's a data format

#

which may be considered a language

#

just not a programming one

quick ginkgo
#

oh, i always just associated it with js

inner jewel
#

JSON = JavaScript Object Notation

amber fractal
#

Well it is the JavaScript Object Notation mmLol

#

And Im slow

quick ginkgo
#

THATS what it stands for??!

#

i also associated it with json + javascript = minecraft

amber fractal
#

Weird considering minecraft is java

quick ginkgo
#

same thing potato tomato

amber fractal
#

No where near the same thing tho

#

It's an entirely different lang

quick ginkgo
#

potato tomato

hushed berry
#

yeah actually

#

thats kinda a good analogy

quick ginkgo
#

i confuse myself a lot by all the crap and incorrect things i say

earnest phoenix
#

where do i get server name

#

i tried to find it on discord.js

#

i cant remember how to do it

dusky marsh
earnest phoenix
#

oh ty

#

Cannot send messages to this user

#

:v

dusky marsh
#

?

earnest phoenix
#

the dude doesnt have a mutal server with the bot

raw wharf
#

Hi...
How can a "reload" of the command handler be done if one has shards? Thonk (pls help)

earnest phoenix
#
global.EnmapGuildsDb = new Enmap({
    name: "Guilds"
});
global.Enmap = require("enmap");```
#

where do i define enmap

#

and how

#

im new at enmap so...

#

i tried to define enmap but this pops up

#

Cannot find module 'better-sqlite-pool'

earnest phoenix
#

@raw wharf You can try bot.destroy(); .then(bot.login(token));

molten yarrow
#

@earnest phoenix u need to run npm i better-sqlite-pool

earnest phoenix
#

Oh ty

#

Error: Cannot find module '../enmapFunctions/NewGuild.js'

earnest phoenix
#

Cannot read property 'hasPermission' of undefined

pallid zinc
#

@earnest phoenix remove ../

#

Show code

earnest phoenix
#

@earnest phoenix show code

dire trail
mossy vine
#

i was legit thinking of making one a few days ago lol

dire trail
#

we thought of that abt 3 days, because of an issue in our github

#

and we thought "why don't we make a wrapper, since it's easier to make, and won't take up much space in code"

#

and boom

mossy mulch
#

ok so just gonna ask , my bot shows server count (discord.py) in the status , but it says 209 , but on dbl it says 76 ... so ... im kinda lost where the problem is ...

idle basalt
#

you havent updated it on dbl

amber fractal
#

That's not how you give dbl your server count

mossy mulch
#

ik

#

i have the api stuff too ...

#

that should post the server count

#

but I asked before in #topgg-api bc it didnt work , but after a few hours it actually started posting the server count even when my console said "failed to post server count"

slender thistle
#

What was the error

#

Can you try again and post any traceback available?

mossy mulch
slender thistle
#

Update the lib and try again please

mossy mulch
#

ok

#

its latest version ...

slender thistle
#

0.2?

mossy mulch
slender thistle
#

dblpy

mossy mulch
#

mmm how do I update that one ?

slender thistle
#

How did you install it in the first place

#

Through pip?

mossy mulch
#

yes

slender thistle
#

pip install -U dblpy

mossy mulch
#

ok now its updated ill try again

slender thistle
#

Ig I'll have to change the way it waits until everything's ready

#

Sucks not to have my laptop on me

mossy mulch
#

well i can show u the code I have to post the servercount ...

slender thistle
#

Please do

mossy mulch
#
import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


class DiscordBotsOrgAPI(commands.Cog):
    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'TOKEN' 
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""

        while True:
            logger.info('attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('posted server count ({})'.format(len(self.bot.guilds)))
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)


def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(DiscordBotsOrgAPI(bot))
``` ofc I have TOKEN replaced with the dbl bot token from the site
slender thistle
#

Slap the new example in

mossy mulch
#

did they update it ?

slender thistle
#

It's updated

mossy mulch
#

ok bc last time it wasnt so I already asked a mod when it would be updated ... ok ill check it out and try it again after it

slender thistle
#

Don't look at that

mossy mulch
#

ow then where ...

slender thistle
#

Hold up

mossy mulch
#

ok

slender thistle
#

Scroll down on either

mossy mulch
#

ok

#

ok so it started up correnctly

#

ok works tysm

slender thistle
#

Could you please open an issue on GitHub

mossy mulch
#

for ?

#

bc now it actually posts correctly ...

slender thistle
#

I suspect that I should rewrite the way it waits for the bot to be fully ready

mossy mulch
#

oww

#

welp i can open one on github but not now , wont be on pc for the next few hours .. just wanted to have my servercount fixed and working correctly

slender thistle
#

Dw, it's fine

mossy mulch
#

i will send u the link then when i opened on ok ?

slender thistle
#

No need, but it's up to you

mossy mulch
#

ow welp ill see (:

slender thistle
#

👌

quartz ridge
#

Hi ! I am creating a bot in node.js but I can not connect my database. Could someone help me solve this error? 😕 ```C:\Users\eveno\OneDrive\Bureau\Bot discord\Bot habbix test\testbot.js:20
if (err) throw err;
^

Error: Cannot enqueue Handshake after already enqueuing a Handshake.
at Protocol._validateEnqueue (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\protocol\Protocol.js:221:16)
at Protocol._enqueue (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\protocol\Protocol.js:138:13)
at Protocol.handshake (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\Connection.js:119:18)
at Object.<anonymous> (C:\Users\eveno\OneDrive\Bureau\Bot discord\Bot habbix test\testbot.js:19:7)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)```

versed briar
#

eey can somone help with a problem a have with my bot

unique nimbus
#

whats wrong

#

send error

west spoke
#

@versed briar we cant help if we don't have any code.

quartz ridge
#

@west spoke @unique nimbus You can't help me ? 😢

quartz kindle
#

post the relevant code

versed briar
#

pi@raspberrypi:~/Documents/bots/dndbot $ npm start

dndbot@1.0.0 start /home/pi/Documents/bots/dndbot
nodemon

[nodemon] 1.18.11
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node index.js
/home/pi/Documents/bots/dndbot/index.js:10
bot.on("ready", async() => {
^

SyntaxError: Unexpected token (
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3
[nodemon] app crashed - waiting for file changes before starting...

quartz kindle
#

an error without code doesnt say much

west spoke
#

Pi(s) normally don't work as well as a laptop/android

quartz ridge
#

@quartz kindle ```var con = mysql.createConnection({
host: "localhost",
user: "ruth",
password: "123456"
});

con.connect(function(err) {
console.log("Connected!");
});

con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "INSERT INTO users (ID, PetType, PetName, PetLevel) VALUES ('1234', '10','test','6')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
});```

quartz kindle
#

@quartz ridge why are you connecting twice?

#

@versed briar you have to post your code. the error doesnt say much

quartz ridge
#

I did not see 😄

quartz kindle
#

also please use code blocks

versed briar
#

oke

unkempt juniper
#

Guys, how do I specify the auth for a request? I use request(url, (error, response, body)) for a discordbots.org request but it say { error: 'Unauthorized' }

quartz kindle
#

which lib are you using for request? look at its documentation and look for how to set headers

versed briar
#

`const discord = require("discord.js");
const botConfig = require("./botconfig.json");
const racefile = require("./races.js");
const classfile = require("./classes.js");
const bgfile = require("./bg.js");

const bot = new discord.Client();

bot.on("ready", async () => {
console.log(${bot.user.username}: Main index is docked.);

bot.user.setActivity("D&D", {type:"playing" });

});

bot.on("message", async message => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;

var prefix1 = botConfig.prefix1;
var prefix2 = botConfig.prefix2;
var messageArray = message.content.split(" ");
var command = messageArray[0];
var arguments = messageArray.slice(1);
var cmds = [">bot",">help","D&Dinfo","D&Dclasses","D&Draces","D&Dbackgrounds","D&D(Racename)"];

if (command === `${prefix1}Bot`) {

`

unkempt juniper
#

Javascript, sorry

quartz kindle
#

request is not a native function, it requires a library. which library is it?

versed briar
#

how do you do a code block

unkempt juniper
#

three `

quartz kindle
#

three times `

unkempt juniper
#

Yea, it's a package

quartz kindle
#

so look into the package's documentation on github or npm, and search how to define headers

west spoke
#

There

versed briar
#
const botConfig = require("./botconfig.json");
const racefile = require("./races.js");
const classfile = require("./classes.js");
const bgfile = require("./bg.js");


const bot = new discord.Client();

bot.on("ready", async () => {
    console.log(`${bot.user.username}: Main index is docked.`);

    bot.user.setActivity("D&D", {type:"playing" });
});

bot.on("message", async message => {
    if (message.author.bot) return;
    if (message.channel.type === "dm") return;

    var prefix1 = botConfig.prefix1;
    var prefix2 = botConfig.prefix2;
    var messageArray = message.content.split(" ");
    var command = messageArray[0];
    var arguments = messageArray.slice(1);
    var cmds = [">bot",">help","D&Dinfo","D&Dclasses","D&Draces","D&Dbackgrounds","D&D(Racename)"];
quartz kindle
#

thats the full code?

versed briar
#

```if (command === ${prefix1}Bot) {

    let BotPic = bot.user.displayAvatarURL;
    let botembed = new discord.RichEmbed()
        .setColor("#ffffff")
        .setThumbnail(BotPic)
        .addField("Bot name: ", bot.user.username)
        .addField("Created on: ", bot.user.createdAt)
        .addField("Server related prefix: ",prefix1)
        .addField("D&D related prefix: ",prefix2);

    return message.channel.send(botembed);
}
//commando's for the bot not d&d related
if (command === `${prefix1}Help`) {
    let cmdos = new discord.RichEmbed()
        .setColor("#ffffff")
        .addField("These commands available: ", cmds)

    return message.channel.send(cmdos);
}
//commando's for the bot d&d related
if (command === `${prefix2}Info`) {
    let info = new discord.RichEmbed()
        .setColor("#DC143C")
        .setDescription("These are your options:")
        .addField("Classes")
        .addField("Races")
        .addField("Background")
        .addField("Weapons")
        .addField("Armor")
        .addField("Equipment")
        .addField("Spells")
        .addField("Others");

    return message.channel.send(info);

}
if (command === `${prefix1}Sup`) {

    let SUP = new discord.RichEmbed()
        .setColor("#ffffff")
        .setDescription("Sup");

    var i = 0;
    while (i < 10) {
        i++;
        return message.channel.send(SUP);
    }
}

});

bot.login(botConfig.token);```

mossy vine
#

ok but why are you defining the variables on every message

versed briar
#

can we go in a voice chat

unkempt juniper
#

Also, is here a way to get the votes count in real time? tried dbl.getVotes() but isn't updated =/

west spoke
#

Creating a loop most likely

quartz kindle
#

@unkempt juniper the best way to get votes in real time is to use webhooks

unkempt juniper
#

I mean, not in real time, but not values from the previous day

#

How often does it update?

quartz kindle
#

no idea

unkempt juniper
#

I got it 👏

willow sparrow
#

how can you make a bot have multiple commands, do you have to have multiple .js files for each command?

grim aspen
#

you can do that, or have all one file

willow sparrow
#

last time i did that it was a MESS

dusky bear
#

How far developed is fully developed for the mods to accept a bot?

mystic shell
pastel tiger
#

Well appearently a table called users is missing

#

Thats really all i can give because you have not shown us any code

west spoke
#

^

grim aspen
#

@dusky bear functioning commands, rest of the requirements are in #502193464054644737s. start there

dusky bear
#

So all you need are functioning comands. No minimums.

west spoke
#

essentially a help command, and other stuff. I'd reccomend trying with file storage/profiles, idk.

dusky bear
#

What image manipulation library do you recommend

west spoke
#

what lang do you use

dusky bear
#

Node/discordjs

west spoke
#

Isnt their a canvas thing built in?

#

I know for python you can use pillow

#

But idk about js

dusky bear
#

thanks.

wild comet
#

Attention my dear friends👀
Here comes a serious request:
Hack-Save
Last week, on a pretty crowded server 2k+ members an admin account got hacked and all of the normal members got kicked + nearly all channels were deleted. Sad thing, so an interesting idea came to my mind.
Creating a bot that prevents those cases.
Basic idea behind this: when an admin kicks serveral members in a short time (lets say 10 members in 1 minute) the bot immediately takes away all admin-roles. Second feature: when an admin deletes two channels in under 10 mins, all admin roles are removed.
Not only at the admin that is acting, at all available admins. Therefore the bot-role has to be the highest role on the server. The owner has to reset the bot, if he does not, the bot will keep taking the roles away. Several features can be added like bot being kicked -->warning to other admins by dm, admin-roles taken away by owner (in case the owner-account got hacked).
Just wrote this down, I know its technically not that hard to realize, so here is my question:
What do you think of this feature?

earnest phoenix
#

Does anyone know why this part of the code doesn't work, without an error message?

west spoke
wild comet
#

Its just an idea that came to my mind, just want some opinions on it😊

earnest phoenix
#
ElуterYesterday at 11:50 PM
Does anyone know why this part of the code doesn't work, without an error message?```

because that event doesn't exist
idle basalt
#

that event doesnt exist

#

thats not how you use find

#

addrole doesnt exist either

#

camelCase my guy

quartz kindle
#

@wild comet the problem is, being hacked by bots is way more common than being hacked by user accounts afaik

#

bots who have admin permissions and get their tokens leaked are single handedly responsible for nuking hundreds of servers

#

it could still work, but you need to check who's the one deleting things, and leave the server if he himself is the one doing it

#

also if a raid happens, you will need to disable the bot before you can mass ban people

#

same if you want to modify the server structure

earnest phoenix
#

@idle basalt what is the good method ?

vernal radish
#

can someone help me with hosting a bot 24/7??

#

idk how

#

to do that

#

?

wraith cipher
#

@vernal radish try getting a aws EC2 instance

#

It's free for a year

vernal radish
#

k

wraith cipher
#

Or if you just wanna test it out

#

Try heroku

quartz kindle
#

google gce is also free for 12 months

#

and free for ever with certain limits

vernal radish
#

but you can still update your bot right

willow sparrow
#

Try discord.host for a forever free host

grim aspen
#

vpsd

wraith cipher
#

OFC you can

willow sparrow
#

With updating

#

I use it

vernal radish
#

k

willow sparrow
#

99.9% uptime gaurenteed

grim aspen
#

@willow sparrow that's not a trustworthy site

willow sparrow
#

I use it and love it

unique nimbus
#

I use scaleway

#

its 3 euros a month tho

#

and european

grim aspen
#

i use skysilk

quartz kindle
#

scaleway uses atom cpus

unique nimbus
#

yeet

grim aspen
#

hey tim

#

do you trust discord.host?

#

@quartz kindle

#

i wouldn't think it would be trustworthy

quartz kindle
#

idk, they claim they are run by MCS Hosting Ltd, you can check their website mcshosting co uk

idle basalt
#

looks sketch idk

#

@earnest phoenix the event is called guildMemberAdd and the method is addRole

#

its all in the docs. i recommend you search there first

strange trout
#

How can a token be leaked

west yarrow
#

🤷

grim aspen
#

there's a couple ways:

#

github link is public and the token is included publicly

#

bot is hosted on a bad site like free hosting

#

and last but not least, if you were to eval client.token without having regex, it will show your bot token in chat

#

@strange trout @west yarrow this should answer your question

strange trout
#

Okay thanks

#

I should be good

#

No Github, Safe host, using regex

#

👍

grim aspen
#

well glitch is actually trustworthy if you put your token in a .env file where it is private and no one can see it if they were to access your bot's page

strange trout
#

Yeah it's safe if used correctly. That's where I do my testing

grim aspen
#

but use regex or a counter reply for eval because it can catch your token whether or not it is in a .env file

hushed berry
#

honeslty i dont really see a need for that

#

how often are you going to eval your bots own token Thonk

grim aspen
#

rare but it could still happen

hushed berry
#

seems like a bit of a stretch

bright spear
#

@grim aspen while it is a good idea to put token in .env, you could always just make the project private

west spoke
#

^

#

Or store it in a db

amber fractal
#

Wait what?

#

Store the token in a db?

west spoke
#

yeh. s3 or something.

scarlet phoenix
#

Yeah, cloud config is pretty common, used mostly for managing tokens/properties/keys for many services in one central location.

west spoke
#

Ye

#

YawN need to update my bot info command, and my bot's page with the correct webpage

scarlet phoenix
#

We use it at work for a boatload of microservices, pretty slick

west spoke
#

Seems cool.

mystic shell
#

every time i type in a command my bot is executing it twice and i dont know why

#

ive looked thru all my code, there is nothing that seems like it could be causing it

west spoke
#

Restart it and check if there are any extra ones open.

mystic shell
#

its doing it with literally all of my commands, and no i only have the one open

west spoke
#

Ah

mystic shell
#

this is literally the worst bug i have ever encountered, i think my program might be haunted

hushed berry
#

do both stop if you turn off the bot @mystic shell

idle basalt
#

you might have two instances running

west spoke
#

^

idle basalt
#

or two message events

mystic shell
#

ive checked both of those, they arent the issue

idle basalt
#

nik, the reason you regex your token is because shit happens and its only a few characters of code to fix

west raptor
#

@mystic shell if it isnt the code there is some background process running I assume

#

are you using node?

mystic shell
#

yeah

west raptor
#

kill all node processes

#

if that doesnt work can you show what's starting your bot or the file

mystic shell
#

im programming my bot on repl.it, im on a chromebook so i can't do it locally

west raptor
#

oh

#

can you show the main file then? (app.js, index.js,..)

mystic shell
#

yeah i just stopped running the code and now im gonna wait like 5-10 mins to see if the bot will go offline like it should

#

if it doesnt then thats concerning because it means the code is somehow being run from somewhere else