#development

1 messages ยท Page 648 of 1

mossy vine
#

read the docs of the library youre using

west spoke
#

Create channel>on channel create> if ID of channel is the same as the channel stored, send message.

smoky mica
#

ah ye I'm tryna find the single thing in the docs

#

and alright imma try

rugged kelp
#

Why ?

west spoke
#

you cant set a timestamp

#

timestamp is the time the message was sent. Unless you alter api calls you cant change the message date

rugged kelp
#

oh

earnest phoenix
#

uh

rugged kelp
#

thanks

earnest phoenix
#

im pretty sure they're doing it on an embed

west spoke
#

Ik

earnest phoenix
#

you can set a timestamp for a rich embed

#

it shows in the embed's footer

west spoke
#

Ah

#

I thought that was the message time

earnest phoenix
#

can't help without seeing the code ๐Ÿคท

#

it's a syntax error i think

spice nymph
#

How count my bot vote please ?

#

And after I donโ€™t know what I do ๐Ÿ˜ญ

west spoke
#

Api calls would work.

I use them too much ffs

spice nymph
#

I never use api of my life. @west spoke

west spoke
#

Then you arent gonna get votes if you dont use any sort of api

rugged kelp
#

how ? online/offline

west spoke
#

Restart

spice nymph
west spoke
#

Dont need to send it here

split hazel
west spoke
#

Already told them.

rugged kelp
#

Why ?

west spoke
#

oh my fucking god

rugged kelp
#

what

west spoke
#

Did you seriously just take the code and not change it

rugged kelp
#

?

west spoke
#

you either have to define the variables or change them..

rugged kelp
#

how

west spoke
rugged kelp
#

im noob : (

west spoke
#

Learn how to code

#

ez

rugged kelp
#

idk :/

west spoke
#

..

#

then dont create a bot if you dont know how to code

rugged kelp
#

ik

split hazel
#

code isn't going to magically work and connect to the exact bot you want by copy pasting

fading wigeon
#

lol

unique nimbus
#

code is like a maze, it can be easy and it can be hard however if you try you will achieve

smoky mica
#

how can i make a bot do something after you clicked a reaction?

#

uh im not good at explaining lmao

fading wigeon
#

uh

#

which lang?

smoky mica
#

js, discord.js

#

lang and lib

fading wigeon
#

@smoky mica

smoky mica
#

ah ty

#

i think i maybe got it, lemme give it a try

fading wigeon
spice nymph
#

discord.js Only _/!_

opaque eagle
#

Why would you want to create an invite for each guild?

#

That seems ultra-suspicious.

spice nymph
#

๐Ÿค”

earnest phoenix
#

Umm someone know the const of member? like a normal member

opaque eagle
#

lol what?

#

const of member?

spice nymph
#

๐Ÿ˜‚

latent spoke
#

Anyone here have a experience with bot music and trying to change the pitch?

opaque eagle
#

No

#

Why

split hazel
#

๐‘บ๐’‚๐’Œ๐’–๐’“๐’‚.#0113

spice nymph
#

Ty

#

@split hazel

latent spoke
#

I confused how to change the pitch :(

#

help me

opaque eagle
#

Why would u want to do that? @spice nymph

spice nymph
#

..

opaque eagle
#

That is against Discord ToS @spice nymph @split hazel

spice nymph
#

I know

opaque eagle
#

Then why would u do it

split hazel
#

Just noticed, it also spams the API

loud salmon
#

@spice nymph i told you to not ask it again

opaque eagle
#

And why would u give it even if it doesn't spam... it's against ToS end of story @split hazel

split hazel
#

I didn't realise

latent spoke
#

why no one wanna help me pandasad

opaque eagle
#

No offense but even if it weren't a violation of ToS, you didn't think that making an invite link for each server and sending it to the bot owner would be a violation of someone's privacy?

earnest phoenix
#

Someone knows how i can get the level from apex-api?

quartz kindle
#

did you already get the data from api and just need to extract the level? or did you not connect to the api at all yet?

earnest phoenix
#

i connected all

#

let me give you an ss

#

wait i have to install lightshot

#

it's a long road

#

=)))

quartz kindle
#

and where is the level you're looking for?

earnest phoenix
#

data->children->metadata->stats->metadata->metadata->->stats->metadata

quartz kindle
#

i mean, what is the value you're looking for?

#

is it value:195?

earnest phoenix
#

it's 38

#

but it's down

quartz kindle
#

ah i see

#

so first of all you have to go into data

earnest phoenix
#

done

#

already

quartz kindle
#

then children

#

now children is an array

earnest phoenix
#

yes

quartz kindle
#

so you have to find the index of the item you want. you can use the find() function

earnest phoenix
#

oh

#

i will dm you if it works or not, ok?

quartz kindle
#

no need to dm, just post here

earnest phoenix
#

ok

quartz kindle
#

is there any more children?

#

or it is only one, "legend_7"?

earnest phoenix
#

legend_7 means 7 legends actives

#

but wait to ss

#

this

#

The 0 is the one that i want

quartz kindle
#

ah so its in another stats, outside of children

#

so data.stats[0]

#

if its always in index 0

#

if not, then you need to use data.stats.find()

earnest phoenix
#

it's ok if i make it like this?

#

or?

#

ignore metadata

#

cuz i know it's wrong

quartz kindle
#

its ok yes, but its not needed

#

you can just do data.stats[0].metadata[2].displayValue

#

assuming the address is correct

earnest phoenix
#

lie let level = data.stats[0].metadata[2].displayValue?

#

like*

quartz kindle
#

yeah, assuming its correct

earnest phoenix
#

ok

quartz kindle
#

from your pictures above, it should simply be data.stats[0].displayValue

earnest phoenix
#

index.js:34
TypeError: Cannot read property '0' of undefined

shy turret
#
  bot = client.fetchUser('579317044915208202')
  if (!bot.hasPermission('CREATE_INSTANT_INVITE') || !bot.hasPermission('VIEW_CHANNEL') || !bot.hasPermission('MANAGE_MESSAGES') || !bot.hasPermission('ATTACH_FILES') || !bot.hasPermission('ADD_REACTIONS') || !bot.hasPermission('SPEAK') || !bot.hasPermission('USE_EXTERNAL_EMOJIS') || !bot.hasPermission('CHANGE_NICKNAME') || !bot.hasPermission('SEND_MESSAGES') || !bot.hasPermission('EMBED_LINKS') || !bot.hasPermission('READ_MESSAGE_HISTORY') || !bot.hasPermission('CONNECT') || !bot.hasPermission('USE_VAD')) {
    guild.leave
    return
  }

discord.js I'm trying to make a thing when the Discord bot doesn't have the correct permissions, it leaves the server, but it keeps saying .hasPermission is not a function. Can anyone help me?

split hazel
#

number 1

#

fetchUser is a promise and will only work in .then or await

#

2 you mean <client>.guild.me

#

for bot

earnest phoenix
#

speedy

#

can you help me?

shy turret
#
const fs = require('fs')
const talkedRecently = new Set();
const Discord = require('discord.js')
const client = new Discord.Client()

my const

split hazel
#

don't ask to ask

earnest phoenix
#

put client insted of bot

shy turret
#

ok

split hazel
#

i already told you, replace bot with <client>.guild.me

#

then the hasPermission function will work

earnest phoenix
#

oof , i need help with apex-api

shy turret
#

ok bot started running, let me see if it works

#

TypeError: Cannot read property 'me' of undefined new error

#
if (!client.guild.me.hasPermission('CREATE_INSTANT_INVITE') || !client.guild.me.hasPermission('VIEW_CHANNEL') || !client.guild.me.hasPermission('MANAGE_MESSAGES') || !client.guild.me.hasPermission('ATTACH_FILES') || !client.guild.me.hasPermission('ADD_REACTIONS') || !client.guild.me.hasPermission('SPEAK') || !client.guild.me.hasPermission('USE_EXTERNAL_EMOJIS') || !client.guild.me.hasPermission('CHANGE_NICKNAME') || !client.guild.me.hasPermission('SEND_MESSAGES') || !client.guild.me.hasPermission('EMBED_LINKS') || !client.guild.me.hasPermission('READ_MESSAGE_HISTORY') || !client.guild.me.hasPermission('CONNECT') || !client.guild.me.hasPermission('USE_VAD')) {
                    ^
hushed berry
#

wtf

shy turret
#

let me get it in a image

split hazel
#

oh not client

earnest phoenix
#

i was wrong

split hazel
#

message.guild.me

shy turret
#

oh message

split hazel
#

is what i meant, got it mixed up

hushed berry
#

that code is um

#

very repetetive

shy turret
#

lol

earnest phoenix
#
index.js:47
[[StableObjectId]]:1
message:"Cannot read property '2' of undefined"
stack:"TypeError: Cannot read property '2' of undefined\n    at apex.user.then.data (e:\somestuff\index.js:36:26)\n    at process._tickCallback (internal/process/next_tick.js:68:7)"
__proto__:Error {constructor: , name: "TypeError", message: "", โ€ฆ}```
#
            console.log(level);```
split hazel
#

this means that stats is either not an array or doesn't exist

#

did you try logging stats into console?

shy turret
#

guild.leave isn't working now

#

trying client.guild.leave now (nope)

earnest phoenix
#

because it's a method not a property

split hazel
#

message.guild.leave you're probably looking for

#

alot of this stuff is in docs

#

and leave is also a function

earnest phoenix
#

it's data.stats

#

the 0

shy turret
#

no error, bot doesn't leave the server

earnest phoenix
#

and tim told me to put data.stats[0] and that either didn't work

split hazel
#

you can't call a function without ()

#

message.guild.leave()

quartz kindle
#

from the pictures you sent me, that should work. do console.log(data.stats[0])

shy turret
#

GG thx

split hazel
#

alot of this is in docs, you should do a simple google search & docs search before asking here

earnest phoenix
#

yeah but if i put children

#

TypeError: Cannot read property 'stats' of undefined

#

i do console.log data

#

and in visual code i don't know who is after the first one.

quartz kindle
#

so data.stats[0] works?

earnest phoenix
#

nope

quartz kindle
#

what does it say?

earnest phoenix
#

0

#

TypeError: Cannot read property '0' of undefined

quartz kindle
#

then console.log(data)

earnest phoenix
#

i have it already

#

it's data.stats[0] but it dosen't work

quartz kindle
#

what does console.log(data) show?

split hazel
#

stats seems to be inside the children array, data.stats won't work on it's own

earnest phoenix
#

oh , i see data.stats = undefined

quartz kindle
#

he wants this stats, unless im blind, that doesnt look like its inside the children array

split hazel
earnest phoenix
#

yeah that's from their site

#

of apex tracker

quartz kindle
#

did you do console.log(data)?

#

what does it show?

earnest phoenix
#

yes

#

i opened some

quartz kindle
#

then its data.data.stats[0]

earnest phoenix
#

cuz it's data that i defined and the data from the core?

quartz kindle
#

yes, the data you defined contains another data inside it

earnest phoenix
#

works

#

ty

earnest phoenix
#

umm i want to create a register/login command if anyone knows how

#

and i want it to store in a json

#

lets not store anything to do with passwords in json

#

not with passwords

#

like username platform

#

i want it to store into an json to don't need to register again

#

or can be without?

wooden lance
#

Wait, is this for a website or?

earnest phoenix
#

No for an apex bot

#

to be more usefull

opaque eagle
#

yeah, store it in an actual database

#

not in a json file

earnest phoenix
#

or database

opaque eagle
#

json files are for configuration/settings

#

Check out SQLite and Keyv for starters

topaz fjord
#

I've corrupted a json file before

#

It's pretty fun

wooden lance
#

Yeah. Json files have a tendency to get corrupted when edited a lot. They're not really designed for it. Your way better using SQLite or another database...and i actually came here for help to set up SQLite lol

earnest phoenix
#

lol

#

๐Ÿ˜ƒ

opaque eagle
earnest phoenix
#

it's ok if i work with xampp?

#

cuz it's like sqlite

opaque eagle
#

I'm not sure if we'd be able to provide much help with it... not a lot of devs here know that, including myself.

#

From what I remember it's a web server, right?

earnest phoenix
#

it's a database with your ip

#

for localhost

#

but you can port forwarding

wooden lance
#

I would recommend SQLite, not because I understand it, but because a lot of people here know how to use SQLite so you're probably gonna get support with code a lot faster.

opaque eagle
#

Hmm.... the whole reason we recommend SQLite for you was that it's the closest thing to JSON since it's file-based.

earnest phoenix
#

@wooden lance You're right

opaque eagle
#

Plus most of us use some SQL database like Postgres, MySQL, etc, (unless ur a MongoDB pleb) so it would be similar enough for us to offer guidance

#

But ultimately no one is stopping u from using XAMPP if u absolutely can't use an SQL db

#

What language do u code in btw? @earnest phoenix

earnest phoenix
#

node.js

opaque eagle
#

Oh yeah, then don't use XAMPP... it's more of a PHP thing rather than a JS thing

wooden lance
#

And now I'm gonna ask my question...
I was wondering, does anyone know how I can use SQLite to make my bot's automod configurable. I tried json files...they got corrupted lol. My bot uses discord.js on node, and the code I need help making configurable (like, being able to turn the feature on or off) is at https://pastebin.com/ym2yDKHc. Thank you in advance.

opaque eagle
#

what do u use to talk to sqlite?

#

like do u use the "raw" sqlite lib, sequelize, keyv, etc

wooden lance
#

sequelize, i installed that.

opaque eagle
#

Oh cool

#

So yeah where do u define ur guild model

wooden lance
#

I followed a guide on how to install it, but its quite useless after that tbh

opaque eagle
#

Just to be clear, you already have sqlite, right?

wooden lance
#

Yes, i have installed it

opaque eagle
#

If you're completely new to Sequelize, here's a crash course on how to use it with discord bots: https://discordjs.guide/sequelize
The guide uses it for a tag system (custom commands) but the logic is pretty much the same.

#

You define a model, sync the model, add/delete stuff when necessary, and fetch them to check if automod is on

wooden lance
#

That's actaully the website i read the guide on. I'm a little new to bot developing, and, it made no sense where it wanted me to put code.

opaque eagle
wooden lance
#

OH

opaque eagle
wooden lance
#

That's what they were for

#

๐Ÿ˜…

opaque eagle
#

np lol

wooden lance
#

I was just thinking they were just random gibberish, apparently not.

opaque eagle
#

lol

wooden lance
#

lol

#

now to go break add that to my automod

kindred cedar
#

lol

earnest phoenix
#

it's ok this command ? create table first(a int, b string)

wooden lance
#

I have a feeling I will come back confused and minus one bot

opaque eagle
#

np

#

Just checkout a new branch and mess around with the code

wooden lance
#

Okay

opaque eagle
#

then if stuff breaks just switch back to the main one

wooden lance
#

K

earnest phoenix
#

it's ok this command ?
create table first(a int, b string)

#

to be like username , platform

#

oh no

#

it's a string , b string

#

?

dense niche
#

?

earnest phoenix
#

it's for sqlite

#

i need to npm?

#

sqlite?

crude aurora
#

there's no such thing as string in sqlite

earnest phoenix
#

someone wit sqlite if the id exist already

#

to don't register him again

earnest phoenix
#

Wth that's a different language in the bottom when you have message.reply

west spoke
#

^

earnest phoenix
#

I just wanted help if he has already register

spare goblet
#

@earnest phoenix Just check if they're in db (registered) already

wooden lance
#

Hello. I've tried...

let ${message.guild.id}-antiswear = new db.table('antiswear-setting')

but it just throws back errors. Anyone got any advice on how I can do the above ^? I'm using discord.js on node. Please ping me if you respond. Thank you in advance.

warm marsh
#

Remove ${message.guild.id}-

#

Name the variable something else.

wooden lance
#

But it needs to be linked to that server.

warm marsh
#

Not there it doesn't.

#
let antiswear = new db.table("antiswear-settings");

// later in code:

let swear = antiswear.get(`${message.guild.id}`) || {};
spare goblet
#

You can't do that. What database are you using @wooden lance

warm marsh
#

quick.db

wooden lance
#

quick.db

spare goblet
#

Then iirc you make a table and then you get the value based off of the key within the db

wooden lance
#

Okay

spare goblet
#

no need ot make 1 table per server

sinful lotus
#

wait you are making a table per user?

wooden lance
#

No

#

Server

spare goblet
#

they were making 1 table per server

sinful lotus
#

wait why?

#

dont do that

#

are you aware that sql works slower the more table it has?

wooden lance
#

But, how do I do it then?

sinful lotus
#

one table, unique key = guild id

#

value = JSON.string() object

wooden lance
#

that made absolutely no sense to me

sinful lotus
#

let settings = new db.table('settings')
settings.set(message.guild.id, JSON.stringify({ antiswear: true }))

#

that will yield more performance and can even hold more than 50k guilds

wooden lance
#

Okay

#

Thanks

earnest phoenix
#

Umm where i can found the db?

#

In the main folder or. ...?

spare goblet
#

@earnest phoenix you should have created it mmLol

earnest phoenix
#

How like "registers.sqlite"?

#

In the main folder

#

I'm new to sqlite

spare goblet
#

you're using sqlite? mmLol

#

i see, then it should be a file called (something).sqlite

#

you need to make it iirc mmLol

earnest phoenix
#

Iirc means..?

spare goblet
#

if i recall correctly

earnest phoenix
#

Oh

spare goblet
#

are you using a package?

earnest phoenix
#

Yes

#

Sqlite 3

spare goblet
#

what package are you using

#

oh okay blobthumbsup

#

in that case iirc you have to make a db file such as database.sqlite

wooden lance
#

Wait....how do I fetch this instead of setting this?

settings.set(message.guild.id, JSON.stringify({ antiswear: true }))

sometimes i feel i shouldn't have a bot when i ask these kinda questions.

spare goblet
#

and then you try to open it from main code file

#

@wooden lance settings.get(message.guild.id) i think

i dont use quick.db so i could be wrong ๐Ÿ˜‚

wooden lance
#

lol

spare goblet
#

p sure its <db>.get() tho

wooden lance
#

I'll try

settings.get(message.guild.id, JSON.stringify({antiswear}))

? I have no clue.

#

I really have no clue lol

spare goblet
#

no, it's <db>.get(<key>) i think blobthumbsup

#

it returns the antiswear option the guild chose blobthumbsup

wooden lance
#

But, that means ill have to have multiple db per server if i have to put them all in other database and lol that took me 4 attempts to correctly spell database wtf am i doing it's 5am

spare goblet
#

no lol

wooden lance
#

Hmm, time to put my thonking hat on Thonk

spare goblet
#

if you do
function(){
settings.set(message.guild.id, whatevertheiroptionishere)
}
then every time a guild invokes the command, it adds it to a row in the db

#

then when you need to see what the guild chose, just do like
settings.get(message.guild.id)

#

and so it'll check what that specific guild id noted in that db

wooden lance
#

But i only need the antiswear/antispam bit.

#

Not both

spare goblet
#

yes, so it returns whether the guild wants to have antiswear/spam.

#

or whatever the option is

earnest phoenix
#

var db = new sqlite3.Database('registers');

#

it's ok to look like this?

#

or var db = new sqlite3.Database('./registers.sqlite');

wooden lance
#

But, my bot needs to know which value to look at @spare goblet, to decide if the feature is on, or off. my brain is obviously at -10% right now

spare goblet
#

I know

#

Okay so first of all there's

//setting whether the feature is on or off
settings.set(message.guild.id, thingystoredhere)

then there's the checking if antispam is on or off
settings.get(message.guild.id) // this returns the "thingystoredhere" from above

earnest phoenix
#

Iara

spare goblet
#

?

earnest phoenix
#

It's ok the first one

wooden lance
#

but then how does my bot know if it is on or off in this cause im a complete idot with this db stuff. ```javascript
for (x = 0; x < profanities.length; x++) {
let settings = new db.table('settings')
settings.get(message.guild.id)
if (message.content.toUpperCase() == profanities[x].toUpperCase()) {
message.delete()
message.channel.send(**Profanity Blocked:** A message by ${message.author} had known profanity words in it and was blocked.)

    let log = message.guild.channels.find(`name`, "logs")
    message.log.send(`**${message.author.username} sent a message with known profanity in it in ${message.channel} and was blocked.**`)
  }
}
warm marsh
#

Omfg

wooden lance
#

What bit of it checks

spare goblet
#

๐Ÿ˜‚ make it save true/false (as boolean) or make it save on/off (as string)

warm marsh
#

Put let table at top out of for loop

spare goblet
#

๐Ÿ˜‚

#

so if(true){ //does something
}else return;

wooden lance
#

Thank you

#

That is what i was asking lol

warm marsh
#

Lol

wooden lance
#

This obviously proves that ollie not do english

spare goblet
#

it's fine lmao blobthumbsup

wooden lance
#

lol ye

spare goblet
#

you should read quick.db docs btw

#

they have usage examples there

wooden lance
#

I was starting to feel like screaming cause we were just going in circles lol

#

And i will @spare goblet prob should of looked at that

spare goblet
#

blobthumbsup have a good day blobsmilehappyeyes

wooden lance
#

you too

earnest phoenix
#

Iara

spare goblet
#

yes?

earnest phoenix
#

I don't know why is not working

spare goblet
#

What's not working?

#

I'm p sure it's supposed to be like the name of db

#

and not liek that

wooden lance
#

this'll work right lol

    for (x = 0; x < profanities.length; x++) {
      let settings = new db.table('settings')
      settings.get(message.guild.id)

      if(true){ //does something
      if (message.content.toUpperCase() == profanities[x].toUpperCase()) {
        message.delete()
        message.channel.send(`**Profanity Blocked:** A message by ${message.author} had known profanity words in it and was blocked.`)
        
        let log = message.guild.channels.find(`name`, "logs")
        message.log.send(`**${message.author.username} sent a message with known profanity in it in ${message.channel} and was blocked.**`)
      }
    }else return;
  }
misty anvil
#

@earnest phoenix what's the error?

#

like what is coming up in the console

spare goblet
#

You should test it out blobthumbsup @wooden lance
As I don't know what the objs are

earnest phoenix
#

the db file is empty but says he have already created

wooden lance
#

Okay

spare goblet
#

WAit

wooden lance
#

?

spare goblet
#

Why did you just put if(true)

wooden lance
#

because you told me to

spare goblet
#

you need to check if(thethingyougrabfromdb == true)

earnest phoenix
spare goblet
#

not just if(true)

#

๐Ÿ˜‚

wooden lance
#

omg i am an idot

misty anvil
#

@earnest phoenix can you screenshot the console

wooden lance
#

how is my bot even running

misty anvil
#

like the error that's coming up

#

tbh i feel like it's not new

#

it's like open

#

or something

spare goblet
#

that's sqlite litowee BAHAHA

wooden lance
#

Im even worse at sqlite

spare goblet
wooden lance
#

You wouldn't think thats possible with what you've just seen, but it is

earnest phoenix
#

i did already this

spare goblet
#

You already created the table blobthumbsup

misty anvil
#

^

earnest phoenix
#

Ik

wooden lance
#

^

misty anvil
#

the tables are already created so you don't need to recreate them

spare goblet
wooden lance
#

^ x2

misty anvil
#

so in your code you can basically take out the create blah blah

#

comment it out and it should work

wooden lance
#

im not gonna keep doing ^ just imagine i am

earnest phoenix
#

But i don't know if the username are inserted

misty anvil
#

XD

#

@spare goblet am i allowed to post a link?

earnest phoenix
#

Yes

spare goblet
#

as long as within context yes

misty anvil
#

download that and open the sql file

#

gives you a good gui view of it

earnest phoenix
#

Oh

#

Ok

spare goblet
misty anvil
#

if not you can just console.log your database and see what's in it

#

select * from table

earnest phoenix
#

Ok

misty anvil
#

if you have any q's feel free to pm me, if i can help i will amarihappy : !

wooden lance
#

how on earth do i make a default quickdb dont say, omg, why do i do this.

spare goblet
#

you just require it iirc?

#

like const db = require('quick.db')

#

then you set them one by one

wooden lance
#

i have already did const db = require('quick.db')

#

wait...

#

im a complete idot

#

it requires the value to be true to do it, it could be anything else

spare goblet
#

set it as boolean val

#

like e.g. if command usage is
?setantispam on/off

const setto = args[0].toLowerCase() === "on" ? true : false

#

or something

#

then make it set by setto

wooden lance
#

oaky

#

omg how does this autocorrect think okay should be oaky

#

im done

#

im goin to bed

#

Thank you for all your help @spare goblet

spare goblet
#

np blobthumbsup night

wooden lance
#

MegaThonk ooo emote

#

anyway bye

earnest phoenix
#
    at apex.user.then.data (e:\somestuff\index.js:42:91)
    at process._tickCallback (internal/process/next_tick.js:68:7)
warning.js:18
(node:7872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
warning.js:18
(node:7872) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

var db = new sqlite3.Database('registers.sqlite');```
#

@spare goblet i know you can help me ๐Ÿ˜ƒ

#
                    if(!row){
                        msg.reply("user not registered");
                        }else{
                            msg.reply("user registered");
                        }
                    })```
spare goblet
#

db.run() is not a function

earnest phoenix
#

and what should i use?

spare goblet
#

p sure its something like this in sqlite3:

db.each(`SELECT ....`, function(err, row) {
if(!row){
msg.reply(`not registered`)
}else{
//something else
}})```
warm oak
#

hay i think p orably stumbled into someting realy werid i have a void thats ment to run random numbers but it keeps running the same string of random numberrs

spare goblet
#

send code/error pls

#

also lib/language?

dawn lark
#

@spare goblet can you help me i cant play my bot in my server

spare goblet
#

wdym you can't play your bot

#

what language/library

dawn lark
#

haydra

warm oak
#

c# its working fine just it keeps throwing up the same numbers

fiery birch
#

hey friendo, you should go to their support server

warm oak
#

i forgot how you show code on this

spare goblet
#

what kastel said blobthumbsup

earnest phoenix
#
        const args = msg.content.split(/ +/g);
        const username = args[1];
        const platform = args[2];
        const me = msg.author;
        if(username)
        {
            if(platform)
            {
                console.log(`SELECT * FROM accounts`);
                console.log(db);
                const data = apex.user(username, platform).then (data => {
                    db.each(`SELECT * FROM accounts WHERE "discname" = "discname" AND "apexname" = "apexname"`), function(err, row) {
                    if(!row){
                        msg.reply("user not registered");
                        }else{
                            msg.reply("user registered");
                        }        
                    }
                })
            }
        }
    }```
#

this command it's doing nothing

warm oak
#

public int roleDice(string StatName)
{
int DiceSum = 0;
int[] diceRoles = new int[6];
Random rnd = new Random();
diceRoles[0] = rnd.Next(1, 20);
for (int i = 1; i < diceRoles.Length; i++)
{
diceRoles[i] = rnd.Next(1, 20);
while(diceRoles[i] == diceRoles[i-1])
{
diceRoles[i] = rnd.Next(1, 20);
}
DiceSum += diceRoles[i];
}

        Array.Sort(diceRoles);
        statText += StatName + ": "+DiceSum+"= "+ diceRoles[1] + "+ " + diceRoles[2] + "+ " + diceRoles[3] + "+ " + diceRoles[4] + "+"  + diceRoles[5] + "\n";
        DiceSum -= diceRoles[0];

        return DiceSum;
    }
#

why is this thing just giveing me the same number

spare goblet
#

is it console logging anything @earnest phoenix ?
console.log(SELECT * FROM accounts);
^ this doesnt do anything other than put this in log: "SELECT * FROM accounts" so i'm not sure what you're trying to do here

earnest phoenix
#

i know that console thing

#

idk what i was trying to doing

spare goblet
#

not sure why it's you need to name it const data and not sure what apex is

earnest phoenix
#

where?

spare goblet
earnest phoenix
#

it's from apex-api

spare goblet
#

why const data
why not just run the function blobsmilesweat

earnest phoenix
#

the database is empty

#

is not inserting anything

spare goblet
#

thats because you didnt make it insert anything ๐Ÿ˜‚

#

INSERT INTO table ...

earnest phoenix
#

I'm an idiot ๐Ÿ˜ƒ

wooden lance
#

im more of an idot

earnest phoenix
#

is not inserting anything

#
        const args = msg.content.split(/ +/g);
        const username = args[1];
        const platform = args[2];
        const me = msg.author;
        if(username)
        {
            if(platform)
            {
                console.log(`SELECT * FROM accounts`);
                console.log(db);
                db.each(`SELECT * FROM accounts WHERE "discname" = "discname" AND "apexname" = "apexname"`), function(err, row) {
                    if(!row){
                        msg.reply("user not registered");
                        }else{
                            db.each(`INSERT INTO accounts (discname, apexname) VALUES (?, ?)`, [msg.author.id, username])
                            msg.reply("user registered");
                        }        
                    }
            }
        }
    }```
spare goblet
#

@earnest phoenix db.prepare() to insert please, mmLol

earnest phoenix
#

=))) i'm an idiot x2

#

still don't want to insert

spare goblet
#

do you know what you're doing?

#

db.each(SELECT * FROM accounts WHERE "discname" = "discname" AND "apexname" = "apexname"), function(err, row) {

earnest phoenix
#

No

spare goblet
#

first of all if the column is called discname, you don't have to change it as a string

earnest phoenix
#

a little

spare goblet
#

it should be a variable

wooden lance
spare goblet
#

also here you're basicalliy selecting everything because you're checking for anything where discname = discname
and so it should be

db.each(SELECT * FROM accounts WHERE discname="itshouldbesomethingelseotherthandiscname" AND apexname="itshouldbesomethingelseotherthanapexname")

#

thirdly. why are you making it insert into db if the row already exists?

#

it would make it have mutliple rows/duplicate rows

earnest phoenix
#

i want to make

#

if is already registered to not register

#

if is not , register

spare goblet
#

Yes, I'm pretty aware of that mmLol read my messages above thne

#

is discname supposed to be discord username?

earnest phoenix
spare goblet
#

shouldnt u do it by discordid

earnest phoenix
#

nvm

spare goblet
earnest phoenix
#

done

spare goblet
earnest phoenix
#
        const args = msg.content.split(/ +/g);
        const username = args[1];
        const platform = args[2];
        const me = msg.author;
        if(username)
        {
            if(platform)
            {
                db.each(`SELECT * FROM accounts WHERE "discname" = "msg.author.id" AND "apexname" = "username"`), function(err, row) {
                    if(!row){
                        msg.reply("user not registered");
                        }else{
                            db.prepare(`INSERT INTO table accounts (discname, apexname) VALUES (msg.author.id, username)`)
                            msg.reply("user registered");
                        }        
                    }
            }
        }
    }```
spare goblet
#

do you understand @earnest phoenix

#

if not i'll give an example reeeee

earnest phoenix
#

give an example cuz i'm new and ...... yeah

#

sorry to make you angry

spare goblet
#

``` db.each(SELECT * FROM accounts WHERE discname = "${msg.author.id}" AND apexname = "${username}"), function(err, row) {

#

do you understand now blobsmilesweat

earnest phoenix
#

omg , yeah

spare goblet
#

you were searching it as a string

earnest phoenix
#

i need to note it

#

BRB

exotic tapir
earnest phoenix
#

Send the command

#

Code/error*

spare goblet
#

@exotic tapir can you show us one line before this error?

#

it should be ^^^ pointing at the error and then you should find the code with that syntax error

#

just the line right before your image blobthumbsup

earnest phoenix
#

var db = new sqlite3.Database('./registers.sqlite');

#

the database is empty

#

god bless me

#

to make this work

exotic tapir
#

I don't really know much about coding. But whenever I remove the "); it makes the lines above and below it show errors also

spare goblet
#

@exotic tapir lol remove ")

#

why is that there anywya

earnest phoenix
#

iara my friend , how are you doing ? ๐Ÿ˜ƒ

spare goblet
earnest phoenix
#

i wanthelp

#

=))

#

var db = new sqlite3.Database('./registers.sqlite');
the database is empty
god bless me
to make this work

spare goblet
#

@earnest phoenix Try
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./registers.db')

#

btw the db should be .db, sorry, apparently sqlite3 is different

earnest phoenix
#

.db.run?

#

like this?

mossy vine
#

no

#

registers.sqlite -> registers.db

#

is what they meant

earnest phoenix
#

oh

#

ty

#

i'm done

#

isn't work

mossy vine
#

what does your code look like, and are there any errors?

earnest phoenix
#

no errors

vague chasm
#

log stuff

earnest phoenix
#
        const args = msg.content.split(/ +/g);
        const username = args[1];
        const platform = args[2];
        const me = msg.author;
        if(username)
        {

                db.each(`SELECT * FROM accounts WHERE "discname" = "${msg.author.id}" AND "apexname" = "${username}"`), function(err, row) {
                    if(!row){
                        msg.reply("user not registered");
                        }else{
                            db.prepare(`INSERT INTO table accounts (discname, apexname) VALUES (${msg.author.id}, ${username})`)
                            msg.reply("user registered");
                        }        
                    }
        
        }
    }```
#

db.db is empty

#

var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./db.db')

vague chasm
#

what if you log db

#

is db.db a file or registers.db

earnest phoenix
#

0 tables

#

of course

spare goblet
#

@earnest phoenix If you create a new database, you need to create the tables again.

earnest phoenix
#

ik

#

but

#

they don't create

spare goblet
#

That's why you don't have tables in your database because you created a new database.
Just make it so that it creates a table if it doesn't exist, for example
CREATE TABLE IF NOT EXISTS registers (discname TEXT, apexnameTEXT)

#

etcetera, etcetera

earnest phoenix
#

ok

spare goblet
#

Also you need to create a file called like, e.g. registers.db or something
I don't use sqlite3, you should check the docs as I've suggested earlier, there's a lot of examples on the github page.

earnest phoenix
#

still 0

earnest phoenix
#

Mongodb is easy to use

#

Should i try it?

exotic tapir
#

I was trying to edit some stuff earlier and prob did it by accident. what file is it under? i dont understand what it is saying? @spare goblet ty

spare goblet
#

@exotic tapir It should be in loader.js or in loader.js it requires guildMemberAdd.js and is used in loader.js

#

So I think it should be in guildMemberAdd.js or loader.js

exotic tapir
#

Loader is in nodes or where?

quartz kindle
#

whats your current error? you removed the ") that should have fixed the error you first posted

spare goblet
#

@exotic tapir blobthumbsup once u remove the ") in the area it mentioned u should be ok

half perch
#

Can anyone tell me what function (for Discord.js) removes a bot from a server. I don't mean the event when the bot is removed

#

I have tried things like message.guild.guildDelete() but it always returns that that's not a function?

quartz kindle
#

you could find it in 10 seconds if you look at the docs

half perch
#

Oh. I'm stupid

#

Thanks

vague chasm
#

not 10 seconds when you have a bad laggy pc

stray garnet
#

yo can someone make a Backdoor Command?

cursive dagger
twilit rapids
#

I mean, if you would pay me to do it, sure...

mossy vine
#

backdoor command..?

spare goblet
#

what's a backdoor command NyaWot we can guide you, but cannot make you one. blobthumbsup

twilit rapids
#

If they pay we can

stray garnet
#

@spare goblet Creates an Invite to a Server where the Bot is in. Bound to my ID Of cause

twilit rapids
#

That's like

cursive dagger
#

Against ToS

#

btw

twilit rapids
#

Fetch a channel of that server, create the invite

#

and it's against ToS indeed

stray garnet
#

But when it's bound to my ID?

twilit rapids
#

What do you mean by that

cursive dagger
#

Still against ToS

stray garnet
#

Okay....

spare goblet
#

It's an unneccessary thing/privacy breach blobthumbsup so it's not allowed. I suggest you read discord tos and devloper page

stray garnet
#

k

broken elm
#

e

rugged kelp
earnest phoenix
#

@rugged kelp Invalid permission

rugged kelp
#

What is not good ?

earnest phoenix
#

MANAGE_MEMBERS

#

Doesn't exist

rugged kelp
#

ADMINISTRATOR ?

#

is good ?

earnest phoenix
#

MANAGE_SERVER

#

or BAN_MEMBERS

rugged kelp
#

Yea :/

broken elm
#

or BAN_MEMBERS

#

yea

#

sowwy didnt see that

spare goblet
rugged kelp
#

thanks โค

broken elm
#

uhh

#

json as storage

somber verge
#

i use txts as storage

earnest phoenix
#

?

stray garnet
broken elm
#

do you have a comma after return?

stray garnet
#

Yes.

broken elm
#

semi-colon instead

#

that should be obvious

stray garnet
#

ok

#

Okay still not

mossy vine
#

semicolon isnt necessary in js

broken elm
#

i know...

twilit rapids
#

Can you show the code the error is on? We can only see half of it

stray garnet
#
  if (!channel) return;

  channel.send(`Welcome to the server, ${member}`);```
broken elm
#

thats true

mossy vine
#

you are using return outside of a function

stray garnet
#

so

#

how to fix that?

mossy vine
#

dont use return outside of a function

stray garnet
#

Ok

warm oak
#

how to you run something when the bot frst wakes up

mossy vine
#

put it in the ready event

late hill
#

Depends on what it is

#

You can also run it before the ready event if your bot doesn't have to be ready

west spoke
#

@warm oak what lib

warm oak
#

i whant to load some user settings

west spoke
#

what libary

warm oak
#

its just a class i made

#

sory im new to this

west spoke
#

I cant help you if I dont know what lib you use

zenith sandal
#

I literally just leave it on the code

west spoke
#

Anyways most have a "on ready" sort of event.
If it doesn't I believe you can just put it at the top of the code.

#

I put things like special servers, and filename bases at the top

zenith sandal
#
  if (err) {
        console.error(err.message);
      }
        console.log('Connected to the dbjogos database.');
  });```
west spoke
warm oak
#

i put it at the top nothing happned

west spoke
#

I again, need to know what libary you use. Js? Py?

zenith sandal
#

what language you're using to code

warm oak
#

c#

west spoke
#

so java but less gay. Ight.

warm oak
#

im scred of java

zenith sandal
#

c# is boneless java :kek

warm oak
#

it runs unity

west spoke
#

Python exists

#

Javascript exists

dry oracle
#

how to do a command named myperm who say all the perm i have

warm oak
#

i like c#

zenith sandal
#

I hate js but for this kind of project its a necessary evil, you have to use the right tools for the right jobs

#

on work I code in Java and C#

west spoke
#

@dry oracle check user perms, loop over every one, and list them.

dry oracle
#

Yeah but idk how to do this

#

Do u have an example ?

west spoke
#

Google

earnest phoenix
#

discord.net wont work with mono, that includes unity @warm oak

warm oak
#

yes

dry oracle
#

There is not an example in google

#

Just for 1 permission i need an example

earnest phoenix
#

hmm

west spoke
#

@ember flame no spon feed

opaque eagle
#

:(

#

I'd just tell them to take a look at GuildMember#permissions... then it'll be their job to look at the docs to figure out how to use it.

dry oracle
#

Something like this

earnest phoenix
#

.

loud salmon
#

dbl dotpost

covert turtleBOT
#

Please do not post random punctuation marks or letters to clear your messages and/or to get attention. This is considered spam as you are not contributing anything to the conversation. Should you need to get the attention of the chat, simply start by saying hello. Should you need to clear your messages, right click on the channel then click "Mark As Read"; this can be done from mobile by holding down on the channel. Further offences will result in the appropriate consequence.

loud salmon
#

ugh

#

who tf uses a semicolon

#

in the current year

opaque eagle
#

I don't know; some might.

loud salmon
#

fuck off

topaz fjord
#

@loud salmon The SAT uses a semicolon in this year

loud salmon
#

good thing I dont take it

topaz fjord
#

I do

#

I cri

#

Next year

loud salmon
#

young boye

tight heath
#

Semicolons nearly died out; nearly!

west spoke
#

@ember flame I dont use js and you dont have to ping me twice jesus

wide ruin
#

in js, how do i get the first 2 numbers in a string

#

but in a way where if i do this is some text 5 and this is more text 17 it gives 5 and 17

tight heath
#

regex ftw

wide ruin
#

never heard of it

limpid raptor
#

maybe with for(if(args !== NaN)) but i don't know how to use it

tight heath
#

it's a bit overkill for your current problem, but definitely needed to learn at one point

#

so why not try it now

fleet horizon
#

Does anybody know the amount of reactions which can be removed in a time span before getting rate limited?

tight heath
#

just use the remove all thingy?

fleet horizon
#

I need to leave one though so that users can use it to quickly react that.

tight heath
#

remove all, and then add that one back?

#

still rate limit friendlier

#

otherwise it's probably the normal per route thingy of 60 per minute

fleet horizon
#

It is for a quiz so there are multiple reactions in a short timespan, and having to add up to 10 reactions back would take too long

#

The best option is probably to just not remove them if their are too many users

#

Thanks for your help!

wide ruin
#

ok so how do i use a regex here?

stray garnet
#

@loud salmon hm; me

slender thistle
#

off topic ๐Ÿ‘€

wheat jolt
#

dbl dotpost

earnest phoenix
#

?

wheat jolt
#

yh

gaunt blade
#

Who's good in brain.js? I need some help with like learning it stuff and making it decide and think by itself.

summer light
#

how do i make a bot give a role as soon as someone joins

earnest phoenix
#

In the guildMemberAdd events @summer light

summer light
#

?

#

dk wut that is

#

im new

#

so idrk

twilit rapids
#

Read the docs

summer light
#

?

earnest phoenix
#

})```
summer light
#

oh wut the

earnest phoenix
#

Just add member.addRole(roleid)

#

or put a const in ()

#

put you need to fine it

#

read docs if you need help about something

lofty hamlet
#

Hi i have an array :

["Test", "Ball", "Ouai","Test", "Test","Roubla", "Rou","Ta", "Roubla",]
How can I make this send me what I have in several times ?

Thx for responses

slender thistle
#

"in several times"?

lofty hamlet
#

That I have several times *

slim heart
#

how am i meant to remove a reaction of a message from the messageReactionAdd event? Ive looked through everything provided. I looked at MessageReaction ReactionEmoji and shit i cant find it idk

wheat jolt
#

@lofty hamlet So, you want to send each object one time?

#

so you get:
Test
Ball
Ouai
Roubla
Rou

#

Ta

#

?

lofty hamlet
#

@wheat jolt no ahah i say :

#

I want send the object who i have in several times

wheat jolt
#

oh

lofty hamlet
#

So ?

earnest phoenix
#

What

#

What object??

#

and wym by "in several times"

lofty hamlet
#

Here i want say :

Test x3
Roubla x2
amber fractal
#

He wants to get duplicates

#

And say how many times they're in it

worn monolith
#
const Discord = require('discord.js');
const bot = new Discord.Client();

if(message.content.includes('ping')) {
    message.reply('pong');

bot.login('token');

Got an error on run:

if(message.content.includes('ping')) {
^

ReferenceError: message is not defined
    at Object.<anonymous> (/home/ubuntu/test.js:4:1)
    at Module._compile (module.js:652:30)
    atObject.Module._extensions..js (module.js:663:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3```
unique nimbus
#

have you defined message?

#

I don't know js

#

but you haven't defined message

mossy vine
#

okay so that code is absolutely fucked

#

let me guess

#

you are copying and pasting random stuff?

dusky marsh
#

Looks like it

worn monolith
#

no, it worked when it was just this:

    if(message.content == 'ping') {
        message.reply('Pong');
    }
});```
but that just makes "ping" a command with no prefix, I want it to say Pong even if "Ping" is in a sentence.
#

I found that message chunk on stack overflow. Figured it would work

warm marsh
#

Probably not a good idea.

worn monolith
#

Of all people I would have expected y'all to catch that I forgot the "bot.on" definer before I did. and stuff when I pasted the new code in. rip, its working. thanks ig

warm marsh
#

You only posted if() nothing else.

worn monolith
#

wdym? its a full 3 lines of code

#

doesn't matter, its working now so its fine

warm marsh
#

Post more code in the future or even better, Learn the code before copying and pasting.

keen karma
#

If

late hill
#

Most people that know what they are doing use multiple files with exports and such, so many times the "bot.on.." part wont be there

#

If you just post random code in here

#

We assume you put that piece of code where it's supposed to be

#

But yeah as Dillon said

#

Don't just paste random code

#

Looking at your first piece of code, you have no idea what you're doing

#

Look up some stuff and start simple

lofty hamlet
#

Hi i have an array :

["Test", "Ball", "Ouai","Test", "Test","Roubla", "Rou","Ta", "Roubla",]
How can I make this send me what I have in several times ?

Thx for responses

He wants to get duplicates And say how many times they're in it

#

Here i want say :

Test x3
Roubla x2
warm marsh
#

Filter out all the ones that don't happen twice.

mossy vine
#

or if you need the count; loops

warm marsh
#

Nah.

#

No need for loop.

#

@lofty hamlet

let arrayOfItems = [1,2,2,3,3,3].reduce((obj, value) => {
    obj[value] = obj[value]+1 || 1;
    return obj;
}, {});
let duplicated = Object.entries(arrayOfItems)
                    .filter(innerArray => arrayOfItems[innerArray[0]] > 1)
                    .map(innerArray => `${innerArray[0]} x${innerArray[1]}`);
#

Something like that would work, But please don't use that. Learn that code before using it.

#

Also there is a lot of other ways for the same outcome. Just quickest I could think of.

mossy vine
#

right, i keep forgetting about those array methods

warm marsh
#

Missed something inside there, Edited though.

slim heart
#

how can i get the members of a role via api

#

i thought guilds/guildid/roles/roleid

west spoke
#

It would just be guilds/guildid
and go to >roles>users

#

I believe

slim heart
#

a role object doesnt seem to have a users prop

amber fractal
#

Get members

#

Filter array if they have that role

#

That's what d.js does

abstract crow
#

What DBs do you guys all use? (SQL)

prime cliff
#

a single text file

spare goblet
#

I use sql

earnest phoenix
#

postgres for large scale

#

sqlite for small scale

abstract crow
#

I heard postgres doesn't do well with many read only queries, but I don't really believe that

spice mango
#

Etcd

amber fractal
#

I use mongo

olive path
#

So from my understanding, #topgg-api is for the dbl api, so I am gonna ask here, sorry if this is wrong. Is there an API that checks for statements similar to the asked statement? Ie. Bot asks for "hello world" then the API looks for "Hello world", "Hello, world.", Etc

west spoke
#

Um

#

Dbl api is server count, votes, etc.

#

Can you please simplify what you said to dummy levels

olive path
#

Yeah, I'm saying that I'm putting this here instead of #topgg-api because I believe that #topgg-api is specific to that api

west spoke
#

it is.

olive path
#

Lol ok, so is there an API I could integrate to discord.js that would allow the bot to check for things similar to the requested message?

#

I did, which is why I'm saying that I'm not putting that in api lol

west spoke
#

Check if x is in message

olive path
#

I'm just saying that so someone doesn't redirect there even though it's against the rules

#

Yeah but what about like

#

Apostrophes

west spoke
#

Using ' in a bot command that has ' as a base is fine.

#

It would go as '''

olive path
#

Like I want to make an Easter egg so that if someone types "I'm a nerd" (in any format) it responds "Me, too!"

west spoke
#

That's a bad idea

#

Say I said:
Hey "user" I'm a nerd

olive path
#

It's less coming to put in discord then you would think lol

west spoke
#

That cannot be used.

#

Well, not here at least

olive path
#

Less common*

west spoke
#

Its mutable

#

Anything that's not brought by a prefix can get the bot muted.

olive path
#

Yeah, I would prolly add a feature to disable it

west spoke
#

Say bot would respond to hi

#

That gets muted.

olive path
#

Ah ok

west spoke
#

If it gets here it has to be summoned by a prefix.

olive path
#

Must've missed that in the rules, sorry. Thank you for the help!

west spoke
#

For example mine cant just respond to help

olive path
#

Yeah

west spoke
#

It has to respond to prefix help

olive path
#

Yeah, otherwise chaos would ensue lmao

west spoke
#

^

#

Also make it not respond to itself

#

And other bots.

#

We check for it.

olive path
#

Yeah, I have done that

#

Lol thank you!

lofty hamlet
#

Hi how i can send the firsty 10 object in an array

inner jewel
scenic kelp
#

Not tryna be mean but google it

lofty hamlet
#

Thx

#

So i have this :

if (!Dresseurs[sender.id]) return message.channel.send("Erreur : `Vous devez รชtre un Dresseur pour effectuer cette commande : ?start`") let arrayOfItems = Dresseur.Sac.concat(Dresseur.SSac.concat(Dresseur.LSSac.concat(Dresseur.LGSac))).reduce((obj, value) => { obj[value] = obj[value] + 1 || 1; return obj; }, {}); let duplicated = Object.entries(arrayOfItems) .filter(innerArray => arrayOfItems[innerArray[0]] > 1) .map(innerArray => `**${innerArray[0]}** x` + "`" + innerArray[1] + "`\n"); if (duplicated.length == 0) return message.channel.send("Vous n'avez aucun Pokรฉmon en plusieurs fois") message.channel.send(`__Voici les 30 premier Pokรฉmons que vous avez en plusieurs fois :\n\n__` + duplicated.slice(1, 30))
How i can sort by innerArray

#

For exemple i ghave this in screen :

#

I want sort by the "pokรฉmons" that I have the most times

warm marsh
#

Ok

#

Before .map add .sort((z,a) => z[1] > a[1])

lofty hamlet
#

I half understood what you did too ๐Ÿ˜‰ if you can explain me in detail

#

Ok i go test

warm marsh
#

I think. You'll have to play around.

lofty hamlet
#

Does not work ๐Ÿค”

#

You want i make this no ? : let duplicated = Object.entries(arrayOfItems) .filter(innerArray => arrayOfItems[innerArray[0]] > 1) .sort((z, a) => z[1] > a[1]) .map(innerArray => `**${innerArray[0]}** x` + "`" + innerArray[1] + "`\n");

#

@warm marsh

warm marsh
#

Works?

lofty hamlet
#

Nop

warm marsh
#

One sec

lofty hamlet
#

Kk

warm marsh
#

On phone so testing in console a little hard

west spoke
#

disgusting

lofty hamlet
#

Ahah

warm marsh
#

Ye

lofty hamlet
#

@warm marsh you have find ? :d

warm marsh
#

Yeah one sec loaded laptop

lofty hamlet
#

Kk

earnest phoenix
#

guys help, I cannot do so that I stream on YouTube help as do?

    bot.user.setActivity('ะŸะพั€ะฝะพ ัะผะพั‚ั€ะธั‚',{ type: "STREAMING", url: "https://www.youtube.com/c/mishaimaev/live"});
    setTimeout(act2, cd);
}
lofty bane
#

hi guys

earnest phoenix
#

you can't @earnest phoenix

topaz fjord
#

You can only use a twitch link @earnest phoenix

lofty bane
#

i want to ask for something

spare goblet
#

Only twitch linkies

lofty bane
#

TypeError: Cannot read property 'send' of null

#

what this mean

earnest phoenix
#

and I saw the YouTube broadcast

#

what you probably saw was rich presence on a user and not streaming activity

amber fractal
#

Whatever you are trying to use .send on, hopefully a channel, is null

lofty bane
#

yea

topaz fjord
#

iara lurker ๐Ÿ‘€

spare goblet
earnest phoenix
#

...

spare goblet
#

At bot.js or a file required in there, there's a property .send() that's null

amber fractal
#

Br0 wot?

#

The channel he is trying to send to is not defined

topaz fjord
#

Can you show code @lofty bane

lofty bane
#
client.on("reachLimit", (limit)=> {
ย  let log = limit.guild.channels.find( channel => channel.name === "log");
ย  log.send(limit.user.username+"\** server ** ");
ย  limit.guild.owner.send(limit.user.username+"\** server ! ** ")
ย  limit.member.roles.map(role => {
ย  ย  limit.member.removeRole(role.id)
ย  ย  .catch(log.send)
ย  });
});
#

yup

spare goblet
#

Yeah that's what I said

topaz fjord
#

I don't think reachLimit is an event

spare goblet
#

There's a property that it's trying to run a method, .send() that's undefined

topaz fjord
#

What lib are you using

spare goblet
#

That's what I said kellyhmm

amber fractal
#

It seems like your saying the method itself is undefined

earnest phoenix
#

and how to stream and to display photos in your profile?

amber fractal
#

Not the channel object

lofty bane
#

mmmmmm

amber fractal
#

@earnest phoenix rich presence

topaz fjord
#

@earnest phoenix only users can set custom stuff like that

#

Bots aren't allowed to

spare goblet
#

Well then your misperception of my words were not my intention and I apologize

lofty hamlet
#

@warm marsh i do disconnect i go sleep ๐Ÿ’ค you havn't the response for good sleep lmao ?

warm marsh
#

Yeah

#

got it.

lofty hamlet
#

๐Ÿ˜ฎ

lofty bane
#

Fixed

#

ty โค

warm marsh
#

will send in one sec

lofty hamlet
#

๐Ÿ‘€

warm marsh
#

can't copy from terminal, Getting slight salt.

lofty hamlet
#

Oof

spare goblet
#

@lofty hamlet please don't send singleworded out of context emojis here thanks, leave in #memes-and-media blobsmilehappyeyes

lofty hamlet
#

Hu ?

#

@spare goblet this is not out of contex @warm marsh respond to me

slim heart
#

Yes but youโ€™re just adding pointless comments (listen to the mod donโ€™t try and argue ๐Ÿ‘€)

lofty hamlet
#

Calm down

warm marsh
#
let count = array.reduce((obj, value) => {
    obj[value] = obj[value] + 1 || 1;
    return obj;
}, {});

let sorted = Object.keys(count)
                .filter(key => count[key] > 1)
                .sort((a, z) => count[a] < count[z])
                .map(sorted => `${sorted} \`x${count[sorted]}\``);```
#

Brain isn't fully functional but that should fix that error.

lofty hamlet
#

Does not work

#

He does not sort

#

@warm marsh

fiery stream
#

That's jess.

#

Jess.

#

Jess.

#

Jess.

slim heart
#

dont spam pls

fiery stream
#

Ops sorry.

warm marsh
#

See, It worked perfectly fine inside on browser console.

lofty hamlet
#

๐Ÿค”

warm marsh
#

but when triied inside of node just broke.

west spoke
#

node and browser are different

lofty hamlet
#

:/

fiery stream
#

Jess

spare goblet
#

It isn't using tools that Node doesn't have tho, neko

warm marsh
#

Yeah, The code is the same.

fiery stream
#

Omg

spare goblet
#

Jazz please don't spam

#

Thanks blobsmilehappyeyes

west spoke
fiery stream
#

sorry okay im not now

warm marsh
#

same code just in browser:

#

doesn't sort the array.