#development

1 messages ยท Page 1012 of 1

kind sedge
#

hehee

restive pebble
#

I have heard these

lusty quest
#

this is why free hosters suck

restive pebble
#

From many guys

delicate shore
#

ahj

kind sedge
#

I need vps lol

delicate shore
#

someone suggest mes vps

restive pebble
#

Fuck u glitch

lusty quest
#

if you have a proper vps run 1 command and you have all modules you wanted

restive pebble
#

I need vps lol
@kind sedge buy one then KEKW

kind sedge
#

Suggest me one

delicate shore
#

oh

kind sedge
delicate shore
#

now glitch server down

lusty quest
#

digitalocean

restive pebble
#

Victory royale

lusty quest
#

you can get one with node preinstalled

restive pebble
#

All games won

delicate shore
#

what is DBL comp?

#

ok

#

now it says no error

kind sedge
#

lol

delicate shore
#

Help me

#

again

lusty quest
#

what message?

restive pebble
#

Error

lusty quest
#

hmm yess the floor is made of floor

restive pebble
#

Yeah

delicate shore
#

Index Code -

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);
}```

Reddit.js code
```js




const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const { Command } = require('discord.js-commando');

module.exports = class RedditCommand extends Command {
  constructor(client) {
    super(client, {
      name: 'reddit',
      aliases: ['subreddit', 'reddit-search'],
      group: 'other',
      memberName: 'reddit',
      description:
        'Replies with 10 top daily posts in wanted subreddit, you can specify sorting and time',
      throttling: {
        usages: 2,
        duration: 10
      },
      args: [
        {
          key: 'subreddit',
          prompt: 'What subreddit would you like to search?',
          type: 'string',
          default: 'all',
          max: 50,
          wait: 20
        },
        {
          key: 'sort',
          prompt:
            'What posts do you want to see? Select from best/hot/top/new/controversial/rising',
          type: 'string',
          default: 'top',
          validate: function(sort) {
            return (
              sort === 'best' ||
              sort === 'hot' ||
              sort === 'new' ||
              sort === 'top' ||
              sort === 'controversial' ||
              sort === 'rising'
            );
          },
          wait: 10
        }
      ]
    });
  }};```

reddit command code 
```js
if(command === "reddit"){
    bot.commands.get('reddit')
  };```
#

now what is wrong here

digital wagon
lusty quest
#

what does the error say

delicate shore
#

this

earnest phoenix
delicate shore
#
    at Client.emit (events.js:196:13)
    at MessageCreateAction.handle (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
    at WebSocket.onMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/node_modules/ws/lib/event-target.js:125:16)
    at WebSocket.emit (events.js:196:13)
    at Receiver.receiverOnMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/node_modules/ws/lib/websocket.js:800:20)
(node:11714) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a ```
#

this also (node:11714) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'execute' of undefined

restive pebble
lusty quest
#

you have somewhere a error in a command

delicate shore
#

oh

#

can u scroll up and see

restive pebble
#

That error is not full

#

Do one thing

#

Copy the first paragraph

delicate shore
#

of?

#

of?

restive pebble
#

Error

delicate shore
#

wait

#

lemme clear the log

#

and run command again

#
at Client.<anonymous> (/app/index.js:246:31)
    at Client.emit (events.js:196:13)
    at MessageCreateAction.handle (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
    at WebSocket.onMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/node_modules/ws/lib/event-target.js:125:16)
    at WebSocket.emit (events.js:196:13)
    at Receiver.receiverOnMessage (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/node_modules/ws/lib/websocket.js:800:20)
(node:11714) 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: 4)```
#

@restive pebble this is the whole error

lusty quest
#

what happens in line 246 in your /app/index.js

restive pebble
#

:O

delicate shore
#

wait

restive pebble
#

It's where u executing

#

Fix

delicate shore
#
  if(command === "reddit"){
    bot.commands.get('reddit').execute(msg, args);
  }
#

oh

#

why tf i did that

restive pebble
#

Undefined

delicate shore
#

now

restive pebble
delicate shore
#

should i remove it

restive pebble
#

Then how will u execute

delicate shore
#

hmmmm

#

m

#

then?/

#

wait

#

ssee

#

thsubd

#

this*

lusty quest
#

rename your Reddit.js to reddit.js

delicate shore
#

it is already

#

reddit.js

#

not Reddit

restive pebble
delicate shore
#

const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const { Command } = require('discord.js-commando');

module.exports = class RedditCommand extends Command {
  constructor(client) {
    super(client, {
      name: 'reddit',
      aliases: ['subreddit', 'reddit-search'],
      group: 'other',
      memberName: 'reddit',
      description:
        'Replies with 10 top daily posts in wanted subreddit, you can specify sorting and time',
      throttling: {
        usages: 2,
        duration: 10
      },
      args: [
        {
          key: 'subreddit',
          prompt: 'What subreddit would you like to search?',
          type: 'string',
          default: 'all',
          max: 50,
          wait: 20
        },
        {
          key: 'sort',
          prompt:
            'What posts do you want to see? Select from best/hot/top/new/controversial/rising',
          type: 'string',
          default: 'top',
          validate: function(sort) {
            return (
              sort === 'best' ||
              sort === 'hot' ||
              sort === 'new' ||
              sort === 'top' ||
              sort === 'controversial' ||
              sort === 'rising'
            );
          },
          wait: 10
        }
      ]
    });
  }};```
#

this is code

#

of reddit

restive pebble
#

Yeh

delicate shore
#

so

#

what should i do ?

#

๐Ÿ˜ฆ

#

๐Ÿ˜ข

#

when you don't have nitro can you cannot use cry emoji even

restive pebble
delicate shore
#

pls help

#

boieng

restive pebble
#

Lemme see

delicate shore
#

oekoekoeko

#

thnx

restive pebble
#

Send the screenshot of all ur files

#

List

#

The side bar

delicate shore
#

no

#

wait

#

@restive pebble

restive pebble
#

Ur commands code wrong

#

Use paste bin like services

#

And send server.js

delicate shore
#

what?

#

What u mean

restive pebble
#

How u defined commands

delicate shore
#

wait see this

restive pebble
#

bot.commands

#

How u defined bot.commands

delicate shore
#
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);
}
#

seee ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#

why laugh?

#

@restive pebble

restive pebble
#

Guess what

#

@pale vessel

pure lion
#

Flamzipe

delicate shore
#

what

restive pebble
#

Help him flazepe

delicate shore
#

@pale vessel

#

plspslpslspls

pure lion
#

Oh collection is captial C

delicate shore
#

oooo

#

@pure lion

#

what to don

pure lion
#

Mm

delicate shore
#

of

#

that execute

pure lion
#

What

delicate shore
#

f

#

@restive pebble ๐Ÿ˜ข

#

Pl

#

s

#

s

pure lion
#

Does it not work

delicate shore
#

nono

#

no

#

no

pure lion
#

Error?

delicate shore
#

see

#

this is whole code

#

@pure lion

#

SEE^^^^^

pure lion
#

Go to where it's undefined

pale vessel
#

what happened

golden condor
#

@delicate shore pls use hastebin

delicate shore
#

kokokok

pure lion
#

^

delicate shore
#

ok

pale vessel
#

holy that structure looks like straight out from xiao nah, just traditional commando command structure

restive pebble
#

Lol

delicate shore
#

and error

golden condor
#

ty

delicate shore
#

wlcm

honest perch
#

There's an error in your code

delicate shore
#

whiche one

honest perch
#

Yes

delicate shore
#

command handler
reddit.js
execution command?

#

which one?

honest perch
#

Yes

delicate shore
#

what

#

๐Ÿ˜ฆ

#

@honest perch ๐Ÿ˜ข

honest perch
#

@quartz kindle help this human

delicate shore
#

pls

#

:(((

winter basalt
#

is tim dbl's stackoverflow professional

earnest phoenix
#

its so funny when ppl want help for their pasted code

delicate shore
#

^^^^^^^
No i watched tutorial of code lyon

honest perch
#

@winter basalt yes

delicate shore
#

@earnest phoenix

honest perch
#

Tim should be hired by dbl to be the code master

delicate shore
#

@golden condor did u saw it?

golden condor
#

what

delicate shore
#

the link

#

you said

pure lion
#

Tim is big brain

delicate shore
#

@pure lion did u find

#

solution

honest perch
#

Learn js

#

Thats the solution

delicate shore
#

@honest perch pls tel me one thing

honest perch
#

Learn js

delicate shore
#

why are u rude

#

:((

winter basalt
#

he isnt even being rude

honest perch
#

I'm being honest

#

You should learn the language before you try to make a bot

winter basalt
#

its just straightforward suggesting you to learn js

#

before you make a bot

delicate shore
#

noone helps me

#

i read the docs before starting to built a bot

#

build

restive pebble
#

ok

#

now

#

send the link

delicate shore
#

but there were no things

#

related to this

restive pebble
#

it will take me 30 min

delicate shore
honest perch
#

It's basic js

restive pebble
#

to respond

#

and solve

honest perch
#

It states the error clearly

delicate shore
#

It's basic js
@honest perch no see the code first

restive pebble
#

i will dig ur code

delicate shore
#

It states the error clearly
@honest perch ik

#

but

restive pebble
#

wait 30 mins

delicate shore
#

how to fix that

#

that idk

#

ok

#

ok

restive pebble
#

or 15 mins

honest perch
#

TypeError: Cannot read property 'execute' of undefined

restive pebble
#

ok reading now

delicate shore
#

yes

honest perch
#

That's your error

delicate shore
#

yes

#

because i watched code lyon on yooutube

#

i did what he did

#

and i am getting errroir

#

of execute

#

the difference

#

is

#

he just told the command handler

#

things

honest perch
#

Dont copy videos

delicate shore
#

there is no better way

#

to learn js

honest perch
#

Lies

winter basalt
#

copying videos is the worst way of learning

delicate shore
#

except paid courses

lusty quest
#

i learned js from reading sourcecode in github

honest perch
lusty quest
#

also learning coding got in the past years many free ways

#

its not like the late 90s or early 2000s where the internet was still growing

restive pebble
#

i think i got ur error

#

pls allow some time

delicate shore
#

ok

restive pebble
#

i dont think

#

could u try .exec instead of execute

#

or .run

delicate shore
#

ok

#

but @restive pebble what shoul i do afterhat

#

like

restive pebble
#

tho is undefined

#

wait

delicate shore
#

.exec('here?')

restive pebble
#

wait

delicate shore
#

ok

restive pebble
#

can u send

#

the excute part

#

where u execute ur command

delicate shore
#

ok

#

if(command === "reddit"){
bot.commands.get('reddit')
};

restive pebble
#

yes

#

reddit.js

#

try

#

u didnt split

#

.

#

reddit.js

#

if(command === "reddit"){
bot.commands.get('reddit.js')
};

#

then execute

lusty quest
#

WTFรŸ

restive pebble
#

then again it will throw error

#

ha ha lol

#

@delicate shore try this

#
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for (const file of commandFiles){ const command = require(`./commands/${file}`);
let commandlocation= `./commands/${file}` bot.commands.set(command.name , commandlocation); }```
#

this will give error

delicate shore
#

ok

#

ao

restive pebble
#

execute is not a function

#

but try

#

first

delicate shore
#

unexcpeced token bot

restive pebble
#

where lol

delicate shore
#

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for (const file of commandFiles){ const command = require(./commands/${file});
let commandlocation= ./commands/${file} bot.commands.set(command.name , commandlocation); }

restive pebble
#

screenshot error

feral aspen
#

Hello Coders.

restive pebble
#

hi

#

oh oh

#

wait

feral aspen
#

Does anyone know how to do the highlighted red text thing

restive pebble
#

how u defined client

#

html?

feral aspen
#

Yes.

#

how do you do the red thing

#

yes.

#

Can you send me the script with a simple word in it?

restive pebble
delicate shore
#

@restive pebble onst client = new Discord.Client()

restive pebble
#

so change to client

#

bot --> client

delicate shore
#

still

#

says unknown

#

token

#

client

feral aspen
#

wait no @restive pebble

delicate shore
#

you mean on top.gg site? @feral aspen

feral aspen
delicate shore
#

like your bot info?

feral aspen
#

Yes.

delicate shore
#

that

feral aspen
#

Like in the picture

#

the red thing

delicate shore
#

in the terminal

#

you have to write

#

same code

#

like

#

<pstyle or whatever

#

in the black terminal

feral aspen
#

can you send me an example.

delicate shore
#

wait a sec

restive pebble
#

send ur full code

delicate shore
#

me?

restive pebble
#

yes

delicate shore
#

wait

#

in dms

restive pebble
#

orelse i cannot help

#

yea

delicate shore
#

@restive pebble your dms close

feral aspen
#

can anyone send me the code for the red text in the pic please?

delicate shore
#

yes one min

#

hammod one min

feral aspen
#

Ok @delicate shore ๐Ÿ™‚

restive pebble
#

ok wait

#

now send

delicate shore
#

ok

#

@feral aspen see this

#

Here insert code from link of

#

Here

#

@feral aspen ok?

pure lion
#

Suuuup

delicate shore
#

Supppp

pure lion
#

Ssssssup

#

You get fixed?

delicate shore
#

Sup

#

No

#

Boeing is helping me now

pure lion
#

Ball

#

Ok

#

Dm me the glitch link again

delicate shore
#

You are still there

#

In the project

#

I never kicked ya

pure lion
#

Not on my pc

#

Uh

delicate shore
#

Ok

feral aspen
#

@feral aspen ok?
@delicate shore I know

#

but when i insert it

#

it doesnt look the same.

#

it just puts red text only.,

#

but in the pic.. its looks different.

#

its like thin red and highlighted gray and stuff.

#

how do i do that.

spare mirage
#

can u make a !help command that automatically updates?

#

and what if I make new folders in my command folder to make the commands more organised

#

will they still get executed?

earnest phoenix
#

what is shards and what do they do and do you need to pay?

lusty quest
#

you need them if your bot reaches 2500 guilds

earnest phoenix
#

ok

#

but what do they do?

lusty quest
#

and they are free (but need more resources from your VPS)

#

they split the bot in mutiple Instances that can communicate with each other

earnest phoenix
#

huh

lusty quest
#

each shard can hold 2500 Guilds

earnest phoenix
#

ok

#

what happens when you dont shard?

lusty quest
#

the bot wont login

earnest phoenix
#

oof

spare mirage
#

hey

pale vessel
#

you would need to create multiple shards once your bot reaches more than 2.5k servers

restive pebble
lusty quest
#

@spare mirage you need to change your command loader

restive pebble
#

why tho discord prevents login without shards

lusty quest
#

but it can work

#

it prevents if you are over 2500 Guilds

restive pebble
#

yeah ik

lusty quest
#

bcs everything above wont get a instance

restive pebble
#

oh

spare mirage
#
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);
}

what do I change?

lusty quest
#

make it to take the new folder with into account

earnest phoenix
#

wait in html what is best place to put text?

spare mirage
#

do I make a new const?
const fun = require(`./commands/fun${file}`);

lethal pine
#

how much time it will take to verify my bot ?

spare mirage
#

2-3 weeks

lethal pine
#

ok

spare mirage
#

U need ur bot to be online alot though

#

so they can test i t

lethal pine
#

done

spare mirage
#

๐Ÿ‘

earnest phoenix
#

@lethal pine your bot

low phoenix
#

How could I then set the bot status to how many servers it is on?

lethal pine
#

yup @earnest phoenix

earnest phoenix
#

@lethal pine your bot name

lethal pine
#

@earnest phoenix OMG

earnest phoenix
spare mirage
#

@low phoenix u make a var:
var scount = bot.guilds.cache.size

earnest phoenix
#

You ideate

indigo folio
#

@low phoenix are you using discord.js?

low phoenix
#

yes

indigo folio
#

then follow @spare mirage's instructions

earnest phoenix
#

whats the best place to but text in html?

plucky harness
#

getting this error when trying to connect to postgressql on a remote server i have already edited the .conf files

#
Is the server running on host "blah blah "and accepting
TCP/IP connections on port 5432?```
honest perch
#

@earnest phoenix huh

earnest phoenix
#

html

lusty quest
#

@plucky harness self hosted DB?

plucky harness
#

no

honest perch
#

what about html

plucky harness
#

vps

lusty quest
#

then its self hosted if you installed it yourself

plucky harness
#

nanu

earnest phoenix
#

what about html
@honest perch smh i did say that

lusty quest
#

did you got a firewall up?

plucky harness
#

ye

honest perch
#

i dont understand what "place to but text in html?" means

plucky harness
#

but i allowed through post 5432

lusty quest
#

allow the port of the bot if the connection is extern

#

tcp?

plucky harness
#

tcp?

lusty quest
#

did you use correct authentification?

plucky harness
#

yes

#

autentication details right?

lusty quest
#

there is something wrong either with the authentification or your setup

earnest phoenix
plucky harness
#

how do i fix it

earnest phoenix
lusty quest
#

idk i never used postgres

plucky harness
#

i have been gettin same error

#

for past 2 days

lusty quest
#

i have no idea, sadly. maybe you find somewhere a 7 years old stackoverflow page with the issue

#

and a possible solution

#

(happened to me a few times)

short siren
#

@plucky harness I had that issue before

plucky harness
#

o yes

#

how did u fix it

short siren
#

cant remember :p pretty sure the server isnt running or

plucky harness
short siren
#

The like data your using to connect to it is wong

#

Show the object

plucky harness
#

server isnt running?

lusty quest
#

check if the service is running

plucky harness
#

its a vps so its running atm

#

service is on auto start

lusty quest
#

check if the service is running

#

maybe it failed to start

short siren
#

Are you using the nodepg package to access the database or

plucky harness
#

wtf

#

port is 5433

short siren
#

That's default for postgree

#

s

plucky harness
#

5432 is

nocturne grove
#

Can anybody explain why this is giving a random order?

guild.channels.cache.sort((c1, c2) => c1.name - c2.name).map(c => c.name);```
(I know I can map first and then sort, but I need the channel objects + that doesn't work either)
lusty quest
#

run it async

spare mirage
pale vessel
#

Can anybody explain why this is giving a random order?

guild.channels.cache.sort((c1, c2) => c1.name - c2.name).map(c => c.name);```
(I know I can map first and then sort, but I need the channel objects + that doesn't work either)

@nocturne grove what are you doing

nocturne grove
#

Idk if the async reaction was for me, but that does not seem to work

lusty quest
#

@spare mirage missing )

pale vessel
#

what are you trying to do

quartz kindle
spare mirage
#

Why do I have an error at the else

nocturne grove
#

I want the channels to be in alphabetical order according to their counter_name property, but for the question I'm using the name property

#

will try Tim

pale vessel
plucky harness
#
#   auto: automatically start the cluster
#   manual: manual startup with pg_ctlcluster/postgresql@.service only
#   disabled: refuse to start cluster
# See pg_createcluster(1) for details. When running from systemd,
# invoke 'systemctl daemon-reload' after editing this file.
``` found this log file
nocturne grove
#

doesn't work too

plucky harness
#

is this problem? @short siren

nocturne grove
#

@pale vessel according to w3schools not

#

why is stuff never working for me ๐Ÿ˜ข

pale vessel
#

mine works fine using that method

quartz kindle
#

flazepe is correct

pale vessel
quartz kindle
#

you can also use localCompare

spare mirage
#

  module.exports = {
    name: 'kick',
    description: "this is a kick command!",
    execute(Discord, bot, message, args){
        if (msg.member.hasPermission("KICK_MEMBERS")) {
            if (message.members.mentions.first()) {
                try {
                    msg.members.mentions.first().kick();
                } catch {
                    msg.reply("I do not have permissions to kick " + msg.members.mentions.first());
            }else {
                msg.reply("You do not have permissions to kick " + msg.members.mentions.first());
        }
       


      
    }
}}```
Im getting an error at `else` can anyone explain?
nocturne grove
#

so w3schools is wrong?

pale vessel
#

this is mine

quartz kindle
#

its not wrong, they dont show any advanced sorting with strings

short siren
#

Show code

quartz kindle
#

their alphabetical example is just .sort()

lusty quest
#

@spare mirage else is on the wrong } bracket

#

you run it on the catch block not the if block

pale vessel
#

by the way does case matter?

plucky harness
#

its not mine but

nocturne grove
#

no for me case doesn't matter

pale vessel
#

can i remove toLowerCase() safely? @quartz kindle just checked and the answer is no

plucky harness
#
host    all             all             127.0.0.1/32            md5
host    all             all             192.168.190.0/24        md5``` what does /24 or /32 indicate
nocturne grove
#

their alphabetical example is just .sort()
@quartz kindle but that's the same as I want, right?

plucky harness
#

it not mine

lusty quest
#

the size of the subnet @plucky harness

plucky harness
#

how would i chcek mine?

quartz kindle
#

@spare mirage you're basically doing try {} catch {} else {

spare mirage
quartz kindle
#

which is incorrect

lusty quest
#

@spare mirage yes

quartz kindle
#

yes, that looks better

spare mirage
#

:D

#

can anyone come in my server to test it?

small prairie
#

I have a weird feeling that .sort wont work exactly the way you are thinking it would due to categories and there names too

quartz kindle
#

@nocturne grove their alphabetical example assumes an array of strings, which will work if you map them first before using sort

short siren
#

@spare mirage If you aren't using stuff passed to the function put underscore before it

spare mirage
#

?

nocturne grove
#

oh okay thanks both

#

@pale vessel, your example doesn't sort aa ab ac, right? It only looks at the first char

pale vessel
#

it does

#

actually, i'm not even sure lmao

nocturne grove
#

oh I'm blind

#

I thought you used charAt(0) somewhere

quartz kindle
#

it doesnt extract the first char, just makes the entire string lowercase

#

case matters when sorting, because sorting strings takes each character's ascii code points

nocturne grove
#

capital comes before non-capital or not?

spare mirage
#
 execute(Discord, bot, message, args){
        if (message.member.hasPermission("KICK_MEMBERS")) {
            if (message.members.mentions.first()) {
                try {
                    message.members.mentions.first().kick();
                } catch {
                    message.reply("I do not have permissions to kick " + message.members.mentions.first());
                }
        }else {
            message.reply("You do not have permissions to kick " + message.members.mentions.first());
       


      
    }
}}}

TypeError: Cannot read property 'mentions' of undefined

earnest phoenix
#

@quartz kindle Could you help me with this database thing im having trouble with?

nocturne grove
#

other way around @spare mirage

#

message.mentions.members.first()

quartz kindle
#

uppercase chars are from 65-90, lowercase are from 97-122

nocturne grove
#

okay thanks

spare mirage
#

thanks

quartz kindle
#

@earnest phoenix what database thing

earnest phoenix
#

Its with MongoDb

#

and its saying collection is undefined

pale vessel
earnest phoenix
#

(node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined

pale vessel
#

interesting

earnest phoenix
#
  bot.prefix = "d-";
const find = await bot.db.collection("Deku-DB").findOne({"g_id":message.guild.id});
if (find && find.prefix) bot.prefix = find.prefix;
if(message.content == "@void zenith") 
{
  message.channel.send(`My prefix is \`\`` + bot.prefix + `\`\` for this guild!`)
};
``` my code
#
bot.on("ready", async () => {
let mongoDB = await MongoClient.connect(`URL`).catch(console.error)
console.log("Connected to Mongo")
bot.db = await mongoDB.db("Deku-DB")
})
#

@quartz kindle ^^

quartz kindle
#

the collection code is inside the message event?

#

which mongo lib?

earnest phoenix
#

the top code is in the message event

#

which mongo lib?
@quartz kindle ?

pale vessel
#

isn't it createConnection?

quartz kindle
#

which npm library are you using to interact with mongodb

earnest phoenix
#

discord js

pale vessel
#

MongoClient so i'm assuming mongodb

quartz kindle
#

the mongo library

earnest phoenix
#

mongoDB

quartz kindle
pale vessel
#

tim i have betrayed sql and moved to mongo today

#

couldn't help it

small prairie
#

Lmao

#

I use both

pale vessel
#

mongoose is too good

quartz kindle
#

lmao

small prairie
#

True

#

Its clean

quartz kindle
#

i find mongoose confusing af

#

i dont like schemas

earnest phoenix
pale vessel
#

sql is still good

#

i find mongo more convenient to use

small prairie
#

I use JSON

#

I have a friend who used .txt databases

quartz kindle
#

nice

#

@earnest phoenix can you console.log(bot.db)?

earnest phoenix
#

ok

uncut vortex
#

Anyone know how to give a user a role when someone @ them ive been having problems with it

small prairie
#

message.mentions.has afaik

#

i dont exactly know what you mean tho can you elaborate tat

#

that

restive pebble
#

lol .txt

small prairie
#

i still find it hard to believe ;-;

#

.txt databases tf

restive pebble
#

yeah

earnest phoenix
#

@quartz kindle i doesnt log

small prairie
#

It must log something
Maybe an undefined

quartz kindle
#

does "connected to mongo" log?

earnest phoenix
#

?

#

uhh no

quartz kindle
#

no errors?

earnest phoenix
#

only the collection aint define

#

defined

#

undefined

#

or smth

#

(node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined

quartz kindle
#

add a ready check on the beginning or the ready event

#

console.log("ready") in your ready event

earnest phoenix
#
(node:4) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
MongoNetworkError: failed to connect to server [cluster0-shard-00-01.6guyy.azure.mongodb.net:27017] on first connect [MongoNetworkError: connection 5 to cluster0-shard-00-01.6guyy.azure.mongodb.net:27017 closed
#

console.log("ready") in your ready event
@quartz kindle ok

#

where about? first or last

quartz kindle
#

there you go lol

#

MongoNetworkError: failed to connect to server

earnest phoenix
#

ok?

#

but i put a valid url

quartz kindle
#

try with unified topology

earnest phoenix
#

where would i put that?

plucky harness
#

so do i have to use tmux to run bot 24x7?

#

on ubuntu vps

quartz kindle
#

.connect(url,{useUnifiedTopology:true})

earnest phoenix
#

ok

quartz kindle
#

@plucky harness many things you can use

plucky harness
#

whats the best

quartz kindle
#

tmux and screen are terminal layers, they keep a terminal window open in the background
pm2 and nodemon are process managers, they manage the process for you

#

then you also have containers like docker and kubernetes

#

i personally use pm2

plucky harness
#

pm2 is not good for python it works great with java

earnest phoenix
#

@quartz kindle now its just saying collection undefined

quartz kindle
#

any network error?

earnest phoenix
#

no

quartz kindle
#

or any log at all

earnest phoenix
#

no mongodb connected thing

quartz kindle
#

show full logs

pale vessel
#

ใƒ‚dใƒจใ‚ฆ

#

oh shit

earnest phoenix
#

show full logs
@quartz kindle how

quartz kindle
#

idk take a pic, or copy and paste

#

everything you see from bot start until now

earnest phoenix
#

k1 sec

pale vessel
#

did you give IP access to your machine by the way?

earnest phoenix
#

@quartz kindle ^^^

regal raven
#

discord.py
How do I check for the next message from the author after a command has been run by him?

For example:
When The user says the quiz command The bot shows a quiz wiyh 4 possible options and the user needs to select one and when I used on_message event the event occurs the same time the command has been run so that doesnโ€™t work

Ping on answer

earnest phoenix
#

@quartz kindle should i just make a new cluster?

quartz kindle
#

@earnest phoenix thats just repeats of the same error

earnest phoenix
#

ik

#

thats the only error i get

quartz kindle
#

you need to look where your bot started

#

remove the code that causes the error, so it doesnt spam your logs

earnest phoenix
#

uhh ok

quartz kindle
regal raven
#

Thanks

earnest phoenix
#

@quartz kindle Nothing logs apart from it saying

2020-07-02T10:02:46.585121+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2020-07-02T10:02:46.692139+00:00 heroku[worker.1]: Process exited with status 143
2020-07-02T10:02:50.029095+00:00 heroku[worker.1]: Starting process with command `node Index.js`
2020-07-02T10:02:50.647637+00:00 heroku[worker.1]: State changed from starting to up
2020-07-02T10:02:50.000000+00:00 app[api]: Build succeeded
2020-07-02T10:02:59.924935+00:00 app[worker.1]: Deku Bot is online on 256 servers!
2020-07-02T10:03:00.136780+00:00 app[worker.1]: Server count posted!
quartz kindle
#

you didnt remove the ready event code did you?

earnest phoenix
#

@quartz kindle wdym?

delicate shore
#

hey

#

i was watching a tuorial

#

on yt

#
if(command === "meme") {
       await msg.channel.send("Fetching a meme, please wait a second!");
        fetch('https://meme-api.herokuapp.com/gimme')
            .then(res => res.json())
            .then(json => {
                let embed = new Discord.RichEmbed()
                    .setTitle(json.title)
                    .setImage(json.url)
                    .setFooter(`Link: ${json.postLink} | Subreddit: ${json.subreddit}`)
                msg.edit(embed)
            });
    }```
#

This worked for them

#

but not for me

#

and yes i have done
const fetch = require('node-fetch');

#

and yes i have donwloaded the module

earnest phoenix
#

errors?

delicate shore
#

no errors

#

naybe the fetch link is no longer there ?

#

maybe*

earnest phoenix
#

there has to be if it doesnt work

delicate shore
#

see this

#

This is what I keep getting

#

It's not sending a meme

earnest phoenix
#

its not editing thats why

delicate shore
#

What

#

So

#

What's the solution

#

Should I remove

#

Await msg ?

solemn latch
#

Your attempting to edit msg, which seems to be the input message

#

Not your sent message

delicate shore
#

Your attempting to edit msg, which seems to be the input message
@solemn latch waitWhat

#

Oh

#

Wait

#

Then what's the sol ? Like

#

Because

solemn latch
#

Store your sent message

#

Edit it instead

delicate shore
#

Hmm

#

Like

#

Then how did he do that ?

#

In YouTube video

solemn latch
#

He probably set it to a var, and edited it.
Just didnt show it

#

๐Ÿค”

#

YouTube programmig tutorials are like that

delicate shore
#

This is tutorial

solemn latch
#

Yeah your missing some stuff

#

See on the left

delicate shore
#

I checked twice

solemn latch
#

Looks like
he is setting msg

#

Before await

delicate shore
#

but i cannot

#

it gives me an error @solemn latch

solemn latch
#

Well duh, you already named your input msg

#

so you can't reuse msg

delicate shore
#

So

#

Ohhh

#

I am stupid

#

Lol

#

I will rename it to msg2

restive pebble
delicate shore
#

But @solemn latch it says message is not defined

solemn latch
#

You need to define it properly

delicate shore
#

Like

#

Wot ?

#

if I write msg then it works

solemn latch
delicate shore
#

Oh @solemn latch

restive pebble
#

u want to edit ur bot's msg?

delicate shore
#

It. Says rich embed

low phoenix
#

How could I then set the bot status to how many servers it is on for discord.js v11?

delicate shore
#

Is not

restive pebble
#

client.user.setStatus

delicate shore
solemn latch
#

I reccomend upgrading to 12 asap, v11 won't be work in a few months

delicate shore
#

What

restive pebble
#

depreacated

low phoenix
#

@restive pebble i will with server count.

delicate shore
#

Does rich embed required a module ?

twilit rapids
#

no

delicate shore
#

ok

restive pebble
#

client.guilds.cache.size

delicate shore
#

So why does it says that

restive pebble
pale vessel
#

it does but if you use { embed: { data } } then no

restive pebble
#

what is ur error

low phoenix
#

@restive pebble for v11?

restive pebble
#

oh

delicate shore
#

it does but if you use { embed: { data } } then no
@pale vessel
What module it needs I'll download

restive pebble
#

client.guilds.size --V11

delicate shore
#

oh

solemn latch
#

Richembed was discordjs v11 btw

#

Its now called messageEmbed

pale vessel
#

you'd want to require discord.js and use MessageEmbed if you're on v12

delicate shore
#

you'd want to require discord.js and use MessageEmbed if you're on v12
@pale vessel
But

#

There is no way

#

To insert image

#

In that

pale vessel
#

there is

delicate shore
#

what's the command

pale vessel
#

please read docs

delicate shore
#

.addImage?

pale vessel
#

setImage()

delicate shore
#

Then I have to replace whole code again by changing every thing ๐Ÿ˜‘

pale vessel
#

just. the. replace. function. in. your. editor.

delicate shore
#

Really

pale vessel
#

oh, glitch

#

omegalul

#

yikes

delicate shore
#

Then

#

Now?

pale vessel
#

replace them one by one

low phoenix
delicate shore
#

There is no title right?

#

In that message embed

pale vessel
#

if you want it to exist, yes there is

earnest phoenix
#

de-help

restive pebble
#

``

#

use `

#

not '

delicate shore
#

Ok

earnest phoenix
#

d-setprefix de-

restive pebble
earnest phoenix
#

E

#

oop

low phoenix
#

@restive pebble Thank you โค๏ธ

restive pebble
wet burrow
#

@sleek epoch

#

oaa

#

@boreal scroll

sleek epoch
#

oa

low phoenix
still merlin
#

is your bot on 0 servers? .-.

low phoenix
#

nope

solemn latch
#

Your changing statuses every 2 seconds

#

Thats api abuse I think

honest perch
#

it is

quartz kindle
#

you define statuses outside of the ready event

#

so they are defined before the client gets ready

#

also, that status will never be updated

#

it will always reuse the same status that was defined

restive pebble
#

he dmed me i fixed lol

#

is your bot on 0 servers? .-.
KEKW

gilded lily
restive pebble
solemn latch
#

To be fair, it is in 0 servers before it logs in

restive pebble
#

next question

gilded lily
#

To he fair, it is in 0 servers before it logs in
@solemn latch

#

sry for pointing out kok

restive pebble
#

@solemn latch pro grammar gods here

gilded lily
#

this girl is trolling me

low phoenix
#

How can I set rights for a "module.exports". Do you want to do it only for group: "SimpleVote-Perms"

inner spruce
#

Anyone that is able to help me out with oAuth? I am using the scopes identify, connections and guilds. For guilds I would like to check whether or not the user has administrator privileges or not.

guilds returns an array of the guild along with the member their permissions as bitfield. Does anyone know how to convert this back to check whether or not this user has administrator permissions or not?

bitter sundial
#

you can do a bitwise and on the bitfield with the value of the admin perm and if the resulting value is non-zero the permission is granted

quartz kindle
#

^ if(bitfield & 8)

slender thistle
#

Are there good explanations on bitfields on the internet, actually?

quartz kindle
#

the one in mozilladocs is pretty good

delicate shore
#

Hey

#

can u help me

#

i am having confusion with args

restive pebble
#

ok

earnest phoenix
#

tf

restive pebble
#

what confussion tho

delicate shore
#
if(command === "gif"){
if(!args[1])
return msg.reply("**Kindly tell a keyword along with**")

let gifo = args.slice(1).join(" ");
    fetch(`https://api.tenor.com/v1/random?key=${tenorapi}=${gifo}&limit=1`)
      .then(res => res.json())
      .then(json => msg.say(json.results[0].url))
      .catch(e => {
        msg.say('Failed to find a gif that matched your query');
        // console.error(e);
        return;
      });
  
};```
delicate shore
#

can anyone help me

bitter sundial
#

explanations for checking I made for xig some time ago

tight plinth
#

@delicate shore whats your problem

delicate shore
#

it's not searching

restive pebble
#

how u defined args lol

tight plinth
#

^

delicate shore
#

like this

restive pebble
#

ok

delicate shore
#
const args = msg.content.split(" ");```
golden condor
#

what

low phoenix
#

How can set for this "module.exports = class PollCommand extends Command {" to require a groupname?

tight plinth
#

actually no

#

if you do that it dont work lol

pure lion
#

Sup

delicate shore
#

sup

quartz kindle
#

@low phoenix wdym require a group name

restive pebble
#

class something extends lol{}
module.exports=something

delicate shore
#
const args = msg.content.split(" ");``` @restive pebble
golden condor
#

How can set for this "module.exports = class PollCommand extends Command {" to require a groupname?
@low phoenix check if this has the property groupname and if not then throw an error

restive pebble
#

yes

delicate shore
#

so why can't it find results

#

should i log in console?

#

and see error

restive pebble
#

const mArray =message.content.slice(prefix.length).split(" ")
const args = mArray.splice(1)

golden condor
#

can u console.log(args)

delicate shore
#

or should i do console.log(args)

#

ok

golden condor
#

const mArray =message.content.slice(prefix.length).split(" ")
const args = mArray.splice(1)
@restive pebble spoonfeed

restive pebble
#

yes thx

#

and u using ytsearch?

pure lion
#

Yes

earnest phoenix
#

Could somone help why my image sometimes goes out of embed?
Code:

const attachment = canvas.toBuffer()
 
let embed = new Discord.MessageEmbed()
    .setColor(color)
    .setAuthor(`Here is ${name}'s profile!`)
    .attachFiles([new Discord.MessageAttachment(attachment, `profile_card_${name}.gif`)])
    .setImage(`attachment://profile_card_${name}.gif`);
message.channel.send(embed)
pure lion
#

He keeps getting rate limited

restive pebble
#

yeah

trim burrow
#

.

pure lion
#

Hi

quartz kindle
#

@delicate shore you're missing a query parameter

pure lion
#

@earnest phoenix example?

quartz kindle
#

/random?key=${tenorapi}=${gifo}&limit=1
its missing a &q

delicate shore
#

where?

restive pebble
#

and that gifo

earnest phoenix
low phoenix
restive pebble
#

should be encoded

#

encodeURIComponent

pure lion
#

@earnest phoenix weirdddd

earnest phoenix
#

ikr

quartz kindle
#

@delicate shore key=tenorapi & q=gifo & limit=1
you have key=tenor=gifo & limit=1

delicate shore
#

oh

#

ok

#

this is error i get

pure lion
#

@low phoenix I recommend using discord's permissions instead of names roles

restive pebble
#

derku use

#

.attachFiles

delicate shore
#

oh

earnest phoenix
#

i did

delicate shore
#

why am i suing msg.say

#

lol

earnest phoenix
restive pebble
#

ok

solemn latch
#

Sounds like discord being weird

#

๐Ÿค”

quartz kindle
#

what do you mean goes out of embed

pure lion
#

:thenk:

earnest phoenix
#

yes but if you do it again it goes out like it doesnt change

restive pebble
#

it dosent appear in setImage

inner spruce
#

the one in mozilladocs is pretty good
@quartz kindle could you link me?

restive pebble
#

that thing should work

#

Derku

delicate shore
#
if(command === "gif"){
if(!args[1])
return msg.reply("**Kindly tell a keyword along with**")

let gifo = args.slice(1).join(" ");
    fetch(`https://api.tenor.com/v1/random?key=APIKEYHERE&q=${gifo}&limit=1`)
      .then(res => res.json())
      .then(json => msg.say(json.results[0].url))
      .catch(e => {
        msg.reply('Failed to find a gif that matched your query');
         console.log(args);
        return;
      });
  
};```
earnest phoenix
#

ik

restive pebble
#

encodeURI

#

@delicate shore

delicate shore
wheat hornet
#

how to make my bot play music using JavaScript

delicate shore
#

encodeURI
@restive pebble ?

restive pebble
#

yrdl

misty sigil
#

what library

restive pebble
#

ytdl

misty sigil
#

eris or djs

earnest phoenix
#

how to make my bot play music using JavaScript
@wheat hornet Tutorials

pure lion
#

@wheat hornet ytdl and ffmpeg

restive pebble
#

@delicate shore

misty sigil
#

and a stream dispatcher if discord.js

pure lion
#

^

restive pebble
#

encodeURIComponent

wheat hornet
#

@pure lion ya but its not playing music at all no errors also

pure lion
#

@wheat hornet errors?

#

Oh

misty sigil
#

i don't know eris

pure lion
#

Send code

restive pebble
#

.on("finish",reason=>{console.log(reason)})

delicate shore
#

encodeURIComponent
@restive pebble what u mean?
can u link me to docs?

misty sigil
#

hmm

wheat hornet
#

my pc switched off sooo ight ima unable

misty sigil
#

so, you come here, to ask for help

pure lion
#

^

misty sigil
#

but can't provide code?

pure lion
#

Smh

wheat hornet
#

โ€ฆ

pure lion
#

Head my shake :e:

tulip ledge
#

Ih ave this array with 1000 entries but it doesn't show the full array in the console any idea how I show it?

pure lion
#

Uh

restive pebble
#

splice

tulip ledge
#

Wut

restive pebble
#

or writeFile

tulip ledge
#

No lol I need to see the whole array

restive pebble
#

yes

tulip ledge
#

splice?

pure lion
#

<array>.splice()

restive pebble
#

writefile using fs

#

into .json

low phoenix
#

@pure lion and how can i set for only Administrator Permissions?

pure lion
#

@low phoenix docs

restive pebble
#

member.hasPermission

pure lion
#

๐Ÿ‘๏ธ

low phoenix
#

xd

restive pebble
#

make sure to select v11

pure lion
low phoenix
#

@restive pebble yes xd

pure lion
#

๐Ÿฅ„

solemn latch
#

๐Ÿฅฃ

delicate shore
#

Wait guys I am stupid

pure lion
#

Are you??

delicate shore
#

I was using msg.replys

pure lion
#

Niiice

restive pebble
#

lol

delicate shore
#

That is why gif wasn't working ๐Ÿ˜‚

pure lion
#

Jayjajayjajayjajayja

delicate shore
#

@pure lion search .

restive pebble
#

message.channel.send

pure lion
#

I'm watching Netflix X))))

restive pebble
#

yt-search uses cheerio

low phoenix
pure lion
#

Wait it doe-

restive pebble
#

yes

pure lion
#

@low phoenix captial

restive pebble
#

it does

#

so it dosent have rate limits

solemn latch
#

Boeing will you code my bot for me too

pure lion
#

Oooo me too

restive pebble
#

lol

solemn latch
restive pebble
#

no

pure lion
misty sigil
#

i want all the bot devs from here

tulip ledge
#

fs.writeFile("./dropsarr.json", dropsarr, (err) => {if(err) throw err;}) why didn't it create a file?

misty sigil
#

to make one giant bot

solemn latch
#

Giant terrible thing

pure lion
#

@misty sigil okay where's the GitHub repo

#

Jajajajajajaja

misty sigil
#

jsjsjsjjsjsjsjjsjs

solemn latch
#

Crash after crash

pure lion
#

Yeeeee

#

It sounds

misty sigil
#

ceo of crash

lusty quest
#

written in like 5 different languages

misty sigil
#

yes

pure lion
#

Engoush

#

Coffeescript

restive pebble
#

@tulip ledge where i doing this

#

u*

tulip ledge
#

In my command

restive pebble
#

platform

misty sigil
#

ok im gonna make a screenshot command its gonna be hard but is it?

pure lion
#

Make new file

solemn latch
#

I hope that english developer helps out

pure lion
#

@misty sigil not rly it's just puppeteer

solemn latch
#

I was looking at it. Seems easy

restive pebble
#

@tulip ledge u doing on windows

pure lion
#

English hard

solemn latch
#

I think I might use grafana to get some images for my bot

pure lion
#

@tulip ledge u doing on windows
@restive pebble no he's doing it on French

restive pebble
#

ok

tulip ledge
#

yes windows

restive pebble
#

no external sites

#

?

tulip ledge
#

no

restive pebble
#

ok

#

it should have worked

#

wait some time

tulip ledge
#

console.log(fs.readFileSync("dropsarr.json", "utf8")); this is reading it

pure lion
#

H m

restive pebble
#

ah

#

writeFile

tulip ledge
#

so it does exist

restive pebble
#

yes

#

it will take time

#

ig