#development

1 messages Β· Page 479 of 1

lusty dew
#

Stupid question

#

Wait

#

how would I define data?

#

if loadImage

#

will not work

quartz kindle
#

what data?

lusty dew
#
 const data =  loadImage(body);
#

data from the image

#

I mean

#

body

#
const { body } = await request.get(image);
quartz kindle
#

is image a url?

#

of so, you dont need request

#

or nvm

#

it should be something with img = new Image; img.src = data;

lusty dew
#
module.exports.run = async (client, message, args) => {

    var user = message.mentions.users.first() || message.author
    var  msg = message.author.displayAvatarURL || user.displayAvatarURL
    var image = msg
    try{
    const { body } = await request.get(image);
    const data =  loadImage(body);
    const canvas = new Canvas(data.width, data.height);
    ctx = canvas.getContext('2d');
    ctx.drawImage(data, 0, 0);
    distort(ctx, 20, 0, 0, data.width, data.height, 5);
    const attachment = canvas.toBuffer();
    if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
    return msg.say({ files: [{ attachment, name: 'glitch.png' }] });
} catch (err){
    console.log(err)
}
}
#

I have image defined

#

I need it to be that

quartz kindle
#

you dont need image = msg

lusty dew
#

Why not

quartz kindle
#

just make image = message.author.etc

#

and remove msg

lusty dew
#

Ok

quartz kindle
#

its the same thing

#

but as for the canvas, idk how node-superfetch treats images

lusty dew
#

:/

#

Welp

#

Me neither

quartz kindle
#

regardless its much easier (and probably better) to manually define the canvas size

#

instead of waiting for an image

#

its better to work with a defined and constant size

lusty dew
#

But

#

I need the persons Avatar

quartz kindle
#

you can get it after

lusty dew
#

It is a Avatar manipulation command

#

Ok

#

Well

quartz kindle
#

i mean, if you're copying the entire command like that, you could also just use canvas 2.0

#

but if you prefer to adapt to 1.6

lusty dew
#

Ima just forget about this command for now

#

I am not in the mood

quartz kindle
#

the solution would be something like canvas = new Canvas(400,400); ctx = canvas.getContext("2d"); img = new Image; img.src = data; ctx.drawImage(img,0,0)

#

but im not sure about how node-superfetch treats images, so data might not work directly like that

#

data here is body from your code

#

what you get from request

lusty dew
#

Ok

#

I will figure it out one day

#

rn not in the mood

#

I may just use

#

the 2nd version or something

#

canvas 2.0

quartz kindle
#

i use canvas 2.0

#

never had any problem with it, even tho they say its in alpha version

lusty dew
#

Yea

#

I used it before

#

Just forgot how to install it

quartz kindle
#

its in their github page

lusty dew
#

Yea

#

I found it

#

npm install canvas@next

tulip snow
#
Uncaught Exception:  TypeError: Cannot read property 'run' of undefined
#

?

lusty dew
#

Hm

#

Code?

#

Which way

#

are you using run

quartz kindle
#

whatever is before .run is undefined

lusty dew
#

Ye

west raptor
#

We can't help if you provide zero code

lusty dew
#

I was getting to that

#

xD

tulip snow
#
    const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
        } else {

            cmd.run(client, message, args);
            
        }
quartz kindle
#

well, cmd is undefined

lusty dew
#

yea

quartz kindle
#

so you have to review why

lusty dew
#

Timmmmm

#

My dude

tulip snow
#

And how do I do that?

lusty dew
#

Well

#

First I would try

#

Console logging maybe

quartz kindle
#

^

lusty dew
#

console.log(cmd)

quartz kindle
#

console.log client.commands and command

lusty dew
#

Ah yes

#

my bad

#

not cmd

#

XD

quartz kindle
#

to see if they contain an expected value

lusty dew
#

Tim

#

Canz you help me

#

With

#

Something?

quartz kindle
#

hm?

tulip snow
lusty dew
#

Anywa

#

Tim I am trying to make a setchannel command

#

so it will set whatever channel the command is used in

#

as logging channel

#

My friend

#

started it

#
const Discord = require("discord.js")
const storage = require('node-persist');


/**
 * @param {Discord.Client} bot
 * @param {Discord.Message} message
 * @param {Array<string>} args
 */
module.exports.run = async (bot, message, args) => {
    switch(args[0]){
        case "channel":
            var chan = message.mentions.channels.first();
            if (chan.guild.id != message.guild.id) await message.channel.send("nice try");
            else {
                
                storage.setItemSync();
            }
    }
}


module.exports.help = {
    names: ["logging"]
}
#

Now I need help with the rest cause

#

idk what he was trying to do

#

he just said ima try something

#

I know what he was doing with the first part

sick cloud
#

that code is horrid

lusty dew
#

Wdym

#

It is not completed

tulip snow
#

My config file is a JS not JSON btw

topaz fjord
#

ew swear filter

bright spear
#

its not really a problem if its opt in

lusty dew
#

How would I do like a case number?
So everytime the command is used
the case number goes up 1

sick cloud
#

db

lusty dew
#

Like for a kick command

Kick report | Case#1
Kick report | Case#2

#

Ah ok

#

could I use

#

quick.db?

sick cloud
#

no

#

get a proper db

#

rethink, mongo, sql, mysql, whatever

lusty dew
#

ew

#

Idk how to use those :/

sick cloud
#

then learn

lusty dew
#

I know

sick cloud
#

or be a fucking meme, use json and cry when all your data gets corrupted

lusty dew
#

sql a bit

#

Um

#

Ok

#

Whatever

#

Wasn't going to use a json

#

What would go inside creating the table

#

nvm

earnest phoenix
#

Anyone want to help me handle some errors?

#

I have an API that handles grabbing currency exchange rates.

#

When a user uses !command usd

#

it will show rates from usd

#

but you know how it is

#

Im using parse so if they type in a nonexistent thing it gives me errors

#

any ideas how to fix?

#

furthermore you could validate the input and compare it against a list of currencies, if you don't want to go in the trouble of doing that you can just do the requests, catch the w/e error that API throws (probably it will throw something related to unknown / invalid currency) - check for that and respond accordingly

#

I have something like this

#

let USD = parseusd

#

Of course it actually has the code

#

My point is

#

If they do !check usd

#

USD won't be on the api to parse

#

So how would I go about throwing it?

earnest phoenix
#

People, hello.

I may be retarded, but how does one list the roles of a user in a guild? (discord.js)

bright spear
#

(answered in other server)

#

hi, do you need help with bot development?

fleet iris
#

how would I add my own css to the discordbots website for my bot?

bright spear
#

@fleet iris just add a <style> tag in the long description

fleet iris
#

oh, gotcha, do you know what I need to target for the background off the top of your head

#

guess I could try body

bright spear
#

yeah

earnest phoenix
#

yall like stupid data porn right?

bright spear
#

wut

earnest phoenix
#

as in like

#

graphs

#

and numbers

#

that are neat

bright spear
#

uh

#

i guess it depends

earnest phoenix
#

just collected some neat data from my bots users showing how methodical people can get

bright spear
#

we're programmers not data analysts

earnest phoenix
#

yea but like

#

yea

#

basically it was a graph of the players movement and colonization efforts through space and pretty much ever player followed a pattern

#

i have a graph for it :f

#

whats the reasoning behind lucas discord pic anyhow?

#

curious

bright spear
#

its some boy named luca

earnest phoenix
#

as in a random boy named luca on the internet?

bright spear
#

uh

#

i dont remember

#

maybe an actor or smth

earnest phoenix
#

lol

#

πŸ‘Œ

bright spear
#

i never knew luca was a boy

earnest phoenix
#

what?

#

i thought he was a reverse trap?

#

smh

lusty dew
#

.

#

I am trying to make a help command where you use reactions to look at certain categories

#

like NSFW would have its own category and Utility would have its own

#

and you use reactions to view a certain one

earnest phoenix
#

reaction collector πŸ€”

#

does that exist?

lusty dew
#

Yea it does

#

I know how to do that im not that dumb

#

I am just wondering how I would make it do categories

earnest phoenix
#

as in recommendations for emojies?

lusty dew
#

No

earnest phoenix
#

as in how you would go about categorie organization etc?

lusty dew
#

Ig

earnest phoenix
#

i mean i would have it output like

πŸ”« game commands
πŸ—¨ General commands
...
etc

#

and react with those

#

and when it clicks

#

edit the message

#

to return whats inside that categorie

lusty dew
#

Ok

earnest phoenix
#

and when you go into a category

#

have one reaction be β—€

#

to return to previous page

#

ya feel?

lusty dew
#

Mhm

earnest phoenix
#

i dont know how many commands or their varience the bot has so im not sure how graceful it would be

lusty dew
#

All i needed was that

earnest phoenix
#

ah ok

lusty dew
#

Now I need to pick the emojis

#

which will be a bitch

#

xD

#

I am picky about everything

earnest phoenix
#

lol

#

all about that ux

#

if you were really cool you would make custom emojis following googles material design principles and integrate those into all your selections

#

but for time sake no xD

lusty dew
#

I could

#

I mean

#

I am not releasing the remake for a good month

earnest phoenix
#

i need to do a rework badly :/

lusty dew
#

Hm

earnest phoenix
#

i have adopted a bunch of new principles when programming which all this invalidates

lusty dew
#

What language?

earnest phoenix
#

nodejs

lusty dew
#

Same

earnest phoenix
#

web application developer

#

but

#

the libraries and such i wrote for my codebase

#

are so spaghetti and obsolete

#

tempted to do a rewrite

#

but thats every programmers answer and it just takes alot of time to go about that so im going to instead just revise the current functions to fit my new standards

#

and let it be

#

instead of the total rewrite

#

anyhow make those custom emojis

#

be unique and cool

lusty dew
#

Meh

#

I won't till later

#

I want to get the command functioning

earnest phoenix
#

yes

#

function over form

lusty dew
#

Yea

earnest phoenix
#

but but but

#

if it looks cool

#

it is cool

bright spear
#

lol ive never fully rewritten my bots

lusty dew
#
module.exports.run = async (client, message, args) => {

    var embed = new Discord.RichEmbed()
    .addField(":gun:Fun commands:", "React with :gun: to view them!")
    .addField(":mailbox_with_mail:Mod Commands:", "React with :mailbox_with_mail: to view them!")
    .addField(":scroll:Information Commands:", "React with :scroll: to view them!")

    var msg = await message.channel.send(embed)
    message.delete().catch(()=>{});
    await msg.react("πŸ”«")
    await msg.react("πŸ“¬")
    await msg.react("πŸ“œ")
    await msg.react("β™»")
    
    
    var Fun = msg.createReactionCollector(FunFilter, {time: 60000})
    var Mod = msg.createReactionCollector(ModFilter, {time: 60000})
    var Info = msg.createReactionCollector(InfoFilter, {time: 60000})
    var del = msg.createReactionCollector(delFilter, {time: 60000});


    del.on("collect", async r=>{
        await msg.edit("Thanks for taking the time to read the ToS!",{embed:null}); 
        setTimeout(()=>{
            msg.delete().catch(()=>{});
            //catch for making sure the function won't call it an error
            //as the message could be deleted in that time
        },5000);        
    });
}
earnest phoenix
#

im just modifying existing functions and portions of code to fit new standards

lusty dew
#

how is this so far?

earnest phoenix
#

does that count as a rewrite?

#

var

#

disgusting

bright spear
#

lol

lusty dew
#

you disgusting

earnest phoenix
#

let

lusty dew
#

meanie

earnest phoenix
#

or const

lusty dew
#

NO

#

var

earnest phoenix
#

why

lusty dew
#

if I want to use var

#

i will use it

earnest phoenix
#

are they global?

#

no

lusty dew
#

Yes

earnest phoenix
#

they are local

#

use let

lusty dew
#

leave me alone

#

:(

#

meanie

earnest phoenix
#

ok :c

lusty dew
#

Anyway

#

I think I got

#

one function done

#

the delete reaction

#

to delete the embed

earnest phoenix
#

how come only the reacts are awaited?

#

in an async func

lusty dew
#

Wym

earnest phoenix
#

wait

#

ignore me

#

wait

#

πŸ‘€

#

is that

#

CONSISTANCY

lusty dew
#

.

earnest phoenix
#

im just messing with ya

#

it looks fine

#

xD

lusty dew
#

Boy

earnest phoenix
#

as counterproductive as it sounds i dont use semi colons at all anymore

lusty dew
#

Le Slap

#

Anyway

#

I am going to try something

#

I never done before :O

#

jk

#

I done it kinda

#

Wait

#

Hold up

#

can i do

#

like

earnest phoenix
#

like

lusty dew
#
    Fun.on("collect", async r=>{
        await msg.edit(embed2)
    })
#

have another embed

#

have

#

the Fun embed

#

defined as embed2

#

and do

#

await msg.edit(embed2)

#

can't I do that

earnest phoenix
#

huh?

lusty dew
#

Idk

earnest phoenix
#

oh your talking about navigating the menues

lusty dew
#

Ye

#

it will edit this embed

#

and put up the second one

#

or whatever

earnest phoenix
#

so personally i would keep a seperate directory containing all the navigational menus and have one function that calls the correct one and then edits

#

like um

lusty dew
#

I could do it in my config

#

well no

#

I could

#

but that would add an extra step I have to do

#

and I am almost out of time

#

xD

earnest phoenix
#
function fetchMenu(arg){
    //fetch menu from menus/ directory
    //require(arg.js).menu
    //pass menu to displayMenu
    
}
function displayMenu(menu){
    //edit the current message to be new menu
}
#

this is how i would go about it imo

lusty dew
#

Ermmmmmmm

#

What

earnest phoenix
#

just so theoretically its super easy to interchange with new menues

#

or add new menus onto it

#

etc

lusty dew
#

Ermmmmm

#

what

earnest phoenix
#

example time

#
// menus/fun.js

module.exports.menu = {
    fields : [] //discord js embed field containing the submenu
}

// help.js fil

let frameMessage = {
        embed: {
            title : 'Navigation',
            description : 'React to navigate menu\'s',
            fields : [{
        //put initial fields here that tell user of diffrent menus
        }]
    }
}

/**
* Pass it a string which is name of file its going to fetch
* @param {String} arg
**/
function fetchMenu(arg){
    let fetchedMenu = require(`./menus/${arg}.js`).menu
    displayMenu(fetchedMenu) 
}

/**
* Pass it a object containing fields in the fashion of a discord embed
* @param {Object} menu
**/
function displayMenu(menu){
    frameMessage.fields = menu.fields 
    message.edit(frameMessage) 
}

//so the idea is whenever you want to swap the menu out just call

fetchMenu('fun')
fetchMenu('general')

lusty dew
#

Hmmm

#

That seems like a lot of work

#

I will experiment with that tomorrow as I am on little time rn

earnest phoenix
#

so the idea

#

behind that

#

is that its theoretically infinitely expandable and interchangeable

#

idk

#

you do you boo

#

also jsdoc comment scheme because force of habbit (i dont even use js doc i just like the commenting methodology)

fleet iris
#

you use await or then and then modify that message variable ex: message.channel.send(embed).then ( (edittedMessage) => { editMessage.edit(); }); or you can do await

topaz fjord
#

You can do await

earnest phoenix
#

Hello

topaz fjord
#
const dick = await message.channel.send('para is weeb')
dick.edit('para is mega weeb')
earnest phoenix
#

client.on('message', message => {
        let reason = message.content.split(" ").slice(2).join(" ")
        let muterole = message.guild.roles.find("name", "muted")
        let men = message.mentions.users.first()

        if(message.content.startsWith(prefix + "mute")) {
            if(!men) return message.channel.send("**Do you want me to mute you πŸ€” ?, please @mention someone. `Ex. #mute @xRokz bad boy`**");
            if(!reason) return message.channel.send("**Do you want me to mute " + men.username + " with no reason ?, `Ex. #mute @xRokz bad boy` or just use `none` for no reason **`")
            if(!muterole) {
                message.guild.createRole({name: "muted", color:"#505f74", permissions: [1115136]})

            }
            message.guild.member(men).addRole(muterole)
                message.channel.send("**" + men.username + " has been muted! :zipper_mouth:**")
        }

        if(message.content.startsWith(prefix + "unmute")) {
            if(!men) return message.channel.send("**please @mention someone. `Ex. #unmute @limber wave bad boy`**");

            if(!muterole) {
                message.guild.createRole({name: "muted", color:"#505f74", permissions: [1115136]})

            }
            message.guild.member(men).removeRole(muterole)
                message.channel.send("**" + men.username + " has been unmuted! πŸ˜€ **")
        }
    })```

this good or bad  vote 0/10
#

im vote 7/10

knotty steeple
#

what

earnest phoenix
#

this code good or bad @knotty steeple

knotty steeple
#

does it matter

west raptor
#

If it works, it works

#

Not like you making something for nasa

#

But, it does look fine, for what I can see

earnest phoenix
#

Rainbow allowed ?

west raptor
#

Wut

knotty steeple
#

rainbow role probably

earnest phoenix
#

yas

#

but this like spam

knotty steeple
#

no it isnt

#

allowed

earnest phoenix
#

i can make afther 5 min change color

steel drum
#

@earnest phoenix

earnest phoenix
#

?

steel drum
#

imo dont hard code commands

#

into your msg event handler

#

load them from separate file(s)

topaz fjord
#

Changing role color every 5 min is fine afaik

earnest phoenix
#

i will try it on new bot

#

ty guys

steel drum
#

np

#

the way i do it is

#

put all my commands in a directory called plugins

#

and in my main bot file

topaz fjord
#

i put my commands in my cmds folder then I have subfolders for each section

steel drum
#

i dont put subfolders

#

i just say subject-w/e it is.js

#

so like bot-economy.js

#

bot-exp.js

#

fun-misc.js

#

etc

earnest phoenix
#

const size    = config.colors;
const rainbow = new Array(size);

for (var i=0; i<size; i++) {
  var red   = sin_to_hex(i, 0 * Math.PI * 2/3); // 0   deg
  var blue  = sin_to_hex(i, 1 * Math.PI * 2/3); // 120 deg
  var green = sin_to_hex(i, 2 * Math.PI * 2/3); // 240 deg

  rainbow[i] = '#'+ red + green + blue;
}

function sin_to_hex(i, phase) {
  var sin = Math.sin(Math.PI / size * 2 * i + phase);
  var int = Math.floor(sin * 127) + 128;
  var hex = int.toString(16);

  return hex.length === 1 ? '0'+hex : hex;
}

let place = 0;
const servers = config.servers;

function changeColor() {
  for (let index = 0; index < servers.length; ++index) {        
    client.guilds.get(servers[index]).roles.find('name', config.roleName).setColor(rainbow[place])
        .catch(console.error);
        
    
    
    if(place == (size - 1)){
      place = 0;
    }else{
      place++;
    }
  }
}



client.on('ready', () => {
  console.log('Bot Is Online')
  if(config.speed <60.000){console.log("The minimum speed is 60.000, if this gets abused your bot might get IP-banned"); process.exit(1);}
  setInterval(changeColor, config.speed);
});
topaz fjord
#

IP banned

earnest phoenix
#

xD

topaz fjord
#

more like API banned

earnest phoenix
#

YAS

#

5 min

#

5 s = 5000

#

5 min = ?

steel drum
#

i usualyl write it in this notation

#

5 * 60 * 1000

earnest phoenix
#

Ok so 864 developers online, do anyone knows how to do what I asked for (DM me who is experienced in API verification bots)

steel drum
#

to keep the source code clean

#

what do you mean API verification bots

earnest phoenix
#

sorry im copypasting from general

#

If anyone it's expert in those and knows how can I make something to verify the ranked elo of the game Town Of Salem please DM me

steel drum
#

is theres a ToS API?

earnest phoenix
#

a bot that works with an Elo verification bot in the specific discord channel

#

i want something simple

#

astris is too complex tbh

#

you can see ur reports, info, money in game gold everything

#

You do a command !setign and put your game name, then you have to log into their forum and you'll get an link ''!verify" and a big code.
But you have to be logged in ''trial system''.
http://blankmediagames.com/Trial/

steel drum
#

it looks like astris has direct access to the ToS database

earnest phoenix
#

i really dont know, because that's not an official tos channel

#

it was but now it isn't

steel drum
#

is there an official tos channel

earnest phoenix
#

let me give u a link

#

2 sec

steel drum
#

they might of contacted the devs of ToS abt this project

earnest phoenix
#

welp isn't really ''not official'' since reedit bot still says that they have 3 discord channels and the channel that astris has is one of them

#

i tried to talk with the dev but he is inactive.. so i couldn't find him on discord

earnest phoenix
#

O

#

h

#

solved it

#

found the api but i still give roles manually, but now i can do commands like !elo and etc

#

yass

steel drum
#

hey

#

post some code

#

for us to dissect

#

test

#

kk that was just me testing smth

#

um

lament meteor
#

wait a second...

steel drum
#

???

#

it should be discord.js

lament meteor
steel drum
#

oh didnt know you could do that

lament meteor
#

iirc python doesnt have console.log()

steel drum
#

can you ?

lament meteor
#

it has print

#

yea

#

console.log() is javascript for print in python

#

try to change it to discord.js kthx

#

@earnest phoenix try to learn javascript first πŸ˜ƒ

steel drum
#

try using fs to read token.json

lament meteor
#

u dont need fs to read token.json

steel drum
#

whats the error

#

you're getting

#

to clear things up

lament meteor
#

tbh he/she doesnt know how to code

steel drum
#

who doesnt know how to code

#

bots are actually really easy to make

lament meteor
#

html is not a coding lang

steel drum
#

try looking at

#

the documentation

upper ember
#

Doesn't work

 String balance = rs.getString("balance");
channel.sendMessage(balance);

Work

 String balance = rs.getString("balance");
sout(balance);
#

helpp lol

heady zinc
#

sendMessage?

lament meteor
#

wat lib?

upper ember
#

jda

steel drum
#

isnt sendMessage deprecated

upper ember
#

no

heady zinc
#

oh jda

#

trash ok

lament meteor
#

in d.js yes but jda no

sullen path
#

@upper ember .queue()

upper ember
#

yea

#

I found that out by myself

sullen path
#

πŸ‘Œ

upper ember
#

but thanks

earnest phoenix
#
const discord = require('pizza.py');
const client = new life.buy();
const tokens = require('./life.json');

client.on('eating pizza', ) => {
  console.log('I HAVE CANCER!');
});

#

not a fake code

sullen path
#

client.on('eating pizza', )

#

('eating pizza', )

#

that comma

lament meteor
#

naming a js module with .py season 1

lofty abyss
#

what is the width of the description?

#

1600x?

#

@bitter sundial

#

anyone know?

hushed berry
#

...

lofty abyss
#

sorry

#

but do you know?

#

by any chance

hushed berry
#

probably depends on the device youre viewing it on

#

lol

lofty abyss
#

pc

hushed berry
#

probably depends on the device youre viewing it on

lofty abyss
#

am trying to embed a website

#

so

hushed berry
#

you do realize that there isnt a standard "pc" resolution right

lofty abyss
#

oofs

hushed berry
#

im not too familiar with html but cant you specify dimensions in %?

lofty abyss
#

Please enter at least 300 characters excluding special characters in your detailed description. If you use iframes, you need to use at least 300 more characters..

#

am dead

#

i cant even embed a website

#

oofs

hushed berry
#

lmao

#

i put this in a comment

lofty abyss
#

LOL

#

ooofs

#

i just put my old description

#

under my website

rustic axle
#

Yes you can groovy

lofty abyss
#

u talking to ur self here bro?

#

lol

rustic axle
#

<img a="google.com/img.jpeg" width="50%">

lofty abyss
#

oh mhm

#

helpful

#

ty

rustic axle
lofty abyss
#

yyeh i use that

lusty dew
gilded blaze
#

Listen to reactions and supply some checks

lusty dew
#

I have the

gilded blaze
#

If you are using Discord.js there is a reaction collector

lusty dew
#

Yea

#

thats what I did

#

I have all that

#

now the problem is

#

getting it to switch embeds

#

when a reaction is clicked

gilded blaze
#

Use the edit method and specify a new embed object

lusty dew
#

Hmmm

#

I have something similar

#

Note I did this half asleep

#

so may be a lot of mistakes

#

or such

#

OOF ofc hastebin not working

quartz kindle
#

you dont need 3 reaction collectors, only one

#

you can detect which reaction was used with the collect event

lusty dew
#

Oh ok

#

Tim

#

I got this

#

[object Object]

gilded blaze
#

So you are trying to pass an object into an embed value?

lusty dew
#

Uhhhhh

#

Idk

#

I think

gilded blaze
#

Where are you getting object output

lusty dew
#

When I click the reaction

#

to switch embed\s

gilded blaze
#

You have to interpret the data in the object

lusty dew
#

Ok

#

I will figure this out later

#

I have school

earnest phoenix
#

yo my doods

#

whats good

ruby dust
earnest phoenix
#

im here to talk about

#

why var is the superior variable declaration method

topaz fjord
#

it's not but whatever you have to tell yourself

heady zinc
#

it's not but whatever you have to tell yourself

earnest phoenix
#

it's not but whatever you have to tell yourself

#

JDA

sullen path
#

JDA what?

heady zinc
#

what's a JDA

topaz fjord
#

you

barren brook
#

how turn my bots status offline

#

in js

steel drum
#

check documentation

#

whenever in doubt i recommend just checking documentation

sullen path
#

you kill the process mmLol

steel drum
#

i think he means

#

the status

sullen path
#

shush

steel drum
#

;3

barren brook
#

like when bots say online green and offline gray and that

steel drum
#

@barren brook

#

sorry had to get a glass of water

#

mess aroudn with this

barren brook
#

k'

lofty abyss
#

yo does anyone know why my cmd keeps just randomly closing?

spring ember
#

How are you launching it

#

Did you call exit?

topaz fjord
#

not if u don't give more info

spring ember
#

Are you using batch

lofty abyss
#

just doing node index.js

#

well in cmd

spring ember
#

Send code

lofty abyss
#

am just going into the folder

#

and doing node indexjs

#

.js

barren brook
#

why are my commands not working from glitch anyone know why?

spring ember
#

Send code of index.js

lofty abyss
#

i will pass

spring ember
#

@barren brook send code

#

@lofty abyss then I can not help you

lofty abyss
#

like it runs fine for like 30m

topaz fjord
#

then we can't fix ur problem lmao

lofty abyss
#

then just closes

barren brook
#

like link to glitch

spring ember
#

No

barren brook
#

ohh code the code

spring ember
#

Just your bots code without token

barren brook
#

k

spring ember
#

@lofty abyss without code i can't help you, it's in the code

barren brook
#

the help code is the prob

#

module.exports.run = (client, message, args) => {
  const help = new RichEmbed()
           .setTitle("Help")
           .setDescription("Here are the commands:")
           .addField("a-Joke","Sends a random joke")
           .addField("a-Help","Shows this")
           .addField("a-Ping","Responds with pong")
           .addField("For people with the permission,","These commands will work")
           .addField("a-Kick @user","Kicks a user")
           .addField("a-Ban @user","Bans a user")
           .addField("a-Role {user} {role} & $Delrole {user} {role}","Gives/Removes a role from a user")
           .setColor(0x00ff00)
           .setFooter(`Help for ${message.author.tag}!`)
          message.channel.send(help)
  }

module.exports.help = {
  name: "help" 
} ```
#

thast the help command

spring ember
#

What is the issue

barren brook
#

wont work

spring ember
#

Errors?

barren brook
#

not just not working when i do the command.

spring ember
#

Can you log if the command has been called?

#

like add console.log('hey') to the start of the run method

barren brook
#

k

#

and

#

is this command right? client.user.setStatus('idle') .then(console.log) .catch(console.error);

spring ember
#

No need to log

#

Just do catch

barren brook
#

can you edit it and send it back please

spring ember
#
client.user.setStatus('idle')
  .catch(console.error); 
barren brook
#

k

#

status.js?

spring ember
#

Idk

#

Where you want to call it

#

πŸ˜‚

barren brook
#

ok

#

ill do status.js

#

says client is not defined

#

how do i put my bot status saying watching instad of playing

rustic axle
#

What do you have on line 51 @lofty abyss

#

That will help us

cyan quail
#

I am using python to write a bot, is it possible to list all servers using the bot?

ionic barn
#

what do you mean?
if its getting all servers that your bot is in ,then client.servers returns an iterable

slow elk
#

So, I've been using SQLite for my bot's warn system, and it keeps returning the following error:

(node:12300) UnhandledPromiseRejectionWarning: Error: SQLITE_ERROR: incomplete input
warning.js:18
(node:12300) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

My SQLite code is as following:

sql.get(`SELECT * FROM warnings`).then(() => {
    // Warn Code Here
}).catch(() => {
    console.error;
    sql.run(`CREATE TABLE IF NOT EXISTS warnings (variables)`).then(() => {
        // Same Warn Code Here
    }
});

Am I doing something wrong here?

#

The warning.js is a file created by VSCode's debugging process.

#

A-anyone able to help me out? Sorry for being inpatient, I want to fix this asap.

#

Oh, I get a different error on the hosting. It simply says Cannot read property 'run' of null, no additional info is shown.

knotty steeple
#

ik its bot.latency but like

#

actual ping

sick cloud
#

thats the ping to the client

#

theres only one other ping, being roundtrip

knotty steeple
#

how do you get that

lusty dew
#

How do you define query?

earnest phoenix
#
       let rateCAD = JSON.parse(data).rates.CAD;
       let rateEUR = JSON.parse(data).rates.EUR;
       let rateAUD = JSON.parse(data).rates.AUD;
       let rateNOK = JSON.parse(data).rates.NOK;
       let rateGBP = JSON.parse(data).rates.GBP;
       let rateBGN = JSON.parse(data).rates.BGN;
       let rateBRL = JSON.parse(data).rates.BRL;
       let rateCHF = JSON.parse(data).rates.CHF;
       let rateCNY = JSON.parse(data).rates.CNY;
       let rateCZK = JSON.parse(data).rates.CZK;```

How can I throw the error if one of those is non-existent?
inner jewel
#

why do you parse it every time

#

also you could make a helper function

earnest phoenix
#

I need to...

inner jewel
#
const parsed = JSON.parse(data);
let x = parsed.x;
let y = parsed.y;```
earnest phoenix
#

breh

#

I need it to update

#

every time the command goes

#

it all works

#

mind if I DM you code?

#

it would help me explain it

slender thistle
#

@knotty steeple Since I am sort of lazy

#
    @commands.command(aliases=['pong'])
    async def ping(self, ctx):
        "Bot's connection to Discord."
        t1 = time.perf_counter()
        await ctx.channel.trigger_typing()
        t2 = time.perf_counter()
        # your stuff```
inner jewel
#

you don't need to parse it for every line

#

data doesn't change

#

you're just wasting cpu and memory to parse it

earnest phoenix
#

data does change lol

inner jewel
#

it doesn't

#

it might change from one invocation to the other

#

but it definitely won't from one line to the other

earnest phoenix
#

alright. I will do

#

but thats not the issue

#

basically

#

I need it to get all exchange values from an args base

#

so !check usd

#

would make the base usd

#

then dm u the values

#

but if I try parsing usd

#

it wont exist

#

so I need to throw the error

#

anyone else willing to help?

night imp
#

I recommend using a full database

#

@earnest phoenix

#

JSON is quick but it is also slow and error prone

earnest phoenix
#

its an online free api

#

can I dm you

night imp
#

Oh wait

#

NVM kek

earnest phoenix
#

I have an idea how to fic it

#

I just need some help

earnest phoenix
#

❌

floral stone
#

What are some good ways to reduce memory?

quartz kindle
#

in js?

lusty dew
#

Tim

#

Wassup my dude

#

can you help me with something

#

what are some good things to use for making a music command?

quartz kindle
#

no idea

lusty dew
#

damn

#

I want to make a good music command

oak imp
#

So I got the bot to shard and it works beautifully, but, it breaks the reload command. So, how does one make all shards run a function via broadcastEval?

lusty dew
#

Hm

#

How does one make your music command do searches instead of URLs

#

How does one

#

get a Youtube Data API ey

#

key*

#

Ok

#

nvm

#

I got it

#

Can someone help me with the search feature?

#

I am using a npm package called youtube-search

#

I have part of it done

#

but I need help with the other part

wintry quest
#

You guys ever seen those bots with an embed, and then when you click β–Ά or something it changes to a new embed?

#

how on fuckery of fucks do they do that

sick cloud
#

reaction collectors and crap

quartz kindle
#

my bot does that

wintry quest
#

ya mind sharing how it does that

lusty dew
#

use reaction collectors like tony said

#

also

#

do you mean pages

#

or actual embeds

#

I know how to do pages

#

but not switching from embed to embed

sick cloud
#

you literally just edit with new embeds

lusty dew
#

I tried doing

#

that

#

like

#

message.edit(embed)

#

but it just returns

#

[object Object]

#

in chat

sick cloud
#

dumbass, lmfao. its { embed: embed }

lusty dew
#

Wow

#

don't be a dick

sick cloud
#

i'm not

lusty dew
#

"dumbass"

#

Just cause I didn't know something

#

doesn't mean you have to be a dick about it

sick cloud
#

yeah yeah whatever ok

lusty dew
#

lmfao

viral iris
#

what can i do here ?

lusty dew
#

You copy the server ID's the bot is already in

#

and paste them there

#

like

#

Ex: 264445053596991498, 482616256592085012

viral iris
#

all servers !?

lusty dew
#

It says

#

max 3

#

so no

viral iris
lusty dew
#

that is optional

#

also

#

It helps to read things

#

before filling all that stuff out

viral iris
#

how can i do website

lusty dew
#

It is optional

#

you dont have to

#

but if your bot has a website

#

put the bot's website URL right there

viral iris
#

okk

wintry quest
#

@lusty dew yeah it was embed pages

#

my bad

lusty dew
#

Ah ok

#

I will help you in a few

#

I am working on a music command rn

#

so kinda busy

wintry quest
#

all good man, about to disappear for an hour or so anyway

#

I'll shoot you a dm later

lusty dew
#

Okie

lusty dew
#

I keep getting this error in chat telling me to connect to a VC

#

but I am in one

#

so idk why it says that

sick cloud
#

@lusty dew voiceChannel not voiceChanel

#

look for typos

lusty dew
#

oooooof

#

ty

sick cloud
#

np

lusty dew
#

❀

viral iris
#

when my bot approval ?

lusty dew
#
(node:1572) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'g
et' of undefined
    at Object.module.exports.run (C:\Users\User\Desktop\LoverBot v3\commands\mus
ic.js:24:33)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection
 id: 2)
(node:1572) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.
#

I do not understand...

sick cloud
#

what line is it erroring on?

#

show the code

lusty dew
#
var data = ops.activate.get(message.guild.id) || {};
#

this one

sick cloud
#

activate is undefined

lusty dew
#

Oh

#

OOOF

#

it is

#

active

#

not activate

#

damnit

#

I just remembered that

#

;p

sick cloud
#

πŸ‘

lusty dew
#

Thanks again

#

lmfao

#

active and activate

#

are close together

#

it sometimes corrects itself to activate

#

Ok this one

#

I do not understand where the error is

#
(node:10908) UnhandledPromiseRejectionWarning: TypeError: data.connection.play i
s not a function
    at play (C:\Users\User\Desktop\LoverBot v3\commands\music.js:49:53)
    at Object.module.exports.run (C:\Users\User\Desktop\LoverBot v3\commands\mus
ic.js:37:30)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:10908) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
 error originated either by throwing inside of an async function without a catch
 block, or by rejecting a promise which was not handled with .catch(). (rejectio
n id: 2)
(node:10908) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
ecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.
#
data.dispatcher = await data.connection.play(ytdl(data.queue[0].url, {filter: "audioonly"}));
#

I don't understand

#

how that is not working

#

I know it says it is not a function

#

but how can I fix it?

sick cloud
#

play isnt a function @lusty dew

#

where did you define play

lusty dew
#

I didn't..

#

How do I define play?

sick cloud
#

connections only have play if they exist, so idk

lusty dew
#

maybe

#

or something

#

no wait

#

nvm

#

@sick cloud I had to do playStream

#

like I said XD

viral iris
#

how can i fix this problem ?
responds to bots

lusty dew
#

?

viral iris
#

if anybot said -help my bot responds to bots

#

how can i fix it ?

lusty dew
#

is your prefix -

viral iris
#

yes @lusty dew

lusty dew
#

that is why then

#

as to how to get your bot to ignore the other bots

#

i do not know

#

I hope I don't have that problem o.O My bot's prefix is mentioning it

#

xD

sick cloud
#

ignore bots

#

what lang @viral iris

lusty dew
#
TypeError: Cannot read property 'emit' of undefined
    at Object.module.exports.run (C:\Users\User\Desktop\LoverBot v3\commands\ski
p.js:27:35)
    at Client.client.on (C:\Users\User\Desktop\LoverBot v3\index.js:57:31)
    at Client.emit (events.js:187:15)
    at MessageCreateHandler.handle (C:\Users\User\Desktop\LoverBot v3\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\LoverBot v3\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\LoverBot v3\node_modules\ws\li
b\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
    at Receiver._receiver.onmessage (C:\Users\User\Desktop\LoverBot v3\node_modu
les\ws\lib\websocket.js:137:47)

Error Line:

return fetched.dispacther.emit('finish')
sick cloud
#

fetched and/or dispatcher are undefined

lusty dew
#

Hmm

#

ok

#

It is

#

dispatcher

#

I defined fetched

#

hmmm

#

For some reason

#

my pause command

#

did not pause the song

#

Fixed it

lament meteor
#

@viral iris what discord lib is your bot?

viral iris
#

bot.js

lusty dew
#

ok

lament meteor
#

ah...

lusty dew
#

so discord.js

lament meteor
#

no...

viral iris
#

yeah

lament meteor
#

@viral iris d.js or eris?

#

oh...

#

ok

lusty dew
#

xD

lament meteor
#

so ur bot is a 1 file bot?

viral iris
#

yes

lament meteor
#

in the message event do if (<MESSAGE>.author.bot) return

#

<MESSAGE> is wat u defined message

viral iris
#

in all codes ?

lament meteor
#

wait... dont tell me u did something like this

const Discord = require('discord.js')
const client = new Discord.Client()

client.on('message', (message) => {
//command 1
})
client.on('message', (message) => {
//command 2
})

client.login('DIsIs.MyTOkEn.KthxBye')```
#

@viral iris ??????

viral iris
#

hm....yes @lament meteor

lament meteor
#

u gotta do it to all of em then

#

why did u do that when u can do all the cmds in 1 event

#

did u set the MaxEmmiters to like 1000?

viral iris
#

i will fix it

#

1060 :3

sick cloud
#

have one event

ruby dust
#

Such creative token

topaz fjord
#

You don't need a message event for every single command

fluid sonnet
#

@fossil oxide or @bitter sundial why my bot (@desert dagger) is muted? 😭

earnest phoenix
#

oof

lament meteor
#

@fluid sonnet check #mod-logs also u dont need to ping the Web admins

fluid sonnet
#

Ah okay

#

Sorry

lament meteor
#

well i checked and it responses to other bots

earnest phoenix
#

good thing he didn't ping all three of them

lament meteor
#

also this isnt the channel to ask those stuff @fluid sonnet

fluid sonnet
#

And where?

#

Ok

#

Thx

#

Whoops

#

But it's anormal

earnest phoenix
#

what

remote heart
#

How can I get the bot to create a server invitation when someone uses a command on a server?

earnest phoenix
#

What language?

remote heart
#

node.js

#

Javascript

earnest phoenix
#

Mk. Let me see.

#

So you want it to create a server invite for the server the command is run in?

remote heart
#

Yes

earnest phoenix
#

Is this bot for your server only?

remote heart
#

No

earnest phoenix
#

Read through that and the comments. It should describe how to do it and where the user went wrong.

#

Something like that should work (I added the unique boolean).

remote heart
#

Where do I have to copy this purely?

quartz kindle
#

you dont copy

#

you learn and implement

remote heart
#

ok

earnest phoenix
#

Silly tim, always preventing spoon feeding.

lusty dew
#

Hey guys!

#

How can you make a command restricted to people who haven't voted for the bot yet?

earnest phoenix
#

Yes

#

@lusty dew DiscordJS?

lusty dew
#

Yep

earnest phoenix
#

Use FS to write a file in JSON format

#

You can use the dbots API to see who votes

#

Add their name to the file

#

Then have it read the filr

#

File*

#

And check if they are on it

heady zinc
#

don't do that.

lusty dew
#

?

heady zinc
#

Do not ever use fs to store data in json files, fs is not meant for that purpose and will fail at some point or another

#

you don't even need to store it in any database, you can keep the voters in memory

lusty dew
#

yea

#

I learned that the hard way o.O

#
C:\Users\User\Desktop\LoverBot v3\index.js:70
});
  ^

SyntaxError: Unexpected end of input
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:670:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
#

I can't find the source

quartz kindle
#

index.js line 70

lusty dew
#

There is no line 70

#

gtg

#

found problem

remote heart
#

How can I make a blacklist command? So that one indicates the user id in the second and then the ID is geblacklistet how does it work?

#

Because I need such a command because if one of the Bot with Commands fully Spammt

sick cloud
#

have a db

#

and add an owner cmd to add/remove users ids from it

#

then on message, stop if the users id is in there

remote heart
#

What should I do?

sick cloud
#

i literally just told you

shy verge
remote heart
#

My english is not good sry 😦

shy verge
#

have a database that has all the blacklisted IDs that only you can add to, then check the db in your message handler if the given message author's ID is in the db

#

then just return out of the message handler if there's a match

remote heart
#

i have no Database

vernal rivet
#

Du sprechst deutsch @remote heart

#

Wenn du das tust, dann ping mich einfach an, was in Deutsch falsch ist, wenn es deine Hauptsprache ist. und ich werde versuchen, so schnell wie mΓΆglich zu dir zu kommen

#

My German is a little rusty, I haven't actually used it alot lately, so I am going to be slow on the responses, and Google a little bit just to check if I wrote the right thing πŸ˜…

shy verge
#

ascended

vernal rivet
#

Lol

earnest phoenix
#

hey guys, any shade of light here would be appreciated, my bot is public a couple days and its in a dozen of servers but from some I randomly get this, haven't been able to reproduce yet

#

fails on .react(...) w/ discord.js

vernal rivet
#

You are missing the right permission to use it

earnest phoenix
#

it does not miss permissions pepodetective

#

in fact, permissions error is "Missing Permissions"

quartz kindle
#

not always

vernal rivet
#

Some times it happens with my bot coin system

quartz kindle
#

for example, if it doesnt have view message history permission, it might throw unknown message error

sick cloud
#

message might've been deleted

earnest phoenix
#

I thought so, but wouldn't it throw Unknown Message, if message was deleted?

quartz kindle
#

yes

earnest phoenix
#

missing access sounds like it can't access that message anymore

vernal rivet
#

It's a missing Access error

earnest phoenix
#

like no longer perms to view the channel the message was posted in

#

I'm actually gonna try to reproduce like that pepothink

#

thanks XD

quartz kindle
#

regardless, missing access is related to a specific permission probably

#

try message history and reactions permission

earnest phoenix
#

will add message history perm I guess blobshrug

#

see how that goes

#

one more question

#

I was really curious about

#

any reason why that is when the server has like 20k members?

quartz kindle
#

most libraries cache members as they come online

#

so at startup the bot can only see online members, and then as more members come online, he starts caching and remembering them

earnest phoenix
#

hmm that'd make sense

#

thanks tim

quartz kindle
#

if you want to see offline members as well

#

you can use guild.fetchMembers()

sick cloud
#

whats this?

(node:12120) UnhandledPromiseRejectionWarning: Error: StatusCodeError: 400 - {"embed":["fields"]}
earnest phoenix
#

a promise threw an error and it wasn't catched, you can listen to unhandledRejection for more info or catch the w/e promise threw the error

  console.error('unhandledRejection', error)
})
lofty abyss
#

oofs my servers are not getting updated on the website

#

slow much

remote heart
#

@vernal rivet Ja cih spreche Deutsch

wide ruin
#

does javascript = js?

west raptor
#

Yes

wide ruin
#

thanks

west raptor
#

Np

topaz fjord
vernal rivet
#

@remote heart Was ist das Problem?

#

Ich werde in wie 20 Minuten zur VerfΓΌgung, ich bin an der Schule, ich gehe zum Mittagessen in 20 Minuten

restive silo
#

Saure Kartoffel eher Deutsche Kartoffel OMEGALUL

vernal rivet
#

Lol, er ist

earnest phoenix
#

.

#

hello]

#
const args = message.content.split(" ").slice(1) 
const server = client.guilds.find(m => m.name.toLowerCase === args[0].toLowerCase())
if(!server) return message.channel.send(`Not found!`)
server.members.forEach(m => m.send(args.slice(1)))
}``` allowed ?
topaz fjord
#

no

#

it's not

#

Since it technically counts as mass dm

earnest phoenix
#

this only on my server

knotty steeple
topaz fjord
#

still counts

earnest phoenix
#

not sand to all server

sick cloud
#

having issues with express statics. no matter how much i try, they won't work, any idea why on this? πŸ‘€

#

also, the files AND path exist

topaz fjord
#

show code bobo