#development

1 messages ยท Page 863 of 1

static trench
#

Idk

earnest phoenix
#

@elder vine Finaly, java.json things work in the app

elder vine
#

Good :)

golden condor
elder vine
#

You don't have two message events?

golden condor
#

No

#

In my index.js there is one

#

*isn'y

elder vine
#

Oh

#

I was about to say xD

golden condor
#

@elder vine i don't get it

elder vine
#

Neither do I, something in your pm2 config must be wrong?

golden condor
#

@elder vine my p.json is this```json
{
"name": "bot",
"version": "1.0.0",
"description": "A simple Node app built on Express, instantly up and running.",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node index.js"
},
"engines": {
"node": "12.x"
},
"author": "Cxllm",
"license": "ISC",
"dependencies": {
"8ball.js": "^1.1.0",
"@discordjs/opus": "^0.1.0",
"@ffmpeg-installer/ffmpeg": "^1.0.20",
"@ksoft/api": "^3.1.6",
"boats.js": "^2.4.0",
"cheerio": "^0.22.0",
"cpu-stat": "^2.0.1",
"dblapi.js": "^2.4.0",
"discord.js": "^12.1.1",
"express": "^4.17.1",
"express-glitch-keepalive": "^0.2.0",
"ffmpeg": "^0.0.4",
"ffmpeg-static": "^4.0.1",
"flexilink": "^2.0.0",
"fluent-ffmpeg": "^2.1.2",
"fs-nextra": "^0.4.7",
"gblapi.js": "^1.3.13",
"genius-api": "^0.4.1",
"genius-lyrics": "^1.0.9",
"give-me-a-joke": "^0.2.5",
"hastebin-gen": "^2.0.5",
"imageapi.js": "^1.0.2",
"mathjs": "^6.6.1",
"moment": "^2.24.0",
"ms": "^2.1.2",
"node-fetch": "^2.6.0",
"node-superfetch": "^0.1.10",
"nodemon": "^2.0.3",
"novelcovid": "^1.0.9",
"pm2": "^4.2.3",
"quick.db": "^7.0.0-b22",
"random-facts": "^1.0.6",
"random-puppy": "^1.1.0",
"simple-youtube-api": "^5.2.1",
"superagent": "^5.2.2",
"tinyurl": "^1.1.3",
"urban": "^0.3.2",
"weather-js": "^2.0.0",
"yql": "^1.0.2",
"yt-search": "^1.1.2",
"ytdl-core": "^2.0.1",
"ytdl-core-discord": "^1.1.0",
"ytpl": "^0.1.20"
},
"repository": {
"url": "git+https://github.com/cxllm/corynth.git"
},
"bugs": {
"url": "https://github.com/cxllm/corynth/issues"
},
"homepage": "https://github.com/cxllm/corynth#readme",
"devDependencies": {}
}

drowsy sentinel
#

hi package.json file that took up chat rather than being pasted in a hastebin

golden condor
#

and I don't have a pm2 config file

#

Sorry Duane

elder vine
#

You probs do.

golden condor
#

Where

elder vine
#

1 sec

elder vine
#

pm2 config

#

No, I really don't know.

golden condor
#

events in the events folder

#

get triggered twice

elder vine
#

fs.readdir(__dirname +'/events/', (err, files) => {
    if (err) console.log(err);
    files.forEach(file => {
        let eventFunc = require(`./events/${file}`);
        let eventName = file.split(".")[0];
        client.on(eventName, (...args) => eventFunc.run(client, ...args));
    });
});
golden condor
#

That's what my events handler basically is

#
fs.readdir("./events/", (err, files) => {
  if (err) console.log(err);
  files.forEach(file => {
    let eventFunc = require(`./events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, (...args) => eventFunc.run(client, ...args));
  });
});```
elder vine
#

Hmm...

#

Tim is tha pro

#

Type pm2 list

golden condor
#
const config = require("../config.json")
const Discord = require("discord.js")
const {queue} = require("../queue.js")
exports.run = async (client, message) => {
  if (message.author.bot) return;
  if (message.channel.type == "dm") return;
  const db = require('quick.db')
  let prefix = await db.fetch(`prefix_${message.guild.id}`);
  if (!prefix) {
    prefix = 'c!'
  }
  let mention = new RegExp(`^(<@!?${client.user.id}>)\\s*`);
  const embed2 = new Discord.MessageEmbed()
  .setTitle("My prefix for this server is " + prefix)
  .setDescription(`Type ${prefix}help for commands and for links to our support server`)
  .setColor(0x00aaff)
if(message.content.startsWith(prefix)) {
    let messageArray = message.content.split(" ");
    let cmd = messageArray[0].toLowerCase();
    let args = messageArray.slice(1);

    let command = client.commands.get(cmd.slice(prefix.length))
    if (!command) command = client.commands.get(client.aliases.get(cmd.slice(prefix.length)));
    if (!command) return;
    if(command.category === "Owner" && message.author.id != config.ownerid) return;
    command.run(client, message, args, queue).then( () => {
      const Embed = new Discord.MessageEmbed()
      .setTitle("Command Run")
      .setDescription(`The command **${command.category}/${command.name}** was run by **${message.author.username}** in **${message.guild.name}**`)
      .setColor(0x00aaff)
      const cnl = client.channels.cache.get("697061184708280350")
    cnl.send(Embed)}).catch(e => {
      const {ownerid} = require('../config.json')
      message.channel.send("Unfortunately, there was an error executing that command and I will inform the developer so he can fix it.")
   client.users.cache.get(ownerid).send(`There has been an error executing ${command.name}\n\`\`\`js\n${e}\`\`\``)
      })
    } else if (message.content.match(mention)){return message.channel.send(embed2);}
    else return undefined;
  }``` This is my message.js
elder vine
#

Which of the instances is your bot?

golden condor
#

index

elder vine
#

do pm2 stop 0 then

#

and see

#

Does it run at all then?

golden condor
#

I have tried that]

#

It stops both

#

instances

#

So I think it's my code

quartz kindle
#

why do you have 2 instances?

golden condor
#

No idea

#

I am tryna fix that

quartz kindle
#

then remove one of them

golden condor
#

For some reason my bot runs every command twice

elder vine
#

The two pm2's isn't the same

golden condor
#

It isn't intentional

quartz kindle
#

pm2 delete bot

golden condor
#

And I can't find the source

#

bot is my friend's bot

elder vine
#

It's not bot

quartz kindle
#

so those are two different bots?

elder vine
#

Yep

golden condor
#

YEs

#

I have no idea

#

How to fix it

quartz kindle
#

show your index.js

golden condor
#

Ok

earnest phoenix
golden condor
#

I have no idea

quartz kindle
#

type top in your terminal

#

also, why do you have 2 bots in your file lol

#

bot and client

wheat jolt
#

I have no idea
fair enough

golden condor
#

@quartz kindle lol idk

#

What would typing top do?

quartz kindle
#

show the process list

#

to see if there is a duplicate process for some reason

charred shuttle
#

Hi I'm having trouble installing discord.py on my windows computer.

#

It has Python 3.8.2.

slender thistle
#

any errors?

charred shuttle
#

When I try to type "python3 -m pip install -U discord.py" it returns
File "<stdin>", line 1
python3 -m pip install -U discord.py
^

slender thistle
#

That doesn't help at all tbh

#

Please post the entire traceback owoMilkROFL

charred shuttle
#

I have no idea how to do anything

slender thistle
#

Screenshot?

charred shuttle
#

Nevermind I think I got it

#

Thanks

earnest phoenix
#

can you try just pip install -U discord.py

#

oof okay XD

#

I havent used python in ages but i dont remember needing the first bit

charred shuttle
#

I was using the wrong "put in code" place

#

I don't know what you call those

#

I'm a big noob

earnest phoenix
#

Everyone has to start somewhere ๐Ÿ™‚ just learn to learn from mistakes

charred shuttle
#

Thank you

earnest phoenix
#
  if(command === "example") {
    let randomnumber = Math.floor(Math.random() * 11)
    const filter = m => m.author.id === message.author.id
    message.channel.send("Choose a random number.")
    console.log(randomnumber)
    message.channel.awaitMessages(filter, {
     max: 1,
     time: 10000 
    }).then(collected => {
      if(collected === randomnumber) return message.channel.send("Right!")
      if(collected !== randomnumber) return message.channel.send("Wrong!")
    })     
  }```
#

The code sends the message and then sends wrong, doesn't wait

#

What is the problem with the await messages?

elder vine
#

What?

#

discord.js version?

earnest phoenix
#

v11

crimson vapor
#

I suggest making a collector

earnest phoenix
#

But isn't that supposed to work ?
What's wrong?

sudden geyser
#

@earnest phoenix what is max supposed to be, because there is max and maxMatches in Discord.js v11:

  • max - The maximum numbers to process (aka see).
  • maxMatches - The maximum number of messages allowed to pass the filter.
earnest phoenix
#

Oh right

#

i will try maxmatches

#

It did work but when i match the right number it will still say im wrong

sudden geyser
#

also collected is going to be a collection of messages, not the random number

summer torrent
#

^

earnest phoenix
#

oh
so how do i make it work with randomnumber?

sudden geyser
#

get the first item from the collection with a method like .first() and compare the content

#

it's in the docs

earnest phoenix
#

i tried it didnt work

summer torrent
#

collected.first().content

#

oops

#

sorry

earnest phoenix
#

i tried using that

#

it didnt work

summer torrent
#

collected.first().content
this?

sudden geyser
#

Can you show what you did

earnest phoenix
#

yeah

#

ok

#
  if(command === "example") {
    let randomnumber = Math.floor(Math.random() * 11)
    const filter = m => m.author.id === message.author.id
    message.channel.send("Choose a random number.")
    console.log(randomnumber)
    message.channel.awaitMessages(filter, {
     maxMatches: 1,
     time: 10000 
    }).then(collected => {
      if(collected === randomnumber) return message.channel.send("Right!")
      if(collected !== randomnumber) return message.channel.send("Wrong!")
    })     
  }```
#

I also tried using if collected.first().content but it still says im wrong...

sudden geyser
#

third issue with your code, === is strict. == is loose. You'd need to convert the string to a number, validate, then compare etc.

#

you didn't even use collected.first()

earnest phoenix
#

i said when i tried it still didnt work

cinder patio
#

Also you are comparing a collection to a number so

earnest phoenix
#

...

cinder patio
#

collected.first().content will always be a string, so either compare loosely (==) or turn it into a number, like Kinolite said

earnest phoenix
#

so you're saying == is for numbers?

cinder patio
#

it's for comparing loosely, aka "4" == 4 will return true

earnest phoenix
#

ok

cinder patio
#

If you use strict compare it won't ("4" === 4)

sudden geyser
#

You should try using === whenever possible. == can have side effects.

earnest phoenix
#

oh

cinder patio
#

no it can't

earnest phoenix
#

i didnt know that

#

learning new stuff everyday i guess

#

thanks! it worked perfectly

sudden geyser
earnest phoenix
#

One thing i forgot

#

How can i do it so if there is no answer it will respond?

#

i tried doing this

#
if(!collected.first().content) return message.channel.send("WHY")```
crimson vapor
#

I think that it only returns when it is collected

earnest phoenix
#

i think i can use catch error for that

#

yep

cinder patio
#

check if the collection's size is more than 0

summer torrent
#

add errors: ["time"] to your await message function

earnest phoenix
#

im adding an error catch

summer torrent
#

then catch it

cinder patio
#

Or just check if the collection size is zero and don't catch any errors

earnest phoenix
#

added this

}).catch(err => message.channel.send("WHY"))  ```
#

worked

#

if(collection.size == 0) ?

#

collected*

cinder patio
#

yes

#

or just if (!collection.size)

earnest phoenix
#
 if(collected.size === 0) return message.channel.send("WHY")```
#

worked

#

thanks!

crimson vapor
#

why the ===

#

I dont understand

#

it would work

#

but why use it

charred shuttle
#

Ran into another problem. So basically I made a standard ping command like

@client.command
async def ping(ctx):
    print(f"Pong! {round(client.latency * 1000)}ms")

And I got this weird message saying
"Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "ping" is not found"
And so before I made this command it just said Pong! and it worked but now every time I type the command it spams multiple responses of what my code used to look like so for example, it would show something like this

#

I feel like it gets worse the more I try to retype the code.

sudden geyser
#

Are you ignoring bots? Are you checking the exceptions to include when the user uses a command that does not exist?

charred shuttle
#

Bot permissions?

#

It has admin as bot permissions so it can basically do anything

#

Should I post my entire code

#

It's 23 lines

#

Ack bugs have taken over me again

cinder patio
#

What would be better? In the database I have a few rows whose values can be either 0, 1 or 2. Would it better to store them all in one row via a bitfield (0x2000 - 0, 0x4000 - 1, 0x8000 - 2) problem is, the max of the number is 34952, and I am not sure if would require more space than 4 rows with 0 / 1 / 2s

glad leaf
#

Is there a bot that has a way I can make it so a role gets removed when receiving a different role?

You get role Test1
Role **Test2 **gets removed

dm me if you know how

summer torrent
#

listen to event

charred shuttle
#

I feel like my bot is running all versions of my code that have existed since I made the first @client.command line and now.

#

Even if I take that command away the command still works

slender thistle
#

@charred shuttle ()

#

Not just client.command

charred shuttle
#

oh

#

Let me try that

cinder patio
#

What would be better? In the database I have a few rows whose values can be either 0, 1 or 2. Would it better to store them all in one row via a bitfield (0x2000 - 0, 0x4000 - 1, 0x8000 - 2) problem is, the max of the number is 34952, and I am not sure if would require more space than 4 rows with 0 / 1 / 2s
Actually I don't think it'd matter because 8bit integers' size is 1 byte, while 32bit integers' size is 4 bytes. Although If I decide to add more options with 0/1/2 then bitfield would save more space

charred shuttle
#

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found
and this error

#

And the command used to say print('___') so it also prints the pong

#

Basically my code is running every single version of this code for some reason

slender thistle
#

Your uhh

#

You kinda have too many instances running at once, don't you think

charred shuttle
#

?

#

Wdym

slender thistle
#

Are you deleting your ping messages

charred shuttle
#

No

#

Is that why

slender thistle
#

Are those all responses sent just on one command usage

charred shuttle
#

Yes

slender thistle
#

Your code is kinda drunk buddy

charred shuttle
#

oh no

slender thistle
#

You're not supposed to send that many messages at once

charred shuttle
#

Ok

#

Wait so how do i fix that

#

Do i just wait

slender thistle
#

Restart your machine first, make sure you're actually closing your bot instance when restarting

charred shuttle
#

Ok

#

I'm sorry

earnest phoenix
#

-ok-

charred shuttle
#

One more question what is a bot instance

slender thistle
#

Your script

earnest phoenix
#

How to get a specific user messages and delete them ?

charred shuttle
#

Ok

elder vine
#

fetch the message and delete

charred shuttle
#

Thank you @slender thistle

earnest phoenix
#

@earnest phoenix like get their last message id and delete it or...
Delete whatever that specific user says?...

elder vine
#

why not fetch the messages and delete it @earnest phoenix ?

earnest phoenix
#

@elder vine i mean you can but i meant like do you want every message of that user to be deleted or something?

#
message.channel.fetchMessages({
 limit: `${args[1]}`,
}).then((messages) => {
messages = messages.filter(user => user.id === user.id)
  
  message.channel.bulkDelete(messages)```
#

i tried this but it doesnt seem to be working

#

the limit is the number i put to delete

#

but it deletes every message

copper cradle
#

limit MUST be an integer

#

not a string

#

convert it to a number

earnest phoenix
#

parseInt(args[1])

copper cradle
#

yeah

earnest phoenix
#

It doesnt solve the problem tho

#

I need to fetch the user's messages and delete them

copper cradle
#

well, you're filtering them by their id

#

so it'll delete every

#

you're comparing 1 to 1

#

like it'll delete everything

crimson vapor
#

Wait, why do you need to fetch the messages before you bulkDelete?

valid gyro
#

Alright, so my bot accessess an api, but some of the api responses I get are links to more things within the api,and when my bot reads those, it just spits out {object,object}

#

how would i get it to read the api responses from the api

craggy cave
#

Has anyone been able to use github self-host runner's with their discord bot?

earnest phoenix
#

@copper cradle but i need to delete the messages with the users id not with the message author id

#

ill try

#

Doesnt work

golden condor
#

@quartz kindle sorry I have been out, can we continue with the issue about the two instances

#

I think it's something to do with my code

earnest phoenix
#

Snekfetch confused my brain angeryBOYE

superagent.get('https://srhpyqt94yxb.statuspage.io/api/v2/summary.json').then(r=>message.reply(r.headers.status))

i tried like 9 different things and I still don't know how to get this to work

golden condor
#

Snekfetch is dead

amber fractal
#

snekfetch has been deprecated forever

earnest phoenix
#

i knu

amber fractal
#

use node-fetch or node's built in http module

golden condor
#

@quartz kindle this is the result from top

earnest phoenix
#

But what if I want to still use snekfetch

#

p.p

golden condor
#

You can't?

amber fractal
#

Well it's not supported and slow

#

so you can have fun with it if you want

earnest phoenix
#

v11.5.1

#

im just confused

#

lol

valid gyro
#

im using request for my api bot

quartz kindle
#

@golden condor did you delete/re-add any of the bots from pm2 since you posted the pm2 image?

golden condor
#

no

#

Seems to be ok now

#

But when it restarts sometimes it loads twice

quartz kindle
#

the process PIDs dont match

#

when you do pm2 restart, sometimes it loads twice?

golden condor
#

Yeah

#

I restarted

#

It didn't go twice

#

I have another question

#

How do I use webhooks inside the code

#

Like the donatebot webhook for example

copper cradle
#

@earnest phoenix ah

#

well still

#

you're cheching if the message id is the same as... well the same message id

#

check what you did

valid gyro
#

so im using request to acces an api, but the api has some responses that are coming out as (Object,Object) it seems to be the ones where the responses are more variabes, how to I get my bot to read those variables

#

for example, say i want to get the name of the subclasses from "subclasses":[{"name":"Lore","url":"/api/subclasses/lore"},{"name":"Fiend","url":"/api/subclasses/fiend"}],"url":"/api/spells/command"}

copper cradle
#

messages.filter(user => user.id === user.id) in this case, user is not an user object, naming it user doesn't change what it is, this shows that you don't actually know how to use functions, in this case user is a message object, so youre checking if the message id is the same as the message id duuuhh, so it'll always be true

quartz kindle
#

@golden condor you mean top.gg webhooks or discord webhooks?

#

@valid gyro subclasses is an array, like this subclasses:[{subclass},{subclass}]

#

do access items from an array, you use their index number, for example the first subclass would be subclasses[0], the second one would be subclasses[1] and so on

#

then you can get the name property after you get the item: subclasses[0].name to get the name of the first subclass

#

you can also use subclasses.map() to transform the items of the array, and give you for example a list of names, instead of a list of subclasses

#

an example of the .map function would be subclasses.map(subclass => subclass.name) to return a list of names (transform each item of the subclasses array into a name)

valid gyro
#

so rn my command is msg.channel.send(`Subclasses: ${body.subclasses}`);

#

I would tack the subclasses.map(subclass => subclass.name) to the end of that?

quartz kindle
#

that would return a list of names yes

golden condor
#

@quartz kindle Not just top.gg webhooks but just any like say donatebot webhook

quartz kindle
#

idk how donatebot works, havent used it

#

does it send a message with a different username/profile pic?

valid gyro
#

that gives me a subclassess is not defined error

quartz kindle
#

then you used it wrong

valid gyro
#

probably

quartz kindle
#

remember, your subclasses is your body.subclasses

#

you just need to attach the map function to it

valid gyro
#

it works now, but it sends subclasses and the function before it twice

#

which is... odd

golden condor
#

@quartz kindle it's like top.gg webhooks basically

valid gyro
#

@quartz kindle now im getting the information I needed but everything is being sent twice

raven urchin
#

I need some help, so I Wanna put how many votes I have on my botinfo. How can i show how many votes I have on top.gg?

valid gyro
earnest phoenix
#

So, i have FFmPeg installed, and it has FFprobe but yet it's still coming up with this error message,

#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.```
#

there's a good few lines of it but that's the main error,

valid gyro
#

spews out everything twice after ive fixed like 2 things

#

o I fixed that

wheat jolt
#

ok tf

modest maple
#

what

wheat jolt
#

i want i want i want i want

#

so dope lol

amber fractal
golden condor
#

pm2 is fucking up

#

I am remade my entire events system

#

and it is still fucked up

warm marsh
#

Using MongoDB with node. Is making a new client each time I want to query something a bad idea? For example: Someone runs a command e.g. settings and it queries the database instancing a new client.

#

Or should I have one constantly open and query that?

topaz fjord
#

yes

warm marsh
#

Yes to what?

scenic kelp
#

You're probably much better off opening one instance when you start your bot

buoyant totem
#

Need some help with my bot. Any1 free?

#

Whenever someone uses a command in chat it also types "null" in the console. so my console is spammed with "null" over and over again

golden condor
#

@cinder patio yeah iii did

#

But it still did the same

#

It sometimes does

#

And sometimes doesn't

#

It's weird

distant plank
#

Hi

elder vine
#

@buoyant totem provide the message event code

#

Hello PMP

buoyant totem
#

Ok

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

    switch(args[0]){
        case 'help':
        message.channel.send({embed: {
            color: 3447003,
            title: "Help",
            fields: [
              { name: "Commands", value: "!help\n!xur\n!lfg", inline: true},
            ]   
        }
        });
        break;

        case 'lfg':
            message.channel.send('https://www.bungie.net/en/ClanV2/FireteamSearch')
        break;

        case 'xur':
            const attachtment = new Discord.MessageAttachment('./screenshot.jpeg')
            message.channel.send(attachtment);
        break;
    }
#

@elder vine

elder vine
#

From what command does it output null?

#

Do you have another message event?

buoyant totem
#

All of them apparently

#

It outputs it twice

#

I dont think so

elder vine
#

Do you have two instances active?

#

Try stopping one of them

buoyant totem
#

Ok I did that

#

still prints "null" twice

#

Do you want the entire code?

elder vine
#

Well, sure.

#

Do you have a console.log anywhere?

buoyant totem
#

yes

elder vine
#

Can you show those lines?

buoyant totem
#

Im kinda new to nodejs so dont be too harsh on me ๐Ÿ™‚

elder vine
#

console.log(error) might be the issue

nocturne grove
#

Is there a difference between client.on('ready' and client.once('ready'? I'd say the last one is only executed once, but how can this event be triggered multiple times instead?

gritty bolt
#

I'm trying to make a server time feature on my bot. I want to send a message after a setup and update it every hour, but I also want users to be able to make changes if needed. How should I go about doing this?

ember atlas
#

How would I sent an embed via a webhook using eris?

buoyant totem
#

@elder vine What do I put there instead?

#

Found the problem

#

It decided to log error even tho it did it properly

blazing portal
#

@nocturne grove the ready event should only be triggered once anyway (unless you are sharding), but I've never seen client.once anywhere, is that even working? ๐Ÿ˜„

nocturne grove
#

Yeah I saw I have it ๐Ÿ˜‚

#

Then they are just similar I guess

blazing portal
#

which d.js version are you using?

#

@nocturne grove you are checking if there is an error, if so you log it. Then inside the else area, you log that same error. Which if it goes to the else block is obviously null

nocturne grove
#

Erm 11.5.1 iirc

#

@buoyant totem ^^ message is to you

blazing portal
#

@nocturne grove you are checking if there is an error, if so you log it. Then inside the else area, you log that same error. Which if it goes to the else block is obviously null
@blazing portal
Sorry wrong mention Menno, forgive me :(
@buoyant totem this was meant for you

gritty bolt
#

I'm trying to make a server time feature on my bot. I want to send a message after a setup and update it every hour, but I also want users to be able to make changes if needed. How should I go about doing this?
Can someone answer this?

buoyant totem
#

ty!

blazing portal
#

Sbss can you explain this a little more? and what lib are you using?

buoyant totem
#

its working now

gritty bolt
#

discord.js

#

Pretty much I want to send an embed after a setup process is done, and update it once per hour

earnest phoenix
#

i'm coding with eris, and i can't find how to set the bot's status. if anyone could point me to a source that would be very appreciated

blazing portal
#

You sucessfully sent the embed?

gritty bolt
#

actually wait nevermind

#

im going another route with this

blazing portal
#

okay ๐Ÿ˜„

gritty bolt
#

i'll use vc names instead

buoyant totem
#

ty!

nocturne grove
#

@gritty bolt to start off you can do this in your ready event:

client.channels.get(id).send(message).then(message => { setInterval(() => {
message.edit(edit); }); });```
gritty bolt
#

im using handlers not ready events but thanks

#

๐Ÿ˜„

nocturne grove
#

Hmm okay

earnest phoenix
#

i'm coding with eris, and i can't find how to set the bot's status. can anyone help?

blazing portal
upbeat vapor
#

hellow

#

Can you tell me how do I make my bot generate tickets? please

blazing portal
#

What kind of tickets, and which lib?

upbeat vapor
#

to create private rooms that staff can answer and use glitch xd

summer torrent
#

listen some events

upbeat vapor
#

which

summer torrent
#

which lib/lang do you use

upbeat vapor
#

Let's see xd that I'm more or less new, what is lib? and lang

summer torrent
#

which programming language do you use for code your bot

upbeat vapor
#

I use a page called glitch to put all the codes ect events

edgy heron
#

@summer torrent it didnt add...

#

still same as

#

isnt it enough

#

<src sometjing /y

summer torrent
#

this is just a widget

#

not for posting server count

#

I use a page called glitch to put all the codes ect events
@upbeat vapor can you show your codes

upbeat vapor
#

I can invite you to my project and modify some things yourself if you want xd

edgy heron
#

@summer torrent i have to edit my bot codes then?

summer torrent
#

yes

edgy heron
#

ans then?

#

dbl.getStats("264811613708746752").then(stats => { console.log(stats) // {"server_count":2,"shards":[]} });

#

then?

summer torrent
#

this is for getStats

upbeat vapor
#

xd

edgy heron
#

... sad lyf

#

can u send me ss

#

Example of posting server count with supported libraries (Discord.js and Eris)
const Discord = require("discord.js"); const client = new Discord.Client(); const DBL = require("dblapi.js"); const dbl = new DBL('Your top.gg token', client); // Optional events dbl.on('posted', () => { console.log('Server count posted!'); }) dbl.on('error', e => { console.log(Oops! ${e}); })

#

this?

summer torrent
#

yes

edgy heron
#

so the bot will post it in my console?

upbeat vapor
summer torrent
#

how can i show it in top.gg
@edgy heron dblapi.js package automatically posts it

edgy heron
#

oo

#

will try tommo

#

willl ping u xF

#

xd

summer torrent
#

@upbeat vapor do you know javascript?

upbeat vapor
#

No, what is that ?

summer torrent
upbeat vapor
#

xd

summer torrent
#

first learn js basics pls

upbeat vapor
#

You know I'm using a translator because I speak Spanish hahaha

#

OKay

earnest phoenix
upbeat vapor
#

where did you create it?

summer torrent
#

๐Ÿ”ญ

earnest phoenix
#

Created what?... The command? @upbeat vapor

upbeat vapor
#

Sep so you use packet or event because there are many things

earnest phoenix
#

Hmm

upbeat vapor
#

and as you say you want to change the prefix xd

earnest phoenix
#

Lol

blazing portal
#

You are not really using a json file as your 'database'? ๐Ÿ˜ฎ

earnest phoenix
#

I love using json files as database lmao

upbeat vapor
#

if I use base data because if not, the prefix ect is not created, do you want me to send you a photo?

#

@earnest phoenix XD

earnest phoenix
#

Wait what... I didn't get what you said lmao

upbeat vapor
#

for the prefix you need a database

earnest phoenix
#

@upbeat vapor json works too

summer torrent
#

hasPermission("MANAGE_SERVER" || "ADMINISTRATOR") is wrong

upbeat vapor
#

It works xd but I guide myself more if it haha

earnest phoenix
#

@summer torrent wait how is it wrong?

summer torrent
#

create a loop for that

upbeat vapor
earnest phoenix
#

@summer torrent loop for which one?
(Idk how it works tbh lmao)

summer torrent
#

wait why don't you just check for MANAGE_SERVER? because ADMINISTRATOR already has a manage server perm

earnest phoenix
#

@summer torrent i mean like when i only check for manage server and if the user has the administrator permission but doesn't have the manage server permission (check mark on the permission) ... It doesn't work

summer torrent
#

administrator has all perms

earnest phoenix
#

But as anyways that permission check literally works for every command that it needs...

#

@summer torrent wait...
If you scroll up and see that fs function... Does it need JSON.stringify() if the prefix that was provided was not a number?

#

Or it doesn't matter?

#

Wait i figured it out nevermind

hidden canopy
#

hi, i was looking to dable a lil bit around making a discord bot for my own server.. which language would u guys suggest i start off with? some online sources talk about node.js n python

earnest phoenix
#

@hidden canopy in my opinion...
JavaScript + discord.js is the best option...

hidden canopy
#

hm okay, thanks I'll take a look

earnest phoenix
#

Np

mystic violet
#

Whats a good library to generate api tokens for my api?

#

Guess ill just use uid-generator lol

#

I mean it doesnt need to be secure, its not like they're accessing personal information

earnest phoenix
#

So i have a command that everyone that has the Administrator permission in the server can use it... But... How can i make the bot not check for if i have the administrator permission or not?
(Because I'm the bot owner basically)

mystic violet
#

if(!<array of admins>.includes(user id)) check if a user needs admin

#

so basically If its not in the array of admins (on ur bot)

#

itll check for administrator

earnest phoenix
#

Oh i see... Thx

weak tangle
#

in embeds, is there a field that can have an image with text like the author? or is there any way to do multiple authors? (@ me)

tough relic
#

So I have the idea to make a bot that could stop an alt account: Like maybe it could get the ip of the new user and search in the server if there is someone with the same ip. If there is the alt would get banned

#

But now my question is... Is there a way to find the user ip?

hollow saddle
#

No, discord's api does not provide that information

amber fractal
#

That'd be a huge security concern

tough relic
#

Yea

#

But we can still ip ban someone from a server right?

amber fractal
#

All bans are ip bans

quaint nebula
#

Iโ€™m pretty

#

Sure*

#

Yeah

tough relic
#

well how can some people are able to come back with an alt?

amber fractal
#

VPNs

quaint nebula
#

VPN

#

Bruh your typing so fast

#

I am on mobile

tough relic
#

I'm fast as fuck boiiiiiiiiiii

quaint nebula
#

Not u

tough relic
#

damn

#

๐Ÿ˜”

quaint nebula
#

Steven

#

๐Ÿ˜ญ

tough relic
#

Anyone want to give me an idea of something to code?
Please
I'm begging... the boredomness of the quarantine will kill me

#

(They told me to ask here)

#

Any library

#

a covid-19 command?

#

Lol dw I speak french

#

thanks for the idea!!

#

Again thanks for your help! ๐Ÿ˜

#

you too

earnest phoenix
#

@Z4-bakedpotato#6969 you can't have multiple authors in your embeds but... You mean like write a text above the image in an embed?

#

Wait did he left? Lmao

ember atlas
#
const eris = require('eris'); 

callisto.on('ready', (callisto, msg) => { 
    callisto.editStatus({
        status: 'online', 
        game: { 
            name: 'Users run !help', 
            type: 2
        }
    })
    
    callisto.executeWebhook('698643966228431009', 'auth', { 
        embed: { 
            author: { 
                name: 'Ready', 
                icon_url: callisto.user.avatarURL
            },
            timestamp: true, 
            color: 'BLUE',

            fields: [
                { 
                    name: 'Username', 
                    value: `${callisto.user.tag}`
                }, 
                { 
                    name: 'Guild Count', 
                    value: callisto.guilds.size
                    
                }, 
                { 
                    name: 'user Count', 
                    value: callisto.users.size
                }, 
                { 
                    name: 'Time', 
                    value: `${new Date()}`
                }
              ]
             }
    })

    console.log('[Callisto] Connected to Discord')
})
``` Anyone see anything wrong with this why it wouldn't set the status or send the webhook, but it console logs?
#

No errors

earnest phoenix
#

Is there a way to prevent shards shutting down for no reason or restart at the moment it shut downs?

spice pier
#

if it shutdowns there's a reason and yes, check if it goes down or if you have a custom event system you can make it send an event to make your shard orchestrator restart it

earnest phoenix
#

so how can I restart it, I still donโ€™t get the idea

sudden geyser
#

@ember atlas I think embed is supposed to be embeds: Array<Embed>

ember atlas
#

Ya, I figured that out

digital ibex
#

hi

#

with my shardPreReady event, it takes an id var, and i just set my event handler how can i define id because the meesage is not being sent to the channel it usually does before i had it? Any ideas? My file looks like ```js
const { idle } = require('../../emotes.json');

module.exports = {
name: 'shardPreReady',

execute: (message, client) => {
    client.createMessage('687774976631373846', {
        embed: {
            title: `Shard Pre-ready`,
            description: `${idle} ID: ${id}`,
            color: 0xfffffa
        }
    });
}

};
and my event handler looks like:js
client.events = new Eris.Collection();
fs.readdirSync('./events/').forEach((dir) => {
const evFiles = fs.readdirSync(./events/${dir}/).filter((file) => file.endsWith('.js'));
for (const file of evFiles) {
const event = require(./events/${dir}/${file});
client.events.set(event.name, event);
}
evFiles.forEach((f, i) => {
require(./events/${dir}/${f});
console.log(${i + 1}: ${f} event loaded.);
});
});``` the handler works, its just events which takes vars

#

with eris

quartz kindle
#

how do you call it?

#

show your client.on("event")

digital ibex
#

wdym?

#

how i load the commands?

quartz kindle
#

how you attach the events to the eris client

digital ibex
#

oh

#

just with a try and catch thingy in the message event

#

like

#
try {
     evFiles.execute(message, client)
} catch(e) {
 console.log(e)
}```
quartz kindle
#

how do you do it in the shardPreReady event?

digital ibex
#

the way i would do it in the event handler i just made, i shown above and usually its just```js
client.on('shardPreReady', (id) => {
client.createMessage('channel', {
embed: {
title: 'shard pre ready',
descritpion: ${idle} ID: ${id}
}}})

quartz kindle
#

yes but show the code using the event handler

digital ibex
#
const { idle } = require('../../emotes.json');

module.exports = {
    name: 'shardPreReady',

    execute: (message, client) => {
        client.createMessage('687774976631373846', {
            embed: {
                title: `Shard Pre-ready`,
                description: `${idle} ID: ${id}`,
                color: 0xfffffa
            }
        });
    }
};
#

that?

quartz kindle
#

show the client.on("shardPreReady") using that

digital ibex
#

i did

#

wdym?

quartz kindle
#
client.on("shardPreReady", id => {
  client.events.get("shardPreReady").execute()
})```
#

something like that

#

you showed the shardPreReady event as a file in the handler, and as hardcoded in the event itself, but you didnt show how you use the file in the handler

digital ibex
#

oh

#

i don't have something like that

quartz kindle
#

then what are you expecting?

digital ibex
#

idk, i thought that it would work like that

quartz kindle
#

you created a file for the event, but you're not using it anywhere

digital ibex
#

kk, i'll do that

still lily
#

how do i edit the message the bot sent
(discord.js)
(javascript)

digital ibex
#

<message>.edit(string)

still lily
#

k

#

@digital ibex TypeError: Cannot read property 'edit' of undefined

digital ibex
#

ok

still lily
#
    if(message.content === '!hello'){
        message.channel.send('hi')
        message.edit('e')
    }
})```
#

thats my code rn

#

how to fix to make it edit

digital ibex
#

u have to define it as something like reee = message.channel.send

#

but u have to await that

still lily
#

okay im lost

digital ibex
#

and reee.edit('pls dont ping me k')

sudden geyser
#

Learn about promises. You have to send the message, wait, then edit that same message.

#

You're referencing the message any user sent.

#

Which could be not your own.

still lily
#

yea

digital ibex
#

so

#

wut u got rn den?

still lily
#
    if(message.content === '!hello'){
        const reee = message.channel.send
        message.channel.send('hi')
        reee.edit('e')
    }
});```
#

this still didnt work

digital ibex
#

yeah

#

u have to await sending the message

sudden geyser
#

Please learn JavaScript.

still lily
#

i know it ive just never had to edit a message

#

idk why

digital ibex
#

ok

#

how do u await something?

#

like

earnest phoenix
#

Jade and Eren, you both are the last survivors

sudden geyser
earnest phoenix
#

@still lily for example:

await message.channel.send("Doing something").then(async message => {
await message.edit("E");
});
});```
ember atlas
#

Can someone help me? I have this event handler: ```js
readdirSync('./events/').forEach(dir => {
const events = readdirSync(./events/).filter(file => file.endsWith('.js'));
for (let file of events) {
const evt = require(./events/${file})
let eName = file.split('.')[0]
callisto.on(eName, evt.bind(null, callisto))
}

for (let file of events) { 
    let pull = require(`./events/${file}`); 
}

});
console.log([Callisto] Events Loaded)

still lily
#

@earnest phoenix that worked but its sending the message 5 times

#

lol

digital ibex
#

ur probably nesting events?

ember atlas
#

what

sudden geyser
#

Why are you requiring the file a second time, but not doing anything with it? Could you possibly show more of your code (Boss)? Maybe you're nesting events like officially said?

earnest phoenix
#

@still lily change that to:

if (message.author.bot) return;
await message.channel.send("Doing something").then(async message => {
await message.edit("E");
});
});```
ember atlas
#

that is the literally the code

digital ibex
#

i was talking about "its jake" about nesting events

ember atlas
#

lol

digital ibex
#

๐Ÿ˜ณ

#

u dont have to await editing the message

#

idk, kinolte might be right, im stuck with creating an event handler myself shrug

ember atlas
#

@sudden geyser Ive just always done it like this (before switching to eris), it's my go to event handler and it just started having this issue today

sudden geyser
#

Alright, and I assume that snippet of code is the top-level of your file (as in it'll only be run once)?

ember atlas
#

mhm

#

Its weird, i have 2 events logs and sends twice, 3 logs 3 times and sends the hook 3 times and etc

earnest phoenix
#

@digital ibex sometimes you need to await message edits

#

(only sometimes)

digital ibex
#

ive never done it like that

#

tbh, rarely edit messages

#

so, i wouldn't really kno tbh

wide ridge
#

sometimes an image or gif doesn't load in a RichEmbed, does anyone know why? Usually if I edit the embed afterwards, the image would load. It's as if it needs to be refreshed sometimes. Just curious why that happens?

earnest phoenix
#

@digital ibex editing an embed to other embed is satisfying tho lmao

digital ibex
#

theres no reason for me to with my bot

#

so

#

i dont

late hill
#

That's a user specific issue

earnest phoenix
#

@wide ridge code?

digital ibex
#

i only edit a message for the ping command

late hill
#

Which I think is caused by just having your connection bork

#

While you might not see the image, others probably can

digital ibex
#

gopi, thats most likely ur connection or discord

wide ridge
#

probably discord

late hill
#

Occasionally it'll also just be discord being poopy and no one will see any images for a while

wide ridge
#

from what I've seen

#

yeah it's somewhat a common issue

earnest phoenix
#

@late hill nope sometimes discord API can't fetch image URLs... That's the issue

wide ridge
#

O.O

late hill
#

Ok but

#

why do other people see it

#

๐Ÿง 

digital ibex
#

as long as the url is a string, then its discord

wide ridge
#
                .setImage(\`${gif}\`)
                .setColor(\`${colorCode}\`)
                .setDescription(\`${msgToSend}\`)
                .setTimestamp();```
late hill
#

why is it a common af issue on mobile devices

wide ridge
#

yeah url is a string

late hill
#

while incredibly rare on desktops

#

๐Ÿง 

earnest phoenix
#

@wide ridge wait a minute...

#

Why are you putting \? Instead of just \?

#

Backslash didn't appear lmao

digital ibex
#

um

sudden geyser
#

https://canary.discordapp.com/channels/264445053596991498/272764566411149314/698694444152520734

  1. Read the ./events/ directory.
  2. For each directory:
    a. Read the ./events/ directory and filter it for each JS file.
    b. For each JS file:
    1. Require the file (./events/<file>)
    2. Load the file.
      c. For each JS file (again):
    3. Require the file.
  3. Log "Events Loaded"

@ember atlas I can't guess it off the top of my head, but does this sound normal? You'd essentially be reading the directory once to do it your usual once, but you're doing it again, so wouldn't it being it all over again for how many events you have to load?

digital ibex
#

because without having to contactonate or whatever tf its called

#

connactecate

#

yeah, idk how to spell it

wide ridge
#

Why are you putting \? Instead of just ?
@earnest phoenix that's in my broadcastEval for sharding

ember atlas
#

Again always worked till now

#

So i didnt really go through it

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

@wide ridge hmm... Anyway...
But always .setImage(`${gif}`) worked tho

ember atlas
#

@sudden geyser Went ahead and removed the last requiring the file, issue still persists

digital ibex
#

:D

wide ridge
#

original code is

        .setColor(`${colorCode}`)
        .setImage(`${gif}`)```
digital ibex
#

setimaghe never works for me

earnest phoenix
#

Hmm

#

Lol

wide ridge
#

so yeah it's a discord issue

#

strange

#

kind of have to just get used to it I guess

#

it's not that common, but still happens occasionally

late hill
#

yes

#

it sucks getting bug reports from people thinking your bot is broken because the images don't load

wide ridge
#

yuppp

#

I feel the pain

earnest phoenix
#

@wide ridge ever saw something more drunk than discord?

#

Lol

wide ridge
sudden geyser
#

@ember atlas, you're not doing anything with it, so it wouldn't be an issue (I think). I think it has to be with you requiring the same directory twice and looping it twice in the same loop. That's likely the cause of it re-requiring it for the number of events.

ember atlas
#

I just really dont get it

#

It's always worked til now

#
readdirSync('./events/').forEach(dir => { 
    const events = readdirSync(`./events/`).filter(file => file.endsWith('.js')); 
    for (let file of events) { 
        const evt = require(`./events/${file}`)
        let eName = file.split('.')[0]
        callisto.on(eName, evt.bind(null, callisto))
    }


});
``` changed to this
sudden geyser
#

If you removed readdirSync('./events/').forEach((dir) => { and the ending }), would that change anything?

ember atlas
#

Oh

#

I see

#

Yep thats the issue i bet

sudden geyser
#

That's what I've been talking about the whole time.

ember atlas
#

i used to do events/dir/file

#

Never fixed that LULW

#

Yep there it is

#

Sorry for me being dumb ded

sudden geyser
ember atlas
#

whats the equivalent of message.guildfor eris?

sudden geyser
#

message.channel.guild

grizzled raven
#

big brain

#

i take it wouldnt be that hard to build a bigger library around eris

valid frigate
#

the smaller the library yes you can expand on it

#

or at least it becomes much easier

#

in fact you could make djs out of eris but that's just saying how easy it is to extend off of what eris provides for you

earnest phoenix
ember atlas
earnest phoenix
#

Hmm what about the view guild insights? @ember atlas

ember atlas
#

Where do you see that at?

earnest phoenix
#

In the image

ember atlas
#

I believe that has something to do with partnered / verified guild things

earnest phoenix
#

Hmm

ember atlas
#

It's some kind of statistics i think

earnest phoenix
#

Anyways... Thx for the help...

ember atlas
earnest phoenix
#

Hmm i see...

#

Hasn't gotten to the partnered server im in, oof

buoyant totem
#

Need some help if anyone is available. Trying to embed the roles of the person who typed the command but I cant seem to figure it out

sudden geyser
#

Can you show your code

buoyant totem
#

Sure thing

#
switch(args[0]){
        case 'info':
            const info = new Discord.MessageEmbed()
            .setTitle('User Information')
            .addField('Player Name', message.author.username)
            .addField('Roles', message.member.roles)
            .setColor(3447003)
            .setThumbnail(message.author.displayAvatarURL());
            message.channel.send(info);
        break;
#

This is the part that sends the embed

regal saddle
buoyant totem
#

yes

regal saddle
#

message.member.roles is not a thing i guess. You need to look up the docs

buoyant totem
#

I have

#

But I cannot figure it out

regal saddle
#

Let me see real quick

buoyant totem
#

Spent over an hour looking

fleet chasm
#

its a thing

#

but you probably should map the cache i guess

buoyant totem
#

Ok

#

And how would I do that? I'm quite new to nodejs

outer niche
#
@commands.has_permissions(administrator =True)
async def ban(ctx, member : discord.Member, reason=None):
    await member.ban(reason=reason)
    await ctx.send(f'Banned {member.name} for {reason}')
    await user.send(f'Banned {member.name} for {reason}')```
#

I do not know why it is not sending the user that was banned the message

fleet chasm
regal saddle
#

Python oof, did you already tried user.dm?

outer niche
#

No but I will try

regal saddle
#

kk

earnest phoenix
#

user isn't defined

#

you used member in the args

#

not user @outer niche

buoyant totem
#

ahhh

outer niche
#

So how would I modify the user.send what I do member.send

regal saddle
#

Yes

earnest phoenix
#

its fairly simple

regal saddle
#

didnt even saw that lol

#

๐Ÿ˜„

outer niche
#
@commands.has_permissions(administrator =True)
async def ban(ctx, member : discord.Member, reason=None):
    await member.ban(reason=reason)
    await ctx.send(f'Banned {member.name} for {reason}')
    await member.send(f'Banned {member.name} for {reason}')``` so this
earnest phoenix
#

tias

#

but it should

buoyant totem
#

@fleet chasm How do I make that line between (' ')

fleet chasm
#

like space the roles out

earnest phoenix
#

first send message then ban

buoyant totem
#

Yeah but how do I type that symbol

earnest phoenix
#

ahh yes cry

regal saddle
#

| copy that @buoyant totem

earnest phoenix
#

forgot about that lmao

buoyant totem
#

ty

outer niche
#

Also in that command it only takes the first word for the reason how would I get to take the entire sentence

earnest phoenix
#

when you ban, you remove the user from the guild, effectively making your bot to not meet one of two conditions to send a dm

buoyant totem
#

I just got an error with it @fleet chasm

#

here's how it looks rn

#
switch(args[0]){
        case 'info':
            const info = new Discord.MessageEmbed()
            .setTitle('User Information')
            .addField('Player Name', message.author.username)
            .addField('Roles', message.member.roles.map(r => `${r}`).join(' | '))
            .setColor(3447003)
            .setThumbnail(message.author.displayAvatarURL());
            message.channel.send(info);
        break;
    }
fleet chasm
#

roles.cache

earnest phoenix
#

async def ban(ctx, member : discord.Member, *, reason=None):

fleet chasm
#

if you are on v12?

buoyant totem
#

so not map?

#

yes

earnest phoenix
#

you should learn python @outer niche

fleet chasm
#

roles.cache.map then

buoyant totem
#

ah ok

outer niche
#

I know Python it would not help if I was in the hospital though

#

And on a crap ton of drugs

fleet chasm
buoyant totem
#

It work!

#

Tysm

#

@fleet chasm

fleet chasm
#

np

buoyant totem
#

โค๏ธ

#

Been trying for hours lmao

trim saddle
#

@outer niche how about sending before banning

earnest phoenix
#

Thats already been mentioned

outer niche
#
@commands.has_permissions(administrator =True)
async def ban(ctx, member : discord.Member, *, reason=None):
    await member.ban(reason=reason)
    await ctx.send(f'Banned {member.name} for {reason}')
    await member.send(f'Banned {member.name} for {reason}')```
#

This does not send a DM to the user And it does not capture the entire sentence like I wanted it to does anybody know what happened where I went wrong

earnest phoenix
#

we told you

#

send the message

#

before banning

#

or else it'll error

#

cause the member will no longer be in the guild

grizzled raven
#

bruh lol

#

uhh

#

ah yes

outer niche
#
@commands.has_permissions(administrator =True)
async def ban(ctx, member : discord.Member, *, reason=None):
    await ctx.send(f'Banned {member.name} for {reason}')
    await member.send(f'Banned {member.name} for {reason}')
    await member.ban(reason=reason)``` this
sudden geyser
#

try it out and see

grizzled raven
#

when a guild experiences an outage and recovers, will the guild.available be true by the time the guild create event fires for that guild

earnest phoenix
#

A guild becoming available triggers guild create?

sudden geyser
#

some libraries,

earnest phoenix
#

Weird

grizzled raven
#

so like

trim saddle
#

now i have a problem i could use help with

function copythings(filename) {
                var copyfield = document.getElementById("copyfield")
                copyfield.value = `ree+${filename}`
                copyfield.select()
                document.execCommand("copy")
                copyfield.value = ""
}
<textarea id="copyfield"></textarea>

so the issue here is, when i run copythings nothing gets put in the text area

edgy heron
#
npm WARN addon-development@1.0.0 No repository field.
npm WARN addon-development@1.0.0 No license field.

npm ERR! path /app/node_modules/.bin/node
npm ERR! code EEXIST
npm ERR! Refusing to delete /app/node_modules/.bin/node: ../node/bin/node symlink target is not controlled by npm /app/node_modules/node
npm ERR! File exists: /app/node_modules/.bin/node
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/12.0.0/_logs/2020-04-12T02_33_01_168Z-debug.log```
#

weird

#

when i tried to install that api package

outer niche
#

It still does not work

earnest phoenix
#

did you restart the bot?

#

Save the file?

sudden geyser
#

TheNoob, I can't confirm it, but it probably will be true.

trim saddle
#

or reload the cog

outer niche
#

Yes

earnest phoenix
#

send the code again

grizzled raven
#

im not good with html but try innerHTML imcool

outer niche
#
@commands.has_permissions(administrator =True)
async def ban(ctx, member : discord.Member, *, reason=None):
    await ctx.send(f'Banned {member.name} for {reason}')
    await member.send(f'Banned {member.name} for {reason}')
    await member.ban(reason=reason)```
grizzled raven
#

nah nvm

edgy heron
#

@earnest phoenix its in glitch

ocean violet
#

How am I suppose to get the shard ID in ready event

earnest phoenix
#

? @edgy heron

edgy heron
#

did you ask me to restart> trash?

earnest phoenix
#

no

#

talking to cula...

trim saddle
#

@outer niche wait is this in a cog?

edgy heron
#

mention names then multiple peeps asking for support lol

earnest phoenix
#

Wait

#

why are you using bot.command

edgy heron
#
 npm i dblapi.js
npm WARN addon-development@1.0.0 No repository field.
npm WARN addon-development@1.0.0 No license field.

npm ERR! path /app/node_modules/.bin/node
npm ERR! code EEXIST
npm ERR! Refusing to delete /app/node_modules/.bin/node: ../node/bin/node symlink target is not controlled by npm /app/node_modules/node
npm ERR! File exists: /app/node_modules/.bin/node
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/12.0.0/_logs/2020-04-12T02_33_01_168Z-debug.log````
earnest phoenix
#

and commands.

outer niche
#

No none of my administrator commands are in a cog

regal saddle
#

Skullbite, i cant help you. Im sorry.

trim saddle
#

it's gucci

regal saddle
ocean violet
#

How am I suppose to get the shard ID in ready event? Helpppp

earnest phoenix
outer niche
#

Ok

earnest phoenix
#

they can assist you further

#

and better

regal saddle
#

How am I suppose to get the shard ID in ready event? Helpppp
How large is your Bot?

edgy heron
#

ping me when someone gonna reply

regal saddle
#

@outer niche did you install py global?

outer niche
#

what

regal saddle
#

Oh wait

#

i messed it up, im sorry for that random ping.

trim saddle
#

@grizzled raven so innerText, innerHTML and value don't change

grizzled raven
#

yeah idk

outer niche
#

You're fine

earnest phoenix
#

So yea, go to dpy server, they can help better

grizzled raven
#

are you sure the func gets ran?

trim saddle
#

it should

#

it's under a button

ocean violet
#

How am I suppose to get the shard ID in ready event

#

Please help

trim saddle
#

in what langauge

ocean violet
#

Js

trim saddle
#

idk

ocean violet
edgy heron
#

hyper told me? outdatedd?

ocean violet
#

wut

edgy heron
#

i am folowing it

#

to show number of servers

ocean violet
#

Bruh no

#

Its outdated

#

100%

#

v11 code

earnest phoenix
#

@ocean violet maybe...
<client>.shard.id?

ocean violet
#

Thats exactly the code in v11 but I am in v12

earnest phoenix
#

@ocean violet it's the exact same on v12 tho

ocean violet
#

Wtf

#

It returns undefined

#

When I eval it

earnest phoenix
#

Hmm...

#

@ocean violet do you use shardingManager?

ocean violet
#

I did

#

Or is it possible to postStats without it?

edgy heron
#

@ocean violet can you help me with v12?

ocean violet
#

What do you need

edgy heron
#

its say 401 unauthorized error

#
Example
Example of posting server count with supported libraries (Discord.js and Eris)

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})```
#

v12....

earnest phoenix
#

@ocean violet maybe try:
<client>.shard.shards.id...

ocean violet
#

Where did the error occurs

edgy heron
#

Oops! Error: 401 Unauthorized

ocean violet
#

Did you spam their api

earnest phoenix
#

Hmm Unauthorized... I never saw that error on dbl server count post before

ocean violet
#
401 Unauthorized Error Occur: This error may occur due to the reasons described below:

It may occur client does not provide the proper authentication credentials to the server within the request time.
It may occur when the server rejects the request of the client for some reasons even though the client provides proper authentication credentials.
When the client is banned for some reasons by the server.
#

I guess you spammed their api?

#

Probably wait 1 hour and try agian

edgy heron
#

how would i spam

#

i am doing what they said in guide mate..

trim saddle
#

either you're ratelimited

#

or your token is wrong

ocean violet
#

I just accidentally spammed the api by not setting the interval time

edgy heron
#

i just copy pasted their code

trim saddle
#

did you alter anything

ocean violet
#

no wait

#

You didnt put ur token

#

LOL

edgy heron
#
onst dbl = new DBL('SECRET', bot);



dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})

bot.shard.fetchClientValues('guilds.cache.size')
    .then(results => {
        console.log(`${results.reduce((prev, guildCount) => prev + guildCount, 0)} total guilds`);
    })
    .catch(console.error);```
#

i did

#

i putted

trim saddle
edgy heron
#

xD

ocean violet
#

Where is this file

edgy heron
#

i didnt add any interval

#

hypergame in bot.js > glitch

ocean violet
#

Glitch doesnt support connecting

#

to other servers

#

Other than port 3000

#

rip

trim saddle
#

also add an interval

#

if someone spams your guild event you'll most likely get ratelimited

ocean violet
#

Glitch only allows port 3000 connection

edgy heron
#

@ocean violet there is others bots hosted in glitch as well

#

and working

ocean violet
#

DBL doesn't like bots hosted on glitch and other similar platform

edgy heron
#

doesnt like

#

lol

#

@latent willow this bot is hosted in glitch, still he have total server counts in his top.gg bot page

ocean violet
#

My bot got 400 bad request

#

I dont even know why

earnest phoenix
#

your bot sent a bad request

digital ibex
#

hi

#
        let GuildModel = require('../../models/Guild');
        const guild = await GuildModel.findOne({ id: message.channel.guild.id });
        console.log(guild.prefix);
        console.log(guild.welcome.channel);
        console.log(guild.welcome.message);
        try {
            if (!args.length) {
                message.channel.createMessage(`Please provide a channel for me to greet new members!`);
            } 
            let channel = guild.welcome.channel;
            if (channel === null) guild.updateOne({ channel: args[0] }).then((e) => console.log(e));
            await guild
                .updateOne({ channel: args[0] })
                .then((e) => message.channel.createMessage(`Successfully set the welcome channel to <#${args[0]}>`));
        } catch (e) {
            console.log(e);
            message.channel.createMessage(errorInE);
        }
``` i am trying to set a welcome channel and uh
#

its logging null when i set the channel, any ideas why?

#

my guildschema:

#

the welcome bit: js welcome: { message: String, channel: String }

fleet chasm
#

what version of d.js are you using by any chance

finite bough
#

crow the 1st word u wrote was onst

minor kelp
#

how to make my bot save all emotes from all guilds its in to a file (python) because i cant do it bcoz im an idiot

earnest phoenix
#

umm

valid gyro
#

My bot is hosted on glitch

earnest phoenix
#

I would be able to help with the write file part but its python sooo

#

same Rag

#

its reliable-ish

#

just space is super lower compared to ram lmao

#

500mb of ram but my bot uses 40mb of ram 1% cpu usage and 196mb of the 200mb of storage an oof

valid gyro
#

I really need to get a self pinging script in mine, rn it's relying on uptime robot which goes down like every 2 hrs

earnest phoenix
#

mine is on uptime robot

#

it works good enough with minor outages every 8hrs?

ripe lantern
#

i need some help, on my bot i entered a command and it does not say anything

earnest phoenix
#

but thats kinda a good thing kinda like auto restarts that you didnt ask for

valid gyro
#

I have to manually restart mine usually

earnest phoenix
#

why?

valid gyro
#

Idk why

earnest phoenix
#

it should auto start

#

if your package.json is setup right

valid gyro
#

What do I need in my package?

earnest phoenix
#

"scripts": {
"start": "node bot.js"
},
"engines": {
"node": "12.16.1"
},

#

start is the script that starts the bot

#

and node is just your node.js version that you want it to use

valid gyro
#

Yeah I have that

#

Although I wrote it in node 13, and glitch runs it at 10, idk if that affects it

earnest phoenix
#

why host on glitch?

#

Heroku is another free option AND python bots atleast continue working even after your hours are up

digital ibex
#

glitch and heroku r both shit

golden condor
#

I'm really getting annoyed with this stupid thing, my bot keeps running two instances

digital ibex
#

um

#

just like

#

disconnect it on one?

#

nvm

ripe lantern
#

my bot wont say anything when i use a command

digital ibex
#

cool

#

can u like

#

give more info?

ripe lantern
#

ok

#

here is all the code

#

in the bot

#

and i use python 3.6

digital ibex
#

u uh

#

token

#

delete

#

now

#

probably should send it without the token and regen another 1 tbh

ripe lantern
#
import asyncio
from discord.ext import commands

bot = commands.Bot(command_prefix = '<')

@bot.event
async def  on_ready():
    print("ready")
    
@bot.command(pass_conetext=True)
async def ping(ctx):
    await bot.say ("ping")
    
bot.run("heres my token b ru h")```
#

and i regen the token

#

tbh

#

nobody could even do anything to my bot

#

because it in one server with only me

#

and i could just

#

yknow

#

ban it

#

so

#

what am i doing wrong

digital ibex
#

iirc its await ctx.say

#

could be wrong

golden condor
#

@digital ibex I can't

#

It's brpken

#

It shows as one instance

#

But acts as two

ripe lantern
#

so uh

#

whats it supposed to be instead of await ctx.say

finite bough
#

@digital ibex I can show u an easier way to do that welcome

digital ibex
#

how?

finite bough
#

holdon

digital ibex
#

blaine, i don't know python very well

ripe lantern
#

oh

mossy vine
#

since i cant fetch more than 100 messages can i fetch 100 then use the oldest as the before parameter of another fetch?

ripe lantern
#

i need more info on dat

digital ibex
#

probably you can sort the messages

#

what language?

mossy vine
#

language doesnt matter as im talking about the api in general

digital ibex
#

oh, i thought u meant how to code it

#

idk about dapi much tbh

slender thistle
#

@ripe lantern Messageable.send

#

Messageable is any object you can message on Discord: users, members (in d.py at least) and text channels

#

ctx aka Context object inherits Messageable so you can do ctx.send

ripe lantern
#

thanks!

#

imma test it

#

it says "Syntax error"

#

so what do i do?

slender thistle
#

What's your code

ripe lantern
#
import asyncio
from discord.ext import commands

bot = commands.Bot(command_prefix = '<')

@bot.event
async def  on_ready():
    print("ready")
    
@bot.command(pass_conetext=True)
async def ping(ctx.send):
    await bot.say ("ping")
    
bot.run("token")```
#

i did put in the token i just edited the message

slender thistle
ripe lantern
#

what do you mean?

#

i am very new to coding stuff

regal schooner
#

you can do print(discord.__version__)

ripe lantern
#

ok

#

it says that "discord" is not defined

#

so whats up w dat?

#

oh wait

#

i just had to import discord lol

#

1.3.3

digital ibex
#

hi

ripe lantern
#

ya?

digital ibex
#
        try {
            let guild = await GuildModel.findOne({ id: message.channel.guild.id });
            let channel = guild.welcchan;
            if (!args.length) {
                message.channel.createMessage(`more args pls`);
            } else {
                channel = args[0];
                await guild
                    .updateOne({ channel: channel })
                    .then((e) => message.channel.createMessage(`channel: ${channel}`));
                guild.save();
            }
        } catch (e) {
            console.log(e);
            message.channel.createMessage(errorInE);
        }
``` with mongoose, why is this not saving into compass?