#development

1 messages · Page 1411 of 1

hasty mulch
#

How do I do that?

wispy pulsar
#

Ic

unborn ridge
#

  let chx = db.get(`welchannel_${member.guild.id}`);
let autorole = db.get(`autorole_${member.guild.id}`)
const channel1 = db.get(`mcountchannel_${member.guild.id}`)
  if (chx === null) {
    return;
  }
  if (autorole === null) {
    return;
  }
  if (mcountchannel === null) {
    return;
  }
   let data = await canva.welcome(member, { link: "https://ak.picdn.net/shutterstock/videos/22276048/thumb/10.jpg", block: false })
 
    const attachment = new discord.MessageAttachment(
      data,
      "welcome-image.png"
    );
  
  
    const mChannel = message.guild.channels.cache.get(channel1)
    mChannel.edit(`MEMBERS: ${guild.memberCount.toLocaleString()}`)
    member.roles.add(autorole)
  bot.channels.cache.get(chx).send("Welcome to our Server " + member.user.username, attachment);
});
bot.login(config.token);

#

this is my guild member add event

wispy pulsar
#

@hasty mulch use bot.wait_for("reaction_add",....)

unborn ridge
#

mcount stuff doesnt work

#

pls

#

i am trying from long time

#

pls

#

member count hannel isnt working

wispy pulsar
#

And if reaction == ...:
Edit the message @hasty mulch

#

Idk discord.js🤐

unborn ridge
#

can u help me

#

lol

hasty mulch
wispy pulsar
hasty mulch
#

The dots being the reaction?

wispy pulsar
#

no

#

reaction = bot.wait_for("reaction_add", check = ...)

#

check for message and the user

#

You should read the documentation

#

@hasty mulch

#

U can also add a timeout

#

@unborn ridge idk js but ig member smthng requires intents to be enabled in py
In js too!?

unborn ridge
#

enabled intents

wispy pulsar
#

Added intents in code too?

unborn ridge
#

listen

stoic girder
#

How do you guys detect a "general" channel where bot can send a message when it joins the guild? I currently just get the "first" channel the bot has permissions to send messages in. I would like to improve that function, need some feedback. (ping me)

unborn ridge
#

i changed little bit

#

it updates member count

#

but 2 times only

#

pls

dusky sundial
#

@stoic girder you could either loop through the channels and try to find one that has the name "general". Another option I can think of (which isn't very efficient but might work) is to count the messages in each channel and find which one is the most popular. I'm sure there are more clever people out there who can help you with a better solution though.

latent willow
earnest phoenix
#

fields.flat is not a function

rocky glacier
#

Developmenttttt

#

I need u

dusky sundial
#

What's up?

summer acorn
#

how do I store an array, object, and boolean, in an SQLite3 datebase

dusky sundial
#

SQLite3 does not support arrays directly. Basically, it only does Ints, Floats and Text. To accomplish what you need, you have to use a custom encoding, or use an FK, i.e. create another table, where each item in the array is stored as a row.

cinder patio
#

Use integers for boolean, 1 = true, 0 = false

summer acorn
#

I see, well in that case

cinder patio
#

Arrays / Objects should be separate tables

#

Or you could JSON.strinigify them but that's kinda cheating

summer acorn
#

kekw,

#

alright then, any other SQL databases that could store Arrays, Objects, and Booleans, without any additional tables/rows?

cinder patio
#

postgres?

summer acorn
#

I looked at that, but not sure how I would use it on the vps since I suck at linux vps

cinder patio
#

Why does it have to be SQL? You could go with mongoDB

summer acorn
#

I am done with mongodb

#

lost all my data because mongodb fucked up

#

just completely randomly it just broke

cinder patio
#

that's unfortunate

dusky sundial
#

Uh oh we got a minecraft youtuber in here

#

<@&304313580025544704>

drowsy crag
#

-atmods

gilded plankBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
twilit rapids
#

...

drowsy epoch
#

Is there a channel to report top.gg bugs

unborn ridge
flat pelican
#

Can you explain why you pinged 25 moderators @dusky sundial

summer acorn
#

quick db is not a good db though

unborn ridge
#

ii think he is getting ||mad||

flat pelican
unborn ridge
drowsy epoch
#

can u send me iit

unborn ridge
#

it works best for be

cinder patio
#

Quick DB is too limited to be used in any serious project involving a database

unborn ridge
#

i am a hobby developer

#

not a serioussssssssssss dev

flat pelican
#

-faq 9 @drowsy epoch -c

gilded plankBOT
unborn ridge
#

i want to ask

drowsy epoch
#

Okay, thanks

dusky sundial
#

@flat pelican someone self-promoted in here, didn't know I wasn't supposed to mention the role. My bad

unborn ridge
#

why earlier luca was nickedhuca

#

huca

flat pelican
#

Please keep this channel on-topic

#

Move on #general if you don't need any code related help

grizzled raven
#

anyone know the rate limit for editing messages in announcement channels

green kestrel
#

i just thought i'd say, on a development note, i really LOVE sphinx search.

#

doesnt matter how big the dataset is, dont seem to be able to slow it down

#

@grizzled raven rate limits arent set in stone, discord adjust them depending on system load, your bots behaviour and other factors and they dont make the current value public

cinder patio
#

never heard of sphinx search

grizzled raven
#

oh okay

green kestrel
#

the only thing you can do is respect the x-ratelimit headers correctly

#

if you respect the rate limit headers and only send the amount it says, when it says, youll never get rate limited

#

usually your library will handle this for you

#

i have some code that doesnt use a library... and it basically does this

        if (isset($r_headers['x-ratelimit-remaining']) && $r_headers['x-ratelimit-remaining'] == 0) {
                /* Sleep and wait until we can send again */
                $now = time() - date('Z');
                $later = $r_headers['x-ratelimit-reset'] - date('Z');
                $seconds = $later - $now + 1;
                if ($seconds > 0 && php_sapi_name() == 'cli') {
                        sleep($seconds);
                }
        }
#

thats used in a script external to my bot itself, to send a queue of role changes, dm's, etc

#

its hacky, but it works

grizzled raven
#

it'd be better if there were some guide i could take, like instead of sending a request every second not knowing i should be sending it every 30 minutes or whatever

#

but yeah thanks

green kestrel
#

thats what x-ratelimit-reset tells you

#

how many seconds before you can send that request again

#

@cinder patio sphinx search is awesome, it can build a google-like stemmed search index of any data source, like mysql, mongo, mssql etc, then it presents a mysql compatible interface for searching, so you connect to it on its own port and just do like: SELECT * FROM searchindex WHERE MATCH('something')

#

and it returns matching rows 🙂

quartz kindle
#

looks nice indeed

green kestrel
#

im using it in my admin backend to allow moderators to search for questions for finding duplicates etc

#

i was using a regex search with mysql RLIKE keyword

quartz kindle
#

i dont really have a use case for it at the moment, but good to know about it

green kestrel
#

but its too complicated to do boolean searches with a regex, for non-technical users

earnest phoenix
#

error

#

how to set FFmpeg/avconv

#

means add

quartz kindle
#

npm install ffmpeg-static

harsh blade
earnest phoenix
#

@quartz kindle

pseudo wadi
#

this?

quartz kindle
#

you mean empty field?

harsh blade
#

Yeah?

quartz kindle
#

"\u200B"

harsh blade
#

Right

#

so

(`Admincmds,\u200B`)
quartz kindle
#

wut

#

what exactly are you trying to do?

harsh blade
#

Get rid of the "undefined" value

quartz kindle
#

show your code

harsh blade
#

I Did it once before but forgot

#
if(args[0] === "Admin".toLowerCase()) {
let usuario = new MessageEmbed()
.setAuthor(message.author.username, message.author.displayAvatarURL({ format: 'png', dynamic: true, size: 1024 }))
.setTitle("Admin Commands")
.setColor(message.guild.me.displayHexColor)
.setTimestamp()//Este es el embed de error, Solo necesitas uno. //:v, ok xdxd
.addField(`\`,panel\`\`,done\`\`,site\`\`,status\`\`,list\`\`,rate\`\`,form\`\`,host\``)
message.channel.send(usuario)  
quartz kindle
#

fields need two arguments

#

.addField(title, value)

harsh blade
#

Yeah, i was wondering what to set as value xD

quartz kindle
#

if you want to have no title, you can do .addField("\u200B", "your content here")

#

or the other way around if you want no value

carmine summit
#

How bout .setDescription()

#

Or is it .addDescription()

harsh blade
#

Thank you Tim

quartz kindle
#

setDescription

high helm
#

Hey, today I realized my bot wasn't working, I printed the debug info to the log and this is what is shown:

quartz kindle
#

and yeah, would make more sense to use a description instead of a field

high helm
#

Any idea what this means? I'm using Discord.js

carmine summit
#

Maybe regenerate your token?

high helm
#

I did

quartz kindle
#

you exceeded the daily login limit

carmine summit
quartz kindle
#

you cant login again until your limit is reset

carmine summit
#

Bot be like: Restart every 10 minutes

high helm
#

I don't know what's going on, because this bot's been up for months and I didn't even touch it 🤔

quartz kindle
#

does it have a process manager like nodemon, forever or pm2?

high helm
#

pm2 yes

carmine summit
#

Someone might've been spamming a comamnd that causes the bot to overload and to crash

high helm
#

:o

quartz kindle
#

likely something happened that caused it to crash at login

#

so it kept retrying until it used all 1000 logins

high helm
#

makes sense

quartz kindle
#

does pm2 not show any error or crash logs?

pseudo wadi
#

1000 logins

quartz kindle
#

try pm2 logs botnamehere --lines=500

carmine summit
#

But he said he didn't touch it in months

high helm
#

ok

quartz kindle
#

and see the logs from the error log

high helm
#

oh frick it's a regex error in my command parser 😛

quartz kindle
#

rip

high helm
#

well, good to know, will fix

#

thank you guys

dusky obsidian
#

Hello,
While sending a python syntax message, when I type a # it comments out all the code after it. But python supports single line comment with #

hard anchor
#

Hi everyone, I have a problem with Discord.py, I want to send random memes without reddit api because I want custom images, but I can't find code for that.

solemn jolt
#

Why i have a error in this code

if (message.content = "list") {
let data = await Guild.findOne({ guildID: message.guild.id })
let Cmd = []
for (let i = 0; i < data.whitelist.length; i += 1) { 
        
Cmd.push(`<@${data[i].type}>`); 
       }
message.channel.send(Cmd);
}
lusty quest
#

if you use a automatic login after a crash or season timeout make sure to add a delay or you end up getting locked out of the API. had the same issue, now i have a 10 seconds delay before the bot logs in again. if he fails 5 logins in a row he goes offline

solemn jolt
#

I have a error in Cmd.push(...)

lusty quest
#

what did you want to add to your array? the string?

earnest phoenix
#

What's the error exactly

solemn jolt
#

I don't now

#

Error say type is undefined

lusty quest
#

thats the best answer tbh

earnest phoenix
#

So the index you're looking for in that data array is undefined which means it doesn't exist

#

Did you mean to do data.whitelist[i].type?

solemn jolt
#

I create array like whitelist: { type: Array, default: [] }

#

And i pushed data like

earnest phoenix
#

Wait a minute, why are you even doing a for loop anyway

#

${message.member.voice.channel.client}

#

not work

solemn jolt
#

await Guild.findOneAndUpdate( { guildID: message.guild.id, }, { $push: { whitelist: { type: user.id } }, })

lusty quest
#

this is wrong

earnest phoenix
#
let Cmd = data.whitelist.map(w => w.type)```
#

huh

lusty quest
#

type is not defined

earnest phoenix
#

right?

solemn jolt
#

😅

lusty quest
#

type is used for Defining what sort of field it make in the Document

solemn jolt
#

Wait iam testing

lusty quest
#

just remove type

earnest phoenix
#

what is right ?

lusty quest
#

if you want to use the userid as key make it an object

earnest phoenix
#

The error isn't because of that

solemn jolt
#

Yes

lusty quest
#

well he doenst get valid data bcs of this

earnest phoenix
#

data[i] is undefined

solemn jolt
#

Wait

earnest phoenix
solemn jolt
#

I send a file

earnest phoenix
#

this

#

work

#

but

#

${message.member.voice.channel.client}

#

not work

#

what solution

#

Channels don't have a client property

#

so

#

?

lusty quest
#

what did you want to get in the first place?

earnest phoenix
#

id?

#

<What are you trying to do>

#

<#${message.member.voice.channel.client}>

#

vc tag

solemn jolt
#

Look

lusty quest
#

you want to mention the voicechannel?

earnest phoenix
#

Just do

#

yah

rustic nova
#

lol

earnest phoenix
#
${message.member.voice.channel}```
rustic nova
#

@earnest phoenix is selfbotting

solemn jolt
#

I think yes

#

Self bot

rustic nova
#

@flat pelican

#

he gone

#

he's definitely getting beaned

solemn jolt
#

I have error in line 65 in type

lusty quest
#

@solemn jolt remove the type: where you push the userid

hard anchor
#

@client.command(pass_context=True) async def meme(ctx): embed = discord.Embed(title="", description="") async with aiohttp.ClientSession() as cs: async with cs.get('https://www.reddit.com/r/dankmemes/new.json?sort=hot') as r: res = await r.json() embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url']) await ctx.send(embed=embed

rustic nova
#

!yardım

lusty quest
#

wtf this bot

rustic nova
#

@drowsy crag selfbottumn

solemn jolt
#

@lusty quest how

lusty quest
#

@weak parrot here is a selfbot

earnest phoenix
#

@earnest phoenix vc tag not possible?

pseudo wadi
#

that looks like selfbot ?

weak parrot
#

!yardım

earnest phoenix
#

huh

rustic nova
#

send a link

weak parrot
rustic nova
weak parrot
rustic nova
#

Thanks headpat

flat pelican
#

hmm

weak parrot
#

Wow Karen

earnest phoenix
#

@solemn jolt Change it to this

let arrayIfCustomCommands = data.whitelist.map(w => w.type);```
#

Done

lusty quest
#

@solemn jolt whitelist: {user.id} }

earnest phoenix
#

No no no

#

vc tag not possible?

solemn jolt
#

I test this

earnest phoenix
#

That's not where the error happens

lusty quest
#

he pushes the userid as a object

#

into an array

hard anchor
#

@client.command(pass_context=True) async def meme(ctx): embed = discord.Embed(title="", description="") async with aiohttp.ClientSession() as cs: async with cs.get('https://www.reddit.com/r/dankmemes/new.json?sort=hot') as r: res = await r.json() embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url']) await ctx.send(embed=embed

lusty quest
#

and when he try to get the Userid its undefined

#

bcs Mongoose wont write it into the db

hard anchor
#

Hello, I have a problem with that code

earnest phoenix
#

The error happens in data[i].type where data[i] is undefined when he was planning to Iterate through data.whitelist as he did data.whitelist.length

lusty quest
#

yea but this will be still empty

#

bcs the Validation Mongoose does blocks that he writes data to the database

solemn jolt
#

Ok

earnest phoenix
lusty quest
#

iirc you cant tag VC channels

sturdy vine
#

quick.db not working with heroku?

earnest phoenix
#

Heroku doesn't support external databases

sturdy vine
#

how to store data then?

earnest phoenix
#

Well in saving data after restart

sturdy vine
#

buy

#

?

earnest phoenix
#

Use MongoDB as an example

sturdy vine
#

dyno

#

oh ok

lusty quest
#

Heroku supports external DBs but no local DBs

#

you can get quick.db working there but with some stupid workarounds

sturdy vine
#

heroku's free dyno resets everyday

lusty quest
#

yea this is why Free hoster suck

sturdy vine
#

pls tell

lusty quest
#

idk how never used them but i know a few users here use a Github repo to write the db files in there before it restarts

sturdy vine
#

😮

lusty quest
#

and if the bot starts it pulls the files from github

sturdy vine
#

ok ty

lusty quest
#

i do not recommend it

sturdy vine
#

json files are used to store data?

lusty quest
#

use Firebase or MongoDB atlas for a better way to save stuff

#

dont. use it only for Configs

sturdy vine
#

ok

lusty quest
solemn jolt
#

@earnest phoenix this code get me the all id but how i can mention it?

earnest phoenix
#
let arrayOfCustomCommands = data.whitelist.map(w => `<@${w.type}>`);```
solemn jolt
#

Thankyou😁 👍

kind thicket
#

How do I add coins to a mentioned user, it's currently only removing them from me

const mentionedMember = message.mentions.members.first();
  money[mentionedMember.id].money + parseFloat(args[1]);
  money.money - parseFloat(args[1]);
  money.save();
#

I've been trying 100 different things but cant see it

earnest phoenix
#

isn't it args[0]?

kind thicket
#

i should clarify that its a give command

#

so its
give @user amount

earnest phoenix
#

it should be args[0] i think

kind thicket
#

I mean, its removing it from me so its working

earnest phoenix
#

try args[0]

kind thicket
earnest phoenix
#

what's the best vps for discord.js?

lusty quest
#

i use a digitalocean droplet

#

the 5$ droplet gives you probably enough power for your first 1k Guilds (depending on how efficent your bot uses the resources)

earnest phoenix
#

${track.link}

#

right?

cinder patio
#

?

lusty quest
#

some context?

earnest phoenix
#

    message.channel.send({
        embed: {
            color: 'AQUA',
            author: { name: `Here are your search results for ${query}` },
            footer: { text: 'HAPPY' },
            timestamp: new Date(),
            description: `${client.emotes.music} - Now playing ${track.title} into ${message.member.voice.channel} ...}`,
        },
    });

};```
#

right?

#

no idea xd

#

any buddy help me plz

lusty quest
#

if you give some context

earnest phoenix
#

lol

#

trackStart.js

lusty quest
earnest phoenix
#

@lusty quest ^^^

#

plz

#

help me

lusty quest
#

context?

earnest phoenix
#

trackStart.js

lusty quest
#

its a file name?

earnest phoenix
#

wdum context

#

lol

lusty quest
#

what did you want to do as example. some context about what your plan is, what issues you have

earnest phoenix
#

i try to add embed

#

on

#

${client.emotes.music} - Now playing ${track.title} into ${message.member.voice.channel} ...

lusty quest
#

and?

earnest phoenix
#

nothing

tribal vessel
#

wow

#

great info

earnest phoenix
tribal vessel
#

we can totally help you

earnest phoenix
#

huh

#

^^^

#

read bruh

tribal vessel
#

/s

lusty quest
#

what tf happens nothing is helpfull as water is wet

earnest phoenix
#

what

#

😂

lusty quest
#

you give 0 useful informations

tribal vessel
#

^

lusty quest
#

like what is the expected outcome?

tribal vessel
#

lol

lusty quest
#

does your embed contains the description?

earnest phoenix
#

lol

tardy hornet
#

bro i cant see what is wrong

#
if(message.mentions.members.first() === message.author.bot) return message.channel.send('dont be dumb, im not DMing a bot')
sand condor
#

your comparing an object to a boolean

tardy hornet
#

can i do that?

if(message.mentions.bot.first()) return message.channel.send('dont be dumb, im not DMing a bot')
#

is it a thing?

sand condor
#

uh no

#

read the docs

tardy hornet
#

no need

#

figured it out

#
if(message.mentions.members.first(bot)) return message.channel.send('dont be dumb, im not DMing a bot')
slender thistle
#

sorry what

tardy hornet
#

wth, weren't you a moderator?

slender thistle
#

Was

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

xd

tardy hornet
earnest phoenix
#

how can i make my bot DM someone?

#

i forgotten the function 🤔

tardy hornet
#

just look up

#

message.mentions.members.first().send(bla bla)

#

and just make a command for that

#

with args

earnest phoenix
#

Jum

#

and what about DMing the command's author?

tardy hornet
#

as easy as it sound

#

message.author.send('bla bla')

earnest phoenix
#

oh right

#

thx

tardy hornet
#

np

slender thistle
#

An alien brainwashed community managers to demote me because I forgot to pay them 69 USD for monthly moderator subscription. Since then, Veld has contacted me to resolve everything out, but I demanded he paid me for damages in hugs, although I still have not received any.

I'm starting to think that having no time and feeling stressed out doing this all day all night did not help, either. It may be just me, but I believe the aliens are out to get me and ruin my life. Please help. I'm stuck in this plastic box with aliens around me.

#

On a serious note, time and stress are the main reasons

tardy hornet
#

wth you pay 69 dollars for being a moderator

slender thistle
#

It's the aliens, man...

sudden geyser
#

Veld has contacted me to resolve everything out, but I demanded he paid me for damages in hugs, although I still have not received any.
pandasad

tardy hornet
#

lol i just read it and understand

#
if(message.mentions.members.first()) return message.channel.send('dont be dumb, im not DMing a bot')

how to i make that if its a bot it will return

earnest phoenix
#
let mention = message.mentions.members.first();
if (mention && mention.user.bot) return message.channel.send("Don't be dumb, I'm not DMing a bot.");```
willow mirage
#

spoon feeeeddd

#

warniing

twin pagoda
#

OAuth2 bot dashboard is pog

sudden geyser
#

PHP 8.0 is a major update of the PHP language. It contains many new features and optimizations including named arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and improvements in the type system, error handling, and consistency.

cinder patio
#

aaanyways...

umbral zealot
#

PHP 8.0: 10 years in the making, 8 new features!

stark abyss
#

so....

earnest phoenix
#

they're just a tad bit too late

stark abyss
earnest phoenix
#

php 🚮 compared to other web frameworks and templating langs we have today

umbral zealot
#

php compared to reactjs is just... laughable

#

I get that it's good for back-end, that's fine. But front-end? gimme a break.

old latch
#

I think mariaDB corrupted, does somebody have any knowledge and would be free to help me?

stark abyss
#

soooooo
Basically I am trying to make a welcome image, and I want the canvas size be the url width and height.
I tried url.width, url.clientWidth, url.naturalWidth, and many more i found on internet...
I was also given an error when I tried those things

(node:217) UnhandledPromiseRejectionWarning: Error: the surface type is not appropriate for the operation```
I also tried making embed setting image and console logging and it said width and height was 0. I tried changing urls too
#

any other things I could try?

#

oh yeah I also tried getting the width/height using an npm and it failed

fiery rune
#

does anyone know, how I can let my bot print out a list of Servers, he is in (maybe via a txt file)?

umbral zealot
stark abyss
quartz kindle
#

thats not how it works

#

imgUrl is a string, not an image

#

it has no with or height or anything, its just text

stark abyss
#

oh

quartz kindle
#

you can use discord.js's messageAttachment to download the image for you

stark abyss
#

why would I download

quartz kindle
#

let image = new Discord.MessageAttachment(imgUrl);

tribal siren
#

what's wrong in message.guild.members.cache.get(args[0])

#

?

quartz kindle
tribal siren
stark abyss
#

oh

quartz kindle
#

actually the messageAttachment class cant download it for you, you need to do it yourself

quartz kindle
tribal siren
#

oh

#

ok thanks

quartz kindle
#

and you probably have it fall back to the message author

tribal siren
#

will fix

tribal siren
atomic vault
#

i am trying to host discord bot in heroku with github but if deploy get success then i get an application error.
how to solve it

tribal siren
#

thank you

stark abyss
#

well if I want to have it for multi guild then it's not very convenient way

molten yarrow
#

you can use loadImage from canvas to get the size

quartz kindle
atomic vault
# quartz kindle what error

it show like this in launch page
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail

quartz kindle
#

and did you check the logs?

atomic vault
#

ya

quartz kindle
#

and?

atomic vault
#

i try to run in heroku run

#

but in it it shows module not found

#

i type ls
then it shows all file but not the folder

quartz kindle
#

you need to say what the logs are, what the error is, what module was not found

atomic vault
molten yarrow
atomic vault
#

ok i will try

molten yarrow
#

aaay you did it

#

try startup again

atomic vault
molten yarrow
#

your Bot?

atomic vault
#

where

#

I tryed node index.js but it show module not found again

molten yarrow
#

same module?

atomic vault
#

ya discord.js

pale vessel
#

MessageAttachment downloads it for you?

#

interesting

quartz kindle
pale vessel
#

I see

quartz kindle
#

i just hands off the url to discord when sending

pale vessel
#

It just generates the object with the URL right?

#

yeah

quartz kindle
#

however it does have image metadata when you receive it, like width and height

#

but not when you send it

carmine chasm
#

Hello guys.

#

I need help

#

I developing a bot to monitor changes on sites like nike, maze artwalk and more in the shortest time possible and in a way that shows me the link of the things that entered.

#

But, I don't know how start.

#

Please help me.

distant lintel
#

Help, dad

earnest phoenix
#

my voting is not showing help me!

#

Ping me if u can help

carmine summit
#

I recommend axios

#

Then store it to a local file

carmine chasm
#

Thanks

carmine summit
#

I can't help you as I'm on mobile

earnest phoenix
#

Help me

carmine summit
#
const data = require('./data.txt')
setInterval(async () => {
let site = await axios('your site here')
if (data !== site.data) channel.send()
fs.writeFile('data.txt', site.data)
},  300000)
#

Something like that

#

@carmine chasm

earnest phoenix
#

can i get help??

carmine summit
#

Yea sure go ahead@earnest phoenix

hollow sedge
earnest phoenix
#

my voting is not showing

carmine summit
#

Screenshot

earnest phoenix
#

No error in logs!

carmine summit
#

Screenshot

earnest phoenix
#

Of?

hollow sedge
#

Or a code block

#

Of your voting code

carmine summit
#

Where it is not showing

#

And the code

earnest phoenix
#

It doesn't send webhook

carmine chasm
hollow sedge
#

?? It's obviously not showing on the top.gg site

devout mortar
#

Hello, I need help there is my bot, which is premium 28 days but it is disconnect so it is not supposed to be what to do?

earnest phoenix
#

No when someone vote it doesn't send webhook

hollow sedge
#

No one can help you if you don't show what you've tried

sudden geyser
#

Clem could you rephrase your question.

pale vessel
#

MEE6

sudden geyser
#

auctions

carmine summit
earnest phoenix
#

what i do

devout mortar
#

sorry, i speak French

hollow sedge
#

What is going on

earnest phoenix
#

a

#

?

devout mortar
#

je voulais dire, mon bot sest deconnecter alors que il est censé etre connecté que faire ?

earnest phoenix
#

@hollow sedge i send you my code ?

hollow sedge
#

Well just send it here

earnest phoenix
#

Alright, but its private should i send in your dms!

hollow sedge
#

If it's private you probably shouldn't send it to me anyway

earnest phoenix
#

@hollow sedge

hollow sedge
#

Refresh your token

earnest phoenix
#

dbl token

#

?

carmine summit
#

@devout mortar quel site est hébergé par le bot?

hollow sedge
#

Yeah

earnest phoenix
#

I regenerated it

hollow sedge
#

That is private

#

So when you post your code just remove it

#

or store it in a separate file or as an environment variable

#

Which you should be doing

earnest phoenix
#

mean

#

?

carmine summit
#

@devout mortar est-il auto-hébergé?

hollow sedge
#

Do you know what an environmental variable is?

devout mortar
#

bot désigner

earnest phoenix
#

@hollow sedge should i invite in My project??

carmine summit
#

est-ce un bot populaire comme MEE6?

devout mortar
#

non

hollow sedge
#

sigh no I don't even use JS

carmine summit
earnest phoenix
#

Brug

#

bruh

#

than?

hollow sedge
#

I'm just saying you posted your tokwn

#

Token

carmine summit
#

@devout mortar Quel site

hollow sedge
#

And you should've kept it in an environmental variable

earnest phoenix
#

i have my token in config.json

devout mortar
#

Avec l'application bot désigner

earnest phoenix
#

i have my webhook token in index.js just

thorn nexus
#

discord.js
user.presence.status doesn't work, how do I get the user status?

hollow sedge
#

Oh I'm dumb

#

Sorry lol @earnest phoenix

carmine summit
#

@devout mortar Où avez-vous acheté premium

earnest phoenix
#

What happened lol

hollow sedge
#

You were right

earnest phoenix
#

Yeah

#

how i fix lol?

devout mortar
#

dans bot désigner aussi,
dans la fonction premium

earnest phoenix
#

@hollow sedge how i fix??

atomic vault
#

can someone help me

hollow sedge
#

Look at the example

carmine summit
#

@devout mortar Donc, je suppose que le concepteur de bot est également l'hébergement, ai-je raison?

hollow sedge
devout mortar
#

je sais pas, @carmine summit

carmine summit
#

vous devez donc accéder à la page de l'application du bot, puis obtenir le jeton du bot. puis dirigez-vous vers le site premium et collez-y le jeton

#

@devout mortar

devout mortar
#

quel site premium ?

#

c bon elle est reco bizzare cette bot

#

🤨

carmine summit
#

@devout mortar sur l'endroit où vous avez acheté le service premium

devout mortar
#

daccord

atomic vault
#

i am trying to host my bot on Heroku with GitHub.
I deploy and then it show all are right
when i opned app it show
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I tryed in heroku run.
it showsmodule (discord.js) not found.
I installed in it by npm install discord.js.
Then also not.
I used git clone
Then also not woeked

carmine summit
#

What did it say when you typed in npm install discord.js

#

Was it something like missing perms?

carmine summit
#

Can you show me your code

atomic vault
#

which code

carmine summit
#

Code.

atomic vault
#

?

carmine summit
#

Your code

atomic vault
#

bot code?

carmine summit
#

Yes

atomic vault
#

const discord = require('discord.js')
const client = new discord.Client()
const acl = "mte!clean"

client.on('ready', () => {
console.log("I am ready")
})

client.on('message', (mes) => {
if(mes.author === client.user){
return
}
if(mes.content === 'mte!setup'){
mes.guild.emojis.cache.forEach((emo) => {
mes.channel.send(emo.toString())
})
}
if(mes.content === 'mte!help'){
mes.client.user.send()
}
if(mes.content.startsWith(acl)){
cl(mes)
}
})

function cl(mes){
let ful = mes.content.substr(8)
let sp = ful.split(" ")
let arg = sp.slice(1)
let ss = arg.toString()
if(ss){
me.channel.bulkDelete(ss)
mes.channel.send("Message deleted")
setInterval(() => {
mes.channel.bulkDelete(1)
}, 5000)
}else{
mes.channel.send("Enter mt!clean <number_of_message_want_to_delete>")
}
}

client.login(bot_token)

carmine summit
#

Looks clean

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

carmine summit
#

Can you try to re-deploy it?

#

The installation is success...

#

And the code is clean

atomic vault
#

in deploy log no error shows

devout frost
#

I suggest showing the actual error that occurs when trying to start.

quartz kindle
#

you are deploying from github right?

#

show your package.json

atomic vault
#

{
"name": "mtebot",
"description": "a really cool app",
"version": "4.15.0",
"engines": {
"node": "12.x"
}
}

quartz kindle
#

thats the problem

pale vessel
#

rip deps

quartz kindle
#

on every redeploy, all your packages get deleted because you have no dependencies

#

you need to add discord.js to your dependencies

atomic vault
#

how

carmine summit
#

And this is why, ladies and gentlemen, why you should buy a vps

quartz kindle
#

"dependencies": {
"discord.js": "^12.5.1"
},

atomic vault
#

where i have to add it

quartz kindle
#

in your package.json

atomic vault
#

after which code

carmine summit
#

Below the engines object

quartz kindle
#

anywhere as long as its on the root level

livid shoal
#

ayy

carmine summit
#

Make sure to put comma

#

Or else its an error

atomic vault
#

i will re-doply now

#

now it is work my bot come online

stone cradle
#

ok ik this isn't related to discord per say but how do i make connect four happen??

tired nimbus
#

you can buy it in your local store!

quartz kindle
#

you want to code a connect 4 game?

stone cradle
#

yes

#

i've already made tic tac toe and they're not so different, right???

quartz kindle
#

come up with a basic data grid to represent the field

tired nimbus
#

2d array

stone cradle
#

am i allowed to post code here? cuz i can show what i have already

quartz kindle
#

then on each move, check if there is 4 in line

tired nimbus
#

is it matrix or matrices

stone cradle
#
valid_c_movements = [ i for i in range(1,8) ]; valid_c_movements.append("q")
@client.command()
async def connectfour(ctx,member):
    opponent = ctx.message.mentions[0]
    await ctx.send(f"playing connect 4 with {opponent.display_name}")
    g = [[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,17,18],[19,20,21,22,23,24],[25,26,27,28,29,30],[31,32,33,34,35,36],[37,38,39,40,41,42]]
    gridstr = ""
    for i in g:
        for j in i:
            gridstr += f"{j} "
        gridstr += "\n"
    await ctx.send(gridstr)
    for i in gridstr.split(" "):
        if str(i).isdigit():
            gridstr = gridstr.replace(f"{i} ",":blue_square:")
    bmsg = await ctx.send(gridstr)
    if bmsg:
        pass
    moves = 1
    while moves <= 42:
        def check(message):
            user = message.author
            return user == opponent if moves % 2 == 0 else user == ctx.author
        m = await client.wait_for('message',timeout=None,check=check)
        c = m.content
        if c not in valid_c_movements:
            continue
        if c == "q":
            await ctx.send("game ended")
            return
        if c in "123456789":
            pass
#

oh its python i forgot to mention that

#

heres what it generates; ideally it would be a square but its obviously not

earnest phoenix
#

what if you send it inside codeblock

pure lion
#

would it be possible for me to use the cygwin terminal as my default terminal for vscode? If so, how?

feral granite
#

In Discord.js the 'guildMemberAdd' event doesn't appear trigger whatsoever? What's up with this and is it fixable, I have tried giving gateway perms and I have the latest version of discord.js

solemn latch
#

do you have the guild member intent enabled?

feral granite
#

I do

#

Wait hold on

solemn latch
#

do you have it enabled on your discord dev portal page

pliant orbit
#

how to add custom backgroung on top.gg

solemn latch
#

html n css

feral granite
molten yarrow
feral granite
#

How do I do that

pliant orbit
pliant orbit
#

can u give code?

solemn latch
#

no, we dont spoonfeed code here

pliant orbit
#

ik but

solemn latch
pliant orbit
#

thnx

feral granite
#

so I gotta get it verified?

solemn latch
#

If your over 100 guilds yes

molten yarrow
feral granite
#

but where, my brain is square

#

Within the code?

molten yarrow
#

yep

feral granite
#

uhhhh

#

Well off to google because I have the stupid

tardy hornet
#
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', { token: 'fake token' });

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
manager.spawn();
manager.on('message', (shard, message) => {
  console.log(`shard[${shard.id}] : ${message._eval} : ${message._result}`)
})

its not console logging the thing

sudden geyser
#

both or one

tardy hornet
#

both

#

worked

#

nvm

#

btw can someone explain to me what shards do

solemn latch
#

they separate connections, so that your bot can have more guilds.

tardy hornet
#

okay

#

i knew i t do something like that

#

and i didnt get why people told me to do it

earnest phoenix
tardy hornet
earnest phoenix
#

Guys ^^

tardy hornet
#

idk what do you mean by that

earnest phoenix
wheat valve
solemn latch
#

you need it at 2500 guilds because discord doesnt allow more than 2500 guilds per connection

solemn latch
#

using css color

pliant orbit
#

like how?

solemn latch
tardy hornet
#

${bot.shards.cache.size}

#

will it work?

#

is it a thing?

solemn latch
#

shards doesnt exist anymore afaik

restive furnace
#

why not just hardcode the shardcount?

#

easier

solemn latch
#

sorry ill clarifiy, client.shards doesnt exist anymore

tardy hornet
#

so how can i see how much

safe creek
#

mt bots twitter got deactivated because i set the year to 2020 lmfao so now i gotta get my birth cert

sudden geyser
#

client.shard I think

earnest phoenix
#

Hey, brother, what you thinking?\nLeave that old record spinning\nYou feel the rhythm going\n(They call it lonely diggin')\nLet's end your time to lay low\nYour knees are bending and so\nIt's time to get up and let go\n(You're gonna come undone)\nHey, mama, how's it going?\nCan't see your body moving

How do I get all the sentences up to \n in the above paragraph?

ex: ```
Hey, brother, what you thinking?\nLeave that old record spinning\nYou feel the rhythm going\n(They call it lonely diggin')\nLet's end your time to lay low\nYour knees are bending and so\nIt's time to get up and let go\n(You're gonna come undone)\nHey, mama, how's it going?\n

solemn latch
#

js right?

livid shoal
earnest phoenix
#

yeah

#

Maximum 1024 letters fit in an embed.
I'm doing a lyrics command

shell plaza
#

how would i change the background of a bot's top.gg page?

solemn latch
#

you could do
lastIndexOf() to get the last \n

earnest phoenix
solemn latch
#

oh why not just get up to a certain length then

solemn latch
#

thats just color ^

pliant orbit
#

he wnts to that only lol

earnest phoenix
#

@solemn latch I'll make an embed page.

#

I don't want broken words and sentences to appear on the pages.

solemn latch
#

okay, so get by length, then do the index stuff.

shell plaza
solemn latch
shell plaza
#

thx

pliant orbit
#

add .gif not .jpg @shell plaza

shell plaza
#

ok

pliant orbit
#

if it works let me know @shell plaza

shell plaza
pliant orbit
#

giv me the link u wnt to add bg

#

@shell plaza

pliant orbit
#

add a gif lol

#

not image

pliant orbit
#

add a gif sir

#

@shell plaza

#

not a photo/pic

solemn latch
#

page gives me an error.

shell plaza
#

lol i did

pliant orbit
#

🙂

#

maybe it worked

shell plaza
#

nope

pliant orbit
#

give me link

solemn latch
#

probably doesn help the url gives a 404

pliant orbit
solemn latch
#

ah

#

are you testing on the preview?

shell plaza
#

yes

solemn latch
#

the preview might not load new images.

pliant orbit
#

worked in mine

shell plaza
#

nope still doesnt work on m ine

#

wtf

#

can i have your code xD

pliant orbit
#

TF

pliant orbit
shell plaza
#

thx

pliant orbit
#

np

rare plume
hollow sedge
#

@rare plume maybe you have to add the filter after you draw the shape?

rare plume
#

Let me try

earnest phoenix
#

@shell plaza dark theme overrides your styling for whatever reason

sturdy vine
#
const ques = args.slice(0).join(" ");
        const google = 'https://google.com/search?q=';
        if(!ques) return message.channel.send('What do you want to search? Type - `\`google <search>` to search anything.')
        const embed = new Discord.MessageEmbed()
        .setTitle(`Google search - ${ques}`)
        .setDescription(`**Search:** ${ques}\n**Results:** ${google+ques}`)
        .setColor('#22f2f2')
        .setThumbnail('https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1004px-Google_%22G%22_Logo.svg.png')
        message.channel.send(embed)

This is my code for google search but it is working if ques has no space but how to check if ques has space?

hollow sedge
#

idk the reason then

lime spade
#

how do i do a force ban command in discord.js v12?

midnight blaze
#

I have just started to use sqlite3, within the get function, I can access the data, but I can not access it outside of the get function, anyone some experience with sqlite3

if(message.content ==".getprefix"){
  let query = `SELECT * FROM data WHERE userid = ?`
  var a = db.get(query, [userid], (err,row) => {
    if(err){
      console.log(err);
      return;
      }
    if(row === undefined){
    let insertdata = db.prepare(`INSERT INTO data VALUES (?,?,?)`);
    insertdata.run(userid,uname, "none")
    insertdata.finalize();
    db.close()
    return;
    }else{
      let userid2 = row.userid;
      let word = row.word;
      console.log(row)  ///THIS WORK
    }
   });

  let result =  db.get(query, [userid]);
  console.log(result) ////THIS DOESNT WORK
  
}

cinder patio
#

Put all the code that needs the result inside the callback you provide in the get function

#

or promisify the function

midnight blaze
#

Yes, but how should I then specifiy a prefix command, when I only can interact within the get function

#

I understand that it will work within the get function

#

hmm

stark abyss
#

I keep getting Could not parse font file error.

const { registerFont, createCanvas, loadImage } = require('canvas')
const Canvas = require('canvas')
Canvas.registerFont('fonts/Bradley Hand Bold.ttf', { family: "bhb" })
earnest phoenix
#

you should cache your prefixes

#

what are you confused about lol

#

making a call to your database everytime you want to get a prefix is retarded

#

cache it in your memory

midnight blaze
#

ok^^

stark abyss
#

If anyone got idea for me please ping thank you DorimeAnu

earnest phoenix
#

@stark abyss it isn't the right directory, if that code is in welcome.js

stark abyss
#

it is

#

i tried .../../fonts/Bradley Hand Bold.ttf

#

it still didn't work

earnest phoenix
#

literally just follow folder structure

stark abyss
#

.../../fonts/Bradley Hand Bold.ttf

#

is that still incorrect?

earnest phoenix
#

you're inside of the folder, exit it
../
now go into the fonts folder
../fonts
and select your font file
../fonts/file.ttf

stark abyss
#

oh

earnest phoenix
#

pls you don't need a package for everything stop bloating your app

stark abyss
#

I see thank you cry

earnest phoenix
#

that project also seems to be abandoned

midnight blaze
#

look, I want to ask, but I feel like, you will be mad, for asking such an obvious question, but I am not sure what you mean with caching your prefix in the memory. Save it as a variable? It wont be saved for a long time then, or did I misunderstand you. So having a prefix command is only something to have for a temporary time?

pale vessel
#

imports registerFont from canvas
imports canvas
uses canvas.registerFont instead

sudden geyser
#

Save it as a variable?
This is an example of caching in-memory.

earnest phoenix
sudden geyser
#

or having a map

midnight blaze
#

map

sudden geyser
#

or an array

midnight blaze
#

I mean, what else could I do, parse it into a json

#

what do you mean, then? I am not so sure, honestly

sudden geyser
#

Think of caching like asking someone for the answer to a problem. You could keep asking and asking that person, or you could ask them and remember what their response was so you don't need to ask them again. Sometimes, cache expires (e.g. you forgot), so you may ask that person again.

midnight blaze
#

I mean, it isnt like it is soo obvious

earnest phoenix
#

instead of you getting your prefix looking like this

message event => getPrefix

getPrefix => get from database

turn it into this

message event => getPrefix

getPrefix => 
            if Map has the prefix for the guild, return that
            else get from database and throw into the map
                 return result from database``
#

setPrefix would essentially be the same, update in your map and update in the database

#

this way you won't be slowed by database calls

lusty quest
#

you could also use a redis server as a cache

#

but this makes sense if you got more than one shard i guess

gritty sinew
#

Can someone help me with a parentheses problem

lusty quest
#

what is your issue?

umbral zealot
#

Here, you can borrow mine: (((()))))

sudden geyser
#

Forgot your cons & nil

hollow sedge
#

How do you get the items in the cache to expire though?

lusty quest
#

what did you use as cache?

hollow sedge
#

I don't have a cache, I'm just asking

lusty quest
#

if you use node-cache or redis you can set a ttl

hollow sedge
#

Hypothetically

#

What if you use a map

lusty quest
#

map is probably until you restart or overwrite

#

there is the ability to get a free redis server if needed

hollow sedge
#

perhaps you could just set a length limit for map? Although that might be a bad idea

lusty quest
#

you get a 30MB cache (doesnt sound much but its enough)

hollow sedge
#

From where?

lusty quest
#

you dont need even a credit card

#

if you want to see what is in your cache Redsmin.com can help you

earnest phoenix
#

that kind of defeats the point of caching though, does it not?

hollow sedge
#

If you're trying to optimize speed you probably shouldn't be storing it in the cloud

lusty quest
#

why?

earnest phoenix
#

yeah

lusty quest
#

its cached on an external server

#

its way faster than a database

earnest phoenix
#

there's still latency while accessing the server

hollow sedge
#

That's true but it's still not as good as it could be

earnest phoenix
#

you add back the latency you removed

lusty quest
#

but like i said earlyer it makes more sense if you got more than 1 shard or mutiple servers

normal sage
#

CSS isn’t working for me.

#

It used to work like a week ago.

lusty quest
#

node-cache is probably the better way than

#

it uses the local RAM for caching

normal sage
#

Now my description is plain text.

hollow sedge
#

Epic

#

I'll have to look into redis

earnest phoenix
#

to me it's just bloat

lusty quest
#

redis is easy but if you want to run it locally use node-cache

earnest phoenix
#

servers no real purpose unless you need to share cached data between two or more processes

hollow sedge
#

How else would you have a cache?

lusty quest
normal sage
#

Could someone help me with something?

earnest phoenix
#

use your language's native types, i.e. js has a Map, python has dictionaries

quartz kindle
#

why node-cache when you can just use objects or maps w

normal sage
quartz kindle
#

nice

hollow sedge
#

Yes but how would you make those keys expire

lusty quest
#

he asked about a ttl idk if you can set it for a map tho

earnest phoenix
#

setTimeout

hollow sedge
#

hm..

lusty quest
#

yea frick the simplest stuff is the best

hollow sedge
#

interesting

normal sage
#

did top.gg stop support for css?

quartz kindle
#

and of course im trolling

normal sage
#

o

earnest phoenix
#

if you want absolute expiry, a single timeout for the entry will do the job
if you want sliding expiry based on getting, you need to cancel the timeout and create a new one everytime get is called

hollow sedge
#

So you would need to store references to the timeouts too?

quartz kindle
#

you can save a timestamp property and update it every time you access it, somehting like lastAccessed:Date.now()

#

then have an interval that cleans up all items older than X

hollow sedge
#

Ah that makes sense

lusty quest
#

node-cache uses a map as cache but adds a easy to use key management and ttl and other stuff. but i guess the way tim and cry suggest is also fine

regal creek
sterile lantern
#

hey i have a question, is there a way to manually edit the sqlite db file without this happenin (node:363) UnhandledPromiseRejectionWarning: SqliteError: database disk image is malformed

#

or in other words, is there like a website i can connect my db to where i can manually edit values?

quartz kindle
#

that error means the file is broken

#

i doubt anything would be able to read it

sterile lantern
#

yeah i know

#

but

#

is it possible to manually edit it

#

like for instance one thing in the db is

#

userid_tokens

#

i tried to manually change the tokens, it errored

#

so is there any possible way to edit it manually without using a cmd?

regal creek
#

Pretty sure you cant recover corrupted sqlite files

regal creek
sterile lantern
#

its just

#

question mark emojis

quartz kindle
#

if the file is intact, you can use something like DB browser

sterile lantern
#

hm

#

db viewer?

#

is that a website

regal creek
#

No

quartz kindle
#

its a windows program

sterile lantern
#

o

quartz kindle
sterile lantern
#

ty

regal creek
#

😦

#

U were faster than me

sterile lantern
#

do i need a specific version of quick.db

#

rn my quick.db version is

#

7.1.1

quartz kindle
#

what for?

sterile lantern
#

for the browser

#

also how do i open it i cant find the app on windows search

quartz kindle
#

quick.db has nothing to do with it

stone cradle
#

windows 🤮 linux 😎

quartz kindle
#

did you download the installer or the portable one?

sterile lantern
#

uhh installer

quartz kindle
#

did you install it?

sterile lantern
#

yes

#

but i cant find

#

where its located

safe creek
#

why are cogs so hard?

sterile lantern
#

should i remove and install again

quartz kindle
#

it should be in C:/program files

safe creek
#

thyere making me thinking of giving up on this, they just give constant errors

sterile lantern
#

o found it thanks

hollow sedge
# safe creek why are cogs so hard?

it's not that difficult if you think about the logic of it. Commands are objects instantiated from the command class. D.py calls the setup function and gathers the commands in them and adds them to the bot.

safe creek
hollow sedge
#

show your code for one of the files

safe creek
#

ive already deleted the code sooo Shrug

hollow sedge
#

why tho

safe creek
#

slightly giving up on it and wanting to cram it all into one single file

#

the self and stuff does have to be bot and not client right? @hollow sedge so e.g self.bot etc

#

im reading the docs

old latch
#

hey hey

safe creek
#

hry

#

hey*

old latch
#

why is the "H" in your nickname capitalized?

safe creek
#

HEHEH

#

why not

safe creek
old latch
#

it kinda triggers me xD

hollow sedge
#

wait

#

no

earnest phoenix
#

That makes us lose brain cells

hollow sedge
#

it's just whatever you named the variable @safe creek

safe creek
#

wdym?

hollow sedge
#

in the setup function

#

the name of that variable

safe creek
#

m redoing my cogs so

#

will it be client if i put it as client

hollow sedge
#

yes

safe creek
#

mmmmmmk i see

hollow sedge
#

it will be aripoearyear if you put it as aripoearyear

safe creek
#

bot is just shorter and an example then

pure lion
#

so i have this function to process midi notes

#
    fn process_events(&mut self, events: &Events) {
        for event in events.events() {
            match event {
                Event::Midi(ev) => {
                    match ev.data[0] {
                        144 => self.notes += 1u8,
                        128 => self.notes -= 1u8,
                        _ => {}
                    }
                }
            }
        }
    }
#

however, at match event i have an error:

#

patterns `SysEx(_)` and `Deprecated(_)` not covered

safe creek
#

wat

pure lion
#

i am including the windcard _ => {} to catch those

#

so like

#

what do

safe creek
#

yes

stone cradle
#

a 2d array is array[y][x] right

pure lion
#

yeah

stone cradle
#

ok

#

im making a connect four bot (actually a connect four function of a larger bot) and i need to detect if theres a tile below the current tile before it places the tile

#

i have a 2d array i'm using to generate the string which is like [[1,2,3,4,5,6,7],[etc] until 42

hollow sedge
#

below would just be array[x][y+1]

#

you're probably just going to have to do a ton of checks

#

unless there's some algorithm lol

stone cradle
#

im not worrying about winning rn

#

just about placing tiles

#

i already have tic tac toe in the bot and it can't be that much different

hollow sedge
#

why would you need to check if there's a tile below the current tile?

stone cradle
#

because gravity

hollow sedge
#

yeah

#

so just use array[x][y+1]

stone cradle
#

i thought 2d arrays were array[y][x]

hollow sedge
#

same thing

pure lion
#

well coords

#

uh

#

(x, y)

stone cradle
#

if i have a square: 123 456 789, i refer to 4 using square[2][1] correct?

pure lion
#

yes

#

that makes sense

stone cradle
#

ok

hollow sedge
#

me confused

#

math too much

pure lion
#

assuming your array is [[1,2,3],[4,5,6],[7,8,9]]

hollow sedge
#

no

pure lion
#

yes

hollow sedge
#

i think it would be square[1][1]

pure lion
#

oh shit yeah

#

no

pale vessel
#

array[1][2] array[2][2] :)

hollow sedge
#

yes

pure lion
#

brp

#

indexcks

hollow sedge
#

square[1][0] would be 1

#

in a row of 3

pure lion
#

i just had a brainfart

hollow sedge
#

square[1][1] would be 4

pure lion
#

arrays start at 0

#

so

pale vessel
hollow sedge
#

that's what I'm saying

pure lion
#

[[1,2,3],[4,5,6],[7,8,9]][1][0] would be 4

earnest phoenix
pure lion
earnest phoenix
#

Wait there's 1

hollow sedge
#
(0, 0) | (1, 0) | (2, 0)
(0, 1) | (1, 1) | (2, 1)
(0, 2) | (1, 2) | (2, 2)
#

i think this is a better representation

pale vessel
#

Bruh tuples

hollow sedge
#

not tuples

#

coordinates

pale vessel
#

Oh

#

Smh my head

pure lion
#

smh wouldn't it be better if (i32, i32)