#development

1 messages · Page 998 of 1

lusty quest
#

@earnest phoenix return the data in the database query back into your value

earnest phoenix
#

line 26

#

@long yew

#

@lusty quest wut

long yew
earnest phoenix
#

wdym

long yew
#

line 26

lusty quest
#
function getCoins(message) {
    con.query(`SELECT * FROM economy WHERE id = ${message.author.id}`, async function (err, result) {
        if (err) throw err;
        
        return result[0]
    });
}

earnest phoenix
#

keys() is not a function

long yew
#

how do i make it a function?

earnest phoenix
#

@lusty quest oh

#

@long yew idk

#

it is ur code

#

try to google it

slender thistle
#

What's your discord.js version

#

Actually, what are you trying to do

lusty quest
#

he works on a pokebot clone.

slender thistle
#

as in the thing that's causing the error, not the bot's overall purpose

long yew
#

idk

#

i'm making a pokebot game thing

lusty quest
#

well this sums it up

hasty sparrow
#

Check your package.json

earnest phoenix
#

did u watched it from youtube @long yew

long yew
#

no

earnest phoenix
#

ok

slender thistle
#

console.log(Discord.version)

lusty quest
#

did it works now @earnest phoenix

earnest phoenix
#

nope

long yew
#

i have a problem

#

i coded the bot a while ago

lusty quest
#

are you sure its the DB query that makes the issues?

earnest phoenix
#
            try{
                var coins = await getCoins(message);
                if(!coins) coins = await newUser(message);
                console.log(coins);
            }catch(e) {
                message.channel.send("Oops, there is a error !")
                return console.log(e)
            }
#

it says indefiened

long yew
#

and was looking back at it

earnest phoenix
#
function getCoins(message) {
    con.query(`SELECT * FROM economy WHERE id = ${message.author.id}`, async function (err, result) {
        if (err) throw err;
        return result[0].coins;
    });
}
long yew
#

my code is version ^11.5.1

lusty quest
#

nvm add async infront of the function

long yew
#

how do i make the bot v11?

lusty quest
#

async function getCoins(message) {
    con.query(`SELECT * FROM economy WHERE id = ${message.author.id}`, async function (err, result) {
        if (err) throw err;
        return result[0].coins;
    });
}


earnest phoenix
#

ur bot is v11

#

@lusty quest ok

slender thistle
#

Probably do this in your code

console.log(Discord.version)
what do you even want to do with your client.guilds

earnest phoenix
#

undefiened

#

smh

lusty quest
#

does it say what line?

earnest phoenix
#

nope

#

smh

lusty quest
#

can you copy the error here or make a screenshot of it?

earnest phoenix
#

ok

lusty quest
#

hmm

#

what does it return if you add a console,log(result[0]) inside of the DB query function?

earnest phoenix
#

yes

#

wait

surreal sage
#

How do i connect my github to Atom

lusty quest
surreal sage
#

then?

earnest phoenix
#

oh

lusty quest
#

read the docs like suggested on the page

earnest phoenix
#

ik

#

what is the problem

surreal sage
#

i

#

dont

#

know

#

how

earnest phoenix
#

i was doing int(25)

lusty quest
#

do int 255

earnest phoenix
#

yes

#

missing one 5

#

xD

lusty quest
#

or max but im not sure if your Mysql version supports it

surreal sage
#

I dont know how i can login in Atom with Github :/

pure lion
#

What was guild.keys() in v11?

earnest phoenix
#

@lusty quest if i set id to unique

#

so it cant add same id

#

right

#

?

lusty quest
#

it will prevent duplicates

earnest phoenix
#

yes

#

ok

#

thx

#

damm it

#

this myphp is bad

#

so slow

surreal sage
#

I dont know how i can login in Atom with Github :/
@surreal sage help?

lusty quest
#

use mysqlworkbench

#

1 less point of failure

surreal sage
#

what

earnest phoenix
#

@surreal sage use VSCODE

surreal sage
#

ok

lusty quest
#

@surreal sage open the github panel

surreal sage
#

ima use vscode

lusty quest
#

CTL+9

earnest phoenix
#

xD

#

xD

#

omg

lusty quest
#

?

earnest phoenix
#

how i can stop the query

#

cuz when i want to create a new user

#

i need to stop the getData()

#

asd

#

cuz it says Handshake in Handshake

#

@lusty quest ?

rustic sundial
#

Hi, I'm trying to do addrole command (addrole to all members), but I have one problem.. Bot sends a message, but he edits that.. I wanna do -> Bot sends message (adding roles), bot adds roles and THEN he edits message. (Done)
Csn anybody help me, please?

lusty quest
#

code?

earnest phoenix
#

.then(//edit)

lusty quest
#

@earnest phoenix i dont think its still the query

earnest phoenix
#

huh

lusty quest
#

i dont see anything in there that should cause it

rustic sundial
#
    const embedls = new MessageEmbed()
                .setTitle(`![Loading](https://cdn.discordapp.com/emojis/652276785811161138.webp?size=128 "Loading") Adding role ${role.name} to all members..`)
                .setColor(red_light)
                .setDescription(`This will take a while..`);

    message.channel.send(embedls).then(async msg => {
        await message.guild.members.cache.filter(m => !m.user.bot).filter(m => !m.roles.cache.has(role.id)).forEach(async n => {
            await n.roles.add(role).then(async s => {
        let all = await message.guild.members.cache.filter(m => !m.user.bot).filter(async m => !m.roles.cache.has(role.id)).size;
            const success = new MessageEmbed()
                .setTitle(`![SUREcheckmark](https://cdn.discordapp.com/emojis/715481264315957299.webp?size=128 "SUREcheckmark") Done`)
                .setColor(red_light)
                .setDescription(`Successfully added role **${role.name}** to **${all}** members`);
            msg.edit(success);
});
});
});
}
#

here

regal raven
#

Help with discord.py

How do I make it so it checks if the bot has the permission to do something. like I have a say command which works like the carl bots echo command and it says anything you want it to say and deletes your original message but I want to make it so if the bot doesn’t have the permission to delete the message then it just says it and doesn’t delete the message?

slender thistle
#

aka message.channel.permissions_for(message.author)

regal raven
#

Nope

slender thistle
#

Since that function returns a Permissions object, get the manage_messages property and see if it's equal to True

rustic sundial
#

Hi, I'm trying to do addrole command (addrole to all members), but I have one problem.. Bot sends a message, but he edits that.. I wanna do -> Bot sends message (adding roles), bot adds roles and THEN he edits message. (Done)
Can anybody help me, please?
@rustic sundial GWseremePeepoThink

regal raven
#

Oh nice idea

#

@rustic sundial lol

rustic sundial
#

Ok

lusty quest
#

i had done something like this but different

#
const inProgressEmbed = { title: 'Processing search...', color: 0xF1C40F }; //the embed

const sendmessage = await message.channel.send('', { embed: inProgressEmbed })//save the message Object and send the Embed

//Add Role

//Create your embed when done

sendmessage.edit(embed)
earnest phoenix
#

how to access glitch.com terminal through javascript?

lusty quest
#

@rustic sundial

earnest phoenix
#

@lusty quest hi your brain is super can you help me with mah problemo

lusty quest
#

i never used glitch

earnest phoenix
#

f

#

how to access the node.js terminal then

#

atleast what we poor people use it for

fresh hatch
#
client.on("message", (message) => {
  if (!message.content.startsWith(prefix) || message.author.bot) return;
  if (message.content.startsWith(`${prefix}ban`)) {
    if (!message.member.hasPermission("BAN_MEMBERS")) {
      message.channel.send("You don't have permission to use this command! :no:")
    } else if (message.content.startsWith(`${prefix}ban`)) {
      let member = message.mentions.members.first();
      member.ban()
      message.channel.send(member.displayName + " has been kicked! :chains:")
    }
  }
})
#

can somebody please help why does my bot say that twice?

lusty quest
#

did you have 2 instances running?

fresh hatch
#

no

earnest phoenix
#

and it doesnt send the emoji at first but sends in the next message

lusty quest
#

wtf why did you call the event every time?

earnest phoenix
#

also can someone tell me how to add delay in commands

lusty quest
#

setTimeout(MS);

earnest phoenix
#

thx

#

ms meaning 1000th of a second right?

regal raven
#

Help with discord.py

How do I make it so it checks if the bot has the permission to do something. like I have a say command which works like the carl bots echo command and it says anything you want it to say and deletes your original message but I want to make it so if the bot doesn’t have the permission to delete the message then it just says it and doesn’t delete the message?

And my code so far is

worldly sequoia
#

L

regal raven
#
@client.command(aliases=['speak', 'echo', 's']) 
async def say(ctx, *args): 
    mesg = ' '.join(args) 
    await ctx.channel.purge(limit=1)
    return await ctx.send(mesg)
earnest phoenix
#

is MS in javascript 1000th of a second?

fresh hatch
#

yea

earnest phoenix
#

so 5000 is 5 seconds right

regal raven
#

Hmm

lusty quest
#

@fresh hatch i know why you get 2 messages

fresh hatch
#

why?

lusty quest
#

it runs 2 command at the same time (kick and ban)

slender thistle
#

Why not use @commands.bot_has_permissions

regal raven
#

I couldn’t do it 😭😭😭

#

Help me with the codes pls

slender thistle
#

Ah right

lusty quest
#

but the kick command checks after he sends the message the name of the command

regal raven
#

Oh hat

#

That returns the permissions for the user

#

I used it

#

Oh

#

Wait

#

Let me try

lusty quest
#

if you dont have the permission to kick a member you get the error even if you run the Ban command

slender thistle
#

You could use the permissions_for thing

rustic sundial
#

@rustic sundial
@lusty quest thank you so much, I'll try it

slender thistle
#

Also, why don't you use *, args

regal raven
#

You could use the permissions_for thing
@slender thistle How?

lusty quest
#

@fresh hatch copy the 3rd line from the Ban command and add it to the kick command. then rename it to kick

slender thistle
#

aka message.channel.permissions_for(message.author)

regal raven
#

Where do I use it

earnest phoenix
#

@lusty quest i used :

var randomguytohack = message.guild.members.random();
message.channel.send("Hacking "+randomguytohack);
setTimeout(5000); //the thing that is giving errors
message.channel.send("nope coudnt hack em");

But it is giving me the error TypeError: "callback" argument must be a function

slender thistle
#

In the beginning of your command

#

replace message with ctx tbh

regal raven
#

Hmm

#

And use if else?

slender thistle
#

and instead of message.author use ctx.guild.me

#

Yes

regal raven
#

😀

earnest phoenix
#

help with my problemo someone

lusty quest
#
  console.log('boo')
}, 100)``` this will create a 100ms timeout
earnest phoenix
#

oh

#

do i swapout function for message.channel.send(); ?

regal raven
#

Does that return a list in which I need the find the manage_messages permissions value?

slender thistle
#

it returns an object where you access a property

#

aka returned_object.some_property

regal raven
#

Oh

lusty quest
#

create a function where you send the message and call it

earnest phoenix
#

ok

slender thistle
#

that property then returns a boolean value

lusty quest
#

or replace the console.log with the message.send

earnest phoenix
#

so it is basically defining then i need to callit

misty sigil
#

Shiv what lib do you develop

slender thistle
#

dblpy

misty sigil
#

cool

fresh hatch
slender thistle
#

Please use one message event

regal raven
#
if ctx.channel.permissions_for(ctx.guild.me).manage_messages:
#Has permission
else:
#Doesn't have permission```
lusty quest
#

@fresh hatch i recommend getting a proper command handler

regal raven
#

Like this?

lusty quest
#

or use a switch case

slender thistle
#

yup

regal raven
#

🙂

fresh hatch
#

im waiting for {TheSourceCode}'s command handler tutorial

earnest phoenix
#

@lusty quest didn't even need to call it it worked on its own

#

thanks

#

now i can hack people in my bot HHEHEHE

tiny venture
#

python Public Flags how to do it

digital ibex
#

@fresh hatch make your own, don't use code you dont understand

earnest phoenix
#

mee6 dab some music for meh

regal raven
#

Thanks @slender thistle for the help :)

slender thistle
#

@tiny venture what

tiny venture
#

public flags Of python@slender thistle

lusty quest
fresh hatch
#

i fixed it

slender thistle
bitter sundial
#

its just the style of wrting with the dots in between always suggests to me that the first thing is resolved before the next gets executed
@viral spade in mongo's case you get a "cursor" when you run find on a model, then you can extend the cursor's search with the extra methods and finally execute it to get the results

long yew
#

hi can anyone help me?

summer torrent
#

Just ask

long yew
solemn latch
#

Your on 12 right?

long yew
#

yeah but my code is 11

#

i'm trying to make it all 12

solemn latch
#

Guilds is followed by .cache

#

In 12

long yew
#

instead of what?

solemn latch
long yew
#

guilds?

solemn latch
#

Not instead of

#

Its just followed by .cache

long yew
#

can u help me change some of my code to v12?

#

also where did u find that cache thing on that link?

solemn latch
#

Managers/cache

long yew
#

`

#

ok ty

#
server = client.guilds.cache().next().value;```
#

is that ok now?

digital ibex
#

no wtf

#

cache isn't a function

solemn latch
#

Its a property

long yew
#

ok i'm reading the document now

#

brb

tight plinth
#

There is a guide that lists everything you have to change from v11 to v12, just use it lol

solemn latch
#

Yeah I gave it

long yew
tight plinth
#

Erm this is not a problem with discord.js

#

Wait

#

What is spanws

long yew
#

spawns

#

?

tight plinth
#

yes

#

Read the error

#

Smh

long yew
#

to spawn a pokemon

tight plinth
#

It's a object or a array?

long yew
#

Smh
wdym u spelt it wrong so i was wondering what u meant

tight plinth
#

Oh yea, sry

long yew
#
function spawnMon() {
    if (currentMon) {
        despawnMon();
    }

    for (var key in trainers) {
        trainers[key].currentBalls = Config.numberOfAttempts;
        trainers[key].catching = false;
    }

    currentMon = {};
    currentMon.id = Math.floor(Math.random() * Math.floor(dex.length)) + 1;
    currentMon.name = dex[currentMon.id - 1];
    currentMon.level = Math.floor(Math.random() * Math.floor(100)) + 1;
    currentMon.catchChance = (Config.catchDifficulty / currentMon.level);
    currentMon.spawnId = Math.floor(Math.random() * Math.floor(9999999 - 999999)) + 999999;
    while (spawns.includes(currentMon.spawnId)) {
        currentMon.spawnId = Math.floor(Math.random() * Math.floor(9999999 - 999999)) + 999999;
    }
    spawns.push(currentMon.spawnId);
    updatePoke();```
#

that is the whole

#

actually nvm i'm gonna make a whole new bot in v12

tight plinth
#

Good choice

solemn latch
long yew
#

also

lusty quest
#

start with a proper DB from the Beginning

#

a json db is easy to make but horrible to maintain

solemn latch
#

I dont see where people are getting the tutorials for these json db's.
Most newbies seem to use them, but I dont understand why.

What guide, or tutorial is pointing people that way CBPikaThink

lusty quest
#

they probably find random youtubers that recommend them in a 4 years old video

solemn latch
long yew
#

ok

#

so

#

can u help me, how do i use a db

#

not json

#

and what ones do u reccomend?

lusty quest
#

MongoDB, Postgres or mysql (these are proper one) otherwise enmap or quickdb(upgrade to jsondb)

long yew
#

wait

slender thistle
#

Basically SQL and NoSQL databases

long yew
#

so what is the difference between mongoDB and quickDB?

lusty quest
#

quickdb is sqlite

long yew
#

what is SQL?

lusty quest
#

and mongodb is NoSql

long yew
#

what is squilite?

lusty quest
#
SQL

SQL ( (listen) S-Q-L, "sequel"; Structured Query Language) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS)....

#

sqlite is sql but the lite variant (usually local on the machine)

long yew
#

ok so should i use quickDB?

lusty quest
#

if you want. i never used it, but i can give you some hints with enmap

slender thistle
#

Just because its name contains "quick" doesn't really mean it's more performant compared to, say, mongo or any other SQL database

long yew
#

ok then i'll do mongoDB

lusty quest
#

its a sqlite database it will never beat a SQL or NOSQL db

digital ibex
#

hi, i have this code: js app.post( '/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login', failureFlash: true }) ); does anyone know why im getting this error?

#

when i've used it before..

#

i've got no idea why this is happening..

long yew
#

if you want. i never used it, but i can give you some hints with enmap
ok ty

#

i did npm install quick.db

#

where do i put this?

#

var db = require('quick.db')

#

ohhhhhh

#

ik

#

wait @lusty quest what do i use?

#

const db = require('quick.db');

#

or

#

var db = require('quick.db')

lusty quest
#

i use mongodb, mysql and used enmap in the past

#

const db = require('quick.db')

earnest phoenix
#

How's it possible to change your bot host's ip so that the ip trackers see it's ip as whatever you want... For example... The ip tracker normally shows the ip... But how to make it show the text you want instead of your ip?

lusty quest
#

so you want a domain?

earnest phoenix
#

lol

#

Huh?

#

Shows BRUH instead of the real ip

lusty quest
#

lol havent seen this in a long time

#

but idk how they have done it. maybe they found some hacky workaround

digital ibex
#

@earnest phoenix have you got a webserver?

earnest phoenix
#

No

digital ibex
#

i'd assume you'd need a webserver to do something like that

#

im not sure tho, only because you can check when someone clicks on it

earnest phoenix
#

Hmm... How would that be modifying the ip even though you're screenshotting the website with puppeteer

#

Hmm

solemn latch
#

are you seeing this on the actual website?

#

or did someone just take a screenshot, and edit the screenshot to say BRUH

long yew
#

BRUH

#

lol

prime cliff
#

It probably recognizes the ip text and edits it out yea

earnest phoenix
#

It's the bot that has an screenshot command that literally takes an screenshot of the website and replace the ip with the text they want

digital ibex
#

ofc thats whats happening bloblul

#

oh lol

earnest phoenix
#

Are you working with some kind of _root modifications through the websites

#

Tf

slender thistle
#

OCR time

prime cliff
#

Smart but someone could easily spin up a web server and have the ip split onto 4 lines

earnest phoenix
#

I have no idea how's that still modifying the original ip from the website... The _root would be impossible for that but... This is just a tf moment

solemn latch
#

why not just canvas?

digital ibex
#

hm

prime cliff
#

It's a screenshot it's easy to edit it out

solemn latch
#

white box over the ip

#

write text on top

#

ez pz done in 5 minutes

earnest phoenix
#

It's literally doing that to every possible ip tracker website

digital ibex
#

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

prime cliff
#

failureRedirect: '/login',

#

That's not how a login system works and possible loop?

digital ibex
#

yeah, thats not the issue tho

#

no, because i have to put my email and password in

#

so ig yeah, but a very slow loop

earnest phoenix
#

Oh wait... Holy shit... I know how they did that... They receive the html first and initialize though the _root path to see if it includes the ip then modifies it... Dude this is fucking genius BigBrain BigBrain BigBrain BigBrain

prime cliff
#

They could do that too but as i said someone can easily spin up a web server and have the ip split onto 4 lines so 12.56.12.123 becomes
12
56
12
123

earnest phoenix
#

Oh his bot didn't do that on a specific website what OMEGALUL OMEGALUL OMEGALUL OMEGALUL

solemn latch
#

you got the ip?

earnest phoenix
#

He himself revealed it by using that website OMEGALUL

prime cliff
#

OfficiallyLost do you have passport-local installed?

digital ibex
#

yeah

#

i had that issue with my discord oauth

#

and i fixed that simply doing ```js
// old broken - giving same error but with 'discord' instead of 'local'
require('passport-discord').Strategy();

// new version - doesn't error or works as intended
require('passport-discord').Strategy;

#

and i doubled checked that, but it still errors

pure lion
#

Heya

#
  if (msg.mentions.has(bot.user)) {
    msg.channel.send('My prefix for this guild is ' + prefix)
  }

its not working

#

nvm

#

fixed

winter basalt
pure lion
#

nvm

#

not fixed

lusty quest
#

what did you want to do?

#

just to have a context

pure lion
#

oh it gets the guild prefix

lusty quest
#

did it send to someone spezific?

#

or why did you have the mention?

rustic sundial
lusty quest
#

is your url correct?

rustic sundial
#

I think yeah

lusty quest
#

hmm

#

this should work

rustic sundial
#

But one thing

#

but it existss

#

I think

lusty quest
#

its a hidden file

rustic sundial
#

okay

lusty quest
#
const mongoose = require('mongoose');

module.exports = {
    init: () => {
        const dbOptions = {
            useNewUrlParser: true,
            autoIndex: false,
            useUnifiedTopology: true,
            poolSize: 5,
            connectTimeoutMS: 10000,
            family: 4
        };
        
        mongoose.connect('mongodb://localhost/yourdb', dbOptions);
        mongoose.set('useFindAndModify', false);
        mongoose.Promise = global.Promise;
        
        mongoose.connection.on('connected', () => {
            console.log('[NOTICE] Mongoose connection successfully opened!');
        });
        
        mongoose.connection.on('err', err => {
            console.error(`[ERROR] Mongoose connection error: \n ${err.stack}`);
        });
        
        mongoose.connection.on('disconnected', () => {
            console.log('[NOTICE] Mongoose connection disconnected');
        });
    }
};

``` this is what i use and i dont have any issues
rustic sundial
#

okay, I'll try

#

thx'

misty sigil
#

how do I use MONGODB for prefix

rustic sundial
#

@lusty quest local host adress is 127.0.0.0 - is that right?

misty sigil
#

Yes

rustic sundial
#

ok thx

lusty quest
#

yes

#

@misty sigil the only thing i found for now is a small YT video series that is somewhat recent

misty sigil
#

hah

lusty quest
#

he also got a Github Repo up with the code

indigo wagon
#

Where can I find detailed information about BOT certification?

solemn latch
#

you mean certification like through discord?

indigo wagon
#

ah sry I mean
get to be vertified developer

lusty quest
indigo wagon
#

Discord

lusty quest
indigo wagon
#

Thank you

#

Is there an age limit ?

amber fractal
#

13+

lusty quest
#

the legal limit for Discord

indigo wagon
#

Alright thanks

lusty quest
#

also sending wrong age will not work

#

will get you probably denied

solemn latch
#

as you have to provide an Id, you will 100% get denied for lying about age

indigo wagon
#

I was worried because I heard 18+ needed in somewhere :/

solemn latch
#

yikes

#

ima get banned for linking discord support watch BalanceKek

slender thistle
#

closes the ban tab
nah

opal plank
#

not sure if you HAVE to be 18+ to get verification, though most of the official documents they'll accept you'll likely only obtain when youa re 18+

#

one exception is passport, they do accept that

lusty quest
#

you can get a ID here with 12 if you want

earnest phoenix
#

hey guys hope everyone is well today, im getting this error Error [SyntaxError]: Unexpected identifier when its trying to get the channel like this just wondered if anyone could give me some advice on it thanks a lot

.then((results) => {
        if (results.find(r => r !== null)) {
          const leftserverEmbed = new Discord.MessageEmbed()
            .setTitle('Blacklisted Server! :warning:')
            .setDescription('**__The Server__** ' + results.find(r => r !== null) + ' **__Has Been Blacklisted!__** :warning:')
            .addField('Reason:', reason.replace(args[0], '').trim())
            .setTimestamp()
          client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${leftserverEmbed});
                                            }`)```
lusty quest
#

is this the complete error?

earnest phoenix
#

yes

#

well this

#

Error [SyntaxError]: Unexpected identifier at Client._eval (C:\Users\jamie\Music\Bots\Project Bump\node_modules\discord.js\src\client\Client.js:391:17) at ShardClientUtil._handleMessage (C:\Users\jamie\Music\Bots\Project Bump\node_modules\discord.js\src\sharding\ShardClientUtil.js:185:82) at process.emit (events.js:322:22) at emit (internal/child_process.js:876:12) at processTicksAndRejections (internal/process/task_queues.js:85:21) { name: 'SyntaxError'

opal plank
#

wait what

#

wtf are you trying to do

earnest phoenix
#

thats the channel id

opal plank
#
          client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${leftserverEmbed});
                                            }`)```
what exactly are you trying to get putting const and if's inside this
earnest phoenix
#

it basically finds the channel and if it finds it it will send the embed within that channel

amber fractal
#

have you never seen a broadcastEval before?

opal plank
#

not at all

amber fractal
#

It runs that code across all shards, they seem to be trying to send a message to a specific channel when the bot enters and leaves a blacklisted server

earnest phoenix
#

becuase when i blacklist a test server it does send the message to the guild owner which is with broadcastEval so that part is working

#

yes once a server is blacklisted it sends a embed to my blacklisted servers channel how it does currently with my main bot

amber fractal
#

can you show the entire file?

earnest phoenix
#

why would you need to see my whole file lol

amber fractal
#

Because you have a syntax error and it doesnt come from there

#

unless you didnt close the .then

#

I just assume you did

earnest phoenix
#

i can post the whole blacklist command if you wish

amber fractal
#

well one sec

opal plank
#
this.then((results) => {
        if (results.find(r => r !== null)) {
          const leftserverEmbed = new Discord.MessageEmbed()
            .setTitle('Blacklisted Server! :warning:')
            .setDescription('**__The Server__** ' + results.find(r => r !== null) + ' **__Has Been Blacklisted!__** :warning:')
            .addField('Reason:', reason.replace(args[0], '').trim());

          client.shard
            .broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${leftserverEmbed});
                                            }`);
            };
          });```
#

you just missed a ) in the end @earnest phoenix

amber fractal
#

there actually might be an error I didnt see in there

opal plank
rustic sundial
#

@lusty quest I have only one problem..

#

this

amber fractal
#

Yeah you need to close the if and the then if you didnt

rustic sundial
#

Can someone help me, please?

lusty quest
#

hmm i never had this error

rustic sundial
#

this is code

earnest phoenix
#

@opal plank i forgot to post the end part too

client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${blacklistedEmbed});
                      }`)
          con.query(`UPDATE testing SET blacklist = 1 WHERE guildid = ${args[0]}`, (err) => {
            if (err) console.log(err)
            sendEmbed(msg, 'Successfully Blacklisted Server! ⛔.')
          })
        } else {
          sendEmbed(msg, `${args[0]} is not a guild id!`)
        }
      })```
amber fractal
#

did you mean to use 127.0.0.1?

opal plank
#

@earnest phoenix .............

amber fractal
#

you could aslo use localhost or 0.0.0.0 I assume

opal plank
#

post the whole thing dude

earnest phoenix
#

okay haha

#
blacklist: (msg, prefix) => {
    if (msg.author.id !== '318089600050528257') { sendEmbed(msg, 'You cannot execute this command') }
    const reason = msg.content.substr(msg.content.indexOf(' ')).trim()
    const args = msg.content.slice(prefix.length).trim().split(/ +/g).slice(1)
    client.shard.broadcastEval(`const guild = this.guilds.cache.get('${args[0]}');
                                    if (guild) {
                                        const guildOwner = this.users.cache.get(guild.ownerID);
                                        guildOwner.send('You Have Been Blacklisted For Violating Our ToS https://projectbump.xyz/ToS :warning: Please Join Our Support Server To Appeal! https://discord.gg/SrEUJ4z');
                                    }
                                    guild ? guild.name : null;`)
      .then((results) => {
        if (results.find(r => r !== null)) {
          const blacklistedEmbed = new Discord.MessageEmbed()
            .setTitle('Blacklisted Server! :warning:')
            .setDescription('**__The Server__** ' + results.find(r => r !== null) + ' **__Has Been Blacklisted!__** :warning:')
            .addField('Reason:', reason.replace(args[0], '').trim())
            .setTimestamp()
          client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${blacklistedEmbed});
                      }`)
          con.query(`UPDATE testing SET blacklist = 1 WHERE guildid = ${args[0]}`, (err) => {
            if (err) console.log(err)
            sendEmbed(msg, 'Successfully Blacklisted Server! ⛔.')
          })
        } else {
          sendEmbed(msg, `${args[0]} is not a guild id!`)
        }
      })```
crimson egret
#

how to use bot game stats

radiant estuary
#

Hello,
i want a embed for my website on discord. I use this:

    <meta property="og:title" content="Hxlper">
    <meta property="og:type" content="website">
    <meta property="og:url" content="LINK">
    <meta property="og:description" content="Beschreibung">
    <meta property="og:image" content="https://cdn.discordapp.com/avatars/704614453165031454/e99a05530d221beac75f65e82792d713.jpg?size=512">
    <meta name="theme-color" content="#9F81F7">

But this doesn't work 😢

#

sry

amber fractal
opal plank
#

@earnest phoenix ```js
blacklist: (msg, prefix) => {
if (msg.author.id !== '318089600050528257') { sendEmbed(msg, 'You cannot execute this command') }
const reason = msg.content.substr(msg.content.indexOf(' ')).trim()
const args = msg.content.slice(prefix.length).trim().split(/ +/g).slice(1)
client.shard.broadcastEval(const guild = this.guilds.cache.get('${args[0]}'); if (guild) { const guildOwner = this.users.cache.get(guild.ownerID); guildOwner.send('You Have Been Blacklisted For Violating Our ToS https://projectbump.xyz/ToS :warning: Please Join Our Support Server To Appeal! https://discord.gg/SrEUJ4z'); } guild ? guild.name : null;)
.then((results) => {
if (results.find(r => r !== null)) {
const blacklistedEmbed = new Discord.MessageEmbed()
.setTitle('Blacklisted Server! :warning:')
.setDescription('The Server ' + results.find(r => r !== null) + ' Has Been Blacklisted! :warning:')
.addField('Reason:', reason.replace(args[0], '').trim())
.setTimestamp()
client.shard.broadcastEval(const channel = this.guilds.cache.get('714642375997259837'); if (channel) { channel.send(${blacklistedEmbed}); })
con.query(UPDATE testing SET blacklist = 1 WHERE guildid = ${args[0]}, (err) => {
if (err) console.log(err)
sendEmbed(msg, 'Successfully Blacklisted Server! ⛔.')
})
} else {
sendEmbed(msg, ${args[0]} is not a guild id!)
}
})}

amber fractal
#

whoops

opal plank
#

same issue, forgot a } in the very end

rustic sundial
#

oh okay

solemn latch
#

Doesn't your code editor tell you this

opal plank
#

actually

#

nono, my bad

#

actually, no, its fine

#

you calling .then outside

wooden ember
#

lol I just use notepad ++ as an editor is that bad then?

opal plank
amber fractal
#

it's not a great editor

#

vsc is basically glorified npp

wooden ember
#

lol

earnest phoenix
#

so thats why becuase the .then is outside the first eval

opal plank
#

@earnest phoenix collapse your categories to quickly find where your syntax is wrong

solemn latch
#

Or there's a problems section

#

And you can click on the problem to take you to the erroring location

earnest phoenix
#

@opal plank your cate are different to mine

#

obvs

opal plank
#

¯_(ツ)_/¯

earnest phoenix
opal plank
#

most likely cuz i have other extensions

#

one fo them being prettyfier

earnest phoenix
#

whats that one lol

opal plank
#

makes your code not look like shit

#

basically

earnest phoenix
#

i cant even find that ex

opal plank
#

if you dont have a linter or anything of the sort, you doing vsc wrong

earnest phoenix
#

i have eslint

opal plank
#

dont use two formatters

#

either use linter or prettifier

#

beautify is fine too

earnest phoenix
#

okay so is the problem because the .then is outside the first eval

opal plank
#

.then is ON the eval

#
    client.shard.broadcastEval()
      .then((results) => {

If you having issues to see it, try removing all the stuff in between to make it clearer

amber fractal
#

because it's suppsoed to be

#

it returns a promise

earnest phoenix
radiant estuary
#

Hello,
i want a embed for my website on discord. I use this:

    <meta property="og:title" content="Hxlper">
    <meta property="og:type" content="website">
    <meta property="og:url" content="LINK">
    <meta property="og:description" content="Beschreibung">
    <meta property="og:image" content="https://cdn.discordapp.com/avatars/704614453165031454/e99a05530d221beac75f65e82792d713.jpg?size=512">
    <meta name="theme-color" content="#9F81F7">

But this doesn't work 😢

amber fractal
#

ffs yall keep spamming your questions instead of waiting

opal plank
#

dont spam

amber fractal
#

@radiant estuary most likely cache

#

verify it's all working there

opal plank
#

dude

amber fractal
#

if it is then it's your cache

opal plank
radiant estuary
#

i get them there

opal plank
#

you gotta be kidding me

earnest phoenix
#

oh shit

opal plank
#

why the f would you share your key here

earnest phoenix
#

imma generate

#

a new key

lusty quest
opal plank
#

how did u even get bot aproved

radiant estuary
#

a website that i know is using the same tags, and this work

earnest phoenix
#

huh

opal plank
#

if you want name, get it on guild

lusty quest
#

there is an id the key

earnest phoenix
#

huh

#

wait what

opal plank
#

guild.id doesnt ahve a property name in it

earnest phoenix
#

i dont understand

opal plank
lusty quest
#

i know what he means now

#

what is the value with the return of the API?

opal plank
#

idk, log it

#

¯_(ツ)_/¯

earnest phoenix
lusty quest
#

its not my bot

#

yes but the guildid is the key

earnest phoenix
#

key ?

#

wdym

#

oh yes

lusty quest
#

and you want to get the name out of it?

earnest phoenix
#

yes

opal plank
#

[0]

amber fractal
#

@earnest phoenix a nested property is name

lusty quest
#

return[0]

amber fractal
#

and that's not an array

earnest phoenix
#

yes it is not a array

amber fractal
#

It's an object

earnest phoenix
#

nested property

#

huh

#

i dont understand

amber fractal
#

you'd need to access the property, it looks like an id: {name, enable}

earnest phoenix
#

yes i acessted

#

and it says undefiened

amber fractal
#

you could recursively flatten it if you wont know the key on get

earnest phoenix
opal plank
#

Object.keys

earnest phoenix
#

forgot about the secret keys

#

i deleted

#

generated a new one*

amber fractal
#

That could work

earnest phoenix
#

look output

amber fractal
#

repounseBody[Object.keys(repounseBody)[0]].name

#

but it looks stupid lmao

earnest phoenix
#

undefiened

#

smh

opal plank
#

do value

earnest phoenix
#

where

amber fractal
#

without deleting that line, right above it log the repounseBody because something has to be wrong

opal plank
#

repounseBody[Object.values(repounseBody)[0]].name

#

actually

#

yeah that should work

amber fractal
#

That wouldnt work

opal plank
#

remember theres a typo up there

earnest phoenix
#

name = undefiened

#

sad

#

me

opal plank
#

did u copy paste it?

#

cuz i said theres a typo

amber fractal
#

Object.values returns a value, not a key

opal plank
#

read this word carefully

#

return value of name

amber fractal
#

object[objectvalue] wouldnt return anything

earnest phoenix
#

well i tried

repounseBody[message.guild.id]

But still undefiened

#

sad

opal plank
#

dude

#

i told you 4 times

#

TYPO

amber fractal
#

It doesnt matter, his code has the typo...

#

if it didnt it'd say cannot read property "x" of undefined

#

on the object

opal plank
#

holdup

amber fractal
#

doesnt want to embed

#

whatever

#

The point being it's the name of the response variable

#

probably just a bad translation

earnest phoenix
#

ye

#

forgot the s

#

xD

amber fractal
#

I mean it wouldnt matter

#

it's just the name of a variable

languid pollen
#

I'm trying to deploy my discord bot to Heroku but heroku doesn't like the line import discord. It says: ModuleNotFoundError: No module named 'discord'. What can i do? (discord.py)

earnest phoenix
#

dude

#

@amber fractal if i do respounce instead of repounce it says undefiened

#

so the dev who created the Module has a bad translation

#

@languid pollen have you tried to install the module?

languid pollen
#

you mean installing discord.py, then yes. My bot worked just fine before

opal plank
#

using Object.values like i said

#

that is now accesible

earnest phoenix
#

this error is annoying me hahah

#

any way i can get it to log something that will tell me whats happening with it

opal plank
#

ever ehard of step debugging?

#

¯_(ツ)_/¯

#

add breakpoints

earnest phoenix
#

its not posting the embed in that channel for some reason and i dont get an error either lol

opal plank
#

step debug it

#

see whats being sent

still merlin
#

can someone*

opal plank
#

@still merlin cant help if you dont post code

sleek stirrup
#

Read what it says @still merlin

#

Hover over the }

opal plank
#

its syntax error

#

bots arent allowed to work here

sleek stirrup
#

ik

still merlin
#

client.on("message", (message) => {
  const args = message.content.split(" ").slice(1);

  if (message.content.startsWith(prefix + "eval")) {
    if (message.author.id !== "529770099285032980")
      return message.channel.send(
        "**error** Only the bot owner can execute this command!"
      );
    try {
      const code = args.join(" ");
      let evaled = eval(code);

      if (typeof evaled !== "string") evaled = require("util").inspect(evaled);

      message.channel.send(evaled);
      message.channel.send(
        "``:x: Error preforming eval command``" + "(" + err + ")"
      );
    }
  
  }
});
#

and error is finally expected

opal plank
#

there we go

still merlin
#

but that does that mean??

amber fractal
#

@still merlin you're missing a catch or finally

misty sigil
#

it expects a finally

still merlin
#

helpful I dont even know how to write a finally or a catch

amber fractal
#

the syntax of try/catch is

...
}catch(e){

}finally{

}``` or
```try{
...
}catch(e){

}```
misty sigil
#

so, where do i even start on this mongodb stuff

amber fractal
lusty quest
#

catch (err){console.error}

digital ibex
#

hi, does anyone know how can i get a html element in backend code?

still merlin
amber fractal
#

you kept ...

still merlin
#

I dont have a ,,,

amber fractal
#

ald you put that at the end of your try

#

It isnt just a copy paste solution

#

the ... is the code you put in the try

#

refer to the docs I sent

prime cliff
still merlin
#

finally expected

#

still

amber fractal
#

again, it isnt a copy paste solution

#

refer to the docs I sent. you're doing try{}try{}catch(e){}

prime cliff
#

Actually Amazri you forgot the catch statement

#

Yea

misty sigil
#

anyone know anything about using mongodb with my discordbot?

amber fractal
#

@misty sigil on windows or linux

#

and if you say mac I'm leaving

still merlin
#

I still don't understand. I've said before I'm still learning to code

amber fractal
#

delete the second try block

#

just keep the catch after

#

so delete try{ }

#

the 2nd one

misty sigil
#

windows

amber fractal
#

not the one with your code

misty sigil
#

why would i use mac

amber fractal
#

because people scare me

misty sigil
#

mac users scare me too

amber fractal
#

do you already have the mongo server?

misty sigil
#

yup

still merlin
misty sigil
#

and a mongo user

still merlin
#

..

amber fractal
#

community edition or using atlas?

misty sigil
#

atlas

amber fractal
#

you kept the } from the old try

earnest phoenix
amber fractal
#

What lang are you using?

misty sigil
#

js

amber fractal
#

ok, do you plan to use mongoose or the official driver

misty sigil
#

depends

amber fractal
#

I just know the official driver better, which is why I asked

misty sigil
#

ill use the official one

amber fractal
misty sigil
#

because it's official

#

done

amber fractal
#

Do you have the url you need to connect to mongo from atlas?

misty sigil
#

yea

amber fractal
#

alright, the general way to connect is like this:

const {MongoClient} = require("mongodb")
MongoClient.connect(url, opts (if you want), (err, client) => {

})
``` You can also use a promise if you dont want to use a callback
misty sigil
#

and how would I get the prefix

amber fractal
#

were you able to successfully connect to the atlas database?

misty sigil
#

ok ill try

amber fractal
#

After you do, you need to select the db to use

lusty quest
#

you learn to walk before you start running. the same goes if you learn new stuff

earnest phoenix
#

https://cdn.discordapp.com/attachments/713054412414910520/726497939291242526/unknown.png

        ctx.beginPath();
        ctx.arc(170, 160, 120, 0, Math.PI * 2, true);
        ctx.lineWidth = 6;
        ctx.strokeStyle = '#ffffff';
        ctx.stroke();
        ctx.clip();
        const avatar = await loadImage(user.displayAvatarURL({ format: 'jpg' }));
        ctx.drawImage(avatar, 40, 40, 250, 250);
        ctx.closePath();

        ctx.beginPath();
        ctx.arc(235, 235, 30, 0, Math.PI * 2, true);
        ctx.lineWidth = 12;
        ctx.fillStyle = statusColor;
        ctx.fill();
        ctx.strokeStyle = '#ffffff';
        ctx.stroke();
        ctx.closePath();```
#

Is there a way to only have it clip the avatar image?

#

okay now i done the debugging i got
[Project Advertising] JamieG#6884 >> pt%blacklist 707945698347450370 test bot.js:878 TypeError: Cannot read property 'broadcastEval' of null

solemn latch
#

@earnest phoenix you want a circle?

earnest phoenix
#

just i want it the status colour outside the clip

solemn latch
#

why

earnest phoenix
#

wdym why

solemn latch
#

why not just get the status itself

earnest phoenix
#

???

amber fractal
#

He doesnt want the status to be clipped I believe is what he means

earnest phoenix
#

yes

amber fractal
#

can you increase the radius of the circle or move the status itself?

marble juniper
#

how am I able to find an image inside of an image with x y coordinates in nodejs

#

I searched everywhere but no answer

earnest phoenix
#

can you increase the radius of the circle or move the status itself?
@amber fractal radius of the status?

amber fractal
#

I think you can extract pixels from canvas if that's what you mean @marble juniper

solemn latch
#

or are you trying to crop pikathink

marble juniper
#

yeah

#

crop

#

actually

#

lol

earnest phoenix
#

if I increase the radius of the status it doesn't fix the issue

amber fractal
earnest phoenix
#

oh ok

amber fractal
#

may work

earnest phoenix
#

i want it outside of the clip

amber fractal
#

of not, you can try to move the status bubble

solemn latch
earnest phoenix
#

the status bubble is inside the clip because I initiate it before the bubble

solemn latch
#

context.drawImage(imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight);

misty sigil
#

i think im connected

amber fractal
#

inside of the callback I'd just put a if(err) return console.error(err) and a console.log("Connected") after that to be sure

solemn latch
#

so, i dont understand, why do people take screenshots of peoples avatar, and want status removed?

#

doesnt discord already provide just the raw avatar for ya

amber fractal
#

he doesnt

misty sigil
#

there we are

amber fractal
#

He explicitly puts it in

solemn latch
#

oh hmmm

misty sigil
#

i'm connected

earnest phoenix
#

it's a rank card

misty sigil
#

but just have a node error

amber fractal
earnest phoenix
#

yh

#

the clip puts it inside

solemn latch
#

oh, crop the pfp, then lay the new status ontop

earnest phoenix
#

not possible

solemn latch
#

do it on seperate contexts if you gotta

earnest phoenix
#

because of the clip

amber fractal
#

what if you change ctx.arc(235, 235, 30, 0, Math.PI * 2, true); to ctx.arc(225, 225, 30, 0, Math.PI * 2, true);?

#

just moving it back 10 pixels

earnest phoenix
#

i see what you mean

solemn latch
#

just use seperate contexts?

earnest phoenix
#

i have

solemn latch
#

ie, draw the entire rank card, make a new context, put the status on top

amber fractal
#

but with the clip, I dont know how to overlay it easily

solemn latch
#

just the xy

earnest phoenix
#

like hanging outside

amber fractal
#

oh then you'd have to overlay it

earnest phoenix
#

is it a function?

misty sigil
#

I've connected to my db

solemn latch
#

its a common way to do things on seperate layers, so they dont interfere

#

it also is used to save processing power

amber fractal
#

I normally link it to my client for easy access everywhere client.db = mongoclient.db("db")

#

There are some extra options, (noListener and returnNonCachedInstance) that you can use to control how the connection works

pure lion
#

👀

earnest phoenix
#

Hello, I'm looking for a bot developer who could make me a little program (more information in private message)

#

I will boost you if you do me a favor

misty sigil
#

@earnest phoenix what you need?

amber fractal
#

But after that's all good, you can start to use it, this is where the docs I've been sending come in, but I'll send you the methods most used that I know of. insertOne, find, findOne, updateOne, updateMany, deleteOne, deleteMany

misty sigil
#

Cool, that could be, kinda easy

amber fractal
#

you'll have to identify the collection first though, so after you have client.db you'd need to client.db.collection("collectionName").method()

earnest phoenix
#

I am looking for a bot developer who could create a program assigned a role according to the status of the user. If you do this service I can boost your server

misty sigil
#

So I'd have to make a collection?

amber fractal
#

Collections are made automatically if you try to insert to a non-existing one

#

Oh, and these all return promises if you dont provide a callback

misty sigil
#

ah so i could just client.db.collection("prefixes").method()

amber fractal
#

Yep

misty sigil
#

and can I have 2 prefixes

earnest phoenix
amber fractal
#

you can make an array of prefixes for each guild if you want

misty sigil
#

I'm just thinking the default one and the set one

amber fractal
#

@scenic kelp

misty sigil
#

@jolly pollen No.

amber fractal
#

ads

jolly pollen
#

Why

misty sigil
#

It's ads

jolly pollen
#

Ohh okok

misty sigil
#

@amber fractal I'll save that img for reference

scenic kelp
#

@jolly pollen You're not allowed to advertise here

misty sigil
#

so I'll figure something out

earnest phoenix
#

Still not sure what's wrong with my error Steven lol

amber fractal
misty sigil
#

and then I might listen out for @mentions so I can show a prefix embed

amber fractal
#

@earnest phoenix I mustve missed your initial question

#

what was your problem?

jolly pollen
#

@scenic kelp c as n u tell me where

scenic kelp
#

nowhere on this server

jolly pollen
#

Ohhk

#

I want to ask one thing

earnest phoenix
#

@amber fractal that broadcastEval error

jolly pollen
#

If my bot will add in 75+ server then

amber fractal
#

Ah, yeah. can you show your code again?

jolly pollen
#

How I get verified bot developer batch

earnest phoenix
#

Yeah

scenic kelp
#

-verifybot

gilded plankBOT
#

Hi! It seems like you are looking for information on how to get your bot verified.

Once your bot reaches 75 servers or more, you are eligible for bot verification. On October 7, 2020, bots with 100 servers or more that are not verified will not be able to be invited to any more servers. You verify your bot on your bot's application page, under the "Bot" section in the sidebar.

If you need more information, check out this article written by Discord about The Future of Bots on Discord and you can ask questions in the Discord Developer Server.

We cannot provide support on how to get your bot verified.

misty sigil
#

does .updateOne() create automatically like .collection()

jolly pollen
#

What’s a

earnest phoenix
#
client.shard.broadcastEval(`const guild = this.guilds.cache.get('${args[0]}');
                                    if (guild) {
                                        const guildOwner = this.users.cache.get(guild.ownerID);
                                        guildOwner.send('You Have Been Blacklisted For Violating Our ToS https://projectbump.xyz/ToS :warning: Please Join Our Support Server To Appeal! https://discord.gg/SrEUJ4z');
                                    }
                  guild ? guild.name : null;
                  `)
      .then((results) => {
        if (results.find(r => r !== null)) {
          const blacklistedEmbed = new Discord.MessageEmbed()
            .setTitle('Blacklisted Server! :warning:')
            .setDescription('**__The Server__** ' + results.find(r => r !== null) + ' **__Has Been Blacklisted!__** :warning:')
            .addField('Reason:', reason.replace(args[0], '').trim())
            .setTimestamp()
          client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${blacklistedEmbed});
                      }`)
          con.query(`UPDATE testing SET blacklist = 1 WHERE guildid = ${args[0]}`, (err) => {
            if (err) console.log(err)
            sendEmbed(msg, 'Successfully Blacklisted Server! ⛔.')
          })
        } else {
          sendEmbed(msg, `${args[0]} is not a guild id!`)
        }
      })```
#

there you go steven

#

its doing everything but sending the embed to the channel i need it to

amber fractal
#

@misty sigil when using updateOne, if you want it to create on non-existent, use the "upsert" option, like I do, that creates it if it doesnt exist and updates it if it does

#

@earnest phoenix I'll look

#

What's the error now?

#

because that is syntactically correct

earnest phoenix
#

Error [SyntaxError]: Unexpected identifier

amber fractal
#

weird, it doesnt come from that then.

#

ah, but it wouldnt check the strings

#

so let me check those

earnest phoenix
#

its defo something here

client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send(${blacklistedEmbed});
                      }`)```
surreal notch
#

I wanted to create a login with discord feature on my site how can i do that?

amber fractal
#

yeah, I assume it's because blacklistedEmbed gets turned into [object Object]

misty sigil
#

@surreal notch OAUTH2

surreal notch
#

Yeah but i tried but can't know something

amber fractal
#

what if you turn it into a raw embed and use .send({embed: ${rawEmbed}})

surreal notch
#

Means at some step i got stuck

amber fractal
#

<MessageEmbed>.toJSON() should turn it into a raw embed

earnest phoenix
#

its just strange how thats not working i get the same with my warn command

amber fractal
#

what did you change it to

earnest phoenix
#

no im saying originally

#

im gonna try your thing now

amber fractal
#

all you should have to do is change this channel.send(${blacklistedEmbed});

#

to channel.send({embed: ${blacklistedEmbed.toJSON()}});

#

if that idea works anyways

#

if I had a sharded bot I'd test it myself

heavy anchor
#

Anyone know how to track the total network usage of a bot?

#

Is there a NPM package I can use for that?

earnest phoenix
#

let me try that steven thank you ill be back in a few moments

surreal notch
#

@heavy anchor You can use your vps host for netword usage

#

*network

earnest phoenix
#

@amber fractal yeah i get the same error

amber fractal
#

What if you just log the string instead of evaling it

#

just to see if it turns into what we expect

heavy anchor
#

@heavy anchor You can use your vps host for netword usage
@surreal notch I’m not using a vps

misty sigil
#

what you using then?

amber fractal
#

console.log(`const channel = this.guilds.cache.get('714642375997259837'); if (channel) { channel.send({embed: ${blacklistedEmbed.toJSON()}}); }`)

#

There's no real easy (free) way to monitor network usage on a per-process level that I know about

heavy anchor
misty sigil
#

unless you're on windows

amber fractal
#

you cant even install node stuff on to that, can you?

misty sigil
#

@heavy anchor is that minecraft servers?

heavy anchor
#

No there is one for Discord bots

misty sigil
#

ah yes i see

#

can't help

heavy anchor
#

Ok

amber fractal
#

yeah not sure how that works

misty sigil
#

maybe contact their support

heavy anchor
#

Thanks

digital ibex
#

hi, does anyone know how i can access a html element in a separate file?

#

in a backend file

amber fractal
#

weird 512mb ram unlimited bandwidth, unlimited storage ryzen 5 2600x cpu (that you definitely dont have full access to, probably split among many clients) for $1.50/3 months

#

what an odd service

earnest phoenix
#

@amber fractal it did what you said btw lol

#

const channel = this.guilds.cache.get('714642375997259837'); if (channel) { channel.send({embed: [object Object]});

amber fractal
#

yeah gets turned into object Object for some reason, you did .toJSON() it right?

earnest phoenix
#

yeah and i got the same error

#

i think

amber fractal
#

Can I see the code?

earnest phoenix
#

yeah

#

@amber fractal

.then((results) => {
        if (results.find(r => r !== null)) {
          const blacklistedEmbed = new Discord.MessageEmbed()
            .setTitle('Blacklisted Server! :warning:')
            .setDescription('**__The Server__** ' + results.find(r => r !== null) + ' **__Has Been Blacklisted!__** :warning:')
            .addField('Reason:', reason.replace(args[0], '').trim())
            .setTimestamp()
          client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                            if (channel) {
                                                channel.send({embed: ${blacklistedEmbed.toJSON()}});
                      }`)
          con.query(`UPDATE testing SET blacklist = 1 WHERE guildid = ${args[0]}`, (err) => {```
hardy vector
#

(node:12560) UnhandledPromiseRejectionWarning: TypeError: Only absolute URLs are supported
at getNodeRequestOptions (C:\Users\kenra\Desktop\Frosty Rewrite\node_modules\node-fetch\lib\index.js:1299:9)

#
 async run(message, args) {
        
        let person = message.mentions.users.first() || message.author

        
        const msg = await message.channel.send("Fetching a dog picture...")
        fetch(`"https://some-random-api.ml/img/dog`)
        .then((res) => res.json())
        .then((body) => {
            console.log(body)
            let embed = new MessageEmbed()
            .setTitle(`Dog for ${message.author.username}`)
            .setImage(body.link)
            .setTimestamp(Date.now())
            .setColor("#9cc4e4")
            msg.edit(embed)
        })
    
    }
#

it never gave me that error before

#

now it does

misty sigil
#

so I've setup my mongoDB write

#

but how do I read the prefix?

crimson vapor
#

How are you storing it?

misty sigil
#

attached to the guild ID

amber fractal
#

Wait wait wait

crimson vapor
#

I mean like what’s the structure of the data

amber fractal
#

fucking discord.json doesnt actually stringify the JSON

#

tf

misty sigil
#

its a string

crimson vapor
#

Are you using mongoose?

misty sigil
#

official

earnest phoenix
#

fucking discord.json doesnt actually stringify the JSON
@amber fractal im not sure why nothing is working haha

crimson vapor
#

I’m confused now

amber fractal
#

I think I know why

misty sigil
#

just mongodb

earnest phoenix
#

gotta be a way around it

amber fractal
#

instead of ${blacklistedEmbed.toJSON()} try ${JSON.stringify(blacklistedEmbed)}

crimson vapor
#

Oh yeah I used mongoose so I’m not sure how to read data from mongodb

amber fractal
#

but I dont think that'll work either

misty sigil
#

so

#

how do i read from mongodb

still merlin
#

can i have some help.

if (command === "balance")
^

ReferenceError: command is not defined
    at Object.<anonymous> (C:\Users\Jon\Desktop\Pokedex\client.js:9:1)```
#

How do I use command without getting a undefined error?

amber fractal
#

db.collection("x").findOne(filter) filter is an object

earnest phoenix
#

@amber fractal well i didnt get the unexpected error that time but it didnt post the embed hahah

amber fractal
#

Yeah, because it doesnt accept raw embed content

crimson vapor
#

@still merlin you need to show your code, from that error is looks like you just didn’t define command

still merlin
#

I know that.. But how do I define it?

crimson vapor
#

depends on how you are using it

earnest phoenix
#

what would you recommend steve

#

steven*

worn niche
#
client.on("message", msg => {
  if (msg.content === "cmsgt") {
    const TestMessage = new Discord.MessageEmbed()
    .setColor('#0099ff')
    .setTitle('Some title')
    .setURL('https://discord.js.org/')
    .setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
    .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/wSTFkRM.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/wSTFkRM.png')
    .setTimestamp()
    .setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');

channel.send(TestMessage);

  }
})

Error is with channel.send(TestMessage); it's saying: "channel is not defined" but if I remove that, command don't want work and there's no error in terminal

still merlin
#

I wanna use it like this.

if (command === "balance")
  message.channel.send("Your balance." + message.author.balance);
else if (command === "duel") {
  const args = message.content.split(" ").slice(1);
  if (message.author.bot) return;
  //finish soon
  else if (command === "leaderboard") {
    if (message.author.bot) return;
    if (!args[2])
      return message.channel.send(
        "Homie there is no second arg on the msg get a second args!1!!11!"
      );
    //finish soon
    else if (command === "search") if (message.author.bot) return;
    const replies = [
      `You search around and find no pokemon!`,
      `${Eevee}`,
      `${Bulbasaur}`,
      `${Pincurchin}`,
      `${Rotom}`,
      `${Pichu}`,
    ];
    message.replytext = Math.floor(Math.random() * replies.length + 0);
    return message.channel.send(replies[message.replytext]);
  }
}```
amber fractal
#

@earnest phoenix I can think of one workaround

still merlin
#

ingore half the code, just trying to test things-

amber fractal
#

define the embed inside the eval

#

then you can use it as a variable inside the eval itself

#

but it will build the embed for every shard, which isnt ideal, but that's all I can think of

#

or

#

just put it in the if mmLol

misty sigil
#

how do i attach my db to my client

amber fractal
#

so something like ```

      client.shard.broadcastEval(`const channel = this.guilds.cache.get('714642375997259837');
                                        if (channel) {
                                          const blacklistedEmbed = new Discord.MessageEmbed()
                                            .setTitle('Blacklisted Server! :warning:')
                                            .setDescription('**__The Server__** ' + results.find(r => r !== null) + ' **__Has Been Blacklisted!__** :warning:')
                                            .addField('Reason:', reason.replace(args[0], '').trim())
                                            .setTimestamp();
                                            channel.send(blacklistEmbed);
                  }`)
#

@misty sigil did you try client.db = <MongoClient>.db("name")?

#

but you'll also need to define the reason and results in there too so not sure how you would tbh @earnest phoenix

worn niche
#
client.on("message", msg => {
  if (msg.content === "cmsgt") {
    const TestMessage = new Discord.MessageEmbed()
    .setColor('#0099ff')
    .setTitle('Some title')
    .setURL('https://discord.js.org/')
    .setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
    .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/wSTFkRM.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/wSTFkRM.png')
    .setTimestamp()
    .setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');

channel.send(TestMessage);

  }
})

Error is with channel.send(TestMessage); it's saying: "channel is not defined" but if I remove that, command don't want work and there's no error in terminal

amber fractal
#

you probably meant msg.channel.send

still merlin
#

How do i define command??

amber fractal
#

you should probably learn js tbh

#

If you dont know how to define a variable, you shouldn't be making a bot

misty sigil
#
client.db = MongoClient.db("discordprefixes")

TypeError: MongoClient.db is not a function
still merlin
#

I know how to define a varible but what would i put..

amber fractal
#

@misty sigil you need the actual instance of the client returned from the connect function

misty sigil
#

how would i get that?

amber fractal
earnest phoenix
#

@amber fractal even with that it doesnt work vs seems to think its assigned a valuable but never used obvs becuase its in string

misty sigil
#

the line is inside the connect block

amber fractal
#

you can use promises instead

#

@earnest phoenix yeah I'm not sure how you would, I'd just use a discord webhook at that point

#

simplifies the process a lot

#

removes the need for the broadcast eval

worn niche
#

you probably meant msg.channel.send
@amber fractal oh thanks, i forgot about it

earnest phoenix
#

@amber fractal I made it like that as it's easier tbh

#

My main bot is working fine (without sharding) but as we are on 1.3k nearly I'm implementing sharding

pure lion
#

Is there a way for me to bypass perms for myself for my prefix command? For example, right now I have an if (!hasPermission'MANAGE_GUILD') return, but I wanna be able to access it too without having the permission

earnest phoenix
#

don't do checks if the message author's id is yours

pure lion
#

Don't do checks or do do checks?

earnest phoenix
#

don't do

#

why would you do checks if you want to bypass it :p

pure lion
#

Just for me

earnest phoenix
#

yeah

haughty night
pure lion
#

Makes sense

earnest phoenix
#

optimisation people

#

optimisation

#

check for id first

pure lion
#

O shit tru

amber fractal
#

Also use &&

#

or no one can use it

#

as only you have your id

earnest phoenix
#

wha

#

if they and it then the command is going to be locked only to them

amber fractal
#

wait

solemn latch
#

Lol

amber fractal
#

I read that wrong

#

I hate logic

earnest phoenix
#
if author id != my id
  permission checks
no else because you don't need an else
amber fractal
#

tbf I would probably mix up that logic if I hadnt read it wrong anyways

#

wait wait wait. their doing a fail check arent they?

#

because !hasPermission

solemn latch
#

Wait wait wait wait.

still merlin
#

Whats the diffrance between if(!) and if?

solemn latch
#

Inveting

earnest phoenix
#

NOT operator

solemn latch
#

Inverting

earnest phoenix
#

it inverts the state of the bool

pure lion
#

You are ! going to that party

#

:)

solemn latch
#

Yeah but more in Yoda speech

amber fractal
#

so would it not be && because

  return because no perms

would return if their id is not my id?

solemn latch
#

! You are going to that party

still merlin
#

?

amber fractal
#

!true == false

earnest phoenix
#

damn did people here never take cs

amber fractal
#

!false == true

#

It makes bools go from false to true and viceversa mmLol

#

if(evaluates to true) will run if(evaluates to false) will not

earnest phoenix
#

wait till they discover boolean algebra and monotone laws

haughty night
amber fractal
#

Bitwise operations mmLol

forest prairie
earnest phoenix
#

filter out users that aren't bots