#development

1 messages Β· Page 431 of 1

unique solar
slender thistle
#

Oh.

#

Thanks. πŸ‘€

#

Yep, got what I need. Much thanks! πŸ‘

unique solar
#

np

slender thistle
#

When you forget to await asyncio.sleep() so your bot spams your DMs and gets ratellimited. bloblul

coral egret
#

wall of text
yoU FORGOT TO AWAIt

shy verge
#

why does pylint suck at linting

old glade
#

Is there a way to change an app name ?

#

in discord I mean ?

#

globally

#

ie : my bot name is Coinbot and I wanna change it to Koinbot

gilded blaze
#

The lib your using should have a name function

old glade
#

i'll look at it

gilded blaze
#

by either using the client or client user

tall falcon
#

@mental solstice Nevermind I found a solution. I added a substring so when the user triggers the bot with "@" it uses the second api for replies but if the message contains "@!" It uses discords API

#

In short term just added a substring

pearl sandal
#

.

tepid laurel
#

What the double flip flop

feral matrix
#

perms.js

var ranksContent = require('./ranks.json');
var ranks = [ ranksContent ];

if (ranks.some(rank => rank.hdevs === msg.author.id )) {
  msg.channel.send("You are a head developer | Permission level: `7`")
} else {
  if (ranks.some(rank => rank.devs === msg.author.id )) {
    msg.chanel.send("You are a developer | Permission level: `6`")
  } else {
    if (ranks.some(rank => rank.managers === msg.author.id)) {
      msg.channel.send("You are a manager | Permission level: `5`")
    } else {
      if (ranks.some(rank => rank.hadmins === msg.author.id)) {
        msg.channel.send("You are head an administrator | Permission level: `4`")
      } else {
        if (ranks.some(rank => rank.hmods === msg.author.id)) {
          msg.channel.send("You are a a head moderator | Permission level: `3`")
        } else {
          if (ranks.some(rank => rank.mods === msg.author.id)) {
            msg.channel.send("You are a moderator | Permission level: `2`")
          } else {
              msg.channel.send("You are a user | Permission level: `1`")
          }
        }
      }
    }
  }
}

ranks.json

{
  "hdevs": [ "231733082804322304" ],
  "devs": [ "208639802231226368" , "304619179762515968" ],
  "managers": [ "297433416998191127" ],
  "hadmins": [ "260470661732892672" ],
  "admins": [ "116930717241311236" , "217006264570347520" ],
  "hmods": [ "294129532531638272" ],
  "mods": [ "188013936442867713" , "227110473466773504" , "338024531098861569" , "145557815287611393" , "447856788885471242" , "393857965536313345" , "252001272146821120" , "386941684723744768" ],
  "trustedusers": [ "241723504620339201" , "274990180857937922" , "220875646270701568" , "239790360728043520" ],
  "donators": []
 }
#

any ideas why this doesn't work?

spring ember
#

switch

shy verge
#

error pls?

spring ember
#

fucking switch

#

don't chain if and else

shy verge
#

also yeah switch jesus fuck

neat falcon
#

JSON mm

shy verge
#

XML mmLol

spring ember
#

SQL mmLol

feral matrix
#

TXT file mmLol

shy verge
#

Physical Piece of Paper mmLol

midnight widget
#

.YTD file mmLol

frail harness
upper ember
#

.docx file mmLol

slender thistle
#

Oh wait, didn't see Adam's message. LUL

feral matrix
#

about my question ^^^

#

anyone have idea?

slender thistle
frail harness
#

@feral matrix please send the error message

feral matrix
#

there's no error

#

it just says mod is user for example

#

but head developer is gooda

#

and head mod

#

and head admin

#

and manager

#

basically just mods, admins and devs aren't working

halcyon abyss
#

in others world it's always good if array have only one item

#

you're doing

 rank.devs === msg.author.id```
If I read your json correctly, it'll test 
```javascript
[ "208639802231226368" , "304619179762515968" ] == msg.author.id```
#

as if an array can be equal to a string

#

Only special case is when array has one elem

#

That way, [ 2] == 2 will return true

#

that's why it only works for your arrays who got one elem

west raptor
#

how would i convert ms to h-m-s

#

i tried humanize

#

didnt work

halcyon abyss
#

do it manually ?

eager perch
#

Help :(

If you use iframes, you need to use at least 300 more characters..
#

Yes I use an iframe, but what would I need to add?

upper ember
#

Idk

#

β€œhello and welcome to this mean-less content, he is here only because I use iframe and I need to add at least 300 words, I hope you enjoy reading this becauseI enjoyed writing this”

#

Add this joi ^

eager perch
#

I don't want it on my page though.

#

Comments

upper ember
#

Hmmm

eager perch
#

Thanks

upper ember
#

So... hm... add mean-less <style>

topaz fjord
#

nah

#

when u put a iframe

upper ember
#

Like... re-write the original page <style>, so it won’t effect the page but it will do those 300 words

topaz fjord
#

u need the 300 characters + 300 more

gusty topaz
#

also if you chain if else. please dont do it

if (condition) {

} else {
    if (condition) {

    }
}

Instead fo

if (condition) {

} else if (condition) {

}
eager perch
#

"Haha I do that"

mental solstice
#

Why else if, instead of another seperate if statment

pure sorrel
#

Because what if both conditions are true?

#

If you only want one of the two to run, then you do else-if

mental solstice
#

Or else

#

Idk. I've never seen a better reason to use else if, over if.. usually makes the code look sloppy.. so im just curious as to why

glossy mason
#

Example of why to use else if:

// my fancy robot that jitters because it's evaluating both statements separately 
if (FORWARD_BUTTON) {
    MOVE_FORWARD();
} else {
    STOP_MOVING();
}

if (BACKWARD_BUTTON) {
    MOVE_BACKWARD();
} else {
    STOP_MOVING();
}


// my fancy robot that doesn't jitter
if (FORWARD_BUTTON) {
    MOVE_FORWARD();
} else if (BACKWARD_BUTTON) {
    MOVE_BACKWARD();
} else {
    STOP_MOVING();
}

I could instead do this:

// my fancy robot that doesn't jitter
if (FORWARD_BUTTON) {
    MOVE_FORWARD();
} else {
    if (BACKWARD_BUTTON) {
        MOVE_BACKWARD();
    } else {
        STOP_MOVING();
    }
}

But as I add more statements (maybe I want to go left or right) it gets nested very deep making it harder to follow and understand. Also let's say I decide I no longer want the robot to be able to go backwards, I can simply remove that else-if without having to go through and fix formatting.

mental solstice
#
If (FORWARD_BUTTON)
    MOVE_FORWARD;
If (BACK_BUTTON)
    MOVE_BACK;

STOP_MOVING;
glossy mason
#

It would be in a while loop since it keeps going through and checking if a button is released, or if the user pushes a new button. Even if yours was in a loop, it would jitter since you are giving the motors power and then cutting it (I'm not making this up, this has been a real issue with improper programming in my robotics club).

#

An actual simple program for these robots would look like:

#pragma config(Motor, port1, motor1, tmotorVex393_HBridge, openLoop, awesomeMotor)

task main()
{
    while (true)
    {
        if (vexRT[Btn8U])
        {
            motor[awesomeMotor] = 127;  //set motor power to 127
        }
        else if (vexRT[Btn8D])
        {
            motor[awesomeMotor] = -127;  //set motor power to -127
        }
        else
        {
            motor[awesomeMotor] = 0;  /set motor power to 0
        }
    }
}
violet wyvern
#

Hi, how do I do for my bot only to have certain commands in servers where someone voted for it?

quasi hearth
#

u need the dbl api

normal frost
#

ok the bot keeps making me loose on crash even though i hit stop before it said i lost

pure sorrel
#

^^^^

shy verge
pure sorrel
#

(Actual robot code is more command-based, obviously, but that is valid robot code)

If you did what Uncle did, the robot would move and stop constantly since it's doing both MOVE_FORWARD and STOP_MOVING every time. If you pressed both the forward and the back button, it would go forward, go backwards, and stop, all within a few milliseconds.
It is very rare that you actually use separate if statements; else-if are easier to debug and are much less buggy. The only time you use separate if statements is in the same situations where you wouldn't use the break keyword at the end of a case in a switch statement.

mystic stone
#

Does anyone here actually send sharded stats?

trim plinth
#

yes

mystic stone
#

argh

trim plinth
#

a lot of people do

mystic stone
#

what's the point of it? If my bot knows its total guild count can it just keep sending that?

trim plinth
#

probably more accurate with sharded stats

mystic stone
#

More accurate how, what?

trim plinth
#

idk

#

just in theory

#

don't take my word for it

#

β„’

mystic stone
#

ok

#

I guess it's very useful if you have independent shards that only know their own guild count, you could have each shard send its own stats

earnest phoenix
#

i'ved receive error
Error: EACCES: permission denied, open '../server.json'
how to fix that? 😦

#

using glitch

trim plinth
#

server.json Thonk

earnest phoenix
#

its name of file connect from write Json when command called.

#

i use json like autorole its working fine

#

this new json file need permission

trim plinth
#

don't use json as a db πŸ‘€

earnest phoenix
#

@trim plinth use sqlite?

trim plinth
#

doesn't have to be sqlite

#

there's mysql, postgresql, rethinkdb, mongodb, etc

earnest phoenix
#

i usually using sqlite.. when i arrange the code.. my brain dizzy.. πŸ˜‚ #cadet

are sqlite have many diffrence with another db services?

#

or same?

trim plinth
#

well not a lot of differences I'd think if you're talking about sql databases

#

NoSQL dbs are a different story

shy verge
#

every noSQL lib is a special snowflake

trim plinth
shy verge
#

and most noSQL dbs require a server instance

#

SQLite is probably the best embedded db

#

period

night imp
#

better-sqlite3 for node

earnest phoenix
#

hello.. i want ask (again).

why this code to get server id from config.json not working?


function getroles() {
  for (let index = 0; index < servers.length; ++index) {        
    bot.guilds.get(servers).roles.find('name', config.roleName)```

servers.json file :
``` "servers": ["430720567675453440", "441923029140897792"],```

error console : 
```TypeError: Cannot read property 'roles' of undefined
9:24 AM```
sick cloud
#

From what I see:

bot.guilds.get(servers)

..your trying to get a guild from an array of IDs, which won't work

earnest phoenix
#

@sick cloud from const servers = config.servers;

#

how can work?

sick cloud
#
const servers = config.servers;

servers.forEach(id => <client>.guilds.get(id).roles.find('name', 'name here'))
// => <role>, <role>

iirc, something like that should work.

frail harbor
echo turret
#

How do you get roles around here?

native narwhal
#

You can get the bot developer role if you submit a bot you have created

echo turret
#

I created but I don't have resources to host it .

#

That's why I'm here.

native narwhal
#

That's unfortunate

#

I reckon there are a few hosts you can get for free but they aren't very good

slender thistle
#

SkySilk. thonk_think

fluid basin
#

Glitch for nodejs or heroku

muted gust
#

if you have a computer somewhere that you dont use much, you can use that as a host, i used a random laptop as a host for my Discord Bot

fluid basin
#

Even though they are great for starters, you should get a proper host when your bot gets bigger

native narwhal
#

I have like 5 laptops which are like 8 years old, do you think I can run a shard on each mmLol

fluid basin
#

If you choose a computer you'll need to ensure it can run the entire day as well

muted gust
#

a laptop is a suprisingly good idea, and if you can get some backup data from a phones hotspot, the bot can still run if your power goes out

quasi marsh
#

Or actually just get a VPS

#

Maybe 2 if you want to be really redundant

frail kestrel
#

A PHONE

#

A

#

connecting to random hotspots

uncut slate
#

that's not what he meant

#

using your phone as a hotspot

frail kestrel
#

oh

earnest phoenix
#

hi

native narwhal
#

Did you perhaps mean to send that in #general ?

fluid basin
#

Its k joakim

#

Do you need help with anything @earnest phoenix?

earnest phoenix
#

my bot is not added

slender thistle
#

If you submitted it, just wait.

native narwhal
#

It can take up to a week (Right now it takes longer than usual so just be patient)

fluid basin
#

It will be added once its approved

spring ember
#

quick question: can you get the subsetest class of an instance? Java

#

ok I found there is instanceof in Java

#

problemo fixedo

sour saddle
#

What's the difference in user mentions with <@UserID> vs <@!UserID>?

umbral pelican
#

! is if they have a nickname

halcyon abyss
#

it displays the nickname even without the ! tho

earnest phoenix
#

hello.. anyone know command get console.log send it channel text chat?

#

discord.js

halcyon abyss
wet ferry
#

Why do I get an error when I do this?

for(i = 0; i = data.maxemoji[message.guild.id]; i++){
      var item = Math.floor(Math.random()*emojis.length);
      console.log(emojis[item])
      message.react(emojis[item]) 
      emojis.splice(item)
    }

data.maxemoji[message.guild.id] = 10

emojis = ["πŸ’―","πŸ˜ƒ","πŸ†’","448998892718260224","415240771332210708","448998892328189980","420354639570141184","448998889698099221","😱","πŸŽ‰"]

uncut slate
wet ferry
#

no the for works, the message.react gives me this error:

TypeError: Emoji must be a string or Emoji/ReactionEmoji

But i logged it, and it is an Emoji/ReactionEmoji

gilded blaze
#

it is probably πŸ†’

wet ferry
#

??

gilded blaze
#

I think it is a compound emoji (or whatever it is called) so it doesn't recognize it

wet ferry
#

it happens every time i try

#

it works with my old code

gilded blaze
#

Well which emoji is giving the problem

wet ferry
#

but I added a new command

#

all emojis

uncut slate
#

the for loop isn't entirely correct, you want a < instead of an = for the second statement

gilded blaze
#

^

topaz fjord
#

No

wet ferry
#

no

topaz fjord
#

Afaik

#

You can't use ids

#

You need the <> thingy

wet ferry
#

no not for reactions

#

It worked on my old code

slender thistle
#

<:emojiname:emojiID>?

wet ferry
#

nope

topaz fjord
#

Like that

gilded blaze
#

^ might work

wet ferry
#

not for reactions

topaz fjord
#

What shiv said

slender thistle
wet ferry
#

you need the id only

topaz fjord
#

That's how reactions are supposed to be zoomeyes

wet ferry
topaz fjord
#

Can you at least try it without telling us we are wrong

maiden geyser
#

when i do 6+6*6 it says invalid syntax

wet ferry
#

i did

gilded blaze
#

ids work

wet ferry
#

^

gilded blaze
#

at least in discord.js

maiden geyser
#

when i do 6+6*6 it says invalid syntax

wet ferry
#

i'm in d.js

#

@maiden geyser i tried in #commands it works for me

maiden geyser
#

:\

#

ill try again

wet ferry
#

idk what case your using it in, but in eval it works for me

topaz fjord
#

Did you console.log the emoji

wet ferry
#

yes

#

it shows the emoji

maiden geyser
#

oooh i did 6+6&6

wet ferry
#

lol

maiden geyser
#

nvm

gilded blaze
#

One of your ids might be incorrect

wet ferry
#

it doesn't work with any emoji

gilded blaze
#

oh

wet ferry
#

click on my avatar and click jump

#

it's at the bottom

gilded blaze
#

What is logging?

wet ferry
#

the emoji

gilded blaze
wet ferry
#

look at the code

#

the random emoji

gilded blaze
#

strange

wet ferry
#

ikr

#

Fixed!

cyan condor
#

How do I make a bot?

topaz fjord
#
  1. learn a coding language
shy verge
#

what programming language do you want to use

cyan condor
#

Idk

shy verge
cyan condor
#

Thx

shy verge
#

there's this one too

#

pick a language and learn it

#

come back when you know your way around a good language

#

also pick c# instead js is shit

cyan condor
#

Ok

shy verge
#

also Java sucks too don't use that mmLol

native narwhal
#

Java is great

shy verge
#

no

#

if you wanna use java then use c#

grizzled sequoia
#

Java is nice and has its uses

#

If you wanted to make use of the JVM I'd recommend Kotlin

#

Syntax is nice and has a few things that Java doesn't

#

Fundamentally they both translate into the same bytecode

#

So performance should be equal

ruby dust
#

how do people make redirect uris? mine for example shows unkown error

native narwhal
#

I like Java's syntax more than Kotlin's

slender thistle
grizzled sequoia
#

Kotlin seems to reflect Python a little more - the way you can access arrays in Kotlin and also filter them etc is a little cleaner than Java IMO

native narwhal
#

We are not saying any language is better than any other we are just talking about our opinions on languages

grizzled sequoia
#

@slender thistle It's a civil discussion, I'm providing my opinion on why I use Kotlin/prefer it over others

slender thistle
#

Tryna backseat mod here, don't mind me.

grizzled sequoia
#

smh lol

native narwhal
#

Leave the modding to the mods

grizzled sequoia
#

Slowly moving my bot to Kotlin, 64.6% Java, 35.4% Kotlin ^^

native narwhal
#

πŸ˜‚

grizzled sequoia
#

One of the things I do like in Kotlin is string interpolation

#

I'm used to things like ```js
console.log(error: ${error})

#

Or ```py
print(f"Hey {username}!")

native narwhal
#

Ah

grizzled sequoia
#

Being able to do ```kotlin
"Error in x: $err"

is very nice
native narwhal
#

I have been programming in Java for 4 years so I have never done such things πŸ˜‚

grizzled sequoia
#

Not sure how performance fares though lol

#

Kek

#

If you ever find time, give Kotlin a try :)

native narwhal
#

Might do

#

Do you have a github? :P

grizzled sequoia
#

I do

native narwhal
#

Oo, I have been on your profile before. I was browsing through like Aeth's github and then it led me to you somehow

grizzled sequoia
#

lol

violet wyvern
#

Hi, how do you use DBL api? DM me or mention me if you know pls (I'm gonna be offline for 10 mins)

grizzled sequoia
#

@violet wyvern You posted that a few minutes ago πŸ€”

violet wyvern
#

?

grizzled sequoia
#

That message

violet wyvern
#

I did?

grizzled sequoia
#

sec

violet wyvern
#

oh

#

sry

#

it was my brother 🀦 He knew I needed help with that

topaz fjord
#

classic excuse

shy verge
earnest phoenix
#

how to change channel name with js?

shy verge
#

docs\β„’

earnest phoenix
#

can js make find channel with includes text?
example : newUser.guild.channels.find.includes('name', 'Member :')

topaz fjord
#

No need for .includes

earnest phoenix
#

yes.. i want change channel name including some "words". Any code for this command?

knotty steeple
#

how much messages should i make my bot/discord.js cache?

uncut slate
#

depends on how much advantage you personally have from a cache

#

if you don't fetch past messages alot, 0

knotty steeple
#

hmm ok

earnest phoenix
#

anyone can teach me how to create a watch.json i using glitch but his always auto restart

trim plinth
#

@earnest phoenix use this ```json
{
"install": {
"include": [
"^package\.json$",
"^\.env$"
]
},
"restart": {
"exclude": [
"^public/",
"^dist/"
],
"include": [
"\.js$",
"\.json"
]
},
"throttle": 900000
}

earnest phoenix
#

@trim plinth thanks, i will try it

trim plinth
#

np

earnest phoenix
#

its working thanks

buoyant tinsel
#

Which is better. JS or Python?

quasi marsh
#

Honestly it's subjective

inner jewel
#

depends on what you want to do

buoyant tinsel
earnest phoenix
#

@buoyant tinsel if ur gonna make a "good" bot use both

#

πŸ‘Œ

quasi marsh
#

Python however, has an unorthodox syntax compared to most other languages

inner jewel
#

no need to use both to make a good bot

quasi marsh
#

Knowing both is someone I would advise

quartz kindle
#

both can do basically everything you'll ever need

quasi marsh
#

At least Javascript is still a nice skill to have

inner jewel
#

knowing both helps choosing the most appropriate one

#

but you don't need to use both if you don't want

buoyant tinsel
#

Hmm πŸ€”

quasi marsh
#

Exactly, for example, discord.py has no way to receive audio streams from Discord

#

It can send fine, it cannot listen

buoyant tinsel
#

Onto remaking my bot in Javascript! :v

sick cloud
#

Node.js ftw

shy verge
#

c#β„’

earnest phoenix
#

How would I make node.js inputs output to a website?

inner jewel
#

what

shy verge
#

that's outside of the scope of what we do here

earnest phoenix
#

Wut

inner jewel
#

not really

#

this is development, not bot-development

shy verge
#

fair enough

earnest phoenix
#

So?

#

#bot-development

#

Oh look at that, not a channel!

quartz kindle
#

you have two options basically, either have your website accept inputs via get or post (with proper authorization), or have nodejs itself run the server and serve the page

earnest phoenix
#

@quartz kindle mind helping me in DMs?

#

It would be appreciated greatly yellowhrt

quartz kindle
#

rather do it here so more people can see and input their insights

earnest phoenix
#

Sure,

#

So I have no idea where to even start.

quartz kindle
#

do you have a website?

earnest phoenix
#

I have my host and domain all ready

#

So yep

quartz kindle
#

so set up a php page that listens to GET requests for example

#

in this page.php you'll have something like $data = $_GET["data"]

earnest phoenix
#

Right-

quartz kindle
sick cloud
#

its node.js not php from what I saw? πŸ‘€

quartz kindle
#

your $data variable will have that information

earnest phoenix
#

Well u need php to get the node.js inpits @sick cloud

#

Inputs*

#

Onto a page

sick cloud
#

You can do it with node.js

earnest phoenix
#

Well

quartz kindle
earnest phoenix
#

As long as it works

sick cloud
#

a simple express and ejs setup would work fine and better than php imo

quartz kindle
#

sure, but were assuming he already has an existing website

inner jewel
#

you don't need to use php at all if you have node

quartz kindle
#

another way is to do it the other way around

earnest phoenix
#

My webhost doesnt support nodeoliy

sick cloud
#

rip

quartz kindle
#

set up a node.js server with express or something, and have your php page send a request to your node.js server ip address

earnest phoenix
#

@quartz kindle so I need a vps

#

Then install a webserver on it?

quartz kindle
#

to run node.js yes

earnest phoenix
#

Sounds complex

#

I may just make the node.js save to a text doccument

#

Then make a script that uploads those every 24 hours

quartz kindle
#

you can make node do the uploading

earnest phoenix
#

why my bot have write N/A

quartz kindle
#

no idea

earnest phoenix
fluid basin
#

You didn't post server count

sick cloud
#

@earnest phoenix you aren't posting your server count, or your not posting it correctly.

earnest phoenix
#

Hhmm I've filled it right before the entry, is there any other way?

#

server countThonk

fluid basin
#

You need to do that via your bot

earnest phoenix
#

how, can you teach me? bloblul

fluid basin
earnest phoenix
#

thanks

fluid basin
#

Find your bot lang and the docs are there

earnest phoenix
#

what is discordDBL token?

sick cloud
#

@earnest phoenix found on your bots edit page at the bottom, or the API docs page iirc.

earnest phoenix
#

thonkku i not understand, later i will try it because now i very busy mmLol

heavy rock
#

Use the YouTube v3 api

sick cloud
#

I'm honestly not a fan of the raw API, so trying to avoid it @heavy rock >.>

#

thats my last resort

heavy rock
#

Use an api wrapper if you find one

topaz fjord
#

simple-youtube-api

sick cloud
#

I already use it for my video function, might try it πŸ‘€

stray wasp
#

Why don't you like it?

sick cloud
#
await api.getChannel(args.join(' ').startsWith('https://youtube.com/channel/') ? args.join(' ') : 'https://youtube.com/channel/'+args.join(' '))
        .then(results => {
            console.log(results[0]);

            const embed = new Discord.RichEmbed()
            .setAuthor(results[0].title)
            m.edit({ embed: embed });
        }).catch(console.error); 

I get errors with that:

earnest phoenix
#

How would I make Discord.JS grab messages in certain channels then save to a text document?

#

I'm so confused with this part...

topaz fjord
#

@sick cloud wut are u searching

sick cloud
#

nevermind, fixed it :l

earnest phoenix
#

if(cmd === `${prefix}avatar`){ message.channel.send(message.author.avatarURL); };

#

Whats wring with this...

#

It wont send the avatar. (Discord.JS)

torpid vale
#

ok... does the command even run?

#

as in console.log a test inside the if statement

#

to see if the command is even trying to run

earnest phoenix
#

Doing it now ^

#

It doesnt...

#

So whats the issue?

torpid vale
#

I can't tell without seeing the message handeling event

earnest phoenix
#
    if(message.author.bot) return;
    if(message.channel.type === "dm") return;
  
    let prefix = botconfig.prefix;
    let messageArray = message.content.split(" ");
    let cmd = messageArray[0];
    let args = messageArray.slice(1);
    let name = botconfig.botname;
torpid vale
#

Do other commands work?

earnest phoenix
#

Yes

torpid vale
#

Can you show the full event then?

earnest phoenix
#

What do you mean?

torpid vale
#

the whole bot.on('message')

#

πŸ€” I need to see the other commands to see if the = signs are messed up 🀦

#

I wouldn't

#

Also, if tokens are in it, you can jsut remove them

quartz kindle
#

do an elimination process

#

console log each individual parts and see whats working and what isnt

earnest phoenix
#
//Grab "banned" messages so you may punish user at later date.

  if (message.content.includes ("@")){
    console.log(`[${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".`);
    console.log(`[${name}//Spam Handler]: Offendor ID:  "${message.author.id}"`);
    console.log(`[${name}//Spam Handler]: Offendor Name:  "${message.author.username}"`);
    console.log(`[${name}//Spam Handler]: Offended Guild:  "${message.guild.name}"`);
    console.log(`[${name}//Spam Handler]: Message ID:  "${message.id}"`);
    console.log(`[${name}//Spam Handler]: Timestamp:  "${message.createdAt}"`);
    message.channel.sendMessage("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(msg => msg.delete(2000));
  }
});```
#

How should I edit this so it only runs after "@" is sent multiple times in succession?

grizzled isle
#

create a map with the user id and 1, then add 1 to that 1 if done again and if its greater than 3l, or 5, then ban them.

earnest phoenix
#
  var m = 0;
  m += 1;
message.channel.sendMessage(`${m}`)
};
#

Im so confused....

grizzled isle
#

so like

bot.on("message", msg => {
    const enmap = require('enmap')
    const spammers = new Enmap();
    // If the content includes a mention, and they are not saved in the spammers, add them in
    if (msg.content.includes('@') && !spammers.keyArray().includes(msg.author.id)) spammers.set(msg.author.id, 1);
    
    // If they are already there, add 1 to it.
    if (msg.content.includes(`@`) && spammers.keyArray().includes(msg.author.id)) spammers.set(msg.author.id, spammers.get(msg.author.id)+1);
    
    // Check if they have more than 5. If so, ban that mofo
    if (spammers.get(msg.author.id) > 5) msg.guild.ban(msg.author.id, 'Spammed too much - AutoBanned')
})
// Put this in your ready event:
bot.setInterval(() => {
        spammers.forEach(key => {
            spammers.delete(key);
        })
// Erase the spammers every 10 seconds.
}, 10000)
earnest phoenix
#

I dont want it to auto ban

#

I just want it to set a variable to 1

#

or something

#

Idk..

#
    console.log(`[${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".`);
    console.log(`[${name}//Spam Handler]: Offendor ID:  "${message.author.id}"`);
    console.log(`[${name}//Spam Handler]: Offendor Name:  "${message.author.username}"`);
    console.log(`[${name}//Spam Handler]: Offended Guild:  "${message.guild.name}"`);
    console.log(`[${name}//Spam Handler]: Message ID:  "${message.id}"`);
    console.log(`[${name}//Spam Handler]: Timestamp:  "${message.createdAt}"`);
    message.channel.sendMessage("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(msg => msg.delete(2000));
  }```
#

I need it to do thta

#

that**

#

@grizzled isle

grizzled isle
#

I gave an example for you. You can cancel some things, you can add, etc.

sick cloud
#

You won't get the code spoonfed to you :^)

earnest phoenix
#

:^(

#

@grizzled isle kk

grizzled isle
#

Took 10 mins to type that example from the top of my head. lol

earnest phoenix
#

I think I got it

#

I just dont know how Ill collect user data for my console.log

#

When it hits 5

#

Wait...

#

I got it... Im just being stupid...

glossy mason
#

It's spelled "Offender"

buoyant oak
#

for your bot to get certified

#

...do you have to have a website?

prime cliff
#

You need to use a website or github that has the DBL widget on it so yea

sick cloud
#

@buoyant oak not entirely, but you need full documentation on how to use the bot (on a website, GitHub, etc..) as well as somewhere with the widget on it. So you can use a website, yeah, but you can also use a GitHub repository, A Gitlab one even owo or something else.

buoyant oak
#

oh ._.

#

thanks for the help

sick cloud
#

No problem.

#

How do I make the scrollbar float?

#

So its like, 5px or something off the edge of the window.

gusty topaz
#

Don't scrollbar css tricks only work on webkit based browsers?

sick cloud
#

Yeah, IE and Firefox just show the default scrollbar.

gusty topaz
#

So that means you shouldn't make the scrollbar the center of your design

#

And your design should also work with other scrollbars

#

Still, you can make it float by applying a :after element

#

And making it 5 wide

sick cloud
#

Thonk margin or padding? but okay

gusty topaz
#

Its margin

#

You can achieve padding as well by :after-ing internal elements

#

Scrollbar CSS is super bizzare

sick cloud
#

it isn't working ;-;

gusty topaz
#

Hmmm

sick cloud
#
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #FF0000;
}
::-webkit-scrollbar-thumb {
    background: #b62f2f;
}
::-webkit-scrollbar-thumb:after {
    margin: 5px;
}

..still the same:

glossy sand
#

you want the scrollbar... outside the browser window...?

sick cloud
#

No x.x

#

I want it so it floats inside the browser window, with a 5px padding around it, so it isn't sticking to the border

gusty topaz
#

Ah

#

Dont set actual margin

#

Set element size

#

Like width

#

Or height

#

And location relative to rest of scrollbar

#

Scrollbar styling is something you'll waste your time on instead of doing something beneficial to the site itself (that can be seen on all browsers not just chrome on pc)

sick cloud
#

feels confused

gusty topaz
#

Its very bizarre

#

Generally CSS can sometimes be dumb

earnest phoenix
#

POP

quiet bobcat
tiny turtle
#

if temVar is more then 2k chars make another tempVar possible for the extra?

spring ember
#

What is tempVar?

tiny turtle
#

${tempVars("set3")[0]}

#

temp variable

spring ember
#

Is that a function? Can you send relevant code?

austere meadow
topaz fjord
#

Well they said they were gonna be deprecated in the future

#

So maybe

austere meadow
#

yeah but to my knowledge it was only deprecating uncaught unhandled rejections (ie, if you didn't have an event catching the rejections)
also it was deprecated ages ago

fluid basin
#

Yes deprecated

#

I guess

#

Just catch all unhandled

topaz fjord
#

^

austere meadow
#

i do though blobwaitwhat

fluid basin
#

And its a database error

austere meadow
fluid basin
#

So maybe its not the unhandled

austere meadow
#

i know but on my main pc it doesn't crash

#

and it uses node 8

fluid basin
#

weird

#

Same versions of sequelize?

austere meadow
#

uhh good point

#

it shouldn't matter but ill check

fluid basin
#

yeah in any case if they are different it must have been updated to crash on error

austere meadow
#

yeah, both are the exact same version

#

4.33.4

#

ill try a downgrade to node 8/9 to see if that helps, if they did fully remove unhandled rejections that's real bad news

#

because discord.js loves unhandled rejections

native narwhal
#

Hmm πŸ€”

austere meadow
#

is anyone else here on node 10?

#

this is really strange

knotty steeple
#

im still on node 8

austere meadow
#

hmm ok

native narwhal
#

I don't use node at all mmLol

austere meadow
#

mmLol good solution

native narwhal
#

Yeah πŸ˜‚

knotty steeple
#

ew you java

topaz fjord
#

I haven't seen any u handled rejections crashing me

#

Wait

#

No

#

Im stupid

austere meadow
#

?

#

@quiet bobcat message.guild.roles.exists(role id)
or message.guild.roles.has(role id)

restive silo
#

exists shouldn't be used with id blake

austere meadow
#

oh

languid dragon
#
const role = message.guild.roles.get("190843013847");

if (role) {
    //exists
} else {
    // does not
}
austere meadow
#

sorry i don't use it OMEGAlul

#

it should be (type, value)

#

right

restive silo
#

has returns boolean if key is in the collection, get returns value by id or undefined

quiet bobcat
#
(node:972) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: fn.bind is not a function```
restive silo
#

oh you are on master right?

knotty steeple
quiet bobcat
#

yeah

restive silo
#

you need to pass a function

#

it isn't key, value anymore, it only accepts a function now

quiet bobcat
#

πŸ€”

austere meadow
#

oh

restive silo
#

its only for find and exists tho

#

πŸ‘€

#

Collection.find(value => value === expectedValue)

#

something like that

languid dragon
#

shouldn't .get() work?

#

since it extends a Collection which extends a Map

restive silo
#

yea but he used something else which throw his error and i just wanted to explain to him πŸ‘€. If you wanna get a value by ID use .get(), if you want get a value by property use .find() with a function

native narwhal
#

Does Collection extend Map Thonk

restive silo
#

yes

languid dragon
#

oh yh igy

#

const role = message.guild.roles.find(r => r.name === "some_role_name");

if (role) {
    // exists
} else {
    // does not
}
knotty steeple
#

i need some commands for people to earn money if their balance is 0

wild tide
#

I forgot what shards mean ._.

#

someone rejog my memory

fluid basin
#

node 8 is bae

#

@knotty steeple dailies

#

xD

knotty steeple
#

besides that

austere meadow
#

i have a work command

#

you do +work and it just gives you like 30 dollars for "working"

#

its on a 30 minute cooldown in my case

#

you could have something like a "chance" command to have a random event occur (like in monopoly) and it gives you a certain amount of money with funny responses

#

ofc it'd be on a cooldown too

knotty steeple
#

sounds good

#

and maybe a loot command

#

"robs" a house and you find some coins

fluid basin
#

maybe a gambling command

quiet bobcat
#

How do I see if a user has a role in discord.js (v12)

austere meadow
#

<Member>.roles.has(id)

#

or you can also use the same get() method as above

quiet bobcat
#

doesn't work

austere meadow
#

what does it say

quiet bobcat
#

it just returns false

#

wait

austere meadow
#

.find(role => role.name === "name") remember

quiet bobcat
#

I forgot to do id

#

lol

karmic parcel
#

rip

earnest phoenix
#

.help

frail kestrel
earnest phoenix
#

yes

west raptor
#
    if(!rMember.roles.has(gRole.id)) return message.reply("They don't have that role!");
``` it always reply saying `They don't have that role!`
#

same with addrole but it replys They already have that role!

limpid cosmos
wanton walrus
#

Well args is not defined

#

Thats your problem

limpid cosmos
#

oh

#

how can I resolve that ?

wanton walrus
#

By defining it

limpid cosmos
#

okay

#

like that ?

#

let args = messageArray.slice(1);

west raptor
#

yea

#

that works

limpid cosmos
#

okay

bitter sundial
#

is messageArray defined

west raptor
#

oof

#

forgot about that

limpid cosmos
#

i succes

west raptor
#
    if(!rMember.roles.has(gRole.id)) return message.reply("They don't have that role!");

it always reply saying They don't have that role!
same with addrole but it replys They already have that role!

earnest phoenix
#
    at emitOne (events.js:121:20)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\charl\Desktop\BOTD\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)```
#

I have no idea what the error is...

quartz kindle
#

C:\Users\charl\Desktop\BOTD\index.js:26:20

#

index.js line 26

west raptor
#

^

earnest phoenix
#

Well yeah...

#

const spammers = new Enmap();

#

I just have no idea why it isnt working...............

#

It shouldnt give me an error...

#
  const enmap = require('enmap')
  const spammers = new Enmap();
#

Should I move my const things to the top of my index?

quartz kindle
#

the require definitely yes

#

the spammers dont need to be const

#

actually they cant be const

#

because const can only be defined once, and on message is a loop that fires every time you get a message

#

so it would be trying to re-define const all the time

earnest phoenix
#
                   ^

ReferenceError: Enmap is not defined
    at Client.bot.on.msg (C:\Users\charl\Desktop\BOTD\index.js:27:20)
    at emitOne (events.js:121:20)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\charl\Desktop\BOTD\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\charl\Desktop\BOTD\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)```
#

True,

#

so should I use let?

quartz kindle
#

yes

earnest phoenix
#

For both statements?

quartz kindle
#

im checking the enmap npm

#
 
// Initialize an instance of Enmap
const myCollection = new Enmap();
 
// Adding data is simply a `set` command: 
myCollection.set("myKey", "a value");
 
// Getting a value is done by key 
let result = myCollection.get("myKey");```
#

both consts should be outside of the loop

#

you dont want to re-initialize the enmap on every message

earnest phoenix
#
               ^

ReferenceError: Enmap is not defined
    at Object.<anonymous> (C:\Users\charl\Desktop\BOTD\index.js:16:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3```
#

Im so confused......

#

Wait hold on

quartz kindle
#

you named the variable in lower case

earnest phoenix
#

Ik

quartz kindle
#

anyways you should probably do ```
const Enmap = require("enmap");
const myCollection = new Enmap();

bot.on('message')```

#

and then work on the collection when you receive messages

earnest phoenix
#

Alright, so it logs my spam

#

Hold on

#
[EternityModeration//Spam Handler]: Timestamp:  "Fri Jun 15 2018 08:31:02 GMT-0500 (Central Daylight Time)"
[EternityModeration//Spam Handler]: The "@" text/symbol was sent in rapid succession by (@dusky helm) in "EternityModeration Support & Testing".
[EternityModeration//Spam Handler]: The "@" text/symbol was sent in rapid succession by (@pseudo stump) in "EternityModeration Support & Testing".
[EternityModeration//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (@pseudo stump) in "EternityModeration Support & Testing".
[EternityModeration//Spam Handler]: Offendor ID:  "448629905731747842"
[EternityModeration//Spam Handler]: Offendor Name:  "LoreiusIuvenlis"
[EternityModeration//Spam Handler]: Offended Guild:  "EternityModeration Support & Testing"
[EternityModeration//Spam Handler]: Message ID:  "457175209561030662"
[EternityModeration//Spam Handler]: Timestamp:  "Fri Jun 15 2018 08:31:03 GMT-0500 (Central Daylight Time)"
[EternityModeration//Spam Handler]: The "@" text/symbol was sent in rapid succession by (@pseudo stump) in "EternityModeration Support & Testing".
(node:17004) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit```
#

So where should I increase listeners?

quartz kindle
#

idk, are you adding event listeners on every spam log?

earnest phoenix
#

Er

#

What do you mean? (sorry Im new to this)

quartz kindle
#

an event listener is when you're waiting for something to happen, like the .on('message'), you're waiting for the 'message' event to happen.

#

if you have too any pieces of code all waiting for something to happen, it shows this warning

#

but its just a warning, it should not stop your code from running

earnest phoenix
#

True

#

So why does it send it so many times?

quartz kindle
#

your code is probably looping somewhere

earnest phoenix
#
bot.on("message", async message => {

bot.on("message", msg => {
  if (msg.content.includes('@') && !spammers.keyArray().includes(msg.author.id)) spammers.set(msg.author.id, 1);
  

  if (msg.content.includes(`@`) && spammers.keyArray().includes(msg.author.id)) spammers.set(msg.author.id, spammers.get(msg.author.id)+1);
  

  if (spammers.get(msg.author.id) > 5){
    spammers.set(msg.author.id, spammers.get(msg.author.id)-5);
    console.log(`[${name}//Spam Handler]: The "@" text/symbol was sent in rapid succession by (<@${message.author.id}>) in "${message.guild.name}".`);
    message.channel.send("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(msg => msg.delete(2000));
  }});
  if (message.content.includes ("@")){
    console.log(`[${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".`);
    console.log(`[${name}//Spam Handler]: Offendor ID:  "${message.author.id}"`);
    console.log(`[${name}//Spam Handler]: Offendor Name:  "${message.author.username}"`);
    console.log(`[${name}//Spam Handler]: Offended Guild:  "${message.guild.name}"`);
    console.log(`[${name}//Spam Handler]: Message ID:  "${message.id}"`);
    console.log(`[${name}//Spam Handler]: Timestamp:  "${message.createdAt}"`);
}});```
#

O

#

I have bot.on

#

twitce...

quartz kindle
#

bingo

earnest phoenix
#

twice*

quartz kindle
#

thats what's adding an event listener to every message

earnest phoenix
#
C:\Users\charl\Desktop\BOTD>node .
C:\Users\charl\Desktop\BOTD\index.js:39
  if (message.content.includes ("@")){
  ^

ReferenceError: message is not defined
    at Object.<anonymous> (C:\Users\charl\Desktop\BOTD\index.js:39:3)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
#

Now I get the error...

quartz kindle
#

bot.on("message", msg => {

#

you're catching the message event, and pass it on as a msg variable

#

so you have to work on msg, not message

#

or change the msg to message

earnest phoenix
#
  ^

ReferenceError: message is not defined
    at Object.<anonymous> (C:\Users\charl\Desktop\BOTD\index.js:39:3)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3```
#

Still get that

quartz kindle
#

its still undefined

earnest phoenix
#

bot.on("message", msg => {

quartz kindle
#

bot.on("message", msg => {
^

earnest phoenix
#

oh

#

so use

#

bot.on("message", message => {

#

?

quartz kindle
#

yes

earnest phoenix
#
  ^

ReferenceError: message is not defined
    at Object.<anonymous> (C:\Users\charl\Desktop\BOTD\index.js:39:3)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3```
#

Still an error

#
  bot.on("message", message => {
  if (msg.content.includes('@') && !spammers.keyArray().includes(msg.author.id)) spammers.set(msg.author.id, 1);
  

  if (msg.content.includes(`@`) && spammers.keyArray().includes(msg.author.id)) spammers.set(msg.author.id, spammers.get(msg.author.id)+1);
  

  if (spammers.get(msg.author.id) > 5){
    spammers.set(msg.author.id, spammers.get(msg.author.id)-5);
    console.log(`[${name}//Spam Handler]: The "@" text/symbol was sent in rapid succession by (<@${message.author.id}>) in "${message.guild.name}".`);
    message.channel.send("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(msg => msg.delete(2000));
  }});
  if (message.content.includes ("@")){
    console.log(`[${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".`);
    console.log(`[${name}//Spam Handler]: Offendor ID:  "${message.author.id}"`);
    console.log(`[${name}//Spam Handler]: Offendor Name:  "${message.author.username}"`);
    console.log(`[${name}//Spam Handler]: Offended Guild:  "${message.guild.name}"`);
    console.log(`[${name}//Spam Handler]: Message ID:  "${message.id}"`);
    console.log(`[${name}//Spam Handler]: Timestamp:  "${message.createdAt}"`);
};```
quartz kindle
#

you have 'msg' mixed in with 'message' everywhere

earnest phoenix
#

So change every msg to message?

quartz kindle
#

yes

#

also

#

your if(message.content.includes)

#

is outside the bot.on() loop

earnest phoenix
#
    ^

ReferenceError: message is not defined
    at Object.<anonymous> (C:\Users\charl\Desktop\BOTD\index.js:39:5)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3```
#
    if (message.content.includes('@') && !spammers.keyArray().includes(message.author.id)) spammers.set(message.author.id, 1);
    
  
    if (message.content.includes(`@`) && spammers.keyArray().includes(message.author.id)) spammers.set(message.author.id, spammers.get(message.author.id)+1);
    
  
    if (spammers.get(message.author.id) > 5){
      spammers.set(message.author.id, spammers.get(message.author.id)-5);
      console.log(`[${name}//Spam Handler]: The "@" text/symbol was sent in rapid succession by (<@${message.author.id}>) in "${message.guild.name}".`);
      message.channel.send("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(message => message.delete(2000));
    }});
    if (message.content.includes ("@")){
      console.log(`[${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".`);
      console.log(`[${name}//Spam Handler]: Offendor ID:  "${message.author.id}"`);
      console.log(`[${name}//Spam Handler]: Offendor Name:  "${message.author.username}"`);
      console.log(`[${name}//Spam Handler]: Offended Guild:  "${message.guild.name}"`);
      console.log(`[${name}//Spam Handler]: Message ID:  "${message.id}"`);
      console.log(`[${name}//Spam Handler]: Timestamp:  "${message.createdAt}"`);
  };```
#

I have no idea what the issue is

quartz kindle
#

this ``` if (message.content.includes ("@")){
console.log([${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".);
console.log([${name}//Spam Handler]: Offendor ID: "${message.author.id}");
console.log([${name}//Spam Handler]: Offendor Name: "${message.author.username}");
console.log([${name}//Spam Handler]: Offended Guild: "${message.guild.name}");
console.log([${name}//Spam Handler]: Message ID: "${message.id}");
console.log([${name}//Spam Handler]: Timestamp: "${message.createdAt}");
};

#

is outside

#
    if (message.content.includes('@') && !spammers.keyArray().includes(message.author.id)) spammers.set(message.author.id, 1);
    
  
    if (message.content.includes(`@`) && spammers.keyArray().includes(message.author.id)) spammers.set(message.author.id, spammers.get(message.author.id)+1);
    
  
    if (spammers.get(message.author.id) > 5){
      spammers.set(message.author.id, spammers.get(message.author.id)-5);
      console.log(`[${name}//Spam Handler]: The "@" text/symbol was sent in rapid succession by (<@${message.author.id}>) in "${message.guild.name}".`);
      message.channel.send("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(message => message.delete(2000));
    }});```
#

this ^

earnest phoenix
#

hold on

#
  bot.on("message", message => {
   
    if (message.content.includes ("@")){
      console.log(`[${name}//Spam Handler]: Harmless (user) error detected, extensive report suppressed. The "@" text/symbol was sent by (<@${message.author.id}>) in "${message.guild.name}".`);
      console.log(`[${name}//Spam Handler]: Offendor ID:  "${message.author.id}"`);
      console.log(`[${name}//Spam Handler]: Offendor Name:  "${message.author.username}"`);
      console.log(`[${name}//Spam Handler]: Offended Guild:  "${message.guild.name}"`);
      console.log(`[${name}//Spam Handler]: Message ID:  "${message.id}"`);
      console.log(`[${name}//Spam Handler]: Timestamp:  "${message.createdAt}"`);
  };

   
    if (message.content.includes('@') && !spammers.keyArray().includes(message.author.id)) spammers.set(message.author.id, 1);
    
  
    if (message.content.includes(`@`) && spammers.keyArray().includes(message.author.id)) spammers.set(message.author.id, spammers.get(message.author.id)+1);
    
  
    if (spammers.get(message.author.id) > 5){
      spammers.set(message.author.id, spammers.get(message.author.id)-5);
      console.log(`[${name}//Spam Handler]: The "@" text/symbol was sent in rapid succession by (<@${message.author.id}>) in "${message.guild.name}".`);
      message.channel.send("**Alert:** *Mass mentions are generally frowned upon. Please use them sparingly.*").then(message => message.delete(2000));
 
 
    }});```
quartz kindle
#

test now

earnest phoenix
#

It works!

#

πŸ˜„

quartz kindle
#

alright

earnest phoenix
#

Thanks so much man

quartz kindle
#

πŸ‘

earnest phoenix
#

πŸ’™

rigid pulsar
#

Just out of curiosity, what's the general consensus on running a bot as root?

#

(Of course, this doesn't mean I do that)

white blaze
#

Yeah I'd like to know too

rigid pulsar
#

I know it's obviously not a smart thing to do, but is there anyone that actually has a reason as to why you shouldn't

#

or anyone that runs it as root and thinks it's a benefit for whatever reason?

sick cloud
#

@rigid pulsar I got a VPS and couldn't be bothered learning how to setup a user, so I run my bot as root. There are obviously the security risks, the only thing I've noticed is that you can run things like apt get for packages like canvas and npm -g flags easier, thats all from me .-.

rigid pulsar
#

The main reason I'm concerned with running a bot as root is the attack vector, I'm used to always programming as if the user is an attacker

#

and if the bot is running as root, getting ACE is already enough to basically have control over the VPS

earnest phoenix
#

How would I gather information from a message

#

Such as message content

#

and the writter

#

in a server

slender thistle
#

discord.js?

earnest phoenix
#

Yep

slender thistle
#

message content? Have you tried reading the docs? thanking

earnest phoenix
#

Yes ma'am

rigid pulsar
#

If you have the Message object,

earnest phoenix
#

  });
rigid pulsar
#

you'd use message.content to get the message contents

#

and message.author to get a User object

#

and if you need a GuildMember, you'd use message.member

earnest phoenix
#
messager.set(message.content);
console.log(`[${name}//Log Handler]: ${message.content}`);
  });
#

So kinda like that?

#

Wait,,

#

I need to define messager

#

hold on

white blaze
#

@sick cloud Setting up a user is pretty easy hahaha

earnest phoenix
#

I got it

#

πŸ˜ƒ

white blaze
#

Literally

useradd -m name
passwd name
#

And then you can log into the user with su name

sick cloud
#

I'm still too lazy to do so

balmy perch
#

oof dont think this is correct

frail kestrel
#

what’s the -m flag

limpid cosmos
#

don't work

slender thistle
#

I think your command is annonce

limpid cosmos
#

yep normal

sick cloud
#

sendEmbed is depreciated also.

limpid cosmos
#

what I must do ?

sick cloud
#

change to send({ embed: embed });

limpid cosmos
#

okay

sick cloud
#

also why do you have a message event for every command πŸ‘€

limpid cosmos
#

I'm goinf to change it I start JS 1 week ago x)

white blaze
#

@sick cloud today I learned a lot of people are hahaha

#

So you're not the only one :P

sick cloud
#

πŸ‘Œ

earnest phoenix
#
      setTimeout(spammers, 300000);
      function spammers() {
        console.log(`[${name}//Spam Handler]: Removing points from spammer.`) 
    }}```
#

Will that infinite loop?

bitter sundial
#

there's nothing that would create an infinite loop there

earnest phoenix
#

Yeah.

bitter sundial
#

it's just going to log that into the console after 300000 ms

#

I'm not a fan of how you use the same variable name for the function and spammers object

sick cloud
#

.setAuthor(`${msg.author.username} ![verified](https://cdn.discordapp.com/emojis/457200280388370433.webp?size=128 "verified")`, msg.author.displayAvatarURL)

bitter sundial
#

I'm pretty sure the author part can't have emojis

#

-bots

gilded plankBOT
#
Tonkku#0950
Bots <:dblAdmin:401723658491527168>

@pliant gorge
@gilded plank
@abstract aspen

bitter sundial
#

yeah I placed them in that title because of that I think

sick cloud
#

darn it! ;-;

#

well that ruins my idea, thanks though

bitter sundial
#

you could still use \βœ” lul

sick cloud
#

but the badge is better and nicer

#

ok though πŸ‘Œ

bitter sundial
#

yeah it's likely because the author part doesn't support discord's markdown while the title, description and other parts do

sick cloud
#

title supports markdown, really? huh

#

makes sense though

bitter sundial
#

yeah it does

slender thistle
#

Titles, footers and field names don't support emotes, I believe.

bitter sundial
#

titles do support emoji

slender thistle
#

Ah, whoops

vestal grail
#

I think fields do as well

slender thistle
#

Let me check.

bitter sundial
slender thistle
#

Field names do.

#

So, author and footers don't?

bitter sundial
#

that's right

slender thistle
#

πŸ‘Œ

sick cloud
#

also how do you make an exec command again? i know you need some child process thing, but i can't remember ;-;

gilded blaze
#

What language?

tall falcon
#

What's the latest npm version on Linux?

earnest phoenix
#

@tall falcon

You can upgrade to the latest version of npm using:

npm install -g npm@latest

tall falcon
#

@earnest phoenix I did that and I ran sudo apt-get install -y nodejs everything is fine now with async

earnest phoenix
gilded blaze
#

Error?

quasi marsh
#

Does anyone know if bots can use rich presence?

gilded blaze
#

Don't think so

#

At least idk any endpoints for it

quasi marsh
#

Yeah

#

I can't find anything here that would say it's not allowed to be used by bots

quiet bobcat
#

Hi I'm trying to fix my muted command. I'm trying to deny permission to send messages in every channel in that guild. I have this code right now js message.guild.channels.overwritePermissions({overwrites: [{ id: mutedRole.id, denied: ['SEND_MESSAGES'] }]});

quasi marsh
#

Seemsl ike python right

#

I have something like

#

Nvm

quiet bobcat
#

discord.js

quasi marsh
#

But I have something like a for loop

quiet bobcat
#

forgot to mention lib

earnest phoenix
#

what do you put in Brief description

quasi marsh
#

for channel in message.guild.channels

#

@earnest phoenix Something about your bot, like what it does?

earnest phoenix
#

ooo

#

Music, Role Management, logging, Moderation, Customizable Behavior and leveling

#

thats what i put?

quasi marsh
#

If you want?

earnest phoenix
#

whats Unable to fetch application

quasi marsh
#

Check if you mistyped your ID

earnest phoenix
#

whats Bot awaiting approval!

slender thistle
#

Bot needs to be checked now.

#

You need to wait and have patience.

buoyant oak
#

yo

#

anyone

#

how do you get a progress bar

#

and like a layout

#

like IDLE RPG

#

or

#

MEE6 ?

turbid gale
#

maths

knotty steeple
#

should i use a Set() to add users to a "dailyPool" or use a database zoomeyes

trim plinth
#

db

formal leaf
#

how can i make the server count in js ?

inner jewel
formal leaf
#

Oops! Error: 403 This host is not accessible.

gilded blaze
#

That’s ur own problem

#

The host should be accessible

earnest phoenix
#

heh

topaz fjord
#

403 is forbidden zoomeyes

#

which could be token issues

#

@formal leaf

formal leaf
#

ohh

knotty steeple
topaz fjord
#

u are

earnest phoenix
#

question is there a way to calculate 1 var before another var?

#

discord.js by the way

quartz kindle
#

what do you mean?

earnest phoenix
#

I am trying to calculate IVs before stats and I have put them all in a variable as far as the formulas go.. I was wondering how to calculate the IV variable before the STAT variable if there is any way

quartz kindle
#

are you using async?

earnest phoenix
#

can a admin approval my bot

quartz kindle
#

i mean, if you're doing sequential coding, just switch the order the vars are calculated

#

but if you're doing async, and need to wait for the calculation to finish, then its another story

earnest phoenix
#

I have tried switching the order and that didnt work either

quartz kindle
#

show the code

earnest phoenix
#

ill have to hastbine

quartz kindle
#

you can post just the relevant part

#

unless everything is relevant lol

earnest phoenix
#

some of the code is relevant can i dm though please

quartz kindle
#

i rather do it here so others can see and input their thoughts

earnest phoenix
#

id rather not post it here

quartz kindle
#

you dont need to post everything

earnest phoenix
#
                        var ivatt = Math.floor(((attack/1 - 5) * 100) / pokelvl - 2 * inforow.att - 0/4);
                        var ivdef = Math.floor(((defense/1 - 5) * 100) / pokelvl - 2 * inforow.def - 0/4);
                        var ivspatt = Math.floor(((spattack/1.1 - 5) * 100) / pokelvl - 2 * inforow.spatt - 0/4);
                        var ivspdef = Math.floor(((spdefense/0.9 - 5) * 100) / pokelvl - 2 * inforow.spdef - 0/4);
                        var ivspeed = Math.floor(((speed/1 - 5) * 100) / pokelvl - 2 * inforow.speed - 0/4);
                        var attack = Math.floor((((2 * inforow.att + ivatt + 0/4) * pokelvl) / 100 + 5) * 1);
                        var defense = Math.floor((((2 * inforow.def + ivdef + 0/4) * pokelvl) / 100 + 5) * 1);
                        var spattack = Math.floor((((2 * inforow.spatt + ivspatt + 0/4) * pokelvl) / 100 + 5) * 1.1);
                        var spdefense = Math.floor((((2 * inforow.spdef + ivspdef + 0/4) * pokelvl) / 100 + 5) * 0.9);
                        var speed = Math.floor((((2 * inforow.speed + ivspeed + 0/4) * pokelvl) / 100 + 5) * 1);
                        var hp = Math.floor(((2 * inforow.hp + ivhp + (0/4 + 100)) * pokelvl) / 100 + pokelvl + 10);```

This is the part I am having trouble with
quartz kindle
#

looks fine, what isnt working?

earnest phoenix
#

its posting NaN

quartz kindle
#

is ivatt showing up as undefined?

#

oh

#

then there's something wrong with the math

#

check if there's strings instead of integers in the variable

earnest phoenix
#

it happened when i put the iv variables in the equation for the stats

quartz kindle
#

for example, pokelvl or inforow.hp could be entering the math as strings instead

#

can you console log all the iv variables?

#

maybe one of them is not correct

#

wait

topaz fjord
#

did you log them

earnest phoenix
#

no

quartz kindle
#

you have the stats

#

inside the iv calculations

#

so you need to calculate the stats first

earnest phoenix
#

either way it goes it doesnt work

quartz kindle
#

yeah because both of them depend on the other

#

ivspeed needs speed, and speed needs ivspeed

earnest phoenix
#

it started when the ivatt etc was inserted into the stats equations

quartz kindle
#

you have to remove one of the dependencies

earnest phoenix
#

hmm maybe i need to do some more reading then Im just going by what bulbapedia gave me

quartz kindle
#

arent ivs calculated from base stats?

inner jewel
#

if that's pokemon, no

earnest phoenix
#

yes

inner jewel
#

the real stats come from base stats, evs and ivs

#

combined

quartz kindle
#

then the iv calculation is wrong, it shouldnt have real stats in their calculation

#

because real stats are not calculated yet

earnest phoenix
#

IV = ((Stat/Nature - 5) * 100) / Level - 2*Base - EV/4

#

that is the IV math

#

it asks for the stat

quartz kindle
#

that stat needs to be defined somewhere

inner jewel
#

from iv ev base final stat

#

you'll need 3 of those to find the last

earnest phoenix
#

but the stat isnt really defined without the iv and iv isnt defined until it has a stat correct?

quartz kindle
#

thats whats in your code, but it doesnt look correct

earnest phoenix
#

hmm ok i will do some more reading then... thanks for your help guys

quartz kindle
#

hmm i think your code for the IV is to retrieve the IV value from the stats, not to create an IV value

sick cloud
quartz kindle
#

pretty sure you can access meta tags with js

sick cloud
#

js isn't allowed on non-certified bots .-.

quartz kindle
#

then rip

#

but it would be kinda useless, since crawlers get that info from page source, before js is loaded

sick cloud
#

yea

#

Anothber question, are there a way to get grids on your bots page? Like just a 50/50 design for the description box.

quartz kindle
#

pretty sure you can

sick cloud
#

Wonder how πŸ‘€

quartz kindle
#

have you tried using tables or inline-block divs?

sick cloud
#

Uh, I don't even know how to use either ;-;

quartz kindle
#

.>

#
<div style="display: inline-block; width: 49%">content here</div>```
#

49% for safety, you can try with 50%

sick cloud
#

ook

quartz kindle
#

if they are still not side-by-side, lower the width, the box might have padding

sick cloud
#

ok

#

That seems to work, thanks ❀

quartz kindle
#

πŸ‘

frail kestrel
#

db suggestions?

fluid basin
#

depends on what you need

#

Mongo is great for documents and keys

#

If not mysql if you prefer SQL

night imp
#

and sqlite for embedded

#

or better-sqlite3 for node

fluid basin
#

yeah for portability you can use sqlite but it won't be good when the bot grows because it is file based

stray wasp
frail kestrel
#

what the fuck

#

what happened to mdn

sick cloud
#

so ytdl gives some readable stream

#

can you make that into a messageattachment?

#

(discord.js)

mental trellis
#

the docs say that client.on_message_edit can be triggered when a message is pinned or unpinned, but it only triggers for me if the content is changed

quasi marsh
#

Async or rewrite?

mental trellis
#

async

#

this is what I have

#

it prints "edit" only when content is changed

#

so my question is, is there something I am doing wrong or is this a problem with discord.py?

quasi marsh
#

Well, async version of discord.py is pretty outdated actually even tho it is "latest"

#

I strongly recommend switching to the rewrite version of discord.py

#

Other than that, it does seem like a d.py issue

mental trellis
#

how much different is the rewrite version?

quasi marsh
#

Honestly a fuckton

#

It's up to you to decide if you find it interesting but discord.py rewrite is a lot improved, syntax is a lot cleaner and everything is just a lot nicer and more things are supported, like nsfw channel checking etc.

mental trellis
#

alright, thanks for the help

#

I've been stuck on this forever thinking I was doing something wrong

quasi marsh
#

Even if your pin check was incorrect (which it's not) print('edit') should still be called when a message is pinned

mental trellis
#

yeah, that's why I put it there and decided to come here with my question

quasi marsh
#

with discord.py rewrite, there is a raw_message_edit event that gives you the payload of the websocket

#

You could listen for this event and print the output to console to see what is coming directly from discord

mental trellis
#

ok. I guess I will be spending some time looking into that

quasi marsh
#

There is a converter utility, I've used it but still be prepared to look yourself

mental trellis
#

so how do I install the rewrite version since it has the same name as the async on pip?

quasi marsh
#

py -m pip install -U git+https://github.com/Rapptz/discord.py@rewrite

#

That should work on Windows

mental trellis
#

Ok. Thanks again

solid cliff
sick cloud
#

I hit it on some video requests, and not on others.

restive silo
#

pretty sure the attachment you wanna upload is too big

#

max is 8mb for bots iirc

solid cliff
austere meadow
#

have you thought about only adding it once GWchadMEGATHINK

solid cliff
#

yes donethat

#

i has fixed it πŸ‘€

spring ember
#

Git angery

#

@solid cliff do .json instead of *.json

rigid hull
#

trying to make music bot and used const queue = require Map(); but i get error "Map" is not defined how can i define pls help

knotty steeple
#

you can only use require on files/node modules

gritty trellis
#

anyone know how to do a translate system on discord.py async

spring ember
#

@gritty trellis it's way too broad

#

Ask something specific

earnest phoenix
#

t

low rivet
#

@gritty trellis an api thonkku

earnest phoenix
#

How do I add a discord bot to the rank system

solid cliff
earnest phoenix
#

res

#

yes

#

how can i add level system to discord bot

#

how can i add level system to discord bot

#

how can i add level system to discord bot

native narwhal
#

Please stop spamming or I will have to mute you

earnest phoenix
#

ko

#

ok

fluid basin
#

don't spam. warning: 1

native narwhal
#

Also, if you want help provide as much information about the case and don't expect to just get the code

fluid basin
#

And I'm sure there are many tutorials out there to teach you how to do it

knotty steeple
#

how would i add a countdown to a cooldown

topaz fjord
#

yorks tut :^)

knotty steeple
#

or daily command

covert fox
#

Hello

topaz fjord
#

you record the timestamp they collected

#

@knotty steeple

fluid basin
#

store last command time

topaz fjord
#

then if that timestamp is 24 hours greater than the current timestamp

knotty steeple
#

hmm

topaz fjord
#

let them use