#development

1 messages · Page 839 of 1

fallow wigeon
#

Okay?

#

What for an Url

earnest phoenix
#

It's released @valid holly

#

url : ""

golden condor
#

How do I make the client go on mobile btw

fallow wigeon
#

Can I put there my yt link? @earnest phoenix

earnest phoenix
#

Nope

golden condor
#

You need a twitch link I think

earnest phoenix
#

Only twitch

fallow wigeon
#

Okay

#

Thx

earnest phoenix
#

Np

subtle yoke
#

Hi, I'm making a fast-food bot thing. I'm wondering how to get random characters for order ID's like. 1HssA

earnest phoenix
#

?

finite bough
#

@subtle yoke u can make an array of letters and words and then math floor randomize them

subtle yoke
#

hmm

earnest phoenix
#

@finite bough i don't think so he needs to randomize it

finite bough
#

why not

subtle yoke
#

um

earnest phoenix
#

Because it's order ID

finite bough
#

:/

earnest phoenix
#

ID for any order

subtle yoke
#

yes

earnest phoenix
#

Or i get it wrong

finite bough
#

random characters

#

he is not asking for 1 single order type

#

he means like

#

something like our discriminator

#

randomize

subtle yoke
#

if you know what discord fast food is if your order ID is like L23d

earnest phoenix
#

Then what

finite bough
#

@subtle yoke like

#

if someone said l123

subtle yoke
#

ye

finite bough
#

u will know its pizza?

earnest phoenix
#

Then it'll not randomize

finite bough
#

^

earnest phoenix
#

You need to specify it

finite bough
#

english gone poof

#

lul

subtle yoke
#

No like sombody says fcorder pizza

#

then the bot replies like

earnest phoenix
#

Random order id

subtle yoke
#

yeah

finite bough
#

u need a db for that

earnest phoenix
#

Then you can use random but check the id isn't already in db

finite bough
#

mhm

subtle yoke
#

OH

valid holly
#
var numberOrder = "1";
numberOrder.padStart(5, 0); // 00001
#

parse and iterate numberOrder to ++

subtle yoke
#

I guess that could work

earnest phoenix
#

You just judged which language he is using :)

subtle yoke
#

I'm using JS btw

earnest phoenix
#

Then math random

#

Or padstart

#

Your choice

subtle yoke
#

ok tysm

earnest phoenix
#

Np

golden condor
#

I don't know the issue here

#

(node:29345) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null
serverQueue.connection.dispatcher.end();

earnest phoenix
#

Code

#

end of null

#

So .. Show me the code

earnest phoenix
#

heya! im making a economy bot for that im making a register cmd, so im using json, i want to check if the user data is already in the json file

modest maple
#

easy -> dont use json

earnest phoenix
#

is a webhook

#
  let collection = mongo.db('sunucu').collection('ozelkomut')
  let komutt = await collection.find({id: message.guild.id})
  let komuttt = komutt.map( function(myDoc) { return myDoc } );```
How can I print these objects in mongodb?
golden condor
#

I can't use the client.user.setStatus function

#

It doesn't work

earnest phoenix
#

Discord.js version? @golden condor

golden condor
#

v12

earnest phoenix
#

Can you send the code?

golden condor
#

yes

#
client.on("ready", () => {
 //the rest of my ready event
  client.user.setStatus('dnd')
client.user.setActivity(`c!help | ${client.guilds.cache.size} servers | ${value.toLocaleString()} users`)

});```
earnest phoenix
#

Umm

#

Do you use playing or etc. ?

golden condor
#

Yes

earnest phoenix
#

I found an example

#
client.user.setPresence({ activity: { name: 'with discord.js' }, status: 'idle' })```
#

Can you try?

summer torrent
#

setActivity

golden condor
#

Will do chief

#

The activity worked

#

But not the status

earnest phoenix
#

Umm

golden condor
earnest phoenix
#

It didn't work for me either

quartz kindle
#

the status is weird af, it sometimes works and sometimes doesnt

#

blame discord

golden condor
#

I have tried everything

#

Ok

#

Thanks

#

would glitch have anything to do with it by any chnace?

earnest phoenix
#

I don't think so

golden condor
#

Because it works for other people

valid holly
#

Just updated to 12

#

My head hurts after updating the code

#
  client.user.setPresence({
    activity: {
      name: "support@iamdesu.com",
      type: "WATCHING"
    },
    status: "idle"
  })
#

Status works for me just fine

pale vessel
#

setStatus and setActivity works

#

@golden condor if you do it through command, it would 100% work

#

i bet it's the eval command

zenith terrace
#

@pale vessel wym through command

pale vessel
#

like .setstatus idle

zenith terrace
#

oh

golden condor
#

@pale vessel wdym?

pale vessel
#

make a command that does it for you

golden condor
#

Like

pale vessel
#

client.user.setStatus(args[0])

#

basically an owner command

golden condor
#

I am gonna make one

pale vessel
#

hopefully it works

golden condor
#

Like this?

#

const Discord = require('discord.js');
const config = require("../config.json")

module.exports.run = async (client, message, args) => {
//only I can use this command!
if (message.author.id != config.ownerid) return message.channel.send("You cannot use this!");
await message.channel.send("ok")
client.user.setPresence("dnd")
}

pale vessel
#

yes

golden condor
pale vessel
#

oof

golden condor
#

new Discord.Client({ fetchAllMembers: false, disableMentions: "all", presence: { status: 'dnd' }});

#

Trying this

wheat jolt
#

my bot can't login

#

is it from me?

pale vessel
#

you shouldn't make a new client

wheat jolt
#

my bot doesn't loginn

zenith terrace
#

Code? Error?

#

Cant see cant help

wheat jolt
#

no error

#

and the code isn't needed

#

I want to ask if it's just for me

#

or it's something with Discord

subtle yoke
#

I want a specific role what can run some commands what should I do?

wheat jolt
#

what lib

zenith terrace
wheat jolt
#

I want to read minds too

amber fractal
#

Don't have to if you look at their message history

wheat jolt
#

My bot should say "I'm up"

#

after it's ready

#

but it doesn't say that

#

and it gets online

zenith terrace
#

was it working before

wheat jolt
#

yes

zenith terrace
#

did you change anything

wheat jolt
#

i added some js files

#

commands

quartz kindle
#

then you did something wrong

zenith terrace
#

what new commands and js files

#

cause of them did something

wheat jolt
#

it was the token actually

earnest phoenix
#

Ok

#

bots cant have rich presence, jacob

restive furnace
#

but they can have mobile icon

#

i managed to get it so ye.

regal saddle
#

i need to watch the dbl api...

glad creek
#

anyone here know discordrb?

#

I used to use server_delete to know when the bot left a server, and it used to work, but now I suspect that Discord may have changed things so that "server was deleted" and "bot was kicked from server" events read differently?

zenith terrace
#

Check their docs

restive furnace
earnest phoenix
#

Anyone know how to fix UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji, I am using message.react('396548322053062656');

modest maple
#

you either need the unicode or the full emoji

#

e.g

#

\⭐

#

or

earnest phoenix
#

Oh thanks

#

I tried message.react('rem'); and got UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
emoji_id: Value "693092944537976913>" is not snowflake.

modest maple
#

did you do the entire ![weirdsip](https://cdn.discordapp.com/emojis/585884223441862656.webp?size=128 "weirdsip")

marble juniper
#

if you want you can try fetching the emoji

#
const emoji = client.emojis.get("id").toString()
plush quail
#

Is there any way of checking what channel a bot is active in?

marble juniper
#

do you mean voice or text channels

plush quail
#

text

marble juniper
#

well not really but you can check where the bot sent his last message

plush quail
#

I don't think that will work for what I'm trying to do, but I will look into it and see, thanks.

zenith terrace
#

@earnest phoenix what CF8 ^^

earnest phoenix
#

ohi found how to fix it

restive furnace
#

is this best way to do this, i think not, so i would want to know how else i would read all cmds at directories once, not multiple times, but here's my code: ```js
let categories = ["dev", "useful"];
for (let i = 0; i < categories.length; i++) {
fs.readdir("./cmds", (err, files) => {
for (let i = 0; i < files.length; i++) {
if (!files[i].endsWith(".js")) return;
let props = require("./cmds/"+ categories[i] + "/" + files[i]);
props.name = files[i].split(".")[0];
console.log(props.name);
}
})
}

#

(as you might see, doing cmd handler)

crimson vapor
#

I could be wrong but you are reading the directory 2 times

#

also you can try it and if it doesnt work you have your answer

late hill
#

That code doesn't do what you're attempting to do

#

The first for loop basically causes you to execute the thing twice and that's it's only purpose

#

You're overwriting the index variable in the next for

sick cloud
#

so in js you can do something like this for the right grammar: ${count} server${count > 1 ? 's' : ''}
does python have a sort of alternative to those inline statements

charred jetty
#

(node:551) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit

How to do it?

sick cloud
#

you've got an event in event @charred jetty, don't nest events

charred jetty
#

Lemme check then

restive furnace
#

(https://discordapp.com/channels/264445053596991498/272764566411149314/693107573955625001)
@crimson vapor yes you are right, so thats why i even did post it here, cause i want to read it only 1 time, so how i would do it with hierarchy like this

- cmds
    - dev
      - test.js
    - useful
      - echo.js```?
Discord

Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!

crimson vapor
#

ok so that command handler you have made so far

sick cloud
#

i can dig out how i do it

#

if you'd like

crimson vapor
#

wont do anyting except console logs

charred jetty
#

Couldn't find it

restive furnace
#

yes.

crimson vapor
#

why are you only logging them?

restive furnace
#

cause i was testing it out does it find the files.

sick cloud
#

my system is obviously suited for myself but it scans categories (so /commands/general/help.js would be loaded)

#

might give you a rough idea

restive furnace
#

but okay lemme edit it a bit.

#

this is different way reading 2 times?

crimson vapor
#

I never thought of just doing a readdirSync.forEach

#

it makes sense that it would work

sick cloud
#

mine reads the commands folder, then for each command folder reads the commands in them, then loads them

crimson vapor
#

but I never thought to do it like that

sick cloud
#

readdirSync works well

#

done it for a year plus now with no issues

#

scaled to 100+ commands easily

restive furnace
#

whats diffence of readdirsync and readdir?

late hill
#

You just have to fix your logic, so it matches his

sick cloud
#

no callbacks for one

#

all async goodness too

late hill
#

Read the commands dir, read each dir inside that, require each file in there

tight plinth
#

readdirSync team

crimson vapor
#

is there a function or library that allows for recursive searches of folders?

restive furnace
#

so readdirSync reads everything first, then returns them, and readdir returns immodely, am i right?

#

im used to for, so that i will keep, but ok ill try tonys way.

#

and tony, commando? cause this.client?

crimson vapor
#

He created his own command framework probably

#

commando is really annoying to work with and honestly you would need to change just about everything to make it pretty

zenith terrace
#

@sick cloud so basically a nested command handler since it reads folders in side of the command folder

sick cloud
#

i use my own custom client @restive furnace

restive furnace
#

okay

sick cloud
#

and @zenith terrace i guess so, the concept is simple though

restive furnace
#

you use class for commands? nice

#

i never used, i always used exports.

crimson vapor
#

after using both, class allows for a bit more functionality and exports is just easier to understand tbh

sick cloud
#
const Command = require('../../structures/Command');

module.exports = class Ping extends Command {
    constructor() {
        super({
            name: 'ping',
            description: `Pong!`,
            extraDocumentation: null,
            aliases: [],
            devOnly: false
        });
    }

    async run(client, ctx, args) {
        const m = await ctx.send(`Ping?`);
        return m.edit(`Pong! ${Math.round(client.ws.ping)}ms heartbeat, ${Math.round(m.createdTimestamp - ctx.msg.createdTimestamp)}ms roundtrip`);
    }
}

that's how my commands generally look

#

again fairly specific to my use

restive furnace
#

nice

crimson vapor
#
const { MessageEmbed } = require("discord.js");
const Command = require("../../src/Command");

class pingCommand extends Command {
  constructor() {
    super({
      name: "ping",
      memberName: "Ping",
      description: "Find out my ping",
      usage: "ping",

      silent: true,
      cooldown: 0
    });
  }
  async run(client, message, args, GuildData, time) {
    let lang;
    if (message.guild) lang = client.lang.get(message.guild.id);
    else lang = require(`../../languages/English`);

    let ping = client.ws.ping;
    let delay = Math.floor((Date.now() - time) * 100) / 100;

    let clientPingTime = Math.floor(ping * 100) / 100;

    let pingEmbed = new MessageEmbed()
      .setAuthor(client.user.tag, client.user.avatarURL())
      .setColor(0)
      .addField(lang.PING_PING, `\`\`\`${lang.PING_PING_NUMBER("?")}\`\`\``, true)
      .addField(lang.PING_CLIENT_PING, `\`\`\`${lang.PING_CLIENT_PING_NUMBER("?")}\`\`\``, true)
      .addField(lang.PING_COMMAND_DELAY, `\`\`\`${lang.PING_COMMAND_DELAY_NUMBER("?")}\`\`\``, true)
      .setTimestamp()
      .setFooter(`Ping`);

    let m = await message.channel.send(pingEmbed);
    let timeNow = Date.now();

    let pingTime = timeNow - m.createdTimestamp;
    let xpingEmbed = new MessageEmbed()
      .setAuthor(client.user.tag, client.user.avatarURL())
      .setColor(0)
      .addField(lang.PING_PING, `\`\`\`${lang.PING_PING_NUMBER(pingTime)}\`\`\``, true)
      .addField(lang.PING_CLIENT_PING, `\`\`\`${lang.PING_CLIENT_PING_NUMBER(clientPingTime)}\`\`\``, true)
      .addField(lang.PING_COMMAND_DELAY, `\`\`\`${lang.PING_COMMAND_DELAY_NUMBER(delay)}\`\`\``, true)
      .setTimestamp()
      .setFooter(`Ping`);
    m.edit(xpingEmbed);
  }
}
module.exports = pingCommand;``` mine is a bit longer tbh
restive furnace
#

okay... seems to

#

what ur silent btw does?

earnest phoenix
#

That's a lot of code just for the ping command

crimson vapor
#

delete message

restive furnace
#

oh ok

crimson vapor
#

its cuz its an embed

earnest phoenix
#

imagine having each command in a new file

crimson vapor
#

thats how most people do it

pale vessel
#

is that bad

earnest phoenix
#

That's how i do it too

sick cloud
#

embed builders are a pain

finite bough
#

^

sick cloud
#

its nicer to use the object

earnest phoenix
#

in .net we like to have modules which allow us to contain commands in one group, taking up a single file

#

@crimson vapor it's cuz you made it big embed

crimson vapor
#

no

#

it has 3 fields

sick cloud
#
ctx.send({ embed: {
  title: 'Hello',
  description: 'World'
} );

fair nicer imo

crimson vapor
#

ig

sick cloud
#

personal opinion at least

#

i know the api in and out so i prefer raw uses

#

flat out could go ditch discord.js and be fine

crimson vapor
#

then I assume I would have to just let xEmbed = { embed: {}}

pallid marsh
#

good ubuntu vps host any1?

earnest phoenix
#

Idk

crimson vapor
#

instead if doing console.log() is there another way to print to console?

pale vessel
#

you're not giving much to the discussion. if you don't know, just don't say anything

sick cloud
#

@crimson vapor there's loggers out there like winston

crimson vapor
#

ill look at winston

#

what do you use?

restive furnace
#

i use console.log with some modified things

finite bough
#

console/log is easier

restive furnace
#

and append to file same time

earnest phoenix
lament meteor
#

tbh... look into console.log, console.table and other loggin methods

#

so it looks neater

sick cloud
#

i use pino

sick cloud
#

@modest maple here, it's a zip because there's a couple files, hope that's ok

#

the code is mainly in main.py though

#

lemme grab a pic of the issue

#

it runs win() fine but seems to go on playing

#

i currently have sys.exit in that code to stop it so remove those and you'll see what i mean

modest maple
#

aight

#

it workes if you enter the correct letters completely without any misses

#

if you miss it then doesnt exit

sick cloud
#

yep

#

and i'm not too sure why that's happening

#

got any idea how that's being caused

restive furnace
#

trying to make event handler, now it just wont recieve events...```js
try {
for (const e of fs.readdirSync("./src/events")) {
if (!e.endsWith(".js")) return;
const event = require("./src/events/" + e);
const eventName = e.split(".")[0];

    logger.log("Loaded " + eventName);

    client.on(eventName, event.bind(null, client));
    delete require.cache[require.resolve(`./src/events/${e}`)];
}

} catch(err) {
logger.error(err.stack);
}```

snow urchin
#

How would I go about doing this?

var array = ["userid1", "userid2"]
array.join("<@ userid >")
// Output => <@userid1>, <@userid2>
modest maple
#

@sick cloud I have fucking no idea how you're recursivley calling yourself

restive furnace
#

array.join connects whole array, so if you do js let array = ["a", "b"]; array.join(","); // Output => a,bthat happens, but if you want to select userid1, then just use array.find or array.filter

sick cloud
#

me neither

#

it's making no sense tbh

#

might ends up just recoding how i handle everything

restive furnace
#

@snow urchin look my message, and if you want like that, just use array.join(", ")

slender thistle
#

They want to convert the IDs into mentions, no?

copper cradle
#

tony, recode that next_state def pls

modest maple
#

i mean the entire thing would work much better in a class

sick cloud
#

soon

modest maple
#

but meh

sick cloud
#

and yeah i know but its just a quick thing for school

#

the bug is driving me crazy

peak dirge
#

I am doing something weird now.. So I get this error that
ReferenceError: RichEmbed is not defined

Even though it is defined in my index.js as const { Client, Collection, RichEmbed } = require("discord.js");

Is there a reason why it can not read the RichEmbed from index.js to random.js ... everything else works except the RichEmbed O_o

Here is the random.js

const embed = new RichEmbed()
            .setColor(0x2C2F33)
            .setDescription(`:underage: This is not nsfw channel`)
            messge.channel.send(embed)
sick cloud
#

discord.js no longer has richembeds

#

use MessageEmbed

zenith terrace
#

depends on his version

sick cloud
#

v12 obviously

#

since its undefined

peak dirge
#

yeah its v12

zenith terrace
#

Ok

peak dirge
#

I recently updated to it xd

zenith terrace
#

Then ye its MessageEmbed

crimson vapor
#

change richEmbed to MessageEmbed

copper cradle
#

or define rich embed as messageembed so you don't have to rewrite your bot

wintry jungle
peak dirge
#

I am rewriting it anyways to fix some stupid mistakes I made on it :(

I still get the same error even with the MessagEmbed waitWhat dammit

wintry jungle
#

@peak dirge They changed basically every module and voice dependency

#

So have fun like re-writing your entire bot

marble juniper
#

most things like guild size is only avaible through the cache property

#

but it does allow some new features like dinamic image url options or custom sizes

#

so its not completely the same

sick cloud
#

big improvement imo

#

i've been using v12 for ages though

#

been ready for it

heavy anchor
#

With bulkDelete why can’t I delete messages older than 14 days? Is there anyway to change that?

zenith terrace
#

I would just do it as

const discord = require ('discord.js');

const embed = new discord.MessageEmbed()```

Its a *little* bit more coding but I find it more easier to do
marble juniper
#

if you use vs code you can also replace RichEmbed with MessageEmbed in all files

#

idk about other code editors but that would be a fast option

sick cloud
#

@zenith terrace in such case you're importing all of discord.js

#

@heavy anchor discord api limitation, no you can't change it

heavy anchor
#

I’m using a bot that can delete Messages older then 14 days

#

is there another way to do it?

sick cloud
#

without hacky abusive methods no

heavy anchor
#

That sucks

crimson vapor
#

if you bulk delete them older than 14 days, it would be abi abuse

#

I think

marble juniper
#

I suppose its just to prevent you from bulk deleting every single message in the channel

#

as that would be api spam yes

heavy anchor
#

That makes sense

marble juniper
#

but im just assuming

heavy anchor
#

Thanks for ur help guys

copper cradle
#

np, when u need something just ask!

heavy anchor
#

Ok thx

fervent tiger
#

i need help making a bot i dont no what to do its saying iinvalid server format

mossy vine
#

have you coded your bot yet

fervent tiger
#

how

#

i donno

mossy vine
#

ok then close the website

#

specifically the part about making a bot

twilit rapids
#

-faq 3

gilded plankBOT
vernal basin
#

I have a question, so if a certain parameter of a command that I have is a Ping of a user, for example

!command @vernal basin ,

my code stores the ping in membername.

When I check membername.roles, it says it's undefined. Do I have to manipulate membername somehow because it doesn't have the private field roles?

(discord.js)

#

Is a ping stored differently than a normal ID?

twilit rapids
#

What version of djs are you using

vernal basin
#

how do I find that?

mossy vine
#

in your package.json

twilit rapids
#

require("discord.js").version

mossy vine
#

or that

fervent tiger
#

im still confused can i screan record with someone to show them

vernal basin
#

oh i just have this const Discord = require("discord.js");

fervent tiger
#

?

twilit rapids
#

Do you have an eval command?

vernal basin
#

?

fervent tiger
#

?

mossy vine
#

@fervent tiger how old are you Thonk

twilit rapids
#

Eh, just check your package.json then

vernal basin
#

okay

#

just a sec

fervent tiger
#

@mossy vine not answering

mossy vine
#

ok

#

anyways

finite bough
#

BRUH

vernal basin
#

oh interesting
version": "",

vernal basin
#

my version is empty

finite bough
#

a

vernal basin
#

is having an empty version an issue?

twilit rapids
#

not really

fervent tiger
#

im just asking how do i get the thing to stop saying invalid server format

mossy vine
#

you said you havent coded your bot yet

vernal basin
#

erm im sure there are plenty of guides out there

#

and yeah you would want to have text in the code first

fervent tiger
#

i dont no how to do them stuff thats y im asking for help

vernal basin
#

there are lots of basic guides on how to boot up a simple bot

mossy vine
fervent tiger
#

?

vernal basin
#
    {
        console.log(`claim activated channel:${message.channel}`);
        const membername = args[0];
        const teamrole = args[1];
        if (membername.roles.has("693129872129917029"))
        {
            client.channels.get("692947490470625360").send({embed: {
                color: BLUE,
                description: `${user} wants you on their team! \n Tag: ${teamrole}`
            }})
            client.channels.get("692947490470625360").send(`${membername}`)
            return;
        }
        message.channel.send({embed: {
            color: RED,
            description: `${user} isn't looking for a team.`
        }});
        return;
    }

so this is my code so far, RED & BLUE are constant integers, and the code crashes here membername.roles.has("693129872129917029")

fervent tiger
#

i dont no how to code tho

twilit rapids
#

what did you input as args[0]

vernal basin
#

i assume it looks something like this: @slim hill

#

the command is intended to be !claim @role @role

#

wait !claim @earnest phoenix @role

#

wait shoot that pinged someone sorry 😦

twilit rapids
#

You have to get the member object from the ID first

#

You can't call .roles on just the ID

vernal basin
#

oh wait

#

im dumb

#

okay thank you

twilit rapids
#

Alright yw

fervent tiger
#

how do i code the bot??

vernal basin
#

...

twilit rapids
#

-faq 3

gilded plankBOT
twilit rapids
#

@fervent tiger read that ^

#

Click the link

fervent tiger
#

i dont no how to code or program tho

twilit rapids
#

Then learn that first

vernal basin
#

that might be an issue just saying

twilit rapids
#

You can't code a bot without any knowledge about coding

vernal basin
#

this is not scratch :thonk:

summer torrent
#

@vernal basin ```js
const membername = message.mentions.members.first()

vernal basin
#

okay ty

twilit rapids
vernal basin
#

:thonk:

#

reading documentation is hard

twilit rapids
#

Spoonfeeding is bad

vernal basin
#

ugh js is so deceptively close to java but its actually not in so many places notlikenoot

sudden geyser
#

only its name will fool people

vernal basin
#

wait so message is the text, mentions is the attribute that I assume returns some List of <@numbers>, and members is the attribute that is the glob of numbers, and first returns the first of the list?

#

also out of curiosity why does .first() exist Thonk doesn't .get(0) work or something

twilit rapids
#

message - Message Object
.mentions - (object iirc) of stuff that is mentioned in this message (e.g. channels, roles, members)
.members - (collection iirc) of Member Objects that are mentioned in this message
.first() - first of the Member Objects

#

So message.mentions.members.first() returns the Member object of the first mention member in that message

#

if that makes any sense

vernal basin
#

okay ty

#

wouldn't it suffice to then just do message.members.first()?

#

or is this just a JS thing

twilit rapids
#

message.members isn't a thing

mossy vine
#

if mentions is an array why tf does it have .members

twilit rapids
#

iirc

tight plinth
restive furnace
#

y

#

es

tight plinth
#

k

slate oyster
restive furnace
#

maven?

slate oyster
#

Gradle

#

Probably a new version

#

Lemme check what it is named

tight plinth
#

discord4j

#

java?

slate oyster
#

Yea

finite bough
#

java and js are different

#

and how to fletch changes form audit logs

#

:notlikenoot

slate oyster
#

We know JS and Java are different
But nobody brought up JS

#

So I don't know what point you were trying to make

vernal basin
#

would doing:

Channel c = new Channel({{
  "id": "channelID"
  "guild_id": "guildID",
  "name": "channelName",
  "type": 0,
  "permission_overwrites": [],
  "topic": "topic",
  "parent_id": "categoryID"
})

successfully create a new channel under the category with categoryID as an ID?

finite bough
#

u cant allot channel an id

vernal basin
#

or did I just terribly misread the docs

restive furnace
#

guild#createChannel("name", idk look docs)

#

find guild#createChannel on docs

pale vessel
#
slate oyster
#

I dunno what was up with my dependencies
It was 404 for a second
But the dependency is working again

restive furnace
#

prob some network error/outage on site

copper cradle
#

guys are you blind

#

that's fucking java

#

not fucking javascript

#

don't you see Channel c = ...

#

That channel is the datatype

#

@vernal basin you obviously misread the docs, just scan through them again and try to understan that constructor

#

I've never used it so idk

#

what lib r u using?

#

jda?

copper cradle
#

wait

#

then why are they using java syntax

#

what the fuck were they even trying to accomplish

copper cradle
#

they sent this

#

would doing:

Channel c = new Channel({{
"id": "channelID"
"guild_id": "guildID",
"name": "channelName",
"type": 0,
"permission_overwrites": [],
"topic": "topic",
"parent_id": "categoryID"
})

successfully create a new channel under the category with categoryID as an ID?

pale vessel
#

ok?

tight plinth
#

I want to make ram usage with my bot, but google is gay and dont work(can't find anything)

copper cradle
#

not my fault they're trying to use java syntax lul on js

zenith terrace
#

Ping wont work

#

@tight plinth

tight plinth
#

dnd lol

#

Yep

pale vessel
#

so os-utils = bae

slate oyster
#

Ug

vernal basin
#

when using createOverwrite, what does one put to overwrite the everyone permissions

pale vessel
#

guild id?

slate oyster
#

The guild's id and the id of the everyone role are the same

pale vessel
#

ye

slate oyster
#

Also Ninja'd

vernal basin
#

oh okay thanks

slate oyster
#

I have to deal with Reactor, disk, and logic
Shouldn't take too long, but not fun

vernal basin
#

message.channel.awaitMessages(message => message.content.startsWith('!confirm'), {time: 120000, errors:["time"]}) should default to the .catch block after 2 minutes right?

slate oyster
#

I gotta write this big ugly system
I have to access some data about a message, check whether it is Message 1 or Message 2 from a group, if it is Message 1 and Message 2 does not exist, I must create Message 2 and save some data, otherwise (if the message is Message 2) I have to figure out which message is Message 1, I then have to set some AtomicReferences to the messages id's. I have to go into Message 1's data and do some processing with that, and then go into Message 2's data and do some processing with that, and then I have to edit Message 2.
Uk

#

Yuck

vernal basin
#
teamname = args[0];
        hexcolor = args[1];
        if (message.member.roles.has("692955330283569203"))
        {
            message.channel.send({embed:{
                color: RED,
                description: `You already have a team!`
            }})
            return;
        }
        message.channel.send({embed:{
            color: BLUE,
            description: `**Are you sure?** This action is irreversible. Type !confirm if you really want to create a team.`
        }})
        var roleid;
        message.channel.awaitMessages(message => message.content.startsWith('!confirm'), {max:1})
        .then(
            message.guild.createRole(`[TEAM] ${teamname}`).then(role => {
                role.setColor(hexcolor);
                roleid = role.id;
            })
        )
        .then(
            message.guild.createChannel(`[TEAM] ${teamname}`).then(channel => {
                channel.setTopic(`${teamname}'s Team Channel`);
                channel.createOverwrite(guild,{
                    READ_MESSAGES: false
                })
                channel.createOverwrite(guild.roles.get(roleid), {
                    READ_MESSAGES: true,
                });
            })
        )
        .catch(message.channel.send({embed:{
            color: RED,
            description: `Command cancelled.`
        }}))

Okay nevermind about the timing stuff. Here is the code that I've made so far, and when I run !createteam test, I believe it creates a blank new role and that's it.

#

So I'm pretty sure the first part works, but my awaitMessages then/catch block is a bit sketch

pale vessel
#

would you mind adding syntax highlighting?

vernal basin
#

uh ok just a sec

#

done

pale vessel
#

v11?

vernal basin
#

uh i don't have a version

pale vessel
#

discord.js version, sorry

vernal basin
#

i checked my package and it doesn't have any version

pale vessel
#

console.log(require("discord.js").version)

#

try that

vernal basin
#

where do I put that?

pale vessel
#

anywhere

vernal basin
#

ok

pale vessel
#

on ready event

vernal basin
#

wait nevermind, it doesn't even create a new role at all. it just gets stuck at the point where it asks for the !confirm

#

@pale vessel 11.3.2

pale vessel
#

that's old

vernal basin
#

oh

#

uh oh

pale vessel
#

upgrade to 11.6.3 at least

#

if you don't mind upgrading to v12, then upgrade to 12.0.2

vernal basin
#

are there any significant changes?

pale vessel
#

v12, yes

#

v11 latest, no

vernal basin
#

okay ill just do 11.6.3 then

pale vessel
#

all right

low bolt
#

hey flazepe

pale vessel
#

heya

low bolt
#

can you help for sharding?

pale vessel
#

wait

low bolt
#
const bot = new Discord.Client()
const moment = require("moment");
const scarew = new Discord.ShardingManager('./server.js', {
    totalShards: 'auto',
    token: 'TOKEN'
});

scarew.spawn(); 

scarew.on('launch', shard => {
  console.log(`${moment().format("HH:mm:ss YYYY/MM/DD")} | #${shard.id} started.`)
});```
pale vessel
slate oyster
#

Literally that's all

#

I switched from Non-Sharding to Sharding with minimal changes

low bolt
#

@pale vessel thanks, I'm trying. I will say result.

#

Oh my God.

#

Thanks, works now!

#

@slate oyster where can I find this library?

slate oyster
#

It's a different language though

west raptor
#

looks like scala so uh

slate oyster
#

No. Not Scala.

west raptor
#

:thonk:

slate oyster
#

But it is a different language than theres

low bolt
#

oh k

west raptor
#

some .NET language then?

#

idk what else it could be

low bolt
#

this vs normal sharding?

vernal basin
#

@pale vessel once I've updated, what do I do?

low bolt
#

or it's same 🤔

west raptor
#

@slate oyster java doesnt use -> does it?

heavy anchor
#

Any recommendations on command handler tutorials?

west raptor
#

what language

heavy anchor
#

Js

west raptor
low bolt
#

@west raptor

west raptor
#

?

low bolt
#

when I use sharding, commands not works.

#

But when I open bot normal, commands works

west raptor
#

have you tried troubleshooting at all?

low bolt
#

Nothings works ye

late hill
#

you can use -> in java

#

for lambda expressions

slate oyster
#

@west raptor It uses it

restive furnace
#

its -> or => all languages

#

everyos, almost all java libs has ez sharding

west raptor
#

huh weird

#

never knew java use ->

late hill
#

well, since java 8

#

new but not really

slate oyster
#

Does D.js just have stupid sharding or something?
Why does everyone need help in js?

restive furnace
#

i dont know

#

but its almost ez as jda or in didcord4j

#

prob cause java has experienced coders and js newcomers

#

im not taliing that all are

late hill
#

I'd say it's mainly that yes^^

restive furnace
#

just. mostnof them

slate oyster
#

Probably

restive furnace
#

oof keyboard

quartz kindle
#

because all stupid people use js

late hill
#

The majority of new people won't pick a language like java

restive furnace
#

yes

#

some easy languages and easiest are python and js

timber prawn
#

Could somebody make me a bot

quartz kindle
#

for free? nope

vernal basin
#

its already hard enough to make one for ourselves Thonk

west raptor
timber prawn
#

not free @quartz kindle

restive furnace
#

@west raptor so python too

late hill
#

From what I saw in my courses, a lot of people struggle with just getting a simple java program to run megu

timber prawn
quartz kindle
#

what even is that

timber prawn
#

.

#

nvm

#

I will make it

quartz kindle
#

good luck!

restive furnace
#

its easiest for noexperienced coders

#

or uby

#

ruby

#

discordrb

vernal basin
#
    else if (command == "createteam")
    {
        console.log(">>> CREATETEAM");
        teamname = args[0];
        hexcolor = args[1];
        if (message.member.roles.has("692955330283569203"))
        {
            message.channel.send({embed:{
                color: RED,
                description: `You already have a team!`
            }})
            return;
        }
        message.channel.send({embed:{
            color: BLUE,
            description: `**Are you sure?** This action is irreversible. Type !confirm if you really want to create a team.`
        }})
        var roleid;
        message.channel.awaitMessages(message => message.content.startsWith('!confirm'), {max:1})
        .then(
            guild.createRole(`[TEAM] ${teamname}`).then(role => {
                role.setColor(hexcolor);
                roleid = role.id;
            })
        )
        .then(
            guild.createChannel(`[TEAM] ${teamname}`).then(channel => {
                channel.setTopic(`${teamname}'s Team Channel`);
                channel.createOverwrite(guild,{
                    READ_MESSAGES: false
                })
                channel.createOverwrite(guild.roles.get(roleid), {
                    READ_MESSAGES: true,
                });
            })
        )
        .catch(message.channel.send({embed:{
            color: RED,
            description: `Command cancelled.`
        }}))

so the goal is, once the user does !createteam test, it should ask for confirmation (!confirm) and if there is confirmation, create a role named [TEAM] test and a channel called [TEAM] test that only the test role can access. The denial works fine, if I have the role it will just return the rejection message, however if I don't, the bot will just stop working.

#

version is 11.6.3

#

node.js

#

discord.js*

summer torrent
#

how can I connect to my server with private key via vscode? I am using private key for connect with putty/filezilla

restive furnace
#

prob some extension?

#

with*

quartz kindle
#

does vsc support sftp out of the box?

west raptor
#

uhh iirc no

#

might be wrong though

summer torrent
#

prob some extension?
@restive furnace yes ik. I am asking for how to add private key to that extension

restive furnace
#

copied straight there: ```
Install VS Code or VS Code Insiders and this extension pack. On Windows, be sure to check Add to PATH when asked to Select Additional Tasks during installation.

Remote - SSH: Install an OpenSSH compatible SSH client.

Remote - WSL: Install the Windows Subsystem for Linuxalong with your preferred Linux distribution. (Note that WSL2 support is experimental.)

Remote - Containers: Install and configure Docker for your operating system.

Windows / macOS:

Install Docker Desktop 2.0+ for Mac/Windows. (Docker Toolbox is not supported, but Docker does not need to be running if you use a remote host.)

Right-click on the Docker task bar item and update Settings / Preferences > Shared Drives / File Sharingwith any source code locations you want to open in a container. See tips and tricks for details.

Linux:

Follow the official install instructions for Docker CE/EE 18.06+. If you use Docker Compose, follow the Docker Compose 1.21+ install directions.

Add your user to the docker group by using a terminal to run: sudo usermod -aG docker $USER Sign out and back in again so this setting takes effect

#

and @tight plinth has done so on vsc

#

ask him

tight plinth
#

yes?

#

sec, afk for some minutes

quartz kindle
summer torrent
#

ty tim

low bolt
#
    client.ws.connection.triggerReady()
},30000)```
not works.
fallen shadow
#

when is sharding recommended?

summer torrent
vernal basin
#

in the Role constructor, the docmentation says this: new Discord.Role(client, data, guild);. How do I set both the color and the name in this?

west raptor
#

I saw 1,500-2,000 is safe

#

you want to do it sometime in that range

low bolt
#

My bot have 1.080 servers

west raptor
#

that's fine too ig

low bolt
#

But i'm getting error

west raptor
vernal basin
#

ty

west raptor
slate oyster
#

Back to my computer
Guess I'll go back to writing that ugly, yucky system

vernal basin
#

@west raptor sorry for the ping, but

guild.roles.create({
                    data: {
                        name: teamname,
                        color: hexcolor
                    }
                })
                guild.channels.create(`[TEAM] ${teamname}`, {
                    type: 'text',
                    permissionOverwrites: [
                    ]
                })

after making the role, if I want to create a permissionOverwrite, how could I use the role I've just created?

west raptor
#

store that into a variable since Roles#create returns the role

vernal basin
#

oh right, im dumb, ty

stable nimbus
#

Could use a little help with my bot. I am trying to make a type of /me command, but I can't get it to work the way I am after sadly, what I want it to do is delete the above message, and repeat the text with the users display name and what they did, an example of what I want it to do is something like this:

//me Yeets Can
Bot Return:
Cody D. C-741: Yeets Can

vernal basin
#

what is your code so far?

stable nimbus
#

client.on('message', message => {
if(message.content.startsWith(${prefix}/me)) {
message.delete()
message.channel.send((message.author.displayName) + ": " + (message.content.replace('/me ','')));
}
})

vernal basin
#

have you tried using the ` symbols

#

instead of double quotes, sometimes that's helped me

barren swallow
#

client.on('message', message => {
if(message.content.startsWith(${prefix}/me)) {
message.delete()
message.channel.send((message.author.displayName) + ": " + (message.content.replace('/me ','')));
}
})```
stable nimbus
#

Thats what I have so far, have to do double slash because one slash is a discord command, wont work with my bot.

pale vessel
#

what is the problem?

stable nimbus
earnest phoenix
#

of course it will work, cody

#

you aren't filtering out your messages

#

filter out bots and dms

stable nimbus
#

I want it to do the following text with the command.

earnest phoenix
#

also titan, don't spoonfeed code

barren swallow
stable nimbus
#

Like if the command is this:
//me Yeets Can

I want the bot to respond with this:
Cody D. C-741: Yeets Can

pale vessel
#

displayName is a guildmember property

earnest phoenix
#

you got told how

pale vessel
#

you need message#member for that

vernal basin
#
const myrole = message.guild.createRole({
                    data: {
                        name: `${teamname}`,
                        color: `${hexcolor}`
                    }
                })
                const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
                    type: 'text',
                    permissionOverwrites: [{
                        id: `${myrole}`,
                        allow: ['VIEW_CHANNEL']
                    },{
                        id: `${message.guild.id}`,
                        deny: ['VIEW_CHANNEL']
                    }
                    ]
                })

for some reason, this creates a blank new role in the role list and nothing else, no channels, nothing.

discord.js, 11.6.3

stable nimbus
#

I tried that website it no longer makes sense to me.

earnest phoenix
#

do you have any prior coding experience

barren swallow
#

@stable nimbus ^

pale vessel
#

i'm guessing no

stable nimbus
#

I'll ask later because none of you guys are making sense.

vernal basin
#

I-

pale vessel
#

displayName is a guildmember property
@pale vessel

unique nimbus
#

@stable nimbus Have you programmed before

earnest phoenix
#

if not, then you shouldn't faceplant into making a discord bot - but rather starting out with language basics; if you don't want to learn, ask someone to make it for your instead

unique nimbus
#

Discord Bots shouldn't be your first project

vernal basin
#

so the discord.js docs are all v12 right

pale vessel
#

not all

earnest phoenix
#

you can select a version which you want to browse

vernal basin
#

okay

#
const myrole = message.guild.createRole({
                    data: {
                        name: `${teamname}`,
                        color: `${hexcolor}`
                    }
                })
                const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
                    type: 'text',
                    permissionOverwrites: [{
                        id: `${myrole}`,
                        allow: ['VIEW_CHANNEL']
                    },{
                        id: `${message.guild.id}`,
                        deny: ['VIEW_CHANNEL']
                    }
                    ]
                })

this is 11.6.3 right?

barren swallow
#

Ye

vernal basin
#

because for some reason it's not reading in the color or the name

#

its just creating a blank role named new role

#

no colors either

#

teamname and hexcolor are predefined constants btw

barren swallow
#

message.guild.roles.create is v12

vernal basin
#

okay i think im on 11.6.3 so im not sure why this isn't working

pale vessel
vernal basin
#

er that's what I looked at

#

I think everything matches up

pale vessel
#

there's no such thing as data: in v11

vernal basin
#

wait

#

oh

#

huh

pale vessel
#

do you understand?

vernal basin
#

oh oops

#

i thought i was on the 11.6.3 docs lmao

#

okay so the role works now

#

but its stlil not making the channel

#

I'm fairly certain I adhered to the 11.6.3 docs this time

#
 const myrole = message.guild.createRole({
                    name: `${teamname}`,
                    color: `${hexcolor}`
                })
                const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
                    type: 'text',
                    permissionOverwrites: [{
                        id: myrole.id,
                        allow: ['VIEW_CHANNEL']
                    },{
                        id: message.guild.id,
                        deny: ['VIEW_CHANNEL']
                    }
                    ]
                })
summer torrent
pale vessel
#

nice

vernal basin
tight plinth
#

Version 12.1.0 has been released!

This release fixes an issue in the RequestHandler concerning the global ratelimit, several typings fixes and additions of AllowedMentions to control which types of mentions your bot is allowed to do (@everyone, @here, roles etc.) and GuildPreviews.

The full (read as: same) changelog is available on GitHub: https://github.com/discordjs/discord.js/releases/tag/12.1.0

pale vessel
#

wow thank you

#

didn't click that link at all

quartz kindle
#

god bless

#

now i need to update my lib

tight plinth
#

Oof

vernal basin
#
 const myrole = message.guild.createRole({
                    name: `${teamname}`,
                    color: `${hexcolor}`
                })
                const newchannel = message.guild.createChannel(`TEAM-${teamname}`, {
                    type: 'text',
                    permissionOverwrites: [{
                        id: myrole.id,
                        allow: ['VIEW_CHANNEL']
                    },{
                        id: message.guild.id,
                        deny: ['VIEW_CHANNEL']
                    }
                    ]
                })

so the role works now but not the channel creation and I'm very confuzzled

summer torrent
#

v13 when 👀

quartz kindle
#

in 5 years

pale vessel
#

have you tried reading tocs

tight plinth
#

Never

zenith terrace
#

tocs

pale vessel
#

yes

vernal basin
#

yes i have read the docs :thonk:

#

I don't see any discrepancies between my code and the docs

pale vessel
#

what happens if I see one?

quartz kindle
#

@vernal basin those are promises, you need to await them

vernal basin
#

wut

pale vessel
#

oh no

steel orbit
pale vessel
#

how do you have green role?

quartz kindle
#

createRole() returns a promise

steel orbit
#

can help me?

vernal basin
#

yea

zenith terrace
#

isnt it .guilds

#

and changed from .find to .get ?

vernal basin
#

oh i need to get the role out of the promise for myId right

steel orbit
#

oh i understand

quartz kindle
#

yes, either await the createRole or use .then()

vernal basin
#

oh okay

zenith terrace
#

Tim tim, am I correct or wrong

pale vessel
#

he's getting the guild from the member

#

not guilds

quartz kindle
#

@steel orbit what version is your discord.js?

zenith terrace
#

O

#

Yes

#

I didnt read the whole code

#

I need to do that more

#

xD

steel orbit
#

@quartz kindle 12

quartz kindle
#

in v12 its channels**.cache**.find()

#

check the new v12 guide

steel orbit
#

okey thanks

stuck aspen
pale vessel
#

you didn't even send the full error

tight plinth
#

It doesn't exist

#

@stuck aspen

#

No

pale vessel
#

oh

#

size

tight plinth
#

Here, client is a bot returned by dbl.getBot

quartz kindle
#

oh ^

#

lul

zenith terrace
#

Lol flaz

pale vessel
#

I need to read more too oof

zenith terrace
#

I thought I was bad 😂

tight plinth
#

So it's normal that it doesn't exist

quartz kindle
#

guilds exists tho

pale vessel
#

but not like the actual guilds

zenith terrace
#

I still havent completed that college work I talked about earlier

quartz kindle
#

its the guilds featured on the bot's page

#

max 3 guilds

pale vessel
#

yes

#

if empty, it would be [] right

quartz kindle
#

yeah i guess

pale vessel
#

so .length

quartz kindle
#

in any case it shouldnt be the cause of the error

#

he needs to show the full error

pale vessel
#

maybe he should try debugging client

earnest phoenix
#

How Do I Do When Somone Vote My Bot The Bot Give Credits

#

Have You Tried Reading The Docs

slender thistle
#

HYTRTD

plush quail
#

Is there any way of detecting when a user enters (not joins) a text channel?

sudden geyser
#

I don't think so

slender thistle
#

No

#

Unless you mean "gets access to a text channel" instead of "opens a text channel"

plush quail
#

no, I'm trying to write a bot that will display messages randomly when a user is actually viewing the channel as I don't want it constantly doing it

pale vessel
#

that's not possible

vague chasm
#

you can check if the user is typing..., that would be better ig @plush quail

pale vessel
#

not an event is it?

vague chasm
#

it is..

pale vessel
#

hmm

vague chasm
#

i have that event disabled in client object cuz it uses more resources when it sees people typing in every active guild

pale vessel
#

i see it

#

typingStart in djs

vague chasm
#

ye

plush quail
#

alright, I might have to do that then, unless I can figure out something else, thanks

vague chasm
#

np

slate oyster
#

My unicode is being encoded as "?" marks
I'ma have to set file encoding until I can find a json-like database with nested collections.

#

Or I can always use MongoDB and emulate nested collections
But not a fan

astral yoke
#

alright i know im retarded but can someone sorta give me the link on where to install this and the link to install it

#
Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\Cools\dog1bot\node_modules\websocket\build\validation.vcx 
proj]```
slate oyster
#

You need VS if I'm correct

wet iron
#

can someone help me?

quartz kindle
#

try installing windows build tools

wet iron
#

i dont know how to make a embed in Discord.js?

astral yoke
#

link? @quartz kindle

wet iron
#
  .setAuthor(message.author.tag)
  .setColor("#FFFC00")
  .addField("Question", question)
  .addField("Answer", responses[randomIndex]);```
pale vessel
#

have you tried reading the docs?

#

MessageEmbed() on v12 and RichEmbed() on v11

astral yoke
#

@wet iron at the top of your code put const { RichEmbed } = require("discord.js"); if you have it installed

wet iron
#

it says that discord rich embed is not a constructor

quartz kindle
#

@astral yoke npm install --global windows-build-tools

sudden geyser
#

Discord.Embed is not even a thing

zenith terrace
#

How are you a bot dev then

#

<.<

pale vessel
#

have you tried reading the docs?

zenith terrace
#

Just saying

pale vessel
#

then { MessageEmbed }

wet iron
#

ok

zenith terrace
#

I forgot there are other languages that make embeds differently

#

Oops

wet iron
#

then { MessageEmbed }
@pale vessel Thanks it worked!

pale vessel
#

i don't have an advice but tim might do

#

actually, read the docs https://discord.js.org

finite bough
#

@zenith terrace I have seen people with bot dev who doesnt even know how to send a msg

zenith terrace
#

below qt? 🧐

finite bough
#

there should be test

#

to check if u r eligible to get bot dev role

zenith terrace
#

Nah

#

That would be too much

finite bough
#

coz

#

we help people after looking at their role

#

example

#

if someone asks how to check if a message has been deleted

quartz kindle
#

i mean, all you need is to have a bot on the website. you can do that with discord bot maker

finite bough
#

^

#

or

#

use the 3 holy buttons

#

ctrl c

#

ctrl v

zenith terrace
#

But then it would be funny if the code didnt work for people

regal saddle
#

@wet iron at the top of your code put const { RichEmbed } = require("discord.js"); if you have it installed
If you installed v12 just use const Discord = require(„discord.js“)

#

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

wet iron
#

it worke

#

worked*

#

im making a bot for my firend

#

she loves to call herself blyatman

regal saddle
#

V12 or below?

wet iron
#

and idk how to set prefix to blyat for the commands not to overlap

#

bc if i type in blyat ping

#

it will activate 8ball command at the same time

#

does anyone know how to fix that?

regal saddle
wet iron
#

y not?

regal saddle
#

Why can you activate 8ball with bylat ping?

wet iron
#

idk

regal saddle
#

some me the 8ball code

wet iron
#
  name:'8ball',
  description:'8ball',
  execute(message, args) {
    const Discord = require('discord.js');

    const responses = [
        "It is certain",
        "It is decidedly so",
        "Without a doubt",
        "Yes – definitely",
        "You may rely on it",
        "As I see it",
        "yes",
        "Most Likely",
        "Outlook good",
        "Yes",
        "Signs point to yes"
    ];

  let question = args.slice(0).join(" ");
    const randomIndex = Math.floor(Math.random() * responses.length);

  const { MessageEmbed } = require("discord.js");

  let ballembed = new Discord.MessageEmbed()
  .setAuthor(message.author.tag)
  .setColor("#FFFC00")
  .addField("Question", question)
  .addField("Answer", responses[randomIndex]);

  message.channel.send(ballembed);
  }
}
#

this is the index.js file

const bot = new Discord.Client({commandPrefix: 'blyat '});
const token = "NjkyNDgwMTg1MzM2OTg3NzE5.Xn5LAQ.JRlsWQhTBwvulOMqgC8p0BIDcSg";

const fs = require('fs');
bot.commands = new Discord.Collection();

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

    bot.commands.set(command.name, command);
}

bot.on('ready', () => {
    console.log("The bot is active and ready to go!");
});

bot.on('message', message => {
    let args = message.content.substring(commandPrefix.length).split(" ");

    switch (args[0]) {

        case "ping":
            bot.commands.get('ping').execute(message, args);

        case "8ball":
            bot.commands.get('8ball').execute(message, args);

        break;
    }

});

bot.login(token);
regal saddle
#

regenerate your bot token

#

You leaked it rn

wet iron
#

oh f*k

#

i forgot

#

ok

#

regenerated

regal saddle
#

Perfect

wet iron
#

now

#

do you know how to do that??

regal saddle
#

im watching your code rn

wet iron
#

k

regal saddle
#

Why does „ping“ = case „8ball“?

wet iron
#

wat?

#

w8

#

how?

#

what?

#

@regal saddle

#

what do you mean?

regal saddle
#

Bot.commands.get(„ping“).execute...case („8ball“)

#

i dont understand your code at all.

wet iron
#

well shi*

#

im making cases

#

for the bot to see

regal saddle
#

Im sorry, but i cant help you out here.

wet iron
#

oof

pale vessel
#

that's just a basic command handler

wet iron
#

@pale vessel can you help?

pale vessel
#

tldr?

#

what's the problem

wet iron
#

when i input the ping command it activates the 8ball command

#

it first outputs the ping command and then activates the 8ball command

regal saddle
#

Oh

#

Now i see the problem

wet iron
pale vessel
#

btw add break; on ping switch

wet iron
#

ok

pale vessel
#

not needed but recommended

regal saddle
#

When you „execute“ ping it also activates 8ball because it wont stop on ping MegaThonk

wet iron
#

🤦‍♂️

regal saddle
#

or am i wrong rn?

pale vessel
#

but it's a switch

#

you may omit break;

wet iron
#

hmm

#

lemme try

regal saddle
#

yea, just do what flazepe says.

#

I cant help you here pandasad

wet iron
#

you were right

#

because i didnt put break after ping

#

it continued to run commands

#

and it ran the 8ball command

#

thanks guys!

copper cradle
#

why r u using a switch statement

#

just try to get the command they run

regal saddle
#

Snails gettin mad V4?

#

👀

copper cradle
#

and catch the error if it doesn't exist

#

not really

regal saddle
wide agate
#

G

regal saddle
#

G

copper cradle
#

I still haven't said the word fucking

regal saddle
#

Ye

summer torrent
slate oyster
#

I put a link to a discord comment into an embed message
My intent was that it would bring up the message in-app
Instead it opened the message in a browser window

#

Which is annoying

slate oyster
#

30 minutes since last post

grand iron
#

Did you give https: // in front?

weak tangle
#

how do i add a role? its saying addRole() is not a function. ive tried msg.author.addRole('598610160113418253');

grand iron
slate oyster
#

@grand iron Yes

#

I'll try it without the https
Because the problem is it opens in-browser

#

Instead of in-app

grand iron
#

@slate oyster if website dont have ssl

#

Use http://

slate oyster
#

It's discord

grand iron
#

What website?

slate oyster
#

It has ssl
Trying to open a discord link in discord

#

not in browser

grand iron
#

Oh

#

I see

#

I also have but discord always directs me to the website

slate oyster
#

Ok, they should fix that imo

grand iron
#

If you want to share a discord link, use the message

#

Ordinary message

slate oyster
#

Ok
It won't look as asthetically pleasing
'Cuz it will show the whole url

#

I have the URL hidden on the Author field of the embed right now

#

So it does not show the full link

grand iron
#

You use discord.js right

#

?

slate oyster
#

No

#

D4J

#

But I'd think it's more of a Discord-Client issue

grand iron
#

Yes

#

This discord client problem

slate oyster
#

Maybe we should contact Discord
and ask them to fix it?

copper cradle
#

the lib you're using doesn't really matter

quartz kindle
#

links in embeds have target="_blank" in them

#

so it always opens in a new window in the default browser

grand iron
#

Thats why i shouls him use message if want send link

quartz kindle
#

although regular links also have target=_blank lol

#

so blame discord's client side js i guess lul

slate oyster
#

yup

grand iron
#

🤷‍♂️

earnest phoenix
#

yo i need recommendations for a cheap cloudserver for my image gathering api

quartz kindle
#

google compute engine, galaxygate, contabo, digitalocean, ovh, scaleway, hetzner, vultr...

dense drift
#

Can anyone help me understand why I can't seem to get message timestamps?

.eval async function clear() { 
let fetched = await msg.channel.fetchMessages({limit: 10})
await msg.channel.send(fetched.map(r => `${r.timestamp}`))
}

clear()```

https://frogmaster.xyz/okYxqgYID
kind summit
#

stable or master?

#

because the function is now channel.messages.fetch({ limit: 10})

#

update your discord.js.

dense drift
#

Welllll

#

That seems like I would need to change my code in a whole lot of Discords.

#

😦

summer torrent
#

timestamp of what

dense drift
#

A message

summer torrent
#

that is createdTimestamp

dense drift
#

Tried, same thing

summer torrent
#

show code

slate oyster
earnest phoenix
#

i just need to find a better provider for my api

slate oyster
#

I just need to reduce whitespace

earnest phoenix
#

i set my whitespace limit to like 5 or so, so that this stuff doesnt happen

#

i'm probably changing to ovh or contabo once the bot has been approved

#

who needs better downloads than uploads

slate oyster
#

I meant to close Opera and instead closed Eclipse
oops

earnest phoenix
#

big f

earnest phoenix
#
setInterval(function(test){message.channel.send(".").then(e=>e.edit(Math.random())))},5000)
#

How can i put the message.channel.send() outside of the function?

#

I can't use vars

#

(Please ping me since I am getting offline now (djs v.11))

sudden geyser
#

uh, that wouldn't do what you'd expect it to if you put it out of the function?

#

like what do you mean

earnest phoenix
#

it returns e.edit is not a function if i put message.channel.send in a variable outside of the setInterval

#

and i dont want it to send each time

#

just edit

#

@sudden geyser

copper cradle
#

...

earnest phoenix
#

dont bully

#

:(

copper cradle
#

I'm not bullying

earnest phoenix
#

... from communist doggo always means bad

copper cradle
#

above the setInterval

#

send the message

regal saddle
#

SNAILS GETTIN MAD NOW V4?

copper cradle
#

.then(e => { setInterval(function() {
e.edit()
}, 5000)
})

#

wair

#

wait

regal saddle
#

snails

#

What you trying to do?

copper cradle
#

I'm on mobile

regal saddle
#

oh, now i understand.

copper cradle
#

wait