#development

1 messages · Page 1813 of 1

proven lantern
#

it's the fallback if you cant find a nicer method

tulip ledge
#

mhm

#

Imma try something with map

#

mmh nvm that won't work

quartz kindle
#

just use a good old for loop

tulip ledge
#

I would too

#

but he doesn't want mutations

quartz kindle
#

then you can swap out the increment for a column search

tulip ledge
#

I'd just "flip" the array on it's side

#

and then run the checkisrowwinner

quartz kindle
#

flipping it would be a mutation

tulip ledge
#

mmmh ight

#

ye my brain is too small for this shit

sudden geyser
#

take a sip of immutable architecture

quartz kindle
#
// rows
for(let row = 0; row < board.length; row++) {
  for(let col = 0; col < row.length; col++) {
    if(col > 0 && board[row][col] !== board[row][col-1]) return false;
  }
}

// cols
for(let col = 0; col < board[0].length; col++) {
  for(let row = 0; row < board.length; row++) {
    if(row > 0 && board[row][col] !== board[row-1][col]) return false;
  }
}
tulip ledge
#

damn so I was almost there

#

I also wrote 2 for loops but was like no this is not it lol

#

well imma head to bed, gl on the diagonal one

proven lantern
#

i want to get rid of the for loop somehow

const checkIsColumnWinner = board => board[0].reduce((acc, cell, columnIndex) => {
    if (acc) return acc;
    for (let rowIndex = 0; rowIndex < board.length; rowIndex++) {
        if (board[rowIndex][columnIndex] !== cell) {
            return false;
        }
    }
    return true;
}, false);```
snow urchin
#

Anyone here have experience with the twitter API?

Client.stream('statuses/filter', { track: "@BotPunny" }, function (stream) {
    stream.on('data', tweet => {
        console.log(`${tweet.user.name} (@${tweet.user.screen_name}) - ${tweet.text}`);
        if(tweet.text.toLowerCase() === `@botpunny test`) {
            console.log("responding")
            Client.post("statuses/update", { in_reply_to_status_id: tweet.id, status: "Test Success" }, (err, data, response) => {
                if(err) console.log(err);
                console.log(1)
            });
        }
    });
});

It sends the Test success, but not as a reply, instead as a regular tweet

amber thistle
#
.entity-header__button-text, .entity-header__button-icon {
 background: rgba(180, 255, 198, 0.504);
}

.entity-header__button:hover,.entity-header__button-text:hover, .entity-header__button-icon:hover {
 background: rgba(180, 255, 198, 0.704);
}

when im hovering it changes the color back to that color and not the color specified in my css, am i using the wrong element??

pale vessel
#

Try background: rgba(180, 255, 198, 0.704) !important;

amber thistle
#

aight

#

still the same

#

oh wait

#

it worked, thanks

pale vessel
#

Feels like I've seen you somewhere

hexed sedge
#

Hey, is anyone here goodie at javascript?

pale vessel
#

A lot of people here

hexed sedge
#

cool. I am having an issue with a little piece of code.
https://pastebin.com/6BtFJkY9
When the clickMenu event gets triggered (from another package that isnt d.js) only the client id gets printed, but menu.id results as null. when I switch client and menu in the execute area, then only menu.id prints correctly and client.id returns null. Anyone have any idea to why this is happening? I might be a little tired as it is almost 2am 😅

median moss
#

How can I make args[0] have the first letter in uppercase?

For example: person uses !command hello, and it replaces the hello for Hello

snow urchin
hexed sedge
#

Ah callum beat me to it

pseudo furnace
#

seym

pale vessel
median moss
pale vessel
#

See what you get

snow urchin
#

yes

pale vessel
median moss
#

ok, thank you so much

hexed sedge
median moss
pale vessel
hexed sedge
pale vessel
median moss
#

I don't get it

#

I think you misunderstood my question

pseudo furnace
#

args[0][0] is the first letter?

snow urchin
#

args[0].charAt(0).toUpperCase() + args[0].slice(1)
and
args[0][0].toUpperCase() + args[0].slice(1)
both work

median moss
#

ohhh

#

ok

#

I get it now

#

sorry

pale vessel
#
const args = ["abc", "efg"];
args[0]; // "abc"
args[0][0]; // "a"
args[0][0].toUpperCase() + args[0].slice(1); // "Abc"
median moss
#

and thanks to KEKW

ocean haven
#

Anyone have the reasoning to open and close db connections upon each request rather than opening a connection upon startup and keeping it open? I was told always close when done with the function. But I have someone asking why.

median moss
hexed sedge
pale vessel
#

So it does return the MessageComponent properly

#

There's only 1 parameter

#

If you want the client, use menu.client

hexed sedge
pale vessel
#

Just menu

clever agate
#

wtf?

hexed sedge
#

Ok, im really sorry, a million thanks to you for the js support, but do I leave in the execute part the menu and client?

pale vessel
#

There is only 1 parameter

#

That would be menu

#

IDK

#

Check your code

#

Or send it here, people can help

#

What's the problem? It's not unmuting the member?

hexed sedge
#

He said its unmuting them, but it remutes them a short time after

pale vessel
#

🩴

hexed sedge
pale vessel
#

What about your mute command?

hexed sedge
#

wdym

#

everything in the code looks fine

long badger
#

i have a unmute code do you want

hexed sedge
#

unless you have a timer that periodically checks if the user is muted or if it expired

#

flazepe, again thank you for helping me, you are a genius

execute(menu) {
        console.log(component.client.id);
        console.log(menu.id);
    }

Am I doing it wrong?

hexed sedge
#

No, console doesnt log anything

#

Ill try again r

long badger
#

ok

#

wait

pale vessel
#

There's actually 2 parameters it seems like

#

So you got it right menu, client

long badger
#
client.on('message', msg => {
  const error = "❌";
  const timeing = "⏱";
  const success = "✅";
  const lodeing = "🤔";
  let args = msg.content.split(" ");
  if (args[0] === prefix + 'unmute') {
    if (msg.author.bot) return;
    if (msg.channel.type == "dm") return msg.channel.send(new Discord.MessageEmbed().setColor("RED").setDescription(error + ` **You Can't Use This Command In DM's!**`).setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    if (!msg.member.hasPermission('MANAGE_ROLES')) return msg.channel.send(new Discord.MessageEmbed().setDescription(error + " **You Need `MANAGE_ROLES` Permission To Use This Command!**").setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    if (!msg.guild.me.hasPermission('MANAGE_ROLES')) return msg.channel.send(new Discord.MessageEmbed().setDescription(error + " **I Can't Kick Any Member In This Server Becuse I Don't Have `MANAGE_ROLES` Permission!**").setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    let user = msg.mentions.members.first()
    if (!user) return msg.channel.send(new Discord.MessageEmbed().setDescription(error + " **Please Mention Same One!**").setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    if (user.id === msg.author.id) return msg.reply(new Discord.MessageEmbed().setDescription(lodeing + " **WTF Are You Doing ??**").setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    if (!msg.guild.member(user).bannable) return msg.reply(new Discord.MessageEmbed().setDescription(error + " **I Can't Unmute one high than me >_<**").setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    var muteRole = msg.guild.roles.cache.find(n => n.name === 'Muted')
    if (!muteRole) return msg.channel.send(new Discord.MessageEmbed().setDescription(lodeing + ` **WTF Is That ?? [ Super Error ]**`).setFooter(`Request By ${msg.author.tag}`).setTimestamp())
    user.roles.remove(muteRole)
    msg.channel.send(lodeing + " **Processing The Unmute Function**").then((m) => {
      m.edit(success + " **Processing is complete**")
    })
    msg.channel.send(new Discord.MessageEmbed().setDescription(success + ` **${user} Has Ben Unmuted By <@!${msg.author.id}>**`).setFooter(`Request By ${msg.author.tag}`).setTimestamp())
  }
})```
#

سخققغ

latent heron
#

sweet jesus

long badger
#

sorry

pale vessel
#

Allah

long badger
pale vessel
#

That is...

hexed sedge
#

when I put menu, client only menu.id displays correctly and client.id returns null

pale vessel
#

Wait, try again js execute(menu, client) { console.log(menu.id, client.id); }

long badger
#

shit why

pale vessel
#

Well yeah you don't expect it to work just by pasting the code

hexed sedge
#
host@host-MS-7A38:/mnt/HDD/panel-bot$ node .
No buttons.
The bot has awakened
Logged in as: something, idk lol#6326
customid undefined
#

Looks like a no

pale vessel
#

I think I know why

#

How do you handle your events?

hexed sedge
#

If its bc im dumb I agree

pale vessel
#

As in, how did you run that execute method

long badger
#

he say client is not defined

pale vessel
#

Show your event handler code

hexed sedge
#

I run the execute thing through my handler in my index.js

#

Let me pastebin it

#

^event handler code

long badger
#

ok ammm

pale vessel
#

O

hexed sedge
#

oh no

pale vessel
#

Try js execute(...args) { console.log(args.length); }

#

If it's not 2 then something is off

hexed sedge
#

Ok one second

pale vessel
#

What package do you use for components by the way?

hexed sedge
#

Its 2

hexed sedge
#

Its kinda really late so my brain might be a little dead

pale vessel
#

When the clickMenu event gets triggered (from another package that isnt d.js)

hexed sedge
#

Im using discord-buttons for the menu system

pale vessel
#

Ah

hexed sedge
#

I couldnt find anything better than that

wheat mesa
#

Detritus

hexed sedge
#

could it be an issue with the package itself?

pale vessel
#

Nope

#

It seems to be working

hexed sedge
#

Ok coolio, as there isnt much of an alternative other than making my own discord api thing

pale vessel
#

Time to debugjs execute(menu, client) { console.log(menu.id, menu.client.id, client, client.id); }

wheat mesa
#

I mean, v13 has buttons does it not?

#

You could technically use the master of djs

pale vessel
#

Yeah

hexed sedge
#

P sure it doesnt have menus

pale vessel
#

But I'd say it's better to wait for the official release

#

A lot of stuff can break while it's in development

median moss
#

when I tried using the charAt I had this error:

    at Object.exports.run (/home/runner/Bulba-Bot-Recover/commands/info.js:13:52)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:312) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)```
hexed sedge
#

And I cba to transfer to v13

pale vessel
#

It means args[0] is undefined

#

Log args and see what returns

hexed sedge
#

what the fuck??

crimson vapor
pale vessel
#

hi @crimson vapor

crimson vapor
#

hi @pale vessel

hexed sedge
#

The log is so long that it exceeds my terminal limit

median moss
crimson vapor
#

console.log(args)

median moss
#

console.log(args[0])?

hexed sedge
#

Never mind

median moss
#

oh

#

lol

#

ok

long badger
#

you use replit or vs

hexed sedge
#

I legit just scrolled past to the previous attempts

pale vessel
#

Is everything defined?

hexed sedge
#

Clear ur terminals bois

hexed sedge
wheat mesa
long badger
#

good send me an invite an my dm

hexed sedge
#

Thing is I have no fucking clue what undefined

median moss
# pale vessel Log `args` and see what returns

(node:447) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

crimson vapor
wheat mesa
#

@long badger don’t spoon feed him if you’re gonna help him on replit though

hexed sedge
#

more than 3 things undefined

pale vessel
#

🩴

#

OK then make it short js execute(menu, client) { console.log(menu.id, menu.client.id, client.id); }

#

See which one is undefined

hexed sedge
long badger
pale vessel
#

So it was never broken @hexed sedge

median moss
#

Unexpected code '{'

median moss
pale vessel
#

We're wayyyy of the track

crimson vapor
#

please learn basic JS

#

thank you

pale vessel
#

What was your issue in the first place? @hexed sedge

median moss
#

lol

crimson vapor
#

are you the one with an unexpected token error?

hexed sedge
crimson vapor
#

no

median moss
#

@pale vessel perhaps my NodeJS being older charAt won't work somehow?

pale vessel
#

Err, no

hexed sedge
#
module.exports = {
    name: 'clickMenu',
    execute(menu, client) {
        console.log(`Menu id ${menu.id} Client id ${client.id}`);
    },
};

This code returns only the menu.id properly and client.id as null. When I reverse menu and client in execute() it is client works and menu not.

median moss
#

mine is v12.16.1

median moss
pale vessel
#

and what's client.id supposed to be?

hexed sedge
#

wait

#

is it that

pale vessel
#

I think both of us need sleep haha

#

client.user.id?

hexed sedge
#

yes

pale vessel
hexed sedge
#

it just clicked

pale vessel
#

Oh my lord

#

I completely missed that

hexed sedge
#

let me

#

see if that works

pale vessel
#

It confused me since you said null

#

It can never be null if it's not a property

#

It would have been undefined

hexed sedge
#

yep

#

dont wake me up

pale vessel
#

So I figured something was off

#

Was it undefined?

hexed sedge
#

yes

#

now it works

pale vessel
#

O

#

Haha

hexed sedge
#

I have wasted both of our time just for this little mistake...

pale vessel
#

Naw

hexed sedge
#

omfg thanks for the patience man <3 super sorry, just tired as it is 2:47am atm

pale vessel
#

It's all good, you should get some sleep exdee

hexed sedge
#

lmfao yeah, just wanted to figure this out

crimson vapor
pale vessel
#

Yeah I woke up at 6:50am or something

crimson vapor
#

oh

median moss
#

I realized I was being dumb and I forgot to fix one thing on the code, the charAt is actually working KEKW

#

thanks flazepe 🙂

pale vessel
#

The shorter the code, the better mmLol

#

use args[0][0] better_lollipop

crimson vapor
#

what in the fuck?

#

why is args an array of an array?

median moss
#

so I used the charAt

pale vessel
#

You sure?

hexed sedge
#

because why not

crimson vapor
#
const args = [
  ['277183033344524288']
]```
pale vessel
#

It would be weird if it doesn't work

#

Actually, doesn't really matter if charAt() works

#

If it works it works

median moss
#

yeah

#

only one more thing

#

if I want to use with args[1], I might replace charAt(0) for charAt(1) and slice(1) for slice(2)?

near kiln
#

not sure what to do here

median moss
#

cause this is the only one not working for me

pale vessel
#

Only args[1] or up to args[1]?

#

Oh wait

median moss
wheat mesa
hexed sedge
#

Well I figured out everything that i need to continue working on this bot

#

Poggers

pale vessel
#

Just change args[0] to args[1]

#

That's about it IG

near kiln
#

@commands.Cog.listener() async def on_message(self, message): if message.channel.id in talk_channels:

median moss
pale vessel
#

Keep everything else as is (slice, etc.)

median moss
#

like

#

it's complex to explain

pale vessel
#

You sure args[1] is defined?

hexed sedge
#

@pale vessel if you ever need anything lmk

median moss
#

but basically when it's the one that fetch the args[1] it works perfectly, but when it's the one that fetch the args[0] it gives me this error:

    at Object.exports.run (/home/runner/Bulba-Bot-Recover/commands/info.js:13:52)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)```
hexed sedge
#

Like free hosting

#

I can cover that

pale vessel
#

Ah, OK

#

I'm good for now, thank you

earnest phoenix
#

I'm not sure why I'm getting an error, could anyone help?```js
//Things above the code defining variables...
//async function STARTS
async function connect(){
mongo.connect((err) => {
console.log("MongoDB connected for Beyblade.js");
});
let ids = mongo.db("main").collection("ids");
const id = ids.find({});
Promise.all([id]).then(data => {
let beys = data[0];
beys.forEach(bey => {
datas[bey._id] = {
latest: bey.latest,
name: bey._id
}
});
console.log("Updated data!");
});
setInterval(() => {
mongo.db("main").collection("ids").updateOne({_id: bname}, {$set: {latest: datas[bname].latest}});
}, 600000);
}
//async function ENDED

//connect and continue
connect();
//rest of the code
}
async init(){
return true;
}
}

module.exports = Beyblade;```

hexed sedge
#

np, just want a way to thank you

earnest phoenix
#

Error: xl MongoClient must be connected before calling MongoClient.prototype.db

hexed sedge
#

anyways, Ill take your advice and go to sleep. Goodnight #development

pale vessel
earnest phoenix
#

goodnight lol

pale vessel
#

Also, can you show me your charAt() code again

near kiln
median moss
earnest phoenix
median moss
#
args[1].charAt(0).toUpperCase() + args[1].slice(1)```
pale vessel
#

I don't think that's the output

#

Try finding an array in your console

median moss
pale vessel
#

I think you copied a part of your error

median moss
#

let me check again

pale vessel
#

Should be above the error, depending on where you put that line of code

#

If you put it after the charAt() part, then it wouldn't show since it errored

median moss
#

this is all:

(node:862) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'charAt' of undefined
    at Object.exports.run (/home/runner/Bulba-Bot-Recover/commands/info.js:13:52)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:862) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)```
median moss
#

this is it

#

lol

#

[ 'a' ]

#

this was the log

#

and what I sent in command

pale vessel
#

So you did !command a?

median moss
#

yeah

pale vessel
#

Then args[1] wouldn't have existed 🩴

median moss
#

let me do 2nd arg then

pale vessel
#

I'm not sure why you want args[1] though

median moss
#

[ 'a', 'b' ]

pale vessel
#

But you need to add a check first if you need that

median moss
pale vessel
#

But don't you need both args?

#

What's your desired output?

median moss
#

when it fetches args[1] I only need the args[1]

#

args[0] is only to check if args[0] === 'shiny'

pale vessel
#

So js const toReplace = args[1] ?? aargs[0]; toReplace[0].toUpperCase() + toReplace.slice(1);?

#

A

#

Typo but yeah

pale vessel
#

It tries to get the second arg (args[1]) if exists

#

If not args[0]

#

And then the usual first letter capitalization

#

?? can be substituted for ||

median moss
#

yeah, I'm getting kinda lost

#

can I send in your DM a pastebin link with my current code?

crimson vapor
#

?? is cooler than ||

boreal iron
#

|| checks if the val is empty

#

That’s not what you always need

amber thistle
#

im not clear about the ?? operator but isnt it the same as ||?

earnest phoenix
#

No

boreal iron
#

You know sometimes empty is something not empty waitWhat

earnest phoenix
#

Say you have to things

amber thistle
crimson vapor
#

if you want an empty string then you would use ??

earnest phoenix
#

If the left side is null it will use the right side

boreal iron
#

It checks if your val is defined and not null

amber thistle
#

i realised a few days ago that ![] returns false

crimson vapor
#

yeah

amber thistle
crimson vapor
#

arrays are truthy

earnest phoenix
#

I mean, yes and no

amber thistle
#

but !+[] returns true

#

i didnt knew u could syntax it like that lmao

crimson vapor
#

+[] returns 0

#

!0 is true

boreal iron
#

Anything defined not 0 is true is JS

amber thistle
#

so + is the same as .length?

boreal iron
#

JS = false

crimson vapor
#

nope

crude egret
#

It really doesn't like me doing this in typescript. (UserName = message.author.id, UserData = {})

#

Anyone know how to get rid of that? Cause it's really starting to piss me off

amber thistle
#

0.1 + 0.2 === 0.3 this returns false topggVeld

crimson vapor
#

yes

amber thistle
#

floating point numbers are weird

crimson vapor
#

it does that in most languages tho

crude egret
#

Anyone know how to solve my issue or if I can do it in a way that does not cause an error like that

amber thistle
crude egret
earnest phoenix
#

You should use a record

crude egret
#

Which is?

earnest phoenix
#

It is another way of making an object

#

Since the Object type is a bit weird

#

Say you wanted to make an object where the key is a string and the value of the that key will also be a string

crude egret
#

Well, the value of that string key is also an object xD

earnest phoenix
#
const settings: Record<string, string> = {}
crude egret
#

With another few objects inside

earnest phoenix
#

Errrr

crude egret
#

This is the contents of the string key

earnest phoenix
#

Honestly no idea rn

crude egret
#

As you can see, it works just fine. But it just comes out as an error

pale vessel
#

Use an interface?

earnest phoenix
#

You could also use an interface as well ig

pale vessel
#

You have to

crude egret
#

And how would I do that?

pale vessel
#

Or well, any better_lollipop

earnest phoenix
#

Do you know typescript at all?

crude egret
#

I don't know interfaces. I use my previous programming knowledge to try to build bots

pale vessel
#

Make an interface for it and use Record<string, Interface>

crude egret
#

Also Mistyy, I wasn't asking how to make an interface. I meant "How do I make a multi layered interface that covers my extensive structure"

pale vessel
#

Multi-layered interface?

crude egret
#

Idk man. As I said, dunno interfaces

candid veldt
#

Guys what are your opinions on vim

pale vessel
#

But you said you know how to make interfaces 🩴

crude egret
#

Yes, for simple stuff. Like an array with one variable

#

object*

pale vessel
#

Multi-layered as ints interface SomeInterface { buildings: { house: number; }; otherProp: string; ... }?

#

Not sure what you mean

crude egret
#

I mean I have an object

#

Gimme a sec

#

{
"User1ID": {},
"User2ID": {}
...
}

#

That is what it cant figure out

pale vessel
#

That's exactly what Record does

crude egret
#

Okay, I'll go see how to use record then, and if it does what I want it to, cause it's both writing and reading data that I'm having trouble with

hexed sedge
boreal iron
# amber thistle

That’s because JS interprets 0.1+0.2 to something like 0.300000….1

It will be true if you use math.round

console.log(Math.floor(0.1 + 0.2) == Math.floor(0.3));

#

Don’t think about it as it doesn’t make any sense okeh

hexed sedge
#

Tf

#

JS dumb asf

pale vessel
#

It's a nifty utility type

crude egret
#

So this would be the way to construct that

#

Yeah, I'm reading that xD

earnest phoenix
#

again object isn't a type you really wanna use

pale vessel
#

object should be an interface

crude egret
#

Why Mistyy? What errors will I encounter?

pale vessel
#

Otherwise it will be treated as Record<any, any>

hexed sedge
#

Wdym

crude egret
#

Oh, okay

hexed sedge
#

Message.member is undefined if I'm not wrong

earnest phoenix
#

You won't really get an error

wheat mesa
# hexed sedge JS dumb asf

I mean, it's not inherently a JS-specific problem. It's just the way floating point numbers are represented in most languages

hexed sedge
#

message.author is a user

crude egret
#

No, you need the message.member for that

#

I'm pretty sure it's because the user is just the discord user, but the member is the user in the guild memory

hexed sedge
#

Or am I wayyyyy off?

crude egret
#

No, message.member

wheat mesa
#

The member object is associated with a guild, whereas the user object is not.

crude egret
#

Yup

earnest phoenix
#

No

#

message.member

hexed sedge
#

That's weird

wheat mesa
#

It's not weird

earnest phoenix
#

You can get the user off the member but not the member off the user

#

User has no ties with a guild

#

so it makes no sense for you to be able to get a member object

pale vessel
#

has() takes an ID, not an object

#

Use watchedRole.id

wheat mesa
#

^^

crude egret
#

flazepe, would the interface be constructed like this?

pale vessel
#

Sure

earnest phoenix
#

That is how one is done yea

#

but be careful with type any

pale vessel
#

You should, err, replace those nasty any with a typed object mmLol

crude egret
#

typed object?

#

type object

pale vessel
#

Nope, an interface

wheat mesa
#

typed

earnest phoenix
#

Use records

pale vessel
#

If you put object it won't be any different than any

crude egret
#

Oh, so put an interface within the interface

pale vessel
#

Yes

earnest phoenix
#

I mean

#

you could do that ig

crude egret
#

Uhhhh, okay xD

pale vessel
#

Only use records if you need the key to be any, or a simple structure, like Record<"firstName" | "lastName", string>

crude egret
#

So I'm just defining my entire structure rn xD

#

Why? I need it to be a string anyways

earnest phoenix
#

No, you use Record when you wanna make a typed object.

crude egret
#

Depends on what "message" is

#

Try to console.log(message) before calling that line

#

Check if it has the .member

near kiln
#

@commands.Cog.listener() async def on_message(self, message): if message.channel.id in talk_channels: stats = levelling.find_one({"id" : message.author.id}) if not message.author.bot: if stats is None: newuser = {"id" : message.author.id, "xp" : 100} levelling.insert_one(newuser) else: xp = stats["xp"] + 5 levelling.update_one({"id":message.author.id}, {"$set":{"xp":xp}}) lvl = 0 while True: if xp < ((50*(lvl**2))+(50*(lvl))): break lvl + 1 xp -= ((50*((lvl-1)**2))+(50*(lvl-1))) if xp == 0: await message.channel.send(f'well done {message.author.mention}! You leveled up to **level:{lvl}**')

error-
if message.channel.id in talk_channels:
TypeError: argument of type 'int' is not iterable

pale vessel
#

Could be that the message is from a DM

#

Make sure message.member exists

#

I suppose the member isn't cached

crude egret
#

Yes, but can you send a screenshot further up. Instead of only sending one line?

pale vessel
#

That would also be a reason

pale vessel
#

if (!message.member) return; EZ

crimson vapor
#

if (message.guild) {} else return; EZ

pale vessel
#

client.on("message", async (message) => null); EZ

proven lantern
#
const players = [
    {player: "player1", rating: 1200},
    {player: "player2", rating: 1200},
    {player: "player3", rating: 1219},
    {player: "player4", rating: 1219},
    {player: "player5", rating: 1210},
    {player: "player6", rating: 1090}
];


const balanceTeams = ({players, teams}) => {
    
}

const [team1, team2] = balanceTeams({players, teams: 2});
// team1 = [{player: "player1", rating: 1200},{player: "player2", rating: 1200},{player: "player3", rating: 1219}];
// team2 = [{player: "player4", rating: 1219},{player: "player5", rating: 1210},{player: "player6", rating: 1090}];

how should i write the balanceTeams function without it exploding with large teams?

#

i basically want the sum of the ratings for each team to be as close as possible

#

but i dont want to try every combination

#

there must be a fancy math thing to solve this faster

lyric mountain
#

If there aren't peaks, just order by rating and match first with last

#

Keep doing it until there are no players left

proven lantern
#

that might work well enough

lyric mountain
#

Tbf, it'll be the only way to get as balanced as possible teams

#

Any other way would only increase difference

proven lantern
#

well trying every combination and would find the rare cases where there are peaks, but it would be exponential

lyric mountain
#

I mean, the peak player will always end up matched with someone

#

If matched with the worst player it'll result in smaller final value

proven lantern
#

how would this get split into two team? [1,100,101,200,201,202]

#

1 and 202 are on a team

#

100 and 201 on the other

#

what about 101,200

lyric mountain
#

101 on first team

crimson vapor
#

200 on the lower one

lyric mountain
#

We synced

crimson vapor
#

idk if im correct but yeah

proven lantern
#

so there would be a running total for each team

#

and which ever team is higher at the time picks the lowest player

lyric mountain
#

The team with the highest player stays with the lesser option

lament rock
#

why does icycast/shoutcast exist

proven lantern
#

so the first pass the highest and lowest seed the teams, then the next pass it looks at the total for each team first and then chooses the lowest rank for the highest team

lyric mountain
#

Ye

proven lantern
#

that's going to be fun to write

proven lantern
lament rock
#

I was trying to get some radio stations beyond listen.moe to work with my lavalink rewrite when I tried to add support for one my bot supports called frisky radio

#

but trying to get the mp3 doesn't return an HTTP/ response

#

so, http requests error

lyric mountain
#

Matchmaking is fun, the worst part is composing the MMR

proven lantern
#

Elo already did the work for MMR

#

done

lyric mountain
#

what do you use for metrics?

proven lantern
#

what kind of metrics? i just put data in Dyanmodb

lyric mountain
#

for example, my tcg players win/lose mmr based on how much damage they cause, with how many cards, sustaining how much damage, etc

#

like, what defines them as "experient players"

proven lantern
#

i haven't built that in yet, but my plan is to save those stats in the DB

#

i have the history command started here

lyric mountain
#

wouldn't that allow abuse?

#

like, create an alt and keep losing/winning against yourself to manipulate your mmr

proven lantern
#

each server is sandboxed

#

the server managers can look out for that

#

and only people with a certain role can record

lyric mountain
#

ic

fresh verge
#

JavaScript!

So, I created a new field to the main data model, how can I make it add the new field to all existing data? (MongoDB).

pale vessel
#

Model? Mongoose?

proven lantern
pale vessel
#

There's no models in MongoDB

proven lantern
#

models are a bad idea

fresh verge
proven lantern
#

that oop thinking

pale vessel
#

Are you using Mongoose or vanilla MongoDB?

#

Since you mentioned models

proven lantern
#

this is probably better than iterating over the db

mighty sedge
#

There's a humble request if your bot i not approved till yet then just quit top.gg it has no support and it could decline your bot even if your bot goes offline for 2 mins. top.gg hai hai

cinder patio
#

whut

sinful kindle
wheat mesa
#

Probably had their bot offline during review and got mad that the bot reviewers don't have the time to wait for his bot to become online

waxen bough
wheat mesa
flat copper
#
client.guilds.cache.forEach(guild => {
			guild.channels.cache.forEach(channel => {
				channel.messages.fetch()
			})
		})```
fetch is not a defined
earnest phoenix
#

@flat copper what was the error

#

cannot read property fetch of undefined?

flat copper
#

Yup

cinder patio
#

why are you doing this?

#

your computer will explode

flat copper
#
const Schema = require('../../models/guild');
module.exports = async (client, reaction, user) => {
	let data = await Schema.findOne({ id: reaction.message.guild.id });

	if (reaction.message.id === data.ticketMsg && reaction.emoji.name === '🎟') {
		reaction.users.remove(user);
	}
};

Not working if I reacted to message

cinder patio
#

how does it not work?

flat copper
#

Idk

#

Its working before
But when I restarted its not working

#

Its not Removing my reaction

cinder patio
#

console.log data, reaction.message.id, or use a debugger to see what's going on.

#

debug your code

flat copper
#

Ok

cinder patio
#

You have to enable partials

flat copper
#

?

cinder patio
wheat mesa
#

2021-07-16T06:46:47.693723+00:00 app[worker.1]: Error: Cannot find module '/app/.srcindex.ts' 2021-07-16T06:46:47.693746+00:00 app[worker.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) 2021-07-16T06:46:47.693747+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:746:27) 2021-07-16T06:46:47.693748+00:00 app[worker.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 2021-07-16T06:46:47.693748+00:00 app[worker.1]: at internal/main/run_main_module.js:17:47
I am currently getting this error when I try to start my bot using Heroku as a host (don't judge me, I'm getting a VPS soon). My Procfile is as follows: worker: node -r ts-node/register/transpile-only .\src\index.ts, and this works when I start my bot in my integrated terminal in VSC. Anyone have any idea why this isn't working?

flat copper
cinder patio
#

You must do it in order to listen for reactions to messages which aren't cached

flat copper
#

Ok

cinder patio
#

The page I sent you even gives you an example

#
client.on('messageReactionAdd', async (reaction, user) => {
  // If a message gains a reaction and it is uncached, fetch and cache the message
  // You should account for any errors while fetching, it could return API errors if the resource is missing
  if (reaction.message.partial) await reaction.message.fetch();
  // Now the message has been cached and is fully available:
  console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
  // Fetches and caches the reaction itself, updating resources that were possibly defunct.
  if (reaction.partial) await reaction.fetch();
  // Now the reaction is fully available and the properties will be reflected accurately:
  console.log(`${reaction.count} user(s) have given the same reaction to this message!`);
#

Though you don't really need to fetch the reaction if you only need the message ID

#

but maybe disocrd.js requires you to because it's trash

flat copper
#

Now its working

#

Thnx

wheat mesa
flat copper
#
let ch = client.channels.cache.find(c => {
			c.name == user.username && c.type == 'text';
		});
		if (ch)
			return reaction.message.Reply({
				embed: {
					title: 'You have opened ticket already!',
					color: 'RANDOM'
				}
			});
#

Why its not working

#

Nothing error

#

I have 4 channel name ᵈʳᵉᵃᵐ乡𝓟𝓻𝓲𝓷𝓬𝓮★᭄ꦿ᭄☆#1111

wary flame
#

Several things wrong with this

  1. In you're channels.cache.find the test function doesn't return anything: Change to: return c.name == user.name...

  2. To reply to a message use Message.reply (no capital 'R")

#

Issue 1 can also be solved by removing the curly braces (in which case lambda returns automatically)

#

@flat copper

flat copper
#
let ch = reaction.message.guild.channels.cache.find(c => {
			c.name == user.username && c.type == 'text';
		});
		if (ch)
			return reaction.user.send({
				embed: {
					title: 'You have opened ticket already!',
					color: 'RANDOM'
				}
			});

Latest code

#

But still not working

pale vessel
waxen bough
#

returns void

#

if you put brackets in arrow function you have to put return

pale vessel
#
func(() => value);
func(() => { return value; });

func(() => (value, undefined));
func(() => { value; });```
crimson vapor
#

async func (num) => { return await func(num > 5 ? num > 1000 ? num - 1000 : num ** 1.5 : num + 1 ) }

#

ez

jovial nexus
#

Whats the intent for cheching if a user is in a vc?

#

GUILD_VOICE_STATES??

#

it was

#

nvm

long crow
#

func (() => { void value })

candid veldt
devout vapor
#

hello hello! I have a question regarding current time for discord bots.

you know how new Date() will show the current time? But it's in UTC. is there any way for it to be such that if I want the bot to generate the current time based on the author's timezone?

sinful belfry
#

you can, but it may also be possible to do something else

eternal osprey
#

hey how do i migrate a channel from one category to another? (in djs)

sinful belfry
sinful belfry
devout vapor
# sinful belfry what are you doing this for?

i'm currently doing timezone conversion. and i wanted to do it such that if the user keys in

26 Jan 15:00

It would show all the converted timezones. but the default one is UTC. I wanted it such that, for instance if I'm GMT+8, the time 26 Jan 15:00 will show all the converted times from GMT+8. if that makes sense....?

cinder patio
#

<t:1626431160689>

thick bobcat
#

o

visual knoll
#

<t:92488294:d>

cinder patio
#

I'm guessing it's using the Discord epoch cause this definitely aint 53509

visual knoll
#

<t::d>

sinful belfry
cinder patio
#

milliseconds

sinful belfry
#

ah, unix is seconds

cinder patio
#

ah

sinful belfry
#

wdym

cinder patio
#

<t:1626431162>

#

Hm

#

wait so

eternal osprey
sinful belfry
#

yeah, i think passing either the channel or the id should work

eternal osprey
#

okay, but is it maybe possible to migrate directly from one category to antoher?

#

No right?

sinful belfry
#

you'd use the .setParent() method to move a channel from one category to another

eternal osprey
#

oowh so it just overwrites

sinful belfry
#

id assume so

stiff stratus
#

Hi, where can i put post a bug on the website?

sinful belfry
stiff stratus
#

yep

sinful belfry
stiff stratus
#

thanks

eternal osprey
#

thanks starman! I guess it worked!

stiff stratus
#

yep, its labeled currently 😂

#

#669

sinful belfry
#

oof, hopefully it'll get fixed at some point

stiff stratus
#

yep, well its only to let them know if its a new bug

#

but due its been reported its ok

#

if its not fixed they think its not priority now 😄

eternal osprey
#
setTimeout(() => {
      channel1.setParent(`${claimedcategory}`, { lockPermissions: false })``` I currently had set 5 roles who where able to see channnel1 by giving it viewing allow perms. However, after this little category change, I want to overwrite it to make sure only 2 of those selected roles are able to see them (Marked by role1.id and role2.id). How would i make such overwrite?
#

wasn't it like channel1.overwritePermissions?

#

Yeah ping me with the answer, thanks in advance guys!

stray seal
#

Hello! Anyone online.

buoyant cliff
#

hello

stray seal
#

Can someone help me?

#

I need help making a name.

#

pls

#

I can say whut it has

split hazel
# eternal osprey ```js setTimeout(() => { channel1.setParent(`${claimedcategory}`, { lockPe...

Since you change categories, wouldn't it be easier to (outside of your discord bot) reset the channels permission overrides

in the first category let all 5 roles see the channel

in the second category let only two roles see the channel and then when you run the command

simply run a simple method which will make the channel inherit the permissions of the category

easiest with less code

#

@eternal osprey forgot if I pinged you now (I probably did)

split hazel
eternal osprey
#

it actually already pinged me as you replied to my message. thank you!

#

I ahve just used channel1.overwritePermissions

#

would work too. Thanks for the help!

timber fractal
#

so i have this code in my reload command to set the aliases

 if (pull.aliases && Array.isArray(pull.aliases)) {
                        pull.aliases.forEach((alias) => 
                        client.aliases.set(alias, pull.name));
                    }``` but it says `TypeError: Cannot read property 'set' of undefined` why does it?
lyric mountain
#

"client.aliases"?

#

also, foreach bad

timber fractal
#

cmd works at other bot

split hazel
timber fractal
lyric mountain
#

idk, you didn't show barely any code

timber fractal
#

what code do you want

lyric mountain
#

errr...the rest of it?

timber fractal
#

there you go

lyric mountain
flat copper
#
const fetch = require('node-fetch');
module.exports = {
	name: 'what-anime',
	aliases: ['w-anime'],
	category: 'Fun',
	description: 'get anime by image',
	execute: async (client, message, args) => {
		let attachment = message.attachments.first();
		fetch('https://trace.moe/api/search', {
			method: 'POST',
			body: { image: attachment.url },
			headers: { 'Content-Type': 'application/json' }
		})
			.then(res => res.json())
			.then(result => {
				console.log(result);
			});
	}
};
bronze gulch
#

Can anyone help me with linux
how i add the -r flag?

It is recommended to run it as a normal user as it doesn't need further permissions.
If you want to run it as root, add the -r flag.

timber fractal
flat copper
lyric mountain
#
if (!client.aliases) client.aliases = {}
pale vessel
# flat copper

Body needs to be stringified JSON and set your content-type header to application/json

timber fractal
pale vessel
#

O, you already have the correct headers

lyric mountain
#

{} means you're initializing client.aliases as an object

pale vessel
#

Skimmed through that

timber fractal
lyric mountain
#

put in what?

timber fractal
#

nothuing?

flat copper
timber fractal
lyric mountain
#

nothing I guess, it's up to you what you want as starting data

pale vessel
#

Err, just stringify your body

timber fractal
#

TypeError: client.aliases.set is not a function

#

@lyric mountain

pale vessel
#

set() only works for sets and maps/other equivalent constructors

#

Won't work for an object

timber fractal
#

so what to do then?

#

nvm i fixed it myself

lyric mountain
#

oh, forgot about js maps

timber fractal
#

but this error randomly shows up

#

reinstall discord.js?

lyric mountain
#

did you grab the code somewhere?

timber fractal
#

no

#

my friend and i made it together

pale vessel
#

Looks like it came from the library itself

lyric mountain
#

is d.js updated?

timber fractal
#

what to do

timber fractal
#

i installed it yesterday on bot and i just reinstalled it

lyric mountain
#

what version is it?

timber fractal
#

discord.js@12.5.3

lyric mountain
#

weird then

timber fractal
#

what to do

#

it occurs like right here cuz the embed doesnt send but the commands reload

lyric mountain
#

idk, you'll need help from someone more experient in d.js for that

timber fractal
#

do you know someone maybe?

#

illj ust ask ind djs server ig

quiet pawn
#

i am alr with js

#

i made my bot in it

split hazel
#

window?

#

I thought this was nodejs

pale vessel
#

It's using form-data's browser lib for some reason

split hazel
#

@timber fractal so what's inside ../structures/embeds.js

#

you might be doing something weird

timber fractal
#

const Discord = require('discord.js');
module.exports = {
default: function (msg) {
return new Discord.MessageEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL())
.setColor(#00fbff)
.setFooter(Ishana's Utilities | ${msg.guild.name})
.setTimestamp()
}
}

#

They helped me in djs server i defined the wring thing

slender wagon
#

@stray seal u can only redirect them to a channel if they are in that server

timber fractal
#

I think thats it

stray seal
#

If then in the server.

slender wagon
#

tell me what's the use case

stray seal
split hazel
#

@timber fractal probably not but somewhere inside your code can you console.log(typeof global.window)

#

just in case

timber fractal
#

In djs they say it might be from glob

split hazel
#

I'll be on my pc as well to investigate glob

timber fractal
#

i fixed it it was this little piece i defined wrong

split hazel
#

nice

#

that glob package has so many unnecessary dependencies

#

contributing to the node_modules clusterfuck

earnest phoenix
solemn latch
#

now my 15 doesnt seem as bad

earnest phoenix
#

yep

quartz kindle
#

npm went full npm

visual chasm
#

how can i get the number of emojis in all guilds

#

message.guild.emojis.cache.size but for all guilds

errant flax
#

just loop every guild the bot is in

solemn latch
#

Are emojis even cached by default?

errant flax
#

then add those numbers then u get ur result blurplemmlol

errant flax
near stratus
visual chasm
sudden geyser
#

or you could just use reduce and add up the sum

near stratus
small tangle
#

max pp

earnest phoenix
sudden geyser
#

Or even better:

client.guilds.cache.reduce((count, guild) => count + guild.emojis.cache.size, 0);

sight 100

clever agate
#

Is it possible to put emoji instead of getting "??"?

sudden geyser
#

yeah

#

but you haven't provided enough information for any of us to help

clever agate
#

I put "😗" but it returned "??"

earnest phoenix
#

is it possible to broadcast over clusters?

#

just like shards

cinder patio
pale vessel
#

Simp

#

Jimp isn't that great with text since it uses bitmap fonts which have limited characters support

#

You're better off using canvas for text manipulation

clever agate
#

okeh

#

soon i create like this

long crow
#

Trivia sure does look neat with the select interaction

slender thistle
#

Wew, indeed

vivid fulcrum
#

if only element widths were consistent too 😔

long crow
#

heh, discord being discord

#

the button width trigger me more than it should

cinder patio
#

Wouldn't buttons be better in this case

long crow
#

for randomized true/false and multiselect imo select fit better

#

maybe I made it button if I specifically made multiple answer

long crow
#
                /**
                 *@type {Array<string>}
                 */
                const answers = question.incorrect;
                answers.push(question.correct);
                answers.sort(() => Math.random() - 0.5);
                for (let n = 0; n < answers.length; n++) {
                    selectAnswer.addOptions([
                        {
                            label: `Options : ${n + 1}`,
                            description: `${decode(answers[n])}`.slice(0, 48),
                            value: `${decode(answers[n])}`,
                        },
                    ]);
                }``` For simple randomizing the answer, this is good enough?
lusty quest
#

why -0.5? iirc it rounds it to the next matching index

quartz kindle
#

sort requires a return value of a number bigger or smaller than 0

earnest phoenix
#

That's basically the shortest way to shuffle an array

#

But its not really recommended

long crow
#

the longest length is 4, forgot to mention

#

Ya, I saw it quite easy to guess, but I think it work for short length?

earnest phoenix
#

Its pretty decent for small arrays

lusty quest
#

i guess the way i do it is a bit overkill then, i have a array of Answers where i push in the correctanswer and then shuffle the array. so i get a question with 4 possible answers but always in a random order

rose warren
#

Do bot integration roles count towards the max server roles?

#

I'm pretty sure they don't, right?

#

iirc

quartz kindle
#

another array randomization method is to clone the array of possibilities then splice a random item onto a new array

lusty quest
#
export function shuffleArray(array: any) {
  let currentIndex = array.length,
    randomIndex;

  // While there remain elements to shuffle...
  while (0 !== currentIndex) {
    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex--;

    // And swap it with the current element.
    [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
  }

  return array;
}
``` i have this, works quite nice, but idk if its the fastest way
quartz kindle
#

that should be very fast, but not sure about the quality of the randomness

lusty quest
#

nah its just an array of 4 items, should be good enough

#

so people just wont press the same button to get the correct answer

quartz kindle
#

yolo spams same button

frosty zephyr
#

i am very noob i wanna make my bot in multiple bot files like meme.py how to do tho

lyric mountain
#

cogs

frosty zephyr
#

hmmm

lyric mountain
#

tbf, that's as far as I can point you to since I'm not a python dev

frosty zephyr
#

how to do those

lyric mountain
#

dot dot dot

#

just research how cogs work, I can't guide you but I know that's the way for multi-file bots in python

frosty zephyr
#

bot.load_extension('cogs.test') # this is good but you can make it better

for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')

else:
print(f'Unable to load {filename[:-3]}')?

#

@earnest phoenix

#

this?

lyric mountain
#

ye probably

earnest phoenix
wheat mesa
#

This is development related, right? What am I meant to do here?

frosty zephyr
#

no no i just want to make my 200 lines file to like other files

lyric mountain
#

what does it do? why use it? be creative

wheat mesa
#

Yes, but am I supposed to use HTML?

frosty zephyr
#

yeah

solemn latch
#

optional

lyric mountain
#

you're supposed to write about your bot

frosty zephyr
earnest phoenix
frosty zephyr
#

idk

solemn latch
lyric mountain
#

html is just for fancyfying

earnest phoenix
#

lol

wheat mesa
#

Ah. Makes sense

earnest phoenix
#

im so confused

solemn latch
#

you cannot use npm in your bots description

lyric mountain
wheat mesa
#

My knowledge of HTML is basically throwing things together until it eventually comes out with a scuffed looking website, so I'm glad it's not forced.

solemn latch
#

which is what waffle is asking about

earnest phoenix
lyric mountain
#

tbf, html is by far the most optional thing in longdesc since you can just use markdown

wheat mesa
#

some fullstack dev would look at some of the html I've written and laugh for a few minutes, then slap me in the face.

earnest phoenix
#

my bot desc is kinda weird

wheat mesa
#

Yeah, using md rn

onyx hare
#

So Im Trying To Get This To Work The Only Error I Have Had I DOnt Get: DiscordAPIError: 404: Not Found whats not found?

const Discord = require("discord.js");
const fs = require('fs');
const path = require('path');
const config = fs.readFileSync(path.resolve(__dirname, '../config.json'));


exports.run = async (client, message, args) => {
    const webhookClient = new Discord.WebhookClient(config.webhookID, config.webhookToken);
    if (!message.member.permissions.has("ADMINISTRATOR"))
    return message.channel.send("You Have Been Denied Use Of This Command ~ Have A Nice Day!");

    if (!message.member.roles.cache.has("831638881376010250") || message.author.bot) return;
 
    let announcement = args.slice(1).join(" ");
      webhookClient.send(announcement)

};
cinder patio
#

maybe a webhook with that ID / token doesn't exist

onyx hare
#

idk, i just made the webhook, copied it, ID is the Numbers, then Tokens The Characters Right?

stable eagle
#

is there an api that gives a phrase in different languages?

wheat mesa
#

Like... google translate?

onyx hare
#

can someone explain why this wont write to the file... this sent the "Added To the File" section but it never added to the file angry_viktor

const fs = require('fs');
const path = require('path');

exports.run = async (client, message, args) => {

    let guild = message.guild
    let test = args.slice(1).join(" ");
     
    fs.writeFileSync(path.resolve(__dirname, './test.html'), JSON.stringify(test))
    message.channel.send(test + "Added To The File").catch((e) => guild.channels.cache.find(i => i.name === 'crystal-crash-logs').send('Error: ' + e));
};
#

it as in the test message i usede

celest aspen
#

Hi there. whenever i put my bot id into https://top.gg/bot/:your-bot-id/webhooks to start using webhooks i always get a 404 error. do i need to add my bot to top.gg to access this page? If not, why am i getting a 404 Page Not Found error

onyx hare
nimble kiln
#

That should do the trick

celest aspen
celest aspen
nimble kiln
#

oh yeah and it has to be added to top.gg and verified

celest aspen
#

Oh oka. no workaround for that?

nimble kiln
#

Nope

plain talon
#

why would you need its webhooks without it on the site?

celest aspen
plain talon
#

you'd want to be on the server api then

#

i assume thats a thing i dont use the server list

celest aspen
plain talon
#

yes but bot webhooks are for when people vote for a bot

celest aspen
#

In the docs there is something called on_dsl_vote tho.

#

I wasnt sure how to use it so came here for help

#

but guess i need to get accepted on top.gg first

lyric mountain
#

on_dsl_vote would be exactly what webhooks do probably

#

webhooks are basically reverse apis - the service sends a request to you and you handle it

celest aspen
#

Yeh but i dont understand how to implement them. plus can't find any examples to try to understand the code cuz i couldnt understand the docs at all

lyric mountain
#

what language?

celest aspen
#

Python

lyric mountain
#

scroll down to "webhook"

celest aspen
lyric mountain
#

you enter the id in the other side

celest aspen
#

other side?

lyric mountain
celest aspen
#

like my bot

lyric mountain
#

webhooks are reverse apis, so if you normally supply the api url in your own code, for a webhook you supply your server's url to the site

#

yes, you need to be approved first

celest aspen
#

oh okay, that actually makes allot of sense

#

One last question if i may

lyric mountain
#

sure

cinder patio
#

ngl, next.js sucks ass

celest aspen
#

Is there a way to make ur bot private on top.gg so like people other cant see it except the owner?

lyric mountain
#

no

cinder patio
#

non-existent TS support and proper docs

lyric mountain
#

why would you publish a bot if you want it to be private in first place?

#

published means open for public usage

celest aspen
#

Well its actually built especially for one server

lyric mountain
#

then don't publish it

prime glacier
#
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: reaper-2.0@v6.3.0-stable
npm ERR! Found: discord.js@13.0.0-dev.f200f14.1626436969
npm ERR! node_modules/discord.js
npm ERR!   discord.js@"^13.0.0-dev.1dcad05.1626178061" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer discord.js@"^12.0.0" from discord-paginationembed@2.1.0
npm ERR! node_modules/discord-paginationembed
npm ERR!   discord-paginationembed@"^2.1.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/ubuntu/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2021-07-16T18_40_13_212Z-debug.log

while doing npm i in aws
using discord v13

celest aspen
lyric mountain
#

chances are you'll be denied if it's hardcoded to one server

lyric mountain
#

like, votes have 0 benefit outside of putting your bot higher on the list

#

if you want some kind of "daily" reward just make a command to simulate it

celest aspen
#

i see

prime glacier
#

how to install discordjs v13?

lyric mountain
#

although I'd not advise doing so

#

since nightly versions might drastically change before stable release, requiring you to constantly rewrite your code

stray seal
#

How do i get/make a Bot Dashboard?

cinder patio
# stray seal How do i get/make a Bot Dashboard?

You'll need to know HTML, CSS, JS, preferably a framework like React or Vue, how to create REST APIs, and how to use discord's oauth2. It's not an easy task, and there isn't a single answer to this. Research the technologies I listed, and start learning.

onyx hare
#

Kinda Works... Doesn't Send announcement In The Description

const Discord = require("discord.js");

exports.run = async (client, message, args) => {
    const webhookid = "REDACTED"
    const webhooktoken = "REDACTED"
    const webhookClient = new Discord.WebhookClient(webhookid, webhooktoken);
    if (!message.member.permissions.has("ADMINISTRATOR"))
    return message.channel.send("You Have Been Denied Use Of This Command ~ Have A Nice Day!");

    if (!message.member.roles.cache.has("831638881376010250") || message.author.bot) return;
 
    let announcement = args.slice(1).join(" ");
    let embed = new Discord.MessageEmbed()
    .setColor("GREEN")
    .setTitle("Testing")
    .setDescription(announcement)
    .setTimestamp()
      webhookClient.send(embed)

};
#

i had "test" as the test message for the announce

tulip ledge
#

You know what would be cool

#

If bots were able to have an About Me section

#

like us

onyx hare
smoky spire
#

They just announced that

#

The application description will show as about me

#

Soon

onyx hare
#

o

#

sweet

eternal osprey
crimson vapor
#

yes

eternal osprey
#

yup! Thanks

#

how do i check if a specific user has one of these roles: js const roling = [role1, role2, role3, role4, role5]?

sudden geyser
#

Depends on what rolex is

#

If it was a snowflake as a string, you could use .includes(...)

#

If it was a role instance, you could pass a function with .some and see if the .id matches.

eternal osprey
#

yup used the some function and it worked!

eternal osprey
#
channel1.overwritePermissions([
        {
          id: role1.id,
          deny: ['VIEW_CHANNEL']
        },
        {
          id: role2.id,
          deny: ['VIEW_CHANNEL']
        }, {
          id: role3.id, 
          deny: ['VIEW_CHANNEL']
        },
       {
        id: role4.id, 
        allow: ['VIEW_CHANNEL']
      },
      {
        id: role5.id, 
        allow: ['VIEW_CHANNEL']
      },
        {
          id: message.guild.id, 
          deny: ['VIEW_CHANNEL']
        },{
          id: vip.id,
          allow: ['VIEW_CHANNEL']
        }
        
      ], 'This will send the channel to the claimed category')
    
    }, 10000);```
why is it missing permissions now? Pretty sure my whole bot has all the selected scopes available.
#

and the roles don't have admin rights

onyx hare
#

I want to explore the possibilities with buttons but I don’t have a cows clue on how to make em work I just wanna make a verification system that says “press here to verify”

fair axle
#

Okey, Why we are not able to use emojis (not unicode) on embed title? I can do it in v12 but not v13 anymore

prime mist
prime mist
fair axle
#

Same code, only difference is v12-v13

eternal osprey
#

does the element users start with index 0 or 1? js {"h38c70":{"name":["367251020914491392"],"users":[],"category":["Unclaimed"]},

slender thistle
#

Indexes in JS start from 0

rotund siren
#

unimportant question: Are there other languages for coding bots

#

as far as I know, I only know python and javascript

#

just a random question, but itd be cool to learn something new

slender thistle
#

Any language that supports websockets and HTTP requests

rotund siren
#

like php and c++?

lament rock
#

php probably

#

c++ definitely

rotund siren
#

yeah I think I understand

lament rock
#

you might want to ease into lower level languages like getting into java/c# and then work into c and/or rust from there

#

If you don't understand types already, give TypeScript a try

#

going from high level to lower level is rough

rotund siren
#

I know thanks

sudden geyser
#

It's less about the level of the language and more about the paradigms.

lament rock
#

Lower level languages usually follow similar ones

rotund siren
#

Came out the crib learning C++ before Python

#

I need to finish coding, ive been procrastinating for the past week 😔

slender thistle
#

Pascal ftw

sudden geyser
# lament rock Lower level languages usually follow similar ones

Sometimes, but lower-level languages are just closer to the hardware of the computer. Paradigms affect a large aspect into how one writes and thinks about programs. Imperative vs. declarative programming, for example. Learning Java vs. Clojure, for example. I'd rather say that low/high-level programming is just another paradigm.

slender thistle
#

Rust for Discord bots cough cough

long crow
#

Golang

split hazel
sudden geyser
#

You're just scared of crabs

limpid anvil
#

Go is better confirmed

earnest phoenix
#

does anyone know about ipc and cluster evaling?

split hazel
lament rock
#

@pale vessel should I drop using built in http lib and just go for net.Socket and write raw requests

pale vessel
#

Why amandathink

lament rock
#

yes

#

number 1 reason: meme and I'm a masochist

pale vessel
#

Is the difference that significant? If not, then don't bother, IMO.

lament rock
#

not in performance, no

#

raw socket is very different in terms of http tho

pale vessel
#

Up to you

#

I wouldn't have a reason to

earnest phoenix
pale vessel
#

But it's definitely a learning experience

#

So if you're up for it, sure

lament rock
#
socket.connect({ port: 10204, host: "localhost" });
socket.write("HTTP/1.1 GET /loadtracks\r\n\r\n");
pale vessel
#

Doesn't sound half bad honestly

lament rock
#

uses streams as well

#

Only downside is parsing headers

#

I was trying to support icecast web servers since their responses start with ICE/ instead of HTTP/
and nodejs http doesn't like responses that don't start with HTTP/ and emits an error

quartz kindle
#

ice ice baby

pale vessel
#

How did other libraries handle those then?

lament rock
#

Apparently, they replace http's parser

#

I found a lib that uses http(s) and allows for ICE/

#

ditch all http wrappers, return to http

pale vessel
#

You really like it low level huh

lament rock
#

performanceeeeeee

pale vessel
#

Sure haha

quartz kindle
#

ferpormance

lament rock
#

masochist

split hazel
#

why would they change it to ICE/

#

that's so stupid

lament rock
#

idk. It's a protocol specifically for radio broadcasts

quartz kindle
#

speaking of performance, anyone ever tried ultralight?

lament rock
#

link?

pale vessel
#

Is this the "better electron"?

lament rock
#

hm. Front end

quartz kindle
pale vessel
#

Cry mentioned it before IIRC

split hazel
#

this sounds like that other electron alternative

quartz kindle
#

there are many "better electron"s out there

#

this one isnt exactly a replacement

#

doesnt run node.js

split hazel
#

neutralinojs

#

it apparently too offers better performance

quartz kindle
#

neutralino uses webview

#

and quickjs iirc

split hazel
#

so angeryBOYE

quartz kindle
#

and doesnt support native libs

vivid fulcrum
#

if you're looking into electron alternatives

#

blazor desktop is something to look into

#

really promising

split hazel
#

you know what

#

just don't use electron at all or make a fucking website instead

#

boom

quartz kindle
vivid fulcrum
#

yeah

#

it can run js too though