#development

1 messages Β· Page 437 of 1

restive silo
#

that might be it

granite hedge
#

really? ugh

#

I wanted to make a system for selfassign roles

restive silo
#

you use the reaction thing from discordjs.guide right?

granite hedge
#

this yes

restive silo
#

which d.js version do you use

#

stable or master

granite hedge
#

stable

restive silo
#

okay so

waxen quest
#

Can anyone help me with how to edit bot's message after X seconds, please?

restive silo
#

what happens is that you try to get the reaction what was removed already so your const reaction = message.reactions.get(emojiKey); returns undefined

#

thats why your emitted event also throws that error

granite hedge
#

@waxen quest I can if it's in js

waxen quest
#

It is

inner jewel
#

use setTimeout

granite hedge
#

^^

waxen quest
#

That didn't work for me

#

For some reason

granite hedge
#

in a .then(

waxen quest
#

ah

#

1s

granite hedge
#

Would there be a fix to the reaction thing?

restive silo
#

remove the messageReactionRemove i guess

#

in the raw event

granite hedge
#

but then it won't work for uncached messages no?

restive silo
#

read this up

granite hedge
#

sure thanks for your help

restive silo
#

they explained it there

fervent oyster
#

I got my discord bot to update server count on the website on ready, guildCreate, and guildDelete

deep inlet
#

Hmm

#

That's unecessary

#

There's a thing that updates it automatically

#

const dbl = new DBL('Your discordbots.org token', client);

#

That will update it automatically periodically

ocean vale
#

does anyone know why it says invaild syntax when i try to run my discord bot because every time i add a new command it would invaild syntax and show a red line on client

quiet bobcat
#

you forgot to close a bracket

ocean vale
#

?

quiet bobcat
#

you forgot to close a bracket

ocean vale
#

idk how to close a bracket

quiet bobcat
#

( unclosed bracket () closed bracket

ocean vale
#

k

gilded blaze
#

LOL

#

WTF

#

HE DIDNT MEAN LITERALLY

#

For each bracket you open there needs to be one to close it

ocean vale
#

k

gilded blaze
#

Or else the program assumes everything after is in the brackets

ocean vale
#

im not really a "good"developer so idk how

latent copper
#

Look up the basics of the language you're trying to use (Python in this case), it will come in very handy! I mean if you don't know how to close a bracket then how are you possibly gonna help if someone needs help with your bot not working or if there's a bug that needs fixing? Keep at it though, the more you do the more you'll remember and learn along the way! πŸ˜ƒ

keen drift
#

@earnest phoenix Alright I think I have it done

#

gives you the gist

vale gull
#

how to make this so it sends the xp in the channel and not in the console?

    let taget = message.mentions.users.first() || message.guild.members.get(args[1]) || message.author;

    con.query(`SELECT * FROM xp WHERE id = '${target.id}'`, (err, rows) => {
        if(err) throw err;

        let xp = rows[0].xp;
        message.channel.send(xp);
    });
}

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

what doesnt work? is there an error?

high lava
#

I'm trying to shard starting with 2 spawns, but the Debug console keeps outputting

#

It looks like it also keep restarting shards, but they wont stay on for more than half a second

quartz kindle
#

try without the inspector

#

sharding starts a separate node process, which cant be attached to the same debugger address

high lava
#

So I actually have to run it?

quartz kindle
#

either without the inspector, or configure the inspector to use a different port

high lava
#

Thanks. That fixed it. I thought it was just a wrong line or something

#

Even though it was literally three lines of code

vale gull
#
    let now = Date.now();
    let timeLimit = 2000;```
error:  (node:392444) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
quartz kindle
#

are you using discord.js?

#

i cant find any ratelimits in their docs

#

master has a rateLimit, but its a different thing

earnest phoenix
#

yes

topaz fjord
#

bot.ratelimits isnt a thing

sick cloud
#

@topaz fjord it could be a custom variable.

topaz fjord
#

then .ratelimits doesnt have the method .get

sick cloud
#

like bot.ratelimits = new Discord.Collection(); or something

#

collections have .get() right?

topaz fjord
#

yes

#

but i dont think you can get that error by having a collection

quartz kindle
#

but in his case, it doesnt have a get()

sick cloud
#

ohk

heady zinc
#

no in his case ratelimits is undefined

#

that's the issue

quartz kindle
#

which in turn makes it not have a get()

#

xD

#

but yeah you're right

heady zinc
#

but the real issue is that they just posted some code and an error without context

#

helpful af

quartz kindle
#

and then they're gone

granite hedge
#

spam account?

quartz kindle
#

no i mean, post a question then go god knows where

granite hedge
#

ping them

quartz kindle
#

what if they have a baby sleeping?

#

i dont wanna wake it up

granite hedge
#

lol, maybe they are the baby

#

can programmers even get babies

quartz kindle
#

can babies ask questions about programming on discord?

granite hedge
#

maybe

#

depends if they are born smart haha

quartz kindle
#

or an alien

grizzled totem
#

how do i make my help command split into categories? it just lists them all in one bunched up list right now

quartz kindle
#

there are many ways to do it

#

for example you can split it into different categories yourself, and have a command argument for each of them

#

like help 1 help 2 etc

#

or name them

grizzled totem
#

i'd just like fields

quartz kindle
#

make help and index, and help name the actual thing

grizzled totem
#

like General, Moderation, etc

#

sounds complicated though, and it wouldn't work since if you give my help command an arg it'll show command information

quartz kindle
#

to split it into different fields in the same message, you can use this to help you design it

grizzled totem
#

well

#

i know how to add fields

#
const { RichEmbed, version } = require('discord.js');

module.exports = {
    name: 'help',
    description: 'Lists all the bots commands, and can optionally provide in-depth information on a specific command or module.',
    usage: '',
    aliases: ['h'],

    execute: async (msg, args) => {
        const help = new RichEmbed()
        .setColor('#7289DA')
        .setTitle('Listing ' + client.commands.size + ' commands:')
        .setDescription(`Start any commands listed below with \`!\` to use the command, or optionally add a command name on the end of the help command to get information on a command. If you need any help, [click here](<removed>). \n\n${client.commands.map(command => `\`${command.name}\``).join(', ')}`)
        .setFooter(`running discord.js v${version}-stable`)
        msg.channel.send({ embed: help });
    }
}

thats my commands code

#

it basically maps the commands, but it won't sort

quartz kindle
#

if you want everything in the same message, use fields

#

if you want it split over different messages, then you have to add arguments

grizzled totem
#

um

#

you don't understand my question

#

i want to use fields, but i don't know how to adapt my dynamic help command so it sorts the commands into the correct field/category @quartz kindle

quartz kindle
#

instead of this ${client.commands.map(command => `${command.name}`).join(', ')}

#

use a logic that sorts them and puts them into fields, instead of description

#

or write them yourself manually

grizzled totem
#

so maybe add a .filter before .map?

quartz kindle
#

you can add a filter, if it fits your needs

grizzled totem
#
 .addField('General', `${client.commands.filter(command => command.category === 'General').map(command => `\`${command.name}\``).join(', ')}`, true)```
would this work?
#

yeah

quartz kindle
#

yeah test it out

grizzled totem
#

okay

#

thanks for the help

quartz kindle
#

nice

rugged pond
#

^^

grizzled totem
#

and what database do people recommend?

#

i need one for cases

sick cloud
#

Rethink all the way :^)

quartz kindle
#

is rethink really that good?

grizzled totem
#

i know of rethink, its alright

#

unsure if it'd be good for a bot though that might grow

#

i don't want to touch sql or anything

inner jewel
#

rethink? @ amy

quartz kindle
#

im using json lul

#

but my bot is not big

#

what about leveldb?

#

doesnt work with shards tho

grizzled totem
#

never heard of it

quartz kindle
#

levelb was developed by google enginners

#

but its like a very optimized flat file db, not an actual rmdb

#

can only have one connection/process at a time

grizzled totem
#

doesn't really sound good for a mod bot

quartz kindle
#

its more than enough

#

any db is probably more than enough for a discord bot

#

these things are designed to support millions of transactions, discord bots are nothing for them

grizzled totem
#

connections though is small

#

like if there are lots of actions happening it can make the bot hang right?

quartz kindle
#

only if you're a bad coder

grizzled totem
#

which i probably am πŸ˜›

quartz kindle
#

if you do things right and use non-blocking calls, it wont hang

#

or put everything into memory, unless you need to cache big things like images

#

for example, my commands only save to db, never load from it

#

everything is loaded into memory at once when the bot starts

keen drift
#

rethinkdb GWfroggyJerry

#

might as well go with microsoft iis by that point

quartz kindle
#

so whats your db choice fishy?

keen drift
#

mongodb

quartz kindle
#

a very popular one indeed, i havent tried it yet

keen drift
#

high availability cluster makes it my favorite

grizzled totem
#

is it easy to use?

#

i kind of want the ease side, like database.get(msg.author.id)

keen drift
#

eh sorta?

#

I use an ORM

#

This is an example query:

#
[ err, result ] = await to(
        ReactRole.find({
            guild: target.guild.id,
            channel: target.channel.id,
            msg: target.id,
            emoji: {
                $in: target.reactions.map(v => {
                    return v.emoji.id ? `${v.emoji.name}:${v.emoji.id}` : v.emoji.name
                })
            }
        })
    );
quartz kindle
#

the easiest would be to use enmaps

#

as a wrapper

grizzled totem
#

i know of enmaps, unsure though since people called it a beginners database

quartz kindle
#

its simply a wrapper that does the connection for you. you can still chose which db you want to have behind it

grizzled totem
#

ah

#

would sqlite be a good choice? since i see it allows rethinkdb too but um, i dunno

quartz kindle
#

the difference is that enmaps automatically saves whenever you do .set()

keen drift
#

sqlite is just local sql πŸ˜›

#

I'd say good for testing

grizzled totem
#

hm

#

i'll think about it anyways.. and can you guys help me with my aliases? they don't work

floral stone
#

I use mysql for my bot

grizzled totem
#

the command works there but the aliases don't

keen drift
#

what framework is this

grizzled totem
#

discord.js

keen drift
#

And the command framework?

grizzled totem
#

i'm not sure what you mean

keen drift
#

Discord.js doesn't provide frameworking for commands

grizzled totem
#

i made my own

keen drift
#

then you should know how to use it?

grizzled totem
#

well it should work honestly

#

but i don't know why aliases don't work and i'm asking for help to fix them

#

i'm new to making bots

earnest phoenix
#

@keen drift Did you make the command?

grizzled totem
#

so no one wants to help?

earnest phoenix
#

whats wrong?

grizzled totem
#

read up

keen drift
#

you need to provide code for us to help

grizzled totem
#

what code?

#

like, the message event?

keen drift
#

where is the module being imported at

grizzled totem
#

uhh messageHandler.js i think

#

thats the message event and loads commands

keen drift
#

Can we see it?

grizzled totem
keen drift
#

can I see your package.json

grizzled totem
#

i don't have one

keen drift
#

package-lock?

grizzled totem
#

nope

keen drift
#

What do you use to import dependencies?

grizzled totem
#
commands/
    help.js
    avatar.js
files/
    config.js
messageHandler.js
app.js
logo.png

thats my file structure, and i import dependencies per-file

#

like when needed

keen drift
#

Import dependencies, as in your dependency manager

grizzled totem
#

ohhhh

#

npm

#

i think

keen drift
#

you don't have a package-lock.json?

earnest phoenix
#

@keen drift Sup

grizzled totem
#

nope

keen drift
#

the fuck

#

Did you deleted the lock file or some shit

earnest phoenix
#

Fishy a bots saying you’re swearing...

grizzled totem
#

there was never a lock file

keen drift
#

npm install discord.js --save does not generate any lock?

grizzled totem
#

i ran npm i discord.js

#

so i don't know if it does or not

keen drift
#

i is install

grizzled totem
#

i know, its shorthand

#

but i didn't add the --save flag

keen drift
#

idk how you work with js projects with a dependency manager without a lock file

#

What other dependencies did you pull via npm

grizzled totem
#

why is this related to my handler though? and none really

#

all i've used is discord.js

keen drift
#

Because client.commands does not exist within discord.js

grizzled totem
#

it does?

keen drift
grizzled totem
#

client.commands = new Discord.Collection();

#

i define it myself

#
const client = new Discord.Client({ disableEveryone: true });
global.client = client;
client.commands = new Discord.Collection();
keen drift
#

well that explains it

#

full context helps

#

What's the controller for registering it?

grizzled totem
#

in app.js:

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
    try {
        const command = require(`./commands/${file}`);

        client.commands.set(command.name, command);
        console.log(`+ ${command.category.toLowerCase()}/${command.name} loaded`);
    } catch(err) {
        console.log(`- a command failed while loading: \n${err.stack}`);
    }
}
keen drift
#

.has looks for map key name

#

if h is an alias, you should be using .find

#

It's returned here if (!client.commands.has(commandName)) return;

grizzled totem
#

well that isn't where aliases are triggered

keen drift
#

where is alias triggered

grizzled totem
#

this is where, in messageHandler.js:

const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
keen drift
#

But can it proceed to that if the previous statement returns?

grizzled totem
#

umm, i think so?

keen drift
#

...?

#

So you are saying if (!client.commands.has(commandName)) return; returns and it will still proceed?

grizzled totem
#

ohhh that

#

it might be returning

keen drift
#

it should be returning

grizzled totem
#

should i remove it and try that?

keen drift
#

yeah

grizzled totem
#

alright

#

thats fixed it

#

thanks

keen drift
#

no problem

#

you should prob fix your package manager

#

while you at it

grizzled totem
#

i will

#

i think i just need to make a package file

keen drift
#

the manager should've made one

#

that's the default behaviour

grizzled totem
#

well it didn't

keen drift
#

Β―_(ツ)_/Β―

grizzled totem
#

there

#

now it has a package and lock

keen drift
high lava
#

how do I take the logs from console.log and make them appear as a message?

#

I don't want to have to look at my log for every little thing

keen drift
#

point it at a channel

#

and send as a message

high lava
#

Oh

#

They WERE pointers

keen drift
#

w h a t

grizzled totem
#

instead of console.log(content) use <message>.channel.send(content)?

high lava
#

I saw the => but I was like "there's no way that's a pointer"

keen drift
#

=>?

high lava
#

That's not how the command I'm using works

keen drift
#

that's the es5+ way of func decl

high lava
#

I'm thinking WAY too much C++ rn

keen drift
#

for me pointers are *

#

in golang

high lava
#

I didn't mean like legit coding C++. The program I use to find pointers before using them in C++, ReClass, it refers to Pointers using =>

#

I've been using it so long that everytime I see that I automatically see "pointer"

floral stone
#
    async def wait(self, user, channel, timeout=120, keywords=None):
        def check(m):
            if keywords is None:
                return m.channel == channel and m.author == user
            else:
                return m.channel == channel and m.author == user and  m.content.lower() in keywords

        try:
            resp = await self.bot.wait_for('message', check=check, timeout=timeout)
        except asyncio.TimeoutError:
            return False

        return resp.content
``` I feel like this makes it easier
#
                return m.channel == channel and m.author == user if 
            else:
                return m.channel == channel and m.author == user and m.content.lower() in keywords #keywords needs to be a list```
#

Is there anyway I can do that without using the if and else statement?

#

Like possibly doing it on the return line

#

I doubt it but maybe

keen drift
#

fuck I gotta refresh my python memory

floral stone
#

I know a one line if statement but it doesn't work in this situtation

keen drift
#

return m.channel == channel and m.author == user and (keyword is not None or m.contentlower() in keywords)

#

i think that works

floral stone
#

That may work

high lava
#

Ok. Fishy. This is what I'm working with right now

try {
            const code = args.join(' ');
            let evaled = eval(code);

            if (typeof evaled !== 'string') {evaled = require('util').inspect(evaled);}

            message.channel.send(clean(evaled), { code:'xl' });
        }
        catch (err) {
            message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
        }
#

My only issue is that this seems to only send values that are strings. So Im wondering if just getting rid of the 4th line all together would work or completely break this

floral stone
#

It worked @keen drift but I had to chnage some of it. I forgot you could use () xD

#
        def check(m):
            return m.channel == channel and m.author == user and (keywords is None or m.content.lower() in keywords)

        try:
            resp = await self.bot.wait_for('message', check=check, timeout=timeout)
        except asyncio.TimeoutError:
            return False

        if keywords is None:
            return resp.content
        return True
keen drift
#

@high lava You can stringify it

compact lichen
#

async def wait(self, user, channel, keywords=None, timeout=120):
def check(m):
return m.channel == channel and m.author == user and (keywords is None or m.content.lower() in keywords)

    try:
        resp = await self.bot.wait_for('message', check=check, timeout=timeout)
    except asyncio.TimeoutError:
        return False

    if keywords is None:
        return resp.content
    return True
keen drift
#

what even changed

grizzled totem
#

modlog does exist 😦

keen drift
#

what are you using to find the channel

grizzled totem
#

uh?

#

its clearly there

high lava
#

It doesn't matter what I stringify. I still get ```javascript
Promise { <pending> }

#

Even with the default stringifying from utils.inspect with the added stringifying on the results, it only returns an array in the console. not the message

earnest phoenix
#

How would I even start using MySQL with DiscordJS/Node

keen drift
#

@grizzled totem I think you have to pass a channel object

#

So you have to search the collection

grizzled totem
#

huh?? its set as null since thats the default

#

but the db thinks it doesn't exist

keen drift
#

@high lava Because that's a promise, you have to await the result

#

oh null doesn't exist?

high lava
#

Christtttt

#

Ok. Thanks

keen drift
#

null does not exist though

grizzled totem
#

oh?

#

so

keen drift
#

that's how db interprets null

grizzled totem
#

what do i have to set it as, undefined maybe?

keen drift
#

if you want an empty value, pass an empty string

grizzled totem
#

can i set it as undefined?

keen drift
#

i think it's still null in db

grizzled totem
#

i'll try it

#

@keen drift i set it as a string and it still says it doesn't exist

keen drift
#

what are you checking it with

grizzled totem
#

if (!guild.modlog) return msg.reply('that config value doesn\'t exist.');

#

i console log'd modlog and it gave me 'disabled' which is the string i set it as

keen drift
#

and it still says the value doesn't exist?

#

for guild.modlog?

grizzled totem
#

well i fixed it now

#

turns out there was a typo

keen drift
high lava
#

You know what. I'm a grade A retard

#

It wasn't the code in the bot that was wrong, it was the code I was trying to eval

topaz fjord
#

lmao

high lava
#

I swear to god. I spend so much time trying to fix stupid mistakes like this

keen drift
#

yeah

#

what you think I said

#

lmao

night imp
#

πŸ€” Anyone use wakatime? Dashboard is showing stats but profile + leaderboard ain't. Does it take a day to update?

#

^new user btw, may be part of it

quartz kindle
#

quick question: how to remove own reactions? like .send().then(msg.react()).then(remove reaction) ? something like that

night imp
#

d.js?

quartz kindle
#

ye

#

im adding a reaction collector on a message for an hour, i want to remove the reactions (bots own reactions, not other peoples) after the reaction collector ends

night imp
#

πŸ€” seems you want <messageReaction>.remove(user)

#

replacing user with the client

quartz kindle
#

does that work without manage messages permission?

night imp
#

Well, default is the client so I assume that it would, I haven't personally tried it myself

languid dragon
#

Msg.react().then(reaction => reaction.delete())

#

Or at least handle something with "reaction"

night imp
#

I don't think there is a delete thonkku let me see

keen drift
#

there's a remove

night imp
#

yeah what cosmo said but with remove()

keen drift
#

but you cannot do reaction.remove() directly

#

it requires an userid

night imp
#

default being the client

keen drift
#

oh yeah it has default

night imp
#

so in your case <message>.reactions.remove() or <reaction>.remove()

quartz kindle
#

alright, i'll give it a try

#

thanks!

night imp
#

inb4 anyone know about wakatime

languid dragon
#

@quartz kindle do you read the documentation

quartz kindle
#

yeah i just did

languid dragon
#

Before asking?

keen drift
#

@night imp Yeah I think it's cached

quartz kindle
#

yes i did, the reason i asked is because i tried it before and it didnt work

#

but i dont recall exactly how did i try it

night imp
#

@keen drift ok I'll wait a day and see if it updates

languid dragon
#

Well i dont think its so much the methods you are worried about just your code logic tbh

night imp
#

wait let me try the api

quartz kindle
#

i figured id try again

night imp
#

nvm bot is bad

quartz kindle
#

i just asked to confirm the methods are correct

high lava
#
        if(message.author.id === `${botID}`) {
            
            message.delete();

        }
#

This doesn't seem to work at all

#
    if (message.content.startsWith('\'nou') || message.content.startsWith('\'help') || message.content.startsWith('\'thot') || message.content.startsWith('\'copy')) {
        message.delete();
    }

I assumed it would work the same way as this. This works perfectly at the moment. The bot just won't delete its own messages

languid dragon
#

Show more code

#

What do you have before the if statements

high lava
#

This is the entire command

    if (message.content.startsWith(`${prefix}` + 'clear')) {
        if(message.author.id !== `${ownerID}`) return;

        if(message.author.id === `${botID}`) {
            
            message.delete();

        }

    }
languid dragon
#

Thats not the entire code

#

What is botID

#

What is ownerID

mental solstice
high lava
#

The ID number of my bot, and the ownerID is my ID

mental solstice
#

Do u need have .then and .catch

languid dragon
#

And are you ignoring bot users

high lava
#

Yes. right after Client.on()

    if (!message.content.startsWith(prefix) || message.author.bot) return;
languid dragon
#

Thats why your bots messages wont get deleted

#

Because its ignoring them

high lava
#

I didn't realize that would have an effect on deletion. thanks

languid dragon
#

Well the thing is
Any message any bot sends is instantly ignored and the entire code returns/stops at that point

#

So there is no way for your message.delete method to run

high lava
#

Or anything else related to messages that were made by a bot

grizzled totem
#

the underlined bit (reason) is empty no matter what and then the command errors

#

despite me putting in like a billion fallbacks

languid dragon
#

you make too many checks to see if reason exists or not

#

i dont think that'd be why it doesn't work but try putting the rest of it inside try{} as well

grizzled totem
#

alright

languid dragon
#

and only make 1 check to see if reason is empty

#
if (!reason || reason === undefined || reason === null || reason === "") {
#

that should do it

grizzled totem
#

alright

languid dragon
#

also are you okay with nitpicks and suggestions?

grizzled totem
#

of course πŸ˜„

languid dragon
#

Ok so you have require('../moderationActions') inside a function and generally it's good practice to declare it before module.exports or at the very beginning of the document

#

that way it's not called every time you use the prune function

grizzled totem
#

ah, alright. so i can just do const { purge } = require('../moderationActions'); or something at the top of the file?

languid dragon
#

exactly

grizzled totem
#

i'll change that for all my mod commands then, since i use the same require way

languid dragon
#

does your purge function have the RichEmbed feature?

grizzled totem
#

whats that..?

languid dragon
grizzled totem
#

ohh

#

in the moderationActions file, yeah

#

for mod logs

languid dragon
#

ah yeah, i assume you know what's up with that error then?

#

is that related to reason being empty

grizzled totem
#

yep

languid dragon
#

try give reason a default value say reason = "this is a reason" and test that

grizzled totem
#

so.. set the reason as a default, then set the reason again if the user provides one?

languid dragon
#

actually yeah

#

set the reason as
"No reason provided."
and only change it IF there is user input

grizzled totem
#

alright

languid dragon
#

that way, no matter what, reason will have a value

grizzled totem
#

hm, stupidly either my bot isn't reloading right.. or its still not working

#

but it still gives the same reason doesn't exist error

languid dragon
#

im going to make some edits and show u what i did to see if i can help you along

grizzled totem
#

alright

languid dragon
#

wait

grizzled totem
#

ookay i see the things you've changed

languid dragon
#

you've restarted the bot and the code was reloaded and you're 100% sure you're working on the right file

#

try console.log(reason, userReason, amount) to see the outputs of everything

grizzled totem
#

restarted again just to make sure, now its saying can't read property trim of undefined

languid dragon
#

how are you executing the command

grizzled totem
#

just running !purge 5

languid dragon
#

oh lul 1 sec

grizzled totem
#

okie

languid dragon
#

okay remove trim() from both [0] and [1] and put it on userReason

#

also do you know how async/await works?

grizzled totem
#

alright i'll remove it, and um kinda

languid dragon
#

can you show me a bit of your code when you run .execute(msg, args)

grizzled totem
#

like the message event?

languid dragon
#

yes

grizzled totem
high lava
#

I have 2 shards just because at this point and they both work perfectly fine. I was just wondering if they automatically balance it over time?

languid dragon
#

balance what?

high lava
#

atm, one shard is hosting 7 guilds and the other is hosting 4

#

Guilds is what I meant

grizzled totem
#

don't you need to start sharding at 2500 guilds?

high lava
#

Yeah, you can still do it earlier tho

grizzled totem
#

ah ok

high lava
#

I did it so I could could code with sharding in mind at an earlier time

grizzled totem
#

smart

languid dragon
#

have you ever used promises

grizzled totem
#

uhh is that the .then().catch() kind of thing?

languid dragon
#

yes

#

async/await is essentially the same thing

grizzled totem
#

i have used them a few times i think, usually i try use try catch since it kinda looks nicer

#

ah

high lava
#

I use it all the time actually

#

Kinda just became a habit

languid dragon
#

my bot is entirely coded with promises tbh

#

LOL

#

1 sec

grizzled totem
#

lol

languid dragon
#

canvasβ„’

#

ok so i've rewritten your code as an example of how i'd write it

#

you dont need to do it that way, it's just another perspective and i think something that'll help out a bit

high lava
#

After reading this I just realized that there's a ping property for the client...

#

Jesus christ, I always do the hardest stuff

languid dragon
#

this is hard nervoussweat

grizzled totem
#

alright

languid dragon
#

im still learning about await/async myself tbh

#

but i think using throw "err" will be handy, i didn't include it because im really not sure

#

all i know is that throw = .catch()
and return = .then()

high lava
#

I've just been using try and catch with some .then().catch() here and there

languid dragon
#

@uncut slate would be able to tell you more about this, he's a JS god

#

the thing is with my bot i have it all promises, and so if an error occurs it is caught by my message handler, so i dont have to worry so much if i break some code

high lava
#

you have that for every command?

languid dragon
#

yeah that's the message handler

#

all my commands are promises and if an error occurs they reject() and send that back to the error handler

high lava
#

I think I may want to do that at some point. lol. I know I don't catch everything so I feel like my bot can suddenly crash at any moment πŸ˜…

#

Sure

young cradle
#

@languid dragon, read the Promise page in mdn if you want to know more about it, to understand async/await, first you need to understand promises.

languid dragon
#

i have an understanding of them saddu

#

im just not godly

young cradle
#

Well, you said

all i know is that throw = .catch()
and return = .then()

By that it doesn't looks like you really understand Promise, specially as <Promise>.then(); has a second argument.

languid dragon
#

yeah im pretty nooby at explaining things tbf

young cradle
#

It happens, if anything goes wrong, just send an mdn page + stackoverflow, always works.

languid dragon
#

thanks KannaHeart

young cradle
#

No problem, I did not much aside from just try to help.

keen drift
#

can't blame you for not understanding it

#

js has a poor implementation of asynchronous actions

#

js went from callback hell to poor man's async

earnest phoenix
#

@keen drift Have you made that image embed thing yet? sorry for being impatient.

keen drift
#

didn't I link you it

#

I made one that gives you the gist and prob get you started

#

I thought I pinged you

jovial sigil
#

hello i am a bit confused about something...
When i embed my bot info into my own webpage, it shows that i have 3 upvotes, but on my discordbots page, it shows only 2... why are they showing different numbers?

languid dragon
#

probably a total/monthly upvote thing

jovial sigil
#

hmm

#

ok ty

drowsy sentinel
#

PROBABLY, you mean to say you don't know?

#

Boi I outta slap you.

languid dragon
#

πŸ‘€ Tonkku does more of the backend, I generally work on other stuff and DSL

drowsy sentinel
#

q; do you plan on having the ability to register who voted for our bot, therefore able to reward them?

languid dragon
#

have you seen the api docs?

drowsy sentinel
#

Sorry.. I'm chowing down like a fat piece of shit. I started writing without thinking. And I was not aware of that until now.

languid dragon
#

tmi

drowsy sentinel
#

yeahh... I know. ;/

austere meadow
#

if you add more options onto a SQL query (like a WHERE clause, attributes (in the case of postgres)), does it slow down the return time of the query?

keen drift
#

Not necessarily

#

If you index it correctly

#

Obv it will be slower with some conditionals

earnest phoenix
#

would also make updating/insert/delete slightly slower since it has to update more indexes

keen drift
#

But it will be in the Β΅s

austere meadow
#

yeah true

#

alright thanks for the help blobsmilehappy

latent copper
#

Does anyone know what extra I need to do for the bot = commands.AutoShardedBot in discord.py or do I just have that with no params and sharding works automatically? Tbh, I don't really get how it works in the first place lol

slender thistle
#

rip parentheses

#

Got a prefix set up or?

#

The sharding is automated, that's correct

keen drift
#

Depending on how that lib shards it, there may or may not be extra things

slender thistle
#

That's why it is called "AutoShardedBot"

keen drift
#

If it spawns multiple processes, and have a parent process, things that relies on full data collection will not work correctly

#

Some sharding method will just create additional socket connection with Discord, leaving it as one process, in that case there's nothing extra to be done

#

Multiple processes will always be superior, so there's a tradeoff between easy to use vs performance

#

I can't remember which one discord.py uses, I believe it spawns additional processes

latent copper
#

Thanks, that's what I was wondering, if it requires me to do any extra setup but I just noticed this and it seems not so should be alright with literally just having that line in there to set it up.

A client similar to Client except it handles the complications of sharding for the user into a more manageable and transparent single process bot.

When using this client, you will be able to use it as-if it was a regular Client with a single shard when implementation wise internally it is split up into multiple shards. This allows you to not have to deal with IPC or other complicated infrastructure.

It is recommended to use this client only if you have surpassed at least 1000 guilds.

If no shard_count is provided, then the library will use the Bot Gateway endpoint call to figure out how many shards to use.

If a shard_ids parameter is given, then those shard IDs will be used to launch the internal shards. Note that shard_count must be provided if this is used. By default, when omitted, the client will launch shards from 0 to shard_count - 1
keen drift
#

yeah looks like it does it for you

#

otherwises ipc is required

latent copper
#

Yeah, I don't fancy messing about with IPC if I don't need to at the moment lol Thanks Fishy!

gusty topaz
#

hmmm, css seems to hate me

#

so I included material icons on my website

languid dragon
#

ready

gusty topaz
#

and made a css file containing the following

.material-icons .thicc {
    font-size: 96px !important;
}
#

I then do

<i class="material-icons thicc">icon</i>
#

but its still small

languid dragon
#
<div class="material-icons">
    <div class="thicc">thingy</div>
</div>
#

remove the space

gusty topaz
#

hmm

languid dragon
#
.material-icons.thicc {
    font-size: 96px !important;
}
gusty topaz
#

just removing the space helped

#

lol, thanks

languid dragon
#

no problemo

earnest phoenix
#

@Fishy can you DM me it?

#

I missed the ping

#

@keen drift

slender thistle
#

How does one open() a file from a folder that is in the same folder as the .py file?

native narwhal
#

Wouldn't you just do open("file.name") or open("folder/file.name")

earnest phoenix
#

Hey

latent copper
#
        with open(r'folder/file.ext', 'r+') as f:
            value = int(f.read())
            f.seek(0)
            f.write(DATA TO WRITE GOES HERE)
            f.close()

That kind of thing?

#

Although you'll need to change it for what you want it to do, that will overwrite the contents of said file

#

(and the value line is specific to what I used it for so you can ignore that) but f.read() will get the contents @slender thistle (ping in case you missed the replies)

vale gull
#

i get this error
(node:44092) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'trim' of undefined

const urban = module.require("urban");

module.exports.run = async (bot, message, args) => {
    if(args.length < 1) return message.channel.send("Please enter something!");
    let str = args.join(" ");

    urban(str.first)(json => {
        console.log(json);
    });
}

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

pls help

#

nvm fixed it

slender thistle
#

@latent copper No notification for the ping in edited message. Thanks both you and @native narwhal

native narwhal
#

πŸ‘ŒπŸΌ

latent copper
#

Ah I wasn't aware of that cheers but no worries!

slender thistle
#
await bot.change_presence(status=discord.Status.online, activity=discord.Game(name=f'ready in {bot.guilds} servers'))

TypeError: change_presence() got an unexpected keyword argument 'activity'

#

That's rewrite for sure, because else my bot wouldn't run

#

Ignore the bot.guilds thing, actually. It's wrong

latent copper
#

str(len(bot.guilds)) or len(bot.guilds) I had to use I think

slender thistle
#

Yeah, still the same error

latent copper
#

Other than that, I dunno why it would throw the activity type error if you're using rewrite. You sure it's the latest version?

slender thistle
#

Yep

#

I mean, I would pretty much get some errors at least for my on_message events in main file :p

latent copper
#

Does it matter which order you specify status and activity maybe?

slender thistle
#

Not really

#

Nope, it doesn't

latent copper
#

hmm πŸ˜•

#

And you've got it under a @bot.event and on_ready() method? I really dunno what to suggest that's weird if you're using the latest rewrite like you say

vale gull
#

what is the random cat website?

ruby dust
#

random.cat iirc

slender thistle
#

@latent copper Had Discord.py async version being used instead of rewrite one

#

No idea how my cogs that were supposed to only work on rewrite worked with async, then

latent copper
#

Yeah that is rather odd, oh well at least it works now!

earnest phoenix
#

@safe berry

vale gull
#

how do i make a cat command with this website?
https://aws.random.cat/meow
my code:

const api = "https://aws.random.cat/meow";

module.exports.run = async (bot, message, args) => {
    let msg = await message.channel.send("Generating...");

    let file = (await snek.get(api)).body.file;
    if(!file) return message.channel.send("I broke! Try again.");

    await message.channel.send({files: [
        {
            attachment: file,
            name: file.split("/").pop()
        }
    ]});

    msg.delete();
}

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

module.require?

#

also im sure with the cat api it returns a link not an image

vale gull
heady zinc
#

iirc d.js doesn't care and will download from the link if a link is given

earnest phoenix
#
bot.on("message", async message => {    
                var args = message.content.substring(prefix.length).split(" ")
        
     switch (args[0].toLowerCase()) {
         case "color":
                
        let color = encode(args.join(" ").slice(7))
        let {body} = await superagent
        .get(`http://www.colourlovers.com/api/color/${color}`)
        var embed = new Discord.RichEmbed()

        .setAuthor("FDP MARCHE")
            .setFooter(`Coded by Enzo`)
            .setColor(body.hex)
        message.channel.send(embed).catch(e => {
            message.channel.send("WoW i cant show this :sob:")
        })
    }   ```
#

o is my error

#

where is my error ?

vale gull
slender thistle
#

Someone wishes to know what your code is ThoughTs

vale gull
#

module.exports.run = async (bot, message, args) => {
    let embed = new Discord.RichEmbed() 
        .setAuthor("Help command")
        .setDescription("These are the commands:")
        .setColor("#42f4ee")
        .addField("Avatar - Displays the person's avatar.")
        .addField("Cat - Display's a cute cat image.")
        .addField("Findusers - finds the user in the server")
        .addField("Icon - Display's the server's icon")
        .addField("Mute - Mute's a member.")
        .addField("Unmute - Unmute's a member.")
        .addField("Randomurban - Display's a random definition.")
        .addField("Urban [name] - Displays the definition of the name.")
        .addField("Userinfo - Display's your userinfo. (Still working on it.)")
        .addField("Vote - Vote's yes or no. (Still wroking on it.)");

    message.channel.send({embed: embed});
}

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

I think you arr adding a value bame but not a value text

#

are*

#

name*

#

I am on phone rn, can't edit messages

earnest phoenix
#

@vale gull is normal with addFiel we need 2 argument ()

#

example

#

.addField("First ","second")

vale gull
#

ohh

#

thanks

earnest phoenix
#

Np πŸ˜ƒ

ruby dust
#

in discord.py we are forced to provide both arguments otherwise an error will show Thonk

earnest phoenix
#

nobody has a solution for me

#

in js too except that his undefined poster @ruby dust

ruby dust
#

no it's not, in js it will show a string of "undefined" while in discord.py it returns none which is impossible for discord's embed system

earnest phoenix
#

its what I'm trying to say

#

i dont speak very good english sorry :p

ruby dust
#

oh ok

earnest phoenix
#

you say coded in js

vale gull
#
    if(!message.member.hasPermission("MANAGE_MEMBERS")) return message.reply("No can do!");
    let wUser = message.guild.member(message.mentions.users()) || message.guild.members.get(args[0])
    if(!wUser) return message.reply("Couldn't find them.");
    if(wUser.hasPermission("MANAGE_MESSAGES")) return message.reply("They can't be warned.");
    let reason = args.join(" ").slice(22);

    if(!warns[wUser.id]) warns[wUser.id] = {
        warns: 0
    };

    warns[wUser.id].warns++;

    fs.writeFile("./warnings.json", JSON.stringify(warns) (err) => {
        if (err) console.log(err);
    });```
#

please help

topaz fjord
#

Asymc

#

Is not a thing

torpid vale
#

@vale gull add a comma after JSON.stringify(warns)

vale gull
#

oh

#

i was typing fast

#

xd

topaz fjord
#

ok

halcyon torrent
#

comas are useless in js

torpid vale
#

no

#

important

topaz fjord
#

They really aren't useless

halcyon torrent
#

but you can do without them

topaz fjord
#

Half the stuff in js won't work without em

halcyon torrent
#

and it wasnt the error rn

#

wot? which case? I never had to use comas by necessity in js :d

vale gull
halcyon torrent
#

AH

#

ok

topaz fjord
#

For es6 it's important

halcyon torrent
#

no mb

#

I misunderstood commas and semicolon u_u

inner jewel
#

without commas you can't even have multiple args

halcyon torrent
#

yey, I know

#

I thought commas were semicolon, idk, I'm tired sorry πŸ˜‚

#

so yeah, semicolons are useless tr

uncut slate
#

@inner jewel rest operator me harder daddy

pliant igloo
#

hiya i'm being an idiot

#

trying to get dblpy working but i don't know what the parameter in the example takes

slender thistle
#
                    the_cog = list(self.bot.get_cog_commands(command))
                    if isinstance(the_cog, commands.Group):
                        cog_or_cmd = re.findall(r'\w+', command)
                        if len(cog_or_cmd) == 2:
                            msg = cog_or_cmd[0]
                            comd = cog_or_cmd[1]
                            the_cog = list(self.bot.get_cog_commands(msg))
                            cmd = self.bot.get_command(comd)
                            for comm in the_cog:
                                if cmd.name == comm.name:
                                    result += cmd.signature + '\n\n    ' + cmd.help + '\n'

command is user input. Any clues why this doesn't work?

earnest phoenix
#

One message removed from a suspended account.

bold wigeon
#

hello everyone i just created my first bot and i have a problem to make him online can somebody help me?
using python

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

bold wigeon
#

can someone help me fix my code?

earnest phoenix
#

One message removed from a suspended account.

bold wigeon
#

he is offline i want him to be online

#

ill send u the code ok? in privte

#

can u chek him?

earnest phoenix
#

One message removed from a suspended account.

bold wigeon
#

sent

#

can somebody help me? i dont know what to write in the Detailed description of your bot *

#

please

slender thistle
#

Your bot's features 02Shrug

#

What your bot is about

#

etc.

bold wigeon
#

yes

#

thank you

slender thistle
earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

neon schooner
#

@bold wigeon your bot prefix should be # not the list of commands. The list of commands should be in the long description or in a help command.

bold wigeon
#

thank you

#

@neon schooner can you help me to make my bot online? im trying and thats not work. can you chek my code?

neon schooner
#

I can't right now, no

#

Sorry

bold wigeon
#

can u bring someone pls?

#

or just a quick view at my code

neon schooner
#

That would be up to someone wanting to take a look at it.

bold wigeon
#

can somebody chek my code?

#

i cant make the bot online

#

i found the problem and i dont know how to fix

#

unexpected character after line continuation character

#

how to fix it pls

abstract crystal
#

i'd be nice if we saw the actual error dump, or if you copied the line of the problem code

bold wigeon
#

i dont know witch line exactly

#

can i send you the code?

#

and u will chek

#

pls

gusty topaz
#

send it to me

abstract crystal
#

sorry but no

gusty topaz
#

I can check

bold wigeon
#

ty

gusty topaz
#

oh

earnest phoenix
#

One message removed from a suspended account.

abstract crystal
#

okay, what's the error and which language are you using

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

gusty topaz
#

java?

#

looks like javascript

abstract crystal
#

^

maiden oxide
#

^^

earnest phoenix
#

One message removed from a suspended account.

granite hedge
#

definitly javascript xd

earnest phoenix
#

One message removed from a suspended account.

bold wigeon
#

im using python and someone know how to fix it?

abstract crystal
#

yes

gusty topaz
#

this is javascript not java

#

also

abstract crystal
#

okay send it @bold wigeon

earnest phoenix
#

One message removed from a suspended account.

gusty topaz
#

you need to put () after new Discord.Client

granite hedge
#

java != javascript

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

granite hedge
#

displayAvatarURL is that a thing? it might, I always use something else

earnest phoenix
#

One message removed from a suspended account.

maiden oxide
#

no its displayAvatarURL

granite hedge
#

I use .avatarURL but I see it's on it too

earnest phoenix
#

One message removed from a suspended account.

granite hedge
#

are you sure bot is what you think it is?

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

granite hedge
#

-_- I was looking at it and have patience, you can't expect people jumping for you

maiden oxide
#

thats kinda rude

karmic lake
#

Lookie here my roblox name

#

We are not your slaves GWmythicalHyperREEEE

granite hedge
#

I have my own bot to look after I have a ton of work to implement so me looking at your code is a favor

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

granite hedge
#

do a console.log(bot) the only thing I can think of that bot is not a client in this case

earnest phoenix
#

One message removed from a suspended account.

granite hedge
#

inside the run function

earnest phoenix
#

One message removed from a suspended account.

granite hedge
#

yeah

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

granite hedge
#

yeah, but what does the console say about bot?

#

take a screenshot of the contents of the log

karmic lake
#

Log it first

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

granite hedge
#

yeah like I tought

#

bot is undefined

maiden oxide
#

Client then maybe

granite hedge
#

so you have a problem somewhere else in your code

maiden oxide
#

Or Bot

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

karmic lake
#

Where are the other files

earnest phoenix
#

One message removed from a suspended account.

maiden oxide
#

You don't need new Discord.Client()
Cuz it should be in the main file

earnest phoenix
#

One message removed from a suspended account.

karmic lake
#

Yeah

#

You're defining shit twice and it triggers me GWmythicalHyperREEEE

earnest phoenix
#

One message removed from a suspended account.

runic cloud
karmic lake
#

Im on vacation so im away from my pc

earnest phoenix
#

One message removed from a suspended account.

karmic lake
#

I gtg

earnest phoenix
#

One message removed from a suspended account.

karmic lake
#

Sorry my dood I have to get ready to fly back home

#

I hate mobile

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

desert bough
#

anyone know how I can fix this error ``` const playlist = await youtube.getPlaylist(url);
^^^^^^^

SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)

granite hedge
#

yep

#

make your function async

earnest phoenix
#

One message removed from a suspended account.

granite hedge
#

await won't work in a function that's not async

#

@earnest phoenix I think we established that you have multiple instances of bot and that's the reason why bot is undefined, search in all your files where you make bot

desert bough
#

@granite hedge how do i do that

granite hedge
#

show part of your code I can tel you where to put it

#
exports.clean = {
    name: "clean"
    , description: "cleans all the recent messages from the bot in that channel"
    , permission: "243275264497418250"
    , category: "DEVELOPMENT"
    , process: async function (bot, msg, suffix) {
        await msg.channel.fetchMessages({
            limit: 100
        }).then(messages => {
            var test = messages.filterArray(m => m.author.id === bot.user.id)
            for (i = 0; i < test.length; i++) {
                test[i].delete(1).catch(e => {})
            }
        }).catch(console.error);
    }
}
``` for me it looks liek this
earnest phoenix
#

One message removed from a suspended account.

desert bough
#

lemme just redownload it from my server hold up

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

desert bough
granite hedge
#

do you have like a function around it? How do you call it to be executed? is it when bot is ready? or ...

earnest phoenix
#

One message removed from a suspended account.

desert bough
#

@granite hedge its when a command is done

#

specifically teh play command

granite hedge
#

surround the piece of code you sent me with js async function() {//YOURCODEHERE}

earnest phoenix
#

One message removed from a suspended account.

desert bough
#

@granite hedge its when theres a message sent is it not already async?

granite hedge
#

it needs the word async it's how javascript checks if it can use await

#

the environment can be async already but yeah javascript is weird in that way

earnest phoenix
#

One message removed from a suspended account.

granite hedge
#

javascript made a huge leap from callbacks to async and promises

#

I said before check where you overwrite your first botinstance and make sure all your files can access the 1 bot you made in your index file

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

maiden oxide
#

@earnest phoenix I'll try out the code and see if I can get the problem

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

${bot.user.tag}

#

One message removed from a suspended account.

#

${bot.user.tag}

#

${bot.user.tag}

#

One message removed from a suspended account.

#

${bot.user.tag}

#

${bot.user.tag}

#

One message removed from a suspended account.

sour timber
#

me

desert bough
granite hedge
#

nah right before where you check the youtube url

#
async function() {
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
            const playlist = await youtube.getPlaylist(url);
            const videos = await playlist.getVideos();
            for (const video of Object.values(videos)) {
                const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
                await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
            }
            return msg.channel.send(`βœ… Playlist: **${playlist.title}** has been added to the queue!`);
        } else {
            try {
                var video = await youtube.getVideo(url);
            } catch (error) {
                try {
                    var videos = await youtube.searchVideos(searchString, 10);
                    let index = 0;
                    msg.channel.send(`dfsffds`)
                                  }catch(e){} }
}
}
desert bough
bold wigeon
#

hello how do i download the chalk module

#

please

onyx summit
spring ember
#

@desert bough you need to give it a name

bold wigeon
#

???

spring ember
#

@onyx summit create your own

#

@bold wigeon async function hello(){}

onyx summit
#

Ye, that would be an option, but I think it will be bad, and also much work

bold wigeon
#

?

desert bough
#

@spring ember what do u mean

granite hedge
#

anonymous functions exist

spring ember
#

אחי Χ©ΧœΧ— ΧœΧ™ Χ”Χ•Χ“Χ’Χ”

#

@bold wigeon

granite hedge
#

so it should work

spring ember
#

@granite hedge it seems like a method

#

And methods require a name

granite hedge
#

oh

spring ember
#

That's not a method

#

That's a function

granite hedge
#

I never called it a method

desert bough
#

@spring ember im not 100% sure what u mean

spring ember
#

Send full code please

desert bough
spring ember
#

Yes

desert bough
#

noice πŸ˜„

#

i is smert and used mah bren :brain:

spring ember
#

πŸ‘

desert bough
#

lol now theres something wrong with it ``` async function ytsearch() {
^^^^^^^^

SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)

spring ember
#

Oh yeah no need for function

#

It's a method so ytsearch(){} is enough

desert bough
#

aight

spring ember
#

Wait umm

#

Wait can you send code

#

I really can't help you when I see this little bit

desert bough
spring ember
#

Wait is it in a class

#

I need full context if you hide stuff from me I really can't help you

desert bough
spring ember
#

Umm what line is the thing you need?

granite hedge
#

there fixed it

#

add async there remove the function and other stuff we told you to add

desert bough
#

now i get this ```client.on('message', async msg => { // eslint-disable-line
^^^^^

SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)

sullen path
#

Then put a )

#

It tells you what to do 🀦

spring ember
#

You did a new line after //

#

Oh wait no

hot sleet
#

how to get users roles map like message.author.roles.map

spring ember
#

It has a map?

hot sleet
#

i think

#

you mean the roles ??

spring ember
#

What is the issue I don't get it

desert bough
#

@spring ember im confused on how to proceed

spring ember
#

I don't know what line you are talking about

#

Can you specify the line?

granite hedge
#

just copy paste your whole code in it

bold wigeon
#

someone can help me pls? i cant download chalk

desert bough
spring ember
#

Don't be an asshole

#

He is having a problem with pip

bold wigeon
#

can somebody help me?

keen drift
#

post qu e s t i o n

bold wigeon
#

someone know how to fix it?

#

how to delete six

keen drift
#

manually removal I suppose

gusty topaz
#

@desert bough what node.js version are you running

#

it may not support the async/await syntax

bold wigeon
#

so how to fix it

gusty topaz
#

make sure you have at least 8.x.x

desert bough
#

6.14.3

gusty topaz
#

ah

#

there is your problem

bold wigeon
#

what?

solid cliff
#

why do you need to remove it think

gusty topaz
#

update to the latest LTS

desert bough
#

ok how can i update

gusty topaz
#

download an installer of the website?

#

Are you running windows?

desert bough
#

im on a linux server

gusty topaz
#

ah

bold wigeon
gusty topaz
#

thats gonna be a bit more difficult

#

you will need to install whats called node version manager (nvm)

keen drift
#

7.6.0+ for async/await

ruby dust
#

is it a good idea to ping the local database each time a message event has been received?

spring ember
#

no

tawdry fox
#

help with this?

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect string value: '\xEC\x9E\xAC\xEC\x9E\xA5...' for column 'username' at row 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3974)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
        at com.fernandopal.ferchy.core.db.Database.loadDataToUsersTable(Database.java:300)
        at com.fernandopal.ferchy.Ferchy.main(Ferchy.java:58)
gusty topaz
keen drift
#

@bold wigeon wots ur pip version

spring ember
#

it is not scaleable @ruby dust

#

@gusty topaz he is on python

gusty topaz
#

and then run nvm install v8.11.3

#

I am talking to jonny

spring ember
#

oh

ruby dust
#

then what do you suggest? I had an idea to ping the db once every second and hardcode the list into a variable

keen drift
#

@tawdry fox what's db collation/charset

#

@ruby dust Why you need to call it every second

desert bough
#

@gusty topaz done

keen drift
#

Is there new data every second

gusty topaz
#

you also need to install your old nodejs

#

so you only have the nvm one

ruby dust
#

idk the other way to check if a user is blacklisted or not rather than keep pinging the db

desert bough
#

it appears to be working tho

#

the bot is online

ruby dust
#

I need to be able to do it on on_message because that way it affects all commands at once

earnest phoenix
#

One message removed from a suspended account.

keen drift
#

@ruby dust Blacklist for commands? Or just all the messages

tawdry fox
#

@keen drift username varchar(100) latin1_swedish_ci

ruby dust
#

check if a user is blacklisted to use commands

keen drift
#

Yeah then you prob query the db that often

#

but I'd build a small memory cache

#

of like

#

10 minutes

#

@tawdry fox try utf8, if it's 4 bytes per character, utf8mb4

tawdry fox
#

ok

gusty topaz
#

@desert bough you will need to run nvm use v8.11.3 every time you want to start the bot

ruby dust
#

wouldn't that mean that if I blacklist someone it will affect in up to 10 minutes rather than instantly?

gusty topaz
#

to tell the system you want to use the new version

#

not the preinstalled old one

keen drift
#

@ruby dust In theory, but you could flush the cache for added ones

#

but without cache it'll work fine

#

db should be able to handle it

#

I've seen way more intensive operation working smooth

ruby dust
#

idk the way of doing it, since commands are in a cog file and the variable with a list of blacklisted ids are in the main file

hot sleet
sour timber
#

can i have a bot

high lava
#

Make one

keen drift
#

if the blacklist is within a file, load the file into memory

high lava
#

That's what this is for

hot sleet
#

any help

keen drift
#

@hot sleet Role doesn't have .user?

#

wait what's target

hot sleet
#

target is the user

keen drift
#

So GuildMember?

hot sleet
#

yeah

#

i will change ,user

keen drift
#

Yeah m.user doesn't exist

hot sleet
#

wait

keen drift
#

m is a Role object, which does not contain any user data

#

if you want to check if an user has a role. do something like target.roles.has(roleID)

hot sleet
#

i want to show his all roles

#

i don't want to use .array()

keen drift
#

target.roles.forEach(m => /... print m.name somewhere ../)

sour timber
#

can i have 2

#

percent of disc

hot sleet
#

wait .array().split(" "); may help

keen drift
#

you mean join/

sour timber
#

but i am autistic

hot sleet
#

i want to remove /n

keen drift
#

huh

hot sleet
#

split /n join ,

keen drift
#

where is \n from

hot sleet
#

i will test it

#

wait

tawdry fox
#

@keen drift same error

[LEVELING] ID of TheEpTic already exists
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect string value: '\xF0\x9F\x87\xB5\xF0\x9F...' for column 'username' at row 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3974)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
        at com.fernandopal.ferchy.core.db.Database.loadDataToUsersTable(Database.java:300)
        at com.fernandopal.ferchy.Ferchy.main(Ferchy.java:58)
#

(is on uft8) username varchar(100) utf8_general_ci No