#development

1 messages ยท Page 1709 of 1

quartz kindle
#

lmao

lyric mountain
#

an unordered plot containing % and absolute data

#

or a data sandwich

solemn latch
#

No top bun?

earnest phoenix
#

there is precompiled binaries in discord py's bin folder for some reason

#

maybe it can help?

torn whale
#

how can i code the bot send a message to a specific channel when someone votes my bot?

earnest phoenix
#

language?

solemn latch
#

You'll want to use the api to receive a webhook, and then send a message like normal for your library.

sturdy dock
#

what is the best way to set up a reminder system for my bot in d.js? would I just use a setInterval for 1 minute and loop through an array of reminder objects to check if date has passed?

quartz kindle
#

if you're fine with reminders being up to 1 minute late

#

sure

sturdy dock
quartz kindle
#

if you want more exact reminders, create an interval that creates timeouts

sturdy dock
#

might end up doing that, thx!

quartz kindle
#

loop through the array, if the date is less than 1 minute from now, create a timeout with the remaining time

sturdy dock
#

right

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

i'll be late

#

:^)

opal plank
#

but timeouts run in sync

#

so its never late

crimson vapor
#

timeouts do be cringe

opal plank
#

agreed

#
function TimeoutPog(fn: fn<any>, time:number) {
  let now = Date.now();
  while(now + time > Date.now()) {
    fn();
  }
}```
This is for the big bois
#

@crimson vapor @quartz kindle

#

dont try that, it'll run that function a fucking gazillion times

#

didnt me and tim build a timeout thing?

quartz kindle
#

wat

opal plank
#

actually it was a highFlex with a setInterval

crimson vapor
opal plank
#

now you can be not only ON time, but before time too

#

never late

quartz kindle
#

watยฒ

opal plank
quartz kindle
#

so instead of being late, you make me work a gazillion times?

opal plank
#

so i made a timeout for you which will execute before, so you arent late

#

yes

quartz kindle
#

i quit

#

:^)

#

imagine if programs became sentient and could modify themselves on the fly

opal plank
#

isnt that how we teach kids? with harsh punishments?

quartz kindle
#

how long until they add process.exit()

opal plank
#

depends

#

on a normal devs code? about a month

#

on my code? about an h

crimson vapor
#

month?

#

how else do you stop your bot

opal plank
#

on a dev from here? about a minute

crimson vapor
#
while (true) process.exit()```
quartz kindle
#

ah yes

#

because one exit is not enough

opal plank
#

i rather do a much better way

quartz kindle
#

you have to make sure to exit the exit

crimson vapor
#
while (true) process.exit(process.exit())```
#

my bad

opal plank
#
import {exec} from 'child_process';

exec(`SIGKILL ${process.pid}`);
#

wink wink

#

can you evet get your own process's PID from there?

crimson vapor
#

perhaps?

opal plank
#

oh

#

you can

#

there

crimson vapor
#
import { execSync } from 'child_process';

while (true) execSync(`echo ${execSync(`SIGKILL ${process.pid}`).toString()}`);```
#

there we go

#

much better

opal plank
#

i yield

#

thats a good one

crimson vapor
#

ik ik

#

wait

#

I forgot toString

pale vessel
#

it's inside a template literal already

crimson vapor
opal plank
#

not even a d.js user can beat code from devs here who are bored

#

in terms of badness

crimson vapor
#

you are wrong

opal plank
crimson vapor
#

you are so wrong

opal plank
#

bad code doesnt beat purposefully bad code

#

we can come up with shitter designs than someone without experience would

crimson vapor
#

well yea but like

#

we aren't thinking we are good doing this shit

opal plank
#

we are good at creating bad code

#

have you seen my bot?

#

thats definition of purposefully poorly coded bot

#

i have bot repos that would put that shit to shame

crimson vapor
#

I made a bad mistake

#

I went to general and started looking at people's githubs

opal plank
#

most people here are notorious for purposefully bad code

#

tim for example used to eval code on a daily basis

crimson vapor
#

why

opal plank
#

i would like a button in github to report a repo to their local authorities please

crimson vapor
#

removed the link

#

like

#

you think your code is bad

#

at least you KNOW whats bad about it

unreal estuary
#

im sorry but why

#

also is this the official top.gg luca bot

quartz kindle
#

yes

#

because luca is the best bot ever

#

so it has to have the best code ever

unreal estuary
#

lol

#

something tells me this isnt luca's actual source

quartz kindle
lean swan
#

serverid.bal

It cannont find what it is but on normal check like db.has(โ€˜293829.balโ€™) it return true

#

Anyone can help me with this?

unreal estuary
earnest phoenix
#

i want that it needs a whitespace before //

lyric mountain
earnest phoenix
lyric mountain
#

that shouldn't match?

earnest phoenix
#

or text//comment

earnest phoenix
lyric mountain
#

so, like, text// comment should match

earnest phoenix
lyric mountain
#

before where?

#

text //comment like this?

earnest phoenix
#

before //

#

text //comment

#

like this

lyric mountain
#

what do you want to capture?

#

include the space or no?

earnest phoenix
# lyric mountain include the space or no?

so it trigger only if there is a space before //
like
text //comment yes
text //commentno
text//commentno
text //commentyes
text// commentno since no whitespace before

lyric mountain
#

that ain't what I mean

#

what do you want to capture? like, what to retrieve

earnest phoenix
lyric mountain
#

//comment, //comment or comment

#

that's what I mean

earnest phoenix
#

no comment can be anything

lyric mountain
earnest phoenix
lyric mountain
#

you don't get it still

earnest phoenix
#

sorry

lyric mountain
#

capture group = what to return, not what to match

#

what is your expected output?

#

or is it just a boolean

earnest phoenix
lyric mountain
#

them who?

earnest phoenix
#

string.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,'')

lyric mountain
#

this is a match, ok?

earnest phoenix
lyric mountain
#

is this what you want to retrieve?

#

circled in red

#

return ONLY comment

#

without //

#

nor space

earnest phoenix
#

so i can replace it

lyric mountain
#

\s+\/\/.+

#

will match everything after //

#

with N amount of spaces

earnest phoenix
lyric mountain
#

||\/\*(\n|.)+\*\/|| if you don't find it yourself

earnest phoenix
lyric mountain
#

separate

earnest phoenix
lyric mountain
#

comments cant be combined

#

you can do this to get both:

#

\/\*(\n|.)+\*\/|\s+\/\/.+

#

also, you surrender way too fast

earnest phoenix
sterile lantern
#

what does mfaEnabled stand for in oauth logging

#

does it mean 2fa

umbral zealot
#

yes. 2fa is part of mfa which is "multi-factor authentication"

sterile lantern
#

ah alright

#

also what does

#

flags: 256,

#

stand for

#

and is it supposed to be different for everyone

#

bc i have a different flag

green kestrel
#

anyone want to give me some feedback on my slash commands functions in my lib?

#

๐Ÿ˜„

#

its taken me so long to do because i thought i had a bug

#

turned out that i had a second instance of my bot running elsewhere, that was eating interaction_create messages and invalidating interaction ids

pale vessel
#

EventEmitter or EventEmitterOptions?

snow urchin
silk wadi
#

How do you do

name = "Zeli"
print(f"Hello {name}!")

In C#?

string name = "Zeli";
Console.WriteLine("Hello " + name);
#

so basically f-strings

pale vessel
#

$"Hello {name}"

#

$-strings

silk wadi
#

pog thanks

snow urchin
#

waits extremely patiently

lyric mountain
earnest phoenix
#

hi

silk wadi
quartz kindle
#

experimental binary serializer

silk wadi
#
using System;

namespace GettingStarted
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your name: ");
            string name = Console.ReadLine();
            if ( name == "Zeli")
            {
                Console.WriteLine("Welcome Zeliktric");
            }
            else
            {
                Console.WriteLine("YOUR NOT ZELIKTRIC!");
            }
        }
    }
}

am pro

snow urchin
onyx hare
#

im getting annoyed with this.. i cant win first it denied message.member.hasPermission("ADMINISTRATOR")
for a hasPermission error now i cant even have it role based
err

 let allowedRole = message.guild.roles.cache.find(r => r.name === "Crystal Bot Permissions")
                                  ^

TypeError: Cannot read property 'roles' of undefined

code

exports.run = (message, args) => {
  let allowedRole = message.guild.roles.cache.find(r => r.name === "Crystal Bot Permissions")
  if (message.member.roles.has(allowedRole.id)) {
    return message.channel.send(
      "Sorry But You Have Been `Rejected` From This Command"
    );
  }
  message.channel.delete() 
  }
earnest phoenix
#

And use <GuildMember>.permissions.has() because <GuildMember>.hasPermission() is gonna be removed in v13

snow urchin
#

gotta love people straight up ignoring me ๐Ÿ˜ฎ

onyx hare
#

how would i log the message? the last time i tried loggin a message i got everything about the guild but nothing about the message

sterile lantern
#
const userResult = await fetch('https://discord.com/api/users/@me', {
    headers: {
        authorization: `${oauthData.token_type} ${oauthData.access_token}`,
    },
});
user = await userResult.json```
#

how do i print the user's username

#

from this

#

oauth

onyx hare
snow urchin
#

ill give u a hint, console log user
anyways

sterile lantern
#

also idk ts so sorry

snow urchin
sterile lantern
#

i only want the username

#

nothing extra

snow urchin
#

user.username

onyx hare
#

when i do console.log(message) It logs the guild info? but not message param

sterile lantern
snow urchin
snow urchin
#

infact

#

what fetch library are you using?

#

axios/node-fetch?

onyx hare
#

it said the not a msg part

sterile lantern
#
{
  id: '293060399106883584',
  username: 'samm',
  avatar: 'a_2cbcb6c17ca217d968553fe36deee9d6',
  discriminator: '0021',
  public_flags: 640,
  flags: 640,
  locale: 'en-US',
  mfa_enabled: true,
  premium_type: 1
}

sterile lantern
#

ah wait

#

i found the issue

#

nvm

snow urchin
snow urchin
#

or..?

onyx hare
#

ofc the client kick it in the balls, it said txt on the console no errors, looked on my phone and it deleted the channel

onyx hare
#

it returned text

snow urchin
#

well, of course it will delete the channel, if you have message.channel.delete()

sterile lantern
onyx hare
#

and del'd the channel

snow urchin
onyx hare
#

yas

snow urchin
#

great!

snow urchin
#

#development message
NOW, my issue, for anyone to help with ๐Ÿ™‚
lets hope I don't get ignored again

sterile lantern
#

for a discord bot, if we're on a team, does everyone need to verify or only the team leader

#

for bot verification

snow urchin
#

leader

sterile lantern
#

but how do multiple devs get verified for one bot

sour flame
#

team

sterile lantern
#

so is it optional or required for all devs on team to verify

snow urchin
#

leader

#

only

sour flame
#

only leader

sterile lantern
#

and devs can verify optionally?

snow urchin
#

when(if) bot is verified, everyone on team gets the badge

snow urchin
sterile lantern
#

wut

#

pog

#

badge is discontinued though right

snow urchin
#

yes

sterile lantern
#

rip

snow urchin
#

so, no badge for you ๐Ÿ˜ฆ

#

ofc it was lost

quartz kindle
unreal kiln
#

huh why is my bot not loading its been saying that for a while and not truning my bot online

snow urchin
#

this is what I got

#

I need the EventEmitterOptions type to be imported into the .d.ts file, and extended into one of my interfaces

quartz kindle
#

you dont need to import it

sterile lantern
quartz kindle
#

just create an interface for EventEmitterOptions and it should automatically merge with the existing one with the same name

waxen snow
#

Can someone help

snow urchin
snow urchin
unreal kiln
snow urchin
#

its not auto merged, as far as I am aware

sterile lantern
snow urchin
sterile lantern
quartz kindle
sterile lantern
#

this s where .env is located

waxen snow
sterile lantern
#

is*

unreal kiln
waxen snow
snow urchin
#

thats a permissions error, run it as root

waxen snow
#

How?

quartz kindle
#

are you hosting on your phone?

waxen snow
#

Yea I use termux

quartz kindle
#

then you cant

#

lol

waxen snow
#

Bruh

quartz kindle
#

what modules are you trying to install? why do you need babel?

snow urchin
unreal kiln
# sterile lantern

yeah that's the new.env and i have no clue if i should keep the same code or no

sterile lantern
#

you just put token as the key and the token itself as thevalue

#

Key: token
Value: Your_bot_token

quartz kindle
# snow urchin to jump back to this, cause my issue got lost again ๐Ÿ˜ฆ What would I stick inside...

this is what worked for me on djsl ```ts
import * as Discord from "discord.js"
export * from "discord.js"

export class Client extends Discord.Client {
public sweepUsers(lifetime?: number): void;
public sweepChannels(lifetime?: number): void;
}

declare module "discord.js-light" {
interface ClientOptions {
cacheChannels?:boolean
cacheGuilds?:boolean
cachePresences?:boolean
cacheRoles?:boolean
cacheOverwrites?:boolean
cacheEmojis?:boolean
cacheMembers?:boolean
disabledEvents?: Array<string>
}
}

#

try that in your .d.ts file

snow urchin
#

anytime I import anything, it instantly treats the file as a module instead of the declarations file

quartz kindle
#

use import *

snow urchin
#

I do.

quartz kindle
#

show your code

quartz kindle
#

youre not using import *

snow urchin
#

I tried that too

unreal kiln
quartz kindle
# snow urchin I tried that too
import * as Events from "events"
export * from "events"

declare module "mymodule" {
  interface ClientOptions extends Events.EventEmitterOptions {
    mongo_uri: string;
  }
}
snow urchin
#

right, doing exactly that code now, still same issue (second screenshot)

quartz kindle
#

is this a module you are importing?

#

do you do import mymodule in your code?

#

or are you using ClientOptions directly?

sterile lantern
#

then go to the secrets section and do it like this

#

secrets V

unreal kiln
snow urchin
#

Actually ye, I am just using it directly, I don't want to have to import the types, hence why I am doing this in the first place

quartz kindle
#

if you're using it directly, dont use a .d.ts file

#

create the declarations in your normal ts files

snow urchin
near igloo
#

idk how to c++

#

can someone tell me what my stupid is?

#

okay i put a ; and its better error but still dk

#

oh i set it to void but im saying its gonna give an int mayb?

#

nope

snow urchin
near igloo
#

can you tell im coming straight from js?

snow urchin
#

well, not according to typescript right now, I don't have a clue why this aint working

quartz kindle
#

yeah its not exported

#

just create your own interface

#
interface ClientOptions {
  a: string;
  b: string;
  captureRejections?: boolean;
}
quartz kindle
near igloo
#

but yea static typing is hard for me ๐Ÿ˜ฉ

quartz kindle
#

i mean

#

all languages have roughly the same limits

#

theres nothing you can do in c++ that you cant in node.js for example

#

except maybe code that runs on specific machines

vivid fulcrum
#

why are you reading a forum thread that's over 10 years old

quartz kindle
#

like OS-level or integrated ciruits

vivid fulcrum
#

cpp syntax evolved by a mile since then

near igloo
vivid fulcrum
#

theoretically

#

you can

#

node can interop c++

near igloo
vivid fulcrum
#

sure

near igloo
#

but anyways im trying to make an application

#

js isnt great for an application

vivid fulcrum
#

i'm not saying it is

#

it's just that it can do what you said it can't

umbral zealot
#

what? lol

near igloo
#

also uhhh idk how to line in with js

umbral zealot
#

js is fine for applicatoins

near igloo
umbral zealot
#

See the thing is it depends what you actually mean by "application"

near igloo
#

๐Ÿคฆโ€โ™‚๏ธ

quartz kindle
#

js is great for cross platform apps, especially because of how easy it is to build interfaces using html and css

umbral zealot
#

no no really. You say "browser" as if it's a damn trap question but that's one of the only things JS can't actually do

near igloo
#

yea im specifying something that doesnt need a runtime, eg an executable

#

js isnt an executable

quartz kindle
#

of course c++ is more powerful, uses 10x less memory, but you need to build it differently for each machine, and it has no built-in user interface capabilities

umbral zealot
#

You can compile JS down to an exe though

umbral zealot
#

Did you know, right now, at this exact moment in time, you were using an application made fully in JS? LOL

near igloo
vivid fulcrum
#

evie is a node fanatic ๐Ÿคทโ€โ™‚๏ธ node just isn't as powerful, but js is great for apps that heavily rely on ui (chromium -> electron), not for anything else though

#

performance is shit

umbral zealot
#

Ah well, aight then, understandable, have a nice day, gg

quartz kindle
#

what is your app gonna do?

umbral zealot
#

inb4 chat app dogekek2

quartz kindle
#

discord ported to c++

#

xD

#

using native OS window UIs

#

aka windowsxp style

umbral zealot
#

Tim, how much are you paid to write shit apps in a language with "shit performance" exactly? Cuz for me it's $78k/year, $CND

quartz kindle
#

$0 :(

umbral zealot
#

d'awww that sucks. no contracts at the moment?

quartz kindle
#

never had one

#

doubt ever will

umbral zealot
#

I wouldn't think that. I used to just write bots and look at me now.

near igloo
quartz kindle
#

"something"

near igloo
#

im gonna keep it secret cuz imma get reamed if i share it in this server

umbral zealot
#

Oh it's a thing that breaks a ToS somewhere. Gotcha, can't perform in video games so you gotta cheat you way to the top, eh? smart

near igloo
quartz kindle
umbral zealot
#

I mean at one point, you gotta feed the family and pay for rent amirite?

quartz kindle
#

ye

#

hopefully by then some of my projects are gonna earn me something

umbral zealot
#

at one point I'll be looking for JS devs for a startup. I'll keep you in mind ๐Ÿ˜‰

quartz kindle
#

if only i stopped procrastinating

umbral zealot
#

I know you're on a competence level that's similar to my own, so, like, don't put yourself down man. Hell, discord.js-light is already a project that you've done, give yourself some more credit!

quartz kindle
#

i do

#

its just i suck at dealing with money

umbral zealot
#

So Say We Allโ„ข

quartz kindle
#

every time money is put on the equation i dont wanna do it anymore, too much pressure

umbral zealot
#

that's why I work for a consulting firm. I let my boss deal with budget and I just collect my paycheck after doing the work I love

quartz kindle
#

ye

#

i'd like getting paid for teaching js tbh

umbral zealot
#

Start a youtube channel! ๐Ÿ˜„

quartz kindle
#

idk if i have the energy to maintain it xd

umbral zealot
#

I did for a couple years, got my 1.6k subs still sitting there, not growing.

#

ยฏ_(ใƒ„)_/ยฏ

quartz kindle
#

nice

umbral zealot
#

I've made a solid $100 from youtube monetization. Once.

#

It was fun though

quartz kindle
#

dont you have to release new videos every week to get monetized?

umbral zealot
#

yeah, and I was doing that back when I was active. discord.js tutorials and such

near igloo
#

can someone pls explain what this is trying to say

vivid fulcrum
#

type mismatch

quartz kindle
#

show your code

snow urchin
near igloo
#

im using cpp _probabilityFunctions[choice - 1] (results, amount, limit); to call cpp probabilityProcessor _probabilityFunctions [1] = {strictProbability}; witch contains ```cpp
int strictProbability (int results, int amount, int limit) {

int s = 0;
for (int i = 0; i < amount; i++) {
    if (){
        /* code */
    }
    
}

}```(the function isnt done yet)

umbral zealot
near igloo
umbral zealot
#

you need to transpile it to your dist folder

vivid fulcrum
umbral zealot
#

oh wait no I'm wrong that is definitely in the dist folder, nevermind.

vivid fulcrum
#

that error is related to one of their deps

#

not their fault

#

oh wait

#

is that their own package

#

i am confusion

umbral zealot
#

What I'm confused about is why someone would try to import their index file

near igloo
#

its the line to call it that is having the mentioned issue

vivid fulcrum
#

you didn't read the link i sent you

near igloo
near igloo
#

fuck off konquerer

quartz kindle
snow urchin
#

mhmm

near igloo
#

ohhh i see @vivid fulcrum

#

sorry about that

#

im self taught in most of what little ik

vivid fulcrum
#

it's fineee

#

just don't look on archaic forum threads

#

ms docs contain a huge majority of useful information

near igloo
#

ohhhhh i figured out my issue

quartz kindle
near igloo
#

aaaaaaaaaaaaaaaaaaaaa its not working

snow urchin
#

thanks for the help, yet again ๐Ÿ˜„

near igloo
vivid fulcrum
#

wym

near igloo
vivid fulcrum
#

modern c++ allows unsized arrays as parameters, no?

earnest phoenix
#

code: ```JS

if(!result[0]) {
realCount = 0,
leaves = 0,
fakes = 0,
bonus = 0;

        let bonusFinal = bonus + count;
        
        options.database.query(`INSERT INTO invites (guild_id, user_id, realCount, leaves, fakes, bonus) VALUES ('${message.guild.id}', '${member.id}', '${realCount}', '${leaves}', '${fakes}', ${bonusFinal})`, function(err, result) {
            if(err) throw err;
            return message.channel.send(options.emojis.yes + " Successfully added **"+count+"** invites to **"+member.username+"**");

});```

I want 0 + count but my bot set 0count

near igloo
#

this seems hopeful?

earnest phoenix
#

how can i do please

vivid fulcrum
#

that code is sql injection heaven

earnest phoenix
#

yes

#

xd

vivid fulcrum
snow urchin
near igloo
earnest phoenix
#

lol

near igloo
#

mine is off of top.gg tho cuz im in limbo with my discord account

#

if discord wont let me appeal my old account i dont wanna be a "clone" of my own bot

#

ehhhh fuck you c++

#

ohh std::array

#

okay

fierce ether
#

(node:14008) Warning: Accessing non-existent property 'instance' of module exports inside circular dependency any idea?

quartz kindle
#

you have a circular dependency

fierce ether
#

this._beta = beta.instance

#

const beta = require('../../Managers/Beta')

quartz kindle
#

and Beta.js requires index.js?

#

or what

fierce ether
#

beta.js extends client

earnest phoenix
#

you proably messed up orders but idk

quartz kindle
#

you have a circular dependency

#

file1 requires file2 which requires file1

umbral zealot
#

Don't import your index from other files

fierce ether
#
var instance;

static get instance() {
  return instance
      }```
#

thats what im using inside beta.js

#

instance = this; //eslint-disable-line

quartz kindle
#

the problem is not the code

#

the problem is your requires

fierce ether
#
global.Promise = require('bluebird')
const config = require('../Structures/config');
const logger = require('../utilitys/logger')
const CommandCollection = require('../Collections/Commands');
const GuildCollection = require('../Collections/Guilds');
const ModuleCollection = require('../Collections/Modules')
const PermissionsManager = require('./PermissionsManager');
const Collection = require('../Structures/Base/Collection')
const EventManager = require('./EventManager');
const Loaders = require('../Loaders')
const util = require('util')
const { Client } = require('discord.js');```
quartz kindle
#

what file is this?

fierce ether
#

beta.js

quartz kindle
#

and the other file?

fierce ether
#
const logger = requireReload(require)('../../utilitys/logger');
const utils = requireReload(require)('../../utilitys');
const Resolver = requireReload(require)('../../utilitys/Resolver');
const FailureEmbed = requireReload(require)('../Base/FailureEmbed')
const config = require('../config')
const beta = require('../../Managers/Beta')```
#

Base.js

quartz kindle
#

what do the required files of beta.js require?

#

do any of them require base.js?

fierce ether
#

of base.js?

quartz kindle
#

does any other file require base.js?

#

the required files of beta.js

fierce ether
#

const PermissionsManager = require('./PermissionsManager');

#

that extends base

blissful owl
#

sa

#

botinfo

near igloo
#

@vivid fulcrum heres where ive gotten, you make sense out of it?

earnest phoenix
fierce ether
#

wait no it dosent

quartz kindle
#

and permissionsmanager requires base?

fierce ether
#

no it dosent acc

quartz kindle
#

something out there does

#

is base.js the main file?

fierce ether
#

no

quartz kindle
#

search for files that require base.js

fierce ether
#

so

#

whats best way bc some are gonna be../../ and some are gonna be ../

quartz kindle
#

use the search function

#

in vsc

fierce ether
quartz kindle
#

then the problem is not base

#

now search for beta

fierce ether
#

if i remove instance its fine

slender wagon
#

is there a way i could define an object ending before applying for example

get.object.house

do it something like this

let obj1 = .house
get.object + obj1

when i try something like this it returns [object object].house

zealous egret
#

Guys can you write most simply how to see how many servers my bot is in

slender wagon
#

oh oki

#

thanks!

fierce ether
zealous egret
#

I am new to the bot making community

distant mango
#

What language

zealous egret
#

python

quartz kindle
distant mango
zealous egret
#

and where i have to write that? into my bot code or?

slender wagon
distant mango
#

Have it displayed in a command?

zealous egret
severe patio
#

how would i add something like const item = ''; into an ejs file?

distant mango
#
@client.command()
async def guilds(ctx): # mmm spoonfeeding
    await ctx.send(len(client.guilds))```
#

With your level I doubt you're using cogs

zealous egret
#

where I have to type it?

near igloo
severe patio
#

how would i add something like const item = ''; into an ejs file?

distant mango
#

You didn't close some brackets there

zealous egret
quartz kindle
distant mango
#

also delete that, I can see your token

zealous egret
distant mango
#

You didn't close brackets in the previous command

#

That's why so much is blue

zealous egret
distant mango
zealous egret
#

Where I can t see it

distant mango
#

Now you just type .guilds

zealous egret
#

what command as .help or .givemeallyourinformations

distant mango
#

And if you used CTRL+C and CTRL+V right it should work

zealous egret
#

But I don t know command

distant mango
zealous egret
#

oh

distant mango
#

Yep

zealous egret
#

Thank you so much it worked

near igloo
zealous egret
severe patio
#

how would i add something like

const item = '';

into an ejs file?

supple brook
#

hi
i need cod protect role update with adminstretor

#

when someone give premission to role with adminstretor then the bot remove premission

lyric mountain
supple brook
#

my bot it music and games

#

but i need bot to my server

lyric mountain
#

then check role permissions when it gets updated, if it has admin just remove it

supple brook
#

Because my server was sabotaged more than once

lyric mountain
#

won't give you copy-ready code tho

#

define "sabotaged"

#

it'd only happen if:
A - someone in your staff is a traitor
B - your bot's token was leaked
C - some other bot's token was leaked

#

in all 3 cases, you shouldn't give admin perms to anyone anyway

supple brook
#

One of the token is stolen

lyric mountain
#

is it from your bot?

supple brook
#

his accpunt token

#

and he has role in server

lyric mountain
#

again, no admin perm = way less danger

supple brook
#

This is why I want a bot that prevents giving adminstrator

lyric mountain
#

just don't give admin perm to any role

#

without admin perm you cant give admin perm

#

unless you're the owner of the server

supple brook
#

yes iam ownership

lyric mountain
#

remove admin perm from all roles, easy

supple brook
near igloo
#

tim how would i do what im trying to do herecpp class Probability { public: void construct(int b, int a, int l) { int batches = b; int amount = a; int results[b][a]; int limit = limit; } }; like can i make the variables defined in the function appear outside of the function?
if you can make a constructor like js imma scream

lyric mountain
supple brook
#

but they downlod any think from Anonymous source

lyric mountain
#

I'll say once more:

  • Give admin perms to roles and face the risk of sabotage/invasion/nukes
    OR
  • Remove admin perms from all roles and stay safe
#

friendship apart, security is security

lyric mountain
opaque acorn
#

Does anyone know how I make my bot create channels with permissions?

sudden geyser
#

I haven't tried C++ in a very long time and only know the basics

near igloo
near igloo
#

Anyways Iโ€™m trying to get outside data into the constructor the way js uses โ€œnew object**(data)**โ€

near igloo
lyric mountain
near igloo
quartz kindle
#

you cannot define an array size from a variable

near igloo
#

Aaaaaaa

lyric mountain
#

but you can use a list

#

๐Ÿ˜‰

quartz kindle
#

you can use a vector

#

which is variable size

near igloo
#

Elaborate pls

lyric mountain
#

ah, yeah, vector

#

vector, list, collection, all refer to a resizable array

quartz kindle
#
vector<int> myvector;
myvector.push_back(5)
near igloo
quartz kindle
#

you're doing way better than i did when i first tried cpp

#

cpp classes are still weird af for me

#

im also a js guy

near igloo
midnight blaze
#

what about linking lists

#

is it easy now

quartz kindle
#

you can also allocate memory

lusty quest
#

i like rust a bit more than cpp, the memory management with it is way easyer

quartz kindle
#
int* mymemory = malloc(size)
*mymemory[1] = 23
// or something like that i dont remember
lusty quest
#

but other stuff with the language is a pain in the ass instead

midnight blaze
#

I still dont get why I should use pointers in cpp

lusty quest
#

there is a reason, but rn i only can remember 50% of the answer

#

right stacks and heaps

trail slate
#

hi guys

pure lion
#

do you need help?

lusty quest
#

ยฏ_(ใƒ„)_/ยฏ

pure lion
modest maple
#

My fucking god i hate cors

#

bane of my life

#

just with how dumb web browsers and JS clients handle them

pure lion
#

isnt there a header that like

#

stops it

vivid fulcrum
#

only useful if you own the server that you're requesting to

#

mojang's api doesn't have properly configured cors

#

so you can't make api requests through websites

#

๐Ÿง 

#

this has been an issue for 8 years btw and the devs just ignore it

#

probably because they don't know what they're doing

modest maple
#

you know i think my CDN isnt working

lyric mountain
#

tsc tsc

modest maple
#

saying that i dont think the reverse proxy is doing litterally anything

#

which i cant tell if it's CF or if its the server

lyric mountain
vernal moth
#

I tried to find the user with tag and then send a DM to it

the code is this

client.users.cache.find(u => u.tag === User + Tag).send(HelpEmbed)```
it gave me this error
```javascript
TypeError: Cannot read property 'send' of undefined```
modest maple
#

ah yes, CF was on the wrong SSL

vivid fulcrum
#

that comparison will never be true

#

also

lyric mountain
vivid fulcrum
#

optional chaining

#

saves lives

vernal moth
pure lion
lyric mountain
#

how would u.tag be equal to user + tag?

vivid fulcrum
#

man i really need to get a colored name so people stop ignoring me

lyric mountain
#

it's like saying banana + milk is equal to banana

vernal moth
#

because the u.tag is both the username and the tag.

#

User is username

#

and Tag is discrimination

#

so...i put it as that

pure lion
#

just compare the IDs

vernal moth
#

how?

#

oh wait

lyric mountain
#

nvm

#

but yeah, use id

vernal moth
#

lemme try

sudden geyser
modest maple
#

In JS

#

how can i

#

cut a string off at a certain length

vivid fulcrum
#

substring

vernal moth
#

wait sorry idk how to check ID instead of..name?

narrow eagle
#

hey, I'm working on sharding for my bot, and I'm having an issue with getting express to work for voting.
What's happening is whatever port I use it says it's already being used and stops everything from working.

I'm guessing it's something to do with using multiple processes, but don't know how to fix it. Could anyone explain the issue or at least point me in the right direction please?

modest maple
vernal moth
#
client.users.cache.find(u => u.id === ID).send(HelpEmbed)```
still says the same error ;-;
dense dune
narrow eagle
#
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', { token: token })

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
manager.spawn();

//set up vote listener
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express()
const webhook = new Topgg.Webhook(||secret password||)
const vote = require('./events/vote')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
    vote.execute(req.vote.user, client, req.vote.isWeekend)
    res.status(200) //respond to top.gg to close connnection and avoid looping
    res.end()
})

app.listen(5000)
#

I've got this. I'm pretty sure it's outside of the shards...

dense dune
#

And that file isn't index.js correct?

narrow eagle
#

no it's a different one

dense dune
#

Are you requiring that file from any other files?

narrow eagle
#

I get this error
Error: listen EADDRINUSE: address already in use :::5000

vivid fulcrum
#

you're creating one for every shard created

narrow eagle
#

no that file is the main file

vivid fulcrum
#

wait nvm

#

i'm blind

narrow eagle
#

it is lol

#

dw

dense dune
#

Are you requiring that file from any other files?

narrow eagle
#

no

#

oh wait I have an import I'm requiring from it.... that's probably it

#

okay removed the import and still nothing smh

dense dune
#

Make sure you're not importing that file from anywhere else. Also make sure you aren't opening it from another file or another process outside of node

narrow eagle
#

oof I missed one import.... got it, thanks for the help

dense dune
#

np

near igloo
#

10/10 mobile

earnest phoenix
quartz kindle
near igloo
near igloo
pale vessel
#

@restive furnace(obj)

umbral zealot
quartz kindle
#

i always end up writing my css from scratch no matter how many times i try to use those css frameworks

urban surge
#

hey

#

TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=

#

where can i find them

#

Twitter developer not available on the portal

blissful coral
#

@quartz kindle do you know if a <select name="roles" multiple> will return a array alwayts

#

and if empty do []

summer torrent
#

it is not like discord

#

you have to answer some questions to get access

blissful coral
#

so if none '' if single '<response>' and multiple []

#

Will just check if it is a array and if not make it one

quartz kindle
#

its only the first

#

even if multiple

pale vessel
#

The selected option

quartz kindle
#

the value property only returns the first selected option

#

it does not return multiple

#

to get all selected options you need to use other properties

umbral zealot
quartz kindle
#

but it says its for tailwind

#

which is a framework

#

no?

umbral zealot
#

nah it integrates with tailwind, but it's not using it by default

quartz kindle
#

hmm

umbral zealot
#

I think it could be interesting, I think basically this is components like... y'know, tabbed navs, alerts, accordions, we all do those things and they require some integration and code, and this is saying "yeah we provide that but not a default style"

manic elbow
#

hi, i need help to put an html in my bot's description. The issue is that I do not know how to do it since as I have config my page has separate files for the convenience of things and in the animations

fierce ether
#

commands: {} commands.push() would be valid correct?

fierce ether
#

what would be then?

waxen bough
#

push() is for arrays []

fierce ether
#

whats for objects?

waxen bough
#

commands[command.name] = command

#

oh you are getting name from command itself

craggy pine
manic elbow
manic elbow
craggy pine
#

idk honestly

lyric mountain
#

Iframes are just small browsers

manic elbow
#

okey, thx

earnest phoenix
#

i am trying to make an eval command but this doesn't work

#

it gives me an error of: missing key-word arguments

soft glade
#

Iโ€™m making an economy bot and itโ€™s going pretty well but thereโ€™s not much ways for you to earn money
Anyone got any ideas? Iโ€™m using discord.py btw
๏ฟผ

earnest phoenix
blissful coral
#

ctx.message.author will always be = to ctx.author

exotic lotus
#
Const xpCooldown = new Set();

client.on("message", msg => {
if(msg.content === "test"){
xpCooldown.add(msg.author.id)
setTimeout(() => {
xpCooldown.delete(msg.author.id)
}, 30000)
return message.channel.send(" worked")
}
})```
#

This isnt deleting author from cooldown after 30 secs

#

Help pls i have to fix this bug today

#

@ me thanks

ancient gulch
#

Okay so, i don't get any error with my code, but i want to optimize it, to be clear, i get 12 Modules for protection, each module get 4 settings

To do a setup command i need like 400 line

There is a exemple

if(module === 'ban') {

// #1
if(settings === 'changecount') {
}

// #2
if(settings === 'changestatus') 
}

// #3 
if(settings === 'changepunish'){
} 

// #4
if(settings === 'changebypass'){
} 

} 

So i need this for 12 module, how can i do all in one, each module get the same settings

lusty quest
#

look into switch cases, will make it a bit cleaner

ancient gulch
#

Yes i get it

#

But

lusty quest
#

or make it dynamic by using a map or something to have all your modules stored as key in it.

lament rock
#

or 1 liner statements

#

switch would take up more lines as it requires the break key word after every expression block

lusty quest
#

but its already way better than having a else if statement of doom

opal plank
#

not even an else

#

just if's

frank needle
#

im suck a idiot

#

i used to do else ifs like this

#
else
  if
blissful coral
#

About to learn python POGGERS

#

Wanna be able to do canvas better so

frank needle
#

do elif

#

dont be a idiot like me

blissful coral
#

?

#

I mean I know the fundamentals of coding lul

#

I already know JS and TS

lament rock
#

else's can't chain like
if
else if
else

can

blissful coral
#

Why would you do if else chains

#

lul

lament rock
#

better than switch statements

lusty quest
#

also py 3.10 gets switch cases

blissful coral
lament rock
#

switches take more lines which is gross

lusty quest
#

took only like 30 years

blissful coral
lament rock
#

shitposting in dev!!1!

#

mods!!

#

jk

blissful coral
#

I mean

#

its in starboard

#

lmao

#

that ss is directly from the starboard message

#

and it relates to the convo a bit

lament rock
#

I just don't like switch. Some prefer it which is fine. I just prefer one line if statements and chains

blissful coral
#

agreed

#

I barely use it so I can't really give a full preference from a performance aspect

#

but definitely in my opinion better than a if else

lusty quest
#

i like switch cases more, looks a bit cleaner than just writing your entire bot with a single if else statement

blissful coral
#

yea same

waxen bough
slender thistle
#

Why

restive furnace
#

that's better than if else if chain tho

#
  • FASTER
slender thistle
#

Is it really faster

waxen bough
#

stackoverflow people say difference is little to none

crimson vapor
#

realistically if/else statements are O(n) where as switch/case is O(1)

earnest phoenix
#

In the era of performance improvements and the advanced technology, these changes commit little to no performance at all

crimson vapor
#

if else chaining decreases readability as well

waxen bough
#
switch (true) {
  case //if
    break
  case //else if
    break

  default: //else
};

``` am i right
crimson vapor
#
switch (string) {
  case 'h':
  case 'help': {
    // code
    break
  }

  default: {
    // code
    break
  }
}``` iirc
waxen bough
earnest phoenix
crimson vapor
#

switch/case are supposed to be interpreted as maps

#

therefore O(1)

earnest phoenix
#

switch statements iterate through every case, they're not considered as maps

crimson vapor
#

3 responses claim c++ is O(1)

#

I can't find much about it for JS

earnest phoenix
#

The low amount of cases are indeed turned into jump tables for faster lookups, if there are many cases, this is ignored and it uses other algorithms to go through them

#

You can have a look at the internals of the V8 engine for JS

rugged lintel
#

how do i change my bot's name on top.gg

earnest phoenix
#

change it in discord

#

and refresh data

rugged lintel
#

i did, nothing changes

alpine hornet
#

Hey guys, I'm setting up a server info command, but when I do the command the message isn't sending. Along with that I'm getting no errors.

#

Please dm me, if you have a fix.

exotic lotus
#

new Discord.MessageEmbed()

#

@alpine hornet

alpine hornet
#

Is that replacing anything?

#

Sorry I'm new.

exotic lotus
#

Yes

#

Line 16

alpine hornet
#

Thanks man. <3

exotic lotus
#

const embed = new Discord.MessageEmbed()

#

And im guessing u have command handlers setup to work with array name

alpine hornet
#

Here, can you dm me?

green ferry
#

Hello

#

I was wondering if someone can help me with somehting

alpine hornet
#

What do you need help with?

#

@green ferry

green ferry
# alpine hornet What do you need help with?

So, I am almost done with my auto mod bot (can kick mute ban, ect..) and apparently I need my bot to be able to let the user know that if the BOT doesn't have the kick_member permissions enabled, it needs it to perform the command -kick @ memberhere

#

Like this something like "I need KICK_MEMBERS to use the kick command"

alpine hornet
#

Here, dm me.

green ferry
#

Okay

slender thistle
#

Why do you use DMs for such simple stuff

blissful coral
alpine hornet
marble juniper
#

for whatever reason

#

when I check the channel.nsfw property

#

it tells me its false

#

even though the command is executed in an nsfw channel

#

also that first part is just a typescript thing

#

so it doesn't cry around

#

when making the channel not nsfw it also still says false

#

not sure why

#

is it because the channel just isn't cached or something?

earnest phoenix
marble juniper
slender thistle
#

๐Ÿคท

marble juniper
#

wish I got a real answer instead of an emoji

#

lol

alpine hornet
#

Very true. You can also do it over a vc to help with the learning process.

marble juniper
#

fuck it then

#

lol

#

guess tim has to help me

slender thistle
#

Not everyone is comfortable with a vc and in case you happen to make a mistake, someone can correct you here

alpine hornet
#

True, next time that will happen.

#

No big deal. I only tried dms because I was learning as well.

slender thistle
#

I'm thinking of adding a helper method for my embeds ngl ๐Ÿค”

#
    @command(description="Test command lol.")
    async def test(self, ctx: CommandContext):
        kwargs = {
            "content"         : "Message.",
            "allowed_mentions": {"parse": []},
            "embeds"          : [
                {
                    "title"      : "Test",
                    "description": "Test haha",
                    "footer"     : {
                        "text": "My footer!"
                    }
                },
                {
                    "title"      : "My title.",
                    "description": "This is a description.",
                    "fields"     : [
                        {
                            "name"  : "Field name 1.",
                            "value" : "Field value 1.",
                            "inline": True
                        },
                        {
                            "name"  : "Field name 2.",
                            "value" : "Field value 2.",
                            "inline": True
                        }
                    ]
                }]
        }
        print(await ctx.send(**kwargs))

cuz this is ugly

earnest phoenix
#

In javascript, how to retrieve the invitation used when a member joins the server?

marble juniper
#
slender thistle
#

You can't directly do that via accessing some property

#

You have to fetch all server invites before and after member join, and then calculate which invite got an incremented use

restive furnace
rocky dagger
#

how can you define arguments with specific symbol in djs?

lusty quest
#

you mean reference emojis to letters?

green ferry
earnest phoenix
#
     console.log("The code is " +inv.code)
});```
#

^ this?

slender thistle
#

Do you know what fetchInvites returns

crimson vapor
earnest phoenix
#

I will Programm a generator where have code

slender thistle
#

So I'm wondering what I can do to have autocompletion and not have to do shit like

if title:
    d['title'] = title
if description:
    d['description'] = description

Any ideas?

marble juniper
crimson vapor
#

and thats it?

slender thistle
#

Not allowed + stupid

earnest phoenix
#

?

marble juniper
crimson vapor
#

strange

marble juniper
#

well all the other ones not in it are just disabled

#

there is also an option to cache channels

#

there are more options

#

but I just didn't enable the others

#

lol

crimson vapor
#

do you have any partials or anything?

marble juniper
#

idk

slender thistle
#

stop spamming

#

and like I said

#

it's stupid and not allowed by most services

#

So you can scrap the idea and do something more useful

earnest phoenix
#

@slender thistle you are stupid

restive furnace
marble juniper
#

but I do use discord.js-light

#

lol

restive furnace
#

djsl == discord.js-light

crimson vapor
#

strange, djs light shouldn't mess with the nsfw property, what happens when you change to regular client + default options?

marble juniper
#

well I don't wanna use the default options

#

because

#

I have a permissions check

#

and for that I need roles cached

#

lol

crimson vapor
#

with regular clent

lusty quest
#

is the channel also cached?

pale vessel
#

Why would you eval typescript

rocky dagger
#

how can you define arguments with specific symbol in djs? i tried this but it didnt work```js
const args = message.content.slice(prefix.length).trim().split(/|+/);

pale vessel
#

Why not use "|"

#

You don't need regex for that

rocky dagger
#

what?

earnest phoenix
rocky dagger
#

its suppoesd to spit the argument

#

so when i say hello, hi, hey | phone, pc, mouse then ``hello, hi, heyis an argument andphone, pc, mouse` is another

slender thistle
#

You could just do "|" instead of using a regex for that

rocky dagger
#

i dont understand. i am too dumb

marble juniper
#

@crimson vapor @lusty quest it seems like if the channel isn't cached it will let the nsfw property stay at false

#

lol

#

for uh

#

whatever reason

#

yes

#

defaults to false

#

guess I will just fetch the channel when checking if the channel is nsfw

slender thistle
#

imo it could be null as a default

marble juniper
#

I disabled the cacheChannels and cacheRoles option

#

I instead now use the fetch methods

#

incase the command has a check for something like permissions

#

or nsfw

#

works perfectly

#

if the roles are cached already it will just return the cache

#

so there wont be any response time issues

#

lol

#

for the nsfw check I just fetch the channel now from the guild

#

again returns the cached one if its already there

#

all works fine

#

thanks for help

#

although I did kinda figure it out myself

#

lol

earnest phoenix
#

Is it possible to enlist a bot on top.gg but not have it be availabe to the public?

#

In order to test stuff?

weary socket
#

Hi uhm I got a question

#

I want to sell premium for my Bot. I saw Dank Memer using Patreon. How do they check if they are the persons who have premium and so on?

#

And how do they see if they donโ€™t have it anymore automatically

lusty quest
marble juniper
#

yeah