#development

1 messages · Page 1330 of 1

fluid basin
#
const done = (output) => {
  // do something with output
}
some_connection.query("some_query", (err, results) => {
  // some processing maybe
  // we're done, callback time
  done(output)
}
#

though for your situation, its recommended to use promises instead

#

@blissful coral

blissful coral
#

I know but like I am having brain farts on how to do them

fluid basin
#

ah ok

earnest phoenix
#

How do u mention the person who triggers the command?

#

javascript

blissful coral
#

message.author

earnest phoenix
#

Litterly the message author

blissful coral
#

lmao

digital ibex
#

does anyone know the endpoint to get a guild role?

blissful coral
#

<message>.guild.roles.cache.get()

earnest phoenix
#

spoonfeed

#

holy moly

blissful coral
#

Eh

digital ibex
#

im not using a library

blissful coral
#

Oh

#

LOL

#

Nvm then idk sorry

digital ibex
#

i cant find it in the docs so i just assumed i'd have to do it myself but im just here to make sure

blissful coral
#

endpoint for a guild role

#

hmmm

#

let me see

sonic lodge
blissful coral
#

shit hes faster

#

LMAO

sonic lodge
#

😎

blissful coral
digital ibex
#

im not looking for the roles

#

im looking for a role

blissful coral
#

does anyone know the endpoint to get a guild role?

#

oh

sonic lodge
#

idk if you can even get just one role

earnest phoenix
#

Hey! I am trying to make dashboard, they have to login trought their discord account.

Now I want to make, that it joins the support server! How?
@earnest phoenix ?

#

I cant find docs

blissful coral
#

Wdym make

#

Like they click a button

digital ibex
#

when they authorise themselves u want them to join ur server?

blissful coral
#

Or auto

earnest phoenix
#

button

fluid basin
#
const promises = [];
for (let i=0; i < some_value; i++) {
  promises.push(new Promise((resolve, reject) => {
    // do something with stuffs with callback
    conn.query("some_query", (err, result) => {
      // do stuff with result
      if (some_condition) {
        // found!
        resolve(true);
      }
      else resolve(false);
    });
  }));
}
Promise.all(promises).then(values => {
  if (values.some(found => found)) {
    // actually found!!
  }
  else {
    // ohnoes, not found!
  }
});
#

@blissful coral

#

phew

#

typing this out

blissful coral
#

holy shit

#

the spoon

#

I love it

#

lmao

fluid basin
#

well

earnest phoenix
fluid basin
#

can't really solve this any other way

blissful coral
#

So looking at this

#

The for loop is to reiterate mine correct

digital ibex
#

when they authorise themselves u want them to join ur server?
nutella?

fluid basin
#

basically you wrap the callbacks in promises

#

actually you can do this without promises as well

#

just have an array

#

and push the response

#

but still you need to wait

#

so uh

blissful coral
#

yeah...

#

lol

digital ibex
#

using the promise.all is probably a better option though

#

i'd do it similar to that anyways lul

vagrant prawn
#

is it good to host on heroku?

digital ibex
#

depends

vagrant prawn
#

after 550 hours, what does happen

digital ibex
#

idk

fluid basin
#

@blissful coral actually, looking at your problem again

#

theres an easier solution

digital ibex
#

idk how heroku works but u shouldnt be working on a project for 550+ hours

fluid basin
#

what sql library you using @blissful coral

digital ibex
#

(assuming u get 550 hours per project)

fluid basin
#

its actually rather simple tbh

#

get all results

#

then run a .some

earnest phoenix
#

is it good to host on heroku?
@vagrant prawn If you want a bot, no
If you want something like an API or DBL webhook listener, yes

blissful coral
#

@fluid basin mysql

fluid basin
#
conn.query("all_channel_in_guild", (err, results) => {
  if (results.some(r => r.id === channel_id) {
    // already exists
  }
  else {
    // doesn't exist
  }
});
blissful coral
#

Would that run before the rest is executed though

fluid basin
#

uh

#

you fetch all the result

#

then check within the results

blissful coral
fluid basin
#

so yeah

vagrant prawn
#

what can i use as database for heroku

fluid basin
#

no

#

they offer postgres I think

#

but it takes hours as well

#

but short answer: nothing

vagrant prawn
#

why no

fluid basin
#

I mean yes

#

mongodb

#

almost forgot that

vagrant prawn
#

is it free

#

for 24 7

fluid basin
#

yes

vagrant prawn
#

ok, thanks

fluid basin
earnest phoenix
#

@blissful coral i just do this for my callback stuff:

function someFunctionThatTakesACallback(callback) {
// do smth
// once it's finished run the callback
// with necessary parms
callback(1, 2, 3);
}
let lol = someFunctionThatTakesACallback(function() {arguments.map()});
#

(the arguments.map(); thing is an example)

fluid basin
#

yeah but the thing is extreme wants everything to callback

#

so yuh

pale vessel
#

wtf is that a void callback

blissful coral
#

@fluid basin well

#

It isn't running before?

#
    const promises = [];
        for (let i=0; i < channels.size; i++) {
            promises.push(new Promise((resolve, reject) => {
                // do something with stuffs with callback
            connection.query(`SELECT * FROM config WHERE guildid = '${message.guild.id}' AND id = '${channelarray[i].id}'`, (err, result) => {
            if (result[0] !== undefined) {
                console.log(`Gotcha Bitch`)
            resolve(true);
            }
            else resolve(false);
            });
        }));
        }
        Promise.all(promises).then(values => {
        if (values.some(found => found)) {
            console.log(`Actually found bitch`)
        }
        else {
            console.log(`Not actually found`)
        }
        });
fluid basin
#

I would recommend getting all results, then doing a .some on it

#

but this is messy

blissful coral
fluid basin
#

its working

#

but messy

blissful coral
#

ok

fluid basin
#

don't need for loop too

blissful coral
#

Okay

earnest phoenix
#

I love that console

blissful coral
#

kek

fluid basin
#

vsc

blissful coral
#

wait why not using a loop?

#

It has to check for each one

#

because I am inputting 3 IDs at a time

#

So it needs to check all 3 and if one exists return

fluid basin
#

ah

strong tundra
#

how do i shard across multiple hosts?

fluid basin
#

then you just need to filter later

blissful coral
#

Multiple hosts?

strong tundra
#

yes

blissful coral
#
if (results.some(r => r.id === channelarray[i].id)) {
#

I mean

#

I can't do this here then

#

Because I don't have i

strong tundra
#

i doubt my bot will get big but i may as well try for fun

blissful coral
#

eh

#

recommended for 1.5k guilds

#

not worth

fluid basin
#

uh

#
const found = results.some(r => channels.includes(r));```
#

there ya go

#

.some will go through every item in results

#

and check if channels has (includes) the item

#

and stop when there is a first "true"

#

damn its just my bad obsession with 1-liners

#

so if (results.some(r => channels.includes(r)))

#

@blissful coral

pale vessel
#

thanks for the sauce

#

i really needed it

blissful coral
#

okay

fluid basin
#

actually collection has a .has method

#

so you can just .has(r.id)

#

gosh

#

why me spooning so much rn

#

LOL

earnest phoenix
#

lmfak

fluid basin
#

prolly me

#

actually its more efficient

#

rather than query the db for the amount of entries you have

pale vessel
#

wait same thing nm

torpid juniper
#

yeah i don't think serenity will do that at all

carmine summit
#

How do I simulate [0] in an object?

pale vessel
#

get the keys/values?

carmine summit
#

no

#

keys/values is random

strong tundra
#

hmm

gritty bolt
#

I have this code js db.once('open', function() { console.log(messageLink); const messageReminderConst = new messageReminderModel({user: user, messageLink: messageLink, time: global.time}); messageReminderConst.save(function(err) { if(err !== null) console.log(err); const data = schedule.scheduleJob(data.time, remindUser(data, bot)); console.log("Successfully saved reminder." + messageReminderConst); const successEmbed = new discord.MessageEmbed() .setTitle("Reminder saved sucessfully.") .setColor("#00FF00"); userObject.send(successEmbed) }); }); }); } });
I'm not sure how to define data, I want to make it the object that I just saved into the db

#

can anyone help?

strong tundra
#

i don't see why it wouldn't

torpid juniper
#

serenity is an oddball of a library

#

instead of exposing all of the shard stuff like most libraries do (like a shard id offset), it does all of that for you

#

which isn't what you want

#

i don't see anything in the docs for a shard offset

#

let me check the shard manager

#

are you using Client @strong tundra

strong tundra
#

yeah i am

torpid juniper
#

is there any way you can pass a ShardManager instance to it

#

(i haven't used serenity before so)

strong tundra
#

i'm not sure

torpid juniper
#

if you can, you can do it

tight plinth
#

so, i dont know what i did, but it looks like that the collector.on("collect") event never triggers, no matter what, it seems that the regular message event is triggered instead. Anyone knows why?

torpid juniper
#

because ShardManager has an offset

strong tundra
#

hmm

#

i only see an index, initial value, and total value

#

unless i'm misunderstanding?

torpid juniper
#
ShardManager::new(ShardManagerOptions {
    // ...
    // the shard index to start initiating from
    shard_index: 0,
    // the number of shards to initiate (this initiates 0, 1, and 2)
    shard_init: 3,
    // the total number of shards in use
    shard_total: 5,
    // ...
});
#

these are the three you need

strong tundra
#

yeah

#

from what i understand, start_shard_range should have all that

torpid juniper
#

it doesn't seem to

strong tundra
#

just from the docs tho

gritty bolt
torpid juniper
#

because serenity automatically manages the shard index

#

you can't set it

#

which is required for clustering

#

my quick skim of start_shard_range is just starting a set of shards that the manager already has

#

but since serenity manages that for you, it's useless for this

#

it's preferable to have a separate shard manager that you can control

strong tundra
#

hmm

stone thunder
#

hi do you know how to make a command to see a member's pings and a serverinfo command

torpid juniper
#

The Shard is transparently handled by the library, removing unnecessary complexity. Sharded connections are automatically handled for you.

#

this is the killing blow in the documentation

tight plinth
#

@stone thunder member ping dont exist

torpid juniper
#

so you have to do some weird and wacky shit

tight plinth
#

serverinfo command learn your programmation language

strong tundra
#

hmm

torpid juniper
#

the alternative that you do is that you let serenity manage all of your shards on each container

#

but then only start the ones that the container should be doing

#

so

clever vector
#

Hey guys how to lock the nsfw cmd in nsfw channel

torpid juniper
#

client.start_shard_range([ 10, 19 ], 999);

#

i'm not sure if you can get the shards that serenity thinks it needs for this

tight plinth
#

@clever vector check if the channel is nsfw (msg.channel.nsfw is true or not)

torpid juniper
#

no you cannot

#

but yeah

#

it seems this is what serenity recommends for clustering

#

since the comment next to that method is This should be used when you, for example, want to split 10 shards across 3 instances.

clever vector
#

No I mean I want to put like the nsfw have something the channel perm on the start

torpid juniper
#

so you get the shard count that you need, then do an example of what i did

digital ibex
#

im trying to get a guild role and i cant seem to figure out how to get a guild role, any ideas?

#

im using v8

strong tundra
#

yea

fluid basin
#

v8? v8 of what?

solemn latch
#

py i would guess

fluid basin
#

oh

strong tundra
#

so if i were to split my bot among three instances, i could have a central thing that gives bots total amount and range and have serenity just take those values and start the cluster?

solemn latch
#

oh wait py is on 1.5

digital ibex
#

v8 dapi rest version

torpid juniper
#

yeah

solemn latch
#

oh your getting it from the api itself?

strong tundra
#

ah that isn't too too bad then

torpid juniper
#

if you get the shard count that discord recommends from the gateway

digital ibex
#

yeah

torpid juniper
#

you can write a tool that autostarts the instances for you

#

take a couple of arguments as params

#

and you're done

strong tundra
#

ah cool thanks a lot

torpid juniper
#

updating your bot is going to be fun though :p

solemn latch
torpid juniper
#

you update your central executable, kill all your instances and reboot them

solemn latch
#

the roles field

torpid juniper
#

or do a rolling update

#

one shard at a time

strong tundra
#

ah true

digital ibex
#

thats all the roles

torpid juniper
#

however that would take ages on a massively clustered bot

digital ibex
#

not a role

#

which im trying to do

solemn latch
#

is that a problem?

torpid juniper
#

ayana is a good example of a massive bot

#

383 shards

#

i think

digital ibex
#

wdym?

vale garden
#

hi

solemn latch
#

getting all the roles

#

🤔

vale garden
#

does anyone think

#

theres

#

ok why tf did the

solemn latch
#

i dont think

strong tundra
#

i'll look at it

digital ibex
#

im not trying to get all the roles

vale garden
#

bruh the colors arent appearing

#

lol

digital ibex
#

im just trying to get one

vale garden
#
let pkmns = [["Weedle", "https://bit.ly/3nX5gVk"], ["Kakuna", "https://bit.ly/2T0vzf9"], ["Beedrill", "https://bit.ly/3dAhUoi"], ["Pidgey", "https://bit.ly/3lXgbN2"], ["Pidegotto", "https://bit.ly/2H7689i"], ["Pidgeot", "https://bit.ly/2HbfgK7"], ["Scyther", "https://bit.ly/3k6lxFe"], ["Rhyhorn", "https://bit.ly/31xNG0L"], ["Rhydon", "https://bit.ly/3o3hvQ7"], ["Rhyperior", "https://bit.ly/3nZISum"],  ["Horsea", "https://bit.ly/3nZITyq"], ["Seadra", "https://bit.ly/346t3dy"], ["Kingdra", "https://bit.ly/2HhEAxS"]]

      let pkmnsImg = pkmns.map(item => item[1])
      let pkmnsList = pkmns.map(item => item[0])

    let pkmn = Math.floor(Math.random() * pkmns.length)

    const embed = new Discord.MessageEmbed()
    .setTitle("A wild pokémon has appeared!")
    .setDescription("Guess the pokémon and type \`!catch <pokémon>\` to catch it!")
    .setColor("YELLOW")
    .setImage(pkmnsImg[pkmn])

      bot.channels.cache.get(channel).send({embed});

      let p = pkmns[pkmn]

      if (args[0] === "catch") {
        if (args[1] === pkmnsList[pkmn]) {
          message.channel.send(`You have caught a ${pkmns[pkmn]}`)
        }
        else {
          message.channel.send("That is the wrong pokemon")

        }
      }
torpid juniper
vale garden
#

anyways

#

for some reason

strong tundra
#

oh haha they use cockroachdb

#

neat

vale garden
#

when i type the correct args[1]

#

it doesnt send any msg

#

does anyone know why

#

i dont even get an error

solemn latch
#

@digital ibex as far as i can tell you cannot get just one role

#

from the api

#

you fetch all the roles, and get the one you want

digital ibex
#

ok

solemn latch
#

even discordjs seems to not get one role when you .fetch(roleID)

#
    // We cannot fetch a single role, as of this commit's date, Discord API throws with 405
    const roles = await this.client.api.guilds(this.guild.id).roles.get();
digital ibex
#

was just making sure cuz eris uses v7 and uses the role id/role endpoint which v8 doesnt have

#

thank

solemn latch
#

interesting they removed it.

#

I wonder why

torpid juniper
#

might've already done the work for you

strong tundra
#

ooh maybe

#

ah hmm it's old though

#

could probably learn stuff from it tho

torpid juniper
#

the sharder should be independent of the library

#

in theory it should always work

#

but yeah try that*

#

see if it helps

#

better to reuse than go from scratch

ivory seal
#
const fs = require('fs');
const port = 5500;
const DiscordOauth2 = require("discord-oauth2");
const oauth = new DiscordOauth2({
    clientId: "",
clientSecret: "",
redirectUri: "http://localhost:5500",});

http.createServer((req, res) => {
    let responseCode = 404;
    let content = '404';

    if (req.url === '/') {
        responseCode = 200;
        content = fs.readFileSync('./index.html');
    }

    res.writeHead(responseCode, {
        'content-type': 'text/html;charset=utf-8',
    });
    const url = require('url')
    const urlObj = url.parse(req.url, true);

if (urlObj.query.code) {
    const accessCode = urlObj.query.code;
    console.log(`The access code is: ${accessCode}`);
    const access_token = `${accessCode}`;
 
oauth.getUser(access_token).then(console.log);
}

if (urlObj.pathname === '/') {
    responseCode = 200;
    content = fs.readFileSync('./index.html');
}

    res.write(content);
    res.end();
})

    .listen(port);```
It gives me this error ``DiscordHTTPError: 401 Unauthorized on GET``
#

can anyone help me with this?

solemn latch
#

401 (UNAUTHORIZED): The Authorization header was missing or invalid.

ivory seal
#

hmm how can i fix this?

vale garden
#
if (args[0] === "catch") {
        if (args[1] === pkmnsList[pkmn]) {
          message.channel.send(`You have caught a ${pkmns[pkmn]}`)
        }
        else {
          message.channel.send("That is the wrong pokemon")

        }
      }
#

can anyone tell me why im getting no message when i type the correct args[1]

ivory seal
#

have u defined args?

solemn latch
#

whats the structure of pkmnsList

gritty bolt
#
db.once('open', function() {
            console.log(messageLink);
            const messageReminderConst = new messageReminderModel({user: user, messageLink: messageLink, time: global.time});
            const data = messageReminderConst.save(function(err) {
                if(err !== null) console.log(err);
                schedule.scheduleJob(data.time, remindUser(data, bot));
                console.log("Successfully saved reminder." + messageReminderConst);
                const successEmbed = new discord.MessageEmbed()
                .setTitle("Reminder saved sucessfully.")
                .setColor("#00FF00");
                userObject.send(successEmbed)
            });
        });
    });```
```TypeError: Cannot read property 'time' of undefined
    at C:\Users\Samst\Desktop\RemindMe\core.js:102:43
    at C:\Users\Samst\Desktop\RemindMe\node_modules\mongoose\lib\model.js:4838:16
    at C:\Users\Samst\Desktop\RemindMe\node_modules\mongoose\lib\helpers\promiseOrCallback.js:24:16
    at C:\Users\Samst\Desktop\RemindMe\node_modules\mongoose\lib\model.js:4861:21
    at model.<anonymous> (C:\Users\Samst\Desktop\RemindMe\node_modules\mongoose\lib\model.js:502:7)
    at C:\Users\Samst\Desktop\RemindMe\node_modules\kareem\index.js:315:21
    at next (C:\Users\Samst\Desktop\RemindMe\node_modules\kareem\index.js:209:27)
    at C:\Users\Samst\Desktop\RemindMe\node_modules\kareem\index.js:182:9
    at C:\Users\Samst\Desktop\RemindMe\node_modules\kareem\index.js:507:38
    at processTicksAndRejections (internal/process/task_queues.js:79:11)```
can anyone help me with this?
earnest phoenix
#

@gritty bolt Congrats you just leaked your file path
Why I always tell people to send ONLY the first line of the error

solemn latch
#

who cares about leaking file paths

#

🤔

ivory seal
#

ye

carmine summit
#

Yeah

gritty bolt
#

that shouldn't really be an issue

ivory seal
#

its not like thats gonna do something

gritty bolt
#

theres nothing in there thats sensative

carmine summit
#

Yeah

solemn latch
#

only thing you get is his desktop username is samst

ivory seal
#

hmm how can i fix this?

#

his or her @solemn latch

solemn latch
#

make sure your sending the auth header

#

and a correct one

#

that has perms for what you want to get

carmine summit
#

global is not defined...

solemn latch
#

global is always defined is it not

#

anyway, it seems data.time is undefined

#

which makes sense since he is defining data as = to the thing he is using data.time in

earnest phoenix
#

hi i got error

agile lance
#

So, I am making a “server count” command and it returned undefined with no error.

Line I used: client.guilds.size

earnest phoenix
#
    at Client.<anonymous> (C:\Users\Adwait Misra\Desktop\YesBot\main.js:15:54)
    at Client.emit (events.js:314:20)
    at MessageCreateAction.handle (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)        
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)       
    at WebSocketShard.onMessage (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)      
    at WebSocket.onMessage (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (C:\Users\Adwait Misra\Desktop\YesBot\node_modules\ws\lib\websocket.js:797:20)
gritty bolt
#

im trying to make data the object im saving

earnest phoenix
#

some error

#

while creating ping command

gritty bolt
#

and theres a time property

#

so the data.time was supposed to be pointing to that

earnest phoenix
#
const client = new Discord.Client();

const prefix = ';';


client.once('ready', () =>{
    console.log('YesBot is online!')

});

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

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

    if(command === 'ping'){
        message.channel.send('Pong 🏓')
    }
})
#

is there any error

#

since its showing error

agile lance
#

add a .catch(err => console.log(err)) at the end

solemn latch
#
const data = messageReminderConst.save(function(err) {
   schedule.scheduleJob(data.time, remindUser(data, bot));
});

but how are you acessing data in that function if its defined after the function is ran @gritty bolt

carmine summit
#

Make it /\+/

earnest phoenix
#

add a .catch(err => console.log(err)) at the end
@agile lance for my error?

gritty bolt
#

what do you mean by that

agile lance
#

So, I am making a “server count” command and it returned undefined with no error.

Line I used: client.guilds.size

#

@agile lance for my error?
@earnest phoenix That’ll make it log the error :3

gritty bolt
#

schedule.schedulejob is a nodeschedule function

#

schedule is nodeschedule

earnest phoenix
#

k what i do?

solemn latch
#

the const data is physically before the function, but its running after

earnest phoenix
#
const client = new Discord.Client();

const prefix = ';';


client.once('ready', () =>{
    console.log('YesBot is online!')

});

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

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

    if(command === 'ping'){
        message.channel.send('Pong 🏓')
    }
})
carmine summit
#

@earnest phoenix Make it /\+/

earnest phoenix
#

k

solemn latch
#

so your doing
data.time
then doing
const data = function

earnest phoenix
#

@carmine summit

gritty bolt
#

how do I fix it then

#

im confused

agile lance
#

client.guilds.size returned undefined? Somebody help please

ivory seal
#

client.guilds.cache.size

carmine summit
#

Wait actually no. Make it .split(" ")

agile lance
#

client.guilds.cache.size
@ivory seal Thank you.

solemn latch
#

you cant use something that cant exist yet.

ivory seal
#

np

solemn latch
#

if you want to use data, it needs to be outside the function thats called

#

that defines data

gritty bolt
#

but im trying to define data as the object i just saved into my db

ivory seal
#

http://localhost:5500/?code=randomcodehere

<html>
<head>
    <title>My First OAuth2 App</title>
</head>
<body>
    <div id="info">
        Hoi!
    </div>
    <a id="login" style="display: none;" href="https://discord.com/api/oauth2/authorize?client_id=767021465676546118&redirect_uri=http%3A%2F%2Flocalhost%3A5500&response_type=code&scope=identify">Identify Yourself</a>
    <script>
        window.onload = () => {
            const fragment = new URLSearchParams(window.location.hash.slice(1));

            if (fragment.has("access_token")) {
                const accessToken = fragment.get("access_token");
                const tokenType = fragment.get("token_type");

                fetch('https://discord.com/api/users/@me', {
                    headers: {
                        authorization: `${tokenType} ${accessToken}`
                    }
                })
                    .then(res => res.json())
                    .then(response => {
                        const { username, discriminator } = response;
                        document.getElementById('info').innerText += ` ${username}#${discriminator}`;
                    })
                    .catch(console.error);

            }
            else {
                document.getElementById('login').style.display = 'block';
            }
        }
    </script>
</body>
</html>``` and this is my html same error i am getting
agile lance
#

@ivory seal I did that and now it says

TypeError: cannot read property of ‘size’ of undefined

gritty bolt
#

so how can I define data before I save it>?

earnest phoenix
#

thanks working

ivory seal
#

<Client>.guilds.cache.size should work

solemn latch
#

i mean, you already have the data in the object

{user: user, messageLink: messageLink, time: global.time}
#

no reason you cant just change const data
to be the object

ivory seal
#

http://localhost:5500/?code=randomcodehere

<html>
<head>
    <title>My First OAuth2 App</title>
</head>
<body>
    <div id="info">
        Hoi!
    </div>
    <a id="login" style="display: none;" href="https://discord.com/api/oauth2/authorize?client_id=767021465676546118&redirect_uri=http%3A%2F%2Flocalhost%3A5500&response_type=code&scope=identify">Identify Yourself</a>
    <script>
        window.onload = () => {
            const fragment = new URLSearchParams(window.location.hash.slice(1));

            if (fragment.has("access_token")) {
                const accessToken = fragment.get("access_token");
                const tokenType = fragment.get("token_type");

                fetch('https://discord.com/api/users/@me', {
                    headers: {
                        authorization: `${tokenType} ${accessToken}`
                    }
                })
                    .then(res => res.json())
                    .then(response => {
                        const { username, discriminator } = response;
                        document.getElementById('info').innerText += ` ${username}#${discriminator}`;
                    })
                    .catch(console.error);

            }
            else {
                document.getElementById('login').style.display = 'block';
            }
        }
    </script>
</body>
</html>``` and this is my html same error i am getting

@solemn latch please help

gritty bolt
#

i could do that

#

hold on let me try that

solemn latch
#

rather than whats saved(which is practically the same here i think?)

gritty bolt
#

yeah it is

charred nimbus
#

can someone help me install node.js on google cloud Vps running ubuntu

gritty bolt
#
ReferenceError: remindUser is not defined```
```js
module.exports = {
//Reminder Function
remindUser: async function remindUser(data, bot) {
    try {
        console.log(data.user);
        const userId = data.user.replace(/\D/g,"")
        const dmChannel = await bot.users.fetch(userId)
        console.log(dmChannel);
        let reminderEmbed = new discord.MessageEmbed()
                .setTitle(data.messageLink)
                .setDescription("You asked me to remind you at this time of the message linked above. Click the link to view the message. If the link does not work, the message may have been deleted or you do not have access to it anymore.")
                .setColor("#FF0000");
                await dmChannel.send(reminderEmbed)
                data.remove();
    } catch (err) {
        console.log(err);
}},
//Then I use it here (same file)
messageReminderConst.save(function(err) {
                if(err !== null) console.log(err);
                schedule.scheduleJob(data.time, remindUser(data, bot));
                console.log("Successfully saved reminder." + messageReminderConst);
                const successEmbed = new discord.MessageEmbed()
                .setTitle("Reminder saved sucessfully.")
                .setColor("#00FF00");
                userObject.send(successEmbed)```
solemn latch
#

did you follow the guide i linked to you yesterday @charred nimbus ?

charred nimbus
#

can someone help me install node.js on google cloud Vps running ubuntu

#

yes

#

it dosent work

solemn latch
#

still admin auth issues?

vale garden
#

have u defined args?
@ivory seal ye i have

charred nimbus
#

yes

solemn latch
#

did you try running it as sudo/root?

charred nimbus
#

ok

solemn latch
#

otherwise, contact google cloud support imo

charred nimbus
#

or why dont i run the built in SSH

vale garden
#
if (args[0] === "catch") {
        if (args[1] === pkmnsList[pkmn]) {
          message.channel.send(`You have caught a ${pkmns[pkmn]}`)
        }
        else {
          message.channel.send("That is the wrong pokemon")

        }
      }
#

for some reason im not getting any message

solemn latch
#

still need to know the structure of pkmsList

#

otherwise 🤷‍♂️

vale garden
#

ok wait

gritty bolt
#

Woo do you know how to fix the error I sent above

vale garden
#
let pkmns = [["Weedle", "https://bit.ly/3nX5gVk"], ["Kakuna", "https://bit.ly/2T0vzf9"], ["Beedrill", "https://bit.ly/3dAhUoi"], ["Pidgey", "https://bit.ly/3lXgbN2"], ["Pidegotto", "https://bit.ly/2H7689i"], ["Pidgeot", "https://bit.ly/2HbfgK7"], ["Scyther", "https://bit.ly/3k6lxFe"], ["Rhyhorn", "https://bit.ly/31xNG0L"], ["Rhydon", "https://bit.ly/3o3hvQ7"], ["Rhyperior", "https://bit.ly/3nZISum"],  ["Horsea", "https://bit.ly/3nZITyq"], ["Seadra", "https://bit.ly/346t3dy"], ["Kingdra", "https://bit.ly/2HhEAxS"]]

      let pkmnsImg = pkmns.map(item => item[1])
      let pkmnsList = pkmns.map(item => item[0])

    let pkmn = Math.floor(Math.random() * pkmns.length)
gritty bolt
#

i defined the function in the same file

#

unless i didnt define it right

solemn latch
#

i still am confused about

remindUser: async function remindUser(data, bot) {
gritty bolt
#

thats in module.exports

#

its a function

solemn latch
#

async function remindUser(...
or
remindUser: async function(...
ive never seen both combined

#

i have no idea how that works

pale vessel
#

the name is optional

vale garden
#
let pkmns = [["Weedle", "https://bit.ly/3nX5gVk"], ["Kakuna", "https://bit.ly/2T0vzf9"], ["Beedrill", "https://bit.ly/3dAhUoi"], ["Pidgey", "https://bit.ly/3lXgbN2"], ["Pidegotto", "https://bit.ly/2H7689i"], ["Pidgeot", "https://bit.ly/2HbfgK7"], ["Scyther", "https://bit.ly/3k6lxFe"], ["Rhyhorn", "https://bit.ly/31xNG0L"], ["Rhydon", "https://bit.ly/3o3hvQ7"], ["Rhyperior", "https://bit.ly/3nZISum"],  ["Horsea", "https://bit.ly/3nZITyq"], ["Seadra", "https://bit.ly/346t3dy"], ["Kingdra", "https://bit.ly/2HhEAxS"]]

      let pkmnsImg = pkmns.map(item => item[1])
      let pkmnsList = pkmns.map(item => item[0])

    let pkmn = Math.floor(Math.random() * pkmns.length)

@solemn latch here are the arrays

scarlet stream
#

How i fix it

earnest phoenix
#

help

#

when i wrote ping

#

command

#

i replies two times why?

faint prism
#

Msbuild and nodejs?

earnest phoenix
#

was my webhook correct?
'http://127.0.0.1:5000/dblwebhook'

scarlet stream
#

Only i install quick.db

solemn latch
#

i think you want to use includes rather than [] @vale garden

vale garden
#

kk let me try

zenith knoll
#

(node:15872) UnhandledPromiseRejectionWarning: TypeError: fn is not a function

#

uh

#

const server = client.guilds.cache.find(${config.mainserver});

solemn latch
#

thats a local ip, the ip needs to be your webhooks public ip @earnest phoenix

zenith knoll
#

is the code line of error

tired panther
#

Does someone has experience with sharding?

earnest phoenix
#
const client = new Discord.Client();

const prefix = ';';


client.once('ready', () =>{
    console.log('YesBot is online!')

});

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

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

    if(command === 'ping'){
        message.channel.send(`Pong 🏓 Latency is ${Date.now() - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`)
    }
})
#

when i do this it replies 2 times

#

why?

solemn latch
#

you have two instances of your bot running more than likely @earnest phoenix

tired panther
#

maybe u running it to time?

crimson vapor
#

do you have your bot running 2 times?

tired panther
#

xD

vale garden
#

@solemn latch alr so this is what i did if (pkmnsList[pkmn].includes(args[1]))

earnest phoenix
#

thats a local ip, the ip needs to be your webhooks public ip @earnest phoenix
@solemn latch how can I find a public ip on python?

#

no

#

only 1 terminal

#

open

vale garden
#

and i realized that even if i enter the wrong arg it doesnt send anything

earnest phoenix
#

in visual studio code

vale garden
#

oof

#

idk whats wrong

solemn latch
#

just pkmnsList.includes(args[1])

zenith knoll
#

(node:15872) UnhandledPromiseRejectionWarning: TypeError: fn is not a function
uh
const server = client.guilds.cache.find(${config.mainserver});

thats what it said the error orrcured in

vale garden
#

dude but

zenith knoll
#

theres a ` ` ther

vale garden
#

@solemn latch im making a pokemon bot and, i need the arg to be the exact pkmn generated

charred nimbus
#

@solemn latch i think its the built in google ssh is the admin panel

solemn latch
#

find takes a function @zenith knoll

rose isle
zenith knoll
#

o mfg

#

ok

sudden geyser
#

What do you mean, send an embed?

rose isle
#

so it send Pong!

solemn latch
#

your just checking if it exists right @vale garden ?

rose isle
#

i wanted to make it embeded

solemn latch
#

thats what your if does

sudden geyser
#

You could use the MessageEmbed class from discord.js

solemn latch
#

pkmsList is an array
.includes checks the array, and if its in there, it returns true

gentle lynx
earnest phoenix
#

nope

#

use dsharpplus or disqord

gentle lynx
#

oh ok

#

im looking for a C# library

#

thanks

#

any docs?

earnest phoenix
#

dsharpplus has docs

#

disqord not so much

#

they're on their repos

gentle lynx
#

ok thx

#

can I still use a command handler in C#?

vale garden
#

your just checking if it exists right @vale garden ?
@solemn latch no my bot spawns in a pokemon, and if the user enters its name correctly he catches it

faint prism
vale garden
#

so i need it to be that exact pokemon

faint prism
#

use dsharpplus or disqord
@earnest phoenix why use those? Wasn't dsharpplus abandoned?

zenith knoll
#

find takes a function @zenith knoll
@solemn latch so i should use get?

earnest phoenix
#

uh

#

no?

#

dsharpplus is being actively maintained

#

you're probably thinking of just dsharp

rose isle
#

You could use the MessageEmbed class from discord.js
@sudden geyser like this?

faint prism
#

Probably

crimson vapor
#

you need to define Discord

sudden geyser
#

see how Discord is underlined red

solemn latch
#

or just use a function in your find @zenith knoll

zenith knoll
#

ok

rose isle
#

ya

zenith knoll
#

so

#

yknow

sudden geyser
#

That's probably an error, most likely you never defined it.

crimson vapor
#

at the top do Discord = require('discord.js')

carmine summit
#

Indentation Error

rose isle
#

ok i need to define DC Lib?

earnest phoenix
#

this is what i sent in dapi the other day in regards why dnet sucks ass

unstable ws, methods that should be exposed are internal, dependency on its own objects, the lib does multiple requests when you'd expect it to do only one
the last reason is why larger bots can't survive on the lib
hitting way too many ratelimits
and the lib is overall slower than its competitors

sudden geyser
#

python gang

carmine summit
#

MISSING )

zenith knoll
#

ew

crimson vapor
#

why is that a most likely, you can see the first line of the file

solemn latch
#

@vale garden then just check if args[1] equals the saved pokemon?

vale garden
#

yeah that isnt working

carmine summit
#

Modify line 9 needs to be )}

vale garden
#

thats what i said at the starting

#

lol

#

the message doesnt get sent

solemn latch
#

your not doing that in the first code you gave

#

your putting the saved pokemon var, and putting it into something else

charred nimbus
#

@solemn latch that admin thing was the built in google ssh

solemn latch
#

ah

crimson vapor
#

Woo you are in like 4 conversations rn lol

vale garden
#

wdymby putting it into something else

solemn latch
#

good to know for next time thanks for letting me know the solution @charred nimbus

charred nimbus
#

np

solemn latch
#

pkmn is the variable already you chose

vale garden
#

ye

carmine summit
#

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

zenith knoll
#

chan = server.channels.find(ch => ch.id == tickets[message.author.id].ticketid)
and i get a not a funciton error

#

i defined server

solemn latch
#

you dont need to
pkmnList[pkmn]

#

when you already have pkmn

vale garden
#

why

rose isle
#

That's probably an error, most likely you never defined it.
@sudden geyser ?

vale garden
#

dude pkmn is just the number

solemn latch
#

your just trying to get the thing you already have

pure lion
#

Bruh

#

@vale garden still having issues?

carmine summit
#

there is a lot happening that is worng

vale garden
#

well yea

carmine summit
#

Shh

#

Shhhh

sudden geyser
#

Try it and see, there's no red underline.

rose isle
#

ok

solemn latch
#

wait, why are you not just getting the pokemon in your pkmn var

sudden geyser
#

Typically you hover over those red squiggly lines to see the error

solemn latch
#

🤔

carmine summit
#

Let me explain

drifting wedge
#

how do i make a redirect oath link?

vale garden
#

wdym

drifting wedge
#

so like they add the bot, then it redirects them

earnest phoenix
#

Guys can someone join my discord server and se what i need to put?

carmine summit
#

First of all, you have an indention error

zenith knoll
#

chan = server.channels.find(ch => ch.id == tickets[message.author.id].ticketid)
and i get a not a funciton error
@zenith knoll

I defined server const server = client.guilds.cache.get(${config.mainserver});

earnest phoenix
#

Guys can someone join my discord server and se what i need to put?

carmine summit
#

You need to modify line 9 to be )}

#

Andddd

vale garden
#

@solemn latch pkmnsList is the array of pokemo names, and pkmn is the number, so pkmnsList[pkmn] chooses a random pokemon from pkmnsList

carmine summit
#

You need to define Discord by
const Discord = require('discord.js')

#

Send me the code afterwards

rose isle
#

Try it and see, there's no red underline.
@sudden geyser Thank You!

solemn latch
zenith knoll
#

can someone help pls lol

pure lion
#

With????????

zenith knoll
#

chan = server.channels.find(ch => ch.id == tickets[message.author.id].ticketid)
and i get a not a funciton error
@zenith knoll

I defined server const server = client.guilds.cache.get(${config.mainserver});

carmine summit
#

??

sudden geyser
#

Toppat typically giving us the full error is more helpful

zenith knoll
#

ok

sudden geyser
#

It's likely that .find is not a function

vale garden
#

@vale garden
@solemn latch ik i can do that but either way its the same

carmine summit
#

Tryna console config.mainserver

#

Then send

vale garden
#

mine is just longer

#

so shouldnt it work

solemn latch
#

🤷‍♂️

zenith knoll
#
PS D:\dbots\Modmailtemplate - Copy> node .
(node:12308) UnhandledPromiseRejectionWarning: TypeError: server.channels.find is not a function
    at Client.<anonymous> (D:\dbots\Modmailtemplate - Copy\index.js:67:32)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (D:\dbots\Modmailtemplate - Copy\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (D:\dbots\Modmailtemplate - Copy\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (D:\dbots\Modmailtemplate - Copy\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (D:\dbots\Modmailtemplate - Copy\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (D:\dbots\Modmailtemplate - Copy\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (D:\dbots\Modmailtemplate - Copy\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (D:\dbots\Modmailtemplate - Copy\node_modules\ws\lib\websocket.js:797:20)
(node:12308) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12308) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
sudden geyser
solemn latch
#

when i do it, it works with the code i showed @vale garden

vale garden
#

ok let me try

carmine summit
#

Bruh

sudden geyser
#

Subtraction

carmine summit
#

Its client.channels.cache.find

#

Ughhhh

sudden geyser
#

noop

carmine summit
#

Yess

#

Wait

charred nimbus
solemn latch
#

npnp

zenith knoll
#

ok

carmine summit
#

There

drifting wedge
#

how can i add a redirect in my oath2

sudden geyser
#

Cwickks the only thing wrong with Toppat's code was they didn't access the .cache property before calling .find. There's no need to look in the client's entire channels collection as that's unnecessary.

drifting wedge
#

so like after they add bot to server it redirects them

solemn latch
#

cant you just use redirect url parameter?

drifting wedge
#

yes but idk how lmao

#

https://discord.com/api/oauth2/authorize?client_id=741285379188981841&permissions=2147483383&scope=bot&guild_id={g.id}&redirect_uri={server_url}/guild/?edit={g.id}

#

this work?

#

it doesnt lol

stuck scaffold
#

hi, I am using mongodb atlas, when I connect to db with my test bot (1 server, 2 shards) the db ping is about 30, but when I connect to the db with my master bot (13000 servers, 13 shards) the db ping is over 20000. What is the reason?

gentle lynx
#

i wanna start coding bots in an another language (something like java, c#) what should i use?

sly marten
#

Hey guys I have an issue with my bot

drifting wedge
#

i wanna start coding bots in an another language (something like java, c#) what should i use?
@gentle lynx ts?

#

Hey guys I have an issue with my bot
@sly marten DONT ASK TO ASK

#

caps

gentle lynx
#

no peepoCringe

#

idk something fun

sudden geyser
#

i wanna start coding bots in an another language (something like java, c#) what should i use?
@gentle lynx there are a lot to choose from. JavaScript? Python? C? C++? C#? Rust? a lot

gentle lynx
#

hm

sudden geyser
#

heck even php

gentle lynx
#

whats rust

sudden geyser
#

systems programming language

vale garden
#

hi im back

agile lance
#
if(!message.member.roles.cache.has(r => r.name == “role name”)) return message.reply("You do not have access to this command!")```

How do I make it so it’s trigger by role name not ID?
sly marten
#

@sly marten DONT ASK TO ASK
@drifting wedge so the prefix of the bot is nk; but even if I type like $help or any other prefix, it replies too. How tf do I fix this

gentle lynx
#

aight ty

solemn latch
#

check the message starts with prefix

vale garden
#

@solemn latch do you think this is correct?

let pkmnsList = [["Weedle", "https://bit.ly/3nX5gVk"], ["Kakuna", "https://bit.ly/2T0vzf9"], ["Beedrill", "https://bit.ly/3dAhUoi"], ["Pidgey", "https://bit.ly/3lXgbN2"], ["Pidegotto", "https://bit.ly/2H7689i"], ["Pidgeot", "https://bit.ly/2HbfgK7"], ["Scyther", "https://bit.ly/3k6lxFe"], ["Rhyhorn", "https://bit.ly/31xNG0L"], ["Rhydon", "https://bit.ly/3o3hvQ7"], ["Rhyperior", "https://bit.ly/3nZISum"],  ["Horsea", "https://bit.ly/3nZITyq"], ["Seadra", "https://bit.ly/346t3dy"], ["Kingdra", "https://bit.ly/2HhEAxS"]]

      let pkmnsImg = pkmnsList.map(item => item[1])
      let pkmns = pkmnsList.map(item => item[0])

    let pkmn = pkmns[Math.floor(Math.random() * pkmnsList.length)]
    let pkmnImg = pkmnsImg[Math.floor(Math.random() * pkmnsList.length)]

    const embed = new Discord.MessageEmbed()
    .setTitle("A wild pokémon has appeared!")
    .setDescription("Guess the pokémon and type \`!catch <pokémon>\` to catch it!")
    .setColor("YELLOW")
    .setImage(pkmnImg)

      bot.channels.cache.get(channel).send({embed});


      if (args[0] === "catch") {
        if (args[1] === pkmn) {
          message.channel.send(`You have caught a ${pkmns[pkmn]}`)
        }
        else {
          message.channel.send("That is the wrong pokemon")

        }
      }
drifting wedge
#

what lang?

sudden geyser
#

@agile lance use .find instead of .has

agile lance
#

@drifting wedge so the prefix of the bot is nk; but even if I type like $help or any other prefix, it replies too. How tf do I fix this
@sly marten if(!message.content.startsWith(“nk”) return;

#

@agile lance use .find instead of .has
@sudden geyser Thanks

solemn latch
#

🤷‍♂️ i am bad at seeing errors without an error message @vale garden

vale garden
#

well

drifting wedge
#

ah i only do python

#

im da python masta

vale garden
#

im not getting any error

#

but it still isnt working

#

aaa

drifting wedge
#

im like the 2nd best python person here

sudden geyser
#

@gentle lynx also since you mentioned Java, look up Kotlin

drifting wedge
#

cuz me and shivaco r the only ones lmao

vale garden
#

can you just show me what you did which made itwork @solemn latch

sly marten
#

@sly marten if(!message.content.startsWith(“nk”) return;
@agile lance and where do I put this in the script?

solemn latch
#

ill pm you the screenshot of my logs since its a big one(trying not to spam chat)

earnest phoenix
#

was my DBL webhook correct?
http://0.0.0.0:8080/dblwebhook'

sudden geyser
#

@drifting wedge I know myself some 🐍

solemn latch
#

you need to use the public ip

#

0.0.0.0 isnt a public ip

drifting wedge
#

ok 3rd best rn

#

https://discord.com/api/oauth2/authorize?client_id=741285379188981841&permissions=2147483383&scope=bot&guild_id={g.id}&redirect_uri={server_url}/guild/?edit={g.id} is this a valid redirect url?

earnest phoenix
#

ok so how can I find a public ip?

drifting wedge
#

it doent work

#

all the vars work too

solemn latch
#

if your on a home network, google.com "whats my ip"

#

if your on a server, it should be on the control panel somewhere

#

ipv6 pog

#

probably should delete that, public ip's although public shouldnt be shared

#

again, probably shouldnt share your ip

earnest phoenix
#

how can I create a flask app for it?

solemn latch
#

im not a py dev 😦 0exe might know

#

@drifting wedge still got that issue?

slender thistle
#

I heard Python

carmine summit
#

Add redirect

#

Put ur link

#

Ez

earnest phoenix
#

i need webhook.js command

zenith knoll
#

is server.iconURL({ dynamic: true, format: 'png', size: 1024 }) not a thing?

#

it wont show

#

var e4 = new Discord.MessageEmbed()
.setColor('GREEN')
.setTitle(Message Sent)
.setDescription(${message.content})
.setFooter(${server.name}, server.iconURL({ dynamic: true, format: 'png', size: 1024 }))
.setTimestamp()

solemn latch
#

is server a guild?

#

or a server?

faint prism
#

Shiv arrives like I do when I hear C#

drifting wedge
#

@drifting wedge still got that issue?
@solemn latch oh

#

yo

#

wuts up

#

@earnest phoenix

#

?

#

so like redirects r like oarth2?

zenith knoll
#

or a server?
@solemn latch wdym

#

server is a guild

#

in a const called server

drifting wedge
#

wait toh

#

how will i do redirects?

#

the redirect is like the user's server

#

?

#

like basically 1 sec

solemn latch
#

are you inviting a bot in your url?

#

because discord wont redirect if you dont add a redirect url to your bots page.

earnest phoenix
#

how to setup api and webhook and vote thing

#

my mind are blown

drifting wedge
#

when u press this

#

i want it to take u to the invite bot page to the server (which it does)

#

then after that, it takes u to the dashboard

solemn latch
#

@zenith knoll servers are called guilds in discord development, so it can be hard to tell what your talking about when you name a variable server that contains a guild.
I have a variable named server, but it references a physical server, not a guild

#

could you redirect your redirect

#

lmao

drifting wedge
#

uh ok....

solemn latch
#

i dont know what other way to do it if it needs to be a dynamic url.

#

or just take it to the users overall dashboard

drifting wedge
#

hmm

#

but redirect isnt related to the function tho

zenith knoll
#

@zenith knoll servers are called guilds in discord development, so it can be hard to tell what your talking about when you name a variable server that contains a guild.
I have a variable named server, but it references a physical server, not a guild
@solemn latch uh well here is what i did const server = client.guilds.cache.get(${config.mainserver});
its a guild

#

so eh

#

whats happening

drifting wedge
zenith knoll
#

omfggggggggggggggggggg

#

OMFG

#

the guild has a default icon

drifting wedge
#

then the redirect edit takes you to the server you want

#

but how can it do that?

zenith knoll
#

the g uild im testing in has a default icon so it wont show

#

im so 0 iq

solemn latch
#

yeah

zenith knoll
#

im soooooooooooo dumb

solemn latch
#

iconURL is optional

zenith knoll
#

ik

#

reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

earnest phoenix
#

"Add a parameter to your app.run(). By default it runs on localhost, change it to app.run(host= '0.0.0.0') to run on all your machine's IP addresses. 0.0.0.0 is a special value, you'll need to navigate to the actual IP address. "
http://0.0.0.0:5000/

solemn latch
#

cry will probably have a better solution, but tracking the invite(bot just joined x guild)
anyone who visits the /redirectedit path who has the manager_server permission in that guild could be redirected for the next few minutes

drifting wedge
#

how do i global something?

#

thats my plan

#

wait it wont work fuckck,ckck

#

======

#

ok so basically. how would i redirect it?

modest smelt
#

How do I write the code, so that I can mute everyone in the server?

drifting wedge
#

it would like link to the /redirectedit redirect

#

which reidrects to?

#

the main bot page?

modest smelt
#
@has_permissions(administrator=True)
@client.command()
async def muteeveryone(ctx):
  guild = client.get_guild(764893841068261447)
  bruh= await guild.fetch_member(message.author.id)
  for role in guild.roles:
    if role.id == 764908012048875540:
      for member in guild:
        await bruh.add_roles(role)
#

this is my code

#

it doesn't show any errors

drifting wedge
#

like how can i log from one redirect to another what the guild id is

solemn latch
#

you cannot directly, which is why my round about way is the only solution i can think of

modest smelt
ember lodge
#

Somone knows a library or API of NodeJS to enter a Nitrado server (PS4 ARK host)

drifting wedge
#

but how would one thing know what server it was added to?

solemn latch
#

-specificrequest

#

probably a database with all that info @drifting wedge or ipc

drifting wedge
#

probably a database with all that info @drifting wedge or ipc
@solemn latch so like when someone adds the bot, it adds them to the db?

#

im confuisedd

modest smelt
#

🙂

solemn latch
#

bot joins guild > bot puts that info into a database
anyone from that guild who has manage_server in that guild that visits example.com/redirectedit is redirected to example.com/edit/:guildid

#

after 30 seconds, or a few minutes delete the entry from the db

drifting wedge
#

but how would redirect edit know the guild id?

solemn latch
#

it doesnt, it looks at the database

pale vessel
#

what is that link lol

solemn latch
#

if nothings there, just error page

#

its nothing 🤷‍♂️

#

its just an example

drifting wedge
#

wait tho

#

i made it take to thye server selector page

#

its not redirecitng

zenith knoll
#

how do u change the permissions of a channel to sync with the paternt\

solemn latch
#

thats what i suggested when you mentioned it

next flax
#

i m unable to install better-sqlite3

solemn latch
#

follow their troubleshooting page

pale vessel
#

gyp error?

zenith knoll
#

how do u change the permissions of a channel to sync with the paternt
@zenith knoll

#

js

solemn latch
#

get the parents permission, save it as the channels?

#

docs would tell you how

earnest phoenix
#

what kind of code is this

#

why are they have @/:

#

sth

next flax
#

gyp error?
@pale vessel yep

earnest phoenix
#

what libary is that

solemn latch
#

do you mean python?

earnest phoenix
#

it python?

next flax
#

js

solemn latch
#

python is a lanugage

earnest phoenix
#

nvm

solemn latch
#

@ is typically used in python 🤔 not js

earnest phoenix
#

im so sleepy

#
@client.command()
@has_permissions(administrator=True)
async def muteeveryone(ctx):
  guild=ctx.guild
  for role in guild.roles:
    if role.id == 764908012048875540:
      for member in guild.members:
        await member.add_roles(role)
#

this only mutes teh bot itself

next flax
#

its py

earnest phoenix
#

why?

solemn latch
#

seems like api abuse @earnest phoenix

earnest phoenix
#

what?

solemn latch
#

your bot will very quickly get ratelimited by discord doing stuff like that

earnest phoenix
#

we need to mute everyone to avoid discussion during a competition

next flax
#

@earnest phoenix just lock the channel

earnest phoenix
#

there are like 25 channels

solemn latch
#

change the permissions of the @everyone role to not be able to talk

earnest phoenix
#

ok

solemn latch
#

or a specific role

earnest phoenix
#

but many people have a bunch of roles

solemn latch
#

so its just one request rather than a ton

earnest phoenix
#

that have perms to speak

#

like an average person in our server has 5 roles

solemn latch
#

🤷‍♂️ put it above that role, same as the mute role

earnest phoenix
#

ok

#

where do i edit my bot

solemn latch
#

on your bots page theres an edit button

#

if your logged in

next flax
#

i m unable to install

#

better-sqlite3

solemn latch
#

did you follow the troubleshooting page they offer

next flax
#

i dont know about that

solemn latch
#

does repl.it support better-sqlite3?

#

anyway, the troubleshooting page is on their github or npm page.

next flax
#

does installing huge amount of packages makes the bot slow?

cerulean laurel
#

hey all i have start with boting last day and i dont know why i get a error ( **const commandFils = fs.readdirSync('./commands/').filter(File => file.endWith('.js')); **)

misty sigil
#

What is the error

cerulean laurel
#

by the filter

next flax
#

file is not defined

misty sigil
#

File is not file

earnest phoenix
#

How to use discord stickers

#

@misty sigil

misty sigil
#

@earnest phoenix not here

earnest phoenix
#

Where

#

?

cerulean laurel
#

file is not defined
@next flax how do un meen that waitWhatSpin

misty sigil
#

also it’s client.commands.get not client,commands.get

#

@cerulean laurel you have File, you tried to use file. They are different

earnest phoenix
#

Where is discord tester server

next flax
#

someone help me

#

with this

earnest phoenix
#

Link plz

#

@misty sigil

next flax
#

better-sqlite shit

earnest phoenix
#

🐹

next flax
#

@earnest phoenix its private

earnest phoenix
#

Discord testers

#

@earnest phoenix its private
@next flax nope

next flax
#

u mean

#

official server?

solemn latch
#

have you looked at the troubleshooting page yet?

#

because its kinda super important to look at that

earnest phoenix
#

official server?
@next flax testers

next flax
#

because its kinda super important to look at that
@solemn latch i didnt understand that

ember lodge
#

Someone knows how can i access admin command logs using Nitrapi?

cerulean laurel
#

@cerulean laurel you have File, you tried to use file. They are different
@misty sigil yes i have create for (prefix)help a file extra in a order names commands

misty sigil
#

dude

#

in the code

#

you use File as the defined thing

rocky hearth
misty sigil
#

and file as the action thing

solemn latch
#

you have to follow the requirements of that library to use it, you cant just use it @next flax

cerulean laurel
#

and file as the action thing
@misty sigil okey

sudden geyser
#

@rocky hearth look up material

gentle lynx
#

what is the best library in java

sudden geyser
#

though I think SynthWave '84 looks cooler

#

JDA?

next flax
#

what is the best library in java
@gentle lynx JDA

gentle lynx
#

ok

cerulean laurel
#

and file as the action thing
@misty sigil and how a can chnage that waitWhatSpin sry if i get right u meen know (file =>....

next flax
#

JAVA DISCORD API

misty sigil
#

change .filter(File to .filter(file

charred nimbus
#

how can i get admin perms on google cloud

drifting wedge
#

how do i move something down with css

#

like a bit down?

pale vessel
#

margin-top i guess

rocky hearth
#

@sudden geyser Hey I just tried material. But its too much bluish dark

sudden geyser
#

Are you using VSC

rocky hearth
#

yes

#

the I pic I shared, is very much similiar to dracula

#

but I feel dracula a bit faded

next flax
#

i followed trouble shooting guide

#

still error

sudden geyser
#

hold on

#

@rocky hearth Go Extensions -> Material Theme -> Set Color Theme

#

The theme looks like a mix of material theme with Dracula

next flax
charred nimbus
#

how can i get admin perms on google cloud

rocky hearth
#

yes then?

drifting wedge
rocky hearth
#

The closes I can get is the Ocean theme

pale vessel
#

margin-top i guess
@flazepe#8587

#

jeez

drifting wedge
#

ty

#

wait tho as the button?

#

like or as div?

pale vessel
#

try both and see

drifting wedge
#

<button type="button" class="btn btn-default">Save!</button>

#

ok ok

#

so like here?

#

or in css?

pale vessel
#

doesn't matter

drifting wedge
#

<button type="button" class="btn btn-default" margin-top:10px>Save!</button> something like this?

pale vessel
#

use the style attribute

misty sigil
#

No

drifting wedge
#

oh lmao

pale vessel
#

style="css"

drifting wedge
#

@pale vessel r u the one who made chip?

pale vessel
#

no, it's kyoso

misty sigil
#

Just put it as a css rule

drifting wedge
#

oh

#

why u got its icon then?

pale vessel
#

don't want to talk about that

drifting wedge
#

o ok

pale vessel
#

it's cringe

drifting wedge
#

o ok lmao

misty sigil
#

flaz did you lose a bet

pale vessel
#

ive dmed so many people about this

drifting wedge
#

alr well i dont care enough lmao

misty sigil
#

I need to know

drifting wedge
#

it works

#

ty

#

bruh flazy is owo

#

flazy, +1 qt rep

pale vessel
#

uwu thanks

#

im in the cringe gang now

drifting wedge
#

how do i make it like default

#

so like it shows

#

but when u start typing it disapears

#

you know wut i mean?

pale vessel
#

start typing?

grizzled raven
#

why does sshing via root@IP have like a different pm2 than when you ssh via user@IP?

pale vessel
#

the button disappears when you type in the field?

drifting wedge
#

i got it

#

its like placeholder

ember lodge
#

Someone knows how can i add Authorization header to node-fetch?

earnest phoenix
pale vessel
#

?????

static nexus
#

pycharm wont open 4 me

pale vessel
#

what the fuck is wrong with you code

#

the question is there

ember lodge
#

i am asking, lol

pale vessel
#

what's your setup

sudden geyser
#

The second argument to fetch takes an object. In the object, give it headers, which will be another key/value for each header

#

For example: js fetch("https://example.com/", { headers: { Authorization: "dummy" } })

pale vessel
#

baka

sudden geyser
#

5head

dapper ocean
#

Guys, who has a python example of on_dbl_vote with getting a user who voted for a bot?

earnest phoenix
#

shivaco probably has one

dapper ocean
pale vessel
#

nope, go away

dapper ocean
#

@pale vessel I won’t distract distract

pale vessel
#

nice ping

dapper ocean
#

Yes

slender thistle
#

fucking

#

stay away from channels you are not going to use properly

dapper ocean
#

?

#

Ok sorry 👌🏻

slender thistle
#

As for your question, what

#

oh, with

#

not without

#

Reading comprehension 100

dapper ocean
#

XD

slender thistle
#

data["user"] returns an ID of the voting user in a string

dapper ocean
#

Oh

slender thistle
#

convert that to integer and get user for that ID

dapper ocean
#

Ok thx, I will try this

#

:)

#

Is it allowed though, so if a user votes for my bot, if he is in bot support server he gets a special role

pale vessel
#

yes

dapper ocean
#

Ok thx distract

pale vessel
#

only not allowed if you give some sort of currency or reward to another bot

earnest phoenix
#

so voting octave for dank memer coins is not allowed but voting prism for voter role in support server is allowed?

misty sigil
#

In prism’s support server yes

static nexus
#

hey guys

#

can i get help

pale vessel
#

yis

misty sigil
static nexus
#

pycharm wont open 4 me

#

idk what the problem is

sudden geyser
#

What happens when you try opening the app

static nexus
#

it just

#

doesnt

pale vessel
#

literally

sudden geyser
#

Try uninstalling and re-installing it

#

or using the toolbox app

static nexus
#

whats toolbox app

sudden geyser
static nexus
#

thanks

#

still not opening

#

re installed 3 times

pale vessel
#

what computer do you have xd

static nexus
#

surface pro 3

#

it worked until earlier today

pale vessel
#

did you do something? like a windows update

static nexus
#

no

#

windows 8.1

#

i think the installatiation fucked up

#

unsing toolbox

dapper ocean
#

Nah, still doesn’t work

fading breach
#

node . does not even work for me anymore lol

dapper ocean
#

My code doesn’t work, I want so when user reacts for a bot, the bot checks if a user is in the bot support server, so it can give the user a special role
discord.py

#

Is it data.user ???

simple frigate
#

What program do suggest using to make a bot?

dapper ocean
#

@simple frigate not a program, a programming language

#

Programs to make bots are really trash

simple frigate
#

Ok! What programming language do suggest me to use?

vale garden
#

hi

misty sigil
#

js is easy for beginners

dapper ocean
#

Bruh, your choice. The most popular are python and javascript

vale garden
#

could i get some help

dapper ocean
#

@misty sigil python is easier though

#

I didn’t get my help though

vale garden
#

my code is acting kinda strage

misty sigil
#

eh arguable

vale garden
#

alr so

#

i have this code

#

and

#

it spawns in a pokemon

#

and if i do !catch <pokemon>

#

i have an if block which checks if the pokemon is correct

#

the problem is that

#

if i type !catch <pokemon>

#

it first spawns in a new pokemon

#

the says that the pokemon arg mentioned was wrong cuz it isnt the new pokemon

#

plzz help

quartz kindle
#

if that code is all inside a message event, then you're generating a new list of pokemon on every single message you receive

solemn latch
#

hey tim, discord seems to have gotten rid of the api request to get a single role from a guild(while keeping get all roles). any idea why they did that?
just easier to have one endpoint?

gentle lynx
#

Whats the difference between prepared statements and just normally using the query function in mysql ?

#

In nodejs

charred nimbus
#

pls hmu

gentle lynx
#

@solemn latch whats the difference