#development

1 messages · Page 1108 of 1

digital ibex
#

like how are you getting the id

pure lion
#

uuid

#

generated

digital ibex
#

send the code, i've never used it before

#

i use shortid :p

pure lion
#

7e46c97f-bfa7-4cdb-818f-488582c35036
^ like this

digital ibex
#

yeah

#

send the code where you're generating it

pure lion
#
const { v4: roomID } = require('uuid')
//...
app.get('/unlocking_door', (req, res) => {
    res.redirect(`/${roomID()}`)
})
digital ibex
#

okay

#

in the post request

#

add this:

#
if (input !== roomID) return res.render('room.ejs', { message: 'Stop tryna mess wid me epic site retard' });
return res.redirect(`/${roomID}`);
pure lion
#

o

#

wo

digital ibex
#

lmk if it works

pure lion
#

it wont

digital ibex
#

why

pure lion
#

new ID generated each time

digital ibex
#

ah

pure lion
#

yeah

digital ibex
#

just do this

pure lion
#

and i cant do req,query() because it hasnt been created yet

#

could i use a map or some shit to store IDs?

errant perch
#

How would I set multiple prefix's to this code

const Discord = require("discord.js");
const bot = new Discord.Client();
 
const token = "";
 
const PREFIX = ("-");
 
bot.on("message", message => {

let args = message.content.substring(PREFIX.length).split(" ");
 
  switch (args[0]) {
          case 'test':
            var embed = new Discord.MessageEmbed()
            message.channel.send("test");
          break;
  }
});
 
bot.login(token);```
pure lion
#

make prefix a let

digital ibex
#
const { v4: roomID } = whatever;
const id = roomID();
// THIS IS OUTSIDE *EVERY* API CALL

app.post('/whatever', (req, res) => { 
    if (input !== id) return res.render('room.ejs', { message: 'Stop tryna mess wid me epic site retard' });
        return res.redirect(`/${roomID}`);
 });```
#

wdym woogie?

#

u want it to respond to more than one prefix?

errant perch
#

yes

#

i changed it to let but it didnt work

pure lion
#

l o s t

#

woogie let is reassignable

errant perch
#

let PREFIX = ("-", "m-")

#

i am

#

l o s t

digital ibex
#

u dont need to make it a let

pure lion
#

ever heard of an array

errant perch
#

array didnt work

pure lion
#

.some

#

()

digital ibex
#

make prefix an array and loop through the prefixes

errant perch
#

monkey

pure lion
#

what

#

imverylost

errant perch
#

lmaosame

#

i am c o d e

pure lion
#

lost, i want to check if input is an active room ID

#

if it isnt then dont redirect

#

and display error message

digital ibex
#
const loadsandloadsofprefixeslolahhaha = ['prefix 1', 'prefix 2'];
let prefix = undefined;
for (const prefixofloadsofprefixes of loadsandloadsofprefixeslolahhaha) {
    if (message.content.startsWith(prefix) prefix = prefixofloadsofprefixes;
}
// the rest of ur code here```
faint prism
#

What an annoying variable name lol

digital ibex
#

why wont that work, dice?

pure lion
#

const a = new Array(100, '@digital ibex')
for (const LmAo of a) { msg.channel.send(LmAo) }

digital ibex
#

?

pure lion
#

spam ping

digital ibex
#

setInterval for spams pls

pure lion
#

also it wont work because new ID every tim

#

e

#

ill just use a map uwu

digital ibex
#
setInterval(() => {
    message.channel.createMessage('ur mom fat');
}, 1);```
#

???

#

input is a string

#

not array

pure lion
#

what is a createMessage

digital ibex
#

eris

pure lion
#

oh

faint prism
#

What is docs

digital ibex
#

basically better d.js

pure lion
#

that is actually discord.js-light

digital ibex
#

no discord js lib can top eris apart from detritus maybe

quartz kindle
#

i would disagree

#

i dont think eris is that good

digital ibex
#

eris is amazing imo

pure lion
#

omg its not working

earnest phoenix
#

thanks

digital ibex
#

the only issue with it is that theres connection timeouts or something

#

never experienced it for myself though

quartz kindle
#

from what i hear, there seems to be multiple issues with it

digital ibex
#

many bots when they hit 10k servers+ using eris make their own sharding manager

#

well, i only know 2 at least anyways

pure lion
#
app.post('/finding_keys', (req, res) => {
    const {input} = req.body
    if (!connections.get(input)) {
        return console.log('apple')
    } else {
        res.redirect(input)
    }
})

i want to stop it if it cant find the item on the map but issnotworking

amber fractal
#

The one for a bot I was planning to make was a modified custom one for eris, but then I never actually worked on the bot mmLol

digital ibex
earnest phoenix
#

i seem to have a problem with shards timing out and not being ready

quartz kindle
#

i was planning to make a cross-lib sharding manager

#

but never got into it

amber fractal
#

That sounds like hell

digital ibex
#

updates be coming out everyday

quartz kindle
#

nah

#

if you stick to the basics, there is not much to update

pure lion
#
app.post('/finding_keys', (req, res) => {
    const {input} = req.body
    if (!connections.get(input)) {
        res.stopThePostReq:)
    } else {
        res.redirect(input)
    }
})
``` e
digital ibex
#

if the library changes stuff however, like discord.js seems to regularly change their source code, wouldn't you have to do something on your end, if its to do with discord.js tho?

#

whats not working, dice?

pure lion
#

its continuing to wait for host even if its not in the map

amber fractal
#

Well they usually dont change the inner workings of the websocket connections

#

I dont think they have any reason to

digital ibex
#

continuing to wait for a host?

quartz kindle
#

updating djs-light is gonna be much worse

digital ibex
#

making a discord.js framework must be hell

quartz kindle
#

imagine eris-light

digital ibex
#

theres already a similar thing

misty sigil
#

discord.js-light is very good

digital ibex
misty sigil
#

very light

pure lion
quartz kindle
#

that link gives 404

digital ibex
#

lemme see if i can find it

pure lion
#

it keeps waiting and thats u g l y

misty sigil
#

url @pure lion?

pure lion
#

not up yet

digital ibex
#

oh axon team

quartz kindle
#

@pure lion you need to return something

pure lion
#

i did

digital ibex
#

for d.js detritus (not yet) and eris

quartz kindle
#

res.send(200)

pure lion
#

o h

quartz kindle
#

or whatever

digital ibex
#

never used it but devs who are wayy better than me and i look up to use it, so im assuming its pretty good

pure lion
#

can i sendStatus and then redirect?

digital ibex
#

i dont think so, not sure tho

quartz kindle
#

its just a normal framework no?

#

nothing about it being "light"

pure lion
#

ok my site works

#

100%

digital ibex
#

u can just do js res.status(200); res.redirect('whatever');

pure lion
#

now i gotta add a 'copy ID' button

digital ibex
#

never used it myself

pure lion
#

omgitworks

#

agonsfdhuoaddng

pure lion
#
        function copy() {
            var copyText = document.getElementById("myInput");

            copyText.select();
            copyText.setSelectionRange(0, 99999); 

            document.execCommand("copy");

            alert("Copied the room ID: " + copyText.value);
        }

it doesnt copy the stuff to my clipboard and only displays the alert with the correct text

digital ibex
#

what does the html look like?

pure lion
#

Its a button that, onclick, run the copy function

#

I'm in bed rn

digital ibex
#

same

#

im assuming the button is something like

#
<button onclick="bob()">copi</button>``` ?
#

i didnt understand what u said cofnsuinon

pure lion
#

Yeah it is

#

I tire

quartz kindle
#

in modern browsers, you can use navigator.clipboard.writeText(text) which is async and returns a promise

pure lion
#

myInput is ID'd to a form tag with a value of the room ID

#

Oh

digital ibex
#

ok i slep

#

u dont need to have it in a form tag

pure lion
#

What is your time zone

#

Also idc

#

Ek8sjriejf

digital ibex
#

idk man, brexit leave me confusion

pure lion
#

What

digital ibex
#

its 01:48

#

idk what timezone im in

pure lion
#

Oh same

digital ibex
#

cuz of brexit stuff

pure lion
#

BST

digital ibex
#

england?

pure lion
#

Ye

digital ibex
#

same

pure lion
#

Ayy

#

yyyYYyYyYy

#

Fuck I'm tired but i gotta wait for someone

digital ibex
#

same but i dont have to :O

#

so i slep

pure lion
#

Ok do sleep good

weary gull
#

Guys, I am not much professional in programming, who helps me and program bots with me, please, please

quaint hound
#

you can find people that will do it for you a dime a dozen

#

well not quite as cheap as a dime

#

but try and follow discord.js's tutorial on their website

#

that should get you started, and then we can help you with specific questions you may have

earnest phoenix
#

Whats the best language to code discords bots in

opal plank
#

there isnt a best language

#

each has their benefits

#

d.js and py are greatly used, some might say they are the best.
some might say ruby or c++ are the best for speeds/compiling
or even lua
it boils down to your preference **||most of the time||

quaint hound
#

^

opal plank
#

to some degree some langs do have advantages, but i wouldnt go as far as saying theres one thats the best

quaint hound
#

if you're asking this question you'd probably want to go with discord.js or discord.py because they have the most documentation and they're the easiest frameworks to learn

opal plank
#

or go for haskell if you dont value your life

quaint hound
#

oh no

weary gull
#

you can find people that will do it for you a dime a dozen
@quaint hound The bot is my purchase, and its means that I do not have help alone -_-

quaint hound
#

i'm not sure what you mean

opal plank
#

i think he means 'i dont want to work, i have money'

quaint hound
#

if thats the case i'm pretty sure you could pick most anyone in this channel to pay and do the bot for you

weary gull
#

I translate from Google Translate to Arabic

quaint hound
#

ah ok

#

well in that case you'd have to hire someone arabic speaking which might be tougher

weary gull
#

if thats the case i'm pretty sure you could pick most anyone in this channel to pay and do the bot for you
@quaint hound No, I want to partner with someone in the Abbot that you do with me for free, we can help some of my goods and yours

earnest phoenix
#

Need help with verify bot

weary gull
quaint hound
#

most people won't partner for free because they can already do it on their own

#

good luck in finding someone tho

weary gull
#

But because I don’t know how to program

quaint hound
#

np

weary gull
#

thx

#

I want to program a bot but not JavaScript node.js

earnest phoenix
weary gull
#

wt

quaint hound
#

i think this might help

weary gull
#

ok

honest cypress
#

Anybody know where to find a video/website that explains how to create a moderation bot? I have little experience figiting with random youtube tutorials

weary gull
#

wtf

#

import discord

client = discord.Client()

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith('$hello'):
    await message.channel.send('Hello!')

client.run('your token here')

honest cypress
#

you need your token

#

right here

quaint hound
#

he just saw the website for the first time

weary gull
#

Yes, but what code?

quaint hound
#

that's python code

weary gull
#

aha ok

honest cypress
#

if im not mistaken, js bot starts with

const require = Discord JS

#

or something like that

weary gull
#

wtf

honest cypress
#

send in dms

quaint hound
#

const Discord = require('discord.js')

#

but close

weary gull
#

sorry

honest cypress
#

im still learning lol

quaint hound
#

you're good lmao

#

as far as tutorials, i dont know of any, but read the docs a lot

honest cypress
#

@quaint hound so, any useful moderation thigns?

#

hmmm

#

docs are basic

quaint hound
#

docs + logic will get you far

weary gull
#

I need people who come in, to answer the programmers badge, or I can do it

quaint hound
#

want to change roles of a user? its in the docs

honest cypress
#

and youtube videos are either not updated or have like no speaking

quaint hound
#

want to mute or kick on ban? its in the docs

honest cypress
#

.........

#

fr

#

i cant get past the first 3 pages

#

cause complicaged

quaint hound
#

well you're not supposed to read the whole thing

#

you search for what you need

weary gull
#

Medicine, you can help me and program a bot with me, please

earnest phoenix
#

Can someone recommend me an app that I can use to work on my bot on the go? I know Termius is a thing but it’s not the best when it comes to coding.

weary gull
#

This is a video server that is hard to use

earnest phoenix
#

Can it connect to a CentOS server?

#

i dont think repl.it itself can handle my bot

weary gull
#

I do not know

#

idk

quaint hound
#

you might want to look at your VPS provider (assuming you're using a vps) to see if they have a mobile app

weary gull
#

Who give me bost in my server😀

earnest phoenix
#

@quaint hound doesnt heroku work as a vps but for like projects to host

pale vessel
#

no

quaint hound
#

heroku isnt worth the trouble

sudden geyser
#

Who give me bost in my server😀
@weary gull I can give you no boosts TohruYeeHawW

quaint hound
#

IMO the only real options are VPS or self hosting

weary gull
#

@weary gull I can give you no boosts :TohruYeeHawW:
@sudden geyser lay lay lay

#

I will program a bot on heroku server

sudden geyser
#

no

quaint hound
#

we can agree glitch bots are the worst tho

weary gull
#

Glitch problem that it is classified as all sites, as it gives the bots a 24-hour workout. Repl.it is not a file or site

solemn latch
#

Glitch < mobile hosted bots < heroku < self hosted < vps < dedi < hosting at nasa

bright dove
#

dedi?

solemn latch
#

Dedicated sever

bright dove
#

o

#

wut dat

quaint hound
#

fancy VPS

solemn latch
#

A whole server computer hosted at a proper facility

quaint hound
#

you still rent it from a company, but you actually own the whole thing

bright dove
#

o

#

coolio

solemn latch
#

Pretty much everyone who has a VPS dreams of a dedi

#

Or maybe I'm projecting

cursive mountain
#

Hi

bright dove
#

ok so I know w3schools is the best for learning javascript, but where's the best place to learn the ways of discord.js?

#

just discord.js website? or is there an actual place for learning it that isn't a part of their website

strange trout
#

There's the guide

#

Oop

surreal notch
#

Can anyone tell me online hosting like glitch but not glitch

solemn latch
#

Heroku does something similar, but its also not great

strange trout
#

A VPS

#

Spare laptop, Raspberry PI, or Intel NUC

bright dove
#

lol no

#

should I like

#

ping a mod

solemn latch
#

@ember atlas man will save us

bright dove
#

gonna try @glad charm too for good measure 😛

earnest phoenix
#

Whats the best way to local host a bot

#

👀

#

Or a vps

solemn latch
#

Locally hosting a bot requires a computer running 24/7

earnest phoenix
#

Yes I have a spare laptop

bright dove
#

raspberry pi 😛

#

that's what I'ma start with

#

and then move to vps if it ever grows

ember atlas
#

@weary gull Do not beg for nitro boosts and post your bot invite link. Only warning.

earnest phoenix
#

@ember atlas kek

#

Kek

bright dove
ember atlas
#

If you do not need coding help, leave this channel. Thanks.

bright dove
#

love you too

earnest phoenix
#

I need some help woo osnhelping me

surreal notch
#

My codes are correct and my bot is not coming online

solemn latch
#

Any errors?

surreal notch
#

No

bright dove
#

then your codes probably not correct KEKW

quaint hound
#

did you call client.login()

surreal notch
#

Should i share?

quaint hound
#

i'm assuming discord.js

surreal notch
#

@quaint hound yes

#

Yes

bright dove
#

did you actually run it? with node .?

quaint hound
#

sure share code

surreal notch
#

yes i m not nub

quaint hound
#

careful about token leaks tho

earnest phoenix
#

Nodemon

surreal notch
#

Ok

#

@quaint hound

quaint hound
#

ok lemme see

surreal notch
#

And this is image of logs

bright dove
#

pretty sure it's const client = new Discord.Client;

#

you just have new Client;

faint prism
#

Beautiful ASCII lol

quaint hound
#

thats fine

surreal notch
#

lol

opal plank
#

nah

#

Discord.Client exports Client

#

you can access it directly

surreal notch
#

yup

bright dove
#

o

earnest phoenix
#

I have no idea how to javascript

opal plank
#

so what exacly is the issue?

earnest phoenix
#

Too big brain

quaint hound
#

bot dont do anything at all he says

surreal notch
#

@opal plank issue is before the bot is coming online but commands not reponsding and now the bot not even coming online.

opal plank
#

do you get any errors on compile?

surreal notch
#

No

#

And i even changed token and tried again

opal plank
#

put your login above your message event

#

just to see if something is clogging

surreal notch
#

Ok

opal plank
#

actually, log in right above the collections

#

i doubt it, but you havent hit any rate limits, have you?

surreal notch
#

rate limits?

#

5 message a sec

#

lol

opal plank
#

rate limits arent only for messages

surreal notch
opal plank
#

thats why im recommending putting the login so up in your script, to make sure its logging

surreal notch
#

I did

opal plank
#

and?

surreal notch
#

same

#

not on9

opal plank
#

you get a ready event?

surreal notch
#

No

opal plank
#

hmmm 002_think

#

add this to your code

#

lemme write it rq

surreal notch
#

yUP

opal plank
#
client.on("debug", (i) => {console.log(i)});

Add that right below token(which should be above the collections)

surreal notch
#

OK

opal plank
#

actaully

#

nonon

#

there

surreal notch
#

WHERE

#

i did debug it is something preparing to gateway

#
429 hit on route /gateway/bot```
pale vessel
#

429 oof

surreal notch
#

lol

#

what it means

opal plank
#

rate limit

#

as i assumed

surreal notch
opal plank
#

you got rate limited TogaSmile2

#

try tomorrow

surreal notch
#

What it means

#

It all did to me yesterday only

opal plank
#

means you gotta wait X amount of time before connecting

#

go sleep and try tomorrow

#

and fix whatever is sending that many requests

surreal notch
#

and why i m rate limited

opal plank
#

good question

#

¯_(ツ)_/¯

surreal notch
#

only i m the one who uses bot

opal plank
#

its prbably something you coded thats spamming the api

#

OOOOOR

#

you somehow managed to log in 1000 times in a single day

surreal notch
opal plank
#

which i seriously doubt someone can accomplish that

surreal notch
opal plank
#

idk

#

¯_(ツ)_/¯

#

its ur code

surreal notch
#

(╯°□°)╯︵ ┻━┻

#

means i hve to try tmrw

#

oof

opal plank
#

indeed

surreal notch
#

and wen i changed my bot's token how the discord api knows i m the one who was rate limited

opal plank
#

you gotta wait for the rate limit to end before you log in again

surreal notch
#

w8 can i open discord developers portal with my 2nd account and make a bot token there? ||big brain||

opal plank
#

you can ping the api manually and see the payload response if you want to see the time

#

i wouldnt recommend evading rate limits

quaint hound
#

yikes ratelimit

surreal notch
quaint hound
#

ratelimit times are like 24 hours tho right

surreal notch
#

||who ever comes to stop my bot i will stop him||

opal plank
#

no

#

rate limits vary

surreal notch
#

ratelimit times are like 24 hours tho right
i think i got rate limit yesterday 1 pm

opal plank
#

i think i remember someone screaming for getting 28h limit

surreal notch
#

lol

quaint hound
#

well for starters i'd recommend looking over all your code to make sure it wont happen again

opal plank
#

i personally got it once for looping a map/array with axios. Not the smartest of my ideas back then

quaint hound
#

and there are ratelimits on a lot of activities

opal plank
#

api didnt like me sending 600 requests

surreal notch
#

Um but I don't think there problem in my codes

opal plank
#

i think there is

surreal notch
#

My codesss are OP

opal plank
#

cuz the api said so

surreal notch
#

so how could i came to know

#

what should i check in my codes

#

¯_(ツ)_/¯

opal plank
#

api doesnt simple say 'oh, i dont like you, im going to rate limit your ass'

surreal notch
#

what should i check in my codes

opal plank
#

its definetly something you doing

#

i've got no clue, anything that does requests, i guess

surreal notch
#

i m just making my commands as usual

opal plank
#

your 'usual commands' are somehow spamming the api

#

find em'

quaint hound
#

Basically anything your bot can do can be rate limited

strange trout
#

What type of commands do you have?

surreal notch
#
const db = require("quick.db")
module.exports = {
name: "prefix",
  category: "Extras",
  aliases: ["pre","currentprefix"],
  description: "Get the current prefix of guild",
  usage: "prefix",
  run: (client, message, args) => {
  let p = db.fetch(`prefix_${message.guild.id}`)
if(p === null) {
p = ";"
}
message.channel.send("**Default prefix**: `;`")
message.channel.send("**Guild Prefix**: "+p)

  }
};```
quaint hound
#

Status changes, nickname changes, message sending, message editing, etc

surreal notch
#

After this i think my bot stop reposnding

quaint hound
#

Could have also been a possible token leak and someone else got him ratelimited

#

Ofc he’s changed the token now so

surreal notch
delicate shore
#

Hey

surreal notch
#

Could have also been a possible token leak and someone else got him ratelimited
Ofc he’s changed the token now so
hm

#

something is wrong but discord

#

*with

delicate shore
#

@pale vessel the code worked but set timeout didn't

opal plank
#

i would assume either pokemon or moderation commands

delicate shore
#

I'll send my code here just a second

opal plank
#

maybe corona

surreal notch
#

but i m using these cmds frm months

ivory mural
#

Where's the location where I can add my bot?

opal plank
#

what

surreal notch
#

God knows what happened

#

I m gonna go with my 2 nd account for test bot

#

simple

opal plank
#

avoiding rate limits

#

just be a good dev and debug your code m8

surreal notch
quaint hound
#

At least take a look before getting ratelimited again

surreal notch
#

Ok

quaint hound
#

If you don’t see anything, try it on a second account

opal plank
#

you're just going to spam the api again if you use a different acocunt, it completely bypasses the purpose of a rate limit

surreal notch
#

ok

quaint hound
#

But trying again and getting the same result isn’t gonna help

opal plank
#

rate limits is the api screaming 'FIX YOUR CODE'

#

not 'make another token akkoShrug '

surreal notch
#

is there any clue to check rate limite

ivory mural
#

How can I create a dashboard in my bot?

quaint hound
#

Like I said tho, could be a token leak

surreal notch
quaint hound
#

You’ll have to be more specific wym dashboard

surreal notch
#

i will recieve a mssg if my token is leaked

opal plank
#

no?

surreal notch
#

yes

quaint hound
#

Not necessarily

opal plank
#

unless you dumb enough to post it here on discord

quaint hound
#

Github tries to stop people from leaking tokens

opal plank
#

then a system message might catch it

quaint hound
#

Nah it won’t I’ve token leaked before from being dumb

ivory mural
#

Can I teach me to create dashboard? @quaint hound

surreal notch
quaint hound
#

I token leaked on stack exchange before

delicate shore
#
 channel.send(thanks)
                  
                  var Tet7 = bot.guilds.cache.get("690557545965813770")

    let upvoter = Tet7.roles.cache.find(role => role.name === "Upvoter!");
     var mo = Tet7.members.cache.get(vote.user)
mo.roles.add(upvoter)
  setTimeout(() => {
mo.roles.remove(upvoter
)        }, 43200000);
                  
                })
            })
        }
    });```
surreal notch
#

lol

#

ok

quaint hound
#

Thankfully nothing happened

surreal notch
#

lol

opal plank
#

omg

#

that code

delicate shore
#

The Timeout is not owrking

#

working*

opal plank
#

VAR

#

NO

#

BAD!

quaint hound
#

Var is useful sometimes ok

#

That’s not the point here tho

opal plank
#

var has its uses

surreal notch
amber fractal
#

just is a different scope

opal plank
#

dont use it unless you know what those uses are

delicate shore
#

Huh

#

But it's working

opal plank
#

var bad

#

they ignore scopes

#

stop using it

delicate shore
#

Only set timeout is not working

#

Ok

quaint hound
#

They don’t ignore scopes

opal plank
#

they do tho

amber fractal
#

They have a different scope

#

it doesnt ignore scopes though

opal plank
#

any functions passed on it they'll retain values

quaint hound
#

^

amber fractal
#

let and const are just lexical

quaint hound
#

That’s not the same as ignoring scopes completely

opal plank
#

its a quick way of explaining it

delicate shore
#

Should I do

#

Let then ?

opal plank
#

let or const

delicate shore
#

or condt

#

Ok

quaint hound
#

Usually let is the better option

opal plank
#

const is immutable

delicate shore
#

Lemme try

opal plank
#

let is mutable

amber fractal
quaint hound
#

Usage of var isn’t a crisis tho

amber fractal
#

just depends on how you use it

quaint hound
#

If the code isn’t working it’s not cause you used var instead of let

amber fractal
#

and it isnt the end of the world. Almost all schools still teach var over let

opal plank
#

@amber fractal yes im aware

quaint hound
#

Ok that doesn’t mean shit

amber fractal
#

Because it's still standard and will stay that way for quite a while

opal plank
#

only reason you'd usually want to use var is for loops

amber fractal
#

I use it so I can get a value out of a try/catch for message awaiting

opal plank
#

using proper scopes is usually a much better call rather than using vars and inducing possible bugs later on

pale vessel
#

I use let for loops

quaint hound
#

Var vs let vs const isn’t a crisis tho

amber fractal
#

instead of initializing a value above that might never get used

quaint hound
#

If you’re going to pick a hill to die on that’s not it

#

Var is also useful because it can be redeclared

opal plank
#

so does let

quaint hound
#

Usually you wouldn’t want to but if you’ve got a funky loop going on it might help

opal plank
#

well

quaint hound
#

Let doesnt

opal plank
#

yes and no

#

you can reassign values to let

quaint hound
#

You can reassign but not redeclare

#

Yea

opal plank
#

hence why you scope them

quaint hound
#

Sometimes you don’t want block scope too

#

Declaring a variable inside an if for example

amber fractal
#
await message.channel.send("What is your email?")
try {
  var response = await message.channel.awaitMessages((m) => m.author.id == message.author.id, { max: 1, time: 60000, errors: ["time"] })
} catch (e) {
  return await message.channel.send("No email received") 
}
let email = response.first().content
``` looks better than 
```js
await message.channel.send("What is your email?")
let response;
try {
  response = await message.channel.awaitMessages((m) => m.author.id == message.author.id, { max: 1, time: 60000, errors: ["time"] })
} catch (e) {
  return await message.channel.send("No email received") 
}
let email = response.first().content

imo

quaint hound
#

Yeah that’s why you wouldn’t want to use block scope sometimes

opal plank
#

imo vars just induce hard to catch bugs in production

gilded dawn
#

Hey everyone! It’s motivational unicorn girl again. XD I have a quick question.

If I bot is on a GitHub repository (I’m hosting it on Heroku), and I transfer the repository to a new GitHub account, will my bot go offline?? Idk how bad transferring a repository is.

opal plank
#

rather messy code over possible bugs cuz scopes

#

wheres my bingo?

quaint hound
#

Idk how github works lmao

opal plank
#

is it an issue that it goes offline tho?

quaint hound
#

I think she means it won’t work

#

Cause heroku is drawing the code from the repo so transferring ownership might mess that up

gilded dawn
#

^^^

sudden geyser
#

var won't be trouble if you don't use it incorrectly

pale vessel
opal plank
#

keyword if

quaint hound
#

Well that’s true for anything

opal plank
#

why bother risking it?

quaint hound
#

The subjective part is how much risk that is

pale vessel
#

also, var looks ugly don't @ me

quaint hound
#

Cause it makes things better in some cases

#

There isn’t a blanket statement that covers all use

#

But generally let is better, until it isn’t

opal plank
#

there are few cases where var is necessary

sudden geyser
#

I'd still use let/const over var, but I think people make out var to be bigger than it actually is as what stands between your way is just a logical error

gilded dawn
#

Also Heroku isn’t really the best place to host a bot bc u only have certain free hours per month . :/ but yeah I’m just worried about transferring the repo

opal plank
#

you own the repo tho

#

even if you made a new acc

quaint hound
#

With my almost 0 knowledge of github it wouldn’t matter cause the repo would still be there

opal plank
#

wouldnt you still have all files?

#

maybe databases or something stored in heroku?

quaint hound
#

So it could still see everything it needed to, unless there’s some sort of account bs going on

opal plank
#

idk, its a shit hosting service, im not sure how it works

quaint hound
#

^

#

Heroku kinda yikes

opal plank
#

heroku and glitch

quaint hound
#

“It’s not as bad as glitch tho”

#

Stop hosting anything on glitch’s shitty website lmao

sudden geyser
#

glitch is more bearable but free hosting is going to arise issues in general

#

depends on what you want to make

quaint hound
#

Glitch is worse I think cause it has more bugs

sudden geyser
#

if you use glitch just to host some small site you just leave it'll be fine

gilded dawn
#

Well that def helps a bit. Ya I just have a new account. So if the repo stays intact, everything should probs stay the same?

quaint hound
#

Most likely yeah

opal plank
#

unless you have data stored in heroky

#

idk what u got setup

quaint hound
#

Well idt that would matter cause the heroku is still there

opal plank
#

say a local database or something

weary gull
#

pls give me welcome code

opal plank
#

ty needed that

quaint hound
#

Nobody gives code for free here lmao

opal plank
weary gull
#

wt

opal plank
#

actually i had that one already

quaint hound
#

Original bingo?

#

I need to save

opal plank
#

my bingo, yes

weary gull
#

lay lay lay

gilded dawn
#

I just did it through git and Heroku.

opal plank
quaint hound
#

Gold

opal plank
#

yw

#

lmao

#

gives me motivation to come here after some dumb questions

quaint hound
#

I hate unnecessary bashing on if else tho

#

Some things can’t be checked with switch so I mean

opal plank
#

if you comparing same thing, switch

#

thats the meaning of that

#

like commands

quaint hound
#

Yea

opal plank
#

if(command == x) {}
if(command == x) {}
if(command == x) {}
if(command == x) {}

#

this level of shit that you'd see around quite often

quaint hound
#

It’s like a pack of wolves all pricking their ears when they see if else

#

People do be beginners

gilded dawn
#

Thanks y’all for the advice !!

Is there a better place to host a bot than Heroku? I def avoided glitch.

surreal notch
sudden geyser
#

no

opal plank
#

oh god

quaint hound
#

The only better options are self hosting and a VPS

opal plank
#

no

surreal notch
#

lol

opal plank
#

code

sudden geyser
#

There are some hosts in the pins

opal plank
#

go to #commands and type n.tag host @gilded dawn

earnest phoenix
#

How to get MEE6 IN MY SERVER

surreal notch
#

There are much free vps dm if u want link i also use free one

quaint hound
#

Yeah VPS is the way to go

sudden geyser
#

wrong server alex

surreal notch
#

How to get MEE6 IN MY SERVER
@earnest phoenix if u know tell me also

quaint hound
#

Damn I really don’t want to have to rewrite my bot in Eris at some point

#

But I need that precious memory

opal plank
#

why not mister tim?

#

go for d.js-light

quaint hound
#

Might do that as a holdover

#

Or I might write my own framework for the hell of it lmao

gilded dawn
#

Thanks for everything y’all!

quaint hound
#

Not like I’m using anything fancy rn

#

Np lol

bright dove
#

Damn I really don’t want to have to rewrite my bot in Eris at some point
@quaint hound wait why would you have to do that

sudden geyser
#

It seems due to memory usage.

quaint hound
#

Yeah Eris is much more lightweight and caches less than discord.js

#

Now I also personally think Eris is ugly as hell to look at because I prefer the object oriented method system, but you gotta do what you gotta do

sudden geyser
#

You could also use Tim's wrapper Discord.js-light, but I would use Eris if you want to go all the way.

#

Eris is based on an older version of Discord.js to my knowledge.

quaint hound
#

Yeah I’d probably start with djs light and see how it goes

sudden geyser
#

It also cares more about compatibility than Discord.js does.

quaint hound
#

Nah they’re separate entities

#

Eris is older tho

sudden geyser
#

wdym

faint prism
#

What is your alls' bot's typical memory usage?

weak rain
#

I want my Bot to send messages whenever it joins any server

#

how to do that

gray zealot
#

Hi! 😄 How do I create a channel in discord.js?

#

nvm

torn ravine
#

@fleet hornet why don’t use channel-id

molten tree
#

What is the best way to program a discord bot because in this case I use it by cell phone and the programs here are bad...;-;

faint prism
#

the programs here are bad
?

#

the best way to program a discord bot
For you, following a tutorial on YouTube
@molten tree

lusty quest
#

check if the Channel exist if no return. otherwise you will get unhandled exeptions -> forced restart

#

@glad charm

faint prism
#

wrong dylan

#

That's the mod
@lusty quest

molten tree
#

For you, following a tutorial on YouTube
@molten tree
@faint prism hm ok

glad charm
#

Damn

lusty quest
#

...

#

sry dylan

faint prism
#

😛

glad charm
#

Lol it's fine

lusty quest
#

@fleet hornet check if the Channel exist if no return. otherwise you will get unhandled exeptions -> forced restart

#

now the correct one

#

almost as annoying as having 6 Alexa on the same server

gray zealot
#

Hi! 😄 How do I create a channel in discord.js?
@gray zealot

#

🙂

torn ravine
#

loL

gray zealot
#

😄

lusty quest
gray zealot
#

okk

#

ty

#

😄

earnest phoenix
#

Anyone here good with d.js 12 and 11?
I need help with a NPM im continuing
Everything under it is on v11, and since discord is updating it needs to be v12 now

lusty quest
#

npm remove discord.js
npm install discord.js

#

this will install d.js v12

#

after this i would run npm update

#

this will update other dependencies

earnest phoenix
#

Yeah, but i'm saying for the physical code

faint prism
#

What

lusty quest
earnest phoenix
#

Yeah, well im just looking for someone to join the team

lusty quest
#

i dont think this here is the correct place for this

earnest phoenix
#

Not really

#

Just theres a bunch of bot devs here

#

So figured I'd ask

lusty quest
#

?

#

the description is really bad

earnest phoenix
#

Not my original description

#

Oh, well, thanks for your time

lusty quest
#

the thing is im not a huge fan of Packages that forces to use certain packages. yours depends on quick.db as example

#

sure makes it maybe easy for a beginner to start but he will regret it when he hits 2500 guilds i guess

bright dove
#

wait

#

your easy-discord-api-communicating package is dependent on another easy-discord-api-communicating package?

topaz fjord
#

tfw it depends on discord.js

#

you could've just used discord.js-light written by the one and only tim

lusty quest
#

i guess the package is still at D.js-V11

earnest phoenix
#

^

pine aspen
#

Hey, ```
0|index | Error: Invalid converter command
0|index | at new module.exports (/root/ModCord/node_modules/eris/lib/voice/streams/FFmpegPCMTransformer.js:7:15)
0|index | at Piper.encode (/root/ModCord/node_modules/eris/lib/voice/Piper.js:149:52)
0|index | at VoiceConnection.play (/root/ModCord/node_modules/eris/lib/voice/VoiceConnection.js:445:24)
0|index | at Object.module.exports.run (/root/ModCord/commands/fun/radio.js:23:31)
0|index | at processTicksAndRejections (internal/process/task_queues.js:97:5)

#

Does anyone how I could fix this issue?

lusty quest
#

your code

earnest phoenix
#

how can i fix it

#

i want the bot to show the name of the person mentioned in the command. example !hug "@earnest phoenix"

#

Who pinged me here

#

i want the bot to show the name of the person mentioned in the command. example !hug "@earnest phoenix"
@earnest phoenix you need to get the first mentioned user

#

message.mentions.members.first() getd the first mention

#

ok

#

And you can save it as a variable and it contains the user class

#

So you can do <variable>.username

#

thx

#

Np

#

Say potato

#

potato

#

lol

#

When you spend ten hours figuring out why message.guild.id is not working but then you realize you misspelled it :/

#

lol

#

@earnest phoenix sorry to disturb again

#

Some parts of embeds don't display pings

#

how to fix it?? @earnest phoenix

lusty quest
#

either user the tag or displayname of the user

pine aspen
#

anyone know how to fix this?

lusty quest
#

your code

pine aspen
#

you ned my code?

#

sec

lusty quest
#

the part that throws the error

pine aspen
#
        client.createMessage(message.channel.id, `This command is currently under construction!`);
        let userVoice = message.channel.guild.members.get(message.author.id)
        let channel = message.channel.guild.channels.get(userVoice.voiceState.channelID) || null
        if (channel == null) return client.createMessage(message.channel.id, { embed: client.functions.embedUtils.error(client.functions.errorMessage(client), `Please make sure you're connected to a voice channel!`) });
        let VoiceConnection = await channel.join();
        let radioName = args[0]

        await VoiceConnection.play(`https://radio.pulseebot.com/radio/${radioName.toLowerCase()}`) 
#

i think its' ffmpeg

lusty quest
#

where is line 23?

#

did you got ffmpeg installed?

pine aspen
#
        await VoiceConnection.play(`https://radio.pulseebot.com/radio/${radioName.toLowerCase()}`) 
#

this

#

Yeah

lusty quest
#

os?

earnest phoenix
pine aspen
#

seems like an eris issue

lusty quest
#

well then idk

pine aspen
#

Uhm OS = Ubuntu 16.04

lusty quest
#

@earnest phoenix why is members defined as a const?

earnest phoenix
#

idk

lusty quest
#

wait the error is in your first embed

#

it should be user.username

earnest phoenix
#

ok

lusty quest
#

not message.username.member.first()

earnest phoenix
#

thx

#

just user.username right?

lusty quest
#

i think. if your userobject has the property

earnest phoenix
#

there is a error @lusty quest

lusty quest
#

bcs you dont follow instructinons

earnest phoenix
#

what should i change

#

??

lusty quest
#

i gave you a hint for it 4 minutes ago

earnest phoenix
#

it should be user.username
@lusty quest ?

lusty quest
#

this will not work

earnest phoenix
#

ok

#

it should be user.username

#

?

#

@lusty quest

lusty quest
#

try and see

earnest phoenix
#

ok

#

Ok so

#

I made meh clear commands

#

And I went to do one and it ended up doing like 4 of the same one

pale vessel
#

smh

lusty quest
#

you still cant follow instructions

pale vessel
#

some people just can't

earnest phoenix
#

Who me or Night

pale vessel
#

night

earnest phoenix
#

i followed the instructions

#

but it shows hugged undifined

lusty quest
#

did you got mutiple instances or nested events? @earnest phoenix

earnest phoenix
#

Here's the thing

#

Lmao I don't care about it

lusty quest
#

i dont really support here some wired Apps to code on phones

earnest phoenix
#

😩

#

Like I said

#

I don't care about the bot that much

#

That much but I mean

lusty quest
#

@earnest phoenix is your user object valid?

earnest phoenix
#

yeah no errors

lusty quest
#

ohh you get the member not the user. why?

earnest phoenix
#

When I'm too lazy to learn to code

lusty quest
#

then you need to do user.user.username

earnest phoenix
#

ok

lusty quest
#

or user.displayName

earnest phoenix
#

user.user.username works

#

thx for the help

#

Question

#

What do you use

#

I'm never sure about dat

#

Ping me that I'ma sleep

lusty quest
#

use? @earnest phoenix

pine aspen
#

Hi, how could I make a readAbleStream with axios?

restive pebble
#

fs.createWriteStream or createReadStream

surreal notch
#

@opal plank Hi

#

On morning my bot doesn't coming on9 but now i check it is on9 but it is not reponsding to cmds I am confused that rate limited is removed or not

torn ravine
#

on9?

surreal notch
#

ONLINe

torn ravine
#

oh

arctic cape
#

@surreal notch which language?

surreal notch
#

Discord.js

arctic cape
#

ohk

#

is there a console error?

surreal notch
#

Nope

arctic cape
#

how're you hosting the bot?

surreal notch
#

GLITCH

arctic cape
#

did u add the necessary scripts in package and package lock?

#

that works

surreal notch
#

Yes sir

#

but bot not responding

arctic cape
#

might be a prefix issue?

#

maybe

#

its better to console log the prefix and ping i think atleast

surreal notch
#

OHHHHHH

#

it worked

#

I forgot to that i have chanegd my custom prefix

#

thx for helping

arctic cape
#

😅

surreal notch
arctic cape
#

anybody who can tell me how to export commands ?

#

discord.js

restive furnace
#

depends if es6 or newer or just commonjs.

arctic cape
#

i expected something like a link of documentation lel can someone like give an example code or documentation code as my bot.js file is getting huge

restive furnace
#

es6:

export default class PingCommand {
/* things here, also this is my opinion to export commands on es6 */
}```

**commonjs**:
```js
module.exports = {
/* code here, example:
run: () => {}
*/
};```
surreal notch
#

@arctic cape You use command handler?

arctic cape
#

how do i know ? is it like written in package or pakage-lock

surreal notch
#

Um

restive furnace
arctic cape
#

thnks

surreal notch
#

Are your all codes in one file or different

arctic cape
#

i want to seperate them currently they are all mixed

restive furnace
#

if you dont use ts and havent declared type as module in package.json, you are using commonjs.

arctic cape
#

ok so i use commonjs

surreal notch
restive furnace
#

yeah, go in to that tutorial and find "command handler".

arctic cape
#

dependencies right?

#

in package.json

restive furnace
#

like?

#

what dependcy?

surreal notch
#

Despendencies show package u have installed

arctic cape
#
 "dependencies": {
    "discord.js": "^12.2.0",
    "discord.js-commando": "^0.10.0",
    "dotenv": "^8.2.0"
  }```
#

thats what i was asking u meant this only right ?

restive furnace
#

that tutorial how to do without commando

#

but you can use commando too

arctic cape
#

ok

restive furnace
arctic cape
#

ok thanks for the help

restive furnace
#

np

blazing ravine
#

why caps not work when using !setnick commandmsg.guild.members.cache.get(userni.user.id).setNickname(newusername);

restive furnace
#

to Clap Lower Clap Case Clap ()

blazing ravine
#

hm

#

toLocaleLowerCase() ?

restive furnace
#

why Locale??

blazing ravine
#

in prefix im using locale ;d

restive furnace
#

toLocaleLowerCase()

blazing ravine
#

msg.guild.members.cache.get(userni.user.id).toLowerCase().setNickname(newusername);

restive furnace
#

nono.

#

so what doesnt work with CAPS exactly?

earnest phoenix
#

ignore the prefix^^

blazing ravine
#

@restive furnace

#

hm

#

im using f!setnick @mention Test

#

and set's nick test

restive furnace
#

dont to(Locale)LowerCase args

#

Hey, I am coding a bot for the first time and shouldn't this return "Pong" if I say "!ping"?
yes, try with startsWith.

#

Also is this discord.js right?

blazing ravine
#

yes

restive furnace
#

dont to(Locale)LowerCase args

blazing ravine
#

ok

#

oh thanks

#

works

earnest phoenix
#

@restive furnace Where would I put startsWith? 😂

restive furnace
#

instead of === "ping", put thag method.

earnest phoenix
#

when i ping everyone in my server the bot shows a error and the bot stops working

#

how to fix that??

surreal notch
#

I want that whenever a person use command of my bot in any server it shows in my server : This person has used this command. in discord.js v12

honest perch
#

@surreal notch yeah, just send a message then

surreal notch
earnest phoenix
#

can someone helpme

faint prism
#

Sounds like you're trying to do an action on an object that is null

viral iris
#

why when i type -map -POI
to commands activated ? -map and -map -POI

if(args[0] == `${prefix}POI`) {
earnest phoenix
#

command works

viral iris
#

is it should be ! or what

earnest phoenix
#

!hug @granite pagoda but when i use !hug @everyone the bot shows the error and stops working

#

@viral iris

viral iris
#

u can't hug everyone

earnest phoenix
#

ik but i dont want the bot to stop working

#

@viral iris

honest perch
#

Please learn js

viral iris
#

what's the error

#

and stop pingingggggggggg

honest perch
#

Its a simple issue to solve

earnest phoenix
#

@viral iris : uses args
Also @viral iris : doesn't use switches but uses shitty if statements

honest perch
#

@earnest phoenix learn

earnest phoenix
#

If statements make your commands case sensitive

honest perch
#

Js

earnest phoenix
#

Oh

#

Maybe I gave him the wrong stuff

viral iris
#

@viral iris : uses args
Also @viral iris : doesn't use switches but uses shitty if statements
@earnest phoenix huh

earnest phoenix
#

thats my error

viral iris
#

where's user ?

#

which line ?

honest perch
#

He's doing @everyone

earnest phoenix
#

WTF

honest perch
#

So it cant get the user

#

Thats why

earnest phoenix
honest perch
#

I'm suggesting

#

To

#

Learn

#

Js

earnest phoenix
#

YEAH

viral iris
#

bruh

#

u can't hug everyone i told u

earnest phoenix
#

WE ARE STACKOVERFLOW GUYS WE WON'T SPOONFEED YA

#

Also John stop using if statements use switches

#

If statements make your commands case sensitive

#

If statements make your commands case sensitive
I typed that sentence so many times to people that auto correct remembered it

#

was

#

worked

#

grammar

viral iris
#

shut up minecraft kid

earnest phoenix
#

bro

restive furnace
#

lol

#

asks for help

#

and then refuses

earnest phoenix
#

lmao

surreal notch
restive furnace
#

go to 0auth2

#

and there

surreal notch
#

wot

#

what about this image

lusty quest
#

this is just a calculator for the flags

pure lion
#

e

surreal notch
#

please tell me the whole process anyone

earnest phoenix
#

It's not rly that hard

pure lion
#

Go to calculator

earnest phoenix
#

Oauth tab

pure lion
#

Put in user ID

#

Click perms

#

Copy link

earnest phoenix
#

Give admin for all perms

pure lion
#

Kaboom

earnest phoenix
#

And done

surreal notch
#

One by one

earnest phoenix
#

Kabruh

surreal notch
#

WHEN I PRESSED ADMIn on bot boz it showed me permsiion integer

earnest phoenix
restive furnace
#

dont spam that...

low trout
#

Is anyone available that can hop in a call? I need some help with something.

surreal notch
#

where to put user id?

#

Put in user ID
@pure lion