#development

1 messages ยท Page 742 of 1

restive furnace
#

ofc.... if u dont just copy paste

earnest phoenix
#

@restive furnace hehe lol

compact oriole
#

CoPy PaStA

compact raft
#

hi

glacial mango
#

How do I pick a random text channel from a server?

restive furnace
#

what lang

surreal wagon
#

With DiscordJS :

// (guild = guildObject)

let randomChannel = guild.channels.filter(c => c.type === 'text').random()
wheat jolt
#

?

#

ah

pliant adder
#

It would be better if you learn the basics of the language instead of diving in so deep.

summer acorn
#

Why do I keep getting this error?

UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
roles[11]: The set already contains this value

I didn't get it before the outage.

pliant adder
#

can you provide the code?

summer acorn
#

The whole error is

(node:1195) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
roles[11]: The set already contains this value
    at item.request.gen.end (/rbd/pnpm-volume/5e67cf9e-ab38-4576-ac99-0726c5933577/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
    at then (/rbd/pnpm-volume/5e67cf9e-ab38-4576-ac99-0726c5933577/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:1195) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1195) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
compact raft
#

is is possible to install node.js to shared hosting windows

pliant adder
#

I don't know what the error is i tried it on my end it works

#

@compact raft shared hosting windows?

compact raft
#

yes @pliant adder

pliant adder
#

explain what shared hosting windows is... @compact raft

compact raft
#

no more explanation

pliant adder
#

then i can't help you

compact raft
#

i mean what i show u more

surreal sage
#

Does this work? .title.url('url')?

#

nope

wheat jolt
#

@surreal sage?

surreal sage
#

does not work

#

dont need help anymore

wheat jolt
#

What is that

quartz kindle
#

@compact raft depends, possibly yes

#

If you have access to ssh and permissions

#

If all you have is a plesk control panel, then probably not

broken jay
#

I need little help with finding Pokemon API, that have generation 8 Pokemons already added. I need this for my bot.

surreal sage
#
const serverembed = new Discord.RichEmbed()
    const msg = await message.channel.send("Pinging...")
    .setTitle('Axyx - Status')
    //fields
    .addField('Internet Ping', `${msg.createdTimestamp - message.createdTimestamp}ms`, true)
    .addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
    msg.edit(`${msg.createdTimestamp - message.createdTimestamp}ms`)
    message.channel.send(serverembed);``` it does not work, well, i want the "msg" in the "Internet Ping" field, How do i let the "ping" in the embed without sending it without the embed?
restive furnace
#

wdym?

surreal sage
#

you see const msg right?

#
.addField('Internet Ping', `${msg.createdTimestamp - message.createdTimestamp}ms`, true)``` that message should be here
#

i want it to

#

but it just sends it without the full embed now

late hill
#

Well

#

You can't just start mixing things like that

surreal sage
#

so how can i like move it to the "${msg.createdTimestamp} thing

#

ik

late hill
#

The setTitle(), addField(), ..

#

Are methods

surreal sage
#

ik

late hill
#

That belong to the RichEmbed

surreal sage
#

yep

late hill
#

Which means you call them on a RichEmbed object

surreal sage
#

ok

late hill
#

You can chain them because they return the object itself

#

But you can't just put .setTitle() out of nowhere

surreal sage
#

title is required ik

restive furnace
#

it isnt

#

title isnt required

surreal sage
#

can i do: js const msg = await("pinging")

#

yeah i thought

#

i dont think so

late hill
#

All you have to do

restive furnace
#

it isnt required (title on embed)

late hill
#

Is simply put the regular message above the embed code

restive furnace
#

just simply msg.edit(embed)

late hill
#

And yes

#

An edit would also be better

#

Rather than sending another message

surreal sage
#

im gonna try with eval

restive furnace
#

um.why u cant directly test on ur bot??

surreal sage
#

im doing the update ver rn

#

with new help embeds

#

and a reboot cmd for me

#

do i have to remove message.channel.send(serverembed)?

#

wait what

#

i dont understand

restive furnace
#

msg.edit(serverembed)

surreal sage
#

ik

#

but

#

where does the message of the ping go to?

#

i want it at js ${msg.createdTimestamp - message.createdTimestamp}

#

do i have to put there just the full: js msg

#

gonna try

late hill
#

Try to use meaningful names for your variables

#

Mixing up message and msg is confusing for both you and anyone else reading your code

surreal sage
#

did not work the: js const serverembed = new Discord.RichEmbed() const msg = await message.channel.send("Pinging...") .setTitle('Axyx - Status') .setColor('#ff1493') //fields .addField('Internet Ping', msg, true) .addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true) msg.edit(serverembed)

#

well msg is the pinging message

#

and message is the full message

late hill
#

Yes

surreal sage
#

^^that script didnt work

#

do i have to put "msg" in msg

late hill
#

Of course it didn't work

#

I've told you that you can't randomly call .setTitle()

#

it would be serverembed.setTitle()

#

You're confused because you've seen them being used like this

let embed = new Discord.RichEmbed()
    .setTitle("something");```
#

That works because it's chained to the line above

surreal sage
#

ah ok

late hill
#

You have code inbetween those

#

Which means you're no longer calling the method on the embed object

surreal sage
#

gonna try serverembed.settitle thin

earnest phoenix
#

better to just move your msg declaration

surreal sage
#
const serverembed = new Discord.RichEmbed()
    const msg = await message.channel.send("Pinging...")
    serverembed.setTitle('Axyx - Status')
    serverembed.setColor('#ff1493')
    //fields
    serverembed.addField('Internet Ping', msg, true)
    serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
    msg.edit(serverembed)``` nope
compact raft
#

@quartz kindle that hosting is mine so i have fully access and i have cpanel access also

late hill
#

You could've done that without having to put serverembed each time, but that should work

surreal sage
#

well it did not

late hill
#

You're doing it using eval

#

Depending on how you implemented your eval command

#

It might not work the same way

surreal sage
#

eval(args)

#

regular embeds work

late hill
#

I'm willing to bet await doesn't work in your eval

#

Either way

surreal sage
#

yeah..

#

same

late hill
#

You could also check your console

surreal sage
#

i do but i cant copy paste

late hill
#

As there's most likely more info there on why it didn't work

surreal sage
late hill
#

So yes

#

It's not working because of the await

surreal sage
#

so if i dont use eval it works or its just the full await

late hill
#

await would work outside of eval

#

If it's an async function

compact raft
#

hello

surreal sage
#

well im gonna upload it then

compact raft
#

anybuddy help me to setup my bot to my windows shared hosting

summer acorn
#

Why does this push the last id twice? Whereas in the logs, it only logs the last id once in the for loop.

roles = new Array();
        console.log(roles)
        for (i = 0; i < Object.keys(db.server.configs.rolePers[message.author.id]).length; i++) {
            let Role = db.server.configs.rolePers[message.author.id][i];
            let role = message.guild.roles.get(Role);
            if (role) {
                roles.push(Role);
                console.log(role.id)
                console.log(Role)
            }
        }
        console.log(roles)
surreal sage
#

restart

#

there is a startup error from the const msg await

#

so it is the await i think

late hill
#

yes

summer acorn
#

Who are you talking to right now? Me or someone else?

late hill
#

If it's an async function

surreal sage
#

to me

summer acorn
#

As I've already restarted it many times.

late hill
#

Did you put that in an async function

summer acorn
#

In a message event.

late hill
#

Not you ๐Ÿ‘€

surreal sage
#

idk

summer acorn
#

Ok then, confusing to me since I am slow in my head.

surreal sage
#

could removing await help?

late hill
#

Well yes, but it would be better for you to just make the function async so that await would work

summer acorn
#

Either way,

client.on('message', message => {
    if (message.channel.type === 'dm') return;
    fse.readJson(`databases/${message.guild.id}.json`, (err, db) => {
        if (err) return console.log(err);
        if (!db.server.configs.rolePers) return;
        if (!db.server.configs.rolePers[message.author.id]) return;
        if (Object.keys(db.server.configs.rolePers[message.author.id]).length === 0) return;
        roles = new Array();
        console.log(roles)
        for (i = 0; i < Object.keys(db.server.configs.rolePers[message.author.id]).length; i++) {
            let Role = db.server.configs.rolePers[message.author.id][i];
            let role = message.guild.roles.get(Role);
            if (role) {
                roles.push(Role);
                console.log(role.id)
                console.log(Role)
            }
        }
        console.log(roles)
        for (i = 0; i < roles.length; i++) {
            if (message.member.roles.has(roles[i])) {
                roles.splice(i,1);
            }
        }
        if (roles.length === 0) return;
        console.log(roles)
        return message.member.addRoles(roles, `Role Persist.`)
    });
});

I get these logs

[]
642314547813679104
642314547813679104
642314644865810442
642314644865810442
[ '642314547813679104', '642314644865810442' ]
[ '642314644865810442' ]
#

What is the problem there?

late hill
#

Show where you've put the code @surreal sage

summer acorn
#

I don't see what the problem there would be.

surreal sage
#

wdym with where

late hill
#

Your code is put somewhere in some kind of function

#

You're gonna have to add "async" to the function declaration

surreal sage
#
if (command === "status") {
    const serverembed = new Discord.RichEmbed()
    const msg = await message.channel.send("Pinging...")
    serverembed.setTitle('Axyx - Status')
    serverembed.setColor('#ff1493')
    //fields
    serverembed.addField('Internet Ping', msg, true)
    serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
    msg.edit(serverembed)
}``` this?
late hill
#

oh

#

I guess that's just in the message event then

surreal sage
#

yeah......

late hill
#

Well you'd have to make that async then

surreal sage
#

how cuz i dont know how

late hill
#

By adding async

#

๐Ÿ‘€

surreal sage
#

replace await with async or async const

modest maple
#

bruh

#

read

late hill
#
client.on("messageCreate", async (msg) => {
// I'm now allowed to use "await" here, yay
});```
surreal sage
#
 client.on("messageCreate", async (msg) => {
    if (msg.content === 'a.status') {
   const serverembed = new Discord.RichEmbed()
    const msg = await message.channel.send("Pinging...")
    serverembed.setTitle('Axyx - Status')
    serverembed.setColor('#ff1493')
    //fields
    serverembed.addField('Internet Ping', msg, true)
    serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
    msg.edit(serverembed)
  }
});``` this good?
earnest phoenix
#

why not just move your msg declaration and properly chain your richembed methods

#

unneeded code dupe

surreal sage
#

or js client.on("messageCreate", async (msg) => { const serverembed = new Discord.RichEmbed() const msg = await message.channel.send("Pinging...") serverembed.setTitle('Axyx - Status') serverembed.setColor('#ff1493') //fields serverembed.addField('Internet Ping', msg, true) serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true) msg.edit(serverembed) });

#

no

#

wait idk

#

gonna try

earnest phoenix
#

the latter would cause api spam

#

or nevermind, wrong event name

late hill
#

@summer acorn what's the issue, your logs seem right for the code you've provided

summer acorn
#

Well, since I already have all the roles in the array, the entire array should be spliced, but it either thinks I don't have the last role, or it doesn't go through the loop enough times.

late hill
#

Oh

summer acorn
#

It goes through the for loop once too little

#

For some reason.

#

Oh wait, I think I might see why that is happening now.

late hill
#

Yeh

summer acorn
#

Nevermind,

late hill
#

You're removing from the array so your for loop won't work as intended anymore

fluid basin
#

LOL

#

nice meme

summer acorn
#

I tried making a second array

#

Didn't work.

fluid basin
#

using splice during loop is a no no

#

on the original array

summer acorn
#
let ROLES = roles;
        for (i = 0; i < ROLES.length; i++) {
            if (message.member.roles.has(roles[i])) {
                roles.splice(i,1);
                console.log(roles)
            }
        }
#

That gave the exact same outputs

late hill
#

Yeh

fluid basin
#

yuh

#

thats js logic

late hill
#

No

fluid basin
#

expected outcome

late hill
#

It's the way large/complicated data is stored

fluid basin
#

no

#

lol

late hill
#

An array will save a reference to the address with the data

fluid basin
#

yes

#

so its the same thing

late hill
#

Putting up a new variable and setting it to that array

#

Sets it to the same adress

#

Meaning they will both edit eachother

summer acorn
#

Oh.

late hill
#

This happens in javascript but also in java, python, ..

summer acorn
#

Then what should I do?

late hill
#

Well

#

Not that

fluid basin
#

???

#

well there are many ways to do so

late hill
#

Just use a different aproach

summer acorn
#

What I need is the length of the original array.

late hill
#

Such as adding the roles the member doesn't have to a new array

#

Without editing the other array

summer acorn
#

Oh, I didn't think about that.

#

Thank you.

fluid basin
#

i mean splicing while in a loop using index just doesnt work

#

imagine array [0, 1, 2, 3]

#

if you do splice(1, 1) you get [0, 2, 3]

#

and splice(2, 1) will remove 3, not 2

summer acorn
#

Alright, I just made it so that if the if statement returns false, it will push, rather than true = splice. Thanks for the help.

surreal sage
#

idk why

#

im going to use the easy way for cmds

vital lark
#

it's saying command isn't defined

modest maple
#

Read the errors people

vital lark
#

think you should know how to read errors

surreal sage
#

now its saying message is nothing

#

WHATS GOING ON

modest maple
#

learn the basics of coding in your programming language before doing disocrd bots

surreal sage
#

no

#

there are errors

#

out of nothing

#

everything worked fine

wheat jolt
#

No one will spoon feed you until your code is perfect

surreal sage
#

no

#

how can i fix this?

wheat jolt
#

As @modest maple said, firstly learn node.js, then read the errors, THEN AFTER ask here

surreal sage
#

:(

modest maple
surreal sage
#

well i know that it cant find the the const or something of command

#

or something blocks the command of like using it

wheat jolt
surreal sage
#

i saw that

#

||smh||

wheat jolt
#

Who cares you saw that

#

smh means shaking my head

surreal sage
#

i care that someone HELPES me

wheat jolt
#

What's the error

surreal sage
#

cant find but i do have it

wheat jolt
#

Share your full code

#

Without token

surreal sage
#

ok

#

i cant paste it lol

wheat jolt
#

Hastebin

surreal sage
#

or a txt

wheat jolt
#

Strange

surreal sage
#

maybe its the node modules

#

wait what

#

if i remove the 2 commands

#

it works..

#

ok now we know

#

it are the commands

#
if (command === "help")
    if(message.author.id !== botConfigs.ownerID) {
        const ownerhelpembed = new Discord.RichEmbed()
        .setTitle('Owner Help Menu')
        .setColor('#ff1493')
        .setAuthor('Axyx Owner')
        .setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
        .setFooter('CDevelopers Bot - Prefix: ax')
        //fields owner
        .addField('Owner Commands', 'Set my status: `axsetstatus <status>` \n Send a update embed to the server: `axupdatesend <message>` \n Execute a code: `axeval <code>` \n Shut me off: `axshutdown`', false)
        //fields cmds
        .addField('Chat Moderation', 'Clear the chat: `axclear (2 > 100) \n Lock a channel: `axlockdown (1m,1h,1d,1)', false)
        .addField('Moderation', 'Kick a user: `axkick @user <reason>` \n Ban a user: `axban @user <reason>` \n Mute (tempmute) a user: `axtempmute @user (1m,1h,1d) <reason>` \n Warn a user: `axwarn @user <reason>`', false)
        .addField('Utility', 'Send a announce-embed: `axannounce #channel #hex-color <title> <message>` \n Bug Report: `axbugreport <bug>`', false)
        message.channel.send(ownerhelpembed);
#
       } else {
        const regularhelp = new Discord.RichEmbed()
        .setTitle('Help Menu')
        .setColor('#ff1493')
        .setAuthor('Axyx')
        .setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
        .setFooter('CDevelopers Bot - Prefix: ax')
        //fields cmds
        .addField('Chat Moderation', 'Clear the chat: `axclear (2 > 100) \n Lock a channel: `axlockdown (1m,1h,1d,1)', false)
        .addField('Moderation', 'Kick a user: `axkick @user <reason>` \n Ban a user: `axban @user <reason>` \n Mute (tempmute) a user: `axtempmute @user (1m,1h,1d) <reason>` \n Warn a user: `axwarn @user <reason>`', false)
        .addField('Utility', 'Send a announce-embed: `axannounce #channel #hex-color <title> <message>` \n Bug Report: `axbugreport <bug>`', false)
        message.channel.send(regularhelp);
    }```
#

@wheat jolt

#

the problem is the command

modest maple
#

i love how we told you what todo with async and you just completely ignored it

surreal sage
#

these dont need that

#

i think

#

do i?

modest maple
#

smh

#

๐Ÿ‘ Read ๐Ÿ‘ The ๐Ÿ‘ Docs ๐Ÿ‘ Learn ๐Ÿ‘ The ๐Ÿ‘ Programming ๐Ÿ‘ Language ๐Ÿ‘ First

surreal sage
#

๐Ÿ‘ stop ๐Ÿ‘ clapping ๐Ÿ‘ ๐Ÿคฃ

#

throw error now

#

nvm

#

it works

#

nvm

#

it like crashes

#
client.on("message", async function (message) {
if (command === "shutdown") {
        if(message.author.id !== botConfigs.ownerID) return;
        message.reply('Shutting down.....')
        process.exit()
}})
``` problem with this?
#

or 1 } and 1 )

#

oh my god

#

) ~{~

#

totally forgot

#

i think i got to reprogram this fully

#

cuz you guys dont want to help

dark oak
#

Maybe try to remove the Function and try again

surreal sage
#

i tried

#

moving to too

#

nothing helped

modest maple
#

smh

#

dude

surreal sage
#

WHAT

modest maple
#

learn how df async works

surreal sage
#

i tried that too

modest maple
#

if you knew even a little bit about the programming language and read the docs you wouldnt have this issue

surreal sage
#

bro

#

i just did somethings

#

and the full problem = command thing or.... THE STUPID HELP COMMAND

modest maple
#

smh

#

dude

knotty steeple
#

can you try actually making a command handler

surreal sage
#

oh my god

#

no

modest maple
#

learn the programming language basics first, then read the docs

surreal sage
#

its just one command

#

that makes the error

modest maple
#

i can see the error

#

RN

sudden geyser
#

CD search up what a referenceerror is

modest maple
#

i dont even program in JS much

surreal sage
#

tell me the error RN

modest maple
#

and i know whats wrong

sudden geyser
#

learning more about javascript will help you in the long run

surreal sage
#

:((((

modest maple
#

and im not gonna tell you it until you learn the JS basics

#

and LEARN TO READ THE DOCS

sudden geyser
#

chillfish ngl I don't feel you're help screaming they learns js and read docs

surreal sage
#

๐Ÿ˜ฟ

#

^^^ me rn :(

modest maple
#

what more can you do when hes refusing to go away and learn the basics of his programming language and refusing to read up on the documentation

surreal sage
#

im gonna try to fix

knotty steeple
#

just stop

surreal sage
#

if you tell me what the prob is

sudden geyser
#

you don't help them in that situation

surreal sage
#

again still you too

earnest phoenix
#

Hello there

unique nimbus
#

We do not give you the code to fix it

surreal sage
#

but i can still learn from it

earnest phoenix
#

I need help with developing a bot that checks how many players are in my minecraft server and then sends back Number of players and their names

#

cmd /getplayers

wheat jolt
#

paid

#

?

compact raft
#

hello

#

i need some help

radiant jay
#

dont ask 2 ask please

modest maple
#

mhmm?

compact raft
#

when i type node index.js the terminal taking more time

#

approx 5 to 10 minute's

knotty steeple
#

blame discord

modest maple
#

^^

#

API is dying

compact raft
#

what is this error

(node:28560) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
    at H:\DISCORD BOT\GULAM-BOT\node_modules\discord.js\src\client\ClientManager.js:40:57
    at Timeout._onTimeout (H:\DISCORD BOT\GULAM-BOT\node_modules\discord.js\src\client\Client.js:436:7)
    at listOnTimeout (internal/timers.js:536:17)
    at processTimers (internal/timers.js:480:7)
(node:28560) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:28560) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
patent prism
#

Discord arent letting any new connections join

#

Wait for a while till they resolve api issues

compact raft
#

me ? @patent prism

patent prism
#

yes

restive furnace
#

Is this because api errors/latency? INFO - discord.gateway. received_message : Shard ID None session has been invalidated. (probably yes)

unique nimbus
#

I think Discord stopped bots from logging in

modest maple
#

they closed api log in eys

restive furnace
#

btw whats the votebutton thingy on style on top.gg? .votebutton?

modest maple
#

go to inspect

#

look where it has <div> class="<class name here>"

#

then its just . + <class name>

surreal sage
#

messasge ๐Ÿคฃ

#

any error you see? ```js
if (command === "help") {
if(message.author.id !== botConfigs.ownerID) {
const regularhelp = new Discord.RichEmbed()
.setTitle('Help Menu')
.setColor('#ff1493')
.setAuthor('Axyx')
.setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
.setFooter('CDevelopers Bot - Prefix: ax')
//fields cmds
.addField('Chat Moderation', 'Clear the chat: axclear (2 > 100) \n Lock a channel: axlockdown (1m,1h,1d,1)', false)
.addField('Moderation', 'Kick a user: axkick @user <reason> \n Ban a user: axban @user <reason> \n Mute (tempmute) a user: axtempmute @user (1m,1h,1d) <reason> \n Warn a user: axwarn @user <reason>', false)
.addField('Utility', 'Send a announce-embed: axannounce #channel #hex-color <title> <message> \n Bug Report: axbugreport <bug>', false)
message.channel.send(regularhelp);
}

if (command === "help") {
    if(message.author.id !== '449250687868469258') {
        const adbed = new Discord.RichEmbed()
        .setColor('#ff1493')
        .setTitle('Extra Commands')
        //fields owner
        .addField('Owner Commands', 'Set my status: `axsetstatus <status>` \n Send a update embed to the server: `axupdatesend <message>` \n Execute a code: `axeval <code>` \n Shut me off: `axshutdown`', false)
        message.channel.send(adbed);
    }
}}
#

or is it the api that it cant send embeds

modest maple
#

message is not defined

#

read the error

#

you cant call upon the object 'message' when it doesnt exist to that part of the code

surreal sage
#

it does not give a error and it does not send

earnest phoenix
#

learn to debug your code

mossy vine
#

the if statement makes it fail..

modest maple
#

you sent us that error

#

with that code

mossy vine
#

messasge

surreal sage
#

noo

#

ik

#

for the joke

#

messasge > message

#

no from big code

earnest phoenix
#

go through your code step by step, inspect your variables and see where it goes wrong

mossy vine
#

@surreal sage its not working because of the if statements. if any other user tries the command, it will work

surreal sage
#

wich statement

earnest phoenix
#

yall need to learn how to debug you can't just rely on other people to fix your code

mossy vine
#

the ones where you compare ids

modest maple
#

cry is right

surreal sage
#

im gonna use botConfigs.ownerID then

mossy vine
#

oh god do you really not understand what the fuck that if statement means

#

if anyone but you runs the command, actually do the command

surreal sage
#

i see

modest maple
#

i dont think hes actually learn js before coding a bot

wary valve
#

same lol

surreal sage
#
    //help
    if (command === "help") {
            const regularhelp = new Discord.RichEmbed()
            .setTitle('Help Menu')
            .setColor('#ff1493')
            .setAuthor('Axyx')
            .setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
            .setFooter('CDevelopers Bot - Prefix: ax')
            //fields cmds
            .addField('Chat Moderation', 'Clear the chat: `axclear (2 > 100) \n Lock a channel: `axlockdown (1m,1h,1d,1)', false)
            .addField('Moderation', 'Kick a user: `axkick @user <reason>` \n Ban a user: `axban @user <reason>` \n Mute (tempmute) a user: `axtempmute @user (1m,1h,1d) <reason>` \n Warn a user: `axwarn @user <reason>`', false)
            .addField('Utility', 'Send a announce-embed: `axannounce #channel #hex-color <title> <message>` \n Bug Report: `axbugreport <bug>`', false)
            message.channel.send(regularhelp);
    }

    if (command === "help") {
        if(message.author.id !== botConfigs.ownerID) return
            const adbed = new Discord.RichEmbed()
            .setColor('#ff1493')
            .setTitle('Extra Commands')
            //fields owner
            .addField('Owner Commands', 'Set my status: `axsetstatus <status>` \n Send a update embed to the server: `axupdatesend <message>` \n Execute a code: `axeval <code>` \n Shut me off: `axshutdown`', false)
            message.channel.send(adbed);
        }
    }}
``` fixed lol
modest maple
#

its a rlly bad way of going about suff

surreal sage
#

oops forgot ; at return

wary valve
#

btw when the new bots getting approved?

surreal sage
#

........

mossy vine
#

you dont need semicolons in js

#

omg

modest maple
#

@wary valve 1 week+

wary valve
#

no u

surreal sage
#

what

modest maple
#

okay?

surreal sage
#

yyyy

#

and im gonna restart now

wary valve
#

but why are u giving live news here lmao

mossy vine
#

@wary valve you are in the wrong channel my guy

modest maple
wary valve
surreal sage
#

yup yup yup can someone do axhelp in #commands

#

i want to be sure about owner only

earnest phoenix
#

I need help with developing a bot that checks how many players are in my minecraft server and then sends back Number of players and their names
cmd /getplayers

#

ask your question

#

no one knows what you're having trouble with when you just say "i need help"

#

develop it for me

#

no

mossy vine
#

for money? sure

earnest phoenix
#

make it yourself or hire someone

#

no one is going to do it for free

fluid basin
#

we are here to help you with your code, not to give you code

wheat jolt
#

does anyone have an ideea why it's throwing this error?

modest maple
#

could quite well be discord's latency

#

atm

wheat jolt
#

it was fixed

vast holly
#

guys

#

my bot how long it would take to be approved ? or checked

modest maple
#

@vast holly 1 week+

slender thistle
vast holly
#

x:

modest maple
#

beat u too it shiv

slender thistle
modest maple
#

oof

trail reef
#

lol

rugged minnow
#

[discord.js]
i'm storing my prefix in a .json file, if i wanted to use multiple prefixes, how would i do it?

amber fractal
#

have an array of prefixes

#

check the start of their message against that array

rugged minnow
#

I tried making an array in json

#

It doesnโ€™t quite work

modest maple
#

use a dict

#

key as the guild ID

#

then the prefix as the content

surreal sage
#

you know how to get content out a txt file of a website? like Version <thattext> (on website txt: 1.0.0)

earnest phoenix
#

How to make change able prefix

#

๐Ÿ˜ข

unique nimbus
#

Databases

earnest phoenix
#

@unique nimbus like

unique nimbus
#

Store each servers prefix in a database and make it customizable

#

mongodb is a database

#

there are others

earnest phoenix
#

@unique nimbus i don't know how to use it can you help me

#

๐Ÿ™

unique nimbus
#

What language you in

#

programming language

mossy vine
#

noone will guide you through database basics

earnest phoenix
#

.js

mossy vine
#

pick a database and read guides and documentation

#

i personally reccommend mongodb, its easy and integrates very well with js

#

you could also go with a variation of sql like mysql or sqlite, but thats a different story

earnest phoenix
#

Ohh

#

Actually i am new in coding i need to learn more

#

If any experienced coder will i can do easilyveryfastpats

pliant adder
#

@earnest phoenix if you need help with mongoose i can help

earnest phoenix
#

@pliant adder how

#

๐Ÿค”

pliant adder
#

woah how??

surreal sage
#

how can i get a color hex of the most used color in a image

#

like roblox logo

earnest phoenix
#

@pliant adder come DMS

surreal sage
#

it picks the color of its color

pliant adder
#

ok

broken jay
#

Anyone know paginator for discord.py? There was Libneko, but this is not longer working

amber fractal
#

You can make one mmulu

surreal sage
#

to who ur talking ?

amber fractal
#

the person that was right above my message.

surreal sage
#

ok

fluid basin
#

@broken jay I guess you can make your own, it should be manageable if you understand lists and stuff

prime cliff
#

Just make a list object of embeds and keep track of the page number and count per message that should be easy to do

broken jay
#

I can try... I'll make suggestion too to discord.py, they would add better in-built paginator. Current one is not very good...

rugged minnow
#

ok, i tried everything to make multiple prefixes

amber fractal
#

if it didnt work, you didn't

rugged minnow
#

i tried making an array in the .json file
i tried making two different values in the .json file
i tried putting in lowercase the recived message, nothing

compact oriole
#

do you use your own command system or discord.pys?

rugged minnow
#

discord.js

earnest phoenix
compact oriole
#

well that

earnest phoenix
#

Undefined

rugged minnow
#

@earnest phoenix you're using a field, you can't remove that

earnest phoenix
#

@rugged minnow why๐Ÿ˜…

rugged minnow
#

the field requires two values

compact oriole
#

thats why I make my own system, so I have more options

earnest phoenix
#

How to remove it

#

Any way

compact oriole
#

There is no way

#

As you are using fields

earnest phoenix
#

Ya

rugged minnow
#

in javascript is:

.addField("test", "test1", true);

compact oriole
#

as @rugged minnow said

pliant adder
#

The third param is optional

earnest phoenix
#

Thank

pliant adder
#

and by default is false

rugged minnow
#

yeah, the third one is optional, i don't use it

compact oriole
pliant adder
#

@earnest phoenix use a description

rugged minnow
#

well, i still can't find a way to use multiple prefixes

#

if i try to use the || it still doesn't work

pliant adder
#

have an array

rugged minnow
#

tried that

twilit rapids
#

@earnest phoenix you can add ** ** as field value

rugged minnow
#

still doesn't work

twilit rapids
#

Which won't be displayed as anything and remove undefined

#

Or get an invisible unicode character

pliant adder
#

or have an empty space

#

which is just an invisble unicode character

fluid basin
#

ok at least show us your code

rugged minnow
#

you can add ** ** as field value
this goes in my notebook

fluid basin
#

or a snippet of the embed

rugged minnow
#

are you talking to me?

fluid basin
#

wait idk

amber fractal
#

@rugged minnow one way is to use an array, use a for loop, check the start of the message for the prefix save it if it is, break and go on

#

I just made it in 6 lines

rugged minnow
quartz kindle
#

or use some() and includes() for a one liner

amber fractal
#

Those work as well

fluid basin
#

@rugged minnow yeah you need to change the part where it checks the prefix duh

compact oriole
#

^

rugged minnow
#

well i tried that

fluid basin
#

if its an array it cant be done the same way as a string

rugged minnow
#

it's storing the value from the .json in a variable

#

i should be using some() and includes() as Tim said

compact oriole
#

if (!prefixlist.any(p => message.content.startsWith(p))) return

rugged minnow
#

because i'm trying to make it not case sensitive

amber fractal
#

then toLowerCase it

fluid basin
#

and in your original code it doesnt check for casing

#

you should get basic custom prefix working first before moving on

#

imho well

pliant adder
#

and use a db

rugged minnow
#

i don't have a db

#

yet

pliant adder
amber fractal
#

Configs are fine for json

#

json is actually meant for things like configs

pliant adder
#

json is for stationary information

amber fractal
#

yes

pliant adder
#

like tokens and etc.

amber fractal
#

i.e. config

#

They never asked for per-server prefix

quartz kindle
#

internet explorer config

pliant adder
#

Eww Internet explorer

amber fractal
#

id est config there we go

#

no acronym uses here

rugged minnow
#

i want to use only one prefix

#

but i don't want to make it case sensitive

pliant adder
#

weirdsip ok

rugged minnow
compact oriole
#

yea

#

because prefix isnt undefined

#

also, why is it to upper?

rugged minnow
#

but i don't want to make it case sensitive

amber fractal
#

I dont think you can ...startsWith(prefix || prefix.toUpperCase() || 1 || 2 || ...)

quartz kindle
#

nope

pliant adder
#

then just don't use toUpperCase smh

quartz kindle
#

@rugged minnow thats not how startsWith works

amber fractal
#

you should lowercase the message and have the prefix lower case then you only need one check

quartz kindle
#

or any function

rugged minnow
#

yeah but then the args then would get lowercase too @amber fractal

compact oriole
#

What do you even mean...

quartz kindle
#

toLowerCase() does not change the value

#

its gives you a copy of it

amber fractal
#

toLowerCase is non-destructive.

modest maple
amber fractal
#

Damn I'm slow

modest maple
#

yup

amber fractal
compact oriole
#

^^^^^^

rugged minnow
#

uh ok

#

thanks

amber fractal
#

I was writing it in console to show it as well

#

That's why I was slow :P

compact oriole
#

Do you use oliys image server

#

?????

amber fractal
#

No it's mine

compact oriole
#

oh

modest maple
#

its just sharex

compact oriole
#

i know

amber fractal
#

I was told to change the subdomain to oliy

fluid basin
#

also, prefix == true so prefix || prefix.toUpperCase() returns prefix

compact oriole
amber fractal
#

it used to be images

compact oriole
#

I use ShareX too ๐Ÿ˜„

amber fractal
fluid basin
#

@compact oriole why is there two of the same lel

compact oriole
#

one is pic one is upload

#

idk

amber fractal
#

you can delete from local after upload

pliant adder
#

how do u have a custom domains

compact oriole
#

is there auto upload?

pliant adder
amber fractal
#

yes

compact oriole
#

i buy my domain

quartz kindle
#

why even upload

pliant adder
#

how much is a domain

compact oriole
#

they differ

amber fractal
#

Because I don't want space taken on my pc

quartz kindle
#

why do you need to save them

pliant adder
#

what's rhe chippest

compact oriole
#

idk

amber fractal
#

Because I take screenshots of things I go back to a lot

quartz kindle
#

ah

pliant adder
#

affax how much do u pay

compact oriole
#

10 dollars a year

#

Found the auto upload

#

Now it only uploads and doesnt even save to my pc

#

at any point xd

amber fractal
#

that's what mine does

quartz kindle
#

i just paste stuff directly to discord, without saving

compact oriole
#

I just love ShareX

rugged minnow
#

ok nevermind

compact oriole
#

I can nuke Digitaloceans bandwith

modest maple
#

same tim

rugged minnow
#

the solution was actually pretty simple

amber fractal
#

The creator of it is in this discord

compact oriole
#

The creator if ShareX?

rugged minnow
amber fractal
#

Yeah

rugged minnow
#

i'm so bad at coding ๐Ÿ˜…

compact oriole
#

Cool ๐Ÿ˜„

#

I just found ShareX and its so good

frank walrus
#

hello, im asking for how to send a private message to the members ?

earnest phoenix
#

in which lib

fluid basin
#

depends on your library, check your library documentation for more information

frank walrus
#

the orginial one

earnest phoenix
#

what language & lib

frank walrus
#

english

earnest phoenix
#

no coding language i meant sorry lmao

sudden geyser
#

what

empty owl
#

ShareX isnโ€™t on Mac ;-;

restive furnace
compact oriole
restive furnace
#

rip its down

compact oriole
#

affax.dev aint ;D

restive furnace
#

they have invlaid ssl

compact oriole
#

I use autorenewed free ssl

restive furnace
#

i dont have even any domain xD

compact oriole
restive furnace
#

okei

empty owl
#

@restive furnace get one for free of freenom

earnest phoenix
#

@compact oriole you leaked your ip

compact oriole
#

no

earnest phoenix
#

ok

compact oriole
#

thats my server

earnest phoenix
#

oh lol

#

small brain here don't mind

compact oriole
#

and also, you cant do anything with ips xd

earnest phoenix
#

other than ddos

compact oriole
#

if you knock me down, it does nothing

#

yea

restive furnace
#

@empty owl idk why, but freenom blocked my ip

compact oriole
#

but they cant stealio anything

empty owl
#

location but itโ€™s like not accurate

compact oriole
#

^

empty owl
#

Vpn?

restive furnace
#

u can block ddosses

#

too

#

xd

#

(differ than firewall cuz firewall blocks all inbound traffic on the port)

empty owl
#

I donโ€™t even host my web on my computer tho

restive furnace
#

i have too op vps 4vcpu, 16gb ram xd

empty owl
#

Then how would someone ddos

valid frigate
#

who cares about anyone ddosing you

empty owl
#

wouldnโ€™t they just ddos ur vps

valid frigate
#

they would have no reason to

restive furnace
#

and yeah if u have line 10 gbps internet, its almsot impossible to ddos

empty owl
#

Some people just be like that

valid frigate
#

ah

#

well if people are ddosing some random kid's vps then it's their fault for bein a dick

#

and they probably don't care

empty owl
#

Lmao

valid frigate
#

so idk why people are fucking their shit up to prevent ddos attacks when it will literally never happen

restive furnace
#

most of the ddossing happens bcs of that, but some ddos happens w/out vps owner being annoying

valid frigate
#

funny

empty owl
#

cloudflare

valid frigate
#

then it's their fault for not implementing basic security measures

#

you wouldn't give away root pass/ have root login enabled, duh

#

also if you haven such a capable vps why are you making discord bots lmao, it has so much more potential (unless you're hosting something else)

surreal sage
#

whats a ${thing} to see how long the bot is online?

surreal sage
#

thx?

mossy vine
#

oh you wanted code?

#

too bad

#

heres docs

surreal sage
#

y

unique nimbus
#

We don't spoonfeed

surreal sage
#

but docs is ok

#

nvm

quartz kindle
#

well, most discord libraries have an uptime method

surreal sage
#

.readytimestamp

#

how to use that ^^^?

#

${readyTimestamp}?

quartz kindle
#

nope

surreal sage
#

${uptime}?

quartz kindle
surreal sage
#

i just said that

#

ahhh

#

how to remove 3x 0 from that

#

${client.readyTimestamp - 000}?

quartz kindle
#

divide by 1000

#

its a number, you can do math on it

surreal sage
#

i want to make a second so is this good if i want ${client.readyTimestamp - 000} seconds

quartz kindle
#

timestamps are in miliseconds

surreal sage
#

ik

quartz kindle
#

1 second = 1000 miliseconds

surreal sage
#

1 sec = 1000 mili

#

lol

#

so minus 000

quartz kindle
#

i told you lol

#

divide by 1000

#

1 * 1000 = 1000
1000 / 1000 = 1

surreal sage
#

${client.readyTimestamp 1 * 1000} seconds?

quartz kindle
#

...

unique nimbus
#

bruh

surreal sage
#

idk how

quartz kindle
#

do you know math?

surreal sage
#

i do, but not on javascript

quartz kindle
#

its literally the same

#

just replace numbers with variables

#
var a = 1000;
console.log(a / 1000)```
surreal sage
#

like this? ```js
// Example: toFixed(2) when the number has no decimal places
// It will add trailing zeros
var num = 10;
var result = num.toFixed(2); // result will equal 10.00

// Example: toFixed(3) when the number has decimal places
// It will round to the thousandths place
num = 930.9805;
result = num.toFixed(3); // result will equal 930.981```

quartz kindle
#

...

surreal sage
#

nah

mossy vine
#

you are literally told what to do

#

omg

quartz kindle
#

also, while we are here

#

a timestamp is the amount of time passed since 1 jan 1970

#

you probably want this instead

surreal sage
#

ok

#
var numb123 = 1000;

${client.uptime / numb123}```this
#

?

quartz kindle
#

well, that will work yes

#

but you dont need to create a variable

#

you can literally do / 1000

surreal sage
#

const or let right?

#

ok

quartz kindle
#

client.uptime / 1000

mossy vine
#

now while we are here in development mmulu

#
                                                                 ^

TypeError: Cannot read property 'send' of undefined```
#

what

quartz kindle
#

channel not found

mossy vine
#

but it logs message.mentions.channels.first() as a textchannel

quartz kindle
#

.first().id

mossy vine
#

oh wait

#

cant i call .send on .first()

#

since it returns a TextChannel anyways?

quartz kindle
#

yeah lol

mossy vine
#

yikes

#

im dumb thanks lol

surreal sage
#

ok thx

#

i tested with eval

cobalt mesa
#

.addField("Propriรฉtaire du serveur", message.guild.fetchMember(message.guild.owner.user).tag) in my code i have this line but the output is undefined a solution please

please mention me if you have a solution (@cobalt mesa)

amber fractal
#

fetchMember returns a promise I assume

earnest phoenix
#

yes, it does

amber fractal
#

.tag will be undefined until the promise is resolved

#

await it

cobalt mesa
#

and to get the tag how do i do with fetching the owner

summer torrent
#

message.guild.owner.user.tag

cobalt mesa
#

at first i had this but on big servers the owner is not cached so i have the fetch

earnest phoenix
#

you got told

#

fetchUser returns a promise

cobalt mesa
#

yes

earnest phoenix
#

await it or resolve it outside of the embed

cobalt mesa
#

.addField("Propriรฉtaire du serveur", await message.guild.fetchMember(message.guild.owner.user).tag) like this ??

#

and else how resolve it outside of the embed please @earnest phoenix

#

sorry for my questions but I never used fetch

wheat jolt
#

you don't have to fetch it

#

just use message.guild.owner.user.tag

#

lol

earnest phoenix
#

the owner is uncached in big guilds

wheat jolt
#

ah

cobalt mesa
#

yes but on big servers the owner is uncached and i don't get him

earnest phoenix
#

also loon, yes except you need to incase the await part in (), (await myAsyncMethod()).property

#

@wheat jolt #commands owner.user.tag undefinied

#

to get it outside of the embed you can also await it or you can use then(func)

cobalt mesa
#

oh ok

#

just I didn't understand when you say that I have to put in () can you explain again please

earnest phoenix
#

you have to incase the await invocation in () because otherwise you would be calling the property on the promise itself
await method().property you would be calling property on the promise

(await method()).property you would be calling property on the object the promise returns

cobalt mesa
#

ah yes

#

in my case like that suddenly (await message.guild.fetchMember(message.guild.owner.user)).tag

earnest phoenix
#

well

#

you can't access the owner object because the owner is not cached

#

use ownerID

cobalt mesa
#

(await message.guild.fetchMember(message.guild.ownerID)).tag ??

earnest phoenix
#

no

twilit rapids
#

without .user and capitalise the D

cobalt mesa
#

i edited the message

#

it return again undefined

earnest phoenix
#

because it returns a GuildMember

#

user property and then tag property

cobalt mesa
#

(await message.guild.fetchMember(message.guild.ownerID)).user.tag

earnest phoenix
#

yup

cobalt mesa
#

i got this error when i test on this server
(node:1015) UnhandledPromiseRejectionWarning: Error: Invalid or uncached id provided. at Guild.fetchMember (/rbd/pnpm-volume/b0f90734-0105-435a-affc-58be85749d40/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/structures/Guild.js:653:38)

#

a solution ??

prisma lion
#

how to add time stamp to cmds

muted junco
#

to the embed?

cobalt mesa
#

yes

west raptor
#

@cobalt mesa well read the error

#

it's an invalid/uncached ID

cobalt mesa
#

yes but how to correct this

earnest phoenix
#

is your only goal here to get the owner's tag?

west raptor
#

Guild#owner exists I think?

earnest phoenix
#

jesus christ

#

read above

quartz kindle
#

@cobalt mesa it appears there is a bug in djs stable

#

you need to fetchUser from the client

cobalt mesa
#

tag and avatarUrl but if i know how to get the tag it same for avatarUrl

quartz kindle
#

fetchMember wont work

#

the fetchMember method sends the input to the userResolver, which has this line: if (typeof user === 'string') return this.client.users.get(user) || null;

#

so the resolver returns null, because the user is not cached

#

which then gets rejected here

#
    user = this.client.resolver.resolveUser(user);
    if (!user) return Promise.reject(new Error('Invalid or uncached id provided.'));```
cobalt mesa
#

ah ok thanks

#

fetchMember is for the guild and fetchUser for the client ??

quartz kindle
#

so try using client.fetchUser(guild.ownerID)

#

yup

#

it returns a user object tho, not a member object

#

if you need the actual member object, you can then get it from the guild after fetching it

cobalt mesa
#

.addField("Propriรฉtaire du serveur", (await bot.fetchUser(bot.guild.ownerID)).user.tag) like this ??

quartz kindle
#

get the guild from the message

#

no need for .user

#

its already a user

prisma lion
#

mm time stamp to embed

#

...

#

how?

#

or cmd

west raptor
#

RichEmbed#setTimestamp iirc

quartz kindle
cobalt mesa
#

.addField("Propriรฉtaire du serveur", (await bot.fetchUser(message.guild.ownerID)).user.tag) ??

slender thistle
#

Looks good

quartz kindle
#

no need for user

cobalt mesa
#

why

quartz kindle
#

fetchUser returns a user

cobalt mesa
#

ah ok i don't see

#

ownerID is undefined

quartz kindle
#

well thats weird

#

is the guild unavailable?

#

console.log(message.guild.available)

cobalt mesa
#

it's available since it is server

quartz kindle
#

did you try doing the console.log?

#

does it show true?

cobalt mesa
quartz kindle
#

and message.guild.ownerID ?

#

still undefined?

cobalt mesa
quartz kindle
#

then its correct lol

#

whats not working?

cobalt mesa
#

ah sorry i have miss the change client into message ๐Ÿ˜…

#

in any case thank you very much because it's been several days that I was looking for how to do and there you just solve my problem so thank you very much

quartz kindle
#

๐Ÿ‘

cobalt mesa
#

the owner has no avatar ??

earnest phoenix
#

it's possible

cobalt mesa
earnest phoenix
#

you shouldn't make so many requests

cobalt mesa
#

ah sorry

earnest phoenix
#

let myvar = await ...
and then you can use the object from there

#

outside of the embed that is

cobalt mesa
#

ok

surreal sage
#

idk but if i specify a user it wont react or do anything ```js
if (command === "warn") {
if (!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You don't have permission!");
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if (!rUser) return message.channel.send("Please provide a valid Ping or user id");
let repCH = message;
let reason = args.join(" ").slice(22);

        let reportEmbed = new Discord.RichEmbed()
            .setTitle("Warnings")
            .setColor("#15f153")
            .addField("Warned User", `${rUser} with ID: ${rUser.id}`)
            .addField("Warned By", `${message.author} with ID: ${message.author.id}`)
            .addField("In channel", repCH.channel)
            .addField("Time", repCH.createdAt)
            .addField("Reason", reason)

        let channel = message.guild.channels.find(ch => ch.name === 'logs');

        if (!channel) {
            message.channel.send("Can't find a 'logs' channel.");
            return;
        }

        message.delete().catch(O_o => { });
        channel.send(reportEmbed);
    }```
unique nimbus
#

what

surreal sage
#

if i specify a user like @this#0000 it wont work

#

no reacts or something

#

nvm

sudden geyser
#

.catch(O_o => { }) KarenWhat

west raptor
#

anybody know what's causing this? it's giving little information so I really don't know why

#

nixos in nix-shell, here's my shell.nix if it helps ```nix
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
with nixpkgs;
stdenv.mkDerivation {
name = "universe";
buildInputs = [
# Rust
nixpkgs.latest.rustChannels.stable.rust

    # Stuff that rust sometimes need
    pkgs.gcc
    pkgs.binutils
    pkgs.openssl
];

}```

flint scaffold
#

how do i print a list of members with a certain role? (JavaScript)

twilit rapids
#

what lib

west raptor
#

turns out it was an issue on how I basically copied the target dir from my arch install to nixos which nix didnt like

#

running cargo clean then building again seems to have fixed it

summer torrent
#

How to get value from <input> tag using querySelector ? (html)

quartz kindle
#

just select it using the element/class/id/whatever

#

then use .value

#

unless you dont know how to use querySelector at all

surreal sage
#

it should change the status type but it does not js if (command === "setmode") { if(message.author.id !== botConfigs.ownerID) return; let args = message.content.split(' ').splice(1).join(' ') if(args !== "online") { client.user.setStatus('online') } else if(args !== "dnd") { client.user.setStatus('dnd') } else if(args !== "idle") { client.user.setStatus('idle') } else if(args !== "invincible") { client.user.setStatus('invincible') } const e = new Discord.RichEmbed() .setTitle('Status Mode Set!') .setColor('#ff1493') message.channel.send(e) }

quartz kindle
#

!== means NOT EQUAL

earnest phoenix
#

also you should use switch

surreal sage
#

oops

#

===

#

=== good right?

vital lark
#

yes

surreal sage
#

but it does not work

vital lark
#

=== is a strict equality

surreal sage
#

no error

vital lark
#

show

surreal sage
west raptor
#

@surreal sage as cry suggested with that many else ifs you should use switch

flint scaffold
#

how do i print a list of members with a certain role? (JavaScript)

west raptor
#

discord.js?

#

also are you going off role name or role id

vital lark
#

@flint scaffold Eris or discord.js

flint scaffold
#

discord.js im quite sure

vital lark
#

well

#

you have to filter if the members has the role using Array#filter and then mapping by a string and then join it

west raptor
surreal sage
#

u don't need it anymore

#

it's fixed

#

i*

grizzled raven
#

nvm

trim saddle
#

@cobalt mesa because it's avatarURL

trail reef
#

Tries to add feature that requires new module

#

Bot won't run, module not found error

#

Sudo previously required for it to run properly for some reason

#

Fixed it by removing sudo

#

mfw I fixed my bot by not running it as root

earnest phoenix
#

Is it just me who is experiencing MongoDB issues? Because if I do many commands that update the collection quickly, it will delete all the documents excluding the id but it changes the id from a String to a ObjectID.

polar flower
#

Are there currently problems with vServers located near Frankfurt am Main? My bot is on a vServer there and does not play any music, i.e. it cannot enter the channel, it tries again and again, as if the internet connection was too weak.

earnest phoenix
#

How to make a prefix non-case sentivite? (my prefix is 'eevee', and i want 'Eevee' to work too)

zealous veldt
#

-moreinfo

gilded plankBOT
#

If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.

earnest phoenix
#

(discord.js)

mossy vine
#

how do you handle that prefix right now

earnest phoenix
mossy vine
#

in the if statement do if (!message.content.toLowerCase().startsWith(prefix))

earnest phoenix
#

Oh

#

Thx

mossy vine
#

that gets rid of case sensitivity in the prefix

#

so eEvEE will work too

wispy vine
#

guys i know this is rly stupid but how do you use pip to get discord.py on windows? i got a fresh copy of python 3.8 and pip comes with it. (write @wispy vine so I can see it)

twilit rapids
modest maple
#

Just a brief note: I wouldn't advise using 3.8 just yet as alot of modules arnt yet compatible with it as of now maybe wait a little longer till using 3.8 and instead use 3.7

grizzled raven
#

@earnest phoenix do message.content.toLowerCase().startsWith(prefix.toLowerCase())

earnest phoenix
#

Already done lel

#

And it works

grizzled raven
#

well if the prefix was Eevee, it wouldnt work

#

that is, if your bot allowes changing prefixes per server

#

__

#

anyway, which would be faster, or better, a Set, or a discord collection?

earnest phoenix
#

The prefix is 'eevee'

vital lark
#

collection

#

set isn't really useful for command storage

earnest phoenix
#

And 'Eevee', 'EEVEE', 'eEvEe'... Works

grizzled raven
#

ok thank

#

and, just saying, if the prefix was Eevee, it wouldnt work

#

but wh

#

doesnt matter

slender thistle
#

@modest maple use 3.6 ftw

modest maple
#

im 3.7

#

but i noticed alot of modules dont yet support 3.8

#

alot of google's modules dont work either

slender thistle
#

Should probably get to 3.7 some time soon

modest maple
#

Not much rlly changed

#

3.8 added the walrus operator which has protentially effected alot of modules

#

My friend found out the hard way after updating to find tensor flow stopped working

slender thistle
#

Oof

compact raft
#

hi

fluid basin
#

hey, do you need anything?

compact raft
#
bot.on('message', message => {
    if (message.content.startsWith('/dm ') && message.mentions.users.size) {
        var v=message.toString().split(' ').shift().shift().join(' ') // Takes the DM content from the message
        var member=message.mentions.users[0] // The mentioned user
        member.send(v) // send that user a DM
    }
})

i'm using this code but message not sent!

#

when i say
/dm @granite pagoda test message

then nothing sent?

vital lark
#

in the if statement, ur checking if /dm and any users are mentioned

#

maybe remove && message.mentions.users.size and make another if statement if any mentions of a user are specified in the if statement that is checking if the command is in the message content

compact raft
#

can u provide example code

#

because i'm totally confused in

vital lark
#

I'm not gonna spoonfeed you

compact raft
#

no not at all

vital lark
#

well, what I am saying is

compact raft
#

if idk then?

vital lark
#

in the if statement you provided (if (message.content.startsWith('/dm ') && message.mentions.users.size)), you're checking if the command is "/dm" and if a user is mentioned

#

I'm saying is add another if statement if there is no mentioned users after the if block

late hill
#

That doesn't matter

compact raft
#

but if user mensioned then ?

late hill
#

What's message.mentions.users

#

You're using discord.js

#

?

compact raft
#

Yes

late hill
#

Should be a Collection

#

an extended map basically

#

I don't think you can index the map the way you're trying

#

Try logging message.mentions.users[0]

#

And you'll probably see the issue

summer torrent
#

@compact raft try message.mentions.users.first()

surreal sage
#

how to get a emoji id with :emoji:<idthing>

mossy vine
#

:emoji:

#

oops

surreal sage
#

from a other server

mossy vine
#

\:emoji:

surreal sage
#

idts

#

there should be a id like

mossy vine
#

<:emoji:id>

surreal sage
#

thx

#

id is server id right?

#

@mossy vine

mossy vine
#

no

#

emoji id