#development

1 messages · Page 778 of 1

eternal adder
#

As I said, it could probably be simpler/easier?

modest maple
#

@regal saddle how are you getting client

regal saddle
#

what you mean?

modest maple
#

How are you defineing client

eternal adder
#

How are you getting your Client class?

modest maple
#

@eternal adder bUT iTs aN oBJeCt

regal saddle
#

im kinda confused sorry notlikenoot

eternal adder
#

ShUdDuP @modest maple

modest maple
#

@regal saddle how do you get client

#

E.g

#

Client = discord.client()

regal saddle
#

yeah

modest maple
#

Then you can't use commands

eternal adder
#

That's for the old async branch right?

modest maple
#

Ni

#

Ni

#

No

eternal adder
#

Ah

modest maple
#

Fucking autocorrect please

regal saddle
#

soo i need to use if message startswith?

modest maple
#

If your using discord.client() yup

regal saddle
#

ahh k thx boys.

#

or girls

eternal adder
#

I know commands is rewrite only..? I've only used client() in async I believe though?

modest maple
#

There a 4 ways in rewrite

#

Client
Autosharded client
Bot
Autoshardedbot

regal saddle
slender thistle
#

async version had commands extension but it was not documented

eternal adder
#

Oof

modest maple
#

Bot has the command extension and built in command handler

#

Client is more bare bones

eternal adder
#

Wait, if Lukas is using commands (permissions check) shouldn't they just use it to mark a command aswell? @modest maple

modest maple
#

I mean if they're using discord.client() they can't use it at all

#

Client doesnt have anything like that

#

Client literally just has the bare bones and the bare events

#

You have to handle everything yourself

regal saddle
#

oof

lean palm
#

hey bois so if i want to make a web frontend for my bot, should i put the server code with the bot code or keep em seperate?

regal saddle
#

thats hard

eternal adder
#

Well, they've got commands has_permissions() there, so I would've thought commands.command() would be fine? Either that or the permissions check doesn't work aha

modest maple
#

Keep seperate

#

If they're using client it will never work

#

Cuz you're trying to call a class and a decorator that doesn't exist

regal saddle
#

how should is use it then?

modest maple
#

If you're trying to use the extension commands you need the bot object

#

Not client

eternal adder
#

You may find it easier to swap to the commands extension? And yeah, get the bot object instead

regal saddle
#

Clientdiscord = discord.Client() would work?

modest maple
#

Otherwise it's either making a command handler or doing .startswith

#

And no not if you want to use the built in extensions

regal saddle
#

ok, the startswith and an permissions check?

#

like message.author.permissions_in(message.channel).kick_members:

regal saddle
regal saddle
#

im kinda new to python

#

i used js before

modest maple
#

If you're new to python I can't advise doing a discord bot till you know the basics well

regal saddle
#

i was kinda confused. thats why.

#

didnt knew that you ca use other Clients.

modest maple
#

What you're trying to use is the extension stuff

#

That's uses bot

#

Because it uses a command handler

#

What you are actually using is client

#

That is a very basic class that just gets you the discord stuff not any command handling or context manager stuff

regal saddle
#

ah okey, i undertand.

pallid aspen
#

@eternal adder I see, but i'm new in Discord API coding, but i just dont see how to make it easier, i really tought about an forEach with the member.user.id that checks if is in the file or not.

eternal adder
#

If you're unsure then my method would work, store them exactly how you already have? You don't want to loop over all members as that can become extremely slow, especially with larger guilds

earnest phoenix
#

I'm still stuck on the invites thing

#

have you actually done anything

#

I did try put in a code for it but it is not working

#

I got the bot online

#

I just need it to track invites just like invite manager

slender thistle
#

have you actually done anything
A question you ask DBL and don't get a proper response to

earnest phoenix
#

I will show you what I have done in a min

#

I'm not on my pc at the moment

#

But I only started all this yesterday

earnest phoenix
#

What I have so far

valid holly
#

very good

#

👍

sinful lotus
#

go check an idiots guide, and find tracking invites section there @earnest phoenix

earnest phoenix
#

Okay

regal saddle
#

it doesnt work 😦

slender thistle
#

What

#

Why are you declaring a function inside an if-statement

regal saddle
#

did i?

#

wait

#

i did.

earnest phoenix
#

lul

stable horizon
#

What the

earnest phoenix
#

hey how tp get a role by bot in server by eval command

manic terrace
#

i have this code in my bot, and it works fine, but my linter says "guild is defined but not used"

bot.on('guildCreate', guild => {
    console.log(`${bot.users.size} sailors have boarded the Golden Barge—now servicing   ${bot.guilds.size} spheres.`);
});

is there something i can do with guild to make my linter stfu? this is like a compulsive thing

slender thistle
#

Don't you think you should use guild.memberCount?

#

or am I missing something?

#

If you don't need guild, rename it to _

west raptor
#

_guild

slender thistle
#

Doesn't _ work easier?

west raptor
#

true

manic terrace
#

i am more interested in the total number of folks with access than the individual guild size; i am not monitoring the logs much

west raptor
#

@slender thistle does JavaScript play well with that tho

manic terrace
#

the linter does not play well with it

lilac wharf
#

first of all change ```js
${bot.users.size} to ${guild.users.size}

slender thistle
#

idk Python works fine with it

#

guiid.users doesn't exist, does it?

lilac wharf
#

I think it does.

manic terrace
#

it does

slender thistle
#

You mean guild.members?

lilac wharf
#

Yeah I think so.

west raptor
#

I thought it was guild.members yeah

manic terrace
#

the code works exactly as expected and intended

lilac wharf
#

I'm half asleep right now so I might not get the name right.

slender thistle
#

rtfd ftw

lilac wharf
#

Cecil you don't want to do bot.users.size because that will count every single user across every single guild the bot is in as well.

manic terrace
#

that's what i want

lilac wharf
#

You sure?

${bot.users.size} sailors have boarded the Golden Barge—now servicing ${bot.guilds.size} spheres.
instead of
guild_count_users sailors have boarded the Golden Barge—now servicing ${bot.guilds.size} spheres.

west raptor
#

@manic terrace you can tell eslint to shut the fuck up with either // eslint-disable-line or // eslint-disable-next-line

#

Iirc

#

Been a long time since I've used a linter in js

manic terrace
#

lol eslint gives me the option to turn guild into _guild and then tells me _guild isn't being used

west raptor
#

Is it eslint or vscode

#

Tell you that

manic terrace
#

eslint, and also // eslint-disable-next-line worked!

#

thanks y'all!

west raptor
#

lol I'm surprised

manic terrace
#

(also the reason i want to know the total users is because the whole reason i am learning how to make bots is to show up a competitor in my industry. so the total number of users and servers is turbo useful data)

west raptor
#

@earnest phoenix Guild#roles

#

Collection of Role

earnest phoenix
#

/eval client.guild.role (member) I like this

lilac wharf
#

@earnest phoenix that's easy...

in eval it should be like this:
message.guild.roles.forEach(role => message.channel.send(role.name + role.id));

#

that's just to print all the role names with the id's.

west raptor
#

could just map it

lilac wharf
#

true...

vital lark
#

also Client#users only caches online users iirc

west raptor
#

Mhm yeah

#

D.js sucks

manic terrace
#

lol

vital lark
#

I would recommend using Collection#reduce (I don't think discord.js has a reduce method)

earnest phoenix
#

SyntaxError: Unexpected token ')'

#

showing this error

vital lark
#

can you show the code?

#

I can't help you if you don't show the code

earnest phoenix
#

/eval message.guild.roles.forEach(role => message.channel.send(+));

vital lark
#

why + in the message content?

lilac wharf
#

^

west raptor
#

You aren't adding anything

earnest phoenix
#

@vital lark its a role

#

name

vital lark
#

+ is not a role name

#

role.name is the role name

lilac wharf
#
/eval message.guild.roles.forEach(role => message.channel.send(`${role.name} : ${role.id}`));
prime cliff
#

But that's now how it works...

lilac wharf
#

Try that

vital lark
#

seems like you're spoonfeeding at this point

earnest phoenix
#

i dont want id

#

i want role by my bot

lilac wharf
#

so just get rid of the section of it with role.id

earnest phoenix
#

/eval message.guild.roles.forEach(role => message.channel.send(${role.name} Admin));

#

like this

vital lark
#

yes

earnest phoenix
#

ohk thx

lilac wharf
#

that would just send a channel message with every role in the guild and admin for example:

test role 2 Admin```
earnest phoenix
#

yaa

#

i dont get the role

lilac wharf
earnest phoenix
#

(stated in the beginning of this conversation by April)

lilac wharf
#

True ^

restive furnace
#

<clientuser>#roles#filter probably will work

slender thistle
#

Does ClientUser#roles even exist

prime cliff
#

ClientUser is not a guild user though 🤔

vital lark
#

no

#

it doesn't

#

has to be a guild member

restive furnace
#

ClientUser#Me#User or smh to get guildmember object of it

fiery stream
manic terrace
#

cause it's diagonal

fiery stream
#

True

earnest phoenix
prime cliff
#

@earnest phoenix delete that you just leaked a password

earnest phoenix
#

Nope

#

Random gen pass

#

@prime cliff

prime cliff
#

hmm

earnest phoenix
#

The password regenerates every restart

prime cliff
#

Mkay

earnest phoenix
#

Can anyone help me for pass a checkbox data from ejs to js ?
I need a example

restive condor
quasi stirrup
#
{ Error: 401 Unauthorized
    at IncomingMessage.res.on (/rbd/pnpm-volume/53d7f4af-4cfe-4738-ba4f-43cd500e21bf/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:118:25)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
  raw: '{"error":"Unauthorized"}',
  body: { error: 'Unauthorized' },
  status: 401,
  headers: 
   { date: 'Wed, 29 Jan 2020 06:53:39 GMT',
     'content-type': 'application/json; charset=utf-8',
     'content-length': '24',
     connection: 'close',
     'set-cookie': 
      [ '__cfduid=d4d7067eec3c36664ee951243bd19ec841580280819; expires=Fri, 28-Feb-20 06:53:39 GMT; path=/; domain=.discordbots.org; HttpOnly; SameSite=Lax; Secure' ],
     'x-powered-by': 'Express',
     'access-control-allow-origin': '*',
     'access-control-allow-headers': 'Authorization',
     etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
     'cf-cache-status': 'DYNAMIC',
     'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
     'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
     'x-content-type-options': 'nosniff',
     server: 'cloudflare',
     'cf-ray': '55c94a503d3ef0dd-IAD' },
  ok: false,
  statusText: 'Unauthorized' }
#

Why this error? can anyone explain me please?

prime cliff
#

Unauthorized means your api token is not set or invalid

earnest phoenix
#

Cloudflare block

#

👀

#

@quasi stirrup you want to make a request on what website ??

prime cliff
#

He is trying to post server stats to dbl

earnest phoenix
#

Really weird why cloudflare respond to this i dont have this personaly

prime cliff
#

Unauthorized means your api token is not set or invalid

modest maple
quasi stirrup
#

@earnest phoenix i have fixed the issue, the token was invalid.

earnest phoenix
#

Hummm okay

modest maple
#

You got the big connection refused

earnest phoenix
#

How can I fix

lofty vine
#

😐

#

yep it states connection refused

#

make sure that you are actually connected

pallid aspen
#

Why do i get the following error: TypeError: Cannot read property 'members' of undefined

With this few lines of code:

const Discord = require('discord.js')
const client = new Discord.Client()
const list = client.guilds.get('GuildID'); 
list.members.forEach(member => console.log(member.user.username));
sinful lotus
#

your client is not yet ready

pallid aspen
#
client.on('ready', () => {
    console.log("Bot Started!");
    
});
#

I used this before the list.members part

sinful lotus
#

but your code there runs before that client.on ready those

#

also thats async

#

it wont block your code

#

so even you put that after client.on ready

#

nothing will change

#

put it inside client.on ready

green kestrel
#

where do you define your token?

pallid aspen
#

Fixed it thanks was indeed like Saya-nyan said! thanks!

#

I'm checking with 2 loops if the user is in a JSON file, and if not he loses his role, but it kind of works, can someone learn me the right way with my code:

#
            list.members.forEach(member => {

                var ii; 
                for(ii = 0; ii < importedJSON.list.length; ii++){

                    var DID = importedJSON.list[ii].Discord;
                    var Side = importedJSON.list[ii].Side;
                    if (DID !== member.user.id){
                        
                        //Watcher
                        member.removeRole('668050709375352843').catch()
                        console.log("Removed Watcher role from Discord ID: " + member.user.tag + "(" + member.user.id + ")");
                        //Player
                        member.removeRole('668050556404891668').catch()
                        console.log("Removed Player role from Discord ID: " + member.user.tag + "(" + member.user.id + ")");
                    
                    } else{

                        if (Side == 0) {
                            
                            if (message.guild.member(DID)) {
            
                            message.guild.members.get(DID).addRole('668050709375352843');
                            console.log("Added Player role to Discord ID: " + member.user.tag + "(" + member.user.id + ")");
                            
                            }
                        
                        } else{
                            
                            if (message.guild.member(DID)) {
                                
                                message.guild.members.get(DID).addRole('668050556404891668');
                                console.log("Added Player role to Discord ID: " + member.user.tag + "(" + member.user.id + ")");
                                
                            }
                            
                        }
                    
                    }

                }

            })```
late hill
#

what's the problem

pallid aspen
#

What I'm doing here is that i want to remove roles from a user if he isn't in the JSON file and if he is then i want to give him the role he has in the json file

#

I use 2 loops now for it, and it's terrible solution, cause it gives loads of errors.

#

For example:
(node:28352) LLgRi7cWeUUu5zpB7dekZFapB2XdRCvM4N: Possible EventEmitter memory leak detected. 11 guildMemberUpdate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

#

And:
(node:28352) UnhandledPromiseRejectionWarning: Error: Removing the role timed out. at /root/NERVE/Monitor/node_modules/discord.js/src/client/rest/RESTMethods.js:577:16 at Timeout._onTimeout (/root/NERVE/Monitor/node_modules/discord.js/src/client/Client.js:436:7) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7) (node:28352) 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(). (rejection id: 7)

valid holly
#

1st that’s the forEach

late hill
#

You're not adding any event listeners in that code

#

So that wouldn't be caused by this

pallid aspen
#

I am currently new in js so it's kinda tricky atm.

late hill
#

The bottom error is probably a timeout due to everything being overloaded as you added way too many listeners

#

You should solve the listeners issue first

valid holly
#

JSON contents are an Array of Member IDs right ?

late hill
#

Which doesn't originate from the code you posted

#

Somewhere in your code you're doing something along the lines of client.on("guildMemberUpdate" ...

pallid aspen
#

@valid holly Member Ids and the role they have

late hill
#

show us where you add the listener

valid holly
#

Instead of using forEach why don’t you throw everything inside a setInterval until condition is met

#

Array.prototype.length

late hill
#

If he doesn't fix the listener issue, nothing is going to work properly nyapeak

wanton shuttle
#

My command to create a new text channel is:
{"name":"new","permissions":"NONE","restriction":"0","actions":[{"channelName":"test","topic":"hi","position":"","storage":"0","varName":"","name":"Create Text Channel"}]}
Yet when it executes I get the error of:
Error with Event "Create Text Channel", Action #1: DiscordAPIError: Invalid Form Body type: Value "text" is not int. Where is the text that im meant to be putting an int in?

late hill
#

And what he's doing isn't time based at all so a setInterval makes no sense anyway

valid holly
#

What he’s doing is looping through the whole JSON at once

#

then adding role to the members at the same time

#

resulting in both err

#

Make it the function execute at an interval to escape the limit

#

I believe it was 5 req/s

pallid aspen
#

@late hill The whole code

late hill
#

..

pallid aspen
#

I'm testing it now with just typing a message untill it works

late hill
#

How about you don't run that code on every single message

pallid aspen
#

So after all of it i want to make a timeinterval of 10 mins

valid holly
#

10 mins would be too long

pallid aspen
#

Well it's only me typing a message, so didn't think it wouldn't matter

late hill
#

All channels your bot has read permissions in will currently fire that on every messages

pallid aspen
#

Yes but it's only me in that test server.

valid holly
#

Is your client in other servers ?

late hill
#

ok

pallid aspen
#

10 mins is to run that code everytime, to check.

valid holly
#

Make sure to remove the forEach

pallid aspen
#

But how do i get every member then?

valid holly
#

map the members then i++ after addRole

pallid aspen
#

Like every member needs to go through the check

valid holly
#

<guild>.members

late hill
#

you leaked your token

#

so you should reset that

pallid aspen
#

Done

valid holly
#

<guild>.members.map(x => x.id)

late hill
#

you may not have all members cached

#

which could also be an issue

#

you also messed up your logs

#

because you put added player role for both of them

pallid aspen
#

Yeah i did so i know what is added

late hill
#

Using an interval to prevent the ratelimits is alright but you rly shouldn't be waiting if you didn't do anything

pallid aspen
#

oh oops ><

#

Changed it again.

late hill
#

I don't know if discord.js will check if the member has the role and automatically prevent you from sending useless requests

#

In case it doesn't, you should prevent that

#

No need to add a role they already have

#

No need to remove a role they don't have

#

Also interested in what exactly the json looks like

#

if Side will always be a number you should be using ===

pallid aspen
#

Changed it to ===

late hill
#

You can also move the ii declaration into the for itself

#

You're only using it in the for

pallid aspen
#

How you mean?

late hill
#

for (let i = 0; i < someNumber; i++) {}

pallid aspen
#

Ah like that yeah got it.

#

But you say if it's always a number, does it mean this: DID !== member.user.id also needs to be !===

late hill
#

No

#

!== is === but inverted, != is == but inverted

pallid aspen
#

Ah okay good 🙂

#

But how can I run this code every 10 mins, instead of every message or memberupdate?

modest maple
#

Have a loop

pallid aspen
#

@late hill I added the checks if they have the role or not that it skips.

#

The first time the code runs everything is fine, but when it happends the second time, it goes wrong.

topaz fjord
#

show code

quartz kindle
#

member.roles.find(r => r.name !== "Watcher") this will match the first role in the role list regardless

#

because .find() tests one by one until it finds one that matches the condition, and your condition is not equal to, which means the first role it finds that is not "Watcher" will pass the condition, whatever that role may be

earnest phoenix
#

Stop with Node.JS/JS, it's very badd

quartz kindle
#

js is not bad lol

earnest phoenix
#

false

#

@quartz kindle JS is not made for the back

#

JavaScript is an interpreted language, so very slow

quartz kindle
#

originally no, but it was made possible, so why not use it? It is easy to use, which increases productivity and has a smaller learning curve

#

which is why so many companies are using it

#

because the cost of development is cheaper

#

which makes it not a bad language

#

its a good language for beginners and cheap/fast/easy development

earnest phoenix
#

Yes Node.JS is also very slow because it is coded in C ++ and python, in addition with its module layer

quartz kindle
#

its not even that slow, the engine has a lot of optimization. its performance is on average equal to python

earnest phoenix
#

I suggest you do a speed test between Java & JavaScript, you will see the big difference

quartz kindle
#

i suggest you stop talking nonsense lol

#

of course java is faster, its a compiled language

#

thats comparing apples to oranges

#

and is not the point here

earnest phoenix
#

Java is not a directly compiled language

modest maple
#

Not to mention your code is probably alot slower and is probably the reason for a difference in performance

quartz kindle
#

and javascript is not a directly interpreted language

earnest phoenix
#

Java is compiled in ByteCode which is itself read by the JVM

modest maple
#

The difference is fractional and they're more than quick enough to do pretty much anything

quartz kindle
#

javascript is compiled in the JIT

modest maple
#

9/10 it will be down to poor optimisation as to limits of an interpreted language

earnest phoenix
#

JavaScript does not get MDR compiled

quartz kindle
#

anyways, blatantly saying JS is bad is not accurate, specially when it does whats its supposed to do very well

earnest phoenix
#

JavaScript is "good" just for the client side

quartz kindle
#

is a volkswagen a bad car compared to a mercedes?

#

maybe slower, yes, but its cheaper, and a good for a lot of purposes

#

and cheaper to fix

earnest phoenix
#

volkswagen is not trying to be on the territory of Mercedes

quartz kindle
#

js is not trying to be java

prime cliff
quartz kindle
#

lmao

#

both are multipurpose languages, both can be used for many things lol. just chose whatever language you like more

#

java is not strictly for servers

earnest phoenix
#

Js = JavaScript, ** Java ** Script, they did this to advertise themselves when the real name is emascript, and if they now want to be a language for the back

quartz kindle
#

yes, and they did it 20 years ago

#

which yes, was stupid, but it has nothing to do with anything now

earnest phoenix
#

Without that JS would not be of this world anymore

quartz kindle
#

they dont want it do be a backend language, they want it to be a multipurpose language. why? because its cheaper and easier to use, so better productivity

earnest phoenix
#

cheaper ?

quartz kindle
#

they are different languages, you cant say one is better than the other, they both have pros and cons

pallid aspen
#

Tim what you suggest to do there, cause i'm clueless at the moment,

earnest phoenix
#

what annoys me even more is the guys who only make Discord bots, they think they are developers while they follow tutorials and don't know anything except that! They don't even know the language

pallid aspen
#

Cause you say find() will use the first role in the list, so it doesn't check the other one.

quartz kindle
#

thats an entire different issue, and i agree there

prime cliff
#

That's actually wrong Dartagnou only half of those do that while bigger bot developers have been using a language for over a year now like me

quartz kindle
#

but discord is for many people a first time experience, entry level programming

#

so its a good way to learn

#

so let them experiment

earnest phoenix
#

And reassure me, are you using object oriented programming?

quartz kindle
#

i am

earnest phoenix
#

phew!

#

do you have a github ?

prime cliff
#

I'm using C# so screw your java vs javascript Kappa

earnest phoenix
#

with a bot repo?

quartz kindle
#

C > all

#

my bots are not open source

earnest phoenix
quartz kindle
#

ok?

earnest phoenix
#

C isn't possible to view original code, @prime cliff c# we can find the original code or you've got the best encryptor/obfuscator

prime cliff
quartz kindle
#

you mean unpack the executable?

earnest phoenix
#

If you build a c# project

#

Yeah

#

Exactly

quartz kindle
#

just code your bot in asm

prime cliff
#

You can build it as an exe or a dll which supports linux too

earnest phoenix
#

Tim = Genius

#

Any program can be decompiled and unobfuscated

#

Tim > all

#

@earnest phoenix but the time depend of the level of security

#

Code your bot in binary ?

modest maple
#

He'll yeh

earnest phoenix
#

Lol

#

True @earnest phoenix

#

I have view a big obfuscator litteraly too long to unobfuscate...

quartz kindle
#

code your bot with brainfuck

earnest phoenix
#
0110010000100001000101000010001011111011111011111111111111110010110010011111100110111111001111100111100110001111111111001100110001111110011111110011100001110010001001100111000010001000100010001111001100011000010001111110011111111111111111111111110000011111111
``` this a code of my bot :kappa:
#

Imagine code 1 hello world in binary

#

Ho, shit !

#

Without any text to binary converger

#

Converter *

#

Hard

#

Ho i'ts simple

#

because :

#

Not for me :(

#

the text (encoded in ANSII) is encoded in exadecimal format

#

Yeah

#

and transformed from hexadecimal to binary is very simple

#

This is a good thing

modest maple
#

sits over here mostly using clojure and python

#

My internet is fucking dying

earnest phoenix
#

con.query(`SELECT * FROM prefix WHERE id = ('${message.guild.id}')`, (err, rows) => {
        if(err) throw err;
          var prefix = rows[0].prefix
    if (message.author.bot) return undefined;
    if (!message.content.startsWith(prefix)) return undefined;
});
    const args = message.content.split(' ');
    const searchString = args.slice(1).join(' ');
    const url = args[1] ? args[1].replace(/<(.+)>/g, '$1') : '';
    const serverQueue = queue.get(message.guild.id);

    let command = message.content.toLowerCase().split(' ')[0];
     command = command.slice(prefix.length)

    if (command === 'play') {```
#

Oof

#

?

#

error info (node:21439) UnhandledPromiseRejectionWarning: ReferenceError: prefix is not defined
at Client.bot.on (/home/dcbot/dev/index.js:128:26)

modest maple
#

Prefix is not defined

earnest phoenix
#
command = command.slice(prefix.length)```
#

@earnest phoenix var prefix = "."

#

Read the error please 😦

#

🤔

#

Or just

#

Oh common

#

Use an if

#

@earnest phoenix SQL Prefix

#

If your bot have

#

Yeah

#

not use var but let

#

Verify if the server have basic prefix or custom

#

In one var

#

And use this var

#

🤷‍♂️

late hill
#

yes

#

async

modest maple
#

Doesn't SQL give you a query as [(stuff, stuff)]

late hill
#

The code where you define the prefix

earnest phoenix
#

in fact a request for each message is not very good!

late hill
#

will most likely run after the rest of your code

modest maple
#

Not Much u can rlly do for checking a prefix

#

Unless you check the guild I'd and see if it matches the last one

royal bison
#

In fact a basic request like that every message doesn’t matter

modest maple
#

Which is rare

quartz kindle
late hill
#

that

pallid aspen
#

@quartz kindle So I changed it to: member.roles.has('0000')

late hill
#

also, the 1 request per message could easily be avoided

pallid aspen
#

But the problem still occurs

late hill
#

even if it doesn't matter

earnest phoenix
#

Daniell an SQL request is very slow!

late hill
#

you should still do it

#

cache the prefixes

#

so you only have to fetch them once

earnest phoenix
#

create an async thread for SQL request !

modest maple
#

That gets pretty fucking big when you start chacheing thousands of guild ids and their prefixes

royal bison
#

Or just cache everything when the bot starts

quartz kindle
#

no need for async threads in js, just use callbacks and/or promises, and cache your prefixes

late hill
#

big

modest maple
#

sits over here with my async SQL dB

late hill
#

with discord.js by default he's probably already caching many things per guild

#

the extra prefix won't even be noticable

#

it's 1 string

quartz kindle
#

anyway he's probably not understanding any of this

earnest phoenix
#

@quartz kindle not working

modest maple
#

Probably now confirmed

quartz kindle
#

i know its not working

#

what did you do?

#

use pastebin please

earnest phoenix
#

okey

#

1 secx

modest maple
#

All code in 8KB

#

Oof

pallid aspen
#


(node:30299) UnhandledPromiseRejectionWarning: Error: Adding the role timed out.
    at /root/NERVE/Monitor/node_modules/discord.js/src/client/rest/RESTMethods.js:551:16
    at Timeout._onTimeout (/root/NERVE/Monitor/node_modules/discord.js/src/client/Client.js:436:7)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)
(node:30299) 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(). (rejection id: 11)
#

How to solve this issues :/

modest maple
#

Catch the timeout error

pallid aspen
#

How @modest maple

modest maple
#

It tells u in le error

#

Love my GitHub app

#

Black + purple is taz_bongo_cat_love

earnest phoenix
quartz kindle
#

you didnt change anything

#

i already told you whats wrong

pallid aspen
#

(node:30399) LLgRi7cWeUUu5zpB7dekZFapB2XdRCvM4N: Possible EventEmitter memory leak detected. 11 guildMemberUpdate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

prime cliff
#

11 wew

modest maple
#

Fucking why

#

Why do you have a new event for every single thing

pallid aspen
earnest phoenix
#

@quartz kindle since sql i ask for await youtube stops if i end it if not then else else ???

pallid aspen
#

I try something new, cause new in js.

#

But how to make it work properly is a problem for me.

quartz kindle
#

@earnest phoenix you need to learn about async programming

#

@pallid aspen the problem is most likely not there, and you still didnt change the .find() functions anyway

pallid aspen
#

I did @quartz kindle i changed them to: member.roles.has('668050709375352843')

earnest phoenix
#

@quartz kindle please look at all the code I sent

quartz kindle
#

the pastebin doesnt show it

#

@earnest phoenix i did, and i already told you

earnest phoenix
#

oki

pallid aspen
quartz kindle
#

now, how many members are being changed there?

#

how many add/remove role operations are actually being sent to discord?

#

because this code is attempting to do EVERYTHING at once

#

meaning, sending to discord 100+ role operations in less than 1 second, if you have that many members passing the conditions

pallid aspen
#

We have 10 members in the guild, and 8 members in the JSON file

quartz kindle
#

im not sure what the current rate limit is, but its possible that its less than 8 per second

pallid aspen
#

And they need to match if they have the role or not that they give it if they are in the JSON file.

#

If they're not in the JSON file but they have the role then remove it.

#

That's the idea.

quartz kindle
#

how many times does your console log "added/removed role"

pallid aspen
#

Let me run the bot in the first round.

quartz kindle
#

but anyway if you want it to scale, you need to make some changes

pallid aspen
#
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Added Player role to Discord ID: Syntax#1337(204572389307187200)
Added Player role to Discord ID: Prizen#6384(276540506798948352)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
#

And that's the problem...

quartz kindle
#

yup

pallid aspen
#

Because i have 2 for loops atm

modest maple
#

API abuse

pallid aspen
#

I'm sorry ;-;

quartz kindle
#

so you need to carefully examine your logic, to avoid such situations

#

and if you want your code to scale, you will need to make some changes

#

you have to drop members.forEach in favor of a regular for loop, and make use of async/await

pallid aspen
#

But if i drop forEach, how do i get every member seperate through my loop of checking in JSON file.

quartz kindle
#

use a normal for loop

#

on all the member keys

pallid aspen
#

I don't understand, what you mean there, cause i already have a for loop.

quartz kindle
#

because you can do this

#
for(...) {
  await something();
}``` but doing this will not work ```js
a.forEach(async a => {
  await something();
})```
#

a for loop will not continue until it awaits the async function, but a forEach loop will not wait

#

because the forEach loop is actually firing functions

wicked lily
#

anyone know py?

#

not my cup o tea

quartz kindle
#

like this ```js
a.forEach(a => {
something
})

is the same as

for(...) {
function() {
something
}()
}```

#

not my cup of tea either

modest maple
#

Yes ik py

#

Py is taz_bongo_cat_love

valid holly
#

@pallid aspen still didn't figure it out ?

dapper patrol
#

.

pallid aspen
#

Sadly still trying, but doing my best

valid holly
#
// JSON
  {
  "memberID": "memberRoleID"
}
#

JSON looks abit like this ?

modest maple
#

That is a JSON format yesish

wicked lily
#

@modest maple can i dm u

#

?

modest maple
#

Sure or ask it here

pallid aspen
#
[
  {"Discord":"204572389307187200","Side":"1"},
  {"Discord":"276540506798948352","Side":"0"},
  {"Discord":"301673545639919616","Side":"0"},
  {"Discord":"330050847360811013","Side":"0"},
  {"Discord":"368361281587249153","Side":"0"},
  {"Discord":"262213629796024320","Side":"0"},
  {"Discord":"163663344429957120","Side":"1"},
  {"Discord":"594520993507311651","Side":"0"},
  {"Discord":"163663344429957120","Side":"1"}  
] 
#

@valid holly Mine atm.

modest maple
#

There are other Py Devs here aswell

#

As I gtg for an hour for sports

#

Cuz school is oof

wicked lily
#

well its gonna takr me a min to explain

#

and ok

valid holly
#

Why not get the member from id and check for role ?

modest maple
#

Send it here and @ me so I can find it when I come back

pallid aspen
#

Discord is the ID and Side is role 0 or 1

#

You mean to make it like this:

[
  {"204572389307187200":"1"},
  {"276540506798948352":"0"},
  {"301673545639919616":"0"}
] ```
#

Etc.

valid holly
#

If you have the member's ID, you can then check if they have a role

blissful scaffold
#

Don't do it like that

valid holly
#

It's better to do so you don't need to update the JSON with new values.

#

JSON isn't the best to write/rewrite data..

blissful scaffold
#

Don't use the values as a key

pallid aspen
#

'The JSON updates itself, from the website, because when people unlink from the webiste with their Discord, then they get out of the JSON list.

#

And then the role needs to be removed.

valid holly
#

I still don't get why you need the "Side" when you can use the API

pallid aspen
#

Side is 0 or 1 because they can select if they are a watcher or a player

#

in the website.

#

So if they have 0 they need the watcher role, do they have a 1 they are a player

valid holly
#

So it serves other purposes than checking if he has the role ?

pallid aspen
#

Side has the purpose to give them the right role

#

if member.id is in the JSON file then they need to give the right role (where i need the Side from)/

#

if the member.id isn't in the JSON file, then the role (watcher or player) needs to be removed from the member

earnest phoenix
#

but can't you do that in the code itself

valid holly
#

^

#

Just map and check, then add accordingly

pallid aspen
#

I already have a list.members.map(member => {

#

If that's what you mean?

valid holly
#

What was list ?

#

The JSON's ids ?

pallid aspen
#

No const list = client.guilds.get('');

valid holly
#

Yeah that's fine.

pallid aspen
#

list.members.map prints:

  '163663344429957120',
  '204572389307187200',
  '261125921958920204',
  '276540506798948352',
  '306797110643392512',
  '329359548152414231',
  '332155890532614144',
  '594520993507311651',
  '671335015468105740',
  '671353409693024286'
]
#

So I think i'm going in the good way here

valid holly
#

Keep only the ID's in the JSON, then check if the mapped member's id is in the JSON

#

if true add role else don't

pallid aspen
#

But how do i know what role they need?

#

if i drop the Side part from the JSON?

valid holly
#

Well you need to explain your situation a bit better.

#

Does your members choose wether or not to be a "Watcher" or "Player" in the website ?

pallid aspen
#

They NEED to choose to be an Watcher or Player on the website.

#

But if they decide to give up their Discord ID, they get a role on the Discord server.

valid holly
#

And what role is that ?

#

Watcher ?

pallid aspen
#

They need to choose on the registration form.

#

So in the database it says 0 = watcher, 1 = player

#

So if they choose watcher the value will be 0.

#

And then in the JSON will say: Side: 0

valid holly
#

Good, thanks for the explanation. 👏

#

Keep the Side then and please clarify the situation from the getgo next time.

pallid aspen
#

And the code where i am busy with needs to check if the players have the right role, and if they have a role but aren't in the JSON file their role will be removed.

#

I will sorry

valid holly
#

Get the member's ID from the JSON, check if the mapped member's ID is in the JSON, get the Side part, store it, compare if 1/0, if 1 get the "Player" role ID else "Watcher" role ID, store them in var, look for mapped member's roles and check if they have the role.

#

array.prototype.includes(member.id) // mapped member not the actual djs object

pallid aspen
#

Don't i have that already, Getting the member ID from JSON and check if mapped member id is in there?

#
            list.members.map(member  => {

                 
                for (let i = 0; i < importedJSON.list.length; i++){

                    var DID = importedJSON.list[i].Discord;
                    var Side = importedJSON.list[i].Side;
                    if (member.id !== DID){```
valid holly
#

👍

pallid aspen
#

            list.members.map(member  => {

                 
                for (let i = 0; i < importedJSON.list.length; i++){

                    var DID = importedJSON.list[i].Discord;
                    var Side = importedJSON.list[i].Side;
                    if (member.id !== DID){
                        
                        if(member.roles.has('668050709375352843')){
                            //Watcher
                            member.removeRole('668050709375352843').catch(err => console.log(err));
                            console.log("Removed Watcher role from Discord ID: " + member.user.tag + "(" + member.user.id + ")");
                        }
                        if(member.roles.has('668050556404891668')){
                            //Player
                            member.removeRole('668050556404891668').catch(err => console.log(err));
                            console.log("Removed Player role from Discord ID: " + member.user.tag + "(" + member.user.id + ")");
                        }
                    
                    }```
valid holly
#

var DID = importedJSON.list[i].Discord;

#

Isn't this going to check for the i value in the array ?

pallid aspen
#

It's the indicator of the for loop

valid holly
#

Sadly I don't think the JSON's content [i] match the map's [i]

#

It's better to use includes()

#

  if(importedJSON.Discord.includes(member.id) {

    // Role check thread here

}
pallid aspen
#

Still get:

Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: ThieMenPvPnOOb#8212(163663344429957120)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Removed Player role from Discord ID: Syntax#1337(204572389307187200)
Added Player role to Discord ID: Prizen#6384(276540506798948352)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
Removed Player role from Discord ID: EncryptedWeb#0123(594520993507311651)
#

I don't undertand why that's still happening.

green kestrel
#

yayy!! ive managed to remove the "see what guilds youre a member of" permission from the oauth2 login of my dashboard 😄

#

logging into the dashboard no longer looks so spooky

vital lark
#

@green kestrel nice

green kestrel
#

the only downside is its internally more spooky lol

#

as i have to store more data in mysql relating to the membership of a user on a guild and their permission bitmask, to replace that api call

#

but meh, its nothing the bot doesnt already know i guess

pallid aspen
#

Also if i use the code TypeError: Cannot read property 'includes' of undefined is what i get/

#

Okay @valid holly I kinda got it working but there is one problem ><

earnest phoenix
#

Hi !

#

I have a problem, i'm coding a filter image but i have a error because avatar image link of User return an error (HTTP 403)

#

have you tried accessing the url yourself

restive furnace
#

403 = forbidden, so your bot token is changed while running/you simply dont have access into it from your bot

earnest phoenix
#

i hope you're aware that's a cdn link, also wrong token is 401

#

what

#

pl:

#

👀

#

264445053596991498

#

19 character

#

what the maximum

modest maple
#

There isn't one

#

Snowflakes can in theory be any number / length altho discord ranges from like 16 - 20 ISH?

earnest phoenix
#

snowflakes don't have a specific length

#

you're misunderstanding how snowflake ids work

modest maple
#

^

earnest phoenix
#

max 64?

#

no

modest maple
#

No

earnest phoenix
#

they're 64bit numbers

#

if I give a value of 100 it will be good ??

modest maple
#

Why do you need to know the max length?

earnest phoenix
#

a snowflake that has a value 100 isn't a valid snowflake

#

refer to the image above

#

because sQL must enter the maximum number

modest maple
#

No you don't?

earnest phoenix
#

Hi guys I m back

modest maple
#

Ok

earnest phoenix
#

VARCHAR have to give

modest maple
#

What

#

The whole point of a dB is that you cans store data in it dynamically how pointless would it be if you had to limit the length of data you put in or the amount

earnest phoenix
#

for example, you cannot enter more than 10 characters in the password ...

modest maple
#

How are you using Ur db

earnest phoenix
#

Hi

modest maple
#

Because somthing seems massively wrong if your limited to X amount of characters per dB entry

earnest phoenix
#

id = GUARD ID

#

I think u all are studying something

#

id= guard id Varchart maximum 30 CHARACTER

modest maple
#

@earnest phoenix you got any idea what theyre on about

earnest phoenix
#

@modest maple if you don't know what I'm talking about in SQL then why are you trying to help

#

varchar requires a specific length

#

however

#

why are you doing that

#

storing them as a string

#

INT ??

#

int is 32bit

#

bigint is 64bit

#

then set up BIGINT and it will be fine

#

yes

#

however

#

mark it as unsigned

#

snowflakes are unsigned 64bit ints

#

since there's no point in going into negatives with ids

#

and how can I give it to him?

#

what

#

how to set it up?

#

or is it good now?

#

Can U all answer me

green kestrel
#

@earnest phoenix fun fact, from that image you posted above, i just worked out there will be wrap-around of discords timestamp in 2154.... best hope nobody is still using discord in 130 years 😄

earnest phoenix
#

way long before that

#

look up the 2038 problem

green kestrel
#

well we got 42 bits of time value, thats 2^42-1 max size which is 4,398,046,511,103... divide by 1000 because its milliseconds gives you 4,398,046,511 seconds, divide by 86400 (seconds in a day) gives you 50903 days, divide by 365 gives you approximately 139 years (didnt bother to account for leap years)... add 139 to 2015... and you get 2154

#

the 2038 problem stems from only having 32 bits in a time_t on 32 bit systems, discord added a fewwwww more bits to the timestamp

#

i really hope that discord arent using 32 bit machines and storing anything as time_t there. otherwise there are much bigger issues 😂

earnest phoenix
#

solved the problem I have Varchar a value of 500 that would be enough

green kestrel
#

enough for what Hedi

earnest phoenix
#

🤦

#

tfw you get told to use unsigned bigint and then you go ahead and use the most poorly performant solution instead

green kestrel
#

whats Hedi trying to do cry

earnest phoenix
#

only GUILD ID storage

#

store snowflakes in an sql* database

green kestrel
#

oh, guild id should be: bigint(20) unsigned not null

#

i can tell you that for sure because thats what im using in mysql/mariadb 😄

#

so listen to cry, he knows what hes talking about

earnest phoenix
#

XAMPP MYSQL

#

PHPMYADMIN user interface

green kestrel
#

dont use varchar, because it will be dog slow when you have to index a bunch of them... get to 1000 or so guilds and 200,000 users and you will notice the issues

#

dont use int, because it will chop off 32 bits of the value

fiery stream
#

Imagine

green kestrel
#

can you imagine an imaginary manager, managing an imaginary menagerie?

earnest phoenix
#

then what exactly should I set now?

green kestrel
#

one sec

earnest phoenix
#

oki

green kestrel
slender thistle
#

Isn't snowflakes' maximum length 21?

earnest phoenix
#

?

green kestrel
#

@slender thistle 21 digits?

slender thistle
#

Yeah

green kestrel
#

not sure, if youre right i'll have to add a digit to all of mine

#

havent noticed a problem though 😄

slender thistle
#

Yeah for now they're 18 digits long

green kestrel
#

18,446,744,073,709,551,615

#

thats the max size of a 64bit unsigned integer

#

its 20 chars long not including the commas

slender thistle
#

Huh

modest maple
#

Snowflakes can be big

green kestrel
#

thats as big as ones ever going to get in decimal

#
my id      = 189759562910400512    (len=18)
biggest id = 18446744073709551615  (len=20)
#

so 20 is fine

#

but you had me checking... glad i dont have to worry :D

slender thistle
#

Time to unsign bigint my VARCHAR 7974_rimuru_lewd_hearteyes

modest maple
#

Sometimes I'm greatful for orm dhut

#

Dhit

#

Shit

#

Ree

#

Somehow somthing broke even more

grizzled raven
#

when clicking a hyperlink for a message, does it always open in browser or is there a way to open in client

earnest phoenix
#

im assuming its possible to open in client

#

does it work in client when its not in a hyperlink?

proud pebble
#

I need help making a discord bot for my server I just got back into coding again im using c#

uncut edge
#

O Boi

proud pebble
#

so can someone help me plz

earnest phoenix
#

with what

uncut edge
#

No can do

earnest phoenix
#

making a bot is such a broad term to begin with

uncut edge
#

sorry broda

proud pebble
#

at least help me get started agian

#

again*

earnest phoenix
#

I don't know much about bot dev in c# but this seems somewhat reliable

proud pebble
#

thx

#

finally someone helps me fuck

tiny tinsel
#

@proud pebble I recommend Dsharpplus.

grizzled raven
#

sooooo

#

when clicking a hyperlink for a message, does it always open in browser or is there a way to open in client lol

earnest phoenix
#

what do you mean

#

on desktop no

#

imagine the security risks if the app allowed to do that

#

it is possible cause electron but security

#

on mobile opening links respects the user's settings

#

How to add Rich Presence in c# tool but without using token??

tiny tinsel
#

What?

earnest phoenix
#

Hummm

#

How can i add Rich Presence for my tool

#

In c#

#

Without using token

#

what

tiny tinsel
#

I doubt that is possible.

#

Rich presence requires a token/authorization.

earnest phoenix
#

This is possible

#

do you want rich presence on your bot or what

#

Lol no

#

@tiny tinsel it doesn't

#

Sublime text, vsc etc...

#

Can use rp without token

#

Or this is forbidden if he use token

tiny tinsel
#

Oh wait. I see

#

Rich presence on Discord what file you're editing?

earnest phoenix
#

Ty

tiny tinsel
#

Oh he wanna make his own.

#

😕

earnest phoenix
#

Yeah

#

I dont want any script prepared

grizzled raven
#

but like

#

ok so when i put an url in a title, it works normally (i think, i dont have a desktop but it doesnt open in a new tab), but when its an url from like RichEmbed.setUrl or something like that, it opens in a new tab

earnest phoenix
#

It's allowed to make a tool for manage the bot? Talk with him, manage sql, etc...

#

it entirely depends on your user settings

#

what @earnest phoenix

#

Bruh

earnest phoenix
#

I think he means links to messages

modest maple
#

Finally got the system automatically generating the help command and paginate when needed

#

altho needs alot of optimisation

restive condor
#

Wut @modest maple

#

How did you get the command headers to be white

vital lark
#

chilly fishu 8, that is beautiful

restive condor
modest maple
#

wew

#

@restive condor markdown

restive condor
#

Ohhh

#

yeah i could use that hehe

#

i thought your Field Name by default was styling them!

modest maple
#

i thought about doing each category in a new field but a hate the hard titles

#

altho that is a config setting on the handler

restive condor
#

Yeah

#

mine is currently a new field for each category

royal herald
#

How can I make a random photo with setimage?

#

with "var img ="

uneven wyvern
#

for(let i = 1; i < 20; i++)
{
  for(let j = 1; j < v; j++)
  {
    console.log(" ")
  }
  
  v = v-1
  
  for(let a = 1; a < i*2; a++)
  {
    console.log("*")
  }
}```

I made a Tree Generater Code but somehow it gives me this as output, can anyone help?
#

@royal herald Math.random

royal herald
#

i know

tiny tinsel
#

Would it be API abuse to change a message every 1 second? for 10 seconds?

royal herald
#

but i mean

#

randomly putting a photo link in "setimage"

#

so it will put one of the links selected from "var"

uneven wyvern
#

are you getting the pictures by links?

royal herald
#

yes

#

I want to randomly take a pokemon photo

#

How should I do?

modest maple
#

have a list of pokemon Urls

#

iirc there isnt rlly a rest api out there

royal herald
#

I couldn't find any Pokemon api anywhere

modest maple
#

thats cuz i dont think theyre allowed

#

or no one has bother todo so

royal herald
#

I made it from my own list

#

Can I discard it if it doesn't appear as an "ads" @modest maple

uneven wyvern
#

Can anyone help me

modest maple
#

whats up

modest maple
#

@royal herald you cant actually access that image btw / i cant

#

but yh having it in an array would work

royal herald
#

how can i do with "setimage"

modest maple
#

like a random image from that?

royal herald
#

can i do math random

#

"var poke"

modest maple
#

pretty sure

#

i dont do js

#

but dont see an issue with the logic

royal herald
#

does anyone know js

topaz fjord
#

What's the issue

royal herald
#

@topaz fjord randomly putting a photo link in "setimage"
so it will put one of the links selected from "var"

topaz fjord
#

that doesn't tell me the issue

#

That tells me what you want to do

royal herald
#

yes I mean it, can I do it like that

topaz fjord
#

yes

royal herald
#

@topaz fjord why this is not worked?

earnest phoenix
#

yikes

modest maple
#

indeed

sage bobcat
#

One message removed from a suspended account.

modest maple
earnest phoenix
#

@modest maple This is a port scanner ?

modest maple
#

yh

#

gonna be built for a kwarg

topaz fjord
#

kwarg?

#

Also what does yh mean

modest maple
#

if you dont specify a port for a websocket to run on it will find a open port

#

and it means like optional arguments

#

that you can pre set if nothing is given

earnest phoenix
#

I think port scanner isn't really allowed by discord...

topaz fjord
#

I don't think that's for discord

earnest phoenix
#

Yeah possible

modest maple
#

its not

quartz kindle
#

yh probably means yeah

earnest phoenix
#

But this isn't really legaly😂

modest maple
#

its for a websocket server

#

that you run

#

not for discord

#

xD

earnest phoenix
#

Use for éducation onlyweirdsip

modest maple
#

for perfectly normal reasons skyShrug

earnest phoenix
#

Yeah yeah

modest maple
#

there is nothing wrong with using a port scanner on a program that is literally for the server sided system to run a web socket

topaz fjord
#

If you're running on your own vps there's no harm being done

manic terrace
#

anyone have a link or tutorial doc to how i can turn a user input into a channelID? i am trying to set this bot up so admins can change the welcome channel with a command

topaz fjord
#

Your lib should have a method to get a channel by name/if

#

*id

#

What lib are u using

#

@manic terrace

manic terrace
#

discord js

#

i guess i can use collection for that, but i've never used collection so it's new territory

grizzled raven
#

@earnest phoenix thats not it

earnest phoenix
#

what

#

oh

#

what do you mean

grizzled raven
#

can i get my bot to dm you embeds so you would know what i mean?

#

or nvm i could just take screenshots

topaz fjord
#

.channels returns a collection and you can use .filter to find the channel by a specific parameter

noble swift
#

how i can view my client id

#

???

amber fractal
#

Developer mode or the developer portal

grizzled raven
#

this is a message link in a title, set by using RichEmbed.setURL() or changing the url property in an embed object. this link opens in a new tab and i assume it opens in browser from client too

earnest phoenix
#

it always opens in browser on desktop

grizzled raven
earnest phoenix
#

you can't really do anything about it

#

it's how the client works

#

and mobile devs are retarded

grizzled raven
#

huh

#

ok thanks

fiery stream
#

Yoooooooiooooo

#

How does discord work

mossy vine
#

it doesnt

earnest phoenix
#

!help

#

?help

modest maple
topaz fjord
#

what os this

#

is

modest maple
#

windows

quartz kindle
#

wewdos

modest maple
#

wheres wewdo

quartz kindle
#

Hiding behind those wews

earnest phoenix
#

wew

snow urchin
#

I may be stupid but why is this not working?

 let userid = client.guilds.get("551070196958363648").members.find(user => user.username === query.id.split("////")[0]).id;
#

query.id.split("////")[0] is just Callum

quartz kindle
#

Members dont have usernames

#

user.user.username === ...

earnest phoenix
#

@snow urchin just use

#

let mid = message.mentions.members.first() || message.author
let userid == client.users.get(mid.id)

blissful scaffold
#

can you do x || y and get something else than true or false back?

earnest phoenix
#

Yeah

#

uh no

#

that's a logical operator

quartz kindle
#

The value of y will be returned if x is falsey

earnest phoenix
#

Yeah

#

js right

#

Js is good for all begginers

#

I think this is bad to start with any langage need to be compiled

#

(Packed🤷‍♂️)

quartz kindle
#

Depends

#

If you start with js, then go to a C lang, it will be hell

earnest phoenix
#

I have start with c# and some people said me this is bad for start

#

Oh

quartz kindle
#

If you start with a C lang then go to js, you will be surprised by how easy it is

earnest phoenix
#

Hmmm

#

Okay okay

quartz kindle
#

There are so many things that js does for you automatically lul

earnest phoenix
#

And

#

You have already test c#?

quartz kindle
#

Nope, i cant C lang :D

earnest phoenix
#

Why ?

quartz kindle
#

Too annoying to learn at this point

earnest phoenix
#

You dont like this 😂

#

Oof

#

No

#

This is funny

quartz kindle
#

Lul

#

I mean, C# is ptobably way easier that C and C++ right?

earnest phoenix
#

yes

#

Yeah

quartz kindle
#

I have 0 experience with C# but i have some experience with C and C++

blissful scaffold
#

I had to work with C/C++ during my study for a few semesters, but it was hell

earnest phoenix
#

C# is the easier in the c family

quartz kindle
#

Lul

earnest phoenix
#

But this is the best for me :)
(And c for linux)

quartz kindle
#

I like js :D

blissful scaffold
#

I will stay with Java for my bots ^^

earnest phoenix
#

Java i dont like this

#

Who have practice c# here?

prime cliff
#

I have a bit of experience with C#

#

I've been doing Discord bots, windows apps and websites all in c# for 3 years now

earnest phoenix
#

Website in c#

#

This isn't really possible 🤨

prime cliff
earnest phoenix
#

You joking

#

Oh okay

#

I know this

prime cliff
quartz kindle
#

I cant help but think ewww whenever i see a url ending in .aspx

#

Lmao

earnest phoenix
#

You know how i can start a js script with 1 Burton When the script is in the ressources ?

#

1 button*

quartz kindle
#

Wut

earnest phoenix
#

At the start

#

We can use a picture in the ressource for example

#

But i cant start a script example for open a cmd and ask for name(use in the tool for the session

#

blazor is

#

eh

#

server side is still a fun idea

#

not performant

#

but client side blazor is a disaster

quartz kindle
#

I dont get what youre trying Dany

earnest phoenix
#

Making a tool🤨

#

I want to make a more easier tool for making bot and free not like "discord bot maker" on steam

#

But at the start the name ask is for the bot

quartz kindle
#

And youre using js? Or what are you building it with?

earnest phoenix
#

The js is for have the variable in the js script i think this is best way lol

#

And with the c# i take this name and placed it in botname var

#

And he can be view in a not éditable textbox

quartz kindle
#

That makes no sense

#

Why are you mixing js with c#

#

js cant run without a js engine

earnest phoenix
#

i do it too

#

electron app with a .net core back component

#

Hmmm

#

This isn't a bad idea but not

#

This is for a future open-source project

quartz kindle
#

Yeah, you can call native code from a js app, but calling js code from a C app needs a js engine

earnest phoenix
#

errr

#

no

#

you can cheat your way with IPC

quartz kindle
#

Well then yoi have two processes running