#development

1 messages · Page 999 of 1

solemn latch
#

Bot.users.size also is the cached users

#

Not all users

quartz kindle
#

you will need to fetch all members to do that

earnest phoenix
#

to get an accurate count you first need to download all members in the guild... which on d.js can spike up your ram usage by a fuckton

#

yeah

forest prairie
#

bruv

oak zealot
#

hi

amber fractal
#

fuckton is an understatement

#

especially if the bot is in this guild

solemn latch
amber fractal
#

May as well just light your server on fire at that point

quartz kindle
#

well you could fetch all and not cache them, but still...

earnest phoenix
#

or don't use retarded libs mmLol

quartz kindle
#

libs cant do anything about that

#

both retarded and non retarded

earnest phoenix
#

there's room for optimisation and storing objects

#

but that's mainly on the runtime and the language

quartz kindle
#

yeah but any half decent bot will likely not want to cache all at all times

amber fractal
#

guild.members.fetch({cache:false}) optimization™️ dont thank me

quartz kindle
#

^ this is what i do

solemn latch
#

Oo

#

I've not seen that before

#

And just loop through all guilds?

earnest phoenix
#

but you'll have to run it again on every command execution

#

which arguably costs more resources than caching

quartz kindle
#

exactly

solemn latch
#

Well, cache the result?

earnest phoenix
#

you can cut down on resource usage by using intents now though

amber fractal
#

yeah, but it still will have the spike in usage because it needs to put them all in memory for some time, just wont be a sustained high usage

quartz kindle
#

you could run it once and cache the numbers, and refresh it only if outdated for a day or so

#

or create your own custom member cache that just tracks bots

#

and control it with memberAdd/Remove

amber fractal
#

Tim you switched to using intents right?

#

did you see what you saved bandwidth wise after switching?

quartz kindle
#

btw the {cache:false} option doesnt actually exist in djs

#

its something i added myself

amber fractal
#

it should

#

In there it does

quartz kindle
#

does it?

amber fractal
#

idk if you can fetch all with it tho

#

because it doesnt say the userresolvable is optional

quartz kindle
#

the cache option is only for single id fetch

amber fractal
#

unless nothing just fetches all still

quartz kindle
#

not for fetch all

earnest phoenix
#

just manually clear the cache with reflection mmLol

quartz kindle
#

btw the bandwidth difference with presences enabled or disabled is basically 80% of the entire thing

amber fractal
#

You could edit the guildmembermanager to fetchmany with cache off

quartz kindle
#

if you disable presence updates, you use 5 times less bandwidth, literally

amber fractal
#

just have to know what you're doing mmLol

quartz kindle
#

i rewrote the entire GuildMemberManager.fetch() method

#

and replaced it with my own

amber fractal
#

👌

#

is that in d.js-light?

quartz kindle
#

ye

amber fractal
#

I didnt even see lmao you just manually modify the exports of each file that you change

quartz kindle
#

depends

amber fractal
#

ah you also use Structures.extend

quartz kindle
#

some stuff is hard to override

amber fractal
#

I never understood that

misty sigil
#

Ok, so I have mongo working

#

and the read

quartz kindle
#

its a marker for the cache option

#

i use it to know if this member is being added with cache on or off

#

the Object.getPrototypeOf line is basically a way to override a method that uses the super keyword

#

since you cannot use super outside of classes

amber fractal
#

so it's a ghetto super? mmLol

quartz kindle
#

yup

amber fractal
#

I like it

quartz kindle
#

could also have used this.__proto__.__proto__ but thats even uglier

#

lmao

amber fractal
#

nice

quartz kindle
#

js has weird things, but i find it awesome how easy it is to override anything

amber fractal
#

imagine showing this to someone who uses java

#

I think they'd just die

quartz kindle
#

yup

amber fractal
#

they'd have a heart attack

quartz kindle
#

js takes the entire private/protected keywords and throws them out of the window

amber fractal
#

I think the new EMCAScript stuff is adding private things arent they

#

or ES2019

warm marsh
#

It's done slightly different though.

amber fractal
#

Whatever it's called

#

it's #prop = x isnt it?

warm marsh
#

Yeah

amber fractal
#

can you have private methods though?

#

Never saw any of that

quartz kindle
#

not yet

amber fractal
#

I did see private getters and setters though

quartz kindle
#

but you can do this.#somefunc = function() {}

misty sigil
#

so my mongoDB promise is returning what it is supposed to

#

how do I get prefix from said promise

#

and then how do I apply said prefix from said promise

warm marsh
#

it returns a promise<object> doesn't it?

amber fractal
#

Show what you did

#

it should just be an object, yeah

#

like any other object

misty sigil
#

promise is an object

#

i think

warm marsh
#

Once you await the query

#

it will return an object or undefined if not found

#

You're bound to know how to interact with Objects in JS so it's just that.

misty sigil
#

here's what the promise returns

warm marsh
#

An object.

misty sigil
#

it is an object

warm marsh
#

it's just variablename.property

amber fractal
#

did you await it properly?

misty sigil
#

it's awaited, yes

amber fractal
#

you could one line it like let {prefix} = await mongocall

#

There's multiple ways to one line it, that's just the one I think of

#

it makes use of destructuring

#

or deconstruction

#

forgot if those are the same

leaden gust
#

destructuring

warm marsh
#

Also could do it with a default value.
let { prefix = 'defaultprefix' } = await mongocall

amber fractal
#

yep, you can also call it different stuff lmao, but it can get really complicated and prefix is probably fine

pale vessel
#

@warm marsh thank you, that's handy.

amber fractal
proper mist
#

I need help making a command like this:

When you type /challenge @user 5 Miami,
it dm's the @user a Message Embed of

Challenged By ${message.author.tag}
Rounds: 5
Server: Miami

crimson vapor
#

What part about it are you stuck on?

earnest phoenix
#

message.guild.members.kick(user) is true on v12?

solemn latch
earnest phoenix
#

I just asked bro.

#

i need true or false answer.

solemn latch
#

Are you looking for kickable?

earnest phoenix
#

what

#

no

solemn latch
#

I'm not sure what your asking then

pale vessel
#

don't think you can kick users but maybe it grabs their id instead and try to resolve it to a member, who knows

#

but probably false

earnest phoenix
#

I mean how can i kick a user on discord.js v12 version, okey?

pale vessel
#

just member.kick()

#

you can't kick users

#

they're not a guild member

solemn latch
#

The docs I linked gave that answer

earnest phoenix
#

so,message.guild.member('userid').kick() will work?

pale vessel
#

members.kick work too iirc

#

sure i guess

#

not sure if guild.member accepts IDs but i think it does since id is resolvable

misty sigil
#

Ok, so my prefix is readable in the promise

#

now how do I set it as the prefix

#

(extra details: lib: d.js/mongodb)

pale vessel
#

await it

misty sigil
#

it is

pale vessel
#

shouldn't be a problem then

misty sigil
#

i can read the prefix

#

i just don't know how to set it

pale vessel
#

prefix = await read()

#

or destructure it if you need to

#

what does the promise return?

misty sigil
#

I'll send an img

digital ibex
#

hello

pale vessel
#

and does it return the default prefix if none is set?

#

yo lost

digital ibex
#

does anyone know why js app.post( '/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login', failureFlash: true }) ); is giving me this error: Error: Unknown authentication strategy "local"

#

hi

rustic ridge
#

because local isn't an authentication strategy?

digital ibex
#

yes it is

rustic ridge
#

is that discord passport

digital ibex
#

no

#

i've done it before, and im doing it again!

pale vessel
#

did you install passport-local?

digital ibex
#

yeah

rustic ridge
#

whats the passport coming from?

digital ibex
#

passport?

pale vessel
#

hmm weird

#

did you use new LocalStrategy?

digital ibex
#

i done new Strategy

misty sigil
digital ibex
#

i just changed localstrategy to strategy

pale vessel
#

try new LocalStrategy

#

ah, why?

digital ibex
#

too long

#

im eating

pale vessel
#

@misty sigil destructure it let {prefix = "defaultprefix"} = await findPrefiz();

#

mfw typo

misty sigil
#

lol

#

so it'd be this
client.prefix = {prefix = "ab!"} = await client.db.collection("prefixes").findOne({"g_id":guild.id});?

digital ibex
#

this is my code: ```js
const { Strategy } = require('passport-local');

async function init(passport, getEmail, getID) {
// < insert unrelated code here >
passport.use(
new Strategy({
usernameField: 'email'
}),
auth
);```

pale vessel
#

prefix = "ab!" would be the default prefix, yes and then you try to get the prefix from the promise if available

misty sigil
#

prefix = "ab!" is the default

pale vessel
#

yeah then you're correct

#

try new LocalStrategy

misty sigil
digital ibex
#

thats just gonna be undefined tho

#

what would i define it as?

#

im not sure i understand how thats gonna change anything

pale vessel
#

what did you require for passport?

#

@misty sigil oNlY oNe wAy tO fInD oUt

misty sigil
#

welp

#

you're right

digital ibex
#

wym?

#

flazepe

#

u can see the code here if i done something stupid

#

i dont think i have or anything

pale vessel
#

you required passport for passport

#

don't you need to require passport-local?

#

not sure since i've never used this before

#

then you can use new LocalStrategy

misty sigil
#

wait does that line of code set it for guild?

pale vessel
#

yeah

misty sigil
#

cool

#

and both prefixes function?

pale vessel
#

both prefixes?

#

wdym

misty sigil
#

ab! and the custom one

pale vessel
#

yeah

#

ab if it couldn't find a custom prefix

misty sigil
#

ab! + custom if it could

digital ibex
#

im requiring passport-local

#

where am i using passport?

#

im only using passport for initialising it and stuff

pale vessel
#

if it errors out then make it js let prefix = "ab!"; const custom = await findPrefix(); if (custom.prefix) {prefix} = custom;

misty sigil
#

ok

pale vessel
#

you're using it on app.js lol

misty sigil
#

👌

#

great, now to figure out db write

digital ibex
#

yeah, because thats how u like initialise stuff

pale vessel
#

i'm pretty sure you can just change it to passport-local

digital ibex
#

hm, lemme try that

pale vessel
#

like where you require it

#

const passport = require("passport")

digital ibex
#

yeah

dusky mist
#

How can i obtain the user who deleted a message?

pale vessel
#

you can't

#

maybe through audit logs but it updates slow

dusky mist
#

Ofc i can

digital ibex
#

because i have the js app.use(passport.initialise()); and stuff

pale vessel
#

no, like the module name

#

you said you installed passport-local but you're requiring passport

dusky mist
#

Which is the problem of audit logs?

pale vessel
#

try const passport = require("passport-local");

digital ibex
#

im using both

pale vessel
#

wdym

digital ibex
#

im using passport-local and passport

misty sigil
#

so i have an async function for my prefixing

#

how would i use it?

pale vessel
#

const {LocalStrategy}

misty sigil
#
async function prefix(guild){
client.prefix = {prefix = "ab!"} = await client.db.collection("prefixes").findOne({"g_id":guild.id});
console.log(client.prefix)
}```
this is the code, idk if i done something wrong
pale vessel
#

where are you putting it

#

on message event?

digital ibex
#

lemme try that

pale vessel
#

and then change Strategy to LocalStrategy (no shit lul)

misty sigil
#

on message yes

digital ibex
#

yeah, same thing

#

same error

pale vessel
#

why don't you just await it without a function?

#

do you need to use it more than one time?

misty sigil
#

wait I can do that I’m dumb

pale vessel
#

the function is wrong btw

pure lion
#

can someone help me with canvas, i wanna draw a text boarder but it misses the text entirely

#

aa!eval (async () => {
const Discord = require('discord.js')
const Canvas = require('canvas');
const canvas = Canvas.createCanvas(750, 100);
const ctx = canvas.getContext('2d');

//loadImage(msg.author.displayAvatarURL({size: 512, format: 'png}).then((image) => { ctx.drawImage(image, 50, 0, 70, 70) })

ctx.fillStyle = '#7289DA'
ctx.fillRect(0, 0, 750, 100)

ctx.textAlign = 'center'
ctx.font = "50px Cartoon"

ctx.fillStyle = "white"
ctx.strokeStyle = 'white'
ctx.lineWidth = 3

var textWidth = ctx.measureText(msg.author.username).width
var fontsize = 50
var fontface = 'Sans'
var lineheight = fontsize * 1.286

ctx.strokeRect(75, 65, textWidth, lineheight)

ctx.fillText(msg.author.username, 75, 65)

const attach = new Discord.MessageAttachment(canvas.toBuffer(), 'h.png');
msg.channel.send(attach)
})()

digital ibex
#

bro

pure lion
#

orB

digital ibex
#

send it in a codebin or something

pure lion
#

noted

#

brb

digital ibex
sleek roost
#

Do I need a computer to create a bot or can I create a bot from my phone?

pure lion
#

yes

#

computer

#

phone bad

digital ibex
#

u can use a phone

pale vessel
#

it's something like ```js
client.prefix = "ab!";

const find = await findOne();
if (find.prefix) client.prefix = find.prefix;

digital ibex
#

u'd have to use something like glitch tho

sleek roost
#

Well thx I’ll use computer ,idk how to glitch my phone 😝

digital ibex
#

not-

#

sure

pure lion
pale vessel
#

what's the problem

pure lion
#

me?

pale vessel
#

mhmm

pure lion
#

i wanna draw a text boarder

#

but it misses the text

#

it draws to the right size, im just trash at numbe-

misty sigil
#

if it errors out then make it js let prefix = "ab!"; const custom = await findPrefix(); if (custom.prefix) {prefix} = custom;
@pale vessel "Declaration or statement expected."

radiant estuary
#

can somebody help me pls:

Code:
.filter(channel => channel.me.hasPermission("CREATE_INSTANT_INVITE"))

Console:

#

uf

pure lion
#

console???

#

i need more context

misty sigil
#

<message>.channel.me?

pure lion
#

^

misty sigil
#

NEED MORE CONTEXT

radiant estuary
#

client.channels.cache.filter(channel => channel.me.hasPermission("CREATE_INSTANT_INVITE"))

pure lion
#

hm

radiant estuary
#

can somebody help me pls

pure lion
#

etrhdsdfiohgiudsfgui

#

is it not in the docs?

radiant estuary
#

i find nothing

pure lion
#

im not sure

smoky spire
radiant estuary
#

ok thx. i try this

pure lion
misty sigil
#

errorjs (node:21200) UnhandledPromiseRejectionWarning: TypeError: client.db.collection(...).findOne(...) is not a function code in message event js let prefix = "ab!"; const custom = await client.db.collection("prefixes").findOne({"g_id":message.guild.id})(); if (custom.prefix)prefix = custom; console.log(client.prefix) and the client defining code js let mongoDB = await MongoClient.connect(`url`).catch(console.error) console.log("Connected to Mongo") client.db = await mongoDB.db("discordprefixes")
Libraries: mongodb and discord.js

tight plinth
#

Make sure you know what you do with your mongodb

misty sigil
#

i know what i do with my mongodb

tight plinth
#

Try logging client.db.collection('prefixes')

#

And see what it returns

misty sigil
#

Ok.

#

It returns 2 resolved promises I think

#

There's no custom prefix data yet

tight plinth
#

Show what it returns

misty sigil
pure lion
#

can someone help me with loadImage? it doesnt wanna work

misty sigil
#

what lang

pure lion
#

js

amber fractal
#

It's not a function you, you put an extra pair of () after the call

misty sigil
#

oof

pure lion
#

jeremy clarkson plj hep ><

misty sigil
#

I'm looking some stuff up

#

gimme a sec

pure lion
#

ok thx

misty sigil
#

I'm not finding anything

pure lion
#

damn

misty sigil
#

p5.js appears to be the only thing appearing

pure lion
#

sdfbhkjhsga

#

wait ill check stack

earnest phoenix
#

I wanna slice the first argument, for example:
"Hey! what's up?" will become: "what's up?"
But I don't seem to get it for some reason

misty sigil
#

do that, they generally have loads of awnsers

hoary elm
#

p5.js appears to be the only thing appearing
@misty sigil iirc loadImage is a Canvas String.

misty sigil
#

Ahh, no idea about canvas

hoary elm
#

Been a while since I’ve used canvas but I remember seeing it there

pure lion
#

@hoary elm u got any ideas?

misty sigil
#

@hoary elm

pure lion
#

do i use await/image#onload because i have no idea

hoary elm
#

Uhh

#

^^

earnest phoenix
#

I wanna slice the first argument, for example:
"Hey! what's up?" will become: "what's up?"
But I don't seem to get it for some reason
@earnest phoenix Does anyone know?

pure lion
#

b a l l s

#

substring(args[0].length + (excess amount))

pale vessel
misty sigil
#

wai waht

#

ty

earnest phoenix
#

substring(args[0].length + (excess amount))
@pure lion wdym by substring

#

oh nvm lol

misty sigil
#

#development message @misty sigil
@pale vessel still doesn't give the default prefix js Cannot read property 'prefix' of null and the line of code causing it is js if (find.prefix) client.prefix = find.prefix;

#

the if statement obviously sees that find.prefix exists somehow

pale vessel
#

are you sure client is defined

misty sigil
#

client is defined

pale vessel
#

find && find.prefix

#

put that in the if statement

earnest phoenix
#

im still confused
what is the substring method?

misty sigil
#

yea that worked

#

I'll keep that in mind for the future, thanks

pure lion
#

im still confused
what is the substring method?
message.content.substring

earnest phoenix
#

yeah ok, but what is it?

pale vessel
#

no he asked what it is

earnest phoenix
#

i wanna know and not copy & paste

pale vessel
#

it's like slice

#

you know slice?

pure lion
#

but better

pale vessel
#

faster

earnest phoenix
#

i never used those, thats why im trying to get to know them

pure lion
#

it gets a portion of the string

earnest phoenix
#

like a part of it ?

pure lion
#

yea

misty sigil
#

yea(edited)

earnest phoenix
#

but afaik it cuts a part of a word and not a full arg

misty sigil
#

yup

#

i think

earnest phoenix
#

i wanna cut a full arg tho

pale vessel
#

slice works on both arrays and strings while substring only works on strings

earnest phoenix
#

what do i put in the slice to cut a specific arg?

pure lion
#

so if i did

let str = 'abcde12345'
let test = str.substring(2, 4)
output: bcd
earnest phoenix
#

thats what i read(but with slice)

pure lion
earnest phoenix
#

i tried using
let thing = args.join(" ").slice(-1, 1)

#

so it will give me args 0 for example

#

i really dont get it..

clever garnet
#

bot.user.setStatus('offline')
whats wrong with this code its not working

im using discord.js

earnest phoenix
#

it takes a few mins so it updates

#

i used this

let itemname = args.join(" ").slice(itemprice.length)```
!additem 100 a
which works but on console it makes a lot of spaces "    a   "
quartz kindle
#

you need to slice before joining

earnest phoenix
#

why is that

quartz kindle
#

so you can slice by words instead of characters

earnest phoenix
#

OH

quartz kindle
#

for example

marble geode
#

slice first then join

quartz kindle
#

"abczyx".slice(1) = "bczyx"
["abc","zyx"].slice(1) = ["zyx"]

earnest phoenix
#

becuase then it counts as an array?

quartz kindle
#

yup

earnest phoenix
#

args

#

args.slice(itemprice.length).join(" ")?

quartz kindle
#

no, you slice by number of items in the array

#

so if you have an array of words, you just slice by 1 to remove the first word

#

no matter what length the word is

earnest phoenix
#

but isnt that supposed to be 0 because of the array?

#

because 0 is first

quartz kindle
#

yes, what slice does is give you sub-selection of the array

earnest phoenix
#

then 1 is first

#

oh

quartz kindle
#

.slice(1) means all array items from index 1 to last index

#

skipping index 0

#

which equals to removing index 0, aka the first word

earnest phoenix
#

ok
so slice 1 will get everything after 0

quartz kindle
#

yes

earnest phoenix
#

you are the best Tim

#

thanks!!!!

quartz kindle
#

👍

misty sigil
#

so

#

now how do i write to my mongodb

earnest phoenix
quartz kindle
#

<voicechannel>.connect()

#

where voicechannel is a channel you have to get from somewhere

#

for example bot.get_channel(id)

ember atlas
#

Hey! So I am currently modifying dragory's modmail bot to do a special feautre where if the user is muted it sends them a dm, does this look right? It's currently not working with no errors

bot.on("guildMemberUpdate", async (oldMember, member) => { 

  let role = "726573617806311546"; 
  
  if (oldMember.roles.size < member.roles.size) { 
    if (member.roles.has(role)) { 
      try{
        const dmChannel = await bot.getDMChannel(member.id) 
        dmChannel.createMessage(`Hey! You have been temporarily muted in the "Avatar: The Last airbender" discord - if you wish to talk to the Sentries or White Lotus please reply to this DM`)
      }catch{
        bot.createMessage("726569173353889923", `Member: ${member.user.username}#${member.user.discriminator} was muted, and I attempted to DM them but they had DMs closed.`)
      }
    }
  }

})
misty sigil
#

I dunno, it looks fine

quartz kindle
#

djs v11?

smoky spire
#

def not djs

quartz kindle
#

ah maybe eris

ember atlas
#

eris

quartz kindle
#

.on("guildMemberUpdate", (guild,newMember,oldMember) => {})

ember atlas
#

newMember?

quartz kindle
#

you can give it any name you want

#

just the order that matters

ember atlas
#

oh i see

#

thank you ill try this :)

limber swan
#

Someone could help here?
TypeError: Cannot read property 'toUpperCase' of undefined

const info = client.channels
            .cache.map(cat => stripIndents`${cat[0].toUpperCase() + cat.slice(1)} \n${commands(cat)}`)
            .reduce((string, category) => string + "\n" + category);```
quartz kindle
#

cat[0] is undefined

limber swan
#

to what should I changed it

quartz kindle
#

cat is not an array nor a string

#

its a channel object

ember atlas
#

tim it still didnt work :(

quartz kindle
#

if you want the channels name, you should use cat.name

limber swan
#

alright, lets try thanks

quartz kindle
#

@ember atlas oldMember.roles is an array

ember atlas
#

mhm

quartz kindle
#

so you have to use .length

ember atlas
#

oh

#

oop

#

oop

#

what the

quartz kindle
#

actually both of them are arrays

jade thorn
#

Hi

ember atlas
#

ya

#

ill add .length and check

#

hey tim, how can i check if a member has a certain role?

#

i thought it was how i did it, but i guess that isnt a function according to the error i got

quartz kindle
#

roles.includes()

#

this is one of the reasons eris is lighter than djs, using arrays instead of collections in lots of places

#

lmao

ember atlas
#

thanks tim youre the best

quartz kindle
#

<3

ember atlas
#

one more thing, i have it that if the user doesnt have dms open it sends to a channel, any idea why it wouldnt send?

quartz kindle
#

await dmChannel.createMessage()

#

otherwise the error isnt thrown in the try/catch block

ember atlas
#

this part

}catch{
        bot.createMessage("726569173353889923", `Member: ${newMember.user.username}#${newMember.user.discriminator} was muted, and I attempted to DM them but they had DMs closed.`)
      }
quartz kindle
#

yes, createMessage() has to be awaited

ember atlas
#

aah

quartz kindle
#

otherwise any error it throws gets lost in limbo

#

aka, unhandled promise rejection

#

or if you prefer, bot.createMessage().catch(() => bot.createMessage())

ember atlas
#

thanks, it all works perfectly

#

just gotta figure out why gitignore isnt ignoring the node modules now : D

quartz kindle
#

lmao rip

limber swan
#

Someone could help here?
TypeError: Cannot read property 'toUpperCase' of undefined

const info = client.channels
            .cache.map(cat => stripIndents`${cat[0].toUpperCase() + cat.slice(1)} \n${commands(cat)}`)
            .reduce((string, category) => string + "\n" + category);```

Tim, nop, still not working

quartz kindle
#

you changed nothing

limber swan
#

nono, thats the messague quote

quartz kindle
#

where are the changes

misty sigil
#

hey

limber swan
#
const info = client.channels
            .cache.map(cat => stripIndents`${cat.name.toUpperCase() + cat.slice(1)} \n${commands(cat)}`)
            .reduce((string, category) => string + "\n" + category);```
But it returns Cannot read property 'toUpperCase' of undefined
misty sigil
#

how do I write to my mongodb

#

im using mongodb official lib

solemn latch
#

its probs on the docs

limber swan
#

It should be like updateOne

quartz kindle
#

cat should be a channel object here

solemn latch
#
const updateDocument = function(db, callback) {
  // Get the documents collection
  const collection = db.collection('documents');
  // Update document where a is 2, set b equal to 1
  collection.updateOne({ a : 2 }
    , { $set: { b : 1 } }, function(err, result) {
    assert.equal(err, null);
    assert.equal(1, result.result.n);
    console.log("Updated the document with the field a equal to 2");
    callback(result);
  });
}
quartz kindle
#

there is no reason for cat.name to be undefined

solemn latch
quartz kindle
#

can you do console.log(client.channels.cache)?

limber swan
#

one sec

#

cat.slice is not a function

earnest phoenix
#

How can i fetch a channel last message?

quartz kindle
#

@limber swan cat.name.slice

#

also did you console.log it? why did the uppercase error suddenly disappear?

#

did you forget to save the file and restart the bot before?

limber swan
#

yes

#

it sent this to teh channel: MEMBER-LOGSember-logs :notes: MUSIC 3 Music 3 :tools: LOGS logs REACT-HEREeact-here AUDIT-LOGudit-log PARTNER-BOTSartner-bots TESTING-MASTIVEesting-mastive PARTNERartner :bell: INFORMATION INFORMATION COMMANDSommands :notes: MUSIC 2 Music 2 NEWSews UPDATESpdates :closed_lock_with_key: VERIFY verify STAFFtaff ANNOUNCEMENTSnnouncements PARTNER-SUPPORTartner-support :speech_balloon: GLOBAL Global MEMESemes :speaking_head: VOICE VOICE CHAThat PRIVATErivate BIG-PARTNERSig-partners MEETINGSeetings :incoming_envelope: SUPPORT support HELPelp GIVEAWAYSiveaways SMALL-PARTNERSmall-partners PARTNERSHIP-REQUESTSartnership-requests FREQUENT-QUESTIONSrequent-questions CHAThat INFORMATIONnformation STAFF-APPLICATIONStaff-applications STAFF-UPDATEStaff-updates :notes: MUSIC 1 Music 1 :speech_balloon: CHAT CHAT

quartz kindle
#

ok so cat is the channel object, and cat.name is the name of the channel, so everywhere you used cat before, you should now use cat.name

limber swan
#

alright

earnest phoenix
#

Anyone?

quartz kindle
#

cat.name.slice()

misty sigil
#

uppsercate

quartz kindle
#

@_@

#

@earnest phoenix await channel.messages.fetch(channel.lastMessageID)

limber swan
#

still returning the same message,

quartz kindle
#

show updated code

limber swan
#
 const info = client.channels
            .cache.map(cat => stripIndents`${cat.name[0].toUpperCase() + cat.name.slice(1)} \n${commands(cat)}`)
            .reduce((string, category) => string + "\n" + category);
            console.log(client.channels.cache);```
quartz kindle
#

and the error is toUpperCase of undefined?

#

or what is the exact error

limber swan
quartz kindle
#

well, you're doing client.channels.cache.map

#

you're mapping channels

#

not commands

limber swan
#

oh

quartz kindle
#

lmao

limber swan
#

so I change channels to comamnds, right?

quartz kindle
#

idk

#

depends how you coded your command handler

limber swan
#

may I shouw ti to you?

#

show

quartz kindle
#

ok

limber swan
#
readdirSync("./commands/").forEach(dir => {
        const commands = readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js"));
        for (let file of commands) {
            let pull = require(`../commands/${dir}/${file}`);
            if (pull.name) {
                client.commands.set(pull.name, pull);
                table.addRow(file, '✔️');
            } else {
                table.addRow(file, `❌`);
                continue;
            }
            if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
        }
    });```
quartz kindle
#

you save them in client.commands

#

so you should be able to do client.commands.map()

limber swan
#

There thanks

misty sigil
#

hey lads

#

i got everything working

#

so now i want my bot to respond to mentions

pale vessel
#

check if the message contains the mention before initializing prefix

misty sigil
#

i want it to respond to mentions besides the prefix

pale vessel
#

you can easily integrate that

placid iron
#

Isn't it just a true false thing

pale vessel
#

yeah plus make the length mention length

quartz kindle
#

can be as simple as ```js
if(message.content.startsWith("<@BOTIDHERE>") || message.content.startsWith("<@!BOTIDHERE>")) {
run command
} else {
prefix = get prefix from db
if(message.content.startsWith(prefix)) {
run command
}
}

placid iron
#

Oh god

#

On message

pale vessel
#

hmm?

misty sigil
#

YESS

#

it works

#

thanks for all the help

gentle wyvern
#

-help

#

-botinfo @gilded plank

gilded plankBOT
#
Bot info
ID

264811613708746752

Username

Luca

Discriminator

1375

Short Description

Luca is a bot for managing and informing members of the server

Library

discord.js

Prefix
  • or @Luca#1375
Total Upvotes

334

Monthly Upvotes

13

Server Count

2 Servers

Owner(s)

@fossil oxide dblAdmin dblMod
@languid dragon dblCertified
@bitter sundial dblAdmin

misty sigil
gentle wyvern
#

Sorry

misty sigil
#

dw, just sayin

earnest phoenix
#

how do I see how many bots are in all of the servers my bot is in?

#

@earnest phoenix

languid lance
#

.

earnest phoenix
#

?

queen violet
#

does anyone know how to svg

pale vessel
#

use an illustrator

hushed cypress
#

please

#

i need peoples who uses my bot

misty sigil
#

@ember atlas same but in this channel

#

bots dont need admin perm

pale vessel
#

awesome

ember atlas
#

@hushed cypress Not the place for it.

limber swan
#

How would u do an if statement that determines if data is != to soemthing
return a message and if its = return an other

if (message.content !== something) {
} else {
}```?
pale vessel
#

mhmm

#
if (you != gay) return send("you're not gay");
else return send("you're gay");```
earnest phoenix
#

also im confused. i finished setting up the environment for my bot, but i dont know what to do after

#

im stuck at bot-env again

#

what the actual hell do i do

#

i am stuck stuck

rancid spade
#

I have servers update (api for fortnite server).
And if the servers change
It goes like
Old: v10
new : v11
so how to do that ?

dusk sphinx
#

I need command prefix for admin separate with non admin

#

Just change it by edit it

rancid spade
dusk sphinx
#

Update

rancid spade
#

but why ?
there's api for autoupdate

dusk sphinx
#

Idk y is that happen

earnest phoenix
#

oh i got a new errror this time

rancid spade
#
            .addField('``servers``', `[ ${client.guilds.size}]`, true)
            .addField('``channels``' , `[ ${client.channels.size} ]` , true)
#

what's wrong ?

#

it goes like
Servers:
[undefined]

steel drum
#

@rancid spade in v12 of discord.js its client.guilds.cache.size

rancid spade
#

@rancid spade in v12 of discord.js its client.guilds.cache.size
@steel drum what about channels & users

steel drum
#

same thing

#

client.channels.cache.size and you can see the pattern

rancid spade
#

thanks

earnest phoenix
#

damn

#

the rest of this channel is actual questions revolved around bots that already work

#

ive never gotten my bot to work because they never gave me any clue on what the actual fuck to do

#

why does it say i have python 2.7 when i have python 3.8.3

rancid spade
#

owner id command only

prime cliff
#

What command handler are you using also check the docs there should be a bool option for inline

sonic lodge
#

hi, does a bot need the "manage messages" permission to delete its own messages

earnest phoenix
#

no

sonic lodge
#

ok ty

earnest phoenix
#

i still dont know what to do after i create the environment

#

@winter basalt the bot.py file i "found" was something else that i dont even know why it exists

#

no docs i can find has any sort of thing telling me what the fuck to do

#

it doesnt tell me where to go

#

well

#

it just expects me to know all that shit like ive done this before

#

it's not the library's job to teach you language fundamentals

#

it's expected of you to already know that

#

but it is the documentaries job to teach me language fundamentals

#

how do valorant stats work with discord bots?

#

not the lib docs

#

how do valorant stats work with discord bots?
@earnest phoenix
those two aren't related whatsoever, what is your actual question

#

wait

#

how do i gain access to valorant stats

#

look for an API that offers that

#

yes

#

riot has one

#

valorant has one just like youtube, osu!, discord bot list, and many other products do

#

i dont feel like submitting anything

#

...

#

wait so

#

it says i need saome

#

but like idk what to put in it

#

do i put my client id

regal raven
#

What is inline in embeds?

spare mirage
#

Hey! I started making my first discord bot yesterday and I am having problems with making embeds

const bot = new Discord.Client(); 
const token = ''; 

const cheerio = require('cheerio');
 
const request = require('request');

const PREFIX = ("b!")

embedhelp = new Discord.RichEmbed()

bot.on('ready', () =>{ 
    console.log('Im alive! woop woop!'); // do node . to run
    bot.user.setActivity('**b!help**');
})

embedhelp.setTitle("Help! :clipboard::banana:")
embedhelp.setAuthor("Banana")
  /*
   * Alternatively, use "#00AE86", [0, 174, 134] or an integer number.
   */
   
  embedhelp.setColor(0x00AE86)
  embedhelp.setDescription(":banana:About Banana!: \n      Banana is a bot bases on having fun \n      And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
  /*
   * Takes a Date object, defaults to current date.
   */
  embedhelp.setTimestamp();
  /*
   * Inline fields may not display as inline if the thumbnail and/or image is too big.
   */
  /*
   * Blank field, useful to create some space.
   */
bot.on('message', message=>{
    if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
    if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n  ");
    if (message.content.startsWith("@Banana#2028")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
    if (message.content.startsWith(PREFIX + "image" )) image(message); 
    if (message.content.startsWith(PREFIX + "help" )) message.channel.send({embedhelp});
}) // commands```
#

this is all the code around the embeds and commands it just doesnt work

earnest phoenix
#

How to check our bot server list from eval command

lusty quest
#

@spare mirage try the code brackets (3x ` at the front at the end)

#

@regal raven you can get 3 Fields next to each other with it instead beneth each other

regal raven
#

😮

#

Noice

spare mirage
#

is that better @lusty quest

lusty quest
#

yes better to read

regal raven
#

Yes that is to me

earnest phoenix
#

Can you help me

lusty quest
#

what is your exact issue?

earnest phoenix
#

How to check our bot server list from eval command

spare mirage
#

thats seems more like a question for #support

earnest phoenix
#

I have eval command

lusty quest
#

yes

#

you should lock it to a check that only you can run it

dusk sphinx
#

How to do command for other command beside ping and help

spare mirage
#

a response?

#

can u explain better?

dusk sphinx
#

I want to add new command

lusty quest
#

what exactly doesnt work @spare mirage

spare mirage
#

something with the variable

lusty quest
#

there are like 5 variables in the code

spare mirage
#

@dusk sphinx commands are kinda easy if u understand them

lusty quest
#

discord.js V11 or V12?

spare mirage
#

Who?

lusty quest
#

you

spare mirage
#

I dont know

#

where do I check it

lusty quest
#

nvm package.json

dusk sphinx
#

Which is command of these 2 '!' or "!" for adding the new command

lusty quest
#

none of them

earnest phoenix
#

do i need to pay for a ssl certificate to get this shit to work

dusk sphinx
#

How

lusty quest
#

you can get a free one with Lets Encrypt or if your domain is listed at Cloudflare you can get a free one

earnest phoenix
#

but like its not a domain its a whole fucking bot wth

spare mirage
#

@dusk sphinx do you already have 1 command?

dusk sphinx
#

You mean this <___>

#

No..almost

lusty quest
#

usually SSL certs are bound to a domain

#

but you can bind them to a ip if needed

earnest phoenix
lusty quest
#

@spare mirage what is now your D.js version?

prime cliff
#

You can get an ssl cert for free too

earnest phoenix
#

hm

dusk sphinx
prime cliff
#

You don't own the domain so you can't get an ssl for discord.com

#

What are you even trying to do

earnest phoenix
#

not get this error

spare mirage
#

@lusty quest I dont know how to find it

lusty quest
#

package.json

#

open it and its in there

#

or npm discord.js -v

dusk sphinx
#

I need example command type please

spare mirage
lusty quest
#

@dusk sphinx no spoon feeding here

#

@spare mirage run npm i discord.js

spare mirage
#

im dumb how lmaoooo

lusty quest
#

in a shell?

#

or terminal

spare mirage
#

||kinda 2 weeks old to coding||

#

ok

lusty quest
#

you need to install the package in order to use it

dusk sphinx
spare mirage
lusty quest
#

this doesnt change the fact that you need to learn how to code @dusk sphinx

spare mirage
#

I suppose its version12

lusty quest
#

@spare mirage try to run your bot again

#

yes

#

its possible that there are more missing packages

earnest phoenix
#

superbrain

#

lets encrypt's cheapest plan

lusty quest
#

its free

spare mirage
earnest phoenix
#

is 15 usd a month

lusty quest
#

right change it rich to Message

earnest phoenix
lusty quest
#

@earnest phoenix get certbot (on linux idk windows)

earnest phoenix
#

fuck linux

#

i use windows

lusty quest
prime cliff
#

LMFAO $15 for 1 website

#

You're getting scammed

lusty quest
#

probably wrong site

prime cliff
#

@earnest phoenix you're getting scammed

spare mirage
#

right change it rich to Message
@lusty quest wait what?

lusty quest
earnest phoenix
#

what the hell is certbot

prime cliff
#

certbot is a linux tool to create free lets encrypt ssl certs

spare mirage
#

instead of Discord.RichEmbed()?

prime cliff
#

You can do that or you can use a website to create a free ssl cert

lusty quest
#

yes

spare mirage
#

And is the M capital?

lusty quest
#

yes

prime cliff
spare mirage
#

alright.. what do I do now

delicate shore
#
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.HasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
#

It this correct

lusty quest
#

pls set it in in a codeblock

#

thx

spare mirage
#

I guess u need to do
if (!botChannel)

delicate shore
#

That's what I did

lusty quest
#

why did you send a message if the bot is not in a channel? Would it be better to check if the bot has permissions to connect and if they are not there throw a message?

delicate shore
#

Like ?

#

If it can't connect for playing a song it says that he don't have perms

spare mirage
#

If I run my bot now I get this error
S C:\Users\Edwin\Desktop\Banana> node index.js
(node:1204) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\Edwin\Desktop\Banana\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\Edwin\Desktop\Banana\index.js:85:5)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(node:1204) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1204) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

delicate shore
#

What is that code ?

earnest phoenix
#

how the fuck do i use certbot

delicate shore
#

if (!Bot.HasPermission = "Connect"))

#

Is it this ?

lusty quest
#
    const permissions = voiceChannel.permissionsFor(msg.client.user);
        if (!permissions.has('CONNECT')) {
            return msg.channel.send('I cannot connect to your voice channel, make sure I have the proper permissions!');
        }
        if (!permissions.has('SPEAK')) {
            return msg.channel.send('I cannot speak in this voice channel, make sure I have the proper permissions!');
        }

``` as example checks that the bot can connect and can speak
#

@spare mirage did you login properly?

spare mirage
#

oh lmaaooo

delicate shore
#

What

spare mirage
#

I deleted my ticked so it wouldnt get leaked

delicate shore
#

Why I need this

spare mirage
#

token*

delicate shore
#

See wait

earnest phoenix
#

im pretty sure if (!Bot.HasPermission = "Connect")) just checks if the bot doesnt have the permission, and if (Bot.HasPermission = "Connect")) checks i9f the bot does have the permission

delicate shore
#

It already has a command

earnest phoenix
#

or maybe im just dumb as shit

delicate shore
#

im pretty sure if (!Bot.HasPermission = "Connect")) just checks if the bot doesnt have the permission, and if (Bot.HasPermission = "Connect")) checks i9f the bot does have the permission
@earnest phoenix
Yes

earnest phoenix
#

:o

delicate shore
#

@lusty quest if it cant connect it already says

#

That I need following perms

earnest phoenix
#

@lusty quest

#

how

#

tf do you

#

use certbot

lusty quest
#

learn linux

earnest phoenix
#

no

lusty quest
#

its a linux tool. i dont think you can use it on Windows

dusk sphinx
#

Lol

spare mirage
earnest phoenix
#

it can be used on windows

dusk sphinx
#

Every platform can use it

earnest phoenix
dusk sphinx
#

Scam website is not allow to have

lusty quest
#

i never used it on windows bcs its dumb to use a Windows server for most Web Applications

delicate shore
#

For leave command ?

dusk sphinx
#

Have you put join command for voice

delicate shore
#

No

spare mirage
#

Doesnt CodeLyon have an tutorial on music bots?

delicate shore
#

It only joins if played

#

Or searched

dusk sphinx
#

That's what happen

lusty quest
#

you dont need a join command

earnest phoenix
#

its saying i need a http website

lusty quest
#

you can have the bot join on successful search query

earnest phoenix
#

this isnt a fucking website

dusk sphinx
#

There's 2 type..so.

viral iris
#

can any1 help ?

earnest phoenix
delicate shore
#

It says unidentified token
Return

#
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.HasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
dusk sphinx
#

I couldn't focus at it if some1 in real life bothering me

delicate shore
#

In this ^

spare mirage
#

@lusty quest My bot logs in but the command still doesnt work :/
I am thinking something is wrong here
if (message.content.startsWith(PREFIX + "help" )) message.channel.send({embedhelp});

delicate shore
#

what

viral iris
#

how to do custom prefix for server
only 1 server

delicate shore
#

Why don't you make a command holder ?

spare mirage
#

Who are u talking to doggo

delicate shore
#

Yo

lusty quest
#

remove startsWith

delicate shore
#

You

viral iris
#

remove startsWith
@lusty quest just?

surreal notch
#

anyone can help me in making login with discord feature i dont know much about oath2

lusty quest
#

yes

dusk sphinx
#

You need this ! After the command

lusty quest
#

@viral iris get some sort of DB and then store the prefix in there

delicate shore
#

@spare mirage make a command holder

earnest phoenix
viral iris
#

yes
@lusty quest ```js
if (message.content === "-help") {

or 
```js
    if (message.content === "help") {
dusk sphinx
#

Lol...i found it but..

lusty quest
#

you dont need a website

earnest phoenix
#

ok'

delicate shore
#

Can anyone help ?

earnest phoenix
#

for certbot? yes you do lol

spare mirage
#
    if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
    if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://www.youtube.com/channel/UCI3uMSDZzJ8T2X_r0PZEzWA?view_as=subscriber ");
    if (message.content.startsWith("@Banana#2028")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
    if (message.content.startsWith(PREFIX + "image" )) image(message); 
    if (message.content(PREFIX + "help" )) message.channel.send({embedhelp});
}) // commands```
lusty quest
#

if (message.content === `${prefix}help`) {

earnest phoenix
#

@delicate shore breh

spare mirage
#

@delicate shore

delicate shore
#
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.HasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
#

What is wrong I. This

earnest phoenix
earnest phoenix
#

ez

delicate shore
#

It says return token didn't found

earnest phoenix
#

don't ask to ask just ask your question jfc

#

hm

viral iris
#

if (message.content === ${prefix}help) {
@lusty quest but i need custom prefix for this server only

delicate shore
#

Like invalid toke.

lusty quest
#

@viral iris not you

earnest phoenix
#

you're not closing your if statement @delicate shore

#

@surreal notch what is your client id

spare mirage
#

Superbrain it still doesnt work

#

logs in though

surreal notch
#

Why?

delicate shore
#

What

lusty quest
#

you need to get some sort of DB and store your prefix in there @viral iris

delicate shore
#

Where ?

earnest phoenix
#

well

dusk sphinx
#

No begging for code

lusty quest
#

@spare mirage is your code correct?

#

if (message.content === `${prefix}help`) {

earnest phoenix
#

you said something that was incoherent @surreal notch all i could read was oauth2 which probably means bot invite

viral iris
#

you need to get some sort of DB and store your prefix in there @viral iris
@lusty quest what's DB

lusty quest
#

Database

surreal notch
#

@earnest phoenix Sipp

earnest phoenix
#

or

viral iris
#

but heroku don't save DB

surreal notch
#

ik how to make bot invite

earnest phoenix
#

if it's this server only

lusty quest
#

you need to do it yourself

earnest phoenix
#

just do in code check for the id

spare mirage
#

uhh I use

if (message.content(PREFIX + "help" )) 
lusty quest
#

should do the same

spare mirage
#

ik

dusk sphinx
#

(Ō~Ō")

spare mirage
#

const PREFIX = ("b!") maybe my prefix is just weird

lusty quest
#

it should work

#

since it looks for messages that contain b!help

dusk sphinx
#

Else if for seperate command?

lusty quest
#

make sure there is not somewhere a space

#

use a switch case

#

Else if works too but ends in spagetti code

spare mirage
#

bot.on('ready', () =>{ 
    console.log('Im alive! woop woop!'); // do node . to run
    bot.user.setActivity('**b!help**');
})

embedhelp.setTitle("Help! :clipboard::banana:")
embedhelp.setAuthor("Banana")
  /*
   * Alternatively, use "#00AE86", [0, 174, 134] or an integer number.
   */
   
  embedhelp.setColor(0x00AE86)
  embedhelp.setDescription(":banana:About Banana!: \n      Banana is a bot based on having fun \n      And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
  /*
   * Takes a Date object, defaults to current date.
   */
  embedhelp.setTimestamp();````
maybe this is wrong
lusty quest
#

did you get any error?

spare mirage
#

no

#

thats weird

lusty quest
#

replace the embed with a simple message just for checking

#

or run your ping command and see if it works

spare mirage
#

lemme try doing if (message.content.startsWith(PREFIX + help)) message.channel.send("hello!")

lusty quest
#

help needs to be a string

spare mirage
#

Wait what... it goes onlie if I dont use message.channel.send({embedhelp})

#

kinda weird

lusty quest
#

?

spare mirage
#

I think I found whats wrong

#

if (message.content(PREFIX + "help" )) message.channel.send("Hello!");

#

it has to be if (message.content(PREFIX + "help")) message.channel.send("Hello!");

#

right?

earnest phoenix
#

it doesn't matter

#

the compiler doesn't care about spaces

lusty quest
#

^

spare mirage
#

reeeee

earnest phoenix
#

your issue is that you're trying to send the embed wrapped inside of another object

#

just pass the embed directly as an argument

#

oh nvm

#

v12

spare mirage
#

None commands work rn

earnest phoenix
#

right

#

i forgot

surreal sage
#
  var wallet = db.get(`${message.author.id}.balance`)
  var bank = db.get(`{message.author.id}.bank`)
  console.log(db.get(`{message.author.id}.bank`))
  const embed = new Discord.RichEmbed()
  .setAuthor(`${message.author.tag}'s Balance`, message.author.avatarURL)
  .addField("Wallet", `**${wallet}** Skiddo Coins`)
  .addField("Cloud", `**${bank}** Skiddo Coins`)
  .setColor("GREEN")
  message.channel.send(embed)``` bank returns null while its 2 when i eval
spare mirage
#

could it be because the embed is made before the command?

 
const request = require('request');

const PREFIX = ("b!")

embedhelp = new Discord.MessageEmbed()

bot.on('ready', () =>{ 
    console.log('Im alive! woop woop!'); // do node . to run
    bot.user.setActivity('**b!help**');
})

embedhelp.setTitle("Help! :clipboard::banana:")
embedhelp.setAuthor("Banana")
  /*
   * Alternatively, use "#00AE86", [0, 174, 134] or an integer number.
   */
   
  embedhelp.setColor(0x00AE86)
  embedhelp.setDescription(":banana:About Banana!: \n      Banana is a bot based on having fun \n      And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
  /*
   * Takes a Date object, defaults to current date.
   */
  embedhelp.setTimestamp();
  /*
   * Inline fields may not display as inline if the thumbnail and/or image is too big.
   */
  /*
   * Blank field, useful to create some space.
   */
bot.on('message', message=>{
    if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
    if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://www.youtube.com/channel/UCI3uMSDZzJ8T2X_r0PZEzWA?view_as=subscriber ");
    if (message.content.startsWith("@silk moat")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
    if (message.content.startsWith(PREFIX + "image" )) image(message); 
    if (message.content(PREFIX + "help")) message.channel.send("Hello!");
}) // commands```
tepid canyon
#

Youre missing the $

earnest phoenix
#

please stop putting like globs of code in chat

steep garnet
#

hey guys.

surreal sage
#
  var wallet = db.get(`${message.author.id}.balance`)
  var bank = db.get(`{message.author.id}.bank`)
  console.log(db.get(`{message.author.id}.bank`))
  const embed = new Discord.RichEmbed()
  .setAuthor(`${message.author.tag}'s Balance`, message.author.avatarURL)
  .addField("Wallet", `**${wallet}** Skiddo Coins`)
  .addField("Cloud", `**${bank}** Skiddo Coins`)
  .setColor("GREEN")
  message.channel.send(embed)``` bank returns null while its 2 when i eval

@surreal sage

lusty quest
#

quickdb?

steep garnet
#

guys

surreal sage
#

yes

steep garnet
#

i have a question.

surreal sage
#

tell

steep garnet
#

like, rlly i can't solve it.

earnest phoenix
steep garnet
#

anyway.

surreal sage
#

what it isnt bruh

tepid canyon
#

@surreal sage youre missing $ before the bank part

lusty quest
#

its a sqlite database

surreal sage
#

thanks lol

steep garnet
#

@earnest phoenix, i wasn't asking to ask.

#

lmao.

#

i was saying i will ask. B)

earnest phoenix
#

p much the same thing

steep garnet
#

anyway.

#

you see those commands like... "oh you really want to do this action" and then the user or the member that is using that command have to say "yes" or "no".

#

like, where i can find how to achieve this?

lusty quest
#

language?

steep garnet
#

js.

lusty quest
#

await message

steep garnet
#

ah sh

earnest phoenix
#

use a message collector

viral iris
#

any1 know how to do custom prefix without DB ?

earnest phoenix
#

@lusty quest its saying i need a domain for certbot

lusty quest
#

i got a ssl cert for my bot without a domain

earnest phoenix
steep garnet
#

oh, nice.

earnest phoenix
#

i put empty for domain

steep garnet
#

ty @earnest phoenix.

#

i'll take it a look.

lusty quest
#

@viral iris if it is a single server you need a custom prefix check if the guild the message is run in is the guild for the special prefix

#

then use the special prefix instead of the normal one

spare mirage
#

if (message.content(PREFIX + "help")) message.channel.send("Hello!");
^

TypeError: message.content is not a function

viral iris
#

@viral iris if it is a single server you need a custom prefix check if the guild the message is run in is the guild for the special prefix
@lusty quest no only 1 server i need custom prefix

delicate shore
#

i got a ssl cert for my bot without a domain
@lusty quest how ?

lusty quest
#

i use linux

#

idk on windows

delicate shore
#

Oh

lusty quest
#

@viral iris i told you how

viral iris
#

@viral iris i told you how
@lusty quest i don't get it

steep garnet
#

@spare mirage, there's an operator you need to add first.

earnest phoenix
#

fucking linux

spare mirage
#

ok...

earnest phoenix
#

yk what

delicate shore
#

Pls help guys

earnest phoenix
#

fuck linux

spare mirage
#

how do I do that

earnest phoenix
#

ima use mac os

delicate shore
#

We are a community pls help

earnest phoenix
#

jk jk

delicate shore
#
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.hasPermission("Administrator")
return msg.reply("Bruh Contact an admin instead')
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");```
lusty quest
#

check the guild the command is used in. if it is the guild for the special prefix use the special prefix if not use the normal prefix

delicate shore
#

People are saying I have not closed my if statemnt

#

But it is

#

Oh

#

Wait

#

Nvm

#

Me need

viral iris
#

check the guild the command is used in. if it is the guild for the special prefix use the special prefix if not use the normal prefix
@lusty quest i guess no 1 use my commands

lusty quest
#

why did you then want the extra prefix? also adding a small DB for it is not hard

#

then every server your bot is in can have a different prefix

#

(its a qol thing)

viral iris
#

why did you then want the extra prefix? also adding a small DB for it is not hard
@lusty quest but the server not saving DB

lusty quest
#

you need to add it yourself

earnest phoenix
#

how the fuck

lusty quest
#

there are different ways to add a Database

spare mirage
#

@spare mirage, there's an operator you need to add first.
how do I make this server operator

earnest phoenix
#

stack overflow

lusty quest
#

you got your answer

earnest phoenix
#

no i did not

lusty quest
#

then use a different cert as discribed

#

but the easy way would be using a domain

#

you can get a free TK domain if needed

earnest phoenix
#

ok

#

how

#

in

#

the actual

#

fuck do i

#

do that'

lusty quest
earnest phoenix
#

fyi free domains are often associated with scam websites so they'll automatically be blacklisted on a lot of services

#

google also knocks down the SEO from those sites

#

@lusty quest so far almost everything youve told me to do doesnt work

#

i cant get a free tk domain but i can get a tk domain

lusty quest
earnest phoenix
#

already tried that

lusty quest
#

tk apperently is now paid

earnest phoenix
#

i dont have a phone

#

yeah but i dont have a phone

viral iris
#

any1 know quick.db ?

lusty quest
#

then either get a paid one or find a way that you dont need SSL

earnest phoenix
#

there is no way

lusty quest
#

or figure out how to get a SSL cert without a domain

#

@viral iris not that much

golden condor
#

@viral iris I do

#

@earnest phoenix also xyz domains are 99 cents in most places

earnest phoenix
#

idgaf about xyz

viral iris
#

@viral iris I do
@golden condor can u come dm ?

earnest phoenix
#

i dont like xyz

golden condor
#

I'd prefer just to stay here but if you must

#

Look on namecheap there are plenty of domains under $2

spare mirage
#
        const embed = new MessageEmbed()
          // Set the title of the field
          .setTitle('Help! :clipboard::banana:')
          // Set the color of the embed
          .setColor(0xff0000)
          // Set the main content of the embed
          .setDescription(':banana:About Banana!: \n      Banana is a bot bases on having fun \n      And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now thanks!');
        // Send the embed to the same channel as the message
        message.channel.send(embed);
      }```
Im getting 2 errors can anyone find them?
earnest phoenix
lusty quest
#

@spare mirage what errors?

golden condor
#

@earnest phoenix yeah the site seems to have stopped working recently

earnest phoenix
golden condor
#

Yeah it's definitely broken

lusty quest
#

try godaddy

golden condor
#

Or namecheap

delicate shore
#
if(command === "leave"){
const userChannel = message.member.voice.channel;
if(!botChannel) return message.channel.send("Join first dude, if you want use this command!");
const botChannel = message.guild.me.voice.channel;
if(!botChannel) return message.channel.send("Hey, im not in a voice channel and you want me to leave?");
if(!msg.author.hasPermission("Administrator"))
return msg.reply("Bruh Contact an admin; instead")
else
botChannel.leave();
return message.channel.send("Ok, im leaving bye!!!");};```
This is my code
golden condor
#

For what

delicate shore
#

But it isn't working