#development

1 messages · Page 1830 of 1

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

and so will message.channel.send(client.token)

crimson vapor
#

in many cases flaze has evaled eval ctx.worker which shows the token

sudden geyser
#

so it's really just a safety precaution

wicked pivot
#

in the idea it works but if I add some example text! embed $ {message.author.name} hey! there's only the Tony Kun

near stratus
#
message.channel.send(`${eval(message.content.split('${')[1].split('}')[0]) }${message.content.split('}')[1]}`)

(still not using regex)

#

also it'll break if the user makes a simple mistake

wicked pivot
#

this is not for an order I have been saying that since a while ago because it is easier to explain like that do not worry you

near stratus
#

No I can't do that without regex
thank you

wicked pivot
#

if you use regex it would work?

frank flint
#
    def __init__(self,bot):
        self.bot = bot
        self.token = 'x'

        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
    @commands.command()
    async def on_dbl_vote(self, data):
        await self.bot.get_channel(871778583339753502).send(f'{data}')    
``` firstly , dblwebhook what should i put secondly is the code correct ? im getting no errors
#

but its not sending'

#

anyone free?

#

tag me pls

sage bobcat
#

One message removed from a suspended account.

near stratus
#

@wicked pivot use this regex then eval

#

wait don't

#

all backslash got removed when copying

#
/\$\{[a-zA-Z0-9\.\(\)\{\}]{1,99}\}/g
#

use this

sage bobcat
#

One message removed from a suspended account.

near stratus
#

L ?

wicked pivot
#
let array = 'string'.split(' ')
    let send = ""
    for (texte of array) {
        if (texte.includes('${')) {
            send = send + eval(texte.split('${')[1].split('}')[0]) + ' '
        } else {
            send = send + texte + ' '
        }
    }```
probably very little optimized but it works as I want it thank you
boreal iron
#

When I'm registrating interactions I'm receiving a DiscordAPIError: Missing Access
What access am I missing?
The app has the intents GUILDS as well as GUILD_INTEGRATIONS

crimson vapor
#

are you registering to the guilds themselves?

boreal iron
#

yeah to the guilds, not global yet

crimson vapor
#

they might not have the slashcommands scope

boreal iron
#

I might be blind but I can't find it... lol

near stratus
boreal iron
#

I could swear I did pandasad

#

Hmm lemme check

near stratus
#

do it again

earnest phoenix
#

Anyone know how to make a Custom Application Bot, are there any Bot Developers I can Hire or talk too ?

sudden geyser
#

You may be interested in Fiber Fiverr

near stratus
boreal iron
near stratus
earnest phoenix
#

Don't got time to do it myself

boreal iron
#

weird

near stratus
earnest phoenix
#

Looking to hire someone, Already paying people to set up 2 discords, my DayZ Nitrado Server and Emblem/Logo. But the community I was in disbanded and the owner blocked everyone, so now I am trying to find out the application bot he used so I can use it for my community, or make a fresh custom bot

#

I was in a Wavez Factions DayZ Discord Server a while back and they had a system I liked.

  1. Read the Discord Rules
  2. Click an Emjoi that would lock you from seeing the rules
  3. Bot would send you an application based on those rules
  4. An Admin would confirm or deny your application

If your application was Accepted, you'd get access to the discord as a member with limited access too channels

If not accepted, you would be kicked from the discord

Trying to get the same system set up

cinder patio
#

This is not the right place for this

#

go to fiverr if you want to hire a developer

earnest phoenix
#

If I wanted to hire a thief, I'd go to the cartel, thx though

boreal iron
near stratus
cinder patio
#

fiverr at least gives you buyer protection

wispy socket
#
WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest".

console say that but when i try to run this command the warning remains the same...

near stratus
wispy socket
#

4.9.0

near stratus
#

strange,
that's the latest tho

#

maybe any of your packages are using an older version

#

Are you using any third party package ?
like Discord-music,
music-boost etc ?

wispy socket
#

maybe, I try to delte them

boreal iron
#

Weird... my interaction doesn't show up

#

(╯°□°)╯︵ ┻━┻

modest maple
#

global interactions can take upto an hour to register

boreal iron
#

nah it's a guild interaction

charred wyvern
#

Does anybody knows how to get vs code presence for discord on ubuntu?

#

Thanks

rose warren
#

I'm pretty sure there's just an extension you add in VSCode?

charred wyvern
#

I added it

#

By Crawl right?

rose warren
#

I don't know.

#

Have you tried restarting Discord and VSC?

crimson vapor
#

thats what it says for you

charred wyvern
#

Yes

crimson vapor
#

perhaps you added it through discord and its overwriting the custom presence

charred wyvern
#

Maybe

#

Ill retry

rose warren
#

Check your Discord settings

charred wyvern
boreal iron
#

Why the fuck does the (guild) slash command don't show up smirk god damn new trash

#

Registrating the guild interaction has been logged succesful.

charred wyvern
#

Linux: Discord versions installed using flatpak or snap need modifications in order to support IPC

#

It says this for Linux

#

But I don't know the command to run?

rose warren
#

Have you tried Googling it?

charred wyvern
#

yes

nova basin
#

I have take of discord.js guide but i have error zerotwocry

#

(I'am new on discord.js)

earnest phoenix
#

the token is wrong

nova basin
earnest phoenix
#

your new but got accepted?

#

reload the token

boreal iron
# crimson vapor are you registering to the guilds themselves?

Gonna ask once again...
You may have an idea why the interaction (slash command) doesn't show up?
Registrations for guilds should happen in real time, hmm?

    // ready event
    const interactions = 
    [
        {
            name: 'pong',
            description: 'Replies with Ping!'
        }
    ];
    
    for(const [id, guild] of client.guilds.cache)
    {
        for(const command of interactions)
        {
            await client.application.commands.create(command, id).then(console.log);
        }
    }

client.on('interactionCreate', (interaction) =>
{
    console.log(interaction);
}
earnest phoenix
earnest phoenix
#

I had that issue.

boreal iron
#

Since I'm the owner of the test guild, I have enough "power"

crimson vapor
#

im not sure tbh

boreal iron
#

Other interactions like buttons etc. will trigger the interactionCreate event successfully

#

But the registered slash commands somehow not even show up

#

If nothing helps anymore... let's call @quartz kindle

quartz kindle
#

@_@

boreal iron
#

They should update immediately.

quartz kindle
#

did you by any chance add a webhook url for interactions in your discord application page?

boreal iron
#

lemme check

#

nope the Interactions Endpoint URLis empty

quartz kindle
#

the command shows up on discord right? just when you run it you dont receive anything?

boreal iron
#

The command doesn't show up in Discord.

quartz kindle
#

oh

boreal iron
#

That's the issue

quartz kindle
#

does your bot have the application commands scope?

boreal iron
#

yes it does, already reinvited it to make sure

#

Does it need special permissions?

quartz kindle
#

what does the .then() log return?

boreal iron
#

The ApplicationCommand obj

#
ApplicationCommand {
  id: 'xxx',
  applicationId: 'xxx',
  guild: <ref *1> Guild {
    id: 'xxx',
    name: '12345',
    icon: null,
    features: [],
    commands: GuildApplicationCommandManager {
      permissions: [ApplicationCommandPermissionsManager],
      guild: [Circular *1]
    },
    members: GuildMemberManager { guild: [Circular *1] },
    channels: GuildChannelManager { guild: [Circular *1] },
    ...
    emojis: GuildEmojiManager { guild: [Circular *1] },
    stickers: GuildStickerManager { guild: [Circular *1] }
  },
  ...
  name: 'pong',
  description: 'Replies with Pong!',
  options: [],
  defaultPermission: true
}
quartz kindle
#

hmm

#

you have the permission right?

#

this one

boreal iron
#

Yeah test-wise for @everyone

#

(I'm the (test) Discord owner)

quartz kindle
#

try logging guild.commands.fetch()

queen needle
#

Was just about to ask if they logged the commands

boreal iron
# quartz kindle try logging guild.commands.fetch()

It's registered.

Collection(1) [Map] {
  'xxx' => ApplicationCommand {
    id: 'xxx',
    applicationId: 'xxx',
    guild: Guild {
      id: 'xxx',
      name: '12345',
      icon: null,
      features: [],
      commands: [GuildApplicationCommandManager],
      ...
    },
    guildId: 'xxx',
    permissions: ApplicationCommandPermissionsManager {
      manager: [Circular *1],
      guild: [Guild],
      guildId: 'xxx',
      commandId: '871814885850353685'
    },
    name: 'ping',
    description: 'Replies with Pong!',
    options: [],
    defaultPermission: true
  }
}
near stratus
boreal iron
#

The slash command isn't showing up, which also means the event isn't get triggered

boreal iron
#

Creating a new guild real quick, inviting the bot with the correct scope -> same result

#

wut? no, not on mobile

near stratus
#

otherwise the commands should load
(they're loading for me rn)

#

dm me the invite

boreal iron
#

sure, need to generate it again, one sec

boreal iron
#

who would have thought of this lmao

quartz kindle
boreal iron
#

yeah what a nonsense

#

the whole client looks differently, at least a little bit

lyric mountain
#

this wouldn't happen if it wasn't for slash commands mmLol

boreal iron
#

god damn caching

small tangle
#

in Java, is Stringbuilder or Stream API better regarding String operations?

slender thistle
#

How would one make sure that user input (&str) would not overflow in u128? Do I have to use conversions or is there another way?

lyric mountain
#

StringBuilder has constant concatenation time, so it is better over loops but bad on single operations

#

sometimes using Stream is overkill and might be worse than a simple loop (like if all you're gonna do is concat)

#

stream is only good if you have many processes for the input

small tangle
#
private String getCommandNamesAsString(Set<String> cmdNames) {
        return cmdNames
                .stream()
                .sorted()
                .map(cmdName -> "`" + cmdName + "`")
                .collect(Collectors.joining(" "));
    }

e.g in this case

lyric mountain
#

like filtering, mapping, reducing, etc etc

lyric mountain
#

however you don't really need .map

#

nor joining

#

use reduce

small tangle
#

oh oke lemme see FeelsSmartMan

#

never used reduce that much

#
private String getCommandNamesAsString(Set<String> cmdNames) {
        return cmdNames
                .stream()
                .sorted()
                .reduce("", (total, element) -> total + " `" + element + "`");
    }
#

have it iPog thanks for the input! didnt think of reduce

elder stump
#

Hi, I was thinking about maintaining one of my bots, but I forgot where I hosted it... Is there a way to find that out ?

quartz kindle
#

...you forgot where you hosted your own bot?

small tangle
#

what LULW

split hazel
#

all hope was lost

elder stump
#

I found it on glitch & heroku, I removed it from both to check if it was not somewhere else. The bot is still online so I guess I forgot

quartz kindle
#

lmao

elder stump
small tangle
#

what? hosted on multiple platforms at the same time?

quartz kindle
#

well, another advantage of paid hosts. you wont ever forget it, since you're paying for it

#

:^)

elder stump
#

Yeah I think I archived it on glitch, then hosted it on heroku. But I checked & the app on heroku was down

small tangle
#

true that

elder stump
#

There's no way someone else can host it without my token right ?

quartz kindle
#

nop

#

does it have an eval command?

elder stump
#

it doesn't

quartz kindle
#

rip

slender thistle
# slender thistle How would one make sure that user input (`&str`) would not overflow in u128? Do ...
    fn validate_partial_input(&self, input: &str, _sel: &Selection) -> Validation {
        let number = u128::from_str_radix(input, 10);
        if number.is_err() {
            return Validation::failure(Error::default());
        }
        let digit_chars = input.chars().all(|c| c.is_digit(10)) && number.unwrap() <= u128::MAX;
        if digit_chars {
            Validation::success()
        } else {
            Validation::failure(Error::default())
        }
    }

Relying on errors to handle user input let's gooooooo

elder stump
#

I could create a new token & re-host it with that one I guess ?

quartz kindle
#

well yes

#

but your old bot will be invalidated, likely crash because of it, and if you have something that autorestarts it, it will keep crashing forever

#

lmao

#

well, most auto-restarters have a limit to how many restarts in a short time

elder stump
#

Yeah I did that, that's the easiest way

#

Thanks for the counseling

wooden ember
#

when you get the time someone joined a server and the time the account was created is there a way to compare them to see how long the time difference is? because as far as i know the api only returns a date and not a number and i have no idea how to compare dates in a simple way

#

using javascript forgot to add

elder stump
#

The time should be in milliseconds. So now - then = duration (in millisec)

wooden ember
#

yes but that doesnt tell me how long the account was around brfor joining the server

#

wait i could just use how old the account is regardless of the date

elder stump
wooden ember
#

yeah im just being dumb

elder stump
#

Sounds like asking made it clearer for you

wooden ember
#

just trying to make an anti bot thing for my server so i dont have to keep banning user bots made seconds before joining manually

wooden ember
#

but thx for the help

lyric mountain
#

it performs considerably better over large datasets

elder stump
#

I didn't know you could get the user account age with the discord api

wooden ember
#

yeah you can just go on a server with the bot dyno and do the command ?userinfo and it says

elder stump
#

I'm looking at the doc rn for Node. Is it from ClientUser.createdAt ?

pale vessel
#

createdAt would be an instance of Date

elder stump
#

yeah, there's createdTimestamp

wooden ember
#

possibly i haven't done much discord bot related stuff in just over a year

pale vessel
#

If you want the timestamp in milliseconds that would be createdTimestamp

lyric mountain
#

millis?

elder stump
#

but that's since the person created their account ?

lyric mountain
#

I'm pretty sure discord timestamps are seconds

wooden ember
#

yeah

pale vessel
#

Milliseconds

lyric mountain
#

the lib converts to millis?

pale vessel
#

Ye

wooden ember
#

why

pale vessel
#

Well timestamps are officially in ISO date format

elder stump
#

Would make sense, timestamps are always like that

lyric mountain
#

I mean, the <t:timestamp> thing is in seconds

wooden ember
#

i thought ISO was in secconds

pale vessel
#

And some structure don't have them so the library extracts the timestamp from the ID/snowflake

elder stump
#

But anyway, even if it was seconds, you could get createdAt & get the millisec value of the Date() object

wooden ember
#

yeah thats all i need

#

just want to make my bot insta ban anyone with an account younger than 5 minutes old

#

or atleast kick and send a msg to rejoin later in the slim chance its not a bot

lyric mountain
#

eh, bots can be detected by user.bot

wooden ember
#

no i mean self bots

#

the ones that join spam all the chats with a csgo phishing link and then leave

lyric mountain
#

that was oddly specific to top.gg

wooden ember
#

?

boreal iron
#

Aye

wooden ember
#

what do you mean

boreal iron
#

Happens here as well

wooden ember
#

it happens every where

lyric mountain
#

but anyway, that isn't a reliable way of preventing that

#

just add a two-step join

#

like

wooden ember
#

yeah but an unreliable way is better than no way

lyric mountain
#

member joins -> has to react somewhere to get a role

boreal iron
wooden ember
#

my server isnt that big its not worth it to do that the user bots only really affect me cuz i have to clear it up

lyric mountain
#

they evolve too fast, hard to track it

lyric mountain
boreal iron
#

And keep track all the possible redirect sites to ban them as well

wooden ember
pale vessel
#

stearncommunity

boreal iron
#

Yeah additionally not or

wooden ember
#

authough that is abit clunky though but eh

lyric mountain
#
  • deny MESSAGE_WRITE to everyone
  • create a "Member" role, which has MESSAGE_WRITE perm
  • add a reaction button somewhere you like (like in the rules) to get the role
  • ???
  • profit
#

0 selfbots attacking ur server

wooden ember
#

yeah but every bot under the sun does that

boreal iron
#

Isn’t that already possible with the rules channels?

lyric mountain
#

well, that's the meta for a reason

wooden ember
#

indeed

lyric mountain
boreal iron
wooden ember
#

lol

boreal iron
#

Trust discord with nothing

#

Already took me weeks to get over the verification process
Didn’t wanna share my personal data to Discord but I couldn’t go on kicking small guilds if they invite the bot or inactive ones

#

Tried to resist as long as i could but finally failed oldEyes

lyric mountain
#

well, if it conforts you, ID is somewhat a public data

boreal iron
#

Not really, nah

#

Not even my name smirk

sudden geyser
#

message is a Collection

#

Not a Message

earnest phoenix
#

@livid jackal

true kayak
#

hey i need help

#

Fontconfig error: Cannot load default config file this error comes up while i run my bot

#

const config = require("./config.json"); and this is my code

#

@wooden kindle can u help me?

wooden kindle
#

huh

#

what error it giving u

true kayak
#

Fontconfig error: Cannot load default config file

#

this

wooden kindle
#

erm

#

lemme see ur config file

#

take out token ect

true kayak
wooden kindle
#

so u have it like this

true kayak
#

yea

earnest phoenix
#

Try delete ,

wooden kindle
#

ye

true kayak
#

still same error

#
const client = new Discord.Client();
const config = require("./config.json");

client.on("ready", ()=>console.log("READY"));

const welcome = require("./welcome");
welcome(client);

client.login("token");```
#

this is my index.js

wooden kindle
#

erm

true kayak
#

any fix?

wooden kindle
#

should ur welcome channel not be welcome.js

#

or no

true kayak
#

it is welcome.js

wooden kindle
#
const client = new Discord.Client();
const config = require("./config.json");

client.on("ready", ()=>console.log("READY"));

const welcome = require("./welcome.js");
welcome(client);

client.login("token");```
#

try that

#

and is the welcome file in a folder or no

true kayak
#

no

#

its not

true kayak
#

still same error

wooden kindle
#

erm

#

can s1 els help im

#

i dont know what the prob is

boreal iron
frail zenith
#

im making a command that lets you see how many votes a person has, my issue is that therse an error attached saying it can't read property execute of undefined, it’s probably something super simple and i’m overthinking it because i’ve never interacted with a website before https://srcshare.io/?id=610872e0d568299bcc398fd8

frail zenith
#

wait i cut it out?

wooden kindle
#

its not my stuff

#

@true kayak

earnest phoenix
wooden kindle
#

needs help

#

not me

frail zenith
solemn latch
#

thats my fault

frail zenith
#

there we go lol

#

ohhhh makes sense

solemn latch
frail zenith
#

hmm i wonder why that is, it looks like any other of my commands

opaque seal
#

I'm getting a CORS error when doing a post request with axios but have no idea why

this.$astroAPI.post('/chargebee/hostedPage', {
            userID: user.id,
            yearly: this.yearly,
            quantity: this.quantity
          })
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:11000/api/v1/chargebee/hostedPage. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:11000/api/v1/chargebee/hostedPage. (Reason: CORS request did not succeed).

While get request work just fine

Here is my backend cors policy (using KTOR)

    // Cors
    install(CORS) {
        method(HttpMethod.Post)
        method(HttpMethod.Options)
        method(HttpMethod.Get)
        method(HttpMethod.Put)
        method(HttpMethod.Delete)
        header(HttpHeaders.AccessControlAllowOrigin)
        header(HttpHeaders.Authorization)
        host("localhost:3000", schemes = listOf("http", "https")) // just for testing
        host("astro-bot.space", subDomains = listOf("www", "docs"), schemes = listOf("https"))
    }
frail zenith
#
if (command === 'vote') {
            client.commands.get('vote').execute(message, args, client);
        }
solemn latch
long crow
#

I'm fairly certain the issue rise because of 3rd line, visual studio code auto add it

solemn latch
#

the error doesnt point there though.

long crow
#

Does you have any file name boodro at same folder?

frail zenith
#

oh that’s probably it, i have no idea why that’s there?

long crow
#

visual studio auto add it sometime when the autotyping pop up

frail zenith
#

oh same error though

#

i dont really understand what’s wrong, i added it to my command handler like any other one

#

wait

#

did i name it execute?…

solemn latch
#

yeah

frail zenith
#

wtf is wrong w me

#

lmao

solemn latch
#

name: 'execute',

frail zenith
#

yeah i didn’t realise what you meant at first because i looked at the file name

#

also how do i use the token to use the webhook?

solemn latch
#

the webhook doesnt need your top.gg token.
the auth is made by you.

frail zenith
#

eek i worded that poorly

#

oh so the authorization part?

#

and then i just make a normal webhook?

solemn latch
wooden ember
#

how would i time how many seconds passed between a user sending two messages?

frail zenith
#

so would i do config.webhooks.mytoken?

solemn latch
sinful sonnet
#

how can i get the response from an api to send it in a discord command

solemn latch
wooden ember
#

but how would i get the timestamp from the previous message though?

solemn latch
#

depends, how are you tracking the other message?
ie, how do you know about the previous message.

wooden ember
#

im just trying to detect spam where a user bot spams a massage in every channel

#

and i just whanna make it so if someone sends two messages withing 5 seconds they get kicked

solemn latch
#

youll want to track messages sent then, probably with something custom.

wooden ember
#

tryed making it so everytime a msg is sent it starts a timer that will only stop if some one sends a msg within five seconds or it runs out at 6

#

but that just feels clunky and unscalable

frail zenith
wooden ember
#

cuz it starts a timer after every msg

solemn latch
frail zenith
#

uh, other way around then haha?

wooden ember
#

and would probably break if two people ar msging at the same time thinking about it lol

frail zenith
#

i’m not rlly sure how to word it

#

interacting with API’s that aren’t just like image scrapers is kinda scary lol

solemn latch
lament rock
#

Using intervals like what's currently being done can be bad because of how many ticking timers could be theoretically reached. That would consume more cpu time

solemn latch
#

ideally, using intervals youd batch message groups together.

lament rock
#

a single clock could be implemented

solemn latch
#

I do think redis is probably the solution here though.

lament rock
#

Anything with a TTY is subject to more cpu time imo

frail zenith
#

oh i just read the doc, how would i set up that webhook?

lament rock
#

unless redis does optimizations and batching TTYs

solemn latch
#

👀 tty?

frail zenith
#

what does tty mean?

sinful sonnet
#

how can i get the response from an api to send it in a discord command

quartz kindle
#

redis will never be faster than arrays and objects in memory

lament rock
#

I meant TTL

#

I am have dumb

solemn latch
#

👀 so youd make timer for each message sent?
or how would you handle it

frail zenith
#

are we allowed to cross post? i think i asked my question in the wrong channel

quartz kindle
#

when a user sends a message, store an array for that user somewhere, and put a timer on it for 5-10 seconds to delete the array

solemn latch
frail zenith
#

oh alrighty

lament rock
#

Have a single interval and sweep a Map keyed by user ID with the V being an Array of Message references each duration

quartz kindle
#

for every message sent, if there is an array, add to it

#

if it exceeds a certain size, do something

#

actually you dont even need an array, just a counter

solemn latch
quartz kindle
#

if counter doesnt exist or is 0, set to 1 and start a timer that resets it, then keep adding messages until its reset

#

if the counter ever grows bigger than whatever, then its spam

#

honestly timers dont mean much, you could probably have a million timers without an issue

#

but yeah, a few timers on users is more efficient than timers on messages

stray seal
#

What is my error?

quartz kindle
#

open your package.json

#

it has "main": "index.js"

#

your file its called "main.js"

#

either rename your file to index.js or rename the "index.js" entry in the package.json to "main.js"

#

the file name has to have the same name as the "main" key in the package.json

wooden ember
stray seal
#

It is running to errors but when i start to do .ping i am getting this wacky console

quartz kindle
#

startsWith, not startWith

stray seal
quartz kindle
#

show error

stray seal
quartz kindle
#

you did startst

stray seal
clever agate
#

hey

#

I made a profile command in Canvas, so I decided to put several "a" and it turned out that I can't make the letter smaller

lyric mountain
#

Well, you can

#

But at what point are you willing to go?

clever agate
#

decrease the letters to fit right.

#
client.db.user.findOne({_id: message.author.id}, function(e,d) {
Canvas.registerFont('./font.ttf', { family:'lilita' })

const canvas = Canvas.createCanvas(1078, 243)
const ctx = canvas.getContext('2d');
let context = ctx;

Canvas.loadImage('./assets/profile.png').then(async(image) => {
  ctx.drawImage(image, 0, 0, 1078,243)
context.font = "50px lilita"
context.fillStyle = '#ffffff';
	context.fillText("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", canvas.width / 7, canvas.height / 2.90);
  message.reply({files: [{attachment: await canvas.toBuffer(), name: "file.png"}]})
})
})```
lyric mountain
#

Ye but, you can only decrease so much before it becomes unreadable

#

That font is not really suited for small sizes

clever agate
#

automatically decrease

lyric mountain
#

There's no automatically decrease

#

You gotta make the algorithm for it

clever agate
lyric mountain
#

Are you even reading what I'm saying?

clever agate
clever agate
quartz kindle
#

actually there is

#

CanvasRenderingContext2D.fillText(text, x, y [, maxWidth]);

#

maxWidth Optional
The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text. However, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width.

clever agate
#

@rustic nova

rustic nova
#

-ub 593383699706281994

gilded plankBOT
#

🔓 Unbanned Gaute#0559 (@loud ingot)

lyric mountain
#

Wut

rustic nova
#

Ah fuck too late

quartz kindle
#

Lol

rustic nova
#

Ffs

clever agate
#

what

rustic nova
#

-b 593383699706281994

gilded plankBOT
#

dblMod Banned Gaute#0559 (@loud ingot)

clever agate
#

LOL

rustic nova
#

Fuckin discord

clever agate
#

LMAO

lyric mountain
#

Did you just un-unban?

rustic nova
#

Tried rebanning to clear the messages

#

Discord decided to be shit

#

Mobile vibes

clever agate
#

sad

#

ok i give up

quartz kindle
#

just add the 4th parameter lol

clever agate
#

I returned

#

I couldn't do a thing

#

(Jimp)

#

ignore the proportions

#

and the things

#

which is bizarre

#

the "Dev Note" is to be all user badges

earnest phoenix
#

Well uee

#

But that's not what those events are typically reading

#

guildCreate could mean it joiner a guild and guildDelete could mean it left one

#

Wdym

#

Yea

#

Or log that it joined a server

boreal iron
#

It’s an event getting triggered, for example if your bot joins a guild GUILD_CREATED is being fired

earnest phoenix
#

Yea

#

If it leaves it fires the guild delete

boreal iron
#

You can "listen to“ that event in your code

earnest phoenix
#

Well ofc you can

lyric mountain
#

But ye, it can create and delete guilds it created

boreal iron
#

Exactly like you listen to the message event which fires if a message was send in Discord

lyric mountain
#

Although that only works on first 10 guilds iirc

earnest phoenix
#

Yes

boreal iron
#

As long as you have the right intents

earnest phoenix
#

It can't create more then 10 guilds iirx

lyric mountain
#

Not only that

earnest phoenix
#

Or no it can do it if it's in more then 10

lyric mountain
#

It can only create as long as it's below 10 guilds

earnest phoenix
lyric mountain
#

So like, if you already joined 4 you can only create 6 guilds

earnest phoenix
#

Are you sure that's v12

#

Or even v13

#

That's not a thing in v12 even

#

You gotta go through the channel manager iirx

#

mag.guild.channels.creae() iirc

#

create*

lyric mountain
#

Mag

boreal iron
#

lmao

lyric mountain
#

Locked and loaded

earnest phoenix
#

I shorten message to msg

#

Less to write on mobile

boreal iron
#

mag is less then msg?

earnest phoenix
#

This proves flazepe is always lurking

#

Or they are self botting reactions

split hazel
#

*takes screenshot of screen with phone*

earnest phoenix
boreal iron
#

Alright I’m tired, you can handle this, I believe in you! smirk

#

Of course right in the moment you create it

#

1x code is less than 2x code

#

lol

#

Just a random example found in the 'net:

#

message.guild.channels.create(channelName, {
        type: "text", //This create a text channel, you can make a voice one too, by changing "text" to "voice"
        permissionOverwrites: [
           {
             id: message.guild.roles.everyone, //To make it be seen by a certain role, user an ID instead
             allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], //Allow permissions
             deny: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] //Deny permissions
           }
        ],
      })```
#

written on mobile - call me god

lyric mountain
#

I call you dog

boreal iron
lyric mountain
#

Tell your cat I said pspspsps

boreal iron
#

Damn don’t have this evil eye emoji Erwin used quite often

split hazel
#

kinky

boreal iron
#

Sorry need to sleep Wass…
Just continuesly ping Kuuhaku, he will help you

lyric mountain
#

Message.guild.roles.everyone is the @everyone role

#

What's the matter then?

#

Not really

#

The permission chain is
User > role > everyone

errant flax
#

just use a role or a user

wooden dust
#

hm

lyric mountain
#

So user perms override role perms which override everyone perms

errant flax
#

whats the highest ping u got for ur bot

#

api

clear marlin
#

452ms

errant flax
#

1000+ dog_kek

clear marlin
#

DO was slow at the time it happened

errant flax
#

the lowest is 70ish

#

i have a bad bot dog_kek

lyric mountain
#

Highest I ever had was around 16k

errant flax
#

what happened to do that isee

lyric mountain
#

Good times on le olde contabo

#

Before the rework they had hdd plans

#

Which were really cheap

#

But well, let's say you suffered a lot with high STs

errant flax
#

has anyone transfered there normal commands to slash commands yet

lyric mountain
#

I use both

clear marlin
#

I use both

errant flax
#

same

#

doesnt matter for me anyways my bot aint going big

lyric mountain
#

My command handler kinda translates slash to normal and vice versa, so I'm pretty fine

earnest phoenix
#

Huh I was pinged?

clear marlin
#

@earnest phoenix

#

yes

errant flax
#

lel

earnest phoenix
#

Stop tj

clear marlin
#

no

errant flax
clear marlin
#

do some work with the slash command handler @earnest phoenix

clear marlin
#

good job

earnest phoenix
#

But a mans gotta enjoy his time sometime

#

:c

clear marlin
#

no enjoyment wtf

earnest phoenix
#

Like u ur on vacation

#

smh

#

Alright then get the fuck back here

#

no more vacation

clear marlin
#

I mean, I can still work

errant flax
#

i only take a break if my battery is on low percent/jk

earnest phoenix
#

I take breaks when I want to take breaks

clear marlin
#

I'm on my laptop but PC's better

earnest phoenix
#

joy of working for myself

errant flax
#

has anyone have access to context menus?

#

oh god misosface

lyric mountain
#

That's no ping

earnest phoenix
#

not that kind of ping

lyric mountain
#

Isn't that the integer limit?

#

Ah, nope, nevermind

errant flax
#

good thing for me i dont use vc(unless i want to listen to music)

#

groovy is my jam smh

#

im not changing music bots anyways #general

#

this isnt development related anymore

lethal trout
#
const client = require('../index')
const arrayOfStatus = [
    'HI',
    'nice',
    `${client.guilds.cache.size}`,
    'haha'
]
let i = 0
const index = Math.floor(i);

client.on('ready', () => {
    console.log(`${client.user.tag} is now online!`)

    setInterval(() => {
        //client.user.setPresence({ activities: [{ name: arrayOfStatus[index], type: "WATCHING" }] })
        client.user.setPresence({ activity: [{ name: arrayOfStatus[index] }], status: 'dnd', type: "WATCHING" });
        i = i + 1;
        console.log(i);
        if (i === arrayOfStatus.length) i = i - arrayOfStatus.length;
    }, 10000)
})```

It doesnt show the status only.. dnd, no errors...
v13
errant flax
#

bc u rnt randomizing what item u want to pick from the array

#

ur only doing Math.floor(num)

earnest phoenix
#

ez

#

Probably spoon feeding but shrug

#

@pale vessel if its bad code show me how its done

#

Actually is activity even supposed to be an array?

#

I can't remember I haven't touched presences in ages

lethal trout
# earnest phoenix ```js const arrayOfStatus = [ 'HI', 'nice', `${client.guilds.cache.s...
- const arrayOfStatus = [
-    'HI',
-    'nice',
-    `${client.guilds.cache.size}`,
-    'haha'
- ]
- client.user.setPresence({ activity: [{ name: arrayOfStatus[Math.floor(Math.random() * arrayOfStatus.length)] }], status: 'dnd', type: "WATCHING" })

+ const arrayOfStatus = [
+    'HI',
+    'nice',
+    `${client.guilds.cache.size}`,
+    'haha'
+ ]
+ client.user.setPresence({ activities: [{ name: arrayOfStatus[Math.floor(Math.random() * arrayOfStatus.length)] }], status: 'dnd', type: "WATCHING" })```
earnest phoenix
#

?

frail zenith
#

uh that looks like the exact same code but twice lmao

clear marlin
earnest phoenix
# clear marlin ?

Mom get out my room im playing FTB presents Stoneblock 2 minecraft

clear marlin
#

alright brb I'm getting out

#

but you gotta win son

earnest phoenix
#

I have only died once

#

to a chicken

#

Apparently if you attack a chicken with a stick it goes super sayun on ya

wooden dust
#

is that a hypothesis or a fact

earnest phoenix
#

Its a fact

wooden dust
#

did you test it

earnest phoenix
#

it did 4 hearts of damage per attack with full diamond armor

wooden dust
earnest phoenix
#

and i had to kill it with a stick else I wouldn't get the amazing drop

wooden dust
#

what's the drop

earnest phoenix
#

Chicken stick

wooden dust
earnest phoenix
#

which is used to fight the end chicken

wooden dust
#

ender chicken

earnest phoenix
#

to get a dragon egg

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
wooden dust
#

We're talking about chicken stick development

earnest phoenix
#

Nah lets move

cobalt girder
#

Hi

#

Someone can explain me how I can do a now playing command with a bar with the duration of the song ?

#

With distube pls . I been searching for a long time 😔

errant flax
earnest phoenix
#

Ah makes sense

#

another useless thing

#

Is it possible for a server to send data back to the client in real time without an always connected websocket?

whole glen
#

does anyone know html because I have a question. is there a way to have more then one style change? I wont the color to be white and the font to be different but it does not tell me how to have two style changes and this does not work <h1 style="color:white;" style="font-family:verdana;">Websites and apps with DarkMode</h1> I'm a noob and it prob is very easy

wooden dust
#

Use commas

whole glen
#

<h1 style="color:white;", style="font-family:verdana;">Websites and apps with DarkMode</h1>?

wooden dust
#
<h1 style="color:white;, font-family:verdana;">Websites and apps with DarkMode</h1>```
whole glen
#

ok

wooden dust
#

actually

#

I don't think you have to use commas

wheat mesa
#

You don't

wooden dust
#
<h1 style="color:white; font-family:verdana;">Websites and apps with DarkMode</h1>```
whole glen
#

thanks it works with no comma

wooden dust
#

ye

whole glen
#

the tutorial does not say

#

also dont join

rose warren
#

You have to put it inside a wrapper. You can't center a link on it's own. Try putting it inside a div element and putting the text-align property on that instead.

whole glen
#

ok

long crow
rose warren
#

Or do display:block; margin: 0 auto on the link if you want to leave it without the wrapper.

rose warren
#

I'd delete this if I were you

whole glen
#

k

long crow
#

I 'd join it later... Nuuu got deleted

whole glen
#

lol

whole glen
heady bronze
#

Anyone knows how to change the bot page Like this ?

#

the floating logo

pale vessel
#

Use CSS animations

rose warren
#

cringe

earnest phoenix
#

ive been working extremely hard on my bot's website, and, tonight ive released the leaderboard! what do you guys think about it? next few days we will implement discord api to get your userid and display more information and even show vote history for the last 7 days with graphs made by the bot! cool! https://ranks.eternaltesting.xyz

obsidian flint
earnest phoenix
long crow
#

Hey

obsidian flint
earnest phoenix
next storm
#
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
    at async GuildMember.edit (/home/container/node_modules/discord.js/src/structures/GuildMember.js:312:5)
(node:25) 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: 24)

can anyone tell why this is comming

#

;-;

rose warren
next storm
#

idk

obsidian flint
#

ok

next storm
#

actually this is a music bot

rose warren
#

And if it's not opt-in that's also not great

obsidian flint
next storm
#

and i was trying to play music in stage

#

but

#

it is unable to play.

#

)-:

obsidian flint
next storm
#

;-;

obsidian flint
#

not the same as voice perm I think

next storm
#

what.

#

;o;

obsidian flint
rose warren
#

Looks like it encountered the error when trying to edit a guild member. If the guild member is the server owner or has a role higher than the bot that's probably the reason behind the error.

next storm
#

oh

next storm
#

)-:

rose warren
#

Doesn't look related to the error? 🤔

#

Show us your code

errant flax
#

how do i compare ApplicationCommandData and ApplicationCommand??

next storm
#

;-;

obsidian flint
wanton flicker
#

hi, ive been trying to get vote rewards like this

#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)```
#

but it doesnt seem to do anything

#

how do i get on vote?

near stratus
pale vessel
#

There's the end event for collectors

errant flax
#
<MessageCollector>.on("end",(collected,reason)=>{
//code
})

Collected param is a collection of Messages

Reason param is the reason why the collector stop (i think its undefined when it ends automatically)

shadow frigate
#

I've made a command to edit a value in a JSON file, however, when successfully writing to it, the data ends up becoming one whole line.

How can I fix this?

pale vessel
#

Use JSON.stringify(obj, null, spaces)

shadow frigate
#

cheers

#

spaces being a number right?

pale vessel
#

Spaces is amount of spaces for indentation or you could also put a value like \t

shadow frigate
#

Alright, I was using 2 for logging errors

#

should work

earnest mural
#

strange i had discordutils package installed, and then when i wake up to check on my bot, the bot is offline and the packge decided to uninstall itself

#

same with asyncpraw wtf

quartz kindle
#

ghosts

#

you send to the message from before you created the collector?

#

yes

#

and you should still have the original message where you received the command from

#

or where do you want to send it to?

#

message.channel.send() ?

#

outside of the collector

#

where did you create the collector?

#

show code

#

see? you have message

#
collector = message.channel.createMessageCollector()
collector.on("end", collected => {
  message.channel.send(collected.size)
})
#

variables declared outside the scope still exist inside the scope

#

as long as you dont override them

sly sierra
#

oh god djsv12 looks weird

earnest phoenix
#

how do we log server-votes?

pale vessel
#

Use the webhook

earnest phoenix
#

like i need to make my bot log votes and give a role on voting i dont want to use other bots like vote-logger which has some bugs

grim sundial
quartz kindle
#

use the webhook

chrome silo
#

Hello, I have in my bot a giveaway command and the embed changes currently every 5 seconds the timer which is api abusing but what would be ok? I read on the dev portal every 20 sec would be ok.

rose warren
#

It depends how many giveaways are set up in the same channel.

chrome silo
#

Well, what would be the best way to find a fix for that issue?

boreal iron
#

Well obviously respecting the rate limts (to not get banned).

#

You may think about to generally change your system to not require that many edits of the message so quickly.

chrome silo
#

like every minute?

eternal osprey
#

TypeError: AutoPoster is not a function:

const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('mytoken', client)

ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})```
pale vessel
#

Read the example

#

You're not destructuring the AutoPoster function from the object

eternal osprey
#

isn't this exactly what i did tho

#
const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('', client)

ap.on('posted', (stats) => {
console.log('Posted stats to Top.gg!')
})```
pale vessel
#

Err no you simply defined the object/default export

#

Look again

eternal osprey
#

owh wait, that message: "posted top top.gg"etc is optional

#

can't i just remove that and simplify to: ```js
const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('', client)```

pale vessel
#

I guess

eternal osprey
#

sure. thanks

shadow frigate
#

I can't seem to send a DM to the owners of servers when my bot joins them.

module.exports = (Discord, client, settings, unirest, guild, shard) => {

  guild.members.fetch(guild.ownerID).then(owner => {

    var embed = new Discord.MessageEmbed()
      .setTitle("Thanks for inviting me!")
      .setDescription(`You invited me to **${guild.name}**.`)
      .addField("Getting Started", "You can use the **$help** command to see a list of commands that you can use to help you setup your role store.")
      .addField("Links", `**[Invite](${settings.links.invite}) - [Support](${settings.links.support}) - [Premium](${settings.links.premium}) - [Upvote](${settings.links.upvote})**`)
      .setImage(`http://${settings.server.host}:${settings.server.port}/api/assets/shopcord-banner.png`)
      .setColor(settings.bot.embed_colour)

    owner.send(embed)
    .then(() => { console.log(`[Shard ${shard}][Function][guild-join-dm] Successfully sent server join message to ${guild.owner.user.tag}.`) })
    .catch(error => { console.error(`[Shard ${shard}][Function][guild-join-dm] ${JSON.stringify(error, null, 2)}`) });

  }).catch(error => { console.error(`[Shard ${shard}][Function][guild-join-dm] Could not fetch the owner of the server.`) });

}
#

It says [Shard ${shard}][Function][guild-join-dm] Could not fetch the owner of the server. yet I know the owner can be fetched, because it's meee

#

Don't think it's supported just yet

near stratus
#

There are two types
GUILD_PUBLIC_THREAD
and
GUILD_PRIVATE_THREAD

#

with channel type 11 and 12 respectfully

#

normally they look like this

{
  "id": "41771983423143937",
  "guild_id": "41771983423143937",
  "parent_id": "41771983423143937",
  "owner_id": "41771983423143937",
  "name": "don't buy dota-2",
  "type": 11,
  "last_message_id": "155117677105512449",
  "message_count": 1,
  "member_count": 5,
  "rate_limit_per_user": 2,
  "thread_metadata": {
    "archived": false,
    "auto_archive_duration": 1440,
    "archive_timestamp": "2021-04-12T23![40](https://cdn.discordapp.com/emojis/743159537397268532.webp?size=128 "40")39.855793+00:00",
    "locked": false
  }
}
#

Sad Already did like 2 / 3 years ago

#

yes

#

If you can do something with your account (user)
you can probably do that in bot api too

#

discord.js ?

#

np

north jewel
#

hey, i have a question about json,i want to get the value of the key, i tried ${jsonFile.key}, the key having another value, but it returns undefined

tulip ledge
#

What is jsonfile?

#

How is it defined?

north jewel
#

const jsonFile = require('../../json.json')

tulip ledge
#

Does it exist?

north jewel
#

yes

#

...

tulip ledge
#

Can you log jsonFile?

north jewel
#

but the point is that key has the value test, and doing jsonFile.key doesnt seem to log as jsonFile.test

tulip ledge
#

What

#

Oh

#

Key is a variable?

north jewel
#

yes

tulip ledge
#

Then use jsonFile[key]

north jewel
#

hmm ok

#

tysm ttteu_thanks

tulip ledge
#

Np

north jewel
#

i never really understood json CS_Hehe

tulip ledge
#

That notation has nothing to do with json

#

It’s how to access objects in js

north jewel
#

so requiring a json file makes an array?

stray seal
#

I am running no errors running this code but i am not getting my Embed with this command:

module.exports = {
    name: 'command',
    description: "Embeds!",
    execute(message, args, Discord){
            const newEmbed = new Discord.MessageEmbed()
            .setColor('#ff249d')
            .setTitle('Rules')
            .setURL('https://www.youtube.com/channel/UC_PubN0fYwvhuse982q1sgA')
            .setDescription('This is an embed for the server rules.')
            .addFields(
                {name: 'Rule 1', value: 'Be Nice'},
                {name: 'Rule 2', value: 'Testing Nice'},
                {name: 'Rule 3', value: 'Be Cool'}
            )
            .setImage('https://i.imgur.com/AfFp7pu.png')
            .setFooter('Yo!');

            message.channel.send(newEmbed);
    }

} ```
tulip ledge
#

No, and object

north jewel
#

oh

#

are you running <prefix>command ?

stray seal
#

I can snip if you guys need

north jewel
#

name: 'command',

#

you named your command command

stray seal
#

Yes.

north jewel
#

so u did <prefix>command?

eternal osprey
#
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster(mytoken', client)
```I still get the same autoposter is not a function error
stray seal
tulip ledge
north jewel
#

can i see your message event?

stray seal
#

I ran the command and this is what it looks like now.

north jewel
#

and use a console.log() right after execute

tulip ledge
#

Can you put console.log(1) in the top of your execute method?

stray seal
#

where? I am now so confused

north jewel
#

can you show the index.js, without token if its there

tulip ledge
#

Right above const embed

#

Put a console log

#

And see if it logs anything

stray seal
#

The full command at the end (the client):

client.on('message', message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if (command === 'ping') {
        client.commands.get('ping').execute(message, args);
    } else if (command === 'youtube') {
        client.commands.get('youtube').execute(message, args);        
    }
});```
#

The full Ping is there

north jewel
#

bruh

stray seal
#

???

north jewel
#

you need to add

        client.commands.get('command').execute(message, args);        
    }```
stray seal
#

E'ry one codes diffrent

north jewel
#

since thats what u did there

narrow fractal
#

Anyone know what can cause this?

north jewel
stray seal
#

let me try now

#

Now getting an Error?

quartz kindle
#

whats the point of creating a command handler if you're not using it?

tulip ledge
#

Just add if(client.commands.has(command)) client.commans.get(command).execute(message, args)

quartz kindle
#

^

stray seal
#

Where?

#

Imma noob lol

tulip ledge
#

Instead of the if(command === …) bullshit

quartz kindle
#

the point of a command handler is avoid having to check every single command individually

#

so instead of "if command is test - do something" "if command is a - do something" "if command is b - do something"

#

you simply do "if command exists in commands - run command"

#

one line for all commands, no matter how many you have

stray seal
#

What do i do to fix my error?

north jewel
#

you cant add it into params

#

.-.

quartz kindle
#

you can lol, but its useleless

stray seal
north jewel
#

show me

#

into your command file

stray seal
#

Think i fixed

#

Fixed

quartz kindle
#

you need to require Discord in all files where you want to use Discord

north jewel
#

;-;

stray seal
#

@north jewel said to do this:

client.on('message', message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if (command === 'ping') {
        client.commands.get('ping').execute(message, args);
    } else if (command === 'youtube') {
        client.commands.get('youtube').execute(message, args);        
    } else if (command === 'command') {
        client.commands.get('command').execute(message, args);        
    }
});```

I had to do this:
```js
client.on('message', message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if (command === 'ping') {
        client.commands.get('ping').execute(message, args);
    } else if (command === 'youtube') {
        client.commands.get('youtube').execute(message, args);        
    } else if (command === 'command') {
        client.commands.get('command').execute(message, args, Discord);        
    }
}); ```
quartz kindle
#
  1. thats not needed and thats not what he said to do
  2. you're still not using the command handler properly
boreal iron
eternal osprey
#

hey guys, my trivia command constantly gives me &quot& in the questions.

#

Any ways on how to remove those

quartz kindle
#

passing it as an argument is the horrible solution lmao

boreal iron
#

Less work, less code = 👍

north jewel
#

yes

eternal osprey
quartz kindle
#

how is it less work less code lel

boreal iron
#

Those are htmlentities you can parse

boreal iron
north jewel
#

just do const Discord = require('discord.js')

#

omg so hard ahhhh

earnest phoenix
#

Object.defineProperty(global, "Discord", {
value: require("discord.js")
});

errant flax
#

how do i edit a role's permission in djs master branch

wooden dust
wooden dust
#

no

wooden dust
#

Use datetime

jolly vale
#

i am

wooden dust
#

try and except

jolly vale
#

no thats not the problem the problem is checking if its a valid city in the api

wooden dust
#

It'd return an error if it's not

jolly vale
#

ye and how do i make the bot send a message in that case

wooden dust
#
try:
check for city and stuff
except:
send message saying city isn't valid```
#

Try would run the code normally, however if there's an error it'll switch to except, and there you can display an error message for the user.

jolly vale
#

oh ok so i just put the api where city is?

wooden dust
#

yeah you do everything you have rn inside try

#

and then error message inside except

eternal osprey
#

hey guys, how do i remove tje &quot& words from a string like this?

jolly vale
#

ok got it thanks

wooden dust
#

At least everything in that particular prompt

#

Yup

eternal osprey
#

replaceall woul;d do the job right

wooden dust
#

yeah if &quot& is constant then it should

eternal osprey
#

ready.replaceAll is not a function

const ready = easy.results[0].question
const klaar = ready.replaceAll("&quot&", "");```
clever agate
#

passport-Discord is giving an error

  • TokenError
#

WHY?

quartz kindle
#

you can use replace with regex instead

eternal osprey
eternal osprey
quartz kindle
#

which btw is faster than replaceAll

long crow
#

for that funny characters, decodeURI is more appropriate

quartz kindle
#

decodeURI doesnt handle html entities

long crow
#

const { decode } = require('html-entities'); KEKW

quartz kindle
#

ye thats an option xd

long crow
pale vessel
#

They cowboyrage

long crow
earnest phoenix
#

How does bot hosting service handle ratelimits/ip bans?

quartz kindle
#

the service doesnt

#

the users have to respect limits, if the user gets the hosting ip banned, the hosting service can ban the user

#

ip bans are usually temporary anyway, and the hosting service has many ips to chose from

earnest phoenix
#

Can you still hit ratelimit ,if you use discord.js ,since it handles internal

quartz kindle
#

discord.js does not allow you to hit the discord rate limits, but its not 100% ratelimit-proof

#

some endpoints are difficult to deal with because of undocumented sublimits

#

and also the sharding manager does not share limits between shards

#

if one shard hits the limit, the other shards are not aware of this, and can try to go beyond limits

humble gyro
#

Tim is poggers

quartz kindle
humble gyro
quartz kindle
#

<3

humble gyro
#

tim gz

#

you're now in my dev database

quartz kindle
#

Lol

#

thanks? hahaha cool

crimson vapor
#

Pog

wooden dust
tulip ledge
#

How do u do this?

earnest phoenix
tulip ledge
#

Now in english pls

earnest phoenix
long crow
#

it is git gud

cinder patio
#

do what

earnest phoenix
#

if you're using smth like astro it automatically generates it for you

lament rock
#

don't use inline

tulip ledge
cinder patio
#

css bro

pale vessel
#

border border-radius box-shadow

delicate shore
#

hey

charred wyvern
#

I got rich presence working

earnest mural
#

wait why am i getting this error

green kestrel
#

yay got context menu actions working on D++ 😄

#

wonder how long before they reach general availability

lyric mountain
earnest mural
#

my intention of it is when the bot starts or is ready it prints that it is online and sets its status to how many servers it is in with how many members that can use it

lyric mountain
#

I know but, the error says @client.event doesn't exist

#

check the docs to see how it has to be done

earnest mural
#

okay

slender thistle
#

client in that context is a discord.Client instance

earnest mural
#

oh

#

yeah i found out why

#

i had two client.event with on_ready running

#

now it works fine

vast crown
#

hi, why is this not working

const filter = m => m.content.includes("test");
const collector = ch.createMessageCollector({filter, time: 15000});

collector.on("collect", m => {
  ch.send(m.content)
});

It gives me this error: TypeError: Function.prototype.apply was called on #<Object>, which is a object and not a function

quartz kindle
#

not ({filter, time: 15000})

vast crown
#

oh it worked, thanks a lot

near stratus
#

How do I turn off firewalls ?
in windows 10
sothat it starts to accept external http requests

#

and so that I can test top.gg webhooks

marble juniper
#

@quartz kindle do you know a better way to format permissions?
I want to transform an array of permissions from this

['SEND_MESSAGES', 'EMBED_LINKS']

to

['Send Messages', 'Embed Links']
#

what I have currently

#

lol

#

the array it makes though is kinda like this

['Send', 'Messages', 'Embed', 'Links']
#

any idea how else I could format them lol

cinder patio
#
function decapitalize(string) {
  return string.charAt(0) + string.slice(1).toLowerCase();
}

const permissions = ["SEND_MESSAGES", "VIEW_CHANNEL"];
const newPerms = [];
for (const permission of permissions) {
  const [first, second] = permission.split("_");
 newPerms.push(`${decapitalize(first)} ${decapitalize(second)}`);
}
nocturne grove
#
const cmds = await client.api.applications(client.user.id).commands.get();
    
for (const cmd of cmds) {
    client.api.applications(cmd.id).delete().then(console.log);
}```
can anybody tell me why this doesn't delete all (global) commands?
quartz kindle
# marble juniper

i would do something like this ```js
permissions.map(perm => perm.toLowerCase().split("_").map(word => word[0].toUpperCase() + word.slice(1)).join(" "))

marble juniper
#

lemme try that

#

lol

#

im the exact opposite of tim

#

I like to overcomplicate stuff

quartz kindle
#

xD

#

edit: forgot a toLowerCase

#

google makes a good point tho, you can simply tolowercase the rest instead

#
permissions.map(perm => perm.split("_").map(word => word[0] + word.slice(1).toLowerCase()).join(" "))
marble juniper
#

yee works perfectly ty tim uwu

polar quartz
#

How to collect user email using auth02?

#

Or see servers user is in

sudden geyser
#

select the correct scope on the developer portal and have a redirect URI

polar quartz
#

What do I put as the redirect url

near stratus
wheat mesa
#

Do I need the message intent to fetch messages and delete them afterwards?

polar quartz
#

My bots page?

wheat mesa
#

Welp

polar quartz
near stratus
polar quartz
near stratus
#

Sorry I can't give a full tutorial rn
Maybe someone else can help

sudden geyser
polar quartz
#

Alright. I’ll just look it up

polar quartz
#

When they user invites my bot and gives permission to that stuff does it just console.log() it?

#

Or no

lyric mountain
#

well, arrow 1 should be pointing to discord api actually

#

there, fixed it

#

1 - user access discord authorization page
2 - discord sends token to your server
3 - your server exchanges that token for desired info from discord
4 - discord sends the requested data
5 - your server process the data and return some result to user

near stratus
lyric mountain
#

¯_(ツ)_/¯

lyric mountain
#

I mean, I did my oauth2 thing using raw http requests and endpoints

#

that before I found out there are libs for that

near stratus
lyric mountain
#

oauth isn't hard at all once you have a webserver setup

near stratus
#

yea

lyric mountain
#

the hardest part for me was understanding why tf the body json was invalid

#

until I read closer discord docs and found out they actually want urlencoded data not json

near stratus
lyric mountain
#

lul

near stratus
#

*here

polar quartz
#

There’s a full discord embed example in the docs 👀

lyric mountain
#

I still find stupid that "embed color" is actually the "1px thin and almost irrelevant line to the left of the embed"

near stratus
polar quartz
#

Lmao

#

I know I’m gonna get some hate for this and ppl are gonna say I should rlly know js before anything but when I first started all I would do is look at the docs and try to put stuff together when trying to make commands until it would work. I had to prior knowledge of any coding language when I first started making bots

lyric mountain
#

you what?

polar quartz
#

Nothing…

lyric mountain
#

but ye, you're supposed to practice the language before attempting bigger projects

polar quartz
#

Yes ik

quartz kindle
#

you wont get hated for that, many people learn like that, but it gets troublesome when they are not very interested in learning, and just keep asking for people to fix it for them

lyric mountain
#

ye