#development

1 messages · Page 1181 of 1

steady anchor
#
let array1 = ['unban.js','kick.js']```
this is my array. How can I replace all `.js`?
#

(javascript)

slender thistle
#

Use .map or a for loop with string.prototype.replace

steady anchor
#
            let commands = o_commands.map(remove_js)

            function remove_js(cmd) {
                cmd.replace('js', '')
            }```
#

this is not correct :(

slender thistle
#

🤔

steady anchor
#

it works

#

thanks

heavy marsh
#

Is there a way to download npm packages using a command?
I am using v12

sharp thicket
#

Hello, i have the "- This request has grown unnaturally so we are unable to accept your verification request at this time." error and i made 2 commands one that shows me the servers and their ids and one that leaves them what are some sketchy names to look out for?

heavy marsh
#

I dont mean using the console like npm i

#

I mean using a bot command

zenith terrace
#

I don't think you can

#

But idk

heavy marsh
#

I have seem some do the

#

But I dont seem to find a way

topaz fjord
#

use process.exec

heavy marsh
#

precess.exec(npm i discord.js)

#

like this?

topaz fjord
#

within node.js

heavy marsh
#
var exec = require('child_process').exec;
child = exec('npm install discord.js').stderr.pipe(process.stderr);
#

like this?

topaz fjord
heavy marsh
#

ok

hushed axle
#

Why I can’t open the console?

#

in vps?

digital ibex
#

how do you expect anyone to help you when you provide no context

hushed axle
quick lily
#

!ajuda

plain gazelle
#

hommie are you using windows server

#

haven't seen that shit since i was in elementary school

modest crane
#

install node.js

quick lily
#

!help

sinful belfry
#

-botcommands @quick lily

gilded plankBOT
#

@quick lily

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

plain gazelle
#

@hushed axle run in through command prompt

hushed axle
#

SOo_o I rent that vps today my friend help me install win

#

VNRGTA_5 why the other vps can open the console and the new vps don’t bigsad

earnest phoenix
#

How would we know

hushed axle
#

How do I know

modest crane
#

do you have node.js installed on the vps?

hushed axle
#

Which one?

modest crane
#

the one where you can't open the console

hushed axle
#

No

#

So I have to install ? That

modest crane
#

yes

hushed axle
#

terifcri thanks

drifting wedge
#

does slowmode_delay=0 work?

#

like for slowmode off

slender thistle
#

Should work

drifting wedge
#

ty

ionic dawn
#

Windows server lol

#

Schools still teaching that cause some companys require that knowledge

#

In my grade we have a few lessons of Windows Prompt

warm terrace
#

my education was so windows focused

#

its sad how little linux and programming was taught

ionic dawn
#

Windows is useful for people who have no idea about computers or have an administrative work

#

Anything else should be made on linux

drifting wedge
#

await ctx.channel.edit(slowmode_delay=0)

#

its saying invalid syntax

low shard
#

I can use user flags only in v12 ye?

sudden geyser
#

Yeah

low shard
sudden geyser
#

yuh

#

anyway you should stay off v11

#

It won't work when intents are required

#

Which is in early October

low shard
#

I will change to v12 when its gonna break

warm terrace
sudden geyser
#

You're delaying the pain until later.

dense vessel
#

^^

sudden geyser
#

I recommend you do it as soon as possible vs. doing it when you're required to.

#

it's like doing your homework very late in the night (or in school) instead of when you get home.

dense vessel
#

is there a way to check that args[0] is a member id? its for an unban command

#

right now the unban command detects everything even if it isnt an id

low shard
#

I have laptop so i will do it in the school

sudden geyser
#

is there a way to check that args[0] is a member id? its for an unban command
@dense vessel what library are you using?

dense vessel
#

discordjs 12

modest crane
#

is there a way to check that args[0] is a member id? its for an unban command
maybe parse args[0] to ulong?

low shard
#

@dense vessel you coding bot

sudden geyser
#

IDs are typically 17-19 characters, but since they're snowflakes, I believe they can be forever growing in size (regex: \d{17,})

low shard
#

Why you ask for help

#

😀

dense vessel
#

maybe parse args[0] to ulong?

IDs are typically 17-19 characters, but since they're snowflakes, I believe they can be forever growing in size (regex: \d{17,})
ill try doing these, thanks for the help

modest crane
#

oh you're using js

#

js don't have ulong

sudden geyser
#

Yeah but you can use parseInt in JS

#

It won't be accurate of course since it's too large

warm terrace
#

Since I don't really have any Discord friends that are interested in Formula 1, can I ask if someone who knows a little about Formula 1 wants to test my bot?

dense vessel
#

would checking if args[0] is NaN work too?

low shard
#

Cute dog

#

Dog*

sinful belfry
#

(not the channel for that)

low shard
#

Oh

#

Sorrt

sudden geyser
#

Yeah but you still need to try parsing it. Really the only reason I'd bother trying to convert it to a number is just to see if it looks like a snowflake

warm terrace
#

that's a rat

sinful belfry
low shard
#

Removed

dense vessel
#

Yeah but you still need to try parsing it. Really the only reason I'd bother trying to convert it to a number is just to see if it looks like a snowflake
alr thanks for the help lite

earnest phoenix
#

I did the snipe command. but does not see embed messages.

#

so RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty. gives a fault.

thick gull
#


        collector.on('collect', (reaction, user) => {
            console.log(`Collected ${reaction.emoji.name} from ${user.tag}`).then(() => {
                options.edit(`Okay, I've collected ${reaction.emoji.name} from you.`)
            }).catch((err) => {
                console.error(err);
            })
        });

is there a reason why .then is undefined
TypeError: Cannot read property 'then' of undefined

drifting wedge
#

How do I make my py bot send like command not found?

radiant patio
#

when I restart my bot the reaction roles dont work. why? how can I fix that?

earnest phoenix
#

async def clear(ctx, amount=300):

how do i make it so i can only clear 300 messages max

sudden geyser
#

DP is the reaction or old message being received as a partial?

#

@earnest phoenix check if amount is greater than 300

radiant patio
#

yes

sudden geyser
#

Could you try logging the value before you fetch the reaction and message

#

To see if it does change or returns a new object

drifting wedge
#

for example

#

if i were to use logs

#

how can i send it to a channel name

#

not id

karmic compass
#

lets say i have this kind of object/array:

{"profiles":[
  "a":{
      "FinalPoint":"One"
     }
  "b":{
      "FinalPoint":"Two"
      }
  ]
}

and i wanted to print out a.FinalPoint and b.FinalPoint, without having to do that directly (like a foreach loop), how would this be done?

sudden geyser
#

@drifting wedge I recommend you use IDs if you can reasonably do it, but you'd need to iterate over all cached channels to see if the name is equal to a string

#

If you tell us more info about what you're trying to do and how you're doing it we may be able to help more

drifting wedge
#

like logging

#

@sudden geyser

#

ill use a db to store custom channels

#

but for now

#

ill just use a channel name

sudden geyser
#

Is the channel name configurable by the user or is it pre-set by you. Like, the channel would have to be called logs and it would dispense logs there

drifting wedge
#

Is the channel name configurable by the user or is it pre-set by you. Like, the channel would have to be called logs and it would dispense logs there
@sudden geyser itll be preset

#

cuz i dont know how to use mango yet

sudden geyser
#

@karmic compass that syntax is not correct in general. You might want to remove the array ([]) part and replace it with an object instead ({}). Then, you can do profiles.a.FinalPoint and so on

#

OExe what library are you using

drifting wedge
#

@sudden geyser py

sudden geyser
drifting wedge
#

yep

sudden geyser
drifting wedge
#

ok so i have channel

#

how would i make it like channel = channel_id of channel called logs

grand finch
earnest phoenix
#

@grand finch how

sudden geyser
#

As in you want to get the ID of the channel you found?

drifting wedge
#

yes

grand finch
#

@earnest phoenix

/**
 * @desc returns a nicely ANSI coloured and formatted string that contains the stack
 *  Usually the stack is just a plain string with a bunc of '\nn\x20\x20\x20\x20's seperating it
 */
Object.defineProperty(Error.prototype, 'niceStack', {
    enumerable: false,
    configurable: false,
    get() {
        const stackFrames = this.stack.split(/\n\s+/);
        let frame = -1;

        return `\t${stackFrames.map((x) => {
            let j = -1;

            return `[${(++frame).toString(10).cyan}] ${stackFrames[frame].split('\x20').map((y) => {
                if (frame === 0)
                    return y.yellow;
                
                j++;

                if (j === 0) /// 'at'
                    return y.grey;

                if (j === 1) /// class and file
                    return y.yellow;

                return y.replace(/\(([\x20-\x7E]+?)([^\/\\]+):(\d+):(\d+)\)/, (...k) => {
                    return `(${k[1].yellow}${k[2].cyan.bold}:${k[3].cyan}:${k[4].grey})`;
                })
                    .replace(RegExp(process.cwd(), 'g'), '.'.cyan.bold);
            }).join('\x20')}`;
        })
            .join('\r\n\t')}`;
    },
});
drifting wedge
#

like the id of the channel called logds

#

logs

earnest phoenix
#

Holy shit

grand finch
#

By polluting the Error prototype 😄

earnest phoenix
#

I never thought of that

grand finch
#

Also requires modules color and chalk but they also pollute the string proto

#

But they also wont dump colours out of the stdout isn't a tty which is neat

drifting wedge
#

press x to doubt

#

l

#

wow=

grand finch
#

regex could be a lot better, currently most colours are just on splitting the stack dump by spaces (\x20)

sudden geyser
#

After you find the channel with the util method I showed you, check if it's not equal to None. If it's not, get the .id property. Though, if all you need to do is send a message in that channel, you may be able to use the channel instance directly (<TextChannel>.send).

I also looked around a bit, and found the discord.util.get helper which can do the same thing but shorter.

#

Also requires modules color and chalk but they also pollute the string proto
@grand finch chalk doesn't polute the string prototype to my knowledge

grand finch
#

Oh right, maybe it's justcolors

sudden geyser
#

yeah it is

drifting wedge
#

channel = discord.utils.get(client.get_all_channels(), name='logs')

#

so like this would work?

#

or would it send it to all guilds?

sudden geyser
#

Yeah that's one way of doing it, but I'd assume you want to restrict it to the guild the message was sent from

drifting wedge
#

yep...

earnest phoenix
#
  if role in ctx.message.author.roles and time < 300:
        await ctx.send('Done')
        role2 = discord.utils.find(lambda r: r.name == 'Level 2 Plan', ctx.message.guild.roles)
    elif role2 in ctx.message.author.roles and time < 600:
        await ctx.send('Done')
        role3 = discord.utils.find(lambda r: r.name == 'Level 3 Plan', ctx.message.guild.roles)
    elif role3 in ctx.message.author.roles and time < 1200:
        await ctx.send('Done')
    else:
        await ctx.send('Time Limited Reach')```

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'role2' referenced before assignment
#

any idea why this error comes up?

ionic dawn
#

Big F to developer

sudden geyser
#

If you have the guild you can do guild.text_channels to get all text channels from a guild

ionic dawn
#

isnt available anymore, SadCat

sudden geyser
#

To be honest I'm glad the badge isn't being given out anymore

drifting wedge
#

Big F to :developer:
@ionic dawn why?

ionic dawn
#

Well, people like to collect badges

drifting wedge
#

no more badges?

ionic dawn
#

@ionic dawn why?
@drifting wedge Is not available anymore, discord said it 4 days ago, no1 will get the badge anymore

drifting wedge
#

wuuuut

#

rip

ionic dawn
#

only for people who sended the verify before day 20

drifting wedge
#

why tho

sudden geyser
#

Yeah but collecting badges was the exact reason it got removed

drifting wedge
#

so fing stuping

#

stupid

ionic dawn
#

Yeah but collecting badges was the exact reason it got removed
@sudden geyser exactly

drifting wedge
#

channel = discord.utils.get(client.get_all_channels(), name='logs')

If you have the guild you can do guild.text_channels to get all text channels from a guild
@sudden geyser

ionic dawn
#

they said lot of people make things only to get the badge

#

fake bots etc

drifting wedge
#

bruhhhh

#

rip

sudden geyser
#

Like, the fact they had to say extreme was alarming:

We’ve approved thousands of bots so far. As time goes on, the verification queue has become more and more filled with fraudulent submissions by individuals that are not submitting actual bots, but are going to extreme lengths to get a profile badge. These submissions are hindering the ability for legitimate bots to get verified in time for the deadline.

drifting wedge
#

wait tho

#

so @sudden geyser

#

how would i get the channels from just one guild?

sudden geyser
ionic dawn
#

and they are renaming the actual badge in the next update

drifting wedge
#

i got that

#

but this is my code channel = discord.utils.get(client.get_all_channels(), name='logs')

#

how would i implement the guild

#

would it be channel = discord.utils.get(guild.text_channels.client.get_all_channels(), name='logs')

sudden geyser
#

remove the .client.get_all_channels() part then try running the code to see if it works

drifting wedge
#

channel = discord.utils.get(guild.text.channels(), name='logs')

#

imma try this

#

this is so wrong @client.event async def on_member_join() channel = discord.utils.get(guild.text.channels(), name='logs') await ctx.channel.send(f'Welcome {member}')

#

omega lul\

sudden geyser
#

You can't make up properties/stuff. What you can use is listed on the documentation, like how you can't use an undefined variable.

drifting wedge
#

i fixed it

#
channel = discord.utils.get(guild.text.channels(), name='logs')
    await ctx.channel.send(f'Welcome {member}')```
#

i mean middle row still not working tho

sudden geyser
#

Do you have a good understanding of Python

drifting wedge
#

yea

#

im fairly new to coding

#

but im pretty good at py

#

thon

grand finch
#

better formatted now

#
/** @desc returns a nicely ANSI coloured and formatted string that contains the stack */
Object.defineProperty(Error.prototype, 'niceStack', {
    enumerable: false,
    configurable: false,
    get() {
        const stackFrames = this.stack.split(/\n\s+/);

        return `\t${stackFrames.map((curr, idx, arr) => {
            switch (idx) {
                case 0:
                    return curr.replace(/^([^:]*):?\s*(.*)$/, (...params) => {
                        return `${params[1].red} ${params[2]}`;
                    });
                    break;

                default:
                    return curr
                        .replace(/^at\s*/, '\u2026') /// 'at' -> '\u2026'
                        .replace(/new ([^\x20]+)/, (...params) => { return `new ${params[1]}`.bold.blue; }) /// class instantiation
                        .replace(/(<\w+>)/, (...params) => { return params[1].grey; }) /// '<anonymous>' etc
                        .replace(/^\u{2026}([\x1b\x21-\x7E]+)\x20+([\(\[])/u, (...params) => { return `\u2026${params[1].yellow} ${params[2]}` })
                        .replace(/\[as\x20+(\w+)\]/, (...params) => { return `[as ${params[1].cyan}]`; }) /// '[as <things>]'
                        .replace(/\(([\x20-\x7E]+?)([^\/\\]+):(\d+):(\d+)\)/, (...k) => { return `(${k[1].grey}${k[2].cyan.bold}:${k[3].cyan}:${k[4].grey})`; }) /// path, filename, line, col
                        .replace(RegExp(process.cwd(), 'g'), '.'.cyan.bold); /// reldir
                    break;
            }
        })
            .join('\r\n\t')}`;
    },
});
#

lol, discord's syntax highlighter breaking a little bit there 😛

drifting wedge
#

does member.id work?
for the user id?
its on the member join event

pale vessel
#

yes

drifting wedge
#

how do i define guild?

#

im using an event

#

{guild.icon_url}

#

when i use ctx says i cant use ctx

torn ravine
#

what is ctx

#

I've seen alot of people use it

sharp thicket
#

hi how do i get the time an account was created?

#

im using NodeJS

torn ravine
#

message.author.createdAt

sharp thicket
#

o

#

why can't i find anything on docs e.e

torn ravine
#

it's under the user class

sharp thicket
#

oh

drifting wedge
#
TypeError: add_field() missing 1 required keyword-only argument: 'name'
Ignoring exception in on_member_join```
#

getting this error

sharp thicket
#

lol

#

wait

#

ima help with that

#

do name: "namehere",

drifting wedge
#

?

sharp thicket
#

you can't add a field without a name..

torn ravine
#

what's your lang

drifting wedge
#

oooh

#

py

#

i mean can i just have nothing as the name?

torn ravine
#

I don't know py sorry

sharp thicket
#

oh

#

same

drifting wedge
#

and how do i get when an account was created

#

in years

thick gull
#

use moment

#

oh wait

#

your using py

#

nvm

meager whale
#

i finally finished my timerbot!

ornate needle
#

@drifting wedge u need name

#

You can't leave it as empty

earnest phoenix
#

Im having an issue with the buy command which i want to 2 items but it's still buying one

#
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");

module.exports = {
    name: 'buy',
    description: "buy command",

    async execute(client, message, args) {
        let prefix = 'h!'
        let user = message.mentions.members.first() || message.author;
        let author = db.fetch(`money_${message.guild.id}_${user.id}`)

        if (!args[0]) return message.channel.send('What are you buying...?')

        if (args[0] === "wand") {
            if (author < 1) return message.reply(`You don't have enough money to buy this item`)
            amount = args[2]
            if (!args[2]) {
                amount = 1
            }
            let embed = new Discord.MessageEmbed()
                .setTitle(`Shop`)
                .setDescription(`You have bought ${amount} wand`)
            message.channel.send(embed)
            db.add(`wand_${message.author.id}`, amount)
            db.subtract(`money_${message.author.id}`, 1)

        }
    }
}
#

Here's the code

thick gull
#

args 2 is the third message im assuming

#

prefix command args[0] args[1] args[2]

#

based on how you have the wand

opal plank
#

what is args 1?

#

also args is a string

#

not sure if you db interprets string as an amount

sacred vigil
#

how do i make bot without knowing java script?

#

i dont know how to code and never learned how

pale vessel
#

woah java?

sacred vigil
#

yea

#

that's what the bots use

opal plank
#

you want a bot without learning how to code?

#

Pay someone.
Buy / bid for a bot.
Buy / Find some botmaker app online @sacred vigil

sacred vigil
#

i dont have money

#

but i will try the 3rd thing you said

opal plank
#

though this is for Development, we dont usually give any of those options for support here

#

also im fairly certain JavaScript and Python are the 2 most common bot langs

#

though thats just an assumption

sacred vigil
#

oh ok

#

thanks

earnest phoenix
#

Hmm i have just fixed my buy command but now i have an issue with my bal command

#

so i have 39 dollars originally in the bank then when i bought two items and checked my bal, it said i have 38 dollars

opal plank
#

isnt that the intended way?

earnest phoenix
#

no

opal plank
#

you buy something, your money decreases

#

¯_(ツ)_/¯

earnest phoenix
#

i mean

sonic lodge
#

🧠

earnest phoenix
#

I have set the price to $1 for test

#

I should have 37 instead of 38

opal plank
#

you arent multiplying your value then

#

you hardcoded it

#

show what u got thus far

earnest phoenix
#

no? wait what value?

#

ok

opal plank
#

you got amount somehow

#

multiply price by amount

#

¯_(ツ)_/¯

earnest phoenix
#
const Discord = require("discord.js");
const db = require("quick.db");
module.exports = {
    name: 'bal',
    description: "this is an bal command",
    async execute(client, message, args) {

        if (!message.content.startsWith('h!')) return;

        let user = message.mentions.members.first() || message.author;

        //let bal = db.fetch(`money_${message.guild.id}_${user.id}`)
        let bal = db.fetch(`money_${user.id}`)

        if (bal === null) bal = 0;

        //let bank = await db.fetch(`bank_${message.guild.id}_${user.id}`)
        let bank = await db.fetch(`bank_${user.id}`)
        if (bank === null) bank = 0;

        let moneyEmbed = new Discord.MessageEmbed()
            .setColor("#FFFFFF")
            .setDescription(`**${user}'s Balance**\n\nPocket: ${bal}\nBank: ${bank}`);
        message.channel.send(moneyEmbed)
    }
}
opal plank
#

no not that

#

bal should be fine

earnest phoenix
#
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");

module.exports = {
    name: 'buy',
    description: "buy command",

    async execute(client, message, args) {
        let prefix = 'h!'
        let user = message.mentions.members.first() || message.author;
        //let author = db.fetch(`money_${message.guild.id}_${user.id}`)
        let author = db.fetch(`money_${user.id}`)

        if (!args[0]) return message.channel.send('What are you buying...?')

        if (args[0] === "wand") {
            if (author < 1) return message.reply(`You don't have enough money to buy this item`)
            let amount = args[1]
            if (!args[1]) {
                amount = 1
            }
            let embed = new Discord.MessageEmbed()
                .setTitle(`Shop`)
                .setDescription(`You have bought ${amount} wand(s)`)
            message.channel.send(embed)
            db.add(`wand_${message.author.id}`, amount)
            db.subtract(`money_${message.author.id}`, 1)

        }
    }
}
opal plank
#

its ur buy that manipulates the money

#

yeah thats the issue

earnest phoenix
#

?

#

Which one

opal plank
earnest phoenix
#

oh

opal plank
#

you just setting amount

earnest phoenix
#

so i take away the 1?

opal plank
#

you arent multiplying amount and price bonkcat

#

if you buy 1 or 20 wans its always going to be 1 money

sonic lodge
#

because you're subtracting the price of 1 wand

opal plank
#

cuz u hardcoded

earnest phoenix
#

Ohh

sonic lodge
#

if something costs $2, and you buy 3 of it, that's 2 * $3 = $6 spent ➕

solemn leaf
#
const Discord = require("discord.js");
const client = new Discord.Client()

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

    client.guilds.cache.forEach((guild) => {
        message.channel.send(`${guild.name} Has a total of ${guild.memberCount} members`)
    })
}

module.exports.help = {
    name: "serverinfo"
}

why doesnt this send?

opal plank
#

fyi you can export multiple things

solemn leaf
#

what

sonic lodge
#
module.exports = {
  something: 2,
  somethingelse: 3,
};```
opal plank
#

^^

solemn leaf
#

ik

#

I dont need to?

opal plank
#

just writing extra code

#

¯_(ツ)_/¯

sonic lodge
#

it's nice to package related things into one object

#

oop life

solemn leaf
#

how does that help with the question?

opal plank
#

with the question, not much, with the code and good practices, a bit

#

also you passing bot

#

why the heck you initiating a new client?

solemn leaf
#

bcs when I do bot

#

it errors

sonic lodge
#

and that error is?

solemn leaf
#

I didnt record it

opal plank
#

just pass your client around

#

dont initiate a new instance

solemn leaf
#

okay

#

I figured the problem thanks guys.

earnest phoenix
#

I have this cat command but it keeps looping

#
const Discord = require("discord.js");
const randomPuppy = require('random-puppy')
    //const cat = require("random-puppy")
    //const event = randomPuppy.all(cat);
module.exports = {
    name: 'cat',
    description: 'This is a random command',
    async execute(client, message, args) {
        const event = randomPuppy.all('cat');


        event.on('data', url => {
            let embed2 = new Discord.MessageEmbed()
                .setImage(url)
            message.channel.send(embed2)


        });

    }
}
#

Which part did i do wrong

opal plank
#

erm, thats a listener...

earnest phoenix
#

oh

#

Then what do i change

opal plank
#

actually

#

what are you trying to do?

earnest phoenix
#

Im trying to get a cat image at a time

#

when i do the command

opal plank
#

then you dont use listeners

#

you need a promissified call or something of the sorts

#

aka fetch an image, dont listen for an event

earnest phoenix
#

Wait I will try something

#

Is it this:

const Discord = require("discord.js");
const randomPuppy = require('random-puppy')
    //const cat = require("random-puppy")
    //const event = randomPuppy.all(cat);
module.exports = {
    name: 'cat',
    description: 'This is a random command',
    async execute(client, message, args) {
        const image = randomPuppy.all('cat');

        randomPuppy()
            .then('cat', url => {
                let embed2 = new Discord.MessageEmbed()
                    .setImage(url)
                message.channel.send(embed2)


            });

    }
}
solemn leaf
#
    const user = message.mentions.users.first();
    let image
    if (!user) {
        image = message.author.avatarURL("", true)
        return
    }
    else {
        image = user.avatarURL("", true)
    }

    const Embed = new Discord.MessageEmbed()
        .setImage(image)

when sending this it doesn't show gifs nor does just doing -avatar it doesn't set image to your pfp.

pale vessel
solemn leaf
#

@pale vessel i set it to gif and that still didnt work.

earnest phoenix
#

Hmm my cat command doesn't work

earnest phoenix
#

how would i name this my command async def soft-ban

restive furnace
#

by naming it like that

earnest phoenix
#

yeah

#

but

#

🤣

#

it doesnt work bc of the -

restive furnace
#
@client.command(name="soft-ban")
async def softban(ctx, ....):
      pass```
earnest phoenix
#

ty

pale vessel
solemn leaf
#

thank

earnest phoenix
#

How do i mention someone in this inventory command

const Discord = require("discord.js");
const db = require("quick.db");

module.exports = {
    name: 'inventory',
    description: "this is an inventory command",
    async execute(client, message, args) {


        if (!message.content.startsWith('h!')) return;


        let user = message.mentions.members.first() || message.author;
        let inv = db.fetch(`wand_${message.author.id}`)

        if (inv === null) inv = 0;

        let embed = new Discord.MessageEmbed()
            .setColor("RANDOM")
            .setTitle(`${user}'s Inventory`)
            .setDescription(`Wands: ${inv}`);
        message.channel.send(embed)
    }
}
solemn leaf
#

@earnest phoenix message.mentions.users.first()

earnest phoenix
#

okay

solemn leaf
#

@pale vessel so can I just do webp for the file?

earnest phoenix
#

How do i do name instead of ID

solemn leaf
#

what did you name the let for it?

#

do

#

let user = message.mentions.users.first();

#

user.tag

earnest phoenix
#

nvm

#

i did it

#

thanks

pale vessel
#

@pale vessel so can I just do webp for the file?
@solemn leaf webp is default, you can just do displayAvatarURL() with no options

solemn leaf
#

@pale vessel okay and this is hap[enin

#

TypeError: user.displayAvatarURL(...) is not a function

pale vessel
#

if you want it to support gif, add dynamic displayAvatarURL({ dynamic: true })

#

are you sure that's a user?

solemn leaf
#

yes

pale vessel
#

it's probably user.user.displayAvatarURL(), try that

earnest phoenix
#
const Discord = require("discord.js");
const db = require("quick.db");

module.exports = {
    name: 'inventory',
    description: "this is an inventory command",
    async execute(client, message, args) {


        if (!message.content.startsWith('h!')) return;


        let user = message.mentions.users.first() || message.author;
        let inv = db.fetch(`wand_${message.author.id}`)

        if (inv === null) inv = 0;

        let embed = new Discord.MessageEmbed()
            .setColor("RANDOM")
            .setTitle(`${user.username}'s Inventory`)
            .setDescription(`Wands: ${inv}`);
        message.channel.send(embed)
    }
}
#

Here's the code

#

Why does that happen?

solemn leaf
#

@pale vessel fixed but still gifs dont move

pale vessel
#

if you want it to support gif, add dynamic displayAvatarURL({ dynamic: true })
@pale vessel

earnest phoenix
#

@solemn leaf Could you help pls

pale vessel
#

also, it was not a user

#

it was a member

#

please make sure next time bruh

earnest phoenix
#

Bruh Aki told me to change it to user

pale vessel
#

not you

#

sorry

earnest phoenix
#

oh

solemn leaf
#

ohhh

#

I see what I did wrong thanks

#

${user.tag}

#

@earnest phoenix

#

I think

earnest phoenix
#

Oh ok

#

Bruh

#

Cannot read property 'tag' of undefined

solemn leaf
#

1 sec

earnest phoenix
#

Where is user defined

pale vessel
#

it's not defined lmao

earnest phoenix
#

And are you spoonfeeding @solemn leaf

solemn leaf
#

no

#

why would I

earnest phoenix
#

Yes

solemn leaf
#

idc if I am

earnest phoenix
#

You are

pale vessel
#

can you like relax

earnest phoenix
#

idc if I am
@solemn leaf rules

#

can you like relax
@pale vessel alright

pale vessel
#

you know the rules and so do i

earnest phoenix
#
const Discord = require("discord.js");
const db = require("quick.db");

module.exports = {
    name: 'inventory',
    description: "this is an inventory command",
    async execute(client, message, args) {


        if (!message.content.startsWith('h!')) return;


        let user = message.mentions.user.first() || message.author;
        let inv = db.fetch(`wand_${message.author.id}`)

        if (inv === null) inv = 0;

        let embed = new Discord.MessageEmbed()
            .setColor("RANDOM")
            .setTitle(`${user.tag.name}'s Inventory`)
            .setDescription(`Wands: ${inv}`);
        message.channel.send(embed)
    }
}
solemn leaf
#

lmao

#

no what

pale vessel
#

it's user.tag

earnest phoenix
#

you know the rules and so do i
@pale vessel never gonna give you up reference

#

No the tag doesn't work

blissful coral
#

What are you looking for

pale vessel
#

it should work

blissful coral
#

Like what do you want it to output

#

Name or tag

earnest phoenix
#

I want to do name

#

Tbh are you even understanding your code

blissful coral
#

user- @ them

pale vessel
#

that would be user.username

blissful coral
#

If you do just user it mentions them user.id is there is and user.username does name

earnest phoenix
#

Cannot read property 'first' of undefined

solemn leaf
#

oh it was id

#

sorry

pale vessel
#

it's users

earnest phoenix
#

That database is wrongly setup

pale vessel
#

users.first()

blissful coral
#

zzZ

earnest phoenix
#

oh it was id
@solemn leaf do you even know what you're explaining her

blissful coral
#

^

earnest phoenix
#

i don't think so

solemn leaf
#

yes

#

i do

earnest phoenix
#

Then

blissful coral
#

@earnest phoenix do users.first() like flazepe said

earnest phoenix
blissful coral
#

What’s wrong with it?

earnest phoenix
#

Why are you having problems with three lines of code

pale vessel
#

you said you wanted username

blissful coral
#

^

earnest phoenix
#

That doesn't seem right
@earnest phoenix your database is setup wrong

plain haven
#

Hello

solemn leaf
#

@earnest phoenix if you want it to ping do ${user.id}, @earnest phoenix Bcs im new to js

earnest phoenix
#

hi

#

@earnest phoenix your database is setup wrong
@earnest phoenix how?

#

@earnest phoenix if you want it to ping do ${user.id}, @earnest phoenix Bcs im new to js
@solemn leaf new to js and also trying to explain someone intermediate level of code

blissful coral
#

@solemn leaf incorrect

#

You do user

#

User if will give them the id

pale vessel
#

it's <@id> or user.toString() for mentions

earnest phoenix
#

@earnest phoenix how?
@earnest phoenix there is a key required in your database

solemn leaf
#

then you would wrap it

earnest phoenix
#

there is no key

blissful coral
#

You can just do ${user}

pale vessel
#

if you put the user object in a template literal, you don't need toString(), it'll automatically convert to a mention

earnest phoenix
#

@earnest phoenix there is a key required in your database
@earnest phoenix wdym? I use quick.db tho

#

so everyone's inventory is literally the same

plain haven
blissful coral
#

What is the problem

earnest phoenix
#

wait so how do i fix it

#

LIGHT MODE

#

AAAAAAAAA

pale vessel
#

what's the problem @earnest phoenix

earnest phoenix
#

wait so how do i fix it
@earnest phoenix allow me to explain

#

ok

blissful coral
#

OMG MY EYES

earnest phoenix
#

quick.db stores data as seperate keys in separate databases

blissful coral
#

Dude light mode is the death of me

solemn leaf
#

better discord

#

get it

blissful coral
#

??

#

Discord tos

#

Stop

earnest phoenix
#

db.set("databaseName.keyName",keyValue);

#

this will save as:

#
databaseName
  |_keyName: keyValue
blissful coral
#

@plain haven what is your problem? You have yet to state a problem

restive furnace
#

better discord
@solemn leaf breaking Discord ToS (ban hammer incoming)

blissful coral
#

Bye bye

#

:)

earnest phoenix
#

Hmm should i show code

#

and tell me which line is wrong

blissful coral
#

Yes so we can help you

#

No what

#

Your error tells you the line

#

That is wrong

plain haven
#

@plain haven what is your problem? You have yet to state a problem
@blissful coral why

blissful coral
#

You sent a picture

earnest phoenix
#

No i don't have any error when i run the command

blissful coral
#

Do you need help

plain haven
#

Huh?

blissful coral
#

Then what’s the problem?

earnest phoenix
#

The quantity of the inventory is the same?

restive furnace
#

If you send a picture here - without a context, how do we know if you have a problem?

#

^^ @plain haven

blissful coral
#

@earnest phoenix in your database are you setting it to per player

sonic lodge
blissful coral
#

Or for your embed are you just pulling the same thing

sonic lodge
#

you are getting the wands of the person who sent the message

blissful coral
#

^^

#

There you go

earnest phoenix
#

Wait so i change to money?

sonic lodge
#

use the mentioned user's id instead, otherwise use the sender's id

blissful coral
#

^^

#

Thanks oopled

earnest phoenix
sonic lodge
#

that or message.author.id

earnest phoenix
#

okay but then it will show their id instead of name?

blissful coral
earnest phoenix
#

okay

blissful coral
#

If you want to show there make

#

Name

#

Then do user.username

sonic lodge
#

oh right ^^ i noticed

restive furnace
#

^^^ bad practice

blissful coral
#

:)

restive furnace
#

use ids instead

blissful coral
#

He wants it for the title

restive furnace
#

someone can have same name

earnest phoenix
#

Hmm it's still showing the same amount?

blissful coral
#

For the title not db

#

Right?

#

@earnest phoenix send code

#

Do js at the start of your block please

#

It makes it easier to read

earnest phoenix
#
const Discord = require("discord.js");
const db = require("quick.db");

module.exports = {
    name: 'inventory',
    description: "this is an inventory command",
    async execute(client, message, args) {


        if (!message.content.startsWith('h!')) return;


        let user = message.mentions.users.first() || message.author;
        let inv = db.fetch(`wand_${message.author.id}`)

        if (inv === null) inv = 0;

        let embed = new Discord.MessageEmbed()
            .setColor("RANDOM")
            .setTitle(`${user.id}'s Inventory`)
            .setDescription(`Wands: ${inv}`);
        message.channel.send(embed)
    }
}
blissful coral
sonic lodge
#
let inv = db.fetch(`wand_${message.author.id}`)```
you still are getting the wands of the person who sent the message
blissful coral
#

^^

earnest phoenix
solemn leaf
#

no

#

you can just do

sonic lodge
#

yes?

blissful coral
#

It should be
let inv = db.fetch(`wand_${user.id}`)

earnest phoenix
#

okay

blissful coral
#

Aki why are you saying no

#

??

solemn leaf
#

wait

#

yes

earnest phoenix
#

Okay

blissful coral
#

Did it work?

earnest phoenix
#

Yes it works. Thanks

#

Also I have a problem with my cat command. So basically when i do the command, it keeps looping

#
const Discord = require("discord.js");
const randomPuppy = require('random-puppy')
    //const cat = require("random-puppy")

module.exports = {
    name: 'cat',
    description: 'This is a random command',
    async execute(client, message, args) {
        const event = randomPuppy.all('cat');
        event.on('data', url => {

            let embed2 = new Discord.MessageEmbed()
                .setImage(url)
            message.channel.send(embed2)
            console.log(url)
            console.log(url)

        })

    }
}
#

I want to fetch the image of cats instead of puppy

blissful coral
#

randomPuppy

#

.all

#

Change that

#

You have cat // out

#

And it is defined the same as puppy

#

Change it to cat

earnest phoenix
#

So randomcat?

blissful coral
#

Yes

earnest phoenix
#

ok

blissful coral
#

Pretty sure

earnest phoenix
#

But it keeps looping?

sonic lodge
#

it's sending the same image over and over?

earnest phoenix
#

No

#

Different images

#

over and over

sonic lodge
#

yeah, i'd imagine there's lots of cat images in a cat subreddit

blissful coral
#

So your send statement is in the loop

earnest phoenix
#

yeah

blissful coral
#

You need to get one

#

Instead of all

#

And make sure the send is outside the loop

#

Or it will loop it

earnest phoenix
#

So how do i get one

#

?

trim walrus
#

Hiiii

sonic lodge
#

it seems weird that that node package has a function that constantly spits out images

earnest phoenix
#

Yeah

sonic lodge
#

i'd imagine getting just one image from that would be unnecessarily complex

trim walrus
sonic lodge
#

wrong place

earnest phoenix
#

i'd imagine getting just one image from that would be unnecessarily complex
But im not sure how?

trim walrus
#

Y’all like my cat?

restive furnace
#

yes, but wrong place

sonic lodge
#

there seems to be another way to use the api that grabs just one image

trim walrus
#

Well shit idk what anyplace is

sonic lodge
#

@trim walrus read the channel name and description

earnest phoenix
#

Oh

restive furnace
#

just dont use randomPuppy

#

its outdated

#

use the reddit api directly instead

sonic lodge
#

yeah, you definitely should

earnest phoenix
#

how?

restive furnace
#

or smth

earnest phoenix
#

Is it the same way i do the meme command

restive furnace
#

go to that link, and u see JSON

earnest phoenix
#

But that's just meme and I have already done that?

#

Who need halp brudda

restive furnace
#

u can do it for dogs and cats too

earnest phoenix
#

how?

restive furnace
#

r/dogs
r/cats

earnest phoenix
#

@restive furnace r/wooooosh

restive furnace
#

no

earnest phoenix
#

Oh

#

It says this when i run the command: TypeError: Cannot read property 'data' of undefined

#
const Discord = require("discord.js")
const got = require("got")

module.exports = {
    name: 'cat',
    description: "this is a cat command",
    async execute(message, args) {
        const embed = new Discord.MessageEmbed()
        got('https://www.reddit.com/r/cats/random/.json').then(response => {
            let content = JSON.parse(response.body)
            let permalink = content[0].data.children[0].data.permalink;
            let memeUrl = `https://reddit.com${permalink}`;
            let memeImage = content[0].data.children[0].data.url
            let memeTitle = content[0].data.children[0].data.title
            let memeUpvotes = content[0].data.children[0].data.ups
            let memeDownvotes = content[0].data.children[0].data.downs
            let memeNumComments = content[0].data.children[0].data.num_comments
            embed.setTitle(`${memeTitle}`)
            embed.setURL(`${memeUrl}`)
            embed.setImage(memeImage)
            embed.setColor('RANDOM')
            embed.setFooter(`👍${memeUpvotes}👎${memeDownvotes}💬${memeNumComments}`)
            message.channel.send(embed)
        })

    }
}

And I use the meme code to replace cats

#

What do i do?

split wedge
#

Can someone pls provide me with a list of essential bots needed in a server

blissful coral
#

Not the point of this channel

#

@earnest phoenix find the line it is happening on first and look at that line

earnest phoenix
#

ok

modest crane
#

some lines are missing the ;

earnest phoenix
#

some lines are missing the ;
@modest crane that wont cause the error lol

#

content is undefinded

#

JSON.parse return promise

modest crane
#

idk maybe that was the problem

sonic lodge
#

JSON.parse doesn't return a promise?

earnest phoenix
#

Oh

#

Sorry

weak rain
#

hey wassup

#

bois

earnest phoenix
#

Its probably cuz data is undefinded

#

Sup

weak rain
earnest phoenix
#

I got it fixed.

#

Whats the cause

#

I haven't defined the data

#

What

#

I mean the data wasn't defined but i just fixed it

#

Btw for the inventory, when i do this, it shows mine instead of another person

sonic lodge
#

that's because your command uses either the first mention, or the author of the message

earnest phoenix
#

And not id

low phoenix
earnest phoenix
#

.join

hasty dagger
#

hello i,m added bot

earnest phoenix
#

Then what do i change

carmine turret
#

guys you know about this?

sonic lodge
#

that announcement came out like 5 days ago

carmine turret
#

;///

tight plinth
#

bruh why people can't read

#

the badge will not be removed

#

smh

torn ravine
#

no one is able to obtain the badge

#

the badge is not being removed

real nacelle
#

how to set embed borders?

#

in my bot.

torn ravine
#

what do you mean

real nacelle
#

aeon

torn ravine
#

and what lang?

real nacelle
#

javascript

torn ravine
#

are you talking about the color?

real nacelle
#

like the aeon bot have

#

yes

torn ravine
#

its .setColor(<your hex color>)

real nacelle
#

OOH
Arigato!

#

thanks**

torn ravine
#

yw

restive furnace
#

or color: 0xkkkk if u use the object

real nacelle
#

i am using 0000ff

#

as hex code

#

@torn ravine

#

but

#

do i need to use double quotes?

torn ravine
#

so it’d be .setColor('<color>')

real nacelle
#

cuz it is taking it as a command

#

lemme try

torn ravine
#

sorry

real nacelle
#

btw the code isn't working

restive furnace
#

"#code" or 0xcode

#

^^ use those

real nacelle
#

and how to make the bot work 24/7

#

even when I close VSCode

restive furnace
#

by getting vps

real nacelle
#

What's that?

#

How to use it?

restive furnace
#

google

real nacelle
#

Do I have to download it?

earnest phoenix
#

@weak parrot do the funny

restive furnace
#

no

real nacelle
#

then

earnest phoenix
#

-vps

restive furnace
#

its a vps

weak parrot
#

-vps

gilded plankBOT
#

A VPS or virtual private server is a virtualized server instance run in the cloud. It acts like a normal server, allowing you to remotely login and manage it just like a physical server or computer. If you're looking for a way to keep your bot online 24/7, a VPS is a great option.

Having trouble choosing a VPS provider or don't know where to start? Click here for a list of common and affordable VPS providers.

real nacelle
#

what's vps 😅

restive furnace
#

heres explained ^^^

real nacelle
#

ooh

#

wait lemme read

#

affordable?

#

It is for money?

restive furnace
#

means cheap

#

yes

real nacelle
#

Aah

#

I don't have money

restive furnace
#

then u need to get rpi or smth

real nacelle
#

I wasted all my money on games.

earnest phoenix
#

Rip then

real nacelle
#

Now what's rpi??

restive furnace
#

not even 3€/month

earnest phoenix
#

Microprofessor

restive furnace
#

also rpi is raspberry pi

#

micro pc

real nacelle
#

All vps's are for money?

restive furnace
#

yes ofc

#

everything is for money

real nacelle
#

I can't use it till the next 6 months.

earnest phoenix
#

Altrrnative is to

#

Open your pc 24/7

real nacelle
#

I took all pcoket money from my parents for the 6 months

#

collectively.

#

Open your pc 24/7
@earnest phoenix not usefull

restive furnace
#

why?

earnest phoenix
#

Theres ntohing er can do

real nacelle
#

How will I open my pc for 24 hrs?

restive furnace
#

by not shutting down it

#

¯\_(ツ)_/¯

real nacelle
#

-_-'

golden condor
#

Just turn ofr the monitor or something

earnest phoenix
#

I can hodt it for you

#

BUT it cost 1$ permonth

restive furnace
#

nice guy or girl ^

golden condor
#

give me token and I host bot for free

#

and code bot

real nacelle
#

oh really?

#

Go and die

#

Am not a fool.

golden condor
#

I was joking

earnest phoenix
#

Yo rude

real nacelle
#

😁

golden condor
#

Don't ever give the token to anyone

#

lol

real nacelle
#

I know

earnest phoenix
#

I am willing to hodt it on my Raspberry Pi

real nacelle
#

Btw y token is ILHGIHFBYIEGFIhiLHH657ILHHIGIg

earnest phoenix
#

But comr at cost of 1$ per month

restive furnace
#

it is Mzkzkzbbtnskbsbdn.Kdjjdvzbjzjdj.bdjidi.kdbsbskks

real nacelle
#

what's raspberry pi?

earnest phoenix
#

Micro processor

#

Aka mini computer

real nacelle
#

Hmm

#

Also from money?

earnest phoenix
#

Yeah

solemn leaf
#

how can I randomize functions? like
let string = [
value.fucntion(),
value2.fucntion()
]

golden condor
#

Yes

earnest phoenix
#

It codt me 20$

golden condor
#

It costs money to buy one

earnest phoenix
#

But i can hodt it on mine

real nacelle
#

It codt me 20$
@earnest phoenix u write s, d?

earnest phoenix
#

For the price of 1$ per month

golden condor
#

Not sure if you should do that tho

earnest phoenix
#

Yeah

golden condor
#

Like if u give access

earnest phoenix
#

I wont give access

golden condor
#

Or you aren't gonna do that

real nacelle
#

Imma seee prices for vps.

golden condor
#

ah ok

#

You could get an rpi ig

solemn leaf
#

how can I randomize functions? like
let string = [
value.fucntion(),
value2.fucntion()
]
let index = getRandomInt(strings.length)
let str = strings[index];

earnest phoenix
#

Why

golden condor
#

Why are you doing that?

bronze linden
#

Heloo

golden condor
#

I don't understand

real nacelle
#

send me a website for vps.

#

pliz

solemn leaf
#

why bcs I have a object and I want to run a function that loads soemthing

bronze linden
#

Hello guys

golden condor
real nacelle
#

thanks!

bronze linden
#

Ai am from português

golden condor
solemn leaf
#

@golden condor

why bcs I have a object and I want to run a function that loads soemthing

earnest phoenix
#

When i try adding another into my buy command and do the buy command, nothing shows up and there's no error either

real nacelle
#

i cant buy vps lol.

bronze linden
#

Hello hermione

earnest phoenix
#

hi

bronze linden
#

Harry potter kkkkk

sonic lodge
#

@solemn leaf you can store individual functions in arrays and call them directly from the array

golden condor
#

@slender thistle

earnest phoenix
solemn leaf
#

@sonic lodge can I pull it fromt he array like the string?

real nacelle
#

I am going to do breakfast, boi boi!!

sonic lodge
#

wdym

solemn leaf
#

array.length

sonic lodge
#

yes?

slender thistle
#

@bronze linden Keep this channel related to development please. Also, non-English in #memes-and-media

sonic lodge
#

it's just an array of functions

earnest phoenix
#

When i try adding another into my buy command and do the buy command, nothing shows up and there's no error either
What has gone wrong in my code?

#

sorry i went away suddenly had skool

#

What has gone wrong in my code?
@earnest phoenix show the code

#

also are you experienced with javascript

solemn leaf
#

@sonic lodge str.then

earnest phoenix
#

discord bot development is very not recommended for beginners

#

I have learnt the basic

#

like?

sonic lodge
#

you are confusing me more

earnest phoenix
#

@solemn leaf dude

#

are you just

#

guessing

solemn leaf
#

no

earnest phoenix
#

you seem like

#

you're giving Hermione wrong info

golden condor
#

@earnest phoenix you need to await the .fetch

solemn leaf
#

figured

#

it out

sonic lodge
#

example

let func1 = () => Math.random();
let func2 = () => 10;
let arr = [func1, func2];
arr[0]();```
slender thistle
#

What the fuck is str.then

solemn leaf
#

thanks @sonic lodge

golden condor
#

await db.fetch(whatever is in here)

#

It is a promise

earnest phoenix
#

oh okay

golden condor
#

iirc

earnest phoenix
#

Bruh

golden condor
#

and is it .fetch or .get ?

earnest phoenix
#

@earnest phoenix i found the problem

#

?

golden condor
#

I haven't used quick.db in a while lol

earnest phoenix
#
if (author < 1200)
#

author is not the money

golden condor
#

Yes it is

earnest phoenix
#

tf

#

It works for the first item

golden condor
#

Look at the code

earnest phoenix
#

it just doesn't work for the second one

#

cuz

#

Your database is setup wrong

#

keys

#

quick.db strictly needs em

golden condor
#

You haven't defined amount

#

In the second one

earnest phoenix
#

no

golden condor
#

Yes

earnest phoenix
#

that's not the whole problem

#

this line of code:

#
let author = db.fetch(`money_${message.author.id}`);
bronze linden
golden condor
earnest phoenix
#

it is fetching everything

golden condor
#

They said that the first one works.

earnest phoenix
#

my bot got error and i dont know how to fixit please help

#

my bot got error and i dont know how to fixit please help
@earnest phoenix show code

solemn leaf
#

is there a limit for .addfeilds?

slender thistle
#

25 fields

#

per embed

rocky hearth
#

how can I fill a transparent image with white color instead of black, before sending it?

earnest phoenix
#

i send log

#

@earnest phoenix you need to learn javascript first before using quickdb

#

or developing bots

slender thistle
#

@bronze linden Please keep this channel on topic of development

earnest phoenix
#

my bot cant find file named custom.js

#

???

golden condor
#

@earnest phoenix I suggest that you use .get instead of .fetch and either way, you need to await it and also you just define amount in the second if statement

earnest phoenix
#

no

#

you don't need to await

golden condor
#

Code

#

You do

#

It's a promise

earnest phoenix
#

i never do

#

ok

#

and my bot works fine

#

wait

golden condor
#

Have they changed it then?

earnest phoenix
#

@earnest phoenix please show your code

#

okay

#

use grasshopper by google

#

it is how i learnt js

golden condor
#

Yes the problem will be because you didn't define it

earnest phoenix
#

go nuts

golden condor
#

Dude

rocky hearth
#

Please enable slowmode on this channel <@&304313580025544704>

earnest phoenix
#

then come back to bot development

#

const Files = require(require('path').join(__dirname, 'js', 'Main.js')).Files;

if(!process.send) {

Files.initStandalone();

} else {

process.on('message', function(content) {
Files.initBotTest(content);
});

}

#

here is the code

golden condor
#

Stop telling people to learn js

#

This person is fine

earnest phoenix
#

const Files = require(require('path').join(__dirname, 'js', 'Main.js')).Files;

if(!process.send) {

Files.initStandalone();

} else {

process.on('message', function(content) {
Files.initBotTest(content);
});

}
@earnest phoenix require inside require

bronze linden
#

Speack português brasil??? ?

golden condor
#

Dude

earnest phoenix
#

i making bot with dbm

golden condor
#

Can you stop giving wrong advice

earnest phoenix
golden condor
#

That works fine

earnest phoenix
#

Can you stop giving wrong advice
@golden condor what's wrong with telling someone to learn js

slender thistle
#

I told you several times to move away from this channel @bronze linden

golden condor
#

No just in general

earnest phoenix
#

ok...

golden condor
#

Also this person clearly knows some js to be able to write the code and have it work

slender thistle
#

You're not being helpful by saying "learn X". Point them at the right resources instead

earnest phoenix
#

yeah ik

golden condor
#

Exactly

earnest phoenix
#

alright

pale vessel
#

@slender thistle he sent an invite

#

probably shouldn't say it here

slender thistle
#

God have mercy on my soul

golden condor
#

I agree

pale vessel
#

bismillah

earnest phoenix
#

@earnest phoenix what's amount in your code

#

wait

#

I will show again

#

you're using the variable for both the price and the amount the user gets

#

so no matter whta you do everything is sold 1:1

#

ohhh

golden condor
#

No

earnest phoenix
#

yes it is

golden condor
#

Also try it now you've added in amount

earnest phoenix
#

she's subtracting amount from the user balance

golden condor
#

Yeah...

young flint
#

Am Harry potter

earnest phoenix
#

LOL

golden condor
#

You need to remove the price of the irem

#

Also

#

You should parseInt args[1]

young flint
#

Hlo Hermione where is Ron

thick gull
golden condor
#

ugh here we go

thick gull
#

get reaction

get corresponding json value
clear reactions
post to array
get new reaction
get corresponding json value
clear reactions
post to array
get messages
post to array
get new message
post to array

this is what i need to do

young flint
#

@earnest phoenix where is Ron

thick gull
#

but

#

i dont know what im

#

doing anymore

golden condor
#

What is the problem. With it

thick gull
#

okay so

golden condor
#

Just a tip

#

There is a message.awaitReactions function

#

Which can be easier than collectors

thick gull
#

mk

golden condor
#

It's a promise btw

earnest phoenix
golden condor
#

Is it still not working?

earnest phoenix
#

no

golden condor
#

You need to check if args[1] is a number

#

For starters

misty sigil
#

isNaN(args[1])

golden condor
#
let amount = parseInt(args[1])
if(isNaN(amount)) amount = 1
#

I just wrote that on my phone but I think that's right

earnest phoenix
#

Okay

#

It still doesn't work

golden condor
#

In both

#

Wait what casing are you using when you run it

#

can you add in a

} else return message.channel.send("Invalid Item")
earnest phoenix
#

okay

#

It says this: ReferenceError: amount2 is not defined But i have already defined it?

golden condor
#

You can just call it amount

earnest phoenix
#

okay

#

It works now. Thanks

golden condor
#

Np

earnest phoenix
#

Oh hmm when i try buying two items, it says invalid item?

earnest phoenix
#

?

cobalt spruce
#

hi

#

does any one here?

#

``` if (message.content.startsWith(${prefix}channel)){
if(!message.member.hasPermission(["MANAGE_CHANNELS"])) return message.channel.send("Sorry you dont permision to preform this command")
if(!args[0]) return message.channel.send('Please include a name for the channel after the command')
message.guild.channels.cache.create(args.slice(0).join(" "), {type: 'text'}), message.channel.send("Channel Successfully created")

 }```
#

i made this so i can make channels using bot

#

but when i do //channel

#

it give me error instead of "Please include a name for the channel after the command"

#

nvm

#

i forgot the let args

grand finch
#

ecma allows you to invoke things in any context you like

tight plinth
steady pilot
#

hi guys i was trying to host my bot on Heroku but it always crashed. When I start it through Visual Studio Code it runs just fine

earnest phoenix
#

Heroku suck for hosting

#

Atleast use repl.it, or buy a real vps

golden condor
#

Because you didn't put the token?

steady pilot
#

I did

#

I don't want to share it so i censored it

golden condor
#

What error does it give

cobalt spruce
#

@flat pelican

#

sorry for ping

#

but

#

when my bot get declined for "offline"