#development

1 messages Β· Page 435 of 1

knotty steeple
#

then a highlight i guess

#

what is the error about

west raptor
#

there is most of it

keen drift
#

That line seems to be not present when I'm logged in and present when I'm logged out/incognito

#

It's prob something in the light theme

knotty steeple
#

@west raptor need python in env path

jovial sigil
#

yup!

#

its there for me too

knotty steeple
#

yes javascript need python GWqlabsMingLUL

keen drift
west raptor
#

so

#

how

#

do i do

#

that

knotty steeple
#

just install python and add it to PATH

#

on system environment

#

but when you install it should add it automatically so

west raptor
#

ok

#

should i disable path legth limit?

knotty steeple
#

yes

west raptor
knotty steeple
#

did it install

west raptor
#

yes

knotty steeple
#

check if python is in path

west raptor
knotty steeple
#

yes

#

wait node wants python or python3 GWqlabsThonkery

west raptor
#

idk

knotty steeple
#

well idk anymore

earnest phoenix
#

ask in plexi server

knotty steeple
#

no

#

ads

#

@earnest phoenix you help here

earnest phoenix
#

idk how to help

knotty steeple
#

i heard you are proficient in js and stuff

west raptor
#

im so confused

#

apparently it needs python2

earnest phoenix
#

@keen drift sorry for the mention but I guess you missed my messages, the line is coming from the background image, its cut in those places (see-through) and what you're seeing is the bg color of the page. its not visible to everyone because it has to do with res scaling, its visible in wider res

keen drift
#

@earnest phoenix The weird is that it's only visible on the light theme and not dark

#

It's the same background, it should be visible

earnest phoenix
#

this is just your eye playing tricks, its not visible in chrome preview as well

#

due to the fact the bg is dark

#

they blend in

keen drift
#

Guess I'll upload my svg version

earnest phoenix
#

I can patch them in ps real quick if u want

keen drift
#

Eh it's fine

earnest phoenix
#

alright xD

keen drift
#

shouldn't occur with svg I hope

#

I think that bg is the 4k version

knotty steeple
#

so i have this balance command, that shows how many coins someone has. when i try to do it on my beta instance of my bot, it shows the gif in the footer, but when im on the public and stable version it doesnt? why is this?
Beta Instance: https://vgy.me/Cou3Sg.png
Normal Version: https://vgy.me/uY2jHy.png

sick cloud
#

is the link right?

keen drift
#

is the gif an animated emoji?

knotty steeple
#

this is the link to the gif

#

code in both instances are the same

quasi marsh
#

Are you running the beta version from your local pc?

#

Could be that your VPS can't access the URL for some reason

earnest phoenix
#

wat

keen drift
#

I'd just dump the RichEmbed and see if it's actually in there

knotty steeple
#

why wont my vps be able to access the url tho GWqlabsThonkery

#

and yes beta version is on my pc

quasi marsh
#

Dunno, just thinking about every possible failure option

#

Can you try curl https://i.gifer.com/ZXv0.gif on your VPS?

knotty steeple
#

hmm ok

earnest phoenix
#

but isn't just an icon url

keen drift
#

It shouldn't need to be able to access it no? You are just passing the URL

quasi marsh
#

Should look like garbage data tho

earnest phoenix
#

why would vps download it in the first place

quasi marsh
#

Hmm that does make sense

keen drift
#

Try dumping RichEmbed struct

knotty steeple
quasi marsh
#

Yeah it's an image

#

So returns garbage data in a console

knotty steeple
#

so thats whats garbage data

#

ok

keen drift
#

Well a terminal can't render an image

knotty steeple
#

ik

keen drift
#

So ascii conversion makes it garbage

knotty steeple
#

its for text stuff only

#

ascii conversion Thonk

#

also before wdym by dumping RichEmbed struct

keen drift
#

Well in the RichEmbed object you create, console log it

knotty steeple
#

i dont use RichEmbed

keen drift
#

But that screenshot is a RichEmbed?

knotty steeple
#

i just do {embed: {stuff}} on send()

keen drift
#

Well, yeah that's RichEmbed, except it's just a standard obj

knotty steeple
#

ok

keen drift
#

In that case there shouldn't be a mistake?

#

Dunno if this works, but I'd try inspecting the element manually as well

simple bramble
#

Idk why, but for some reason 1 command doesn't show up in the bot's help list, even though its in the code

inner jewel
#

you forgot a newline

simple bramble
#

oh

#

i didnt see that there

#

it blended in with the other code blocks

tulip snow
#

How do you install quick.db?

sick cloud
#

npm i quick.db?

earnest phoenix
#

how can i see the cpu of my bot

#

any example?

low rivet
#

lang?

elfin bane
#

How do I add commands to my bot. Lol all I’ve got is β€œcookie” and then it sends a cookie πŸͺ emoji

#

I wanna do milk to but when I do milk it disables cookie

#

:\

quartz kindle
#

lmao

#

you have to program them

earnest phoenix
#

.addField('CPU', ${process.cpuUsage}`)
why i cannot use this

sick cloud
#

does it even exist?

#

Β―_(ツ)_/Β―

glossy mason
#

@earnest phoenix what lib?

earnest phoenix
#

discord.js

glossy mason
#

Does this work?

.addField('CPU', process.cpuUsage)
earnest phoenix
#

wait i will try it

#

here is the error

glossy mason
#

First line explains all, one of your fields has a value with more than 1024 characters.

earnest phoenix
#

hello.. anyone know how to get all data from all row in column using sqlite3 discord.js..?

my code :


bot.on('message', async message => {
    if (message.author.bot) return;
  const db = await dbPromise;
    db.get(`SELECT * FROM badword WHERE guildId = "${message.guild.id}"`).then(row => {


    
if(message.content.toLowerCase().includes(row.badword1)) {

  message.delete();
        return message.reply(row.message)

    
  
});
  
});



////////////////////////////////////////////////////////////////////////

on my code only get 1 row, not all row...
example :

  1. Data at Database :
  • row 1 : f*ck,
  • row 2 : s*it.

when write "f*ck", it's deleted and send message warn. But if, write s*it", no deleted message and message warn.

glossy mason
#

From what it sounds like you are asking, you see the SELECT * part of your query? That means select all columns, you can do stuff like SELECT columnName to only select a single column. Also, never concatenate values into your queries, use prepared statements instead like this:

db.get('SELECT columnName FROM badword WHERE guildId = ?',  [message.guild.id]).then(... //your other stuff
#

The reason to use prepared statements instead of string concatenation is because let's say you had something like a place for a server to add a new bad word, some could do something like

let userInput = '", "");DROP TABLE badword;--'
db.get(`INSERT INTO badword (word, guild) VALUES ("${userInput}", "${guildId}")`) ...

But it really would be doing

INSERT INTO badword (word, guild) VALUES ("", "");DROP TABLE badword;--")

And goodbye badword table.

keen drift
keen drift
#

πŸ‘€

high lava
#

Um

#

Ok

keen drift
#

Saw dat

high lava
#

You saw nothing

#

...I don't know if you were talking about me typing or the message the other dude sent

keen drift
#

I need to buy more prepaid cards so i can abuse aws

#

Other guy

high lava
#

Ok. Good

#

Also, don't abuse my dad

merry stirrup
#

Can someone help me with adding roles when someone hits 10 invites?
** Code Lang.:** Discord JS

Plz PM ME

keen drift
#

πŸ‘€

high lava
#

Wait. what

merry stirrup
#

πŸ‘€

#

🍭

keen drift
#

If invites >= 10 > addrole

#

Ezpz

high lava
#

I honestly dont think that's possible

merry stirrup
#

xD

#

It is, RefferalRanks, Invite Managaer

high lava
#

And if it is, then it's hella hard to achieve

keen drift
#

Hella hard πŸ‘€πŸ‘€πŸ‘€

merry stirrup
#

so, anyone has an idea of how?

high lava
#

sigh Harder than normal

keen drift
#

Heh

#

guildMemberAdd > Iterate invites > conditionals > addrole

#

d0ne

high lava
#

looking at the official documentation, there is a .fetchInvites() method for the Guild class. It works like this

// Fetch invite creator by their id
guild.fetchInvites()
 .then(invites => console.log(invites.find(invite => invite.inviter.id === '84484653687267328')))
 .then(console.error);
#

I'd suggest finding that on the documentation and then going from there

#

You could even look at the other classes and see if anything else there would work for you

merry stirrup
#

I know how to check them

young wind
#

Hello, i'm using discord.py, non-rewrite.
Can someone here help me with some properties of discord.Invite?
I read in the documentation that you get get the number of uses from an invite. I used

inv = await client.get_invite(CODE)
uses = inv.uses```
but it returns None every time.  I'm looking to use the int value that SUPPOSEDLY comes from inv.uses, but I can't seem to retrieve the value?
merry stirrup
#

but when someones joins

#

to add the role if they have an amount of invites

#

PM me plz

#

gtg

high lava
#

What?

#

If they just joined they wouldn't have invites. lol

keen drift
#

Knows how to check them > still doesn't know how to do it

#

πŸ€”πŸ€”πŸ€”πŸ€”

high lava
#

I think he's asking how to give autoroles once they reach a certain number of invites

#

Which, if he knows how to check them, that should be really easy

keen drift
#

So like an inviter role 🀨

high lava
#

Or like tiers depending on how many people you invite

#

10+ 20+ 30+ etc.

keen drift
#

His question is unclear anyway πŸ€·β€β™€οΈ

high lava
#

Like, I found both of the classes and methods I needed to use to do that and it only took me a few minutes. lol

#

The documentation is super good for this

#

@young wind Do you expect the .get_invite() to GIVE you the code, or did you put a url to the invite in the brackets?

#

Because it's usage is .get_invite(url)

young wind
#

According to the docs, I use get_invite() to retrieve an invite object, which I SHOULD be able to use to get the uses from.

high lava
#

The client class and Invite class are two different things. In reality your getting the info like this

discord.client.get_invite().uses

When in reality you need to get uses using the actual Invite class, not the client, like this

discord.invite.uses
young wind
#

Yes, but I need a way to get the invite object in the first place.

#

(Which is supposedly returned by get_invite())

high lava
#

What invite are you actually using, if you could show it

#

Dont worry, I'm not gonna spam you or anything :P

young wind
#

Nvm, I got it sorted out.

#

Thanks for the help tho.

high lava
#

np

merry stirrup
#

Thx guys

wise bridge
#

I am just messing around a bit with the webhooks and they basically seem to work. But when I try to access the post data, i fail at it. I am using a PHP script which sends to a webhook and it just doesn't send anything.

<?php

include 'Client.php';

$discord = new Client('webhookurl');
$discord->send('A vote!\n'.$_POST["type"]);

?>

Just sending "A vote!" Works but using the post data fails

fluid basin
#

I assume there is nothing in $_POST?

#

Those are post body variables

wise bridge
#

Ah that could be

earnest phoenix
#

@keen drift looks good

wise bridge
#

I still can't figure out how to, has anyone got a clue? php://input as resource still doesn't work

frail kestrel
#

@high lava .catch(console.error)*

high lava
#

what?

frail kestrel
#

cc this

// Fetch invite creator by their id
guild.fetchInvites()
 .then(invites => console.log(invites.find(invite => invite.inviter.id === '84484653687267328')))
 .then(console.error);
high lava
#

Oh yeah

#

You can ignore that

frail kestrel
#

lol

high lava
#

Wait a sec

#

Wait. Nvm

#

I just took it from the official website. They could figure it out. lol

frail kestrel
#

oof

wise bridge
#

I still haven't got any further with the webhooks.

<?php

include 'Client.php';


$data = json_decode(file_get_contents('php://input'), true); echo $data;

file_put_contents("debug.txt", $data);

$discord = new Client('url');
$discord->send('Even this does not work with the test webhook but opening this page in browser does');
if ($data) {
    $discord->send($data);
}
$discord->send('A vote!\n'.print_r($data));

?>

That debug file is always empty after a test webhook

jolly mist
#

the team does not work, help please

bot.on("message", async message => {
    if(message.author.bot) return;
    if(message.channel.type === "dm") return;

    let prefix = botconfig.prefix;
    let messageArray = message.content.split(" ");
    let cmd = messageArray[0];
    let args = messageArray.slice(1);

    if(cmd === `${prefix}info`){

        let bicon = bot.user.displayAvatarURL;
        let botembed = new Discord.RichEmbed()
        .setDescription("Bot Information")
        .setColor("#ffa500")
        .setThumbnail(bicon)
        .addFiled("Bot Name", bot.user.username)
        .addFiles("Created on", bot.user.createdAt);

        return message.channel.send(botembed);
    }
});
languid dragon
#

team?

vale gull
#

what am i doing wron

    const { body } = await superagent
    .get('aws.random.cat/meow');
    const embed = new Discord.RichEmbed()
    .setColor(0x954D23)
    .setTitle("Meow :cat:")
    .setImage(body.file)
    message.channel.send({embed})
} else
 

});```
knotty steeple
#

there is multiple things wrong with that code

vale gull
#

hm?

knotty steeple
#

why is there an else

vale gull
#

wtf

#

im retarted

frail kestrel
#

retarted

#

you are rarted

pale marsh
#

I’m trying to collect statistics for how many commands are used per day

#

I guess I can count the commands used and send them every set interval to the database

#

But still trying to figure out how to determine when 24 hours have passed since I usually fo maintenance every now and then and the bot restarts πŸ€”

#

Any ideas?

quartz kindle
#
timer.setUTCHours(24);
timer.setUTCMinutes(0);
timer.setUTCSeconds(0);```
#

this will set timer to exactly the next midnight utc from any point you start it

#

then just deduct from it the current time and use the result in a settimout

pale marsh
#

That'll only post like once every 24 hours, and when I restart the bot the current number stored in memory will be lost/reset back to 0

quartz kindle
#

then why dont you just send it like every 60 seconds?

#

if you have a database setup correctly, the transaction should not cost too much resources

#

or you send it manually whenever you restart the bot, if you have a restart command

#

but that doesnt work for crashes

pale marsh
#

The same issue still exists. If I send it every 30 seconds, when can I tell that say 24 hours have passed since I first started sending?

quartz kindle
#

ah i see what you want

#

do it like this, use the code above to get the midnight utc timer, push that to the database as a row/index, and then feed the content into that by checking if the time already exists

#

after 24 hours have passed, the timer wont match anymore, and the database will create a new row instead of feeding the existing one

#

then you can fetch the amount of commands for each 24h timeframe

pale marsh
#

That's not a bad idea actually πŸ€”

#

Thanks. That should work

earnest phoenix
#

Hi, I am currently making a system that when reacting to send a message in my private, but is speaking the following error: 'Can not send messages to this user' being that my dm is released

sharp escarp
#

Excuse me i am trying to make a eco bot and i am ok at java but not the best and i try to run my bot but it says squlite3 module not found and i tried downloading squlite3 but bunch of errors poped up please help

#

please help

knotty steeple
#

java and sqlite Thonk

sharp escarp
#

yah

spring ember
#

Ok what is squlite

knotty steeple
#

*squlite3

spring ember
#

It needs to be sqlite

knotty steeple
#

i wonder if he meant javascript thonkku

sharp escarp
#

Yah sorry i meant sqlite3

spring ember
#

Also for eco you should use a process database like postgresql

sharp escarp
#

Yha i meant javascript im sorry

spring ember
#

Oh

knotty steeple
#

meh

#

i use sqlite for my economy

spring ember
#

@sharp escarp sqlite3

#

Not squlite

sharp escarp
#

Yah

spring ember
#

I hope this will fix the problem

#

Can you send the code?

#

And the stack error

sharp escarp
#

its alot of errors are you sure

#

i dont think they will fit in the text limits

spring ember
#

Hastebin

jolly mist
knotty steeple
#

red wave?

#

also you have files but thats not defined

jolly mist
#

&

#

?

knotty steeple
#

looks like you have ) near "./commands/"

#

but you dont need that

jolly mist
#

yeah ?

earnest phoenix
#

it’s case-sensitive

jolly mist
#

stop

knotty steeple
#

stop what

jolly mist
#

this is bot for Discord, one guy as well as me, the current he does not have a red wave

#

I have

knotty steeple
#

still dont know what you mean as a red wave

jolly mist
knotty steeple
#

again

earnest phoenix
#

because you did a closing bracket after the closing quotation mark

knotty steeple
#

^

jolly mist
#

?

#

fs.readdir("./commands/"), (err, Files) => {

    if(err) console.log(err);

    let jsfile = files.filter(f => f.split(".").pop() === "js")
    if(jsfile.length <= 0){
        console.log("Couldn't find commands.");
        return;
    }

    jsfile.forEach((f, a) =>{
        let props = require(`./commands/${f}`);
        console.log(`${f} loaded!`);
        bot.commands.set(props.help.name, props);
    });
});
#

??

knotty steeple
#

remove that

jolly mist
#

Who is this?

#

f*ck? thank you

knotty steeple
#

wat

jolly mist
#

I have instead of the hands CLOVES

#

and yet, what is a
"nodemon" is not internal or external command, executable program or batch file.

#

why ERROR

jovial sigil
#

Weirdest conversation I've seen so far....

jolly mist
#

Help please
C:\Users\Tishin\Desktop\project\IlychBot\index.js:12
let jsfile = files.filter(f => f.split(".").pop() === "js")
^

ReferenceError: files is not defined
at fs.readdir (C:\Users\Tishin\Desktop\project\IlychBot\index.js:12:18)
at FSReqWrap.oncomplete (fs.js:169:20)

vale gull
#

im trying to run nodemon

quartz kindle
#

files is not defined

knotty steeple
#

case sensitive

#

you have Files when you use files

visual zenith
#

guys, when I tried to do

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
``` it doesnt work and idk how to fix it
spring ember
#

Is your port being forwarded?

visual zenith
#

wdym forwarded?

#

can you tell me more please

spring ember
#

Are you hosting on a VPS or at home?

visual zenith
#

im hosting using glitch

#

im so confuse on how to award the users when they upvote

#

@spring ember

ruby dust
#

it's always the best practice to first test the features before you get yourself in these kind of awkward moments

visual zenith
#

πŸ€”

prisma panther
#

So is there any way to setup a bot just so i can send embeded messages with its own profile pic?

turbid gale
#

like this? Thonk

upper gyro
#

Hey guy's Im a little bit stumped by this, so hopefully one of you can help me.

I have this which should be adding roles to a member when they join the guild. This code is in my guildMemberAdd event, however it is returning a Missing Permissions error even though the bot has all permissions including administrator (for testing purposes). Any chance that any of you have any ideas?

Code

let moduleConf = client.modules.get(member.guild.id);
    if(moduleConf.autoRole.enabled){
        let roles = [];
        if(moduleConf.autoRole.role.length > 0){
            moduleConf.autoRole.role.forEach(role => {
                let roleID = member.guild.roles.find('id', role);
                if(!roleID) return;
                roles.push(roleID.id);
            });
        }
        member.addRoles(roles, 'Auto Role added').then(() => {
            console.log('role added');
        }).catch(console.error)
    }

Error

{ DiscordAPIError: Missing Permissions
    at item.request.gen.end (C:\Users\RedJambo\Desktop\Discord Bots\PublicBot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:71:65)
    at then (C:\Users\RedJambo\Desktop\Discord Bots\PublicBot\node_modules\snekfetch\src\index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  name: 'DiscordAPIError',
  message: 'Missing Permissions',
  path: '/api/v7/guilds/376568990048321538/members/155149108183695360',
  code: 50013 }

FYI: I am writing in NodeJS using the discord.js API

sick cloud
#

That usually means that the role(s) your trying to add is higher than your bots highest role (in the Server Settings "Roles" tab, position-wise).

#

Go to the Roles tab and make sure the role(s) your trying to add are all below the bots highest role.

upper gyro
#

That was my first thought.. so I put it at the very top of the list (I should have added that in the original post) but still no luck

#

I put the bot role at the top of the list that is.

sick cloud
#

Weird.. πŸ‘€

upper gyro
#

I'll agree to that one

#

So it looks like I managed to fix it... my code now reads:

let moduleConf = client.modules.get(member.guild.id);
    if(moduleConf.autoRole.enabled){
        let roles = [];
        if(moduleConf.autoRole.role.length > 0){
            moduleConf.autoRole.role.forEach(role => {
                let roleID = member.guild.roles.find('id', role);
                if(!roleID) return;
                member.addRole(roleID, 'Auto Role Added').then(() => {
                    console.log(`role added`);
                }).catch(console.error);
            });
        }
    }

I moved the member.addRole to be in the forEach loop and it solved the problem. I have a feeling that member.addRoles doesn't like adding an array of roles if there is only one role.

sick cloud
gilded thunder
#

@prisma panther what language?

prisma panther
#

@turbid gale yes

#

@gilded thunder whatever will let me do it lol

quartz kindle
#

any language can do it. just use whatever you're already using

prisma panther
#

I dont know how to do anything 🀷

quartz kindle
#

do you even have a bot?

gilded thunder
gilded thunder
#

What's the difference between a user and a member in the sense of discordMember and discordUser?

quasi marsh
#

Member has additional properties

#

For instance, when the user joined the server

#

In most libs, it will probably extend from the user model

#

Meaning you can compare members with users

#

But a member is associated with a guild (server), and a user is not

gilded thunder
#

So member is on the same server and a user isn't present?

quasi marsh
#

Yeah if you want to retrieve a member you'll have to call it with a guild

#

In python it's like

#

member = client.get_guild(id).get_member(id)

gilded thunder
#

and user : discordUser

quasi marsh
#

To simplify, a discordUser represents just the person, nothing more

#

a discordMember represents the person, but also it's connection to a specific server

gilded thunder
#

Okay, thanks blobthumbsup

fluid basin
#

member has roles and nicks

sick cloud
#

@gilded thunder a user has basics like ID and username. member has extras like roles, nickname etc that are guild specific.

fluid basin
#

and perms

sick cloud
#

^

last niche
#

can anyone help get me a simple af bot? I need a bot that can ban @here or @everyone while DM each one why.

quasi marsh
#

Learn programming and make one yourself πŸ˜‰

gilded thunder
#

Why you wanna ban everyone thonking

#

Seems a bit dodgy.

#

As if you found a leaked token and want to nuke servers with it.

buoyant tinsel
#

Wait.

#

This server has Thonk?!

#

<3

gilded thunder
#

I also have nitro.

buoyant tinsel
#

Lucky.

#

I ain't got money for that.

gilded thunder
#

You ever just say you have Nitro just to flex on them poor nibbas

quartz kindle
#
{ DiscordAPIError: Missing Access
    at item.request.gen.end (/home/timotejroiko_gmail_com/astrobot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)
    at then (/home/timotejroiko_gmail_com/astrobot/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
  name: 'DiscordAPIError',
  message: 'Missing Access',
  path: '/api/v7/channels/459919817382821888/messages/459920180940898304/reactions/%E2%97%80/@me',
  code: 50001 }
#

my bot was added to a server and started giving off these, never seen them before

#

something related to reactions, but it does have permission to use reactions

bleak sapphire
#

dunno anything bout d.js but it looks like ur bot has no perms to add reactions? idk

quartz kindle
#

it should have tho

bleak sapphire
#

try checking the bot permissions in that server using eval

#

or just kindly ask them if your bot has the add reactions permission

quartz kindle
#

it was removed from the server, cant check anymore

bleak sapphire
#

ow

wispy jolt
#

did this happen before or after it was removed

quartz kindle
#

before doing anything, i have a code to check for the permissions i need, including adding reactions, but the code didnt say anything, so im assuming no permissions are missing, or there is another permission required that im not aware of

#

before

fluid basin
#

Hmm

#

Seems like you lost access to the reaction before your bot could perform the action that it was trying to do

#

Like being denied access to reaction or that channel or being removed from that guild

quartz kindle
#

yeah which is very strange

#

the reactions are for my pagination in the help menu, they're fired off immediately

fluid basin
#

Yeah most likely it was removed from the server before your bot could carry out that action it was trying to do

#

Well generally these should rarely happen, but there is still a chance for it to happen when the 2 actions coincide

bleak sapphire
#

anyone have an idea on how to get started with a web dashboard?

fluid basin
#

Hmm

#

I'd say you get the base design done

#

With placeholder variables and etc

bleak sapphire
#

well its done

fluid basin
#

Then from there slowly convert the placeholder values to actual dynamic values from your bot

quartz kindle
#

so i just tried to remove reaction permissions in my server, and the bot responded correctly

bleak sapphire
#

i just dont know how im going to make users log in to my website so that they can customize the bot

quartz kindle
#

so the problem is elsewhere

#

oh found it

sick cloud
quartz kindle
#

apparently it needs read message history to add reactions

sick cloud
#

I don't have 2FA on but my bot can use the orange permissions.

#

@bleak sapphire implement oauth2 and make it possible to list servers etc, thats a good start.

#

Get the authorization and login/logout etc out of the way, make sure your bot has a good database, then you can do other things.

night imp
#

nope

frail kestrel
#

mfw permissions calculator

#

discord has an oauth url generator on bot page

rough wraith
#

Currently my bot is sharding and it runs on three shards. I am wondering if I could have a separate temporary "maintenance" bot process and run it on all the shards?

neon schooner
#

What're you wanting to do that for exactlty? Maintaining some functionality?

rough wraith
#

like a daily task

#

realized that i have left my cleanup db.py script in the dust for quite a long time

neon schooner
#

So it'd change over on cron?

rough wraith
#

since we sharded the bot, i dont think that script works anymore

#

and ye cron

neon schooner
#

It might be useful to rewrite and stuff maybe the server would catch fire less often if the db is cleaned up

rough wraith
#

and things would be faster

#

takes lesser cpu

#

ye

neon schooner
#

That'd be good

rough wraith
#

yeah discord limits me to that 3 shards

#

i cant make one instance across all shards temporarily

ruby dust
#

wait, is manage webhooks considered a dangerous moderation tool?

sick cloud
#

It can be, it can be used like a bot or userbot to spam channels etc.

#

Also guys, how do you get the max amount of memory on your dedi/VPS, and how do you get CPU usage? (node.js/discord.js)

ruby dust
#

well I mean, to the point when you are required to have 2fa enabled to have that permission

sick cloud
#

πŸ‘€

ruby dust
#

I'm relying on this image

sick cloud
#

Yeah. I don't think thats true though, I've been able to use those permissions though I don't have 2FA.

ruby dust
#

in servers that require 2fa?

sick cloud
#

Maybe.

fluid basin
#

yeah it applies to servers with 2fa enabled

sick cloud
#

πŸ‘Œ

upper gyro
#

@sick cloud take a look at os-utils on npm that gives some usage stats like memory and cpu.

sick cloud
#

already got it with good ol' process, no modules needed

#

but thanks

upper gyro
#

πŸ‘πŸ» πŸ˜€

earnest phoenix
#

STATS

#

COMMANS

#

commands

quiet bobcat
earnest phoenix
#

virify

quiet bobcat
#

Bot commands don't work in here go to #commands

earnest phoenix
#

Ok

jolly mist
quiet bobcat
#

You need {} after catch I think

native narwhal
#

Doesn't catch always have to be wrapped in brackets?

ashen tendon
#

{

earnest phoenix
#
try {} catch {}``` (node 10 with flag)
or ```js
try {} catch (_owoWhatsThis) {}```
jolly mist
#

thank you!

frail kestrel
#

flag

#

flag as in

#

--flag

eager perch
#

πŸ‡ΊπŸ‡Έ

frail kestrel
#

??

#

is that related to our conversation here or nah

#

oh

#

right

jolly mist
#

why does not it work? what's the problem?

const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
    if(!message.memder.hasPermission("MANAGE_MEMBERS")) return message.reply("Sorry pal, you can't do that.");
    let rMember = message.guild.memder(message.metions.users.first()) || message.guild.members.get(args[0]);
    if(!rMember) return message.reply("Could't find that user yo.");
    let role = args.join(" ").slice(22);
    if(!role) return message.reply("Specify a role!");
    let gRole = message.guild.roles.find(`name`, role);
    if(!Role) return message.reply("Could't find that role.");

    if(rMember.roles.has(gRole.id));
    await(rMember.addRole(gRole.id));

    try{
        await rMember.send(`Congrats, you have been given the role ${gRole.name}`)
    }catch(e){
        message.channel.send(`Congrats to <@${rMember.id}>, trey have been given the role ${gRole.name}. We tried to DM them, but their DMs are locked.`)
    }
}

module.exports.help = {
    name: "addrole"
}
low rivet
#

what's not working?

frail kestrel
#

dont expect us to know, tell us what you're experiencing

jolly mist
#

Well, when I write m! addrole the bot should give out the role I wrote, and it does not what does not. Does not work!

frail kestrel
#

i can already see the first error

jolly mist
#

?

frail kestrel
#

This: message.guild.memder(message.metions.users.first()) || message.guild.members.get(args[0]);

Should be: message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);

jolly mist
#

still does not work?

halcyon abyss
#

you get your member by his id ?

jolly mist
#

?

proud folio
#

How can i convert a image to CSS code?

fluid basin
#

Do you mean html code

#

CSS is for styling, not sure what do you need

proud folio
#

I have a image

#

That i want to my background on the site

knotty steeple
#

background-image: url("https://example.com")

#

i think

fluid basin
#

And the url has to be https or else it wouldn't load

buoyant oak
#

so I'm trying to insert data into multiple columns using pymysql.
The Code

conn = pymysql.connect(host = 'localhost', user = "myuser", passwd = "mypass", db = "db", port=xxxx)
cursor = conn.cursor()
cursor.execute("INSERT INTO Table(Column1, Column2) VALUES (%s,%s)", (variable1, variable2))

It would return the following error:

query = query % self._escape_args(args, conn)
TypeError: not enough arguments for format string

Any ideas?

granite hedge
fluid basin
#

its just discord, titles and description work differently compared to fields

earnest phoenix
#

so

#

I have a problem

fluid basin
#

yea?

earnest phoenix
#

with Jimp in discord.js

fluid basin
#

Hmm

#

I've used jimp for a bit, but soon I moved to using canvas and the speeds are way faster

earnest phoenix
#

the problem is it gives The source must be a Jimp image

fluid basin
#

Not saying jimp is bad or anything

#

Oh that means you have to make it a jimp image first, probably loading the image using jimp first and using that

earnest phoenix
#

oof

#

now I have to find how to do that then

fluid basin
#

Hmm

earnest phoenix
#

I did that

#

it gives that respond

fluid basin
#

Like in this lenna is the jimp image

earnest phoenix
#

oof

#
Jimp.read("C:/dingus/"+message.author.id+".jpg").then(function (image) {
          image.mask(message.author.avatarURL, 50, 20 );
          image.print(font, 300, 30, message.author.tag);
          image.write("C:/dingus/"+message.author.id+".jpg");
    // do stuff with the image
}).catch(function (err) {
    // handle an exception
});

is the current thingy

#

but

#

I've tried some other ways

fluid basin
#

Oh

#

You are missing the err argument

earnest phoenix
#

oo

fluid basin
#

See in the example its function (err, lenna)

#

wait no

earnest phoenix
#

.>

fluid basin
#

I think you should try putting them together

#

like image.mask(...).print(...).write(...)

earnest phoenix
#

oh

#

I tried that tho but well Ima try again

fluid basin
#

OH

#

Its your .mask part thats wrong

earnest phoenix
#

oh

fluid basin
earnest phoenix
#

woopsae

fluid basin
#

Your src is wrong I guess

#

the src has to be a jimp image

earnest phoenix
#

well whatever heh

#

gonna find >.>

fluid basin
#

Meaning Jimp.read(message.author.avatarURL).then(function (avatar) ...

#

and avatar will be a jimp image

#

message.author.avatarURL is a URL, not an image

#

nor a jimp image

earnest phoenix
#

yeet

fluid basin
#

yup hope that solves your problem

buoyant oak
#

;-;

earnest phoenix
#

well

#

I don't get errors, so it edits the picture, but

#

it doesn't do it right

#

oof

#

Now ima have to check everything again grrr

fluid basin
#

yeah then you will need to adjust your code I guess

earnest phoenix
#

ik

odd seal
#

Does anybody know how to give a bot watching status?

solid cliff
#

lib?

odd seal
solid cliff
#

async or rewrite

#

async I assume πŸ‘€

earnest phoenix
frail kestrel
#

.then((err, avatar) => { });

#

haha

tame obsidian
solemn valve
#

Guys need a bit of help to get started

#

Is there how to guide to making a bot with basic code blocks

#

I did a quick look around on rules and announcements couldn’t find any links

tame obsidian
#

lmao what

night imp
#

Try watching YouTube videos

#

They go over the basics of getting started

solemn valve
#

I want to make a bot that sends a command to a 3rd party website and returns the output

#

Ok

tame obsidian
#

like a webhook

#

or like a request

quartz kindle
#

chose your language/environment, get a basic bot running (connect to discord, listen to messages), then take a look at http requests

solemn valve
#

It’s a call to a website that links to google translate api for free

tame obsidian
solemn valve
#

that might be perfect im checking it out

real ginkgo
#

H

#

Can someone help me?

sick cloud
#

@real ginkgo ask your question?

real ginkgo
#

How do you make a user joined, user left thing?

#

I use JS.

night imp
#

Discord.js?

real ginkgo
#

Yes

night imp
#

Use client.on

solemn valve
#

made a bot, its on my server

night imp
#

here under the events tab

#

you can see all the events you can
client.on

solemn valve
#

do i need to download visual studio and node.js?

#

im an ex coder it shouldnt take me long to get the hang of it again

night imp
#

Have you coded the bot?

#

πŸ€”

solemn valve
#

nope

night imp
#

Ok, you have to code it first and then host it

real ginkgo
#

Yea

solemn valve
#

what visual studio workloads do i need to install

#

ASP.NET and web development + universal windows platform development?

sick cloud
#

any editor will do for node.js

#

personally Visual Studio Code is good, but its up to you

solemn valve
#

k installing just universal package if i need something else ill assume it'll ask

sand roost
#

How should I limit urban to give NSFW responses?

low rivet
#

dont think you can

solemn valve
#

thank you for help so far

sick cloud
#

@sand roost just limit the command to NSFW channels, thats what I'd do. the api might have a safe search thing though, dunno

buoyant oak
#

guys

#

any idea where the information on Bucketypes are? Trying to use cooldowns

#

anyone used cooldowns

#

pls

#

;-;

ruby dust
#

this question might be more suitable to be asked in dapi, but if I were to get a user with bot.get_user_info() will I be able to do further actions on them even if they are already in the server? like I know this is more used to hackban users and so on...

solid cliff
#

@buoyant oak

@commands.cooldown(rate,per,BucketType) 
# Limit how often a command can be used, (num per, seconds, commands.Buckettype.default/user/server/channel)```
jolly mist
#

Why does not it work, why does not the role play out ???

const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
    if(!message.member.hasPermission("MANAGE_MEMBERS")) return message.reply("Sorry pal, you can't do that.");
    let rMember = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
    if(!rMember) return message.reply("Could't find that user, yo.");
    let role = args.join(" ").slice(22);
    if(!role) return message.reply("Specify a role!");
    let gRole = message.guild.roles.find(`name`, role);
    if(!Role) return message.reply("Could't find that role.");

    if(!rMember.roles.has(gRole.id)) return message.reply("They don't have role.");
    await(rMember.addRole(gRole.id));

    try{
        await rMember.send(`Congrats, you have been given the role ${gRole.name}`)
    }catch(e){
        message.channel.send(`Congrats to <@${rMember.id}>, trey have been given the role ${gRole.name}. We tried to DM them, but their DMs are locked.`)
    }
}

module.exports.help = {
    name: "addrole"
}
buoyant oak
#

@solid cliff ty

slender thistle
#

@ruby dust Yes?

earnest phoenix
prime cliff
#

Just do a sql statement to filter by channel id and then get the index of that filter which would be the serverid to remove it

knotty steeple
#

rest of code?

#

owait

#

i c

#

you still have to do msg.channel.send()

#

with embed

buoyant oak
#
@commands.command(pass_context=True, hidden=True)         
@commands.cooldown(1,5,commands.BucketType.user)
async def economy(ctx, Command:str=None):
    if Command == None:
        await bot.say(" THIS IS THE ECONOMY MENU:")
#

~~slightly ~~confused
very confused

west raptor
#

thanks @knotty steeple

knotty steeple
#

also isnt doing prefix + "COMMAND" annoying

west raptor
#

kinda

#

ill set up command handler soon

knotty steeple
#

so your bot is 1 file?

west raptor
#

yea riht now it is

#
  fs.writeFile('storage/userData.json', JSON.stringify(userData), (err) => {
                                               ^

TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at Client.bot.on.message (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\app.js:115:48)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)```
quartz kindle
#

error in the json data, or not a proper object

granite hedge
#
msg.channel.fetchMessages({ limit: 100 }).then(messages => console.log(messages.size).catch(console.error);
```does not result to anything
quartz kindle
#

isnt catch supposed to be after the then()?

uncut slate
#

you're missing a closing paren

sick cloud
#

how does one make a git pull command? so I can actually pull my bots updates w/o needing to reupload all the files lol

west raptor
#

seems to be in the code the json is fine if i comment the command it works fine

  var guildMoney = 0;
        var guildUsers = 0;
        var guildRichest = '';
        var guildRichest$ = 0;

        for (var i in userData) {
            if (i.endsWith(message.guild.id)) {
                guildMoney += userData[i].money;
                guildUsers += 1;
                if (userData[i].money > guildRichest$) {
                    guildRichest$ = userData[i].money;
                    guildRishest = userData[i].username;
                }
            }
        }
        message.channel.send({"embed":{
            title: "Balance",
             color: 0x4386f2,
             fields:[{
                 name:"Accounts",
                 value:guildUsers,
                 inline:true
             },
             {
                 name:"Total Money",
                 value:guildMoney,
                 inline:true
             },
            {
                name:"Richest Accounts",
                value:`${guildRichest} with ${guildRichest$}`
            }]
         }})
    }

    fs.writeFile('storage/userData.json', JSON.stringify(userData), (err) => {
        if (err) console.error(err);
    }); */``` here is the code
knotty steeple
#

*/ what is that there for

quartz kindle
#

could be that userData contains properties that are incompatible with json

earnest phoenix
#

multiline comment πŸ€”

quartz kindle
#

console.log the userData to check

sick cloud
#

thankssss

earnest phoenix
#

@prime cliff Can you send the query?

ocean vale
#

My Commands Aren't working when i have a chat filter on what should i do?

sick cloud
#

what kind of chat filter?

west raptor
#
   fs.writeFile('storage/userData.json', JSON.stringify(userData), (err) => {
                                               ^

TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at Client.bot.on.message (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\app.js:115:48)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\fazin\OneDrive\Documents\Coding\ecbot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)``` i get this error if i dont comment ```js
 fs.writeFile('storage/userData.json', JSON.stringify(userData), (err) => {
        if (err) console.error(err);
    });``` i logged `userData` got `{}` but it worked before i added
#
var guildMoney = 0;
        var guildUsers = 0;
        var guildRichest = '';
        var guildRichest$ = 0;

        for (var i in userData) {
            if (i.endsWith(message.guild.id)) {
                guildMoney += userData[i].money;
                guildUsers += 1;
                if (userData[i].money > guildRichest$) {
                    guildRichest$ = userData[i].money;
                    guildRishest = userData[i].username;
                }
            }
        }
        message.channel.send({"embed":{
            title: "Balance",
             color: 0x4386f2,
             fields:[{
                 name:"Accounts",
                 value:guildUsers,
                 inline:true
             },
             {
                 name:"Total Money",
                 value:guildMoney,
                 inline:true
             },
            {
                name:"Richest Accounts",
                value:`${guildRichest} with ${guildRichest$}`
            }]
         }})
    }
``` and the i comment it, i still get an error
#

that was confusing

earnest phoenix
#

Guys give me a Welcome Message Java Script Code (discord.js)

west raptor
#

hold on i worded that bad

quartz kindle
#

if you get {} that means the object is empty

#

i dont think you can stringify an empty object

ocean vale
#

@sick cloud this is what my chat filter looks like
``import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time

Client = discord.Client()
client = commands.Bot(command_prefix = "+")

chat_filter = ["PINEAPPLE", "APPLE", "CHROME"]
bypass_list = []

@client.event
async def on_ready():
print("Bot is online and connected to Discord")

@client.event
async def on_message(message):
contents = message.content.split(" ") #contents is a list type
for word in contents:
if word.upper() in chat_filter:
if not message.author.id in bypass_list:
try:
await client.delete_message(message)
await client.send_message(message.channel, ":underage: BE GONE CURSE WORDS! :angry: ")
except discord.errors.NotFound:
return
@client.event
async def on_message(message):
if message.content == "p!info":
await client.send_message(message.channel, "Name: Penguin Helper Version: 0.0.1 Created by Musicmanlogo#6435 Coded by Penguin#7006")

@client.event
async def on_message(message):
if message.content == "p!help":
await client.send_message(message.channel, "Name: Commands Help,Info Prefix p! More Commands Coming Soon")
client.run("Taco.18")``

sick cloud
#

codeblock pls

ocean vale
#

k

sick cloud
#

also um i don't use python so can't help any further there

#

Β―_(ツ)_/Β―

quartz kindle
#

code block is triple `

slender thistle
#

It is send_message

#

Not send message

#

You probably should use chat_filter instead of chat filter

#

Why do you have client and Client defined?

#

delete_message, not delete message

ocean vale
#

well im not coding this by myself

#

i have someone else helping me

slender thistle
#

Oh what

#

client.run("Taco.18") is wrong

ocean vale
#

ik

slender thistle
#

Ah ok nice one

ocean vale
#

i changed

cold niche
#

Chatfilters are hard tho

ocean vale
#

because that was the token for the bot

slender thistle
#

Is except discord.errors.NotFound: valid?

#

I thought it was discord.NotFound

cold niche
#

CommandNotFound?

slender thistle
#

Yeah

#

Or wait

#

There is technically no command, because that's on_message event

cold niche
#

Ohh

#

Why are you coding your bot with the async branch tho?

slender thistle
#

Preferences, probably retardEyes

cold niche
#

I'd really recommend using the rewrite version (if you can maintain the code on breaking changes)

slender thistle
#

Or, as they said before,

well im not coding this by myself
i have someone else helping me
cold niche
#

That's the most annoying thing (IMO) when you have thousands of thousands of code, and you have to refactor the whole thing because you miss something from the async branch's capabilities

slender thistle
#

Use async2rewrite :^)

cold niche
#

Lol, nice meme

ocean vale
#

@slender thistle where do you see
send message
chat filter
delete message
Because im not seeing it and im looking at it

slender thistle
#

Wait

#

Isn't it if X not in Y:?

cold niche
#

It looks like you followed a bad YT tutorial mate

ocean vale
#

not really

cold niche
#

That direct import of Bot, and the botclient

sick cloud
#

quick question before i go to bed but i get this console output when i try logging all my reminders (there are 2)

code:

module.exports = async () => {
    const reminders = [];
    const r = await db.table('reminders');

    if (!r) return;
    await r.forEach(obj => {
        reminders.push(obj.reminders);
    });

    // monitor reminders
    setInterval(() => {
        reminders.forEach(reminder => {
            let r = reminder[reminders.indexOf(reminder)];
            console.log(r);
        });
    }, 3000);
}
cold niche
#

That's a mistake of a bad youtuber

slender thistle
#

Actually, true

sick cloud
#

so its like only logging the same one ^^

slender thistle
#

You only need import discord, since you are using on_message event instead

cold niche
#

He wrote more commands coming soon, so I assume he'll use the commands.ext in the future

#

Which is fine, but then he won't need the client to be defined

slender thistle
#

Or just use on_message event in the same file over and over

cold niche
#

And he'd need to change the decorators

slender thistle
#

You also could just use on_message event instead of thousands

#

Oh waot

#

Is that on message I see

#

Nvm

quartz kindle
#

@sick cloud long the entire db.table to make sure the reminders are there

sick cloud
#

they are

quartz kindle
#

then log each step to see until where they are being moved correctly

sick cloud
#

yeah

#

gonna try that now

#

so the reminders are there

#

but only one is given

earnest phoenix
#

sa

sick cloud
#

@quartz kindle ^^

floral stone
#

Why is there a list inside of a list?

#

@sick cloud

sick cloud
#

idk really

#

thats how its coming out

quartz kindle
#

this doesnt look right reminders.forEach(reminder => { let r = reminder[reminders.indexOf(reminder)]; console.log(r); });

#

try logging reminder

#

instead of reminder[indexof]

sick cloud
#

okay

floral stone
#

Ah, yeah. My database data comes out as a list aswell. I always return the first item if the list length is one.

sick cloud
#

woo ok that fixed it

#

cheers

spring ember
#

for of GWqlabsHyperRage

sick cloud
#

weird question but how do i actually compare the times?

#

i have setAt which is a date of when the reminder was created, and remindAt which is how long to wait before reminding the user in ms

#

but idk what to do xD

floral stone
#

What langauge do you use? @sick cloud

sick cloud
#

node.js / discord.js

floral stone
#

Ah, then you are ouy luck from me atleast.

sick cloud
#

okay

quartz kindle
#

if current timestamp - saved timestamp > target timeframe

granite hedge
#

Question so a bot can't bulkdelete his own messages on this server? why is that?

#

I have seen people clean up the commands of there bot, I want to achieve this too, but for some reason it's not working in this server due to missing permissions

#

it works on another server

floral stone
#

"missing permissions"

#

Are you sure you are not deleting other people messages!?

granite hedge
#
msg.channel.fetchMessages({
            limit: 100
        }).then(messages => {
            var messagearray = messages.filterArray(m => m.author.id === bot.user.id)
            msg.channel.bulkDelete(
                messagearray
            ).then(m => {
                msg.channel.send({
                    embed: {
                        color: 0x20B2AA
                        , title: `Successfully cleaned up ${m.length} messages from ${bot.user.name}`
                        , timestamp: new Date
                        , footer: {
                            icon_url: bot.user.avatarURL
                            , text: `Replying to ${msg.author.tag}`
                        }
                    }
                })
            }).catch(e => {});
        })
quartz kindle
#

which permission is missing?

granite hedge
#

doesn't say

quartz kindle
#

if its missing manage messages, then its not seeing the messages as its own

granite hedge
#

no perm for bulk-delete

#

I filter it so it's only the bots messages so it can only be the messages of the bot

quartz kindle
#

the error doesnt specify which permissions are missing, you have to check them yourself

granite hedge
#

how?

quartz kindle
#

try to disable manage messages permission in your server

#

and see if it errors

granite hedge
#

sure

#

yeah no perm, but I can't see why it would do that, I filter all messages and only allow messages from the bot to be kept

#

var messagearray = messages.filterArray(m => m.author.id === bot.user.id)

quartz kindle
#

there is a specific way to do it, if you just scan for messages it doesnt work

granite hedge
#

have any link to a guide?

#

for discord.js

quartz kindle
#

i think you need the message object

#

so instead of bulkdelete, you have to loop over each message and delete one by one i think

granite hedge
#

I had that before but they said it wsn't good xd

quartz kindle
#

i dont know then, my bot doesnt have that feature

#

it only deletes his temporary message when processing a command

granite hedge
#

it works when looping over it, I guess will use that for now

quartz kindle
#

you can check for permissions and then use bulk if you have them, and loop if you dont

#

best of both worlds xD

earnest phoenix
#

Requirements
Required:

Node.js 0.10.x or greater
Web Browser if not using Node.js
Optional:

Audio
Node.js 0.12.x
ffmpeg/avconv (needs to be added to PATH)
Documentation / Gitbooks
Getting Started:
Installing
Stable npm install discord.io

Latest npm install izy521/discord.io

Example
var Discord = require('discord.io');

var bot = new Discord.Client({
token: "",
autorun: true
});

bot.on('ready', function() {
console.log('Logged in as %s - %s\n', bot.username, bot.id);
});

bot.on('message', function(user, userID, channelID, message, event) {
if (message === "ping") {
bot.sendMessage({
to: channelID,
message: "pong"
});
}
});

gusty topaz
earnest phoenix
#

....

tame obsidian
#

discord.js >

earnest phoenix
#

About
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily.

Object-oriented
Predictable abstractions
Performant
100% coverage of the Discord API
Installation
Node.js 8.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies, as they're all optional.

Without voice support: npm install discord.js
With voice support (node-opus): npm install discord.js node-opus
With voice support (opusscript): npm install discord.js opusscript

Audio engines
The preferred audio engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus. Using opusscript is only recommended for development environments where node-opus is tough to get working. For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.

Optional packages
zlib-sync for significantly faster WebSocket data inflation (npm install zlib-sync)
erlpack for significantly faster WebSocket data (de)serialisation (npm install discordapp/erlpack)
One of the following packages can be installed for faster voice packet encryption and decryption:
sodium (npm install sodium)
libsodium.js (npm install libsodium-wrappers)
uws for a much faster WebSocket connection (npm install uws)
bufferutil for a much faster WebSocket connection when not using uws (npm install bufferutil)
Example usage
const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});

client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('pong');
}
});

client.login('token');

quartz kindle
#

code block please

neat falcon
#

^

knotty steeple
#

thats literally the description on the website

#

he is just copy pasting it

earnest phoenix
#

yeah github

neat falcon
high lava
#

When you guys debug a bot while it's online, what do you normally do?

topaz fjord
#

i dont

#

well

high lava
#

ATM. I'm making the actual Server go offline and then hosting the Bot on my PC for the time I'm doing it

#

Well, what do you do then?

topaz fjord
#

wait for something bad to happen

#

then fix it

prime cliff
#

I have 2 modes in my bot live and testing in testing mode the bot adds t to the prefix :/ so it dosent mess with the other bot

high lava
#

That's a good idea

#

I'm just worried about it going offline while people are using it

#

Well, whatever. I was just adding the server count so it's not that bad

halcyon abyss
#

just have another client/token and have each one on a different channel

high lava
#

Yeah. I'm just gonna make a copy of the bot, one for testing and one live one

#

Then just update the repository when the testing version isn't broken

#

Wait a second. nvm. there's an easier way, if I only I read what you said first. lol

lament rock
#

Using jimp and I'm trying to send a buffer but I'm having slight difficulty.
Code:

canvas.getBuffer(Canvas.MIME_PNG, buffer => {
    var attach = new Discord.Attachment(buffer, "slot");
    msg.channel.send({files: [attach]});
});

Error:

C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\discord.js\src\client\ClientDataResolver.js:274
    } else if (resource.pipe && typeof resource.pipe === 'function') {
                        ^

TypeError: Cannot read property 'pipe' of null
    at ClientDataResolver.resolveFile (C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\discord.js\src\client\ClientDataResolver.js:274:25)
    at Promise.all.options.files.map.file (C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:154:30)
    at Array.map (<anonymous>)
    at TextChannel.send (C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:153:40)
    at Jimp.canvas.getBuffer.buffer (C:\Users\Brad.INFINITE\Documents\GitHub\amanda\plugins\gambling.js:65:19)
    at C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\jimp\index.js:2255:27
    at C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\stream-to\index.js:39:7
    at exports.PNG.onEnd (C:\Users\Brad.INFINITE\Documents\GitHub\amanda\node_modules\stream-to\index.js:18:5)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
#

Discord.js

knotty steeple
#

something to do with d.js?

#

idk i dont canvas or jimp

lament rock
#

Canvas died so, I'm moving to jimp

knotty steeple
#

well from the error stack thats what it looks like

#

something to do with discord.js

lament rock
#

Yeah but it may just me not providing a proper attachment or something

knotty steeple
fluid basin
#

tbh you should be using canvas lol

#

xD

lament rock
#

Like I said, Canvas is dead'

#

I used to use it and now I cant

fluid basin
#

hmm why not

lament rock
#

One of the deps doesn't build properly

#

if cache gets cleared and you try and build it then run, it'll throw Canvas.createCanvas is not a constructor even though it is

#

or however you make a canvas

fluid basin
#

yeah it is not a constructor

#

according to the docs

lament rock
#

Yes. It is a constructor. I used it and it worked

fluid basin
#

you make a new canvas like this let canvas = new Canvas(width, height);

lament rock
#

I'm now using jimp

#

I just named my jimp const as Canvas

fluid basin
#

well probably you are using the old api

lament rock
#

nope

#

looking at Jimp's npm docs

#

my issue is getting a buffer to send EEER

fluid basin
lament rock
#

one sec

#

let me check what it really is

#
let canvas = new Canvas.createCanvas(553, 552);
let ctx = canvas.getContext("2d");
#

That's what I used to use and that has worked

#

So

fluid basin
#

Yeah I am saying it has been changed to let canvas = new Canvas(553, 552);

#

Try that and it will work

lament rock
#

ok. Then that leaves me to another issue

high lava
#

^ can confirm

lament rock
#

Heroku doesnt build canvas

knotty steeple
#

you host on heroku?

fluid basin
#

use prebuilt then

lament rock
#

and there are no buildpacks that I could find that support heroku18

#

well. Let's try that, then

fluid basin
#

Meant to be able to run on Travis and AppVeyor so I am assuming it'll work on heroku as well

lament rock
#

It does build this, yes

fluid basin
#

yeah you can use this then, its basically the precompiled canvas

lament rock
#

ok

fluid basin
#

Anyways, for your previous jimp issue, it was something wrong with your code on the message send part

#
msg.channel.send({files: [attach]});
#

message.channel.send takes first argument as the message content and the second one as attachments/embeds/files etc

#

so it has to be this

#
msg.channel.send('', {files: [attach]});
#

@lament rock

lament rock
#

It works

#

The Canvas prebuilt

fluid basin
#

yup

lament rock
#

Thank you

fluid basin
#

Np

jovial sigil
#

Can someone point me to a guide or tutorial for updating my bot's server count with discord js?

knotty steeple
quartz kindle
#

literally just install dblapi and copy paste the first 2 lines of code

fluid basin
#

You should use the official library on the discordbots api docs

knotty steeple
#

pls

shy verge
fluid basin
#

docs > all

vestal cradle
#

Awe is there a way to get every guilds name that the bot is in?

#

(javascript)

quartz kindle
#

yes

fluid basin
#

Yeah, just loop through all the guilds and get the names

vestal cradle
#

Anyyyy help?

quartz kindle
#

client.guilds.map()

vestal cradle
#

hmm

jovial sigil
#

Thank you guys!

earnest phoenix
jovial sigil
#

awesome i was able to get my server count posted!

knotty steeple
#

@earnest phoenix missing )

#

close to {

jovial sigil
#

ah yes

#

if (dbl.hasVoted(id)) {

earnest phoenix
#

Now I have a log error

#
SyntaxError: Unexpected token )

    at createScript (vm.js:74:10)

    at Object.runInThisContext (vm.js:116:10)

    at Module._compile (module.js:537:28)

    at Object.Module._extensions..js (module.js:584:10)

    at Module.load (module.js:507:32)

    at tryModuleLoad (module.js:470:12)

    at Function.Module._load (module.js:462:3)

    at Function.Module.runMain (module.js:609:10)

    at startup (bootstrap_node.js:158:16)

    at bootstrap_node.js:598:3
knotty steeple
#

what do you have

quartz kindle
#

just as it says, you have a wrong ) somewhere

#

try to find it

earnest phoenix
quartz kindle
#

can you find it by yourself?

earnest phoenix
#

I did.

knotty steeple
#

ok

earnest phoenix
#

It's the closing });

knotty steeple
#

sendMessage is depreciated

earnest phoenix
#

Just send?

quartz kindle
#

yeah

knotty steeple
#

yes

earnest phoenix
#

K I did that

#

Still getting errors.

knotty steeple
#

also

#

you should be able to debug code yourself

jovial sigil
earnest phoenix
#

Ok I see

#

So I move the )?

jovial sigil
#

not up to us

earnest phoenix
#

I made this bot with almost no knowledge.

jovial sigil
#

XD

earnest phoenix
#

Β―_(ツ)_/Β―

quartz kindle
#

knowledge will come as long as you try

earnest phoenix
#

I wish this was lua.

quartz kindle
#

try to find where the parenthesis and the brackets are not closing properly

earnest phoenix
#

I like lua

knotty steeple
#

then code lua

earnest phoenix
#

You can code a discord bot in lua?

knotty steeple
#

yes

jovial sigil
#

i believe there's discordlua

knotty steeple
#

discordia library

quartz kindle
shy verge
#

or use a good editor that autoinserts a closing bracket with each open bracket

knotty steeple
#

he is using glitch

#

iirc

shy verge
#

banned

earnest phoenix
#

What are you talking about...

#

I'm not using gliiiitch

#

πŸ˜‚

knotty steeple
#

ok what are u using

earnest phoenix
#

Gliiiiiitch

shy verge
quartz kindle
#

@_@

knotty steeple
#

smh

earnest phoenix
#

Β―_(ツ)_/Β―

jovial sigil
#

what's glitch?

shy verge
#

a bad hosting service

knotty steeple
#

for bots*

earnest phoenix
#

Better than horiku

knotty steeple
#

its not bad for express apps

shy verge
#

ew sepuuku

jovial sigil
#

what's bad about it?

earnest phoenix
#

So is there no way to fix this if i'm using glitch?

quartz kindle
#

that has nothing to do with fixing lol

earnest phoenix
#

oof

knotty steeple
#

you are just missing a }

quartz kindle
#

^

jovial sigil
#

ye

shy verge
#

i give free hosting to tiny bots for the luls

quartz kindle
#

o nice

earnest phoenix
#

Now I have unexpected end of input or whatever

knotty steeple
#

kek

shy verge
#

use a real editor

#

not glitch editor

earnest phoenix
#
SyntaxError: Unexpected end of input

    at createScript (vm.js:74:10)

    at Object.runInThisContext (vm.js:116:10)

    at Module._compile (module.js:537:28)

    at Object.Module._extensions..js (module.js:584:10)

    at Module.load (module.js:507:32)

    at tryModuleLoad (module.js:470:12)

    at Function.Module._load (module.js:462:3)

    at Function.Module.runMain (module.js:609:10)

    at startup (bootstrap_node.js:158:16)

    at bootstrap_node.js:598:3
knotty steeple
#

ok here is what to do

#

code your bot in a proper code editor

#

then copy paste that code into glitch

quartz kindle
#

nice rules

#

i delete your shit

earnest phoenix
#

but i'm on reeeeeing chromebook ;-;

knotty steeple
#

cant you download vscode on a chromebook

earnest phoenix
#

Idk

#

It doesn't have windows

shy verge
#

what distro does chrome os run on

quartz kindle
#

google os

#

i think

earnest phoenix
#

chrome os

quartz kindle
#

^

shy verge
#

πŸ‘

knotty steeple
#

google os?

quartz kindle
#

o wait

knotty steeple
#

well rip vscode

quartz kindle
#

i misread

earnest phoenix
#

chrome os runs on a crappy linux

#

that doesn't run anything

shy verge
#

so you know how Ubuntu is built on Debian and fedora is built on redhat

#

what is chromeos built on

earnest phoenix
#

Idk

quartz kindle
#

chrome os is literally built on top of chromium framework

earnest phoenix
#
Chrome OS. Chrome OS is an operating system designed by Google that is based on the Linux kernel and uses the Google Chrome web browser as its principal user interface. As a result, Chrome OS primarily supports web applications.
quartz kindle
#

like, google chrome is in itself a sandbox operating system

jovial sigil
#

wiki says linux kernel

quartz kindle
#

or almost one

shy verge
#

does chrome os have a package manager

earnest phoenix
#

nvm

shy verge
#

latest chrome os can run linux apps

earnest phoenix
#

chrome os can get vscode

quartz kindle
#

can it?

shy verge
#

yes

quartz kindle
#

o nice

earnest phoenix
shy verge
#

time 2 powerwash

earnest phoenix
#

How the hell is wget not found

shy verge
#

try using curl

earnest phoenix
#

kk thanks

shy verge
#

and if there's a package manager then do something like apt install wget or something

earnest phoenix
#

Stupid chrome os

shy verge
#

-o not -0

earnest phoenix
#

Thanks πŸ˜„

#

I'm not installing ubuntu

shy verge
#

you sure it's not an emulator?

#

like bash on Ubuntu on windows

earnest phoenix
#

Nope

shy verge
#

huh

earnest phoenix
#

How do I run it anyway?

#

If I do have it?

shy verge
#

code methinks

#

so like code i-fucking-hate.js

earnest phoenix
#

lol

#

I mean I do have xfce

#

Should I run the code on that?

shy verge
#

idk

earnest phoenix
#

oof

fluid basin
#

done installing?

earnest phoenix
#

yes

#

Now I have loads of problems

quartz kindle
#

lmao

earnest phoenix
#

The whole thing is covered in problems

quartz kindle
#

99 missing dependencies in linux, 99 missing dependencies in linux. apt-get one down, install it around. 137 missing dependencies in linux

earnest phoenix
#

lol

sick cloud
#

how do you get the latest commits off a github repo?

earnest phoenix
#

idk

shy verge
#

pull?

earnest phoenix
#

id not defined.

prime cliff
#

Because you need to input a user id ofc Thonk

earnest phoenix
#

?

#

What

#

I can't just put a random users id in...

quartz kindle
#

who do you want to check if he has voted?

#

if its the person using the command, then you have to get their id and put it there

earnest phoenix
#

What I want is a voter-exclusive command

quartz kindle
#

then thats what you have to do

earnest phoenix
#

How do I get the id of the user that has voted?

quartz kindle
#
  1. user types in command
  2. bot gets command
  3. bot checks user id
  4. bot checks if used id has voted
  5. result if yes or if no
earnest phoenix
#

welp

#

idk how to do that

#

so oof