#development

1 messages ยท Page 1430 of 1

dim wadi
#

that

terse finch
#

so the following code only produces the following "role" @everyone

print( (get(message.author.roles)) )
hollow sedge
terse finch
#

nvm

hollow sedge
#

Ohh

#

I see

#

You are using markdown right? @dim wadi

terse finch
#

anyone know anything about shebang lines

south sinew
#

if anyone has experience with discord.js-light, i need some help with some errors i am getting while trying to use the voiceStateUpdate event
what i am trying to achieve is for my bot to leave the vc and clear the music queue when there are no other users in it, or clear the queue when manually disconnected it. i was able to achieve this with normal discord.js using this code

// If a user leaves or changes channels
if (oldState != null && oldState.channelID != newState.channelID) {
    const serverQueue = client.queue.get(oldState.guild.id);
    const channelInfo = oldState.guild.channels.fetch(oldState.channelID);
    const botChannelID = oldState.guild.members.fetch(client.user.id).voice.channelID;
    const usersInVC = channelInfo.members.filter(member => !member.user.bot).size;

    // If the bot is the only user in the VC clear the queue and leave
    if (channelInfo.members.has(client.user.id) && usersInVC < 1) {
        if (serverQueue) {
            if (serverQueue.twentyFourSeven) return;

            let leaveEmbed = new Discord.MessageEmbed()
                .setColor(0xff4a4a)
                .setTitle(`๐Ÿ‘‹ Left due to no other users being present in the VC.`);

            serverQueue.textChannel.send(leaveEmbed);
            if (serverQueue.connection.dispatcher) serverQueue.connection.dispatcher.destroy();
            if (client.queue) client.queue.delete(oldState.guild.id);
        }
        channelInfo.leave();

        // If the bot is not in a VC and there is a queue, clear the queue 
    } else if (botChannelID == null && serverQueue) {
        let leaveEmbed = new Discord.MessageEmbed()
            .setColor(0xff4a4a)
            .setTitle(`๐Ÿ‘‹ Left due to being manually disconnected.`);

        serverQueue.textChannel.send(leaveEmbed);
        if (client.queue) client.queue.delete(oldState.guild.id);
    }
}
#

problem is, discord.js light sends a null response when someone disconnects, causing the code to error out, and i cant seem to find a way to make it detect the specifics i need it to with that

#

any help is appreciated

earnest phoenix
#

any way i can get the lyrics of asong?

#

scrape genius

#

if you google around you can also probably find alternative apis

#

ok

quartz kindle
south sinew
#

ok, thanks!

prisma wren
#
commandHandler(path) {
        this.fs.readdirSync(this.path.normalize(path)).map((f) => {
            const File = require(this.path.join(__dirname, '..', path, f));
            this.commands.set(File.name, File);
        });
    };
    getCommand(cmd) {
        return this.command.has(cmd) ? this.command.get(cmd) : false;
    }
    start(token, path) {
        this.commandHandler(path);
        this.login(token);
        this.mongoose.connect('//this is the link but i deleted it cuz its important to keep safe i think', {
            useNewUrlParser: true,
            useUnifiedTopology: true
        });
        this.mongoose.connection.on('connected', () => console.log('DB connected'));
        this.on('ready', () => console.log(`${this.user.tag} is now online!`));
        this.on('message', async(message) => {
            if(message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(this.config.prefix)) return;
            const args = message.content.slice(this.config.prefix.lenght).trim().split(/ +/g);
            const cmd = args.shift().toLowerCase();
            const command = this.getCommand(cmd);
            if(!command) return;
            if(command.timeout) {
                if(this.timeouts.has(`${command.name}${message.author.id}`)) return message.channel.send(this.embed({ description: `Please wait ${this.ms(Date.now() - this.timeouts.get(`${command.name}${message.author.id}`), { long: true })}`}));
            } else return command.run(this, message, args).catch(console.error);
        })
    }
    embed(data, message) {
        return new this.discord.MessageEmbed({ ...data, color: 'RANDOM' }).setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true, format: 'png' }));
    }
};
module.exports = EconomyClient

so i was following a tutorial for the beginning of an economy bot and I ran into a problem as it says there are some problems with the code and I need to fix them to move one. can anyone help?

quartz kindle
#

it says there are some problems with the code

#

what are the prolems?

prisma wren
#

there is more code above so the line numbers are off

#

its starts at number 21

quartz kindle
#

show the code before

prisma wren
#

ok

#
const { Client, Collection, MessageEmbed } = require('discord.js');
class EconomyClient extends Client {
    constructor() {
        super();
        this.discord = require('discord.js');
        this.fs = require('fs');
        this.path = require('path');
        this.ms = require('ms');
        this.mongoose = require('mongoose');
        this.commands = new Collection();
        this.timeout = new Collection();
        this.config = {
            prefix: '?',
        };
        this.schemas = this.mongoose.model('economy', new this.mongoose.Schema({
            user: String,
            Coins: Number
        }))
        }
    }
quartz kindle
#

this.schemas - this.mongoose.model

#

isnt that supposed to be an =

prisma wren
#

and this is a reason im not a good coder, way too many spelling mistakes

quartz kindle
#

also, you have one bracket too many

#

you're ending the class before the other methods

prisma wren
#

which bracket is it?

quartz kindle
#

just copy and paste your code into an online js beautifier or whatever and you'll see

prisma wren
#

ok

#

It says there are still 5 problems

quartz kindle
#

did you remove the bracket?

#

if you're still wondering which one

prisma wren
#

oh ok

#

ah that fixed it, thank you so much

earnest phoenix
#

anyone know how to show how many severs its in like a live feed of how many seves its in

earnest phoenix
#

wdym

#

@chilly bison

chilly bison
#

pusher

#

and a html page

#

that's all you need

earnest phoenix
#

can you show me picture

chilly bison
#

if ya wanna be fancy you can add countup.js

#

pusher

#

html

#

noom

warm marsh
#

Tf is a pusher?

earnest phoenix
#

lemme see

#

@chilly bison in top.gg right
?

#

@chilly bison hello

chilly bison
#

no

#

pusher

#

and html

earnest phoenix
warm marsh
#

You use the API and send the bot guilds every x hours.

#

Webhook or whatever it's called.

dim wadi
hollow sedge
#

how are you making the website

#

@dim wadi

floral oracle
#

is it possible to give your discord bot a custom emoji on its status

dim wadi
hollow sedge
#

yes

dim wadi
#

?

hollow sedge
upper elm
dim wadi
#

Do u see the images where it says Help Panel @hollow sedge ?

upper elm
#

or how can you check if a user is a webhook

hollow sedge
#

sigh ik this is markdown

copper cradle
upper elm
#

thanks?

hollow sedge
#

can you show me the markdown for the image @dim wadi

copper cradle
#

idk what a partial is

upper elm
#

alr

floral oracle
#

is it possible to give your discord bot a custom emoji on its status

hollow sedge
#

i dont think bots can have emoji statuses anyway

upper elm
dim wadi
#

LMAO nvm it was my fault i ut a space where the alt

#

i put a space

hollow sedge
#

dude

dim wadi
#

oops

hollow sedge
#

if you had showed me that i couldve helped you lol

dim wadi
#

sowwy ๐Ÿ˜ฆ

hollow sedge
#

lol as long as you fixed it, it's good

dim wadi
#

UwU ๐Ÿ™‚

lunar sequoia
# upper elm what is a partial user?

The library usuall drops events if the required data isn't cached already. For example, if a message was deleted and that particular message wasn't found in cache then the messageDelete event isn't fired. However, if you enable partials, you will start receiving the ID related to the event. For example, if a message was deleted but wasn't found in cache, the event will still be fired but, the caveat being that the message object passed to the event will only have the ID, in this case, the message ID. Head over to the docs to find an example with the messageReactionAdd event as well.

young flame
#

uh i have a question

#

is it possible to like list a persons warns AND the person who warned them the reason and time?

floral oracle
#

yes

earnest phoenix
#

if you keep track of it

#

a usual pattern for this would be to have a punishment object which has the following
type property that defines the punishment type (i.e. warn/ban/kick etc)
target property that defines the target of the punishment (user id)
issuer property that defines the person responsible for the punishment (user id)
timestamp property that defines the unix timestamp of the occurance

#

you can obviously throw in a reason and other shit in there

lunar sequoia
floral oracle
#

you're wrong on some of that

#

you can definitely give custom statuses to bots

#

it's been around longer than users even had the option @lunar sequoia

lunar sequoia
#

Umm no, when I say custom status, it is referring to the Custom status that users can set on their profiles. Bots have never had access to set this custom status however, you can set a status with the default PLAYING, WATCHING, LISTENING, etc.

floral oracle
#

yeah that's what I was referring ti

#

ohhhh

#

sorry I misunderstood

prisma wren
#
const { Message } = require("discord.js");
const Client = require("../structures/Client");
module.exports = {
  name: `ping`,
  /**
   * @param {Client} client
   * @param {Message} message
   * @param {string[]} args
   */
  run: async (client, message, args) => {
    const msg = await message.channel.send("Pinging..");
    await msg.edit(
      client.embed(
        {
          description: `Pong!\nMessage edit: ${
            msg.createdAt - message.createdAt
          }\nWS: ${client.ws.ping}`,
        },
        message
      )
    );
    await msg.edit(`Pong!`);
  },
};
#

So, I created the ping command and I did the node . thing and it said the bot was online yay but when I typed the command in my discord, it didn't work and an error popped up. Ill send the ss of the error below. If anyone can help me figure out where I went wrong, I'd like that.

south sinew
silver lintel
#
const config = require('../../config.json');
module.exports = {
  name: 'help',
  aliases: ['commands'],
  cooldown: 3,
  description: 'List all of my commands or info about a specific command',
    usage: '<command>',
  type: 'info',
  execute: (message, args) => {
//...
message.channel.send(config.color)
//Cannot access 'config' before initialization
prisma wren
#
const { Client, Collection, MessageEmbed } = require("discord.js");
const { set } = require("mongoose");
class EconomyClient extends Client {
  constructor() {
    super();
    this.discord = require("discord.js");
    this.fs = require("fs");
    this.path = require("path");
    this.ms = require("ms");
    this.mongoose = require("mongoose");
    this.commands = new Collection();
    this.timeout = new Collection();
    this.config = {
      prefix: "?",
    };
    this.schemas = this.mongoose.model(
      "economy",
      new this.mongoose.Schema({
        user: String,
        Coins: Number,
      })
    );
  }
  commandHandler(path) {
    this.fs.readdirSync(this.path.normalize(path)).map((f) => {
      const File = require(this.path.join(__dirname, "..", path, f));
      this.commands.set(File.name, File);
    });
  }
#
getCommand(cmd) {
    return this.command.has(cmd) ? this.command.get(cmd) : false;
  }
  start(token, path) {
    this.commandHandler(path);
    this.login(token);
    this.mongoose.connect(
      "//this is a link i should keep safe or smth",
      {
        useNewUrlParser: true,
        useUnifiedTopology: true,
      }
    );
    this.mongoose.connection.on("connected", () => console.log("DB connected"));
    this.on("ready", () => console.log(`${this.user.tag} is now online!`));
    this.on("message", async (message) => {
      if (
        message.author.bot ||
        !message.guild ||
        !message.content.toLowerCase().startsWith(this.config.prefix)
      )
        return;
      const args = message.content
        .slice(this.config.prefix.lenght)
        .trim()
        .split(/ +/g);
      const cmd = args.shift().toLowerCase();
      const command = this.getCommand(cmd);
      if (!command) return;
      if (command.timeout) {
        if (this.timeouts.has(`${command.name}${message.author.id}`))
          return message.channel.send(
            this.embed({
              description: `Please wait ${this.ms(
                Date.now() -
                  this.timeouts.get(`${command.name}${message.author.id}`),
                { long: true }
              )}`,
            })
          );
        command.run(this, message, args).catch(console.error);
        this.timeouts.set(
          `${command.name}${message.author.id}`,
          Date.now() + command.timeout
        );
        setTimeout(() => {
          this.timeouts.delete(`${command.name}${message.author.id}`);
        });
      } else return command.run(this, message, args).catch(console.error);
    });
  }
#
embed(data, message) {
    return new this.discord.MessageEmbed({
      ...data,
      color: "RANDOM",
    }).setFooter(
      message.author.tag,
      message.author.displayAvatarURL({
        dynamic: true,
        format: "png",
      })
    );
  }
}
module.exports = EconomyClient;
#

thats the whole thing

south sinew
#

looks like its an issue with this block

 if (command.timeout) {
        if (this.timeouts.has(`${command.name}${message.author.id}`))
          return message.channel.send(
            this.embed({
              description: `Please wait ${this.ms(
                Date.now() -
                  this.timeouts.get(`${command.name}${message.author.id}`),
                { long: true }
              )}`,
            })
          );
prisma wren
#

on the client?

south sinew
#
this.timeouts.has

thats throwing the error

#

you dont have timeouts defined

prisma wren
#

so what should i do, make one?

south sinew
#

no, you just made a typo :)

this.timeout = new Collection();

should be

this.timeouts = new Collection();
prisma wren
#

ah

#

yes

#

ok tysm

south sinew
#

sometimes the simplest things are the problem

#

np

prisma wren
#

yeah the reason im not a great coder is a) im not 100% familiar with the language and b) im not the best typer

south sinew
#

yeah i feel that lol

prisma wren
#

hey, @south sinew, sorry for ping but it is still giving an error

south sinew
#

whats the error?

prisma wren
south sinew
#

ok, so timeouts is still undefined

prisma wren
#

i thought i changed it tho

#

wait.....

#

let me try smth

#

nvm i thought it was because i didnt save it

#

but still gave the error

south sinew
#

different or same?

prisma wren
#

same

south sinew
#

hmmm

#

just check over your code again and make sure that timeouts is still defined throughout

#

js is wack sometimes

prisma wren
#

alr

#

i dont have to change this right?

south sinew
#

no

prisma wren
#

alr then they are all changed

lunar sequoia
#

hmm, I'm not too sure but try replacing the if condition to this.timeouts && this.timeouts.has()

prisma wren
#

this?

lunar sequoia
#

Yup, give it a try now

prisma wren
#

ok

#

same error still

lunar sequoia
#

What's the error now?

prisma wren
lunar sequoia
#

Oh wait a minute

#

I know the error lol

prisma wren
#

ok

lunar sequoia
#

In your getCommand function, it's supposed to be this.commands.has

prisma wren
#

where?

lunar sequoia
#

Show me where line 31 is

prisma wren
#

ohhhhh

#

its that supposed to be with an s too?

lunar sequoia
#

Yeah, you missed an "s"

prisma wren
#

so should i undo what you had me do earlier?

lunar sequoia
#

So, it should be this.commands.has()?this.commands.get():false

lunar sequoia
prisma wren
#

ok

#

so, it didnt work nor did it give me an error

#

when i did ?ping on my server, it didnt respond

#

but i havent received an error yet

lunar sequoia
#

What is line 31 now?

prisma wren
valid grotto
#

Am I unable to verify my bot if I'm under 18? Discord requires a government-issued ID.

pale vessel
#

Nah, as long as you're over the minimum age (which is 13 and 16 in some countries), you can verify your bot

upper elm
#

Yeah, passports work and if you have a driver's liscence that works

earnest phoenix
#

you can get an id while you're underage though, no?

upper elm
#

I'm under 15 so I had a bit of a struggle lol

earnest phoenix
#

i got my id when i was 13

valid grotto
pale vessel
#

Yep, here we have IDs issued to citizens that are 12 and above

#

I used mine

earnest phoenix
#

huh

#

oh yeah the service they're using has retarded policies

valid grotto
#

It's government issued kids ID, I'm not sure why it's not accepted.

earnest phoenix
#

they don't accept certain documents from certain countries

valid grotto
#

Guess I'll try it again with a student ID

earnest phoenix
#

it will tell you what can be used for your country

valid grotto
earnest phoenix
#

ooof

#

stripe isn't even in my country ๐Ÿ™ƒ

pale vessel
#

Do you live inside a cave

earnest phoenix
#

close enough

#

second world country

#

lol

prisma wren
#

could anyone help me find out what is wrong with my code? when i node it, it says that its online and connected but when i go into my server and run the command, there isnt a response. before, everytime there wasnt a response the terminal said there was an error but there is no appeared error in the terminal.

earnest phoenix
#

don't ask to ask

#

just ask about your problem right away

#

provide your code and the errors you get

#

and obviously state your lib and language

prisma wren
#

lib?

earnest phoenix
#

library

prisma wren
#

lang is js

valid grotto
prisma wren
#
const { Client, Collection, MessageEmbed } = require("discord.js");
const { set } = require("mongoose");
class EconomyClient extends Client {
  constructor() {
    super();
    this.discord = require("discord.js");
    this.fs = require("fs");
    this.path = require("path");
    this.ms = require("ms");
    this.mongoose = require("mongoose");
    this.commands = new Collection();
    this.timeouts = new Collection();
    this.config = {
      prefix: "?",
    };
    this.schemas = this.mongoose.model(
      "economy",
      new this.mongoose.Schema({
        user: String,
        Coins: Number,
      })
    );
  }
  commandHandler(path) {
    this.fs.readdirSync(this.path.normalize(path)).map((f) => {
      const File = require(this.path.join(__dirname, "..", path, f));
      this.commands.set(File.name, File);
    });
  }
#
getCommand(cmd) {
    return this.commands.has(cmd) ? this.commands.get(cmd) : false;
  }
  start(token, path) {
    this.commandHandler(path);
    this.login(token);
    this.mongoose.connect(
      "//this was the important link that i might have leaked",
      {
        useNewUrlParser: true,
        useUnifiedTopology: true,
      }
    );
    this.mongoose.connection.on("connected", () => console.log("DB connected"));
    this.on("ready", () => console.log(`${this.user.tag} is now online!`));
    this.on("message", async (message) => {
      if (
        message.author.bot ||
        !message.guild ||
        !message.content.toLowerCase().startsWith(this.config.prefix)
      )
        return;
      const args = message.content
        .slice(this.config.prefix.lenght)
        .trim()
        .split(/ +/g);
      const cmd = args.shift().toLowerCase();
      const command = this.getCommand(cmd);
      if (!command) return;
      if (command.timeouts) {
        if (this.timeouts.has(`${command.name}${message.author.id}`))
          return message.channel.send(
            this.embed({
              description: `Please wait ${this.ms(
                Date.now() -
                  this.timeouts.get(`${command.name}${message.author.id}`),
                { long: true }
              )}`,
            })
          );
#
command.run(this, message, args).catch(console.error);
        this.timeouts.set(
          `${command.name}${message.author.id}`,
          Date.now() + command.timeouts
        );
        setTimeout(() => {
          this.timeouts.delete(`${command.name}${message.author.id}`);
        });
      } else return command.run(this, message, args).catch(console.error);
    });
  }
  embed(data, message) {
    return new this.discord.MessageEmbed({
      ...data,
      color: "RANDOM",
    }).setFooter(
      message.author.tag,
      message.author.displayAvatarURL({
        dynamic: true,
        format: "png",
      })
    );
  }
}
module.exports = EconomyClient;
#

thats the client.js

#
const { Message } = require("discord.js");
const Client = require("../structures/Client");
module.exports = {
  name: `ping`,
  /**
   * @param {Client} client
   * @param {Message} message
   * @param {string[]} args
   */
  run: async (client, message, args) => {
    const msg = await message.channel.send("Pinging..");
    await msg.edit(
      client.embed(
        {
          description: `Pong!\nMessage edit: ${
            msg.createdAt - message.createdAt
          }\nWS: ${client.ws.ping}`,
        },
        message
      )
    );
    await msg.edit(`Pong!`);
  },
};
#

thats the ping.js

pale vessel
#

Jeez

tawny oar
#

bruh imagine js

prisma wren
#

i dont have to

pale vessel
#

You leaked your mongo URI

tawny oar
#

DELET THIS

prisma wren
#

oops

#

i edited it

pale vessel
#

Change your password

prisma wren
#

will do

pale vessel
#

It's hard to find what's wrong when it has no error

#

Have you tried debugging

prisma wren
#

no

#

how do i do that?

pale vessel
#

Log your variables

#

Make sure that the command was at least executed

#

If not then the problem is from somewhere else

prisma wren
#

its not letting me type in the debug thing

pale vessel
#

Just use console.log()

#

Add a console.log("test") to the first line of your ping command and try running it

#

If test appears in your console then the command has issues

prisma wren
#

yeah it said test

#

@pale vessel sorry for ping, but it said test

pale vessel
#

What's your problem again?

#

Did the command work?

prisma wren
#

no, it didnt

pale vessel
#

Change it to console.log(client, message, args);

prisma wren
#

that was the error given

pale vessel
#

Where did you put that

prisma wren
#

in the top of the ping.js file, should i have put it in the client.js file?

pale vessel
#

Not on the top

#

Inside the run function

prisma wren
#

oh ok

#

make it test then?

pale vessel
#

You put the test on there too?

prisma wren
#

no

#

i edited the test

pale vessel
#

try it again inside the first line of that function

prisma wren
#

ok

#

there?

pale vessel
#

Yes

prisma wren
opal plank
#

Why not use message.client

#

?

prisma wren
#

wdym

opal plank
#

Literally what i wrote

#

message.client rather than client

prisma wren
#

idk

opal plank
#

Then.... Try it?

pale vessel
#

You didn't remove that console.log() on the top of the file...

prisma wren
#

i did

pale vessel
#

Show your command

prisma wren
#

wait

#

im dumb

#

i didnt save it

#

it ran like normal but the test wasnt there

pale vessel
#

So it could be your command handler

#

Can you show your command handler?

prisma wren
#

at the bottom

pale vessel
#

After you define it or after return

prisma wren
#

delete the other one or keep it

pale vessel
#

Keep it

prisma wren
#

ok

#

that?

pale vessel
#

Yes

#

If nothing pops up in the console then you did something wrong

prisma wren
#

it popped up like normal

pale vessel
#

So the command wasn't found

#

Try moving that console.log() one line above

#

Above the return

prisma wren
#

ok

pale vessel
#

Run the command

prisma wren
#

i did

#

that was the response

pale vessel
#

Then your message event is broken

prisma wren
#

how do i fix it?

pale vessel
#

wait

#

Try changing command to cmd

earnest phoenix
#

Hi

pale vessel
#

I doubt this would change anything since if the command wasn't found, it would return false which in this case it didn't

#

So it's somewhere else

earnest phoenix
prisma wren
earnest phoenix
pale vessel
#

Before if

prisma wren
#

after this.on("message",

pale vessel
#

Above if

prisma wren
pale vessel
#

Nothing?

#

well your message event is not even working

prisma wren
#

oh

sharp rock
#

what code for first bot in visual studiio code?

#

im first time use the visual studio code

umbral zealot
# sharp rock what code for first bot in visual studiio code?

Start by learning javascript.

Useful links for learning JavaScript and Node:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie's Accelerated JS: https://js.evie.dev/

sharp rock
#

hmm yeah thx

rare moss
#

Hello, this question is targeted to people who have music bots.

Basically I have bot, and I started working on a music cog with lavalink. I am wanting to put these changes on my host but I have no clue where to start. My host is pebblehost and i have their 5 dollar a month bot plan. For lavalink do I need a dedicated server?

sharp rock
#

hmm,i need make a nice music bot

#

anyone know the code?

umbral zealot
#

Step 1) learn programming
Step 2) choose a library
Step 3) code the bot

#

If you're not going to learn programming, you're not making a music bot, you're just shovelling code, and you might as well just use Groovy.

#

Making a bot while copying code is like thinking you're an artist because you can do a puzzle.

lusty quest
#

you could use a GUI tool to write a bot. but writing is not really the right therm for it

rare moss
#

please ping me if you have any solutions

#

๐Ÿ˜„

lusty quest
#

you can run lavalink on the same server.

wraith haven
earnest phoenix
#

client.user.displayAvatarURL

#

not work

lusty quest
#

did you get an error?

lunar sequoia
rocky hearth
#

can I host the bot with firebase

lusty quest
#

its not really designed for it. better use a compute engine machine

shrewd dagger
#

SF

gusty quest
#

how can i get users in voice channel, so im making when u type !users to show all users in voice channel.

#

but in embed

ivory seal
#

DiscordAPIError: Cannot send an empty message . Im trying to ping the user in a channel after they join so i do

const channel = client.channels.cache.get('mychannelid')
channel.send(member);
})```
quartz kindle
#
.send(`<@${member.id}>`)
earnest phoenix
#

heroku error

reef mantle
#
if(message.content.startsWith(prefix + "avatar") || message.content.startsWith(prefix + "av")){
              let embed = new Discord.MessageEmbed()
              .setImage(message.mentions.users.size.first().avatarURL())
              .setColor("RANDOM")
              .setFooter("text
")
               message.channel.send(embed)
            }```
#

can someone check?

earnest phoenix
#
              let embed = new Discord.MessageEmbed()
              .setImage(message.mentions.users.size.first().avatarURL())
              .setColor("RANDOM")
              .setFooter("text")
               message.channel.send(embed)
            }```
reef mantle
#

uhh

reef mantle
#

i thought you were not supposed to spoonfeed

#

but you look like a nice guy

#

thnx btw

pure lion
#

you arent supposed to spoonfeed smh

sterile minnow
#

Hi ppl,

I want to do a command that plays the Snowgiving Radio in JS.
Problem is it is a m3u stream. Is there any way to play it anyways?

I tried ```js
channel.join()
.then(connection => {
const dispatcher = connection.play('http://ice55.securenetsystems.net/DASH45.m3u');
message.reply("Should Play")
dispatcher.on("end", end => {channel.leave()});
})
.catch(console.error);

But it doesnt play any Audio
pure lion
#

@earnest phoenix dont use heroku, problem solved

reef mantle
#

hey happy

pure lion
#

refer to pins

reef mantle
#

the code you gave me shows an error

pure lion
#

@sterile minnow do you have @discordjs/opus installed

#

@reef mantle send the error

sterile minnow
#

Yes i do

#

/ i use opusscript

pure lion
#

are there any errors thrown?

reef mantle
#

it says message.mention.users.size.first() is not a function guys

#

it logs this

sterile minnow
pure lion
#

Tayron, id reccomend using the discord bindings for opus

#

its a lot faster

sterile minnow
#

I guess it only supports mp3 and not m3u. Okay imma try that rq

pure lion
#

@reef mantle size is a number, the size of the discord collection

reef mantle
#

hello?

#

so waht?

pure lion
#

numbers dont have any properties

#

but collections do

reef mantle
#

oooooohhh

#

so wut should i do then??

sterile minnow
#

Do it without .size i guess

pure lion
#

message.mentions.users is a collection

#

and you can get first from a collection

sterile minnow
#

Doesnt help too. I guess it only supports MP3

pure lion
#

yeah id assume that

#

if you want higher quality you can always check if theres a higher bitrate

sterile minnow
#

But how do i play m3u ? Or convert it to mp3

pure lion
#

there cant just be m3u

#

check the radio site

sterile minnow
pure lion
#

huh

sterile minnow
#

I think i got it

#

lemme try

#

It seems like it works now

#

I just removed the .m3u

#

And the Quality is wow

pure lion
#

gg

sterile minnow
#

ty ^^

#

Gonna Continue the Command

#

But one question tho

#

Should i do a Broadcast where ppl subscribe or for every guild a own Player?

pure lion
#

what

sterile minnow
#

Nvm i'm dum dum

#

All good

pure lion
#

dont put it behind a paywall kekw

sterile minnow
#

No i mean discord.js Broadcast

pure lion
#

what is that?

sterile minnow
#

Imma just stay with that

pure lion
#

ah

reef mantle
#

hey guys

#

sorry if i am asking again but

#

how to make our bot say something everyday at the same time

#

i know i have to use timeout

#

but how i do not know

#

as i am still an average

eternal osprey
#

hey guys how do i set the color of an embed in discord.py to random?

#

because i know in javascript you can just use "RANDOM".

#

how can that be done in py?

coral lichen
coral lichen
eternal osprey
#

uhhh

#

why is this?

green kestrel
lusty quest
#

ok

green kestrel
#

So I can restart subsets of the shards rather than having to cold boot them all for an upgrade I can rolling restart them

lusty quest
#

does the broadcasting of the shardids could be managed over it? like you add a new one without having to reboot all of them

earnest phoenix
#

Bro Log Set Kyu nahi ho raha DLS Vote ka?

#

english please

#

Why Log is being not setuped With DLS Vote Bot??

near stratus
#

Why am I getting this ?

(node:3879) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

at Object.embedDes (/app/res/reference.js:57:22)
#

My code is

    embedDes : (message,Title,Description,Footer) => {
    	let emb;
    	if(Footer == false || Footer == undefined){
    		emb = new Discord.MessageEmbed()
    			.setColor("#ff6f61")
    			.setTitle(Title)
    			.setDescription(Description)
    	}else{
    		emb = new Discord.MessageEmbed()
    			.setColor("#ff6f61")
    			.setTitle(Title)
    			.setDescription(Description)
    			.setFooter(Footer)
    	}
    	message.channel.send(emb);
    }
#

I'm getting error here

message.channel.send(emb);
#

Don't mind the ||shitty|| code

earnest phoenix
#

Update your Node.js Version

near stratus
#

oh it works fine on my pc but this error shows on vps

near stratus
stiff walrus
#
let reason = args.slice(1).join(" ");

if(!reason) reason = 'BelirtilmemiลŸ.';

let warnings = db.get(`warnings_${message.guild.id}_${user.id}`);

if(warnings === 3) return message.channel.send(`${user} adlฤฑ kullanฤฑcฤฑ zaten **3 uyarฤฑsฤฑ** var. Daha fazla veremezsin.`);

i want to make reason compulsory how do i do that? I mean like that: !warn <@user> (no reason)

and message channel send ('You should give a reason')

#

how do i that

quartz kindle
#

if(!reason) return message.channel.send("you must provide a reason")

stiff walrus
#

thanks

dark steeple
#

How can I check if args[0] is a mention of a channel?

earnest phoenix
#

Use regex to check if it's a channel mention

molten yarrow
#
channel = message.mentions.channels.first();
dark steeple
#

@molten yarrow no

lunar sequoia
#

Or you could just check if the message contains a channel mention ^

dark steeple
#

if I use it like that, any args will count as the first channel mentioned

main trench
#

Thats why you check it

dark steeple
#

I will try to use regex just like the voltrex said

dark steeple
#

that way, any agrs would count. If I mentioned the channel in args [1] it would pick up in the same way, but I just want to take args [0]

main trench
#

How the arg system works is if I do "!channel #channel then say text" it will only detect args[0] which is the channel

#

With args[1] being the text it won't respond to it

#

Unless you code it to

dark steeple
sterile minnow
#

Hi,

I have a issue with Playing audio with my Bot on NodeJS v14.15.0. Somehow it says i dont have a Opus Module even tho i have @discordjs/opus installed and if i try opusscript it gives me a Chunk full of Error

young flame
sterile minnow
#

Can anyone help me with this Opus issue?

lusty quest
#

would love to but i make a big circle around music bots bcs they are a pain in the ass

lusty quest
young flame
#

uh

#

im done with maps rn

lusty quest
#

why?

young flame
#

what database should i do though

lusty quest
#

what did you want to store?

young flame
#

i would just use MoonSQL but some of the functions im storing in it would contradict what i want to store

young flame
lusty quest
#

any database will work

young flame
#

quick.db to?

lusty quest
#

yea

young flame
#

hm

#

how would you store multiple things though

sterile minnow
lusty quest
sterile minnow
#

Server: 14 | PC: 15

lusty quest
#

i would use a unique id as key and then add the Warn reason, Warned user id, and Moderator User ID to it

young flame
#

it only did the guild id and the persons id

sterile minnow
#

Now its both 15

lusty quest
young flame
#

no?

lusty quest
#

also your syntax is wrong

wise hawk
young flame
lusty quest
#
db.set(`warned_${message.guild.id}`,{user:userid,points:points,reason:reason,issuer:issuer})
#

then you can also call it by db.get(`warned_YOURGUILDID.user`)as example

lusty quest
sterile minnow
lusty quest
#

did you updated all packages on the server?

sterile minnow
#

It doesnt complain now but it doesnt play any audio

lusty quest
#

remove the node_modules folder and run npm install

sterile minnow
#

Everything is up to date. Gonna try

#

Doesnt help

#

It just doesnt play any audio

#

But the URL works

#

cuz my PC works with it

#

And no errors at all

#

The URL even works with wget

lusty quest
#

strange

young flame
#

@lusty quest is there a way to like

#

make a number then each time they get warned it goes from 1 - 2

lusty quest
#

.add

sterile minnow
#

Hotpatched with Replacing Opus with Lavalink

lusty quest
#

opus is a codec?

timber fractal
#
const canva = require('canvacord');
const Discord = require('discord.js')

module.exports = {
    name: "trigger",
    description: "Trigger yourself",


    async run (client, message, args) {

        let avatar = message.author.displayAvatarURL({dynamic: false, format: "png"});

        let image = await canva.trigger(avatar);

        let triggered = new Discord.MessageAttachment(image, "triggered.gif")

        message.channel.send(triggered);
    }
}```


```node:14016) UnhandledPromiseRejectionWarning: TypeError: canva.trigger is not a function

Why if i use this code it says that error?

lusty quest
#

canva.trigger doesnt exist

timber fractal
#

but

#

how do i fix that

#

because in the tutorial it worked

lusty quest
#

use a function that exist

timber fractal
#

but

#

in the tutorial it worked

lusty quest
#

or you have somewhere a mistake in your syntax

timber fractal
#

sorry im new

#

what do you mean

lusty quest
#

did you know basic js?

timber fractal
#

yeah

main trench
#

@timber fractal they where probably using a older version of Canvacord

lusty quest
#

yea is the next guess

lusty quest
#

use a up2date tutorial

molten yarrow
main trench
#

@timber fractal step 1. Find a better tutorial

timber fractal
#

-_-

molten yarrow
#

5sec of googling xD

timber fractal
lusty quest
#

or read the docs

timber fractal
#

LOL

main trench
timber fractal
#

@molten yarrow thx it worked

molten yarrow
robust blade
#

how do i install canvacord on windows

molten yarrow
robust blade
#

the dollar sign is not an command

#

'$' is not recognized as an internal or external command,
operable program or batch file.

molten yarrow
#

dont use the $ xD

robust blade
#

ok

#

im having npm warn

#

i dont know why

#

ok it works

jovial nexus
#

why in ytdl-core songInfo.videoDetails.author.name is unfefined?

#

if you going to answer "idk" please dont respond

lone palm
#

Damn+

jovial nexus
#
        songInfo = await ytdl.getInfo(results[0].url);
        song = {
          title: songInfo.videoDetails.title,
          url: songInfo.videoDetails.video_url,
          duration: songInfo.videoDetails.lengthSeconds,
          id: songInfo.videoDetails.videoId,
          author: songInfo.videoDetails.author.name
        };```
lone palm
#

It wasn't on purpose

pale vessel
#

Debug

jovial nexus
#

i know xD

pale vessel
#

Log songInfo

jovial nexus
#

log it?

#

ok

pale vessel
#

Yes

#

Check the properties

lone palm
#

unfefined

jovial nexus
#

holy fk thats a lot of debug

lone palm
#

ok

pale vessel
#

Log songInfo.videoDetails

jovial nexus
#

the debug shows it as it is

pale vessel
#

That's what you'll be using

jovial nexus
#
      allowRatings: true,
      viewCount: '12089',
      author: 'Testing',
      isLowLatencyLiveStream: false,
      isPrivate: false,
      isUnpluggedCorpus: false,
#

author isnt undefined in the debug

pale vessel
#

No .name

#

Just author

#

It's not an object

jovial nexus
#

guess so

lone palm
#

@jovial nexus Now?

jovial nexus
#

now is says [object Object] in the message but "Testing" in the debug

#

wha

lone palm
#

wait

pale vessel
#

What did you put

lone palm
#

what do you want to get?

jovial nexus
#

songInfo.videoDetails.author

#

that debugs Tesging but messages [object Object]

lone palm
#

Yes, because you want to get everything

pale vessel
#

Can you show what you did

jovial nexus
#

just changued songInfo.videoDetails.author.name to songInfo.videoDetails.author

pale vessel
#

How did you log it

#

The one that said object

jovial nexus
#

console.log(songInfo)?

pale vessel
#

What do you mean by "messages"?

#

Show where you used the object

jovial nexus
#

the code is like js songInfo = await ytdl.getInfo(results[0].url); song = { title: songInfo.videoDetails.title, url: songInfo.videoDetails.video_url, duration: songInfo.videoDetails.lengthSeconds, id: songInfo.videoDetails.videoId, author: songInfo.videoDetails.author }; console.log(songInfo) message.channel.send(song.author)

#

mistake there

pale vessel
#

Change the console.log content to songInfo.videoDetails.author

jovial nexus
#

idk man it logged just {}

#

ytdl-core is wierd

pale vessel
#

So it's an object

#

An empty one

jovial nexus
#

i guess

pale vessel
#

I'm still not sure what the content of songInfo.videoDetails is

#

Can you post it in hastebin?

jovial nexus
#

guess what

analog kettle
#

ok i have a TypeError: Cannot read property 'name' of undefined

#
function walk(dir, callback) {
  fs.readdir(dir, function(err, files) {
      if (err) throw err;
      files.forEach(function(file) {
          console.log(`Loading a total of ${files.length} commands.`);
          var filepath = path.join(dir, file);
          fs.stat(filepath, function(err,stats) {
              if (stats.isDirectory()) {
                  walk(filepath, callback);
              } else if (stats.isFile() && file.endsWith('.js')) {
                  let props = require(`./${filepath}`);
                  console.log(`Loading Command: ${props.help.name} โœ”`);
                  client.commands.set(props.help.name, props);
                  props.conf.aliases.forEach(alias => {
                  client.aliases.set(alias, props.help.name);
                });
              }
          });
      });
  });
}
walk(`./commands/`)```
opal plank
#

@analog kettle would be nice if you actually threw the whole error, but anyway

#

one of the commands you have doesnt have name in it

analog kettle
#

c:\Users\joshu\Desktop\Coding\TC Bot\Base.js:21
console.log(Loading Command: ${props.help.name} โœ”);
^

TypeError: Cannot read property 'name' of undefined
at c:\Users\joshu\Desktop\Coding\TC Bot\Base.js:21:62
at FSReqCallback.oncomplete (fs.js:168:5)
thats the error

opal plank
#

help: {
name: '',
}

#

yeah figured

pale vessel
#

Looks like the help export doesn't even exist in one of them

glossy tundra
#
git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ git init
+ ~~~
    + CategoryInfo          : ObjectNotFound: (git:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

i have a problem with git, and i don't know how to fix it

opal plank
#

installing it first would be wise

glossy tundra
#

I already did

opal plank
#

clearly not

earnest phoenix
#

@opal plank They probably did

#

but wasnt added in windows env

opal plank
#

im fairly certain windows doesnt need to be restarted for git

#

worst case scenario you could just open a git terminal

analog kettle
#

on mine the commands load but then instantly the code stops :/. eh ill fix it eventually

earnest phoenix
opal plank
#

git bash, boom

earnest phoenix
#

had to manually insert it into windows env

pale vessel
#

you just need to restart terminal if you installed it after you open the terminal

opal plank
#

yo whats the ETA for verification again?:

tardy hornet
#

what is wrong?

lunar sequoia
#

What's in procfile?

tardy hornet
#

worker: node .

lunar sequoia
#

hmm, also add a web: npm start

#

I've seen that issue come up sometimes

tardy hornet
#

nope

#

still

#

@lunar sequoia

lunar sequoia
#

Did you refresh the page?

tardy hornet
#

yes

lunar sequoia
#

Are you deploying all changes to a github repo?

tardy hornet
#

no

lunar sequoia
#

Then you're using heroku's cli?

tardy hornet
#

yes

#

@lunar sequoia

lunar sequoia
#

That's strange

zenith knoll
#

I am trying to send a message to a channel when i get a event for it (py)

#

here is my code

#

@bot.event
async def on_guild_channel_create(channel):

await channel.send(random.choice(messages))
#

and my messages is a list

#

messages = ["Ooh, a new channel!", "First!"]

#

wont send

#

idk y

tardy hornet
heady sable
#

Can someone help me set up a event to see when someone has voted for my bot in python

tardy hornet
#

@lunar sequoia i see why i think

#

when he try to clone it

earnest phoenix
zenith knoll
#

I am trying to send a message to a channel when i get a event for it (py)
here is my code

async def on_guild_channel_create(channel):

    await channel.send(random.choice(messages))```
and my messages is a list
```messages = ["Ooh, a new channel!", "First!"]```
wont send
idk y
#

no errors

#

just wont send

#

i tried a try except

#

no error

#

random.choice()

#

import random

south aspen
#

you need to make

Random = random.choice(message)
#

i think

zenith knoll
#

um

#

its the same thing though

#

lol

#

it does the same thing

heady sable
snow urchin
#

dk what I did but my message event is giving this?
(node:11284) UnhandledPromiseRejectionWarning: DiscordAPIError: 401: Unauthorized
worked for one command, then stopped working all together with this.

proven ivy
heady sable
#

?

#

@proven ivy where is that

proven ivy
#

webhooks: dont ruslte yor feather for no reason, if youre lost you can read more aobut out _webhooks here_

heady sable
#

oh

snow urchin
#

So something strange is happening, whenever I run !ping, bot works fine, I run it again, all fine. I run !eval and the bot throws a 401 error from djs, then every single action djs makes, message events etc, throws 401 error?? Makes 0 sense but something here is breaking djs
https://hasteb.in/gopudoci.coffeescript

lunar sequoia
#

Umm, why are you doing client.token = "HIDDEN"?

#

I don't see a reason to be changing the token for the bot?

pale vessel
#

You can't change client's token to that @snow urchin

#

It actually tries to use the one you set, which is not a valid token

#

That's how the lib works

snow urchin
#

oh wait ye, I had that set for a different bot that used a differnt lib where that worked lol

#

I feel dumb

lusty quest
#

i use this to remove all critical stuff from eval prints ```js
text.replace(//g, "" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));

tranquil drum
earnest phoenix
#

there's no point in trying to hide the token

tranquil drum
#

evaling client[atob('dG9rZW4=')] will prob still leak it

earnest phoenix
#

this

snow urchin
#

when would i EVER need to eval that lol

tranquil drum
#

why bother with trying to hide it then?

earnest phoenix
#

atob?

pale vessel
#

base64 to string

#

only on browsers iirc

#

there's btoa that does the opposite

earnest phoenix
#

A simple way to hide the token is to Iterate through the output and replace all instances of the token

#

there's still a ton of ways to access it

#

@earnest phoenix except it's a string and strings can be transformed

tranquil drum
pale vessel
#

print the letters in each line

tranquil drum
#

I don't use node too much haha, just front end stuff

earnest phoenix
#

there's no point in trying to hide the token, just don't make a dumb bitch move to give eval access to someone you don't trust

tranquil drum
#

hot take: just don't have an eval command ๐Ÿ˜ณ

earnest phoenix
# earnest phoenix What?

i can transform the token into inserting a space after every character, a zero, or anything really

#

attackers are way more creative than that though

tranquil drum
#

your regex won't catch it

earnest phoenix
sudden geyser
#

Heck, you could even just message.channel.send(...) the token

#

Don't bother trying to hide your token

#

It's a waste of time.

earnest phoenix
#

I did that, doesn't send the token

tranquil drum
#

and the attacker can transform it back

sudden geyser
#

Voltrex there are still a number of ways to send it. It's not worth the time to try disguising it, because your #1 protection should be good enough to limit who can use the command anyway

heady sable
#

Whats wrong wt my code it dosnt work...

from discord.ext import commands

import dbl


class TopGG(commands.Cog):
    """
    This example uses dblpy's webhook system.
    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'I think I hide this...'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")


def setup(bot):
    bot.add_cog(TopGG(bot))```'
earnest phoenix
#

bruh If there is an actual way, show me, go, ahead

earnest phoenix
quartz kindle
#

eval convert token to hex

earnest phoenix
#

token.split(" ").join("0")

#

and boom

#

your regex doesn't detect it

#

well

#

you'd split by ""

#

and not " "

tranquil drum
#

Array.from(token).reverse()

silent cloud
#

Yo guys

#

How i can optimize it?

#
  //console.log('ะ—ะฐะฟัƒัั‚ะธะปัั!');
  bot.user.setStatus('available'); // available idle dnd invisible
  bot.user.setPresence({
      activity: {
        name: `*help โœจ `,
        type: 2
      }
  });
});```
quartz kindle
#

what is there to optimize?

tribal siren
#

How to make a command that lists all my boyโ€™s servers?

#

dw Iโ€™m privating it to myself only

silent cloud
#

I have memory leaks in my code, I think they are here

quartz kindle
#

they are definitely not there

quartz kindle
silent cloud
#

I decided this way, because after a long bot work, the status simply disappears

earnest phoenix
tribal siren
#

Like this?

fringe marten
#

c/supreme Rules

earnest phoenix
#

Yea that way is impossible to hide the token from

quartz kindle
tribal siren
#

I got 36 for now so itโ€™s ok for me ๐Ÿ‘Œ

quartz kindle
quartz kindle
#

you can only send 5 messages per 5 seconds

tribal siren
#

oh

quartz kindle
#

it will take 40 seconds

#

and spam your discord

tribal siren
#

yes, I understood it wrong

silent cloud
tribal siren
#

so how to do it properly if not like that?

quartz kindle
# silent cloud And how i can fix it?

if you dont have a dynamic status, you can set the status in the client options, that way it will never reset because its automatically set again on every reconnect

silent cloud
#

Hmmm, how i can do animate status?

quartz kindle
#

wdym animate status

pale vessel
#

Rotating status?

silent cloud
#

Yep

tribal siren
#

I think he means to change the status automatically once every time

#

Oh

silent cloud
#

Yessss

tribal siren
#

Mkay

quartz kindle
#

setInterval

silent cloud
#

In ms?

tranquil drum
#

Just don't change it too quickly

quartz kindle
#

yes

tranquil drum
#

setInterval is in ms in every implementation of js i think

silent cloud
#

How i can do it in code like this:

quartz kindle
tribal siren
#

oh do I

lusty quest
#

make an list of possilbe statuses and the set interval. each time the nterval stops generate a random number to pick an string from the list

quartz kindle
silent cloud
#

Wtd

#

Wtf

#

Idk how to do it ._.

tranquil drum
#

which part ๐Ÿ˜ณ

silent cloud
#

Idk how to realize it

tranquil drum
#

do you know how to make an array?

silent cloud
#

Ye

tranquil drum
#

ok what about setInterval

silent cloud
#

._.

quartz kindle
tranquil drum
#
setInterval(function, time)
#

function can be defined in place or as a reference to an existing function

#

time is in ms

lusty quest
#

make a list js const status_list= ["status1","status2"]

create a setIntervall and use a random number generator to get the index for the list

setInterval(()=>{
const index = Math.floor(Math.random()*(status_list.length-1)+1)
}, 50000)

this is an example

#

then also set the activity inside your interval

#

inside the set activity just pass the list with the random generated index

lunar sequoia
#

Tip: you don't need to -1)+1

pale vessel
#

lmao that -1 +1

tranquil drum
#

Math.floor(Math.random() * array.length)

earnest phoenix
#

it's just to see if they're going to copypaste

#

i think

tranquil drum
#

LOL

earnest phoenix
#

which they obviously will

quartz kindle
#

lmao

pale vessel
#

yeah true

earnest phoenix
#

๐Ÿ—ฟ The bait, it always works

pale vessel
#

this is why erwin give examples in typescript

#

genius

lusty quest
#

next time i write them in COW

tranquil drum
#

examples in rust from now on

earnest phoenix
#

Examples in binary

#

Genius

#

in cpp using N-API

#

translate it yourself ๐Ÿ™ƒ

tranquil drum
#

in wasm bytecode pepe

quartz kindle
#

N-API directly or using node-addon-api?

#

xD

lusty quest
#

i write them in g-code. you then need either a software to simulate it to see the result or you have a Milling machine that could run the program

quartz kindle
#

dafuq is g code

lusty quest
#

programing language for CNC controlled milling machines

#

also lathes

#

and EDM machines

quartz kindle
#

lmao

lunar sequoia
#

ah, this reminds me of those lathe days lol

rare moss
#

Yo how do you get your lavalink server onto your host?

#

i have a music bot and I have no clue how to do it.

#

My host doesn't give me access to a command prompt

earnest phoenix
#

how do you not have access to that

#

that's the core of every os

lusty quest
#

where tf did you host that this stuff happens?

rare moss
#

they don't give you full access

earnest phoenix
#

which host are you using

rare moss
#

pebble

lusty quest
#

did you use a webspace?

rare moss
#

no

lusty quest
#

did you pay for the host?

rare moss
#

uhm yes

lusty quest
#

gtfo there

rare moss
#

?

lusty quest
#

get the frick out there

earnest phoenix
#

lol did you seriously buy their bot hosting plan

rare moss
#

ye

#

it was like 5 bcuks a month

earnest phoenix
#

you got ripped off

rare moss
#

and

#

it did what I wanted

#

for like 5 months

#

do you guys know of a better host that provides everything for cheap?

earnest phoenix
#

they're pinned

lusty quest
#

digitalocean, vulture, OVH as example

tranquil drum
#

i use heroku ๐Ÿ™‚

lusty quest
#

AWS and Google Cloud Services

earnest phoenix
#

you should never ever get shit like that advertising "EASY DISCORD BOT HOST!!"

#

because they're ripping you off

lusty quest
#

if its easy its dumb, you pay way to much for next to no functions

earnest phoenix
#

they're profiting off people who don't have experience with getting a cheap vps or linux

lusty quest
#

also for 5$/month you can get a Digitalocean VPS that will have probably more compute power and full access

rare moss
#

does the galaxy gate 3 dollar a month plan give u access to the command prompt?

lusty quest
#

yes

#

every normal vps does

rare moss
#

sweet

tranquil drum
#

for $7/mon you can get a hobby heroku dyna that you'll spend more time making docker files for than actually programming your service

lusty quest
#

even the free google vps

#

heroku sucks even if you pay

rare moss
#

yeah

#

heroku sucks

tranquil drum
#

LOL

lusty quest
#

also writing a dockerfile is easy.

#

you do it once

tranquil drum
#

i use it cause it's automated

lusty quest
#

i could make my bot also automated.

leaden cliff
#

Do I talk here to if something with my Discord bot is not working?

tranquil drum
#

my bot is hosted on a vps with dokku so it's basically the same thing

tranquil drum
leaden cliff
#

K.

#

I am trying to get my Discord bot to work but it won't.

lusty quest
#

did you get errors?

rare moss
#

@lusty quest what host do u use for your bot?

lusty quest
#

i use digitalocean

leaden cliff
#

I have the Terminal on cmd I type (node .) and it changes cmd to node then it changes it back to cmd.

lusty quest
#

?

tranquil drum
#

so you ran node . and nothing happened

leaden cliff
#

It changed cmd to node then changed it back.

earnest phoenix
#

the window title yes

lusty quest
#

did you get errors?

earnest phoenix
#

because it ran node

rare moss
#

@lusty quest what plane do you specifically use?

tranquil drum
#

airbus a380

lusty quest
#

currently a Debian 10 Droplet

leaden cliff
#

It is still on cmd.

tranquil drum
#

so no errors

lusty quest
#

run node -v

tranquil drum
#

what does your package.json look like

lusty quest
#

also did you initialized your node project?

umbral zealot
leaden cliff
umbral zealot
#

Your js file is not saved.

tranquil drum
#

big brain

umbral zealot
#

CTRL+S to save. If there's a white dot next to the file name in the tab at the top, it's not saved.

lusty quest
#

if it is this i guess someone is facepalming rn pretty hard

umbral zealot
#

This happens multiple times a week actually, on various servers I'm in.

tranquil drum
#

there's no error cause the entrypoint exists but there's no output cause there's no code

tranquil drum
#

nice

earnest phoenix
#

hey so like how do i make my bot send a message that is o a json file

tranquil drum
#

we did it

umbral zealot
#

There you go. Now we're moving forward.

#

Which module didn't it find, if you scroll up?

tranquil drum
#

did you initialize this project yourself or is it from somewhere else

leaden cliff
umbral zealot
#

uhm

#

Can we get, like, a bigger screenshot? make the window bigger, run it again, and look at the error

earnest phoenix
#

like i made a json made a require server = json file and then if i got to the msg.channel.send("${server}")

lusty quest
umbral zealot
#

You probably forgot to install discord.js

earnest phoenix
lusty quest
#

then you can just refer to it to send it

earnest phoenix
#

no

tranquil drum
#

is it trying to send an embed?

earnest phoenix
#

ye

leaden cliff
tranquil drum
lusty quest
earnest phoenix
#

lol

umbral zealot
#

You should be following a tutorial, not blindly moving forward

earnest phoenix
#

of npm i discord.js

umbral zealot
#

Better yet, you should be learning javascript first.

lusty quest
#

^

tranquil drum
earnest phoenix
umbral zealot
# leaden cliff

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we'd like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie's Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

tranquil drum
#

or maybe someone else can chime in since on JDA it just sends it

earnest phoenix
leaden cliff
tranquil drum
#

that means it worked

leaden cliff
#

It changes to node then back to cmd.

earnest phoenix
umbral zealot
#

Can you please learn javascript first

#

And then once you're done, follow a tutorial for discord.js bots

#

because... we're not going to handhold you through the entire process, here.

leaden cliff
#

The bot is offline still.

umbral zealot
#

yeah because it's not running

earnest phoenix
#

omg

#

just search its ez

tranquil drum
#

yo @earnest phoenix what's the problem now?

leaden cliff
#

What should I search?

umbral zealot
broken sentinel
earnest phoenix
#

like i have the require then in the embed but like if i type anything in the json file in ""it only sends me a erorrr

broken sentinel
#

How to make it upload random memes

earnest phoenix
#

go to a website

lusty quest
#

use the reddit api

tranquil drum
#

what's the error

earnest phoenix
#

ye

lusty quest
#

as example

earnest phoenix
#

or that

umbral zealot
earnest phoenix
broken sentinel
tranquil drum
#
broken sentinel
#

thx

tranquil drum
#

i'd look up a lib for your language of choice

earnest phoenix
leaden cliff
earnest phoenix
#

DUDE

umbral zealot
tranquil drum
earnest phoenix
#

u have to put your bot token there

#

dont use json as your db problem solved

lusty quest
leaden cliff
#

I do have my token their.

umbral zealot
# leaden cliff

Please don't ignore the fact that if you do not know javascript, you will not be able to make a bot.

earnest phoenix
leaden cliff
#

I just replaced it because I am smart.]

earnest phoenix
#

it doesnt work

tranquil drum
#

?

earnest phoenix
#

it makes even more erors that are unfixeble

lusty quest
# leaden cliff

learn Javascript and how to use a discord lib please. we wont babysit you here for the entire process

tranquil drum
#

???

earnest phoenix
#

bc it only makes more and more erorrs

broken sentinel
leaden cliff
#

OMFG!

tranquil drum
#

json is an object notation spec that should be parsed the same way by everything that claims to support it

old cliff
#

Anyone knows how to set up a reverse proxy using cloudflare workers?

earnest phoenix
leaden cliff
#

@earnest phoenix I love you!!!!!

#

You fixed it!

earnest phoenix
#

no

tranquil drum
lusty quest
umbral zealot
# earnest phoenix bc it only makes more and more erorrs

here. let's be very thorough in this answer.

Why shouldnโ€™t I use a JSON file as a database?

A JSON file is not suitable for use as a database for several reasons.

Firstly, you will incur a major performance hit as you need to read from and write to the file on each query and modification. This brings a major performance impact especially when the amount of data increases.

Second, you cannot concurrently write to a JSON file - only one write can be performed at a time. This is part of what causes the performance impact, but perhaps more importantly may introduce unexpected results and even file corruption.

JSON files are also human readable and easily accessible by end users. This means that your database and application will be vulnerable to attacks, especially as database reads are rarely checked for malicious code (Which usually happens on write).

What should I use instead?

An actual database, to put it bluntly. SQL, NoSQL, whatever takes your fancy. Some SQL databases are SQLite, PostgreSQL and MariaDB, while NoSQL databases include things like MongoDB, RethinkDB, ArangoDB and many more. If you want the easy way out, check out Enmap.

What can I use a JSON file for?

JSON files are best used to store static data, in other words data that doesnโ€™t need to change often or programmatically. In practice, this means configuration and other application data that needs to be defined by a human - which is what JSON excels at. If you want something easy, use enmap.

leaden cliff
#

I removed the colon!

#

It was the colon!!!!!

earnest phoenix
#

OMG its simple coding

old cliff
tranquil drum
#

right

earnest phoenix
#

no

#

im using only text

#

well if it's simple why are you struggling so much

tranquil drum
#

why do you need a reverse proxy?

leaden cliff
#

@earnest phoenix Thank you for telling me to remove the colon.

umbral zealot
#

lol that wasn't even the problem ๐Ÿ˜‚