#development

1 messages · Page 1004 of 1

solemn latch
pale vessel
#

we know

quartz kindle
#

you want to find its index?

earnest phoenix
#

Yea

solemn latch
#

still passing

cinder patio
#

.findIndex

digital ibex
#

my one still isn't finished sad

quartz kindle
#

you need to find 2 indexes then

plush oar
#

Where can I host my bot 24/7 of BDFD (Bot designer for discord)

earnest phoenix
#

Is that a plain function @cinder patio

cinder patio
#

yea

plush oar
#

Where can I host my bot 24/7 of BDFD (Bot designer for discord)

earnest phoenix
#

Oh lemme see

quartz kindle
#

@plush oar idk, nobody here uses bdfd

cinder patio
#

Though you'll have to create your own to get multiple indexes like Tim said

digital ibex
#

my one is still cloning F

green kestrel
#

@plush oar please dont spam your bot invite here

plush oar
#

btw on my bot when u say !order ill give you a peak what happends

green kestrel
#

its not the appropriate channel

misty sigil
#

or server

plush oar
#

with photos

solemn latch
#

lol

green kestrel
#

bot designer for discord bots can only be hosted on their platform, which you top up by viewing ads

#

you cant take them away and host them anywhere else

plush oar
#

REEEE

green kestrel
#

theyre in a bespoke programming language... if you can call it that

quartz kindle
#

thats why i said nobody here uses bdfd lol

plush oar
digital ibex
#

dude

surreal sage
#

How to fetch a message with cycling thru channels

plush oar
#

lol ignore the 3 and the £

prime cliff
#

@plush oar you probably should not make a fast food delivery bot tbh, tons of works with little reward, there is already a big bot that does this and discord likes to flag down users that join servers too quickly

green kestrel
#

yeah

#

it gets their "delivery" users banned or limited

quartz kindle
#

what does it even do

green kestrel
#

a user places an order, the mods of the bot go to that server via an invite to "deliver" an image of some food

quartz kindle
#

lol wut

green kestrel
#

yeah, i dont get it either

plush oar
#

bruh

digital ibex
#

tf

plush oar
#

do u not know "roleplay"

green kestrel
#

sure, but this is a lot of effort to roleplay being something you can get paid for irl

quartz kindle
#

heard of it, but i dont practice it

green kestrel
#

for me roleplay means loading up skyrim or fallout 4

#

or at most, getting out some dice

#

😄

solemn latch
#

Oh good you didn't say 76

green kestrel
#

of fork no

#

76 can do one

#

i never even bought it

#

actually just bought no mans sky today on steam summer sale, 50% off

digital ibex
#

guys, quick question

green kestrel
#

apparently its better now (nms) now the fuss has died down and theyve patched it

digital ibex
#

how can i make a script to start both folders at the same time?

#

like in the package.json scripts thing

prime cliff
#

WaitWhat you don't "start" folders

green kestrel
#

if it was me, i would have dashboard and bot as completely separate repositories, in separate accounts, just sayin'

plush oar
#

lol idk what to put as my long desc on my BOT on https://top.gg LOL

digital ibex
#

yeah, they are

cinder patio
#

I have them as different branches, not sure if that's a good idea

green kestrel
#

@plush oar think keywords that will get you listed in searches, "delivery", "roleplay", "fast food" etc, and maybe say something like "better than <competitor bot name>"

#

that way anyone searching for <competitor bot name> gets your bot in their results

digital ibex
#

i mean something like

plush oar
#

wtf

digital ibex
#

how can i make a script in a package.json file to start everything at once, what i do now is open 2 separate consoles ( because its beta ) and run it separately

plush oar
#

my bot excists?

#

uh

digital ibex
#

how can i start the two at once? if anyone knows

rustic ridge
#

in the main property

plush oar
#

uh

rustic ridge
#

in the command

#

like run a shortcut

digital ibex
#

the file contans: json { "scripts": { "start": "./" } }

rustic ridge
#

to bth files

cinder patio
#

You can do this using node or batch

rustic ridge
#

or a bat file

plush oar
#

OH

digital ibex
#

i done it before, but it was erroring

#

2 secs, lemme show u

rustic ridge
#

bat file sounds easiest to me

digital ibex
#

this happens

#

no idea why

quartz kindle
#

one option is to use pm2

green kestrel
#

no, your bot is awaiting approval @plush oar

cinder patio
#

That's because of FS, not sure how the thing's called but

digital ibex
#

i dont want to use pm2 as it takes too much memory

cinder patio
#

Ah,

digital ibex
quartz kindle
#

@digital ibex that happens because when you start your a process from another folder, all relative paths will be based on where you started the script from, not where the script is located

digital ibex
#

thats what happens with the dashboar dwhwn i try to start

#

oh

#

how can i change that?

#

like make it not error

cinder patio
#

yeah provide absolute paths using __dirname

digital ibex
#

o ok

cinder patio
#

Or

quartz kindle
#

there should be a command line option

#

idk which one

digital ibex
#

i done ```json
{
"scripts": {
"start": "node __dirname ./bot/src/bot.js & nodemon __dirname ./dashboard/src/app.js"
}
}

amber fractal
#

that's not how that works I dont think

digital ibex
#

wait for the bot i get Error: Cannot find module 'C:\Users\Aneesah\Desktop\Lost\__dirname'

#

oh

cinder patio
#

No you use it in your code,

fs.something(`${__dirname} + relative path`)
green kestrel
#

^^

digital ibex
#

put that in the package.json file?

amber fractal
#

no

#

where you read files

digital ibex
#

oh

quartz kindle
#

pm2 has a cwd option to set the base directory from where to start the process in, idk about nodemon

#

wait you're using npm to start

digital ibex
#
fs.readdirSync(`${__dirname}./commands/`)
``` i was doing before: fs.readdirSync('./commands'); btw
#

so it would be like that?

cinder patio
#

You'll want to remove that dot

digital ibex
#

oh ok

woven sundial
#

I'm trying to get information out of a Json api. The website is using cloudflare.
my code to request :

 request('https://corporateclash.net/api/v1/districts.js', { json: true }, (err, res, body) => {
APP CODE
});```
error code :
```json
'cf-error': 'user-agent not supplied.'

how can I supply a User-Agent ?

package used : Request
Discord.js

quartz kindle
#

you can set a user agent in the headers

woven sundial
#

and how do I know what user-agent do I need?

quartz kindle
#

you dont

#

you can supply a random user agent and see if it works

#

if it doesnt, try using a browser-specific user agent

#

for example copy and paste google chrome's user agent

digital ibex
#

wait, this could mess my paths up right? because im hosting it on my pc, windows, where my host is a linux?

#

or won't it do nothing

woven sundial
#
request('https://corporateclash.net/api/v1/districts.js', { json: true }, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" } (err, res, body) => {
#

like that?

quartz kindle
#

yeah

sudden geyser
#

I think you're missing a comma

woven sundial
#

yep indeed ty

#

here

sudden geyser
#

si

quartz kindle
#

shouldnt headers be inside options tho

#

{ json: true, headers: {...}}

woven sundial
#

oh gotcha

blazing ravine
#

s

woven sundial
#

it work ty @quartz kindle!

blazing ravine
#

guys

#

how to skip guild who not give permission to the bot for fetch invite

earnest phoenix
#

filter

#

?d

blazing ravine
#

what xd

earnest phoenix
#

Nvm

blazing ravine
#

idk how to skip

cinder patio
#

check if your bot has that permission before fetching the invites

#

return

blazing ravine
#

my bot is in 32 servers

#

idk how t oskip guilds who not give perms

quartz kindle
#

add a filter before the forEach

earnest phoenix
#

^

quartz kindle
#

guilds.cache.filter(g => check if it has permissions here).forEach()

blazing ravine
#

@quartz kindle can u tell me bcs idk xd brain dead

#

8 hours trying but in clieant.on(ready)

#

idk how

#

client*

solemn latch
#

He just have the code

#

And checking perms can be found on the docs

blazing ravine
#

@quartz kindle

#

like this ?

quartz kindle
#

no...

blazing ravine
#

xd

#

tell me pls

quartz kindle
#

you dont know how to check permissions?

blazing ravine
#

nop

#

in client.on("ready", async () idk how

small prairie
#

g.me.permissions.has ig

quartz kindle
#

^

blazing ravine
solemn latch
small prairie
#

sighs im not allowed to spoonfeed so sorry :/

blazing ravine
#

¯_(ツ)_/¯

solemn latch
#

Has is a method

blazing ravine
#

😦

#

can some1 help me

solemn latch
#

On the docs it explains the method has

small prairie
#

^

quartz kindle
#

you gotta specify which permissions you wanna check for lol

blazing ravine
#

bro rlly idk how can u edit the code for me pls if u have time

quartz kindle
#

code is not smart, code is very stupid actually, you need to tell your code EXACTLY what you want, it cant guess for you

blazing ravine
#
    g.fetchInvites().then(guildInvites => {
      invites[g.id] = guildInvites;
    });
    });```
#

xd

quartz kindle
#

also that extra .cache there is wrong

small prairie
#

no offense but did you take this code of a git rep?

solemn latch
#

Then under methods, click has

misty sigil
#

hey

#

any idea how I can make my userinfo command respond to names and nicknames

small prairie
#

i use commando's member arg off the git try doing that :/

misty sigil
#

Not what I was looking at

obtuse jolt
#

how can I make this an async function

client.queue = new Queue(function (input, cb) {})```
small prairie
#

i think

solemn latch
#

async function

small prairie
#

this should do the trick afaik

obtuse jolt
#

lol i figured it out

small prairie
#

lol

obtuse jolt
#

big brain time

small prairie
#

lol

lost herald
#

how would i, in discord.py generate an image with text on it and send it

opal plank
#

Tkinter is quite decent

misty sigil
#

any idea how I can make my userinfo command respond to names and nicknames

lost herald
#

i can use tkinter for that?

opal plank
#

depends on what you want to do

blazing ravine
opal plank
#

Read the error

lost herald
#

i wanna send a black image with text on it using a custom font

blazing ravine
#

yes

opal plank
#

its telling you right away what it error'd

misty sigil
#

M I S S I N G P E R M I S S I O N S

blazing ravine
#

how to skip the guilds who not give permission to the bot

#

i knowww

solemn latch
#

I gave you the page explaining how to use has

blazing ravine
#

but idk how to skip guilds who not give permission

opal plank
#

check for perrmission and send when it does

blazing ravine
#

-_-

#

idk how

opal plank
#

if(perm) do

solemn latch
blazing ravine
#

in client.on ready

#

not work

opal plank
#

i dont see whats the issue

blazing ravine
opal plank
#

what are you even trying to do]

blazing ravine
#

cant fetch invites

solemn latch
#

Your using has wrong

misty sigil
#

why does your bot need invite perm

blazing ravine
#

when

#

someone join

#

]

#

showing

#

inviter.tag

lost herald
#

ping me if anyone has any ideas bout my problem

blazing ravine
#

invites uses

opal plank
#

why is your bot logging all guild invites when it starts?

blazing ravine
#

idk

#

i see this code

#

in github

opal plank
#

.......

blazing ravine
#

and how to make new

#

xd

#

u help me ;d ?

opal plank
#

i have aboslutely no idea how 50% of people here managed to get bot developer role

solemn latch
#

So you don't know why you are writing what you are?

misty sigil
#

same @opal plank, same

solemn latch
#

Code from github @opal plank

misty sigil
#

I don't even know how I got here

opal plank
#

copy pasting code isnt developing

misty sigil
#

maybe because I made an actual bot.

solemn latch
lost herald
#

i made two actual bots owo

quartz kindle
#

having a basic bot that works is enough to get approved

opal plank
#

i see that

quartz kindle
#

otherwise this website would have 10x less bots in it xD

lost herald
#

im just tryna figure out new libraries

#

learning and getting experience

#

cant figure out the PIL library tho, can't seem to save a file

quartz kindle
#

i dont use py sorry

opal plank
#

im gonna end it here cuz this is getting offtopic, but still quite a shame to see this many people not knowing a lang

misty sigil
#

any idea how I can make my userinfo command respond to names and nicknames

opal plank
#

js?

misty sigil
#

yea

opal plank
#

fetch mentions on message

#

then use id

#

basically convert everything to id

misty sigil
#

nah, i was thinking plain text

quartz kindle
#

you can use members.fetch() with a query

#

.fetch({query:"abc",limit:1})

opal plank
#

name => fetch cache name
mention => regex <@!
id => copy this

#

isNaN for id

#

regex for mention

#

everything else try cache

misty sigil
#

aight

solemn latch
#

I think ima do a study on people asking for help here.
Give people the docs for the question they ask, if they don't understand still, I'll copy paste the example code from the doc and give it to them

opal plank
#

thats the general rule of no spoonfeeding

#

send them docs or snippet from docs

solemn latch
#

If they magically understand the exact same code just when a user says it, they are a help vampire

quartz kindle
#

and if they dont understand still?

opal plank
#

if they tried it, then give a bit more help

solemn latch
#

^

opal plank
#

spoonfeeding creates vampires

quartz kindle
#

post garlic emojis to send them away

solemn latch
#

I'm just going to be copy pasting from docs

opal plank
#

try and error and problem solving are skills required to be a dev

earnest phoenix
#

@opal plank mom allso did spoon feeding

#

is you vampire then?

#

soorry for offtopic

solemn latch
#

All kids are help vampires from their parents

#

Thats part of the deal CBPikaThink

potent dust
#

So uhh im new at making bots at C# using DSharp, I managed to get the bot latency using cmContext.Client.Ping, cmContext being CommandContext. How would I get the message response time?

obtuse jolt
solemn latch
#

A queue? BIGPOG

quartz kindle
#

nice

obtuse jolt
#

it finally works

quartz kindle
#

@potent dust message response time is usually obtained by manually measuring it

#

for example, get the current timestamp in milliseconds, and save it in a variable, then send the message

obtuse jolt
quartz kindle
#

once the message is successfully sent, compare the saved timestamp to the current timetsamp

obtuse jolt
#

@solemn latch yes I added a queue because of the virustotal api limits

#

its 4 requests max per minute

#

which also means i can add queue priority heh

quartz kindle
#

what if your queue grows faster than it resolves? lmao

#

imagine using your command and being told there are 3765 requests ahead of you in the queue

obtuse jolt
#

o god

earnest phoenix
#

could somebody help me make a bot pls pls!

misty sigil
#

yowch

#

@earnest phoenix what library

obtuse jolt
#

well i hope not but it shouldnt be a problem because its all in a database so it should get through it even if i restart it

viral spade
#

In a sharded mongodb cluster for a statistics bot with lots of user data, should i make

a) 1 guild collection, that contains all the data in arrays, including roles,members,channels and big statistics arrays textmessages,voiceminutes,...

b) 1 collection per all of these entities

also note i have to do lots of calculations on the data.

solemn latch
#

I would add a check if there's more than x things in the queue, dont add it to the queue

obtuse jolt
#

ahh yes i should do that

#

20 max?

solemn latch
#

20 max still is what 5 minutes waiting

#

Just to have the request sent

obtuse jolt
#

something like that

solemn latch
#

If you think users will wait that long

obtuse jolt
#

i mean it does say that its queued im gonna add a command to see your position in the queue too

earnest phoenix
#

Hello guys

solemn latch
#

Since you probably know the time exactly how long it'll take you could add that

obtuse jolt
#

thats why it gives the user their queue ID

#

it's like 1 request per 20 seconds

#

which is shit

#

but i cant do anytrhing about that

solemn latch
#

60/4 is 15

obtuse jolt
#

you right

#

i mean thats a bit better

solemn latch
#

15 seconds, if your 7th in queue it'll take 15*7 seconds, which will give users the estimated time

obtuse jolt
#

yeah

#

priority queue do be soundin nice doe

#

hehe

solemn latch
#

Priority for those who vote

#

ezpz

obtuse jolt
#

idk how to like handle votes tho

potent dust
#

once the message is successfully sent, compare the saved timestamp to the current timetsamp
Oh alright, im not so new to C# but I am for DSharp. Will try out doing that, thanks!

obtuse jolt
#

thats my problem

viral spade
#

In a sharded mongodb cluster for a statistics bot with lots of user data, should i make

a) 1 guild collection, that contains all the data in arrays, including roles,members,channels and big statistics arrays textmessages,voiceminutes,...

b) 1 collection per all of these entities

also note i have to do lots of calculations on the data.

solemn latch
#

the api makes it simple

obtuse jolt
#

I managed to get the queue working because I am rewriting the whole of the scan command

#

it will look so much better after

#

it will also be a lot more reliable

#

the current one works most of the time

#

this one should have a really low fail rate

#

i need to test if the queue keeps going even if i restart

potent dust
#

cmContext.Message.Timestamp oh i found out this exists :p

#

byeah

obtuse jolt
#

it doesnt

#

i can just add a queued restart so it restarts next time the queue is empty

worn niche
#

Hi, I want to do that when someone type "Meme" in chat, it'll show random meme from sitehttps ://www.memedroid.com/ and I can't figure how to do that. Even google don't have anwser.

#

in javascript

obtuse jolt
#

if you did that it would get muted in 99% of bot lists

worn niche
#

wdym?

solemn latch
#

Ideally it should be a command, not just the word meme

trim burrow
#

hello guys
i have made a bot
i need a code to set his status as listening
not streaming or anything

#

can any one help me ?

worn niche
#

Ideally it should be a command, not just the word meme
ik but for this moment I need it as world meme

obtuse jolt
#
client.user.setActivity("text", { type: "LISTENING" })```
#

@trim burrow

trim burrow
#

@obtuse jolt thank you bro

obtuse jolt
#

damn i actually need to add the scanning part to it soon

#

thats gonna suck

#

i need to finish this command first tho

worn niche
#

Hi, I want to do that when someone type "Meme" in chat, it'll show random meme from sitehttps ://www.memedroid.com/ and I can't figure how to do that. Even google don't have anwser. I'm doing it in javascript

obtuse jolt
#

why cant you just use reddit or something

#

and its funny because theres a lot more results if you just use something like reddit

marble scaffold
#

How do you create a levelling up system?

obtuse jolt
#

no pls dont

marble scaffold
#

Iq

#

Wdym

obtuse jolt
#

they are so annoying

marble scaffold
#

What are?

obtuse jolt
#

levelling up bots

marble scaffold
#

music bots are annoying :/

#

Smh

worn niche
#

How do you create a levelling up system?
@marble scaffold on yt are a lot of tutorials

obtuse jolt
#

but if you really want to here you go

#

idc about music bots i never use them

marble scaffold
#

You spend like hours to do the code

worn niche
#

you can always see github ready rojects

obtuse jolt
#

usually people do to flex on other devs that their sound quality is better

digital ibex
#

make your own ones

stark abyss
#

discord js

var limit = getRandomNumber(0, 3)
console.log(limit)
var hugUrl;
var response = await fetch("http://api.giphy.com/v1/gifs/search?api_key=[api]&limit=3&q=hug")    
.then(res => res.json())
.then(res => res.data[limit].url)
  console.log(hugUrl)
  const embed = new MessageEmbed()
  .setImage(hugUrl);

message.channel.send(embed)
#

how can I have it so that hugUrl is res.data[limit].url)

strong tundra
#

music bots are pretty easy to make

stark abyss
worn niche
#

music bots are pretty easy to make
ya

stark abyss
solemn latch
#

My first discord bot was a music bot

slender thistle
#

If you have a slightest idea of what you are doing, anything is, honestly

strong tundra
#

i just refactored this one music bot script to work with my framework is all

#

very very easy stuff

stark abyss
#

help

digital ibex
strong tundra
#

now i need to rewrite it to not use Javascript

stark abyss
#

discord js

var limit = getRandomNumber(0, 3)
console.log(limit)
var hugUrl;
var response = await fetch("http://api.giphy.com/v1/gifs/search?api_key=[api]&limit=3&q=hug")    
.then(res => res.json())
.then(res => res.data[limit].url)
  console.log(hugUrl)
  const embed = new MessageEmbed()
  .setImage(hugUrl);

message.channel.send(embed)
#

how can I have it so that hugUrl is res.data[limit].url)

slate gull
#

hi

digital ibex
#

hi

strong tundra
#

it looks like response is res.data[limit]url

stark abyss
#

ya

strong tundra
#

so you'd need to do something like let hugUrl = response

stark abyss
#

oh

#

ok ty

slender thistle
#

#createdby b

tawdry locust
#

stupid question, should you await database inserts/selects

cinder patio
#

doesn't usually matter

#

I mean, if you are getting stuff from it, yeah

#

but inserting.. up to you

marble scaffold
#

music bots are pretty easy to make
@strong tundra You say that, but it does depend on the quality

strong tundra
#

what

#

d.js literally does everything for you

#

just feed it a url and there you go

tulip ledge
#

Can u do .includes on an array?

solemn latch
#

Yes

obtuse jolt
cosmic gorge
#

sd

potent dust
#

So like, I want to send a message on the channel if a parameter isnt specified on a command. The thing is that I know how to send the message but I dont know how to verify is the parameter is null, I already tried doing a if statement to see if it is equals to null but it seems like it doesnt work

#

here is code for reference

#

(DSharp)

earnest phoenix
#

can someone help

#

i made a bot on py

#

it works

#

im tryna host on heroku

#

and get this error in cmd

#
error: update_ref failed for ref 'refs/remotes/heroku/master': cannot lock ref 'refs/remotes/heroku/master': unable to resolve reference 'refs/remotes/heroku/master': reference broken
Everything up-to-date
#

i reinstalled heroku clia

#

cli

#

checked update

#

and everythin

worn niche
#

hi again, I need help woth "meme" command. When I'm typing in chat "meme" (what is correct), it isn't showing what it have to show. No errors in chat and terminal.

client.on("message", message => {
  if (message.content === 'meme') {
    exports.run = async (client, message, args) => {
    try {
        const { body } = await snekfetch
            .get('https://www.reddit.com/r/dankmemes.json?sort=top&t=week')
            .query({ limit: 800 });
        const allowed = message.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
        if (!allowed.length) return sg.channel.send('It seems we are out of fresh memes!, Try again later.');
        const randomnumber = Math.floor(Math.random() * allowed.length)
        const MemeEmbed = new Discord.MessageEmbed()
        .setColor(0x00A2E8)
        .setTitle(allowed[randomnumber].data.title)
        .setDescription("Posted by: " + allowed[randomnumber].data.author)
        .setImage(allowed[randomnumber].data.url)
        .addField("Other info:", "Up votes: " + allowed[randomnumber].data.ups + " / Comments: " + allowed[randomnumber].data.num_comments)
        .setFooter("Memes provided by r/dankmemes")
        message.channel.send(MemeEmbed)
    } catch (err) {
        return console.log(err);
    }
  }
}
});
lusty quest
#

snekfetch is deprecated iirc

worn niche
#

so what to do?

#

sorry but I don't know english very well

lusty quest
#

node-fetch is the current one

#

(i litteraly use the same command and fixed it and updated it to the current stuff)

#

const { data } = await fetch('https://www.reddit.com/r/memeframe.json?sort=hot').then(response => response.json());this is the same but using node-fetch

worn niche
#

(i litteraly use the same command and fixed it and updated it to the current stuff)
@lusty quest what do you mean?

#

oh

lusty quest
#

also why did you just copy/pasted the command. it will not work

spare mirage
#

quick question:

#

if I make a command holder will this work? and how do I use my image feature? do I add all the code for (PREFIX + "image") to the command.js file or do I keep the code in the main file?

    name: 'ping',
    description: "this is a ping command!",
    execute(message, args){
        message.channel.send('pong!');
    }
}               ```
lusty quest
#

depends on how the command handler is coded

spare mirage
#

this above is the command handler

lusty quest
#

this is a command

#

not a handler

spare mirage
#
client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(command === 'ping'){
        client.commands.get('ping').execute(message, args);
    } 
});
#

this is the handler

lusty quest
#

yes but for a single file execution

spare mirage
#

? wdym?

#
const fs = require('fs');
 
client.commands = new Discord.Collection();
 
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
    const command = require(`./commands/${file}`);
 
    client.commands.set(command.name, command);
}
lusty quest
#

yes this is the handler

spare mirage
#

do you mean this?

#

ah ok

lusty quest
#

now every command you make is in its own file

#

inside the commands folder

spare mirage
#

I understand

lusty quest
#

you can actually handle the prefix in a message handler

spare mirage
#

?

lusty quest
#

something like this

#
  const args = message.content.slice(settings.prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();

    const cmd = client.commands.get(command);
    if (!cmd) return;
``` (its incomplete)
spare mirage
#

do I replace that with:

#

const fs = require('fs');

client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const command = require(./commands/${file});

client.commands.set(command.name, command);

}

#

?

lusty quest
#

no

#

both work together

#

the command handler loads the commands and the message handler executes them

spare mirage
#

do u NEED the command handler or is it optional?

lusty quest
#

its way cleaner if you have one

spare mirage
obtuse jolt
#

nice side bar

spare mirage
#

:P

#

always

lusty quest
#

it needs to run in the on message event

#

and like i said its not complete and copy / paste will not work out of the box

spare mirage
#

bot.on("message", function(message) {
so in here?

#

ik ik

lusty quest
#

yes

#

but why a function?

spare mirage
#

oops I have 2

#

bot.on('message', message=>{
and this for this

bot.on("message", function(message) {
 
    var parts = message.content.split(" "); // Splits message into an array for every space, our layout: "<command> [search query]" will become ["<command>", "search query"]
 
    /* Simple command manager */
    if (parts[0] === "b!image") { // Check if first part of message is image command
 
        // call the image function
        image(message, parts); // Pass requester message to image function
 
    }
 
});
#

^the image command

lusty quest
#

you dont need the command handler in there

#

since you have then 2

#

if everything works fine you have your image command in a extra file with the function

spare mirage
#

I can just add this

 var parts = message.content.split(" "); // Splits message into an array for every space, our layout: "<command> [search query]" will become ["<command>", "search query"]
 
    /* Simple command manager */
    if (parts[0] === "b!image") { // Check if first part of message is image command
 
        // call the image function
        image(message, parts); // Pass requester message to image function
  }

to ```bot.on('message'blablblalblabllba````

lusty quest
#

idk what you plan to do, it feels like you just Frankenstein a bot together

spare mirage
#

I plan to build a command handler

#

and yes Im making the most random command bot ever

lusty quest
#

yes but everything in the code is Random. like you search on Github for Node.js Bots and just copy/paste commands out of it

spare mirage
#

no I dont

lusty quest
#

but it feels like this. bcs the style is for some reason different every time you ask here

spare mirage
#

I get alot of information online though

lusty quest
#

i have nothing against it but you dont get some connections between stuff right

spare mirage
#

I do

#
bot.on("message", function(message) {
 
var parts = message.content.split(" "); 
blablabla```
I was stuck here (like really stuck, took me 4 hours to get this lmao and I asked discord multiple times) and used a pastebin that someone made ¯\_(ツ)_/¯
#

I dont like to copy

#

but I was done with wasting my whole day

lusty quest
#

what does this part should do?

spare mirage
#

? thats not correct english

#

but ok

#

ill try to explain

#
 
    /* Simple command manager */
    if (parts[0] === "b!image") { // Check if first part of message is image command
 
        // call the image function
        image(message, parts); // Pass requester message to image function
``` this part takes the 1st agrument from !image so the 1st argument would be **cookies** here: b!image **cookies** 
it chages the function image(message) some part of this function here: ``` var options = {
        url: "http://results.dogpile.com/serp?qc=images&q=" + search,
        method: "GET",
        headers: {
            "Accept": "text/html",
            "User-Agent": "Chrome"
        }
    }; ``` It changes search to the 1st argument and the api will search and randomly pick an url and send 

message.channel.send( urls[Math.floor(Math.random() * urls.length)]);

#

@lusty quest

#

disclaimer: this is what I see and the explanation is probably shi

#

am I correct?

trim burrow
#

hello guys
can you give me antispam code ?

slender thistle
#

We don't spoonfeed code in this server

obtuse jolt
spare mirage
#

wait whats that?

#

@obtuse jolt

obtuse jolt
#

virus total discord bot

whole magnet
#

A virus total bot? Thats pretty sick

obtuse jolt
#

i just added a feature that queues files and urls for scanning instead of spamming the api

#

its taken me ages

#

but it looks AMAZING

spare mirage
#

does it scan the file/links for virusses?

obtuse jolt
#

yeah

whole magnet
#

Which library did you make it in?

spare mirage
#

thats cool

obtuse jolt
#

it even has auto url and file scanning

#

it was made in discord.js

spare mirage
#

ur such a bigbrain

#

||compared to me||

obtuse jolt
#

yeah i'm just waiting for it to be approved into here

#

its been accepted into 1 so far

#

its taking ages

#

no denies tho

#

just taking ages

#

im really excited to release that update its a prototype at the moment

#

im still making it

knotty sigil
#

does someone knows how can i log the user that deleted the message?

whole magnet
#

ngl that is pretty awesome,

obtuse jolt
#

ive so far only finished the url scanning

knotty sigil
#

.addField(`Deleted by:`, what i need to put )

obtuse jolt
#

but its getting done fast

spare mirage
#

if someone sends me a sucpisious link

obtuse jolt
#

@knotty sigil there isnt 1 line you have to call the event then log it

spare mirage
#

I use that bot

#

and scan it?

obtuse jolt
#

Yeah

#

thats exactly why i made it

#

so that people could scan sketchy dm links

#

and files

whole magnet
#

Yeah I can actually see use in it, opposed to most of the bots I make being based around pure bullshittery

quartz kindle
#

if the owner deletes the message, there isnt any event log. but if someone else deletes it, it will create an entry in the event logs, so you need to fetch event logs to get it

obtuse jolt
#

im hoping once it gets into here it will start to get servers because its only in 9 rn

spare mirage
#

@obtuse jolt can I use that for my server?

whole magnet
#

Ill add it to my server if you've got an invite?

spare mirage
#

ur bot?

obtuse jolt
#

yeah!

#

dm me if you want the link

spare mirage
#

just dm me an ivite link

obtuse jolt
#

i dont think i can send it here

hoary elm
trim burrow
#

@knotty sigil you need the deleted message log ?

opal plank
#

theres an event emitted

#

log onto that

knotty sigil
#

but if i do author.tag it will show the one who made the massage and not the one who deleted it @hoary elm

trim burrow
#

@knotty sigil try this but you need a room with name log

client.on('messageDelete', message => {  
    if(message.author.bot) return;
    if(message.channel.type === 'dm') return;  
    if(!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return;  
    if(!message.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return;  
 
    var logChannel = message.guild.channels.find(c => c.name === 'log');  
    if(!logChannel) return;  
 
    let messageDelete = new Discord.RichEmbed()  
    .setTitle('**[MESSAGE DELETE]**')  
    .setColor('RED')  
    .setThumbnail(message.author.avatarURL)  
    .setDescription(`**\n**:wastebasket: Successfully \`\`DELETE\`\` **MESSAGE** In ${message.channel}\n\n**Channel:** \`\`${message.channel.name}\`\` (ID: ${message.channel.id})\n**Message ID:** ${message.id}\n**Sent By:** <@${message.author.id}> (ID: ${message.author.id})\n**Message:**\n\`\`\`${message}\`\`\``)
    .setTimestamp()  
    .setFooter(message.guild.name, message.guild.iconURL)  
 
    logChannel.send(messageDelete); ```
opal plank
#

spoonfeeding at its finest

hoary elm
#

Indeed spoonfeed

opal plank
#

this is what you should probably tell them. Check MESSAGE_DELETE event emitted and see the snippets in the example using it

hoary elm
#

I mean what I sent was pretty much the same explanation just via Reddit

opal plank
#

always send them docs

#

docs is your trusty source of information for anything you do coding wise

#

if they cant read the docs, then give a more summarized explanation, but coding without knowing how to read docs is a huge set-back

hoary elm
#

Don’t really need to explain that to me 👌 but yeah I understand

trim burrow
#

how can i add invite logs (with invites counter and inviter) plz ?

final gate
#

Is there a solution to reduce the API

pure lion
#

how can i add invite logs (with invites counter and inviter) plz ?
@trim burrow database

hoary elm
#

how can i add invite logs (with invites counter and inviter) plz ?
@trim burrow fetch the invites and store them in.. an object or database or something of the sort there should be a detailed guide for it around somewhere just look on google

final gate
#

Is there a solution to reduce the APIIRface

slender thistle
#

Reduce what

hoary elm
#

Yeah what about the API

slender thistle
#

You don't "reduce" an API

pure lion
#

what does that even mean

final gate
#

There is pressure on it and the higher the API compression, the bot is restarted @slender thistle @hoary elm

slender thistle
#

So "reduce the load on the API"

final gate
#

Explain more @slender thistle

slender thistle
#

I wish I myself understood what you are asking

#

but well, ratelimits sound like what you want

final gate
#

😂

earnest phoenix
#

such thing as reducing an api does not exist nor does it make any sense

slender thistle
#

... unless it means "reducing the amount of functionality an API provides"

#

which doesn't not make sense

final gate
#

yes

earnest phoenix
#

that can be said about any tern lol

#

term*

slender thistle
#

True

final gate
#

I mean is there a solution to reduce API consumption

slender thistle
#

If it's your API - implement and enforce ratelimits
If it's an API you use - enforce local ratelimits, either through local limit or dynamically

spare mirage
#

Hi! one question
I am making a command handler
if I want to make an command that sends an embed do I add the embed code

    .setColor('#d29e04')
etc.```
#

to the commandname .js

#

or do I leave it in bot.on('message', message=>{

opal plank
#

everything on the code will be on the command file

#

aka the commandname.js

#

on your index.js you'll only execute the file(which contains the code)

spare mirage
#

ah I get it

knotty crane
#

:))

slender thistle
#

@knotty crane Firstly, no. Secondly, no. Thirdly, no.
As for the rest of the reasons, wrong channel and that's not true

knotty crane
#

Some one told me that is true sorry

slender thistle
#

To say nicely, that's complete... bullshit

#

Please refrain from spreading such messages in the future

#

Thank you for understanding 👍

spare mirage
#

so just making sure @opal plank the commandname.js will be:

    name: 'ping',
    description: "this is a ping command!",
    execute(message, args){
    let botping = message.createdAt - new Date()
    let apiping = bot.ws.ping
    
    const embedping = new Discord.MessageEmbed()
    .setColor('#d29e04')
    .setTitle('Ping :banana:')
    .setAuthor('Banana')
    .setDescription(':ping_pong: Pong!')
    .addField(`blablabla`)
    .addField('ur dinner today', 'bananas', true)
    .setTimestamp()
    .setFooter('Justii :3')
        message.channel.send(embedping);
    }
}```and it would send the embed?
#

if I execute it

pine bear
#

I need a little help. . .

Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\catra\OneDrive\Desktop\my discord bot> npm install
npm WARN my-discord-bot@1.0.0 No repository field.

audited 15 packages in 1.991s
found 0 vulnerabilities

PS C:\Users\catra\OneDrive\Desktop\my discord bot> node .
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module 'dotenv'
Require stack:
- C:\Users\catra\OneDrive\Desktop\my discord bot\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)        
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at Object.<anonymous> (C:\Users\catra\OneDrive\Desktop\my discord bot\index.js:1:1)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\catra\\OneDrive\\Desktop\\my discord bot\\index.js' ]    
}
PS C:\Users\catra\OneDrive\Desktop\my discord bot> npm dotenv -v
6.14.5
``` this made no sense.
spare mirage
#

does this use an api?

#

Cannot find module 'dotenv' probably something wrong in ur code

#

:P

lusty quest
#

@pine bear npm i dotenv

surreal sage
#

i forgot how to fetch a channel out of a guild category

worn niche
#

Hi, is there any way to get all members status (lik: online, don't disturb and idle) to one count?
I have this but I can't find thing what will add users with these status into one count:

const totalOnline = fetchedMembers.filter(member => member.presence.status === 'online');
     const totalIdle = fetchedMembers.filter(member => member.presence.status === 'idle');
     const totalDND = fetchedMembers.filter(member => member.presence.status === 'dnd');
     const totalOffline = fetchedMembers.filter(member => member.presence.status === 'offline');

spare mirage
#

npm i --save dotenv*

surreal sage
#

category.children.get() right?

potent dust
#

Making everything on index.js is bad? Like everything in only one file, all commands and such. If so, I'd like some explanation of why

pine bear
#

okay, not I gotta get a correct token

spare mirage
#

@lusty quest can u check my message above catra c'yra s message?

lusty quest
#

just start the bot and see if it works

#

this is how i do it

worn niche
#

Making everything on index.js is bad? Like everything in only one file, all commands and such. If so, I'd like some explanation of why
@potent dust why not all commands in index.js file?

spare mirage
#

its not bad

#

its just more organised

lusty quest
#

bcs you can loose track

#

having a command handler will make things way easyer

opaque hawk
#

Why does this return an Object is possibly null error?

if(!prefixes[message.guild.id]) {
    prefixes[message.guild.id]
  }```
worn niche
#

Hi, is there any way to get all members status (lik: online, don't disturb and idle) to one count?
I have this but I can't find thing what will add users with these status into one count:

const totalOnline = fetchedMembers.filter(member => member.presence.status === 'online');
     const totalIdle = fetchedMembers.filter(member => member.presence.status === 'idle');
     const totalDND = fetchedMembers.filter(member => member.presence.status === 'dnd');
     const totalOffline = fetchedMembers.filter(member => member.presence.status === 'offline');

lusty quest
#

@potent dust its not bad just can end be pretty inefficent, You will get spagetti code at one point

cinder patio
#

it's cause prefixes may be null, check if it's null first

potent dust
#

Oh alright, its bc my friend is doing that and I just couldnt explain why it is kind of unorganized

opaque hawk
#

Here I define prefixes: js let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"))

cinder patio
#

You're using typescript right?

opaque hawk
#

Correct

cinder patio
#

Define an interface for the object

opaque hawk
#

ok

spare mirage
sudden geyser
#

You're missing a } after your if

cinder patio
#
interface Prefixes {
   [key: string]: Object
}

let prefixes: Prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"))
opaque hawk
#

alr thanks

spare mirage
#

@sudden geyser no im not

sudden geyser
#

How so

spare mirage
#

or am I blind

opaque hawk
#

You are blind

spare mirage
#

I reall am blind

#

where is it lmao?

worn niche
#

Hi, is there any way to get all members status (online, don't disturb and idle) to one count?
I have this but I can't find thing what will add users with these status into one count:

const totalOnline = fetchedMembers.filter(member => member.presence.status === 'online');
     const totalIdle = fetchedMembers.filter(member => member.presence.status === 'idle');
     const totalDND = fetchedMembers.filter(member => member.presence.status === 'dnd');
     const totalOffline = fetchedMembers.filter(member => member.presence.status === 'offline');

opaque hawk
#

That }); at the bottom should be assigned to your bot.on message

spare mirage
#

ahh

#

makes sense

opaque hawk
#

It still turns up with the "object is possibly null" error

cinder patio
#

Cnnn, you could use one for loop

tepid canyon
#

@worn niche put .size on the end of each?

opaque hawk
#

I am using repl which is buggy atm, imma see if anything happens in vscode

cinder patio
#

Refresh the page

opaque hawk
#

I already did

cinder patio
#

alright then try with vscode

opaque hawk
#

ok

cinder patio
#

or just do if (prefixes && !prefixes[...]) {...

worn niche
#

@worn niche put .size on the end of each?
@tepid canyon I have other fetchedMembers.filter for doing all avaible members, what should I do?

tepid canyon
#

All the members in the guild?

worn niche
#

yes

tepid canyon
#

You don't need a filter for that

worn niche
#

oh wait

#

I readed it worng

#

I mean all users with status online, idle, dnd

spare mirage
#

what?

worn niche
#

I mean all users with status online, idle, dnd
into one count like:
All avaible members:
all avaible memers

tepid canyon
#

const totalAvailable = fetchedMembers.filter(member => member.presence.status !== 'offline').size;

spare mirage
lusty quest
#

install discord.js

spare mirage
#

how is it gone?

#

nps i --save discord.js right?

lusty quest
#

did you deleted the node_modules folder?

worn niche
#

const totalAvailable = fetchedMembers.filter(member => member.presence.status !== 'offline').size;
@tepid canyon I'll try

lusty quest
#

yes

worn niche
#

const totalAvailable = fetchedMembers.filter(member => member.presence.status !== 'offline').size;
@tepid canyon it says: undefeined

opaque hawk
#

aaaaaaaaaaaaaaaaaaand it still shows the object is possibly null even in

#

even in vscode

spare mirage
#

I dot think I did?

#

I just deleted some folders in the folder to delete some apis

tepid canyon
#

does it work for your other 4 where you filter online/idle etc @worn niche

#

because if it doesnt work for that it most likely aint working for the other ones then

worn niche
#

does it work for your other 4 where you filter online/idle etc @worn niche
I'll give ss here

tepid canyon
#

ok

worn niche
#

Code:

client.on("message", message => {
  if (message.content === "SMChecker")
   message.guild.members.fetch().then(fetchedMembers => {
     const totalOnline = fetchedMembers.filter(member => member.presence.status === 'online');
     const totalIdle = fetchedMembers.filter(member => member.presence.status === 'idle');
     const totalDND = fetchedMembers.filter(member => member.presence.status === 'dnd');
     const totalOffline = fetchedMembers.filter(member => member.presence.status === 'offline');
     const count = fetchedMembers.filter(member => member.presence.status !== 'offline').size;
     // We now have a collection with all online member objects in the totalOnline variable
     const SMCheckerEmbed = new Discord.MessageEmbed()
    .setColor('#0099ff')
  .setTitle('Online Members')
  .setDescription('***Status:***')
    .addFields(
    { name: 'Online:', value: `${totalOnline.size} "online" members`, inline: true},
    { name: 'Idle:', value: `${totalIdle.size} "idle" members`, inline: true},
    { name: 'Do not disturb:', value: `${totalDND.size} "do not disturb"\nmembers`, inline: true},
    { name: 'Offline:', value: `${totalOffline.size} "offline" members`, inline: true},
    { name: 'Total Avaible Users (alpha):', value: `${count.size} avaible members`, inline: true},
    )
    .setTimestamp()

 message.channel.send(SMCheckerEmbed);
})
});
misty sigil
#

how do i fix this

errant perch
#

jeremy clarkson is inside me

misty sigil
#

yes

opaque hawk
#

Put code into a hastebin @worn niche

misty sigil
#

do i fix it using cloudflare

spare mirage
#

how is bot not defined

#

its a const

tepid canyon
#

remove .size then i suppose and it should be fine @worn niche

worn niche
#

ye, but it'll show offline members

errant perch
#
      var user = message.mentions.users.first() || message.author;
      var embed = new Discord.MessageEmbed()
        .setTitle("User Information")
        .setThumbnail(user.avatarURL)
        .addField("Player Name", user.username)
        .addField("Current Server", message.guild.name)
        .addField("Current Role ", user.guild.roles.highest.name)
        .addField("User ID ", `${user.id}`)
        .setColor(0xffa500);
      message.channel.send(embed);
      break;```

I'm getting "Cannot read property 'roles' of undefined"
tepid canyon
#

Remove .size from the const count

spare mirage
opaque hawk
#

So that null error over there still exists but this line doesnt return any errors for some reason

#

let prefix = prefixes[message.guild.id].prefixes;

spare mirage
#

uhhh

worn niche
#

okay, problem fixed. I was just having ${count.size} and not ${count}. But thanks for wasting your time @tepid canyon . ❤️

spare mirage
#

ok I dont understand

tepid canyon
#

you could of kept count.size you just needed to remove .size from the const

spare mirage
#

people say "a command handler is easy"

#

erm

tepid canyon
#

If youre new it will of course take some time

errant perch
#

So it's gotta find the user inside of the guild then find the role?

spare mirage
#
bot.on('message', message=>{
    if(!message.content.startsWith(PREFIX) || message.author.bot) return;

    const args = message.content.slice(PREFIX.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(message.content.startsWith(PREFIX + "ping")) {
        bot.commands.get('ping').execute(message, args);
    }``` this has to execute ping.js right?
#

oh really?

pure lion
#

Where

spare mirage
#

I dont know

#

¯_(ツ)_/¯

sudden geyser
#

can you show us your ping file

spare mirage
#

right?

#

Iok

sudden geyser
#

yes the issue is you're doing bot.ws.ping, but bot was never declared in the scope.

#

Are you sure the execute function will have those three values

spare mirage
#

how do I declare it? do I just add const bot = new Discord.Client();

opaque hawk
#

I fixed my problem

sudden geyser
#

no

opaque hawk
#

use the non-null assertion thingy

#

!

spare mirage
#

I did but

sudden geyser
#

Use the single instance you created in your index file

spare mirage
#
    if(!message.content.startsWith(PREFIX) || message.author.bot) return;

    const args = message.content.slice(PREFIX.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(message.content.startsWith(PREFIX + "ping")) {
        bot.commands.get('ping').execute(bot, message, args);```
#

still gives an error

golden condor
#

You can do message.client.ws.ping

pure lion
#

Why not client.ws.ping

spare mirage
#

reeeee

#

I have that

#

oohhh

#

loll

#

fixed :p

golden condor
#

@obtuse jolt which one

obtuse jolt
#

i want it to search through all of it to see if the users id already exists in there

#

so that they can only do it once

spare mirage
#

why is the bot ping 900? I run the bot on this device

surreal sage
#

what is the property of the channels in a category

misty sigil
#

does

#

cloudflare fix ssl errors

surreal sage
#

nO

quartz kindle
#

@obtuse jolt if you need searching, perhaps converting everything to an array of objects would be better

green kestrel
misty sigil
#

good work

#

but why 4 shards

green kestrel
#

because the default of 10 for my framework was overkill? 😄

quartz kindle
#

lmao

misty sigil
#

why shard at that point

earnest phoenix
#

why is the bot ping 900? I run the bot on this device
@spare mirage because it is

green kestrel
#

shards cost me nothing, so i just enable them as default and not worry about it if for some reason i get a massive spike in invites

misty sigil
#

thats a good point actually

surreal sage
#

what is the property of the channels in a category

misty sigil
#

ok how do i shard

green kestrel
#

well i say nothing, what i mean is they have so little cost as to not be noticable, and it means that theres less interruption to as many servers when it receives opcode 7

livid rivet
#

@peak parcel in what language are you coding your bot?

pure lion
#

ok how do i shard
@misty sigil docs I believe

green kestrel
#

well depending on your platform and language, shards most definitely wont cost you nothing

misty sigil
#

jk

green kestrel
#

😛

spare mirage
#

@earnest phoenix yes bit the bot is running on my pc so it should be VERY LOW right? or do I connect to the discord servers and after that to my bot?

misty sigil
#

no

earnest phoenix
#

no

peak parcel
#

@livid rivet I have 0 experience in coding. I've just been looking around for cool bots and stuff and stumbled here.

earnest phoenix
#

It's your connection

green kestrel
#

no it wont be very low, the ping has to go to the discord websocket and back via REST

spare mirage
#

yes my connection trash

misty sigil
#

thats just how the client.ws.ping wants to be

spare mirage
#

20kbs ps

#

:/

livid rivet
#

okay are you fluent or at least beginner in any language?

green kestrel
#

so its 2x your connection latency plus any discord api overhead

spare mirage
#

who @livid rivet?

pure lion
#

How to shard:
Smash your server boi

spare mirage
#

I am very begginer

livid rivet
#

not you, FRX

placid iron
#

Doesn't it say to only shard after 1000 servers?

peak parcel
#

@livid rivet Nah i'm not and its not something I am interested in starting. Just looking to find and add new bots to my server.

misty sigil
#

How to shard:
Smash your server boi
@pure lion H A M E R T I M E

green kestrel
#

@misty sigil mind if i ask why the username? the guy is a legend. i have a boss that looks a lot like him

misty sigil
#

wdym

surreal sage
#

what is the property of the channels in a category

green kestrel
#

jeremy clarkson lol

spare mirage
#

@peak parcel If u try to learn coding actually learn it (try to understand) and dont copy paste from yt vids

earnest phoenix
#

Ma boi jeremy

misty sigil
#

just kinda like top gear tbh

spare mirage
#

thats my experience trying to learn coding so far

#

:P

#

makes it way more fun

hoary elm
#

@livid rivet Nah i'm not and its not something I am interested in starting. Just looking to find and add new bots to my server.
@peak parcel for adding bots to your server you can find a list of bots that have been approved here on the http://top.gg website if you want to learn to code well where you start depends on the Lang you want to use

errant perch
#

how do i convert miliseconds to days in discord.js

livid rivet
#

@peak parcel oh lmao... then go on the webssite and search for bots with DM on join

green kestrel
#

@misty sigil to shard first you need purples.

misty sigil
#

purples

green kestrel
#

then you shard the purples

misty sigil
#

yes

obtuse jolt
#

@quartz kindle i have this now

[{"user":"X Æ A-Xii#0002","userid":"551854789990940699","channelid":"726960119929241631","type":"ip","input":"8.8.8.8","isautoscan":false,"priority":false},{"user":"X Æ A-Xii#0002","userid":"551854789990940699","channelid":"726960119929241631","type":"ip","input":"8.8.8.8","isautoscan":false,"priority":false},{"user":"X Æ A-Xii#0002","userid":"551854789990940699","channelid":"726960119929241631","type":"ip","input":"8.8.8.8","isautoscan":false,"priority":false}]```
#

how can i search through that

spare mirage
#

is it an good idea to give our ur clientid? to let people make invites?

misty sigil
#

yes

peak parcel
#

@livid rivet Cheers mate

misty sigil
#

obviously

spare mirage
#

ok thats a no

misty sigil
#

i can access clientID easily

green kestrel
#

youll need to if you want anyone to invite your bot, but you can find it if anyone can see your bot online, its same as your bots snowflake id

misty sigil
#

just rightclick and then copy id

spare mirage
#

oh lol

errant perch
#

how do i convert miliseconds to days in discord.js
@errant perch help it shows my account is 9 quintillion miliseconds old

spare mirage
#

with dev mode?

misty sigil
#

yes

green kestrel
#

its amazing the amount of 'private' bots ive invited, where people didnt tick 'private bot' and just assumed without an invite link, i couldnt. i just made one with their snowflake id and permissions as minimal as possible

#

i mean on my own servers not here

hoary elm
#

😂😂

placid iron
hoary elm
#

Usually helps if you enable that

misty sigil
#

lmao

green kestrel
#

yeah

misty sigil
#

so sad that luca is private

#

it would have no use on my server

green kestrel
#

luca i bet is useless anywhere but here

#

i bet its got hard coded ids of this server all over it

misty sigil
#

it does

green kestrel
#

i mean why do otherwise

misty sigil
#

have you seen the git

green kestrel
#

theres a git?!

hoary elm
#

Yeah lol

earnest phoenix
misty sigil
green kestrel
#

i recently put my latest bot onto github, if anyone wants to critique

hoary elm
#

GitHub links on its page on the bot list to

green kestrel
misty sigil
#

very complexicated folder structure

green kestrel
#

wtf at the one pull request

earnest phoenix
#

-bots 265925031131873281

gilded plankBOT
green kestrel
#

i lol'd

spare mirage
#

is it an good idea to leak ur bottoken for money?

#

lmao

misty sigil
#

n o

earnest phoenix
hoary elm
#

Definitely not

spare mirage
#

if I just regen it :P

earnest phoenix
#

@misty sigil i am going to invite your bot

misty sigil
#

ok

green kestrel
#

aaaaaaaaaaaaaah!

#

are you trying to make me cry?

#

this joke code is AWFUL

#

😢

#

lol

pure lion
#

:o

green kestrel
earnest phoenix
misty sigil
#

its well written

earnest phoenix
#

somone help

misty sigil
#

very well

errant perch
earnest phoenix
#

https://sourceb.in/a064946d59 help my mute cmd isnt working like the roles has all the default permissions and its called new role not Muted
@earnest phoenix your code is outdated and you're overwriting permissions of each channel which will reset the perms of the channel every time the command is run

#

ok

#

soo uh

#

how can i update it

pure lion
#

Best bot cheems

earnest phoenix
#

Check the docs on how to create roles

#

k

#

And also use updateOverwrite instead

#

-docs create roles

misty sigil
#

@earnest phoenix what lib

earnest phoenix
#

discord.js

peak parcel
#

Id like to add the bot that this discord uses so when a user joins the server that popup comes up and they can select what they want to do. Does anyone know the name of it?

misty sigil
earnest phoenix
#

And also use updateOverwrite instead
@earnest phoenix ?

misty sigil
#

Id like to add the bot that this discord uses so when a user joins the server that popup comes up and they can select what they want to do. Does anyone know the name of it?
@peak parcel that isn't a bot, and we don't provide support for bots

earnest phoenix
#

@earnest phoenix ?
@earnest phoenix instead of overwritePermissions

#

?

opaque hawk
#
if(!message.member!.hasPermission"MANAGE_SERVER") {
    message.channel.send("Insufficient perms!");
  }``` This returns a `) expected` and a `; expected` error at `"MANAGE_SERVER")`
earnest phoenix
#

Since it will overwrite the perms

#

If you don't know what I mean read the docs

#

And it seems like you don't know your code

misty sigil
#

@opaque hawk it is !message.member.hasPermission("MANAGE_SERVER")

earnest phoenix
#

Invalid flag

opaque hawk
#

ik but if I do that it returns a null error so I have to use member!

misty sigil
#

oh wait

earnest phoenix
#

MANAGE_GUILD instead

misty sigil
#

its MANAGE_GUILD

opaque hawk
#

ok

misty sigil
#

im dumm

opaque hawk
#

makes sense, thx

earnest phoenix
#

ik but if I do that it returns a null error so I have to use member!
@opaque hawk TS?

opaque hawk
#

yes

hoary elm
#

@peak parcel that isn't a bot, and we don't provide support for bots
@misty sigil ^^ he was referring to Luca I just informed him it’s private

misty sigil
#

no !message.member!.

earnest phoenix
opaque hawk
#

it still has the same error

misty sigil
#

he was?

hoary elm
#

Yeah he DMed me

misty sigil
#

i thought that thing was discord builtin

earnest phoenix
#

ok

misty sigil
#

no thats discord feature

#

that splash

opaque hawk
#

It gives the same error, even with "MANAGE_GUILD"

pure saddle
#

show code @errant perch

misty sigil
#

show code

#

@opaque hawk

opaque hawk
long yew
#

What are the requirements for a bot to be added here? Like will it need to be online 24/7?

misty sigil
#

yes/ but accidental downtime is fine aslong as its not offline for review

pure saddle
#

nope

opaque hawk
#

no

hoary elm
#

What are the requirements for a bot to be added here? Like will it need to be online 24/7?
@long yew yes

opaque hawk
#

..

pure saddle
#

no need 24/7

long yew
#

Oh

errant perch
#
      var user = message.mentions.users.first() || message.author;
      var embed = new Discord.MessageEmbed()
        .setTitle("User Information")
        .setThumbnail(user.avatarURL)
        .addField("Player Name", user.username)
        .addField("Current Server", message.guild.name)
        .addField("Account Created", `${user.createdAt} days old`)
        .addField("User ID ", `${user.id}`)
        .setColor(0xffa500);
      message.channel.send(embed);
      break;```
@pure saddle
hoary elm
#

If the bot is offline when it’s tested it will most likely be denied

misty sigil
#

@opaque hawk code?

opaque hawk
peak parcel
#

So I would like to set up a bot on my server where a user would fetch their Rocket League ranked data from the Rocket League tracker network and then assign them the appropriate role. I've seen this on another server and am looking for someone who would like to help me.

misty sigil
#

If the bot is offline when it’s tested it will most likely be denied
@hoary elm will ALWAYS

long yew
#

@hoary elm what do you use to keep urs on 24/7?

misty sigil
#

@peak parcel we don't give support, look it up on https://top.gg

trim burrow
#

guys what you use to set your bot always online ? pandasad

long yew
#

VPs

earnest phoenix
#

@earnest phoenix doesnt work

hoary elm
#

@hoary elm what do you use to keep urs on 24/7?
@long yew I use a VPS or a paid host

long yew
#

Suggest any vps?

peak parcel
#

@hoary elm said for me to ask here. i'll leave you guys be. Have a good day.

hoary elm
#

DigitalOcean currently usually I use Google Cloud

earnest phoenix
#

Use heroku it is free

opaque hawk
#

@long yew ik that you didnt ask me, but in my repl.it i have a file named keep_alive.ts with the following contents: ```js
import fetch from "node-fetch";

const app = require("express")();
// @ts-ignore
app.all("/", (req, res) => res.send("Not dead!"));
app.listen(3000);
setInterval(() => fetch(process.env.ANTI_DUPE!), 30 * 1000);```

pure saddle
#

Date.now() - user.createdAt /1000/60/60/24 @errant perch u can make like that

errant perch
#

k

hoary elm
#

Or heroku but they do have limits 😉

earnest phoenix
#

What is the Limit

opaque hawk
#

I dont personally like heroku, they dont like my Procfile

hoary elm
#

So much usage per month

earnest phoenix
#

somone help with my mute cmd

long yew
#

DigitalOcean currently usually I use Google Cloud
@hoary elm how do u use google cloud to host?

pure saddle
#

on heroku u cant save persisent data

earnest phoenix
#

Any other fre hosting?

opaque hawk
#

i heard 1000 hours, which is more than 300 more hours in a month

earnest phoenix
#

Hmm kk

pure saddle
#

codes*

tulip ledge
#
                        if(newcxp >= level * 375) {
                            finished = false;
                            let newxp = newcxp;
                            let newlevel = level;
                            while (!finished) {
                                if(newcxp >= level * 375) {
                                    newxp -= (newlevel * 375);
                                    newcxp -= newlevel * 375;
                                    newlevel++
                                    console.log(newxp)
                                }
                                else finished = true;
                            }
                            let lvlsql = `UPDATE users SET level = ${newlevel} WHERE discordid = "${message.author.id}"`;
                            let xpsql = `UPDATE users SET xp = ${newxp} WHERE discordid = "${message.author.id}"`;
                            client.con.query(lvlsql)
                            client.con.query(xpsql)
                        }

Any idea why this gives me negative XP?

opaque hawk
#

put for code there, add a file named "keep_alive.<file extension>"

pure saddle
#

only token

earnest phoenix
#

Obsfucate it

hoary elm
#

@hoary elm how do u use google cloud to host?
@long yew look on YouTube

trim burrow
#

how can i add anti spam for my bot plz ?

hoary elm
#

That’s where I found the guide I used

#

how can i add anti spam for my bot plz ?
@trim burrow loop through sent messages and check if it has duplicate characters

#

Or I believe there is some modules for it but last time I used it it was buggy

trim burrow
#

i don't have the code 🙂

pure saddle
#

npm modules for antispam not good

#

then code

hoary elm
#

Yeah make some code for it

#

Loop through the message

earnest phoenix
#

Free lifetime vps or hosting?

pure saddle
#

i think no free vps

earnest phoenix
#

Ik how get free vps for 3 hrs

pure saddle
#

u can use trials

#

azure or gcp

hoary elm
#

npm modules for antispam not good
@pure saddle this i agree with very unreliable.. I coded my own from scratch.

#

Not a module itself just the feature

errant perch
#

i got it

#

/6350/60/60/60

earnest phoenix
#
        muterole = await message.guild.roles.create({
          name: "Muted",
          permssions: {
                SEND_MESSAGES: false,
                ADD_REACTIONS: false,
                SEND_TTS_MESSAGES: false,
                ATTACH_FILES: false,
                SPEAK: false,
          },
          color: "2f3136"
        });
``` will this work?
errant perch
#

divide that

#

and it works

#

wait no

#

fuck

earnest phoenix
#

no

#

somone helpthen

#

please

#

somone

#

Hm

#

Dont think

errant perch
#

i think i got it