#development

1 messages · Page 1551 of 1

mellow kelp
#

sadly

earnest phoenix
#

some run archaic vulnerable versions too

#

but they won't update because that costs $$

delicate shore
#

so

#

How can I make mine look like this

lusty quest
#

if you call it via backend no one will see it tbh

earnest phoenix
#

i will never get used to chrome not parsing json

delicate shore
pale vessel
lusty quest
#

so why did you want to "beautify" it?

delicate shore
#

It looks cool

lusty quest
#

it doesnt change how your API client will read it

delicate shore
#

ok :-:

pale vessel
#

yea don't

lusty quest
#

also as cry said blame chrome for not parsing it

rocky hearth
#

if u using JSON.parse, then do this JSON.parse('to be parse', null, 4)

delicate shore
#

res.json is what I am using

lusty quest
pale vessel
#

but why

lusty quest
#

it makes no sense i know

delicate shore
#

pog

lusty quest
#

but the issue is that Chrome by default doesnt parse Json properly

delicate shore
mellow kelp
#

@delicate shore app.set('json spaces', 4)

delicate shore
#

h

#

ll

tribal siren
#

heya

#

what's wrong

#
let content = args[0];
  let role = message.mentions.roles.first() || message.guild.roles.cache.get(args[1]);
  if(!role) return message.channel.send('Mention a Role!')
  if(content === 'add'){
    let members = message.guild.members.cache.filter(m => !m.roles.cache.some(role));
    members.forEach(m => { m.roles.add(role) });
    const embed = new Discord.MessageEmbed()
      .setTitle('Done!')
      .setDescription(`I added ${role} to every person in this server!`)
      .setTimestamp()
      .setColor('RED')
    message.channel.send(embed)
  }
  if(content === 'remove'){
    let member = message.guild.members.cache.filter(m => m.roles.cache.some(role));
    member.forEach(m => { m.roles.remove(role) });
    const embed = new Discord.MessageEmbed()
      .setTitle('Done!')
      .setDescription(`I removed ${role} from every person in this server!`)
      .setTimestamp()
      .setColor('RED')
    message.channel.send(embed)
  }```
pale vessel
#

you tell me

#

no errors?

tribal siren
#

fn is not a function

pale vessel
#

i literally just said

tribal siren
#

oh ok

#

thanks

rocky hearth
#

is there somthing similiar to wordpress for nodejs?

pale vessel
#

Ghost

rocky hearth
#

hmm interesting, hv u used it?

#

or is it worth trying?

pale vessel
#

I've tried it

#

It's nice

rocky hearth
#

oh cool thanks

solemn leaf
#

what is member for GuildMemberAdd

#

I need to get tag from meber

young flame
#

how do you like

#

hm

#

wait

#

brb

solemn leaf
#

member.user.tag?

young flame
#

memeber.tag

#

member.tag*

#

how would i like

lament rock
#

member.user.tag
GuildMember.tag does not exist

young flame
#

add something per hour/minute/second

#

like income per 20minutes

#

?

lament rock
#

Depending on your database, you can set up intervals natively for it to do something to every entry. For instance, MySQL/MariaDB has this.

If not, if you're using NodeJS, you can use setInterval which accepts a function as the first param, then a number for milliseconds as the second

young flame
#

but how would i keep it active after i restart the bot?

#

like do i need to actively save there times indivisually?

#

if so thats fine i just dont have the function implementation on how i should approach it

lament rock
#

You can set a timeout to target a specific time such as if you're doing something hourly and there are 57 minutes left in the hour, you can set a timeout for 1000 * 60 * 57
which starts the loop

young flame
#

kk

#

and ty

#

oh and

#

how would i do a custom shop?

#

where i can like add items and remove items but buy using the ds!shop command it list everything that was added?

#

i have the adding and removing editing and stuff like that down

#

i just dont know how to display all the items

lament rock
#

Depends how you want things to be displayed. Most people will opt for using an embed which is significantly better than trying to format plain text

young flame
#

yeah i wnt an embed

#

but like

#

how would i get each item

#

their prices and description and like

#

display it

dusky sundial
#

Probably store the price, name etc. in a database and just grab it from that

#

Or in a file, if you don't feel like using a db

young flame
#

yeah ik that

#

but when your sttoring it if it s a db or not

#

its a single thing

#

not a collection

#

which is why i said how would i display "all the items"

#

not grab them seperately that would take uup to much time and be inefficient

#

expecially if its per guild

dusky sundial
#

Well, if you're using SQL, depending on how you store it, you can do SELECT * FROM Table WHERE guild_id=? to get all items in a guild.

lusty quest
#

depends on what database you use, MongoDB will return a json object. mysql idk anymore havent used it in years

young flame
#

hm

dusky sundial
#

From what I see on w3s it returns an array, which might not be too effective if you want to grab a specific item

#

On MySQL

young flame
#

sqlite3 databse

#

brb

lusty quest
#

sqlite will probably also return an array since its SQL

young flame
#

it feels kinda bland to me

dusky sundial
#

If it's just a matter of displaying every item, an array would be fine

earnest phoenix
#

yo

earnest phoenix
#

you can always try image generation

young flame
#

wut dat

earnest phoenix
#

if an array has multiple elements with the exact same value what would indexOf return

dusky sundial
#

Arrays are fast to loop through, it's just that they're not too effective when you want to find a specific element in it

#

The first one it finds, I'd assume

earnest phoenix
#

back when i had a public bot i got fed up with discord's bullshit formatting and started generating my own images in whichever format i wanted

young flame
#

ooo

#

how u do dat

#

sounds cool

earnest phoenix
#

varies from language to language

#

you'll have to do a bit of research

young flame
#

kk

earnest phoenix
young flame
#

idk

#

seems complicated

earnest phoenix
#

koompleecated

lament rock
#

I wanna do more frequent image generation, but I don't wanna compile native deps which'll work on my windows dev env and also prod

#

so, stuck with Jimp which isn't efficient

earnest phoenix
#

isn't canvas kind of chonky

#

idk

earnest phoenix
#

h

young flame
#

idkkkk

#

its stressing me out man

#

i dont code well when im stresseds

earnest phoenix
#

canvas is so awesome MDN has an entire folder of docs for it

#

wait

young flame
#

so does commando

#

but its ass

#

kinda

#

idk

#

i bneee

#

H

lament rock
#

that would be the webJS canvas lib. Not node-canvas

young flame
earnest phoenix
#

commando is a command framework tho

earnest phoenix
#

read the description of the package

lament rock
#

I know what it is

young flame
#

H

earnest phoenix
#

also owo what's webJS Thonk

young flame
#

i d k

lament rock
#

Front end JavaScript

earnest phoenix
#

bruh

#

ok why tf did discord just go BEEEEEEEEEEEEEEEEEE with pings suddenly

tribal siren
#

bruh

earnest phoenix
#

i have 0 pings

earnest phoenix
lament rock
#

If you're a fan of jank, do image manipulation through an html file and then render it and screenshot it somehow

daring prawn
#

How do I change body background in top.gg?
I tried

.entity-content__body { background: RED}
#

But doesn't work and yes I used <style></style>

lament rock
dusky sundial
young flame
#

ignore the bottom part

earnest phoenix
#

and also you're gonna be using the same exact canvas API for the html file

lament rock
young flame
#

woah

#

cute bot!

lament rock
#

Thanks

earnest phoenix
lament rock
#

I don't track votes so doesn't matter to me

earnest phoenix
#

@lament rock I voted for the botum

#

:)

#

I want to ask if anyone knows MongoDB.

lament rock
frigid warren
earnest phoenix
#

Best CSS:

.description {
  background: white;
  color: white;
}
earnest phoenix
# frigid warren Yes

How can I register what is written in MongoDB?

For example: M-language set en
how do I register in English?

frigid warren
#

Wdym

earnest phoenix
#

İn models folder I write
languageCode: String,

but I didn't understand how to do it in commands.

frigid warren
#

Umm

earnest phoenix
#

we cant understand anything

#

are you turkish

frigid warren
#

You have to create new object and then save the doc

earnest phoenix
#

you'll probably be able to get some help from @earnest phoenix if you're having a hard time explaining us in English

#

Okay, thanks.

frigid warren
#

Problem fixed

fluid basin
#

anyone knows whats the difference between lavaplayer and lavalink?

earnest phoenix
#

lavalink is a webserver wrapping around lavaplayer so non JRE apps can use it

#

it's java though so you can expect meh performance

fluid basin
#

I see I see

#

java is quite meme leaky

earnest phoenix
#

i just realized what i wrote oop

#

corrected it

young flame
#
body {
  background: linear-gradient(135deg, #fead7b, #c76d7f, #462371);
}
``` this  right?
#

nah i just entered node and did .load util.js and it did that

willow mirage
#

anyone know what does this called a > b ? a : b

earnest phoenix
#

ternary?

willow mirage
#

thx

rocky hearth
#

has anyone used, tailwind css??

analog imp
rustic nova
#

yes

#

message_create in the sense of sending a message

analog imp
#

interesting, makes me wonder how big bots are able to do it (unless client rate is adjusted) without using leaky bucket algorithm

rustic nova
#

the message-sending is per channel btw

analog imp
#

interesting, thought for quite some time it was by guild, then client itself
ex X-RateLimit-Global: true //or false for guild

#

hmmm

#

heard it's pretty hard to hit rate limits, but see it happen with larger bots from time to time

daring prawn
earnest phoenix
#

i have used it at last
def runClient(): client.run("TOKEN")

but not working ?
wrong code 😕

#

if you never call runClient() it won't ever run

#

oh

#

why are you wrapping it in a function though?

#

def runClient() ^ SyntaxError: invalid syntax

#

def is only used to define the function

#

before there was no problem but now not working

#

i have also used

earnest phoenix
#

i have used it earlier

#

but now not working

#

just call it directly, no need to wrap it inside another function

#

ok

daring prawn
#

Why does this not work

lament rock
daring prawn
#

@lament rock also thanks & loved your bot haha

daring prawn
#

Work*

#

I get black borders

lusty quest
#

they also have probably different Rate limits

daring prawn
#

Why does this not work?

.titleandvote .votebutton {
    background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
    border: none !important;
    transition: all .2s ease !important;
    color: white !important;
}

.titleandvote:hover .votebutton:hover {
    box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
    border: none !important;
    outline: none !important;
    border-radius: 8px !important;
}

.titleandvote:active:focus .votebutton:active:focus {
    background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
    box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
    border: none !important;
    outline: none !important;
    border-radius: 8px !important;
}
#

Yes I added style if someone can help pls ping me

young flame
#

@lusty quest economy or music

lusty quest
#

?

young flame
#

choose one smhhh

#

it one of those choice questions

lusty quest
#

both are oversaturated with bots

young flame
#

H

#

fine

#

what would you go for

lusty quest
#

idk come up with something unique

young flame
#

unique?

#

is that a joke lol

#

theres a bot for anything

lusty quest
#

music bots are a pain in the ass, economy bots are already some large and popular one there that you wont get replaced unless your bot does something unique

young flame
#

hm

lusty quest
#

also there are still things you could do something unique lol

young flame
#

like what

#

theres a bot that gives you info about fucking nasa

lusty quest
#

here are some ideas:
Make a Unique Mini Game bot
Make a Bot that tracks satelite Positions
Make a Bot that follows you around and question everything you do

rustic nova
#

inb4 there's a bot that gives you info about the nsa

#

task failed successfully

quartz kindle
#

my bot already tracks satelite positions lmao

young flame
#

but guess what

#

THERES A BOT THAT DOES THAT

#

smhhhhhhhhhhhh

lusty quest
#

coming up with something unique is hard, but if you manage to pull it off you probably get headache about how tf did i scale the bot again next week.

quartz kindle
#

depends, most unique bots can be pretty niche

#

my bot's growth is very slow paced because of that

lusty quest
#

Brain hit the nail on the head i guess

young flame
#

tim what bot would you want to see?

quartz kindle
#

hey now, no stealing ideas :^)

young flame
#

im not

slender thistle
#

AI that translates code from one programming language to another

young flame
#

already a bot that does that

quartz kindle
#

yes translate my js to C

slender thistle
#

Be the C to my Cython

cinder patio
earnest phoenix
#

Lol

quartz kindle
#

Cython new best lang

slender thistle
#

Cython >

earnest phoenix
#

Wth really?

daring prawn
#

border*

earnest phoenix
#

Wtf no it’s a joke lmao

slender thistle
#

border-radius: 50%?

#

Or border: none

lusty quest
#

if you need an idea, write a Discord Bot that uses AI to debug Code and make fix suggestions.

quartz kindle
slender thistle
#

Python to C# when

cinder patio
cinder patio
#

make it a website or a vsc extension

quartz kindle
#

come up with a unique game idea that can run on discord

#

turn based pong

#

space invaders with emojis

lusty quest
delicate shore
#

Hey guys

#

I am using express for my api

lusty quest
quartz kindle
#

rip

#

btw what happened to the discord store?

#

was it removed?

delicate shore
#
   app.get("/image/meme", async (req, res, next) => {
// code
   });
   app.get("/imge/dankmeme", async (req, res, next) => {
// code
   });

I have never used express before
and I have to every-time write the same code again and again for a diff endpoint
Is there way I can just do app.get("/image")
And get the / request which is after that?

quartz kindle
#

if im not mistaken

tepid osprey
#

I have asked this before but... Can I get help about it again?

cinder patio
#

What tim said ^ or you can also use query params

#

both work

delicate shore
#

Just another ques

#

Does it returns a string

quartz kindle
#

yes

cinder patio
#

yes

delicate shore
#

alr thanks

young flame
#

@quartz kindle do you think

#

i-

#

idk

#

nvm

daring prawn
#

Why does this not work?

.titleandvote .votebutton {
    background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
    border: none !important;
    transition: all .2s ease !important;
    color: white !important;
}

.titleandvote:hover .votebutton:hover {
    box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
    border: none !important;
    outline: none !important;
    border-radius: 8px !important;
}

.titleandvote:active:focus .votebutton:active:focus {
    background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
    box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
    border: none !important;
    outline: none !important;
    border-radius: 8px !important;
}

Why this not work

quartz kindle
quartz kindle
#

nor focus on two things at once

delicate shore
quartz kindle
#

yes it should

delicate shore
#

Alright

quartz kindle
#

you probably want to toLowerCase it as well

young flame
#

makes me not wanna code in the first place

quartz kindle
#

find something niche that you like and code in that area

tepid osprey
quartz kindle
#

for me its astrology/astronomy

delicate shore
#

alright

quartz kindle
#

although i've taken quite a liking to node.js libs and benchmarks so im wasting lots of time with those instead atm

young flame
quartz kindle
#

make an audio waveform generator bot

young flame
#

but when i ask for suggestions its always "oh theres to many of those", "be more unque its not gonna get anywhere" stuff like that

delicate shore
#

I got an error :(

quartz kindle
#

if you like music then do music, but dont be too competitive about it

#

because you know its a highly competed field

lusty quest
#

make a bot that is Voice controlled

#

requires some AI stuff probably

delicate shore
#

nvm

#

I am dumb

quartz kindle
#

dont focus on success. focus on excellence and success will chase you

#

~ from some indian movie

delicate shore
#

POG it worked

#

Thanks tim ♥️

quartz kindle
#

👍

limber flume
quartz kindle
#

indeed it is

daring prawn
lusty quest
#

ahh yes fun, i break down my behemoth of a single file containing common functions into single files and then indexing them

daring prawn
quartz kindle
#

pain

lusty quest
#

yea

daring prawn
#

?

lusty quest
#

but its easyer to read afterwards

quartz kindle
#

been doing it for 2 weeks actually, on and off

daring prawn
#

Okay

quartz kindle
daring prawn
summer torrent
#

i don't know css but i think you need , between class names

#

yeah you need ,

quartz kindle
#

if its different classes yes

#

but not if its parent and child

quartz kindle
#

and why do you still have the old design?

daring prawn
#

It is not from me

#

@quartz kindle search that link in this channel

#

I wanted to make that one but don't really know how

quartz kindle
#

you realize thats from 2 months ago, and its for the old website

#

the new website is very different

daring prawn
zenith terrace
quartz kindle
#

technically you can

daring prawn
#

But how

#

😂

quartz kindle
#

but rearanging the whole design of a website with css alone is a very complex task

daring prawn
#

Ohhhh

#

Hm

quartz kindle
#

just take the current design and change the things you wanna change

zenith terrace
#

tim appreciate the pets >:(

zenith terrace
#

xD

#

yes

daring prawn
#

@quartz kindle where can I view app the style tags for top.gg?

daring prawn
#

And how do I thank tim guy

quartz kindle
daring prawn
umbral skiff
#

hi

quartz kindle
#

its the only reliable way

umbral skiff
#

Best rdp specifications for music bot?

delicate shore
#

Hey since that worked out
I wanted to know how can I get the query using express which person gives

#

like /Reddit?q=aww

quartz kindle
delicate shore
#

I wanna get the part after ?q=

umbral skiff
delicate shore
#

Do I do it the same way?

#

Like /reddit?q=:file
Or something

quartz kindle
#

req.query

delicate shore
#

Oh ok
Thanks

#

But what if there are more than 2 queries

#

Like ?msg=Hi&&?Lang=English

quartz kindle
#

/reddit?a=sometihng&b=bla

delicate shore
#

Yes that

quartz kindle
#

req.query.a // something
req.query.b // bla

delicate shore
#

Oh

#

Now I get it!

#

Thanks

quartz kindle
umbral skiff
quartz kindle
#

that has nothing to do with music bots

umbral skiff
quartz kindle
#

yes, but it doesnt matter

#

you can use rdp, ssh, or anything else, doesnt matter what configuration you use

#

it does not affect the bot

#

its only how you connect to the server

umbral skiff
#

The specifications of the device do not affect the performance of the bot ???

quartz kindle
#

ram and cpu yes, but rdp no

#

rdp is the connection protocol

#

not the computer

#

you mean what cpu and ram the server should have for a music bot?

#

depends on how big the bot will be, music costs a lot of resources

#

i would start with a minimum of 2gb ram and then see how big your bot gets

earnest phoenix
#
const Keyv = require('keyv');

module.exports = {
  name: 'purge',
  description: 'Bulk deletes a certain amount of messages.',
  usage: 'clear `amount`',
  async run(message, args) {
    if (!message.guild.me.hasPermission('MANAGE_MESSAGES')) {
      let msg = await message.channel.send('I require the `Manage Messages` permission in order to perform this action!');
      msg.delete({ timeout: 2000 });
      return;
    }

    const amount = parseInt(args[0]) + 1;

    if (isNaN(amount) || amount < 2 || amount > 100) {
      let msg = await message.channel.send(`You must enter a number higher than 0 and less than 100.`);
      msg.delete({ timeout: 2000 });
      return;
    }

    message.channel.bulkDelete(amount, true).catch(async (err) => {
      console.error(err);
      let msg = await message.channel.send(`Can't delete messages older than 2 weeks.`);
      msg.delete({ timeout: 2000 });
      return;
    });

    const clearEmbed = new Discord.MessageEmbed()
      .setColor('#90ee90')
      .setTitle("purge")
      .setDescription("succesfully purged the messages")
      .setTimestamp(new Date());

    
message.reply(clearEmbed).then(m => m.delete({timeout: 2000}))
  }
}```
umbral skiff
earnest phoenix
#

This is allowing other members to purge...

#

What’s the reason?

umbral skiff
#

1vcpu and 2GB RAM Good ?

earnest phoenix
#

Oh found out..

late plank
#

amount < 2 || amount > 100
You must enter a number higher than 0 and less than 100.
did you mean amount < 1

quartz kindle
#

then you have to wait and see how big it gets

late plank
#

although if the bot holds little state that's a ton of memory

daring prawn
# quartz kindle for now yes

Hey sorry but how do I make a gif come in my page like the footer or as soon as u go to the bot page u see a gif

quartz kindle
#

you can put a gif in the description

frosty valve
#

what is the new dblapi.js?

daring prawn
#

@frosty valve top.gg-sdk?

frosty valve
#

oh, ok

daring prawn
quartz kindle
#

upload it somewhere then put the link

#

or convert it to base64

daring prawn
quartz kindle
#

then you did wrong

daring prawn
quartz kindle
#

with markdown or html

earnest phoenix
#

yo

#

How can visual studio show the text typed by the user in colored text (basically formatting PLAIN TEXT inside an input element) ❓

#

huh

#

you mean syntax highlighting?

#

yeah

#

you cant put html inside the element

#

and css is pointless

#

vsc has their own highlighting engine

#

it's open source so you can check it out if you want to

#

otherwise look into highlightjs

#

googling around gave me this

empty hound
#

How to log in discord web us acunt discord apk

umbral skiff
#

windows 10 pro 1809 or window server for bot??

earnest phoenix
#

neither

#

use a linux distro

umbral skiff
#

I haven't tried Linux not once

earnest phoenix
#

there's a first time for everything

umbral skiff
#

i use vicoal studio code Is it in Linux system?

earnest phoenix
#

no

#

well

#

actually i think so

#

but for hosting you wouldn't install vsc there

lusty quest
#

windows servers are way to expensive

earnest phoenix
#

you would just deploy your bot files there and run with whatever runtime you're using

earnest phoenix
umbral skiff
#

Now I am going to buy RDP and have options. I should choose the system, so what should I choose

lusty quest
#

yea

#

also the filesystems are quite inefficent

#

well this where badly phrased

#

windows software raid is inefficent

earnest phoenix
#

id go for ubuntu if it's an option

#

or any other debian distro

floral tide
#

red hat isnt bad too

lusty quest
#

but is less new user firendly

floral tide
#

yea

#

for beginners ubuntu is better

umbral skiff
floral tide
#

18.04

#

the 18.04 lts is better

#

if you are new

umbral skiff
#

I have no experience with Linux

floral tide
#

go ubuntu

#

then

lusty quest
#

or debian is also fine

umbral skiff
#

Can any of you help me in Linux

floral tide
lusty quest
floral tide
#

i kinda do

#

hard can it be to teach a person

lusty quest
#

it depends on how fast the person can learn, ive met people here who where unable to use a ! in a function for 2 days

floral tide
#

hmm

#

so have i

earnest phoenix
#

your voice variable is already a channel

#

you can also remove that if check by doing ```js
voice ?? "None"

#

im having an aneurysm now

#

bye

drifting wedge
floral tide
drifting wedge
#

like idk how i would do it

#

without like 10000000 if statements

late plank
#

the answer is arrays

#

any time you're writing a bunch of if statements like this - chances are you're not thinking about arrays, I kinda expected to be looking at a bot, so that's about all the advice I can give, I don't know webdev

drifting wedge
#

dw about the web stuff

#

like html/css

#

just literally the js

#

basically the ifs statement

#

how would i do array?

earnest phoenix
lyric mountain
#

for em3 to be highlighted, both em1 and em2 must match given pattern, right?

drifting wedge
#

sure 🙂

#

well not necessarily

#

em3 is the 3rd square

#

so any pattern that has the top right square works

lyric mountain
#

ok, let's start by removing this parts:```
let em1 = document.getElementById("1");
let em2 = document.getElementById("2");
let em3 = document.getElementById("3");
let em4 = document.getElementById("4");
let em5 = document.getElementById("5");
let em6 = document.getElementById("6");
let em7 = document.getElementById("7");
let em8 = document.getElementById("8");
let em9 = document.getElementById("9");

#

you can put it like this:

drifting wedge
#

ty btw 🙂

lyric mountain
#
let squares = []
for (int i = 0; i < 9; i++) {
  squares[i] = document.getElementById(i + 1);
}
#

this will fill the array with the elements

drifting wedge
#

what does the stuff in the for loop do?

#

like i dont understand that

#

the rest i do

#

but not the int i = 0; i < 9; i++

lyric mountain
#

ah, that's a bounded loop

#

replace int with let actually

#

let i = 0 means the loop will start with variable i set at 0

#

i < 9 means it'll run until number 9, exclusive

drifting wedge
#

oh also

#

it doesnt reset the game

#

after someone wins

#

which it should

#

cuz look

lyric mountain
#

i++ means it'll increase i after each iteration

#

sure

drifting wedge
#

but thats ez

#

on win call func to empty board

zenith terrace
#

you were already answered

drifting wedge
#

KuuHaKu is typing

quartz kindle
#

godhaku

lyric mountain
#

then to check the array for 3 X's or 3 O's, you can use something like this:

let winner = null;
for (let r = 0; r < 4; r++) {
  let columnCount = 0;
  let currCharInColumn = null;

  for (let c = 0; c < 4; c++) {
    let char = squares[c + (3*r)].innerHTML;

    if (char === firstCharInColumn) {
      columnCount++;
      if (columnCount === 3) winner = char;
    } else if (firstCharInColumn == null) {
      firstCharInColumn = char;
      columnCount++;
    } else break;
  }
}
#

something like this

#

well, there's still diagonal check

drifting wedge
#

alr that makes sense

lyric mountain
#

but it's just to get the idea

drifting wedge
#

but how would i get diagnal or vertical?

#

ye

lyric mountain
#

vertical and horizontal is already there

#

basically, you have an array of 9 elements

drifting wedge
#

mhm

lyric mountain
#

r equals to row number

#

c equals to column number

#

to get slot, squares[c + (3*r)]

#

that's because all 2nd-row elements will be in indexes 3-5

#

and 3rd-row elements will be in indexes 6-8

#
for (let c = 0; c < 4; c++) {
    let char = squares[c + (3*r)].innerHTML;

    if (char === firstCharInColumn) {
      columnCount++;
      if (columnCount === 3) winner = char;
    } else if (firstCharInColumn == null) {
      firstCharInColumn = char;
      columnCount++;
    } else break;
  }
#

this checks the current row

#

if the currentChar is null, it assigns it and increases counter

#

if it's not null, but matches the current square, it increases the counter

#

if it's not null and doesn't match, it exits

#

actually, stopping to think, the way it checks vertical elements would not work

#

updated my code, now it checks only horizontal

#

to check vertical, you just need to flip direction:

let winner = null;
for (let c = 0; c < 4; c++) {
  let rowCount = 0;
  let currCharInRow = null;

  for (let r = 0; r < 4; r++) {
    let char = squares[c + (3*r)].innerHTML;

    if (char === firstCharInRow) {
      rowCount++;
      if (columnCount === 3) winner = char;
    } else if (firstCharInRow== null) {
      firstCharInRow= char;
      rowCount++;
    } else break;
  }
}
#

this is the same as row-counter, but it'll check for columns

#

and finally, for diagonal:

let winner = null;
for (let d = 0; d < 4; d++) {
  let diagCount = 0;
  let currCharInDiag = null;

  let char = squares[d + (3*d)].innerHTML;

  if (char === currCharInDiag ) {
    diagCount++;
    if (diagCount === 3) winner = char;
  } else if (currCharInDiag == null) {
    currCharInDiag = char;
    diagCount++;
  } else break;
}

for (let d = 2; d > -1; d--) {
  let diagCount = 0;
  let currCharInDiag = null;

  let char = squares[d + (3*(2-d))].innerHTML;

  if (char === currCharInDiag ) {
    diagCount++;
    if (diagCount === 3) winner = char;
  } else if (currCharInDiag == null) {
    currCharInDiag = char;
    diagCount++;
  } else break;
}
#

basically, you want to check exactly indexes 0, 4 and 8 (first diagonal) then 2, 4 and 6 for second diagonal

#

if the current char changes, you already know it'll not be a winning sequence

#

did that make any sense?

#

after all that, you just need to check the value of winner

#

it'll either be null, 'O' or 'X'

#

msg.toLowerCase() === 'command'

#

msg being the content

cinder patio
#

toLowerCase*

summer torrent
#

message.content

lyric mountain
#

oh, nvm

#

just noticed the lowercase C

cinder patio
#

ye

solemn jolt
#

@earnest phoenix just show the msg content

lusty quest
#

i do not have to understand why this gives me the Guild object and not the id right? ```js
const {guild} = message //message passed by command handler
console.log(guild.id); //gives me the Guild Object not the ID

lusty quest
#

this makes no sense?

lusty quest
cinder patio
#

Why are you putting the if statement inside a command? Oh dear

#

you don't know what you're doing, do you

lusty quest
#

i know

#

but for some reason i get the object and not the id, ive checked now 2 times that ive uploaded to the correct folder

opal plank
#

hmmm i wonder if this is possible

lusty quest
#

well then back to the drawing board and time to figure out why it broke, thanks to github ive where able to revert to an older version

drifting wedge
#

oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) Invalid "refresh_token" in request for gunicorn / flask / nginx

lusty quest
#

what token did you send to refresh?

daring prawn
#

How do I ake my background gif like this https://top.gg/bot/779230692960632832

#

make*

quartz kindle
#

just inspect element

drifting wedge
zenith terrace
#

thats weird to look at

drifting wedge
#

it happens when i open the page

#

when i refresh it works

quartz kindle
#

how does that bot have 18 reviews with only 128 servers lmao

#

are they buying reviews?

zenith terrace
#

they are all 5 stars as well

#

which no bot would ever have

quartz kindle
#

review-locking commands

lusty quest
# drifting wedge wdym

you have to send a refresh token to the oauth service to refresh your auth token, if you send the wrong one you get the error. you get your refresh token when you connect to oauth

quartz kindle
#

next level strats

zenith terrace
rustic nova
#

Turkish bot

quartz kindle
#

xD

rustic nova
#

doesn't surprise me

drifting wedge
#

if u reload it works

#

but if u just open the page it wierd

lusty quest
#

wired.

#

maybe your workflow got an issue

#

but idk flask

drifting wedge
#

only reloading sometimes

#

actually

zenith terrace
#

that gif background hurts to look at on that bot as well

opal plank
#

i second startgirl

#

wait a second

#

wait, since when the top.gg links embed?

rustic nova
#

hm?

#

always

#

or wdym

opal plank
#

not that one

#

the bots

rustic nova
#

they always did so too

opal plank
#

i dont recall it embedding a couple months ago

rustic nova
#
#

the fuck?

lusty quest
#

they get now more informations than they used to

rustic nova
#

ah

#

the bot embed was always a thing

opal plank
#

hmmmm thats interesting, i completely missed it

#

also, another question, if you set message cache to be 0 on d.js, and you initiate a collector when that message is passed, does the reference get deleted and stop the collector from working? or does it not delete the message reference until its not being used? or am i completely misunderstanding how the collector works internally?

#

im having some odd behaviour, which is, when i initiate 4 message collectors on 4 different messages, only the last message sent's collector work. Which is odd, shouldnt d.js shield the collectors message to not be deleted so it doesnt stop working?

quartz kindle
drifting wedge
#

its not even oath

#

its just nginx

opal plank
drifting wedge
#

its oath

opal plank
#

messageCacheMaxSize: 1 and try sending 3 message collectors, the behaviour im getting is that only the last one works

quartz kindle
#

wdym only the last one works? that makes no sense

opal plank
#

exactly

quartz kindle
#

code?

opal plank
#

let me send you in dm, too much Portuguese shit

quartz kindle
#

is it a message collector or a reaction collector?

opal plank
#

reaction*

#

my bad

#

well rip hastebin

#

nice, hastebing not working

#

perfect

rustic nova
#

bing

#

just host your own one

opal plank
#

duckgo

rustic nova
#

yandex

opal plank
#

baidu

tribal siren
#

Hello

#

Just a quick question

#

You know yddgrasil?

#

that bot with the userphone command

#

Does it require GUILD_PRESENCES Intent?

smoky herald
#

i mean, obviously that you need 2FA 😂 but where does it come from

tribal siren
#

oof

#

one sec

sudden geyser
tribal siren
#

read bottom

#

i think you don't have 2fa on

smoky herald
#

hmmm, so If me as the bot owner don't have 2FA and a user on a server requiring 2FA tries to use a command with for example Manage Messages the promise fails and throws that log?

rustic nova
#

yes

solemn leaf
#

is presence from message.author or message.member?

rustic nova
#

both are guild members iirc

#

check docs i suggest

smoky herald
#

alriight, thank you guys 💖

rustic nova
#

author returns user
member returns guildmember

earnest phoenix
#

Can someone pls provide the link of web which provide free of cost python course

zealous sable
#

I

#

gave you it like 20 mins ago

earnest phoenix
zealous sable
#

Well if you want a high quality course then sure a little bit of money to spend on a udemy course isnt bad

#

if you have a github student account you can get a free "One Month" course for 30 days

signal estuary
#

How can i save things via json file etc? I want to make settings, so that you can disabel commands on a server. So the command doesnt only work on exactly this server, but on the others it works. How can i do this? How can i save things?

sudden geyser
#

A JSON file may not be the best solution to this problem, but you'd need to read the file, parse it to something readable (for your program), modify it, then parse it back to JSON and write back to the file. I don't know what language you're using, nor should you really be using JSON if you want to have dynamic settings. A database (e.g. SQLite) may be better for the job.

signal estuary
lusty quest
#

use a proper database like sqlite, Mysql, Postgres, MongoDB, json is not really suitable for being used as a database

signal estuary
#

can someone recommed me a tutorial or a video or a doc where i can do it?

glossy spoke
#

java-script lmao

lusty quest
#

did you know what you want to use?

#

Mysql, postgres and mongodb require a server

#

sqlite can be used locally

sudden geyser
#

Assuming you know SQL

earnest phoenix
#

whats sqlite

earnest phoenix
lusty quest
sudden geyser
restive furnace
#

it's fast

earnest phoenix
#

Should I use it

restive furnace
#

yes

earnest phoenix
#

ok

restive furnace
#

if ur using mongoose, def if ur using mongodb then stay with it

sudden geyser
#

One tool may be better than the other in certain areas.

#

I don't need to use the moment library but it may be handy since it's extensive on dates and time

#

But I choose to use dateformat instead

lusty quest
#

sqlite is nice, but annoying to use if you start to shard across mutiple machines

restive furnace
#

since I basically reinverted the wheel, implemented almost everything on my own

#

for a 5 guilds bot

lyric mountain
#

imagine an inverted wheel

restive furnace
#

well i didn't want my node_modules folder to grow into like 5 GB and didn't want package hell™

sudden geyser
restive furnace
#

ah ok

sudden geyser
#

@opal plank you have that file with the guy who sent like 20-30 requests to get the weather in a bunch of locations

opal plank
sudden geyser
#

ty

quartz kindle
#

LMAO you actually saved it?

#

this is gold

opal plank
#

indeed

#

no way i would let the actual definition of bad code be lost through the ages

#

imma submit this onto urban dictionary or some shit, its worth that much

quartz kindle
#

put it on reddit

knotty quartz
#

I reslived the issue @quartz kindle it was because I didnt format

#

You are right formatting is easier

misty sigil
#

callback hell

#

and too many embed fields

#

just BLEGH

knotty quartz
#

Is it Ctl alt 7 for formatting on repl?

#

So I can format the newer code I put in

lyric mountain
earnest phoenix
#

i gotta try to move to a new db

#

json file is failing me

#

75 servers in 24h is more stressfull than you think

cinder patio
#

we told you

#

a few times

mellow kelp
#

how much time did it take for top.gg to approve bots again?

#

maybe it's different now

summer torrent
#

1 week

mellow kelp
#

o

#

aight thx

cinder patio
#

I'm questioning whether I should write my own parser or use an existing one like acorn or esprima

opal plank
#

prob use acorn

cinder patio
#

ooh or maybe use a parser generator

lyric mountain
#

"move to a new db"
"json file is failing"

opal plank
#

acorn is pretty damn good, dont see much of a use writing your own parser

cinder patio
#

The thing is, I'm not parsing javascript, but a custom language, which is simpler than js

#

It's very similar to js though, so acorn is definitely an option

opal plank
#

i'd probably try sticking with acorn if possible, its a lot of work to make your own parsers

earnest phoenix
earnest phoenix
cinder patio
#

And the docs are pretty shitty

opal plank
opal plank
cinder patio
#

The docs don't say what the node really represents, they only show the structure, yeah I can guess but sometimes it's not clear enough

#

while if I make my own, it's going to be optimized for my language and it's going to be way simpler

#

I've used parser generators before but I can only find one that's for JS

#

and it's wip 😢

#

Guess I'd have to use good ole bison and yacc and have a C++ backend and all that

#

wait there's bison in js pogey

restive furnace
#

no, stick with C++ plez

#

parsing in C++ EZier

sharp plinth
#

Hey does someone know how could i code a command which changes the language of the bot ?

mellow kelp
#

you can store guild settings in a database

#

then you could use something like a json file to store messages for each language

lusty quest
knotty quartz
#

Hii can I get help it nothing bad just one simple error that isnt higlighted

lusty quest
#

i18 is a localisation framework

mellow kelp
lusty quest
#

i dont use it for now but i plan to use it, if i understand how it works

#

a other way would be making a local file/database entry with your translations and map them

cinder patio
#

hmm... antlr4 vs jison, which is the better parser generator?

#

I think I'll go with antlr4, it has more starts and the generated parser can also be used for other languages

light nebula
#

-help

restive furnace
#

JSON5 gang

cinder patio
#

I'm gonna use it for js

#

but it supports java, c++/c, go, C#, swift, php

#

it looks fun to work with

earnest phoenix
#

I'm trying to install node v12 on my ubuntu vps, but everytime I try to install it, it just installs v13

solemn latch
#

is there a reason you specifically need v12?

earnest phoenix
#

sqlite3

#

Won't install with v13

solemn latch
#

it says it supports any version over 10.20.1

#

are you sure you have all the requirements for sqlite installed?

earnest phoenix
#

yea

#

im so confused

#

well im getting a different error then lmao

solemn latch
#

which version are you using of sqlite? better-sqlite3 is the most used one.

earnest phoenix
#

It's just sqlite3

#

It's a package that mongodb requires

solemn latch
earnest phoenix
#

This is the error when attempting to node start my bot.

#

EH

solemn latch
#

i dont see anywhere on mongo's page that it requires sqlite

earnest phoenix
#

My bot is for some reason saying I need sqlite3 to be installed

#

They're entire separate databases lmao

solemn latch
#

are you using sqlite in your code?

earnest phoenix
#

No lmao

earnest phoenix
#

discord.js

#

just d.js

#

why would you need sqlite anywhere in your code

#

Maybe another module requires sqlite3 to be installed?

cinder patio
#

show the dependencies object inside your package.json, some trash package may need it

earnest phoenix
#

it might be a problem in the env file could you send it here so we could check

#

imma pastebin it

#

did this man just send the wrong file

#

The modules i've got installed are discord.js unirest express body-parser mongodb

#

did i

#

no

#

we said package.json NOT package-lock.json

#

there is no package.json

#

lmao

#

wait what's unirest

cinder patio
#

they both work technically -

#

wait why

earnest phoenix
cinder patio
#

there should be a package.json

earnest phoenix
#

uh

solemn latch
#

i didnt think node even would run without a package.json

cinder patio
#

it would

earnest phoenix
#

then how does one fix the issue lmao

#

Probably why node start is failing is because there is no main file

#

Nope

earnest phoenix
#

Local hosting runs perfectly fine

#

No other package in that looks sus

#

But since i've moved everything over to my vps, it's messing up

cinder patio
#

nah it's not unirest

#

none of those require sqlite

earnest phoenix
#

form-data mime request

solemn latch
#

copy pasted modules?

earnest phoenix
#

Nope, re-installed

#

I'm locally hosting my bot using node v12, that's why im wondering if it's v13 that's giving me issues

#

Since the VPS is on node v13

solemn latch
#

99% of v12 things work on v13

earnest phoenix
#

do these shell commands one by one in order:

npm uninstall
npm init -y
npm install discord.js express body-parser mongodb
#

This should make a package.json and also reinstall every single module

earnest phoenix
#

Discord.js versions that use nodejs v14 wouldn't work on replit because replit is on nodes v12

#

Uninstalling all modules

#

one sec

#

Ok

#

lol

#

npm init -y gave me an error

#

nvm

#

it didnt

#

just me being stupid

#

@solemn latch is copy pasted modules bad tho?

#

out of curiosity

solemn latch
#

yeah

cinder patio
#

yes

#

especially for native modules

#

and also it's a waste of time

solemn latch
#

just going from different node versions you should really reinstall your modules.

earnest phoenix
#

how the heck would someone else tell you what packages you need for your project

solemn latch
#

changing systems you absolutely should.

earnest phoenix
#

@earnest phoenix why not in the bots folder

#

Okay

#

Re-installed everything

#

Went to run the bot

#

Error: Cannot find module 'sqlite3'

#

But nothing needs it

solemn latch
#

what code editor do you use?

earnest phoenix
#

pls don't laugh

#

but atom

solemn latch
#

i dont remember if atom searches all files
try control + f then search sqlite3

earnest phoenix
#

CTRL + F searches the file thats open

#

hol' up

#

I think I got something

#

nvm

#

all crap lmao

#

Should I try installing sqlite on the vps again?

solemn latch
#

what did you find?

earnest phoenix
#

It was what was on my local node_modules folder

#

Instead of the VPS

signal estuary
#

how can i write in files for example text files or json files via a discord bot?

earnest phoenix
#

use fs

signal estuary
solemn latch
#

generally speaking, you should not write to text files or json files with code as its easily corruptable.

#

if you need to write data, you should be using a database.

earnest phoenix
#

Alright

signal estuary
earnest phoenix
#

I kinda found a way around it

#

I used to use the god awful package discord-economy, which auto installs sqlite when installing the package

#

Seems to have worked but I don't wanna keep discord-economy on there lmao

signal estuary
#

just want to know how to write in a txt file

pale vessel
#

just fs.writeFile()?

solemn latch
#

yeah

earnest phoenix
pale vessel
earnest phoenix
#

or go to the documentation of fs

pale vessel
#

confused

earnest phoenix
#

same

signal estuary
#

fs.writeFile("./report.txt", report + msg.author.tag)
should this work? "report" is nothing else then msg.content

dusky sundial
#

I would add a space or \n after report + for visual purposes

#

and keep in mind that writeFile() replaces the content in the file

solemn latch
#

doesnt matter if he uses writeFile he doesnt want to store it ;p

dusky sundial
#

He doesn't? upsidedown_thinking

solemn latch
dusky sundial
#

But-

solemn latch
#

🤷‍♂️

dusky sundial
#

Alrighty then shrug

#

I don't wanna quench my thirst, I just wanna drink water

signal estuary
# solemn latch yeah
                if(err) throw err;
            })

Hes writing in the file, but hes deleting the first message, when a new message comes

solemn latch
#

yeah thats how writefile works

signal estuary
#

but he should delete, he should write it, but not delete the other message, which is already stored in the file

pale vessel
#

oh you want appendFile()?

signal estuary
#

whats the different?

pale vessel
#

it... appends

dusky sundial
#

appendFile would add onto the file, instead of replacing the content

#

It takes what's already in the file, and adds the new stuff onto it

sinful pike
dusky sundial
#

writeFile replaces, appendFile appends

signal estuary
dusky sundial
lyric mountain
hoary delta
#

I'm trying to figure out how I can use es6 with the shardingManager... I keep getting a "cannot use import statement module" error after passing my "./bot.js" file to the shardingManager constructor.

robust blade
#

can someone tell me what is this

bot.user.displayAvatarURL()
lyric mountain
#

the user's avatar

glacial pagoda
pale vessel
#

End Function

glacial pagoda
#

Where is That

lyric mountain
#

why alternate caps

glacial pagoda
#

What

pale vessel
#

End If

#

You See, Why Are You Typing Like You're Writing A VB Application?

glacial pagoda
#

Um

lyric mountain
glacial pagoda
#

Yeah

lyric mountain
glacial pagoda
#

So Dont I Have tp Put The Flag

pale vessel
glacial pagoda
#

I Dont Know What A VB Application Is

dusky sundial
#

Why does every word start with a capital letter crycat

lyric mountain
#

exactly

lyric mountain
#

the bot doesn't have the required perm in the server

glacial pagoda
#

Yeah it does

lyric mountain
#

it doesn't

#

check channel perms

dusky sundial
#

If it did, you wouldn't get the error

glacial pagoda
#

Ok Ill Check

#

OH I GET IT NOW, I NEEDS TO BE AT THE TOP OF THE HIGHERACHY

#

Ok Thanks!

lyric mountain
#

cool, now we also have sql syntax

dusky sundial
lyric mountain
#

anyway, yw

dusky sundial
#

sql is such an angry language

sage bobcat
#

One message removed from a suspended account.

lyric mountain
#
Please, select all data from table users

wrong syntax

#
SELECT * FROM USERS

correct

lusty quest
#

lol how did you fail a container build?

sage bobcat
#

One message removed from a suspended account.

dusky sundial
lusty quest
#

show your dockerfile

lusty quest
dusky sundial
#

TODAY WE'RE LEARNING ABOUT SQL QUERIES

sage bobcat
#

One message removed from a suspended account.

dusky sundial
#

Who am I kidding, I hate children, I could never be a teacher

#

Although, it feels like half of the teachers hate children too so idk :,)

lusty quest
#

dont be a teacher on elementary schools, do it when they are able to legally Drink, if you are in the US then RIP

lyric mountain
#

imagine making oral tests about regex

#

anyone passing by the door would think it's an alien school

lusty quest
#

the autistic kid will do it like a mantra

pale vessel
#

forward slash opening parenthesis period plus closing parenthesis forward slash g m