#development

1 messages ยท Page 1868 of 1

pallid jungle
#

?

#

ok

#

@lyric mountain Look

#

I want to set the channel

#

then in another code i get this channel

#

But i don't know why not working

#
    const channel = args[0]
    
    let data;
    try {
        data = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: channel
        })
        if(!data) {
            data = await schema.create({
                GuildID: message.guild.id,
                ChannelID: channel
            })
        }
    } catch (error) {
        console.log(error)
    }

    await data.save()
    return message.channel.send({content: `set the channel to <#${channel}>`})
}
#

To set the channel

#
    try {
        let GuildData = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: message.channel
        })
        if(!GuildData) {
            GuildData = await schema.create({
                GuildID: message.guild.id,
                ChannelID: channel
            })
            if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
        }
    } catch (error) {
        console.log(error)
    }

to know the channel

quartz kindle
pallid jungle
pallid jungle
coarse topaz
#

Hi there;
Well, I'm still stuck at the same part, haven't figured out a way to check if a user reacted to a message for the second time.. If it's the second time the user reacts to the message, the bot should remove the user's first reaction and leave the second one

Could someone help me, please?

#

d.js btw

quartz kindle
pallid jungle
pallid jungle
#
    try {
        let GuildData = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: channel
        })
        if(!GuildData) {
            GuildData = await schema.create({
                GuildID: message.guild.id,
                ChannelID: channel
            })
            if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
        }
    } catch (error) {
        console.log(error)
    }
#

Should i require channel ?

coarse topaz
wheat mesa
#

They told you to do message.channel.id to get the channel id

pallid jungle
# wheat mesa You want the channel id, do you not?

Yes i need channel id i set here

    const channel = args[0]
    
    let data;
    try {
        data = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: channel
        })
        if(!data) {
            data = await schema.create({
                GuildID: message.guild.id,
                ChannelID: channel
            })
        }
    } catch (error) {
        console.log(error)
    }

    await data.save()
    return message.channel.send({content: `set the channel to <#${channel}>`})
}
#

So

#

In this code

    try {
        let GuildData = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: message.channel
        })
        if(!GuildData) {
            GuildData = await schema.create({
                GuildID: message.guild.id,
                ChannelID: channel
            })
            if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
        }
    } catch (error) {
        console.log(error)
    }
wheat mesa
#

Didnโ€™t see that part

pallid jungle
#

I should get the channel

wheat mesa
#

Are you using a valid channel ID as your argument?

pallid jungle
quartz kindle
#

still same thing

pallid jungle
#

Wait lemme do it message.channel not with args

quartz kindle
#

message.channel is wrong

#

its not an id

pallid jungle
#
    let data;
    try {
        data = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: message.channel.id
        })
        if(!data) {
            data = await schema.create({
                GuildID: message.guild.id,
                ChannelID: message.channel.id
            })
        }
    } catch (error) {
        console.log(error)
    }

    await data.save()
    return message.channel.send({content: `set the channel to <#${message.channel.id}>`})

This to set the channel ^^

now i got this

CastError: Cast to string failed for value "{
  name: 'set',
  aliases: [ 'Set', 'SET' ],
  dmOnly: false,
  guildOnly: true,
  args: false,
  usage: '',
  cooldown: 5,
  guarded: false,
  execute: [AsyncFunction: execute]
}" (type Object) at path "ChannelID" for model "guildSettings"
    at model.Query.exec (E:\C) Developing\Wolfy Djs-13\node_modules\mongoose\lib\query.js:4498:21)
    at model.Query.Query.then (E:\C) Developing\Wolfy Djs-13\node_modules\mongoose\lib\query.js:4592:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  messageFormat: undefined,
  stringValue: '"{\n' +
    "  name: 'set',\n" +
    "  aliases: [ 'Set', 'SET' ],\n" +
    '  dmOnly: false,\n' +
    '  guildOnly: true,\n' +
    '  args: false,\n' +
    "  usage: '',\n" +
    '  cooldown: 5,\n' +
    '  guarded: false,\n' +
    '  execute: [AsyncFunction: execute]\n' +
    '}"',
  kind: 'string',
  value: {
    name: 'set',
    aliases: [ 'Set', 'SET' ],
    dmOnly: false,
    guildOnly: true,
    args: false,
    usage: '',
    cooldown: 5,
    guarded: false,
    execute: [AsyncFunction: execute]
  },
  path: 'ChannelID',
  reason: null,
  valueType: 'Object'
}
quartz kindle
#

i just told you why

coarse topaz
pallid jungle
# coarse topaz I know right, but I don't seem to be able to find the method I must use :/
const filter = (reaction, user) => {
    return reaction.emoji.name === '๐Ÿ‘' && user.id === message.author.id;
};

const collector = message.createReactionCollector({ filter, time: 15000 });

collector.on('collect', (reaction, user) => {
    console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
});

collector.on('end', collected => {
    console.log(`Collected ${collected.size} items`);
});

You need to react to the message first

pallid jungle
# quartz kindle i just told you why

@quartz kindle Broo
Here to set

    let data;
    try {
        data = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: message.channel.id
        })
        if(!data) {
            data = await schema.create({
                GuildID: message.guild.id,
                ChannelID: message.channel.id
            })
        }
    } catch (error) {
        console.log(error)
    }

    await data.save()
    return message.channel.send({content: `set the channel to <#${message.channel.id}>`})

So i set this channel
When i go to the other code to get the data to know the channel i set before

    try {
        let GuildData = await schema.findOne({
            GuildID: message.guild.id,
            ChannelID: message.channel.id
        })
        if(!GuildData) {
            GuildData = await schema.create({
                GuildID: message.guild.id,
                ChannelID: message.channel.id
            })
            if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
        }
    } catch (error) {
        console.log(error)
    }

By that way it gives message.channel.id not the channel i set before

coarse topaz
wheat mesa
#

Check the reactions already stored on the message.

coarse topaz
#

I'm sorry, but after checking the docs for a while again I'm still not able to understand what I'm exactly supposed to do in my code to check the already stored reactions on the message and use it to develop the rest of the code

quartz kindle
#

what exactly do you want to do?

#

send yes/no emojis and then have the user click them?

#

what do you need to detect the first reaction for?

coarse topaz
# quartz kindle what do you need to detect the first reaction for?

Basically, I'd like to make it so that if the user presses reaction 1๏ธโƒฃ, the bot will do nothing; however, if the user then presses reaction 2๏ธโƒฃ, the bot will delete reaction 1๏ธโƒฃ and leave the second one, and so on

More than one user can use this system, so it's important for the bot to verify if the first reaction and the second reaction belong to the same user before deleting one of them

#

That's what should happen

solemn latch
#

Pretty basic check code wise.
Just check If the user reacted to the first reaction any time you get a reaction of the second.

quartz kindle
#

you want to make the choice unique right?

#

a single user can only react to one emoji

#

so you can loop over message.reactions and check if reaction.users includes the user, and if it does, remove it

coarse topaz
quartz kindle
#

so loop over reactions on collect

#
.on("collect", ... => {
  for(const reaction of message.reactions.cache.values()) {
    if(reaction.users.cache.has(user.id)) { reaction.users.remove(user.id) }
  }
})
coarse topaz
quartz kindle
#

you can add a skip for the current reaction

coarse topaz
#

how to do that? Block_Poggers

quartz kindle
#

if(reaction === collectedreaction) { continue }

coarse topaz
#

oh

#

okok will try it out, thanks a lot!

drifting wedge
#

pymongo is there something wrong with this? py DB.cards.update_one( { "card_title": card_title, "card_desc": card_desc, "col": old_col }, { "$set": { "col": new_col, } }, upsert=True )?

#

i want to basically replace in the cards collection the old col with the new one

thorny flume
#
app.get('/test/?name=Jp', (req, res) => {
  res.send(`Welcome ${req.query.name}`)
})

not function

quaint wasp
#

uhh

#

๐Ÿ˜…

#

This is not the problem with my code im pretty sure..

#
(node:6236) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
    at RequestHandler.execute (C:\My Projects\apis\chat\node_modules\discord.js\src\rest\RequestHandler.js:172:15)
    at RequestHandler.execute (C:\My Projects\apis\chat\node_modules\discord.js\src\rest\RequestHandler.js:176:19)
    at RequestHandler.push (C:\My Projects\apis\chat\node_modules\discord.js\src\rest\RequestHandler.js:50:25)
    at async WebSocketManager.connect (C:\My Projects\apis\chat\node_modules\discord.js\src\client\websocket\WebSocketManager.js:128:9)
    at async Client.login (C:\My Projects\apis\chat\node_modules\discord.js\src\client\Client.js:245:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6236) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:6236) [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.```
#

i mean I dont have abot controller anywhere in my code, and its in require handler in discord.js's src

digital ibex
#

update to node 16

quaint wasp
#

ooo

#

It is im pretty sure...

#

how do I check my version?

coarse topaz
#

@quartz kindle I'm pretty sure I'm doing something wrong, but I can't figure out what it is
Currently, the bot reacts to the message with the 4 reactions it's supposed to react with, all fine with it, however, when the user (in this case me) tries to press any of those reactions, the bot removes it, regardless it's the first or the second reaction the user adds to the message

            for (const reactionValue of m.reactions.cache.values()) {
            if (reactionValue === reaction||user.id === bot.user.id) {
            continue;
}
            if (reaction.users.cache.has(user.id)) {
            reaction.users.remove(user.id);
    }
}```
quaint wasp
#
continue``` is a thing in js? whoa... never knew that
coarse topaz
quaint wasp
#

ah mine is 14.17

#

do I have to re-install it to update or is there a command?

coarse topaz
quaint wasp
#

it does packages... but not node

coarse topaz
#

ah my bad

#

no idea then

earnest phoenix
#
const DBL = require("dblapi.js");

module.exports = {
    
    /**
     * Starts to post stats to DBL
     * @param {object} client The Discord Client instance
     */
    init(client){
        if(client.config.apiKeys.dbl && client.config.apiKeys.dbl !== ""){
            const stats = new DBL(client.config.apiKeys.dbl, client);
            setInterval(function(){
                stats.postStats(client.guilds.cache.size);
            }, 60000*10); // every 10 minutes
            const dbl = new DBL(client.config.apiKeys.dbl, { webhookPort: client.config.votes.port, webhookAuth: client.config.votes.password });
            dbl.webhook.on("vote", async (vote) => {
                const dUser = await client.users.fetch(vote.user);
                const member = await client.findOrCreateMember({ id: vote.user, guildID: client.config.support.id });
                member.money = member.money + 1000;
                member.save();
                dUser.send(client.translate("misc:VOTE_DM", {
                    user: dUser.tag
                })).catch(() => {});
                const logsChannel = client.channels.cache.get(client.config.votes.channel);
                if(logsChannel){
                    logsChannel.send(client.translate("misc:VOTE_LOGS", {
                        userid: dUser.id,
                        usertag: dUser.tag
                    }));
                }
            });
        }
    }

};

how to make this webhook work?

#

Cause it didnt send any webhook

boreal iron
#

Because dblapi is deprecated

#

Use the latest library mentioned in the docs

balmy root
#

yo

#

i have a code

earnest phoenix
#

Can i change it into top gg api?

balmy root
#
  if(!message.guild.me.hasPermission("EMBED_LINKS")) {
    return message.channel.send('oh no looks like i dont have embed permission :<, for commands to work right please give me \`EMBED_LINKS\` permission to continue to use the bot')
  }

am i dumb or is the permission embed_links just not working :<

slender thistle
#

Work with channel overwrites instead

sick fable
#

if it's below 16 then update it to 16

amber thistle
#

im trying to receive vote data, im currently testing my webhook

app.post("/web/vote", (req,res) => {
    console.log(req.body)
})

but it logs undefined when i press test

quaint wasp
sick fable
#

go to there website and download the latest node version

amber thistle
#

u can just install it without uninstalling

earnest phoenix
amber thistle
#

where is the data stored when top.gg sends vote data to my webhook? because req.body logs undefined when i tested it

app.post("/web/vote", (req,res) => {
    console.log(req.body)
})
#
app.post("/web/vote", async (req,res) => {
    console.log(req)

    if(client){
        const user = await client.users.fetch(req.body.user)

        client.guilds.cache.get("856706638962622465").channels.cache.get("884265293193543740")
        .send({
            embeds: [
                new Discord.MessageEmbed()
                .setDescription(
                    `Arigatou **${user.username}**-san for upvoting me on [Top.gg](https://top.gg/bot/854652560182476800/)`
                )
            ]
        })
    }
})

cannot read property user of undefined, ok req.body is undefined, how do i access the vote data if it is not in the body?

amber thistle
#

anyone here

near stratus
near stratus
# amber thistle ```js app.post("/web/vote", async (req,res) => { console.log(req) if(cl...

are you using body parser ?
because I guess req.body will be empty unless you use that
try adding

app.use(express.json()) //This line
app.post("/blah", (req, res) => {
  console.log(req.body)
})

Also you don't have to find the guild to find the channel.
Instead of client.guilds.cache.get("1001").channels.cache.get("1001") you can simply do client.channels.cache.get("1001")
And about can't read user of undefined Do you have client defined anywhere ?

amber thistle
#

OH YEA

#

i forgot body parser smh

#

it sends 3 request when i press test

#

hm why does it sends 3 requests

#

oh wait i forgot to send a response lol

solemn latch
#

Gq

lament rock
#

freenom is notorious anyways

#

you should just buy a domain off namecheap

#

I know a guy who had multiple domains taken away from him by freenom and then sold

solemn latch
#

That's only common if your site gets traffic from what I understand.
Great for development and stuff, not so much for production

lament rock
#

don't other registrars offer tk as a tld?

solemn latch
#

It's also possible the list isn't fully complete.
Cloudflare may just partially support some

uncut vortex
#

I was wondering what makes people go from thinking that a discord bot is "ok" to thinking that is a great discord bot?

rose warren
#

It not being a clone. Or it does something no other bot does. Or it's aesthetically pleasing like tatsu for example.

uncut vortex
#

Ah

rose warren
#

Moderation bots usually aren't that impressive to people since they all basically do the same thing. Game bots usually stand out more if they have an original idea.

uncut vortex
rose warren
#

Yeah. Spend some time playing around with some popular game bots like Owo, Tatsu, Mimu, Dank Memer etc. to figure out why they're popular.

marble juniper
rose warren
#

There's a bunch of popular game bots on the site which you can find easily.

rose warren
marble juniper
#

it does AI powered NSFW filtering

#

although some bots do have it its not many

#

not even 10 bots have it as far as I know

#

lol

rose warren
#

Yeah I've seen that before but it is more uncommon for sure

marble juniper
#

yeah

#

its still kinda unique tbh

#

but discord is making my bot burn to pieces atm

#

since I can't fetch images from discord's cdn and I still dont know why

#

and if I can't fetch images my bot is completely useless

rose warren
#

๐Ÿ˜ฌ

marble juniper
#

I asked in discord dev server but only discord staff can help

#

aka the ones with staff badge

#

but no response

#

so I just disabled my main & only feature of my bot completely

#

discord why u gotta do dis to me

rose warren
#

So right now it's a unique moderation bot that doesn't moderate? dog_Joy

marble juniper
#

... yes

#

because discord doesn't let me

rose warren
#

What error do you get when you fetch?

marble juniper
#

403 status code

#

and that only happens when my bot tries to fetch

rose warren
#

Does the request require headers maybe?

marble juniper
#

I tried User-Agent header

#

and also without it

#

like they told me to in discord dev

#

but still the same error

rose warren
#

Yeah that's what I was going to suggest dog_Think

marble juniper
#

maybe just a cloudflare ban

#

from discord's cdn

#

although idk

earnest phoenix
rose warren
#

If it was a Cloudflare ban the response would be from Cloudflare's server.

marble juniper
#

dblapi is depreceated

earnest phoenix
earnest phoenix
rose warren
#

Someone already answered you

earnest phoenix
#

But how to migrate that into top.ggsdk

rose warren
marble juniper
marble juniper
#

I think it might be cloudflare though

#

there is no other possibility

rose warren
#

Have you tried opening an issue on the discord api github?

marble juniper
#

I did make a discussion

rose warren
#

Make an issue instead

marble juniper
#

I will just see if I still get a 403 error when trying to fetch

#

since it has been a while since I last tried to fetch an image

meager wasp
#

hey I have made a bot then how I can add to it

rose warren
hybrid cargo
#

lmao

marble juniper
#

Please god save my bot

#

don't make me get a 403 error again

#

I will just shutdown my bot if the 403 status code error still persists

#

and the others can't help me

errant flax
rose warren
#

What are you trying to do?

errant flax
#

making an oauth2 app

#

im trying to authenticate myself and it gives me that

rose warren
#

I figured as much but can you show any code?

errant flax
#

what part?

marble juniper
#

the part with the ouath2 stuff

#

what else

errant flax
#
const route = require(`express`).Router()
const passport = require(`passport`)

route.get(`/`,passport.authenticate(`discord`))

module.exports = route
rose warren
#

Have you put the redirect url in the application's dashboard?

errant flax
#

yes

rose warren
#

Are you sure they're exactly the same? Have you tried logging your oauth url?

errant flax
#

lemme see

rose warren
#

I've only ever done discord oauth in php so I won't be of much help ๐Ÿ‘€

errant flax
#

ah i didn't saved it

#

mb

#

it works now

hollow loom
#
client.on('guildMemberAdd', (member) => {
    const embed = new Discord.MessageEmbed()
        .setDescription(member.user.tag + 'has joined the server welcome!')
  console.log('User' + member.user.tag + 'has joined the server!');

var role = member.guild.roles.find(r => r.id === '884081521839976498')

const chnl = member.guild.channels.cache.get('884079613205155900')
chnl.send(embed)

setTimeout(function(){
  member.addRole(role);
}, 10000);
});

member.guild.roles.find is not a function

#

help

errant flax
#

help misosface

hollow loom
#

thanks for your bot's source code lmao

errant flax
hollow loom
#

do u have hacker plan\

#

on replit

errant flax
#

no?

hollow loom
#

oof i have your bot's source

errant flax
#

and?

hollow loom
#

๐Ÿ’€

errant flax
#

my bots source requires somethings that the person forked it(u) doesn't know about

rose warren
# errant flax

Have you tried logging your oauth url? Does the redirect uri match that exactly (including whatever might be after the replit.co)?

errant flax
#

yes

rose warren
#

And you're still getting that error?

errant flax
#

yep

rose warren
#

How are you putting the redirect uri in when you make the request. Where's that in your code?

errant flax
#

u mean this code?

const route = require(`express`).Router()
const passport = require(`passport`)

route.get(`/`,passport.authenticate(`discord`))
route.get(`/redirect`,passport.authenticate(`discord`,{
  failureRedirect: `/forbidden`
}),(req,res)=>{
  res.send("hi")
})

module.exports = route
rose warren
#

And do you know where that router wants to redirect to?

errant flax
#

app.js

const express = require(`express`)
const auth = require(`./routes/auth.js`)
const passport = require(`passport`)
const session = require(`express-session`)
const discordStart = require(`./strategy/discord.js`)
const app = express()

app.use(session({
  secret: process.env.session_secret,
  cookie: {
    maxAge: 1000*60*60*24
  },
  saveUninitialized: false
}))
app.use(passport.initialize())
app.use(passport.session())

app.listen(2000)
//app.use(express.json())

app.use(`/auth/`,auth)
app.get(`/`,(req,res)=>{
res.send(`hey`)
})
rose warren
#

Hmm... I can't really help much more than that.

errant flax
old cliff
#

whats the problem

#

did you put the correct redirect url?

#

including the path /auth/redirect as well?

errant flax
#

yes

#

i even made /auth/idk path to see if it works, and it does

#

ive spent the last hour on this and still wont work misosface

#

?

earnest phoenix
#

How to make the vote rewards with topgg api sdk?

errant flax
earnest phoenix
#

how can i create this (multiples choices) ?

pale vessel
#

choices

#

Add that property to the structure

earnest phoenix
#

do you have a link pls ? @pale vessel

errant flax
willow mirage
#

when my server has 8 cores and 16 threads, does that mean that total threads is 128 (8x16)?

earnest phoenix
#

What?

#

I only know there is hyper threading which does make sense for your case

#

Correct me if I am wrong because it was a while back when I studied this

willow mirage
#

I dunno

#

I read something like this

#

@earnest phoenix

errant flax
#

how do i "queue" my request for an api?

#
const strat = require(`passport-discord`).Strategy
const passport = require(`passport`)
const scopes = ["identify","guilds"]
passport.use(new strat({
  clientID: process.env.client_id,
  clientSecret: process.env.client_secret,
  callbackURL: process.env.client_url,
  scope: scopes
},(acessToken,refreshToken,profile,done)=>{
  console.log(done)
}))

what does accessToken, refreshToken and done do?

near stratus
errant flax
#

receiving

near stratus
errant flax
#

is that for my question about "how to queue request for an api"

cinder patio
#

why can't you use that? It's the right way of doing it

errant flax
#

is it a partial?

#

is the message a partial?

cinder patio
#

Yeah, DMChannels don't have a name

near stratus
#

use as

cinder patio
#

make sure name is in the object

near stratus
#
(message.channel as TextChannel).name
cinder patio
#

"name" in msg.channel

errant flax
#

:misosface:

runic depot
#

im getting this error on discord oauth2
"unsupported_grant_type"

runic depot
#
const data = {
            client_id: discord.clientId,
            client_secret: discord.clientSecret,
            grant_type: "authorization_code",
            code: request.query.code,
            redirect_uri: discord.redirect,
        };
        const headers = {
            "content-type": "application/x-www-form-urlencoded",
        };
        const result = await fetch(`${discord.endpoint}/oauth2/token`, {
            headers: headers,
            data: new URLSearchParams(data).toString(),
            method: "POST",
        });
        const text = await result.json();
        return response.json(text);
    },```
runic depot
#

can anybody help?

errant flax
cinder patio
#

you're just bypassing TS typechecking lol. Using as is fine if you make sure the object has the name property beforehand

near stratus
runic depot
near stratus
runic depot
#

i guess its not getting the data

runic depot
near stratus
# runic depot i guess its not getting the data

I did this in my code and it worked

fetch(
                "https://discord.com/api/oauth2/token",
                {
                    method: "POST",
                    body: new URLSearchParams({
                        client_id: clientID,
                        client_secret: clientSecret,
                        code: code,
                        grant_type: "authorization_code",
                        redirect_uri: URL,
                        scope: "identify guilds",
                    }),
                    headers: {
                        "Content-Type": "application/x-www-form-urlencoded",
                    },
                }
            )

(Don't mind the formatting)

near stratus
#

All of them are either outdated (uses request) or uses callback

errant flax
#

is there an example i could based on?

near stratus
# errant flax is there an example i could based on?
GitHub

A generic rate limiter for node.js. Useful for API clients, web crawling, or other tasks that need to be throttled - GitHub - jhurliman/node-rate-limiter: A generic rate limiter for node.js. Useful...

earnest phoenix
#
const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('akuanakganteng')
const app = express()

app.post('/webhook', wh.listener((vote) => {
  const dUser = await client.users.fetch(vote.user);
                const member = await client.findOrCreateMember({ id: vote.user, guildID: client.config.support.id });
                member.money = member.money + 1000;
                member.save();
                dUser.send(client.translate("misc:VOTE_DM", {
                    user: dUser.tag
                })).catch(() => {});
                const logsChannel = client.channels.cache.get(client.config.votes.channel);
                if(logsChannel){
                    logsChannel.send(client.translate("misc:VOTE_LOGS", {
                        userid: dUser.id,
                        usertag: dUser.tag
                    }));
                }
            }
))

app.listen(3000)```
Is this code right?
near stratus
earnest phoenix
errant flax
near stratus
errant flax
#

just done

near stratus
#

it's a passport thing
when you're done with work you call return done()

earnest phoenix
near stratus
earnest phoenix
near stratus
errant flax
#

actually whats refreshToken
is it the same thing as accessToken?

earnest phoenix
#

or how about this

const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('apikey')
const app = express()

app.post('/webhook', wh.listener((vote) => {
  const dUser = await this.client.users.fetch(vote.user);
                const member = await this.client.findOrCreateMember({ id: vote.user, guildID: this.client.config.support.id });
                member.money = member.money + 1000;
                member.save();
                dUser.send(client.translate("misc:VOTE_DM", {
                    user: dUser.tag
                })).catch(() => {});
                const logsChannel = this.client.channels.cache.get(this.client.config.votes.channel);
                if(logsChannel){
                    logsChannel.send(client.translate("misc:VOTE_LOGS", {
                        userid: dUser.id,
                        usertag: dUser.tag
                    }));
                }
            }
))

app.listen(3000)```
errant flax
errant flax
near stratus
errant flax
#

ah any docs about it?

earnest phoenix
#

oh yeah i forget its for my command code xD

earnest phoenix
near stratus
# errant flax ah any docs about it?

lemme find one
anyway accesToken is the token you use to fetch data from the api (like bot token)
refreshToken is used to regenerate the token (In case it becomes invalid / exposed)

errant flax
#

how can the accessToken be invalid

earnest phoenix
#

can i run webhook same host with dashboard? @near stratus

near stratus
# errant flax how can the accessToken be invalid

It has a validity
Normally you get a response like this from the api

{
  "access_token": "6qrZcUqja7812RVdnEKjpzOL4CvHBFG",
  "token_type": "Bearer",
  "expires_in": 604800,
  "scope": "identify connections"
}

After the time in "expires_in" you have to regenerate the token.

runic depot
#

after 7 days they can simply relogin

errant flax
runic depot
errant flax
#

passport?

runic depot
#

ow, so i cant help

near stratus
near stratus
errant flax
#

ah

earnest phoenix
#

what happens if i store invalid characters in json keys

near stratus
#

for some reason it's in python
but anyway

earnest phoenix
#

it's in python because that's what the most used language for botums is

earnest phoenix
#

you can store anything as a key in a js object unless it's an actual object

errant flax
#

do i put that in the params object?
im using axios for this

near stratus
earnest phoenix
earnest phoenix
#

111 total messages
51 messages with the word issues

earnest phoenix
#

how do you put json as a url param Thonk

#

akio why did you give discord docs to the poor guy

earnest phoenix
#

Why my webhook didnt run?

earnest phoenix
clear marlin
earnest phoenix
#

or maybe you set it up wrongly

near stratus
earnest phoenix
earnest phoenix
#

topgg sdk

#

meanwhile deno gang has almost every single weeb api built in so no need for deno fetch topggGuns

quartz kindle
#

yes, all the weeb apis

near stratus
#

#WeebGang

earnest phoenix
#

But my question can i run webhook same place with dashbaord?

#

including weebassembly
leaked footage of captain america saying weebs, assemble when

clear marlin
near stratus
#

@earnest phoenix window is built in deno
So can't they just do window.fetch() ???

earnest phoenix
#

somebody make a deno port

runic depot
quartz kindle
earnest phoenix
#

you don't need the window. part cuz it's a global object

clear marlin
earnest phoenix
quartz kindle
#

:^)

earnest phoenix
# clear marlin if you're using javascript with the typescript written wrapper, it doesn't matte...
const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('key')
const app = express()

app.post('/webhook', wh.listener((vote) => {
  const dUser = await client.users.fetch(vote.user);
                const member = await client.findOrCreateMember({ id: vote.user, guildID: client.config.support.id });
                member.money = member.money + 1000;
                member.save();
                dUser.send(client.translate("misc:VOTE_DM", {
                    user: dUser.tag
                })).catch(() => {});
                const logsChannel = client.channels.cache.get(client.config.votes.channel);
                if(logsChannel){
                    logsChannel.send(client.translate("misc:VOTE_LOGS", {
                        userid: dUser.id,
                        usertag: dUser.tag
                    }));
                }
            }
))

app.listen(3000)
``` How about this?
clear marlin
#

it should be working man

earnest phoenix
#

is there a way to synchronously use dynamic imports
or should I just use Promise.all for my command folder imports

quartz kindle
#

nope

clear marlin
#

oh wait

#

yes

earnest phoenix
#

nodejs doesn't have top level await

clear marlin
#

I read it wrong

earnest phoenix
#

deno does

#

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

near stratus
earnest phoenix
clear marlin
quartz kindle
earnest phoenix
#

nice

#

can i use top level await inside a for loop

clear marlin
#

yes

#

on vote

#

yes

earnest phoenix
#

nice

earnest phoenix
clear marlin
#

there's a test vote button on top.gg

earnest phoenix
#

so

var commands = fs.readdirSync("./commands")
.map(file => require(`./commands/${file}`));

I can use this as:

var commands = fs.readdirSync("./commands")
.map(file => await import(path.join(import.meta.url, `./commands/${file}`)));
earnest phoenix
clear marlin
#

under the webhook panel in your bot

earnest phoenix
#

im using var because ill mutate the array later im not dumb

earnest phoenix
clear marlin
earnest phoenix
#

idk

clear marlin
#

it would be

path.join(import.meta.url, `/commands/${file}`) ```
I guess
earnest phoenix
#

does dynamic import work with relative paths?

clear marlin
#

Not a js guy, but I guess

earnest phoenix
#

yup didnt send anything

near stratus
clear marlin
#

well the meta sends
file:///home/dir/dir/module.js

#

that's your url

earnest phoenix
clear marlin
near stratus
old cliff
clear marlin
#

@earnest phoenix yes import.meta.url sends an absolute path

earnest phoenix
#

alr

earnest phoenix
#

ill use path.join for imports

clear marlin
#

dynamic imports are relative to the cwd

earnest phoenix
#

I use VPS

clear marlin
#

if you use an absolute path, I guess it wouldn't do the job

earnest phoenix
#

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

earnest phoenix
#

path.join with import.meta seems like it should work

clear marlin
#

you have to use a path like ./commands/file.js relative to your file

#

maybe

earnest phoenix
#

according to google, dynamic imports work the same as require for dynamic, absolute and bare imports

#

imma try it and see

somber yew
near stratus
# earnest phoenix nope

then do me a favour and run a console.log(anything) at the beginning of the app.post() to check even you're receiving the request

earnest phoenix
near stratus
earnest phoenix
#

ok

#

i almost got myself banned by saying that lmfao

near stratus
rose warren
#

Let's try and keep this channel on topic guys dog_Heart

earnest phoenix
# earnest phoenix ```js const express = require('express') const { Webhook } = require('@top-gg/sd...
const express = require('express')
const { Webhook } = require('@top-gg/sdk')

const wh = new Webhook('akuanakganteng')
const app = express()

app.post('/webhook', wh.listener((vote) => {
              wh.webhook.on("vote", async (vote) => {
                const dUser = await client.users.fetch(vote.user);
                const member = await client.findOrCreateMember({ id: vote.user, guildID: client.config.support.id });
                member.money = member.money + 40;
                member.save();
                dUser.send(client.translate("misc:VOTE_DM", {
                    user: dUser.tag
                })).catch(() => {});
                const logsChannel = client.channels.cache.get(client.config.votes.channel);
                if(logsChannel){
                    logsChannel.send(client.translate("misc:VOTE_LOGS", {
                        userid: dUser.id,
                        usertag: dUser.tag
                    }));
                }
            });
        }
    }

app.listen(3000)```
Because in that code i didnt add async
quartz kindle
#

also faster

earnest phoenix
#

noice

quartz kindle
#

thats a big nono

earnest phoenix
#

tim how do you debug code so fast

quartz kindle
#

i just read it?

#

idk

earnest phoenix
quartz kindle
#

yes

earnest phoenix
#

await require async function right?

quartz kindle
#

yes but thats not the point

#

for every webhook you receive, you create a new vote listener

earnest phoenix
#

Im so confused xD

near stratus
earnest phoenix
#

and how about the async?

quartz kindle
#

first webhook, vote runs 0 times
second webhook, vote runs 1 times
third webhook, vote runs 2 times at once
etc...

earnest phoenix
#

i mean await

near stratus
earnest phoenix
#

im caching responses from reddit.com so i don't get rate limited
what should i set as the cache time to live

#

anybody here willing to make a bot for payment?

#

command in my index.js file js if (command === 'kill'){ client.commands.get('kill').execute(message, args, Discord)}

ERROR dynoError

                                     ^

TypeError: Cannot read property 'execute' of undefined
#

i mean it was the same before I messed up a little

earnest phoenix
#

and it used to work

near stratus
earnest phoenix
#

my god,
you have an if else if else for a command handler where you manually put command names

earnest phoenix
earnest phoenix
near stratus
earnest phoenix
#

ad yeah i need to put that code in my index.js xD

#

its working now

#

Thx

earnest phoenix
near stratus
earnest phoenix
#

yall overprice hard

#

i got a vc leveling system with image manipulation for only $10

#

we just doin a bit of trolling

#

oh

#

i thought u were serious

near stratus
earnest phoenix
#

i already turned down two other bot building requests

near stratus
earnest phoenix
#

noice

near stratus
#

I'm broke

earnest phoenix
#

i need crypto

#

paypal bad

#

i have given somebody like a year of nitro for making me custom bots lol

#

and you're an auctions tester

#

so i can trust ya

#

hol up rq

near stratus
earnest phoenix
#

what did you mine with it

near stratus
earnest phoenix
#

w h y

near stratus
#

Can't mine bitcoin
so mine doge > sell doge > buy bitcoin

earnest phoenix
#

doge uses scrypt algo for mining which makes it even more resource intensive than pure bitcoin

#

mine btg

#

all for custom bots lol

#

it is designed so people with huge computers get like a 1% better chance at getting more profit

near stratus
earnest phoenix
earnest phoenix
#

if you take the picture after 48 hours it appears invalid

near stratus
earnest phoenix
#

why am i even asking you for proof when im not gonna make a bot for anything lol

earnest phoenix
#

lol

#

there are two hard forks of bitcoin

earnest phoenix
#

lmao

#

bitcoin cash: insanely low fees
bitcoin gold: insanely low resource intensive

#

dunno if btg is supported on exchanges though

#

i can always trade on tipcc

#

hold up lemme download a btg miner for windows

near stratus
# earnest phoenix bitcoin cash: insanely low fees bitcoin gold: insanely low resource intensive

UwU

BTG is a cryptocurrency with Bitcoin fundamentals, mined on common GPUs instead of specialty ASICs.

ASICs tend to monopolize mining to a few big players, but GPU mining means anyone can mine again - restoring decentralization and independence. GPU mining rewards go to individuals worldwide, instead of mostly to ASIC warehouse owners, recreating network effects that Bitcoin used to have.
earnest phoenix
#

works on binance ๐ŸŽ‰

near stratus
#

fuck doge Imma start btg

earnest phoenix
#

hodl some doge

#

convert the rest to scala

#

they're both on steroids rn

quartz kindle
#

either their code is crap or you're ripping them off lol

earnest phoenix
#

or you can do this smirk

quartz kindle
#

or they are from a third world country with crap economy

quartz kindle
#

ye man, indians will work so hard for a few bucks its insane

#

they deserve way more appreciation, and more money

earnest phoenix
#

stop before i convert this chat to politics about the prime minister

earnest phoenix
jovial nexus
#

How can i list the active voice connections of a bot?

earnest phoenix
#

before i met him he was on discord 4 years with no nitro

jovial nexus
#

in djs v13

earnest phoenix
#

now he got like 8 months lol

near stratus
quartz kindle
#

still thats a rip off

earnest phoenix
#

some of the bots he is def getting ripped off on

cinder patio
#

doubt anyone would order a bot if the price was any higher

earnest phoenix
#

like the mee6 leveling copy but for vcs would be worth like $80-100 and i got it for 10

quartz kindle
#

how long it he take to do it?

earnest phoenix
#

making bots is not easy

#

a bit over a week

#

either you got ripped off or they got

quartz kindle
#

damn

near stratus
earnest phoenix
#

oh

#

so was $10 a good price?

quartz kindle
#

a week of work is worth a few hundred bucks minimum

earnest phoenix
#

wtf

near stratus
earnest phoenix
#

isnt that a bit too much

quartz kindle
#

people be getting ripped off left and right

jovial nexus
#

How can i list the active voice connections of a bot? in djs v13

near stratus
quartz kindle
#

and thats like a bare minimum

cinder patio
#

you don't know how many hours a week though

quartz kindle
#

coding is not mcdonalds

#

it takes skill and experience

cinder patio
#

he could've spent 30 minutes each day

earnest phoenix
#

that's how much my teachers earn a month

quartz kindle
#

teachers are so underpaid its unfair

near stratus
quartz kindle
#

freelancers have to compete with indians who charge 50 cents an hour tho

#

life's not easy for them

earnest phoenix
#

my mom earns a lot less per month

near stratus
earnest phoenix
#

and she's the most hardworking in the entire school

quartz kindle
#

jesus

near stratus
quartz kindle
#

ah

near stratus
#

10$ is more paid than most of the jobs

quartz kindle
#

yes

#

but for people who live in expensive countries, thats very little

earnest phoenix
#

how much does a pack of lays cost in usa

#

@rose warren

quartz kindle
#

Mac Clear your cache please, more like Mac Clear the scams please

earnest phoenix
#

oh my god 136 rupees for a pack of lays

#

we get it for 5

errant flax
#

should i put my tos and privacy policy in a command or in a webpage

earnest phoenix
#

in a webpage

#

and a command that links to the webpage

pale vessel
#

You can put it under developer portal

#

Discord will show it when people invite your bot or application

earnest phoenix
#

gminer ain't working for mining btg
I get no device found error:

D:\GMiner>mine_btg.bat

D:\GMiner>miner.exe --algo 144_5 --pers BgoldPoW --server btg.2miners.com:4040 -
-user btg1q0ru00r6vkhd7tcjajf7xgaeuz93zg886ly7r4e --pass x
No device found

D:\GMiner>pause
Press any key to continue . . .

D:\GMiner>
errant flax
earnest phoenix
#

@quartz kindle sorry for pingus but im trying to fix my broken ubuntu partition
the 17 GB one is where my linux was
what should i do to fix it?

quartz kindle
#

fix as in recover the system? recover data? or just wipe it?

earnest phoenix
#

wipe it

#

i dont have anything important on there

quartz kindle
#

delete it

boreal iron
#

You can delete it and then expand your existing C or D partition for example

earnest phoenix
quartz kindle
#

you cant expand C because its not contiguous

#

but you can expand D after you delete them

#

ah if you want to reinstall yes

earnest phoenix
#

ok

quartz kindle
#

just delete then create inside the linux installer

earnest phoenix
#

done

#

17 gb free space

quartz kindle
#

you can delete the 1.7gb too

earnest phoenix
#

ok

#

19 gigs free

quartz kindle
#

ye

earnest phoenix
#

:)

#

time to reboot

quartz kindle
#

now you can do the rest from the installer

earnest phoenix
#

ty

#

gave warning unrecognised partition then booted uefi ubuntu

boreal iron
earnest phoenix
#

aw fuck

boreal iron
#

You canโ€™t boot from Ubuntu any longer after deleting it lmao

earnest phoenix
#

now i need to wait for windows 7 to turn on

boreal iron
#

Did you change the boot priorities in your bios?

earnest phoenix
#

no

#

it's just my computer slow

#

coupled with counterfeit windows

waxen bough
#

why unetbootin

earnest phoenix
#

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

#

@boreal iron ok i booted windows

#

do i need to install ubuntu from the iso again

quartz kindle
earnest phoenix
#

lmao i accidentally uninstalled unetbootin

waxen bough
#

u should. jk

earnest phoenix
#

it's working now though

#

i just opened the file again

#

have some chocolate while im installing

feral aspen
#

Alright.. uhm.. quick question.

#
if (channel !== 'reset') {
    channel = interaction.guild.channels.cache.get((channel.match(/\d+/)[0] ?? null));

    if (!channel) {
        embedError.setDescription("โŒ The channel you entered is invalid.");
        return await interaction.followUp({ embeds: [embedError] });
    };
};
earnest phoenix
#

Yes that is valid code

feral aspen
#

The channel is defined as [#development](/guild/264445053596991498/channel/272764566411149314/)

#

The issue I'm facing is that if someone typed ?command L, L is not a channel causing the match method to error.

earnest phoenix
#

Match returns null

feral aspen
#

Yup.

earnest phoenix
#

So [0] fails

#

Add a ?.

waxen bough
#

?.[0]

feral aspen
#

.. then?

boreal iron
feral aspen
#
channel = interaction.guild.channels.cache.get((channel.match(/\d+/)?.[0] ?? null));
earnest phoenix
#

The partition was unrecognised by the installer

cinder patio
#

That ?? null is unnecessary

feral aspen
#

I want it to go to the error in the !channel.

cinder patio
#

What exactly does the error say

#

you never said

feral aspen
#
TypeError: Cannot read property 'match' of null
cinder patio
#

That means that channel is undefined

feral aspen
#

.. but the channel is stored as a string not an object.

cinder patio
#

check if it's not undefined before doing anything

cinder patio
#

It doesn't matter what it's supposed to be, inside the channel variable there's undefined

feral aspen
earnest phoenix
#

Same error

feral aspen
#

!modlogs <#channel> is the command, and the collector for <#channel> is a string, so it stores as a string, doesn't get the object.. so I collected the string like <#channel> but in the channel, I made it L.. but the match method fails since no number were found.

earnest phoenix
#

I'll test try ubuntu

#

Didn't work

#

why is it trying to use cdrom

waxen bough
#

how about u use rufus for the installer, that worked for me

feral aspen
#

OHHH.

#

My bad.. I'm sorry.

earnest phoenix
#

just when you think life couldn't get any worse, your internet breaks during installation

boreal iron
#

Are you using the latest Ubuntu installer?

earnest phoenix
#

Yes

boreal iron
#

20.something?

earnest phoenix
#

yup

boreal iron
#

Well better throw that PC away, buy a new one with two HDDs

earnest phoenix
#

nah

#

i love to suffer

boreal iron
#

lmao

earnest phoenix
#

any help on why tf it's trying to use the cdrom mount point

errant flax
#

./routes/auth.js

const route = require(`express`).Router()
const passport = require(`passport`)

route.get(`/`,passport.authenticate(`discord`))
route.get(`/redirect`,passport.authenticate(`discord`,{
  successRedirect: `https://discord.com`,
  failureRedirect: `https://youtube.com`
}))
module.exports = route

./strat/discord.js

const strat = require(`passport-discord`).Strategy
const passport = require(`passport`)
passport.use(new strat({
  clientID: process.env.client_id,
  clientSecret: process.env.client_secret,
  scope: ["guilds.join"],
  callbackURL: process.env.client_url
},(accessToken,refreshToken,profile,done)=>{
  console.log(profile.accessToken===accessToken)
  done()
}))
#

why does it always redirect me to the failureRedirect link?

quartz kindle
#

this is how you partition your drive

boreal iron
quartz kindle
#

wd > seagate

boreal iron
#

Pfff in your dreams

quartz kindle
#

talking from experience

boreal iron
#

Me too

quartz kindle
#

lel

earnest phoenix
#
type: 'GUILD_TEXT',
  deleted: false,
  guild: <ref *1> Guild {
    id: '860913724222341220',
    name: "๐“ผTyrone's server",
    icon: null,
    features: [ 'COMMUNITY', 'NEWS' ],
    commands: GuildApplicationCommandManager {
      permissions: [ApplicationCommandPermissionsManager],
      guild: [Circular *1]
    },
    members: GuildMemberManager { guild: [Circular *1] },
    channels: GuildChannelManager { guild: [Circular *1] },
    bans: GuildBanManager { guild: [Circular *1] },
    roles: RoleManager { guild: [Circular *1] },
    presences: PresenceManager {},
    voiceStates: VoiceStateManager { guild: [Circular *1] },
    stageInstances: StageInstanceManager { guild: [Circular *1] },
    invites: GuildInviteManager { guild: [Circular *1] },
    deleted: false,
    available: true,
    shardId: 0,
    splash: null,
    banner: null,
    description: null,
    verificationLevel: 'LOW',
    vanityURLCode: null,
    nsfwLevel: 'DEFAULT',
    discoverySplash: null,
    memberCount: 4,
    large: false,
    applicationId: null,
    afkTimeout: 300,
    afkChannelId: null,
    systemChannelId: null,
    premiumTier: 'NONE',
    premiumSubscriptionCount: 0,
    explicitContentFilter: 'ALL_MEMBERS',
    mfaLevel: 'NONE',
    joinedTimestamp: 1629523272638,
    defaultMessageNotifications: 'ALL_MESSAGES',
    systemChannelFlags: SystemChannelFlags { bitfield: 3 },
    maximumMembers: 250000,
    maximumPresences: null,
    approximateMemberCount: null,
    approximatePresenceCount: null,
    vanityURLUses: null,
    rulesChannelId: '876085712758399036',
    publicUpdatesChannelId: '876085712758399036',
    preferredLocale: 'en-US',
    ownerId: '551120440584699904',
    emojis: GuildEmojiManager { guild: [Circular *1] },
    stickers: GuildStickerManager { guild: [Circular *1] }
  },
  guildId: '860913724222341220',
  parentId: null,
  permissionOverwrites: PermissionOverwriteManager { channel: [Circular *2] },
  messages: MessageManager { channel: [Circular *2] },
  threads: ThreadManager { channel: [Circular *2] },
  nsfw: true,
  id: '876085712758399036',
  name: 'general',
  rawPosition: 2,
  topic: null,
  lastMessageId: '884395473266417664',
  rateLimitPerUser: 0
}โ€Š
quartz kindle
#

nice wall of text

boreal iron
earnest phoenix
#

How to detect this channels featurws

#

wall of hot text

quartz kindle
earnest phoenix
#

Like using message.channel.features

boreal iron
quartz kindle
#

lmao

boreal iron
#

WD reds are good as well as Ironwolfs

quartz kindle
#

they are guild features

earnest phoenix
#

This is message.channel

quartz kindle
earnest phoenix
#

!eval message.channel

quartz kindle
#

stay away from seagate barracudas

#

also i believe we had this convo before

boreal iron
#

I agree anyways never heard something good about barracudas before

earnest phoenix
#

Oh nwm this is guild but how to get it with code

#

Guild.channel.features === COMMUNITY ? YES NO

quartz kindle
#

more than half of the barracudas i installed for my clients broke within 1 year

#

and most of the pcs they brought in with bad disks were preinstalled seagates

#

this was on laptops from 2010-2015

earnest phoenix
#

my pc is from 2014

boreal iron
quartz kindle
#

you access it from the guild object, not from the channel object

#

message.guild.features or channel.guild.features or guild.features

#

also, its an array, so you can use .includes

earnest phoenix
#

I wanna detect these community channels

quartz kindle
#

i just told you how

earnest phoenix
#

*our communism channels

#

You said how do get these result

#

Oh

#

Yes you did sorry

#

Thanks

quiet topaz
#

is it possible to know who added the bot to a guild (guildCreate) in discord.js?

pale vessel
#

not possible in any library

errant flax
quiet topaz
#

because i want to let the user who added the bot know, that the bot doesnt have the right permissions

boreal iron
#

Try to message the guild owner about missing permissions

errant flax
#

or just check via audit logs

boreal iron
#

Or try to send a message to the channel a command of the bot with missing permissions has been executed

errant flax
#

if the bot has perms to see it

errant flax
quiet topaz
boreal iron
#

Well then respond to executed commands with a message about the missing permissions to run this command

#

No bot needs all permissions in the first place

quiet topaz
#

yeah but i was thinking, what if it doesnt have read/send perms

boreal iron
#

2 possibilities, 1st donโ€™t care as they might kick the bot again if it doesnโ€™t work, 2nd detect if the bot is missing basic permissions like sending messages and leave the guild

quiet topaz
#

hmm ok

errant flax
pale vessel
#

Message could not be loaded

errant flax
#

./routes/auth.js

const route = require(`express`).Router()
const passport = require(`passport`)

route.get(`/`,passport.authenticate(`discord`))
route.get(`/redirect`,passport.authenticate(`discord`,{
  successRedirect: `https://discord.com`,
  failureRedirect: `https://youtube.com`
}))
module.exports = route

./strat/discord.js

const strat = require(`passport-discord`).Strategy
const passport = require(`passport`)
passport.use(new strat({
  clientID: process.env.client_id,
  clientSecret: process.env.client_secret,
  scope: ["guilds.join"],
  callbackURL: process.env.client_url
},(accessToken,refreshToken,profile,done)=>{
  console.log(profile.accessToken===accessToken)
  done()
}))

its always redirecting me to the failureRedirect

signal estuary
#
if (!member.roles.cache.some((r) => r.name === 'Muted')) return console.log("already unmuted")
TypeError: Cannot read property 'cache' of undefined
small tangle
#

command in DM executed? or what is member

signal estuary
# small tangle command in DM executed? or what is member

little complicated:

const checkMute = async (con, client) => {
    con.query(`SELECT * from mutes`, async (err, results) => {
        results.forEach(async res => {
            // console.log("Expires: " + res.expiresAt + " current date: " + new Date())
            if (res.expiresAt <= new Date().toLocaleString()) {
                // console.log("Mute from " + res.userId + " runs up")
                let server = client.guilds.cache.find(server => server.id === res.serverId);
                let user = client.users.fetch(res.userId);
                let member = await server.members.fetch(user);
                if (!member.roles.cache.some((r) => r.name === 'Muted')) return console.log("already unmuted")
            }
        })
    })
}
module.exports.checkMute = checkMute;
#

but member is right

rose warren
#

Oh I'm sad I missed the conversation about freelancers getting ripped off dog_Pensive $10 for a bot shouldn't be a thing. Your time is worth so much more than that.

errant flax
#

?

split hazel
#

depends on the bot

#

some just copy a template and still do a crap job

rose warren
#

Ok so i'm not talking about scammers

#

I'm talking about actual devs

errant flax
#

can someone help me with a discord oauth2 :reeeee:

near stratus
errant flax
#

nope

#

different issue

lyric mountain
#

waddya need?

errant flax
#

./routes/auth.js

const route = require(`express`).Router()
const passport = require(`passport`)

route.get(`/`,passport.authenticate(`discord`))
route.get(`/redirect`,passport.authenticate(`discord`,{
  successRedirect: `https://discord.com`,
  failureRedirect: `https://youtube.com`
}))
module.exports = route

./strat/discord.js

const strat = require(`passport-discord`).Strategy
const passport = require(`passport`)
passport.use(new strat({
  clientID: process.env.client_id,
  clientSecret: process.env.client_secret,
  scope: ["guilds.join"],
  callbackURL: process.env.client_url
},(accessToken,refreshToken,profile,done)=>{
  console.log(profile.accessToken===accessToken)
  done()
}))

always redirects to failureRedirect link

lyric mountain
#

hmmm, idk what passport is sorry

errant flax
split hazel
#

passport just provides easy ways for express apps to implement authentication

#

I never used it though I usually just write my own oauth handlers

errant flax
#

wait how isee

lyric mountain
#

oauth isn't that hard after you understand how it works

#

it's just some go-here-go-there and processing some data on each step

signal estuary
#
let server = client.guilds.cache.find(server => server.id === res.serverId);
let user = client.users.fetch(res.userId);
let member = await server.members.fetch(user);


if (!member.roles.cache.some((r) => r.name === 'Muted')) return console.log("already unmuted")
TypeError: Cannot read property 'cache' of undefined
near stratus
lyric mountain
#

same issue I had KEKW

split hazel
#

I had that issue ages ago

#

they suddenly changed the api without warning anyone

lyric mountain
#

who tf uses querystring in body?

split hazel
#

because it wasn't supposed to be accepted in the first place

near stratus
lyric mountain
split hazel
#

treating devs like dogs

#

@errant flax do you get redirected to the discord auth page first?

#

one that tells you to authorise

near stratus
lyric mountain
#

wait guilds are cached on djs?

near stratus
lyric mountain
#

tf

near stratus
#

.fetch() always better than .get()

near stratus
raw nest
tawdry oracle
#

is there a way of changing the bots profile banner color?

solemn latch
#

Changing the pfp color iirc

raw nest
signal estuary
near stratus
raw nest
signal estuary
#

I try to create a role named "Muted" but the roles name is always "new role". I tried:

                msg.guild.roles.create('Muted', {
                    data: {
                        color: 'GRAY',

                    },
                    reason: 'Muted - by bot',
                })

and this:

                msg.guild.roles.create({
                    data: {
                        name: 'Muted',
                        color: 'GRAY',

                    },
                    reason: 'Muted - by bot',
                })
eternal osprey
#

how would i select one random object each time? So right now, either sword or axe.

signal estuary
clever agate
#

i started TS now, and how do you fix this error?

eternal osprey
signal estuary
signal estuary
clever agate
#

okeh

#

@signal estuary how do you define Client as a constructor? lol

clever agate
signal estuary
signal estuary
#

I want to add the role to the channel permissions and edit it:

                let role = await msg.guild.roles.create({
                    name: 'Muted',
                    color: 'RED',
                    reason: 'Muted - by bot'
                })
                let edit = await msg.guild.channels.cache.forEach(r => {
                    r.permissionOverwrites.create([
                        {
                            id: role.id,
                            deny: ['SEND_MESSAGES']
                        }]);
                })
      if (!userOrRole) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
                             ^

TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
earnest phoenix
earnest phoenix
earnest phoenix
rose warren
earnest phoenix
#

lmao wat

rose warren
#

Yeah they didn't install djs

earnest phoenix
#

since when did djs have ts support

rose warren
median raft
#

Guys I did my custom emojis 32x32px but they look blurry as hell, what should be the size of them?

earnest phoenix
#

At least 128

wicked pivot
#
for (let i = 0; i < list.length; i+10) {
        console.log(i)
}```
return 0, 0, 0 ....
earnest phoenix
#

64 could work for less detailed emojis

median raft
#

I'll try 128 thank you

earnest phoenix
#

so the value of i never changes

wicked pivot
#

why ?

earnest phoenix
#

umm because you are never setting the value just calculating it?

#

try doing i = i + whatever

wicked pivot
#

ow okay thx

round solstice
#

Quick question to all developers out there working with larger bots, I'm looking for a way to monetize my bot. Any suggestions?

earnest phoenix
#

Donate button

#

Or premium features

cinder patio
#

patreon

rose warren
split hazel
#

don't bother monetizing your bot before it grows a decent size

sudden geyser
cinder patio
#

Isn't chargebee paid?

rose warren
#

Chargebee is free for your first $90k or something

split hazel
#

it's a great tactic

sudden geyser
#

You don't need to do that

#

But it's an easy strategy

rose warren
#

I've been using it since June instead of Patreon and Chargebee is perfect. So easy.

sudden geyser
#

e.g. most mobile apps do that

earnest phoenix
#

ALL mobile apps do that

rose warren
#

I think you need to have a registered company to be able to use Chargebee though

#

I can't remember when I signed up what they asked for, but I've heard some people say they ask for business details.

earnest phoenix
#

Mac when are you gonna send your chargebee referral

rose warren
#

They don't have a referral system lol

earnest phoenix
#

oof

rose warren
#

I'm just genuinely satisfied

earnest phoenix
#

I'm just gonna make my bot free and slap a donate command on it

sudden geyser
#

Me personally, I like when an application only charges for what's costing them. For example, most of AniList's features are free to use but only a few are locked behind premium because they "cost" more to run.

rose warren
#

Before, I would have a spreadsheet with people's Patreon real names, Discord usernames saved on Patreon (not updated) and Discord IDs so I could find them if I needed to, even though I had their official bot give them the roles and unlock the features for them. Their API was a nightmare and their bot was hella unreliable. Some people had stopped paying and didn't have their perks removed.

earnest phoenix
#

Most crypto miners only take 1% of your mining rewards and they even allow you to build from source to get everything free

rose warren
#

Now, Chargebee does everything for me automatically. I don't need to do anything. People sign up on my site, pay and get their perks, invoices etc all automatically. When they want to cancel it cancels for them and I don't have to go and check to make sure it's done like I did with Patreon.

#

I would waste hours every month checking through the Patreon list and referring to my spreadsheet making sure people had the perks they paid for / had their perks removed. Patreon is 0/10 bad experience and high fees on top.

#

Chargebee's API is easy and their docs are very complete.

#

And I also don't require any unnecessary details like real name etc. All I collect is their Discord ID and email address. Whereas with Patreon it asks for their real name and doesn't give you their Discord ID on the dash so it's kinda painful when it comes to support.

earnest phoenix
#

Patreon just forgor to clear their cache smh

rose warren
#

Fr

#

It'll show you their Discord username when they signed up. So if they change it you don't know who they are.

earnest phoenix
#

i smell a skill issue

rose warren
#

I heard about Chargebee here dog_Joy blame my endless Chargebee ramblings whenever someone mentions Patreon on whoever told me about it.

earnest phoenix
#

crypto best

#

period

rose warren
#

And tbh if you're earning $90k and you get into the paid tier, it's still hella cheap for all it does.

#

I wouldn't mind paying

earnest phoenix
#

If someone's earning 90k and call smth expensive they have a problem

rose warren
#

Well you can be earning $90k and not making a huge profit after taxes, salaries and overheads. $90k still isn't huge in business terms.

#

I worked for a startup a few years ago that made over $150k in turnover in a year and the manager still couldn't afford to pay himself.

#

Turnover โ‰  profit

split hazel
#

in discord bot terms tax evasion is actually a very easy thing

#

well the IRS might come knocking asking how you're earning all this money but

rose warren
#

It's easy until they catch you dog_Joy

split hazel
#

bitcoin

#

lovely to see how governments love to milk as much money as they can through taxes from their hard working and struggling citizens

earnest phoenix
#

bitcoin is pretty easy to track

#

which is why hackers prefer xmr

rose warren
#

If you get audited you'd still be stuffed. You'd have tax invoices from your payment processor you'd have to justify.

earnest phoenix
#

it's impossible to see who sent money to whom in xmr

rose warren
#

"oh we just send stripe money because we like them"

split hazel
#

"only 90k a year from my friends no biggie"

sudden geyser
earnest phoenix
#

They tax us more than they need to

split hazel
#

pretty sure most of it goes towards politicians being able to use money as toilet paper

rose warren
#

You don't need to pay tax if you declare a loss anyway. The #1 aim of a new company is to NOT make a profit. If you're making a profit you're doing it wrong and you should fire your accountant.

sudden geyser
earnest phoenix
#

i don't get the you

split hazel
#

rich getting richer poor getting poorer

earnest phoenix
sudden geyser
#

oh uh, yeah I know I made 200 billion but all I have for you is this subway sandwich

split hazel
#

and in the uk boris is making things even worse

#

he should be locked up

#

pretty much has blood on his hands

earnest phoenix
#

don't even ask me about india

#

the bitchass prime minister modi thought removing the 500 and 1000 ruppee notes would be a good fix for tax evasion

sudden geyser
#

every politician has blood on their hands

split hazel
#

and wasting tax money forcing people to get vaccines that don't even work half the time and stupid covid19 schemes that just ended up killing people instead of helping

split hazel
#

modern day nazis if I say so myself

earnest phoenix
#

Yeah I do

#

modi supports taliban too

#

iirc

rose warren
#

Hmm this is getting political...

earnest phoenix
#

chat getting real sussy rn

waxen bough
#

Should i be worried i know nothing about tax

near stratus
peak mason
#

Isnt this the dev channel ?

sudden geyser
rose warren
#

Yes

earnest phoenix
split hazel
#

funny joke name one good politician

near stratus
earnest phoenix
humble crane
#

How to add if anyone add our bot to their server after adding the bot they will be redirected to another website that we set.

humble crane
#

Anyone?

earnest phoenix
#

You can

rose warren
#

You have to use the redirect uri parameter on the invite link

earnest phoenix
#

Just add a redirect URI to the bot invite

rose warren
#

It's not oauth... ๐Ÿ‘€

humble crane
#

Is that feature/option in Developer portal web or top.gg web

rose warren
#

Dev portal

humble crane
#

K

#

Ty

#

Y'all

earnest phoenix
#

question: does the redirect work even if all you selected as the scope was bot and/or application.commands so the app doesn't really need a token

#

Hi! Actually do slash command, i do this for send to discord my commands but actually i was cooldown for 24 hour because he spam API. Someone can give me a solution for sent only new command to discord when my bot start ?
https://hastebin.com/idezaracam.less

earnest phoenix
#

Um

#

When will my bot be verified

#

@rose warren

sudden geyser
earnest phoenix
#

My bad

quartz kindle
#

jk pls no ban

sick fable
#

(node:13248) DeprecationWarning: The message event is deprecated. Use messageCreate instead

#

WTF is this ๐Ÿ˜ญ

quartz kindle
#

exactly what it says

sick fable
#

but it no workd

quartz kindle
#

wdym

#

it does work, everyone is using it

sick fable
#

lemme see

clever agate
#
client.on("messageCreate", (message) => {
//...
});
sick fable
#

my bot is not working

#
client.on('messageCreate', message => {
    if(message.author.bot || !message.content.startsWith(prefix)) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/);

    if(message.content.startsWith === `${prefix}ping`){
        initiate(ping)
    }
});
#
function initiate(command){
    fs.readdir('./Commands', (err, files) => {
        if(err){
            console.log(err)
        }

        else{
            files.forEach(file => {
                if(!file.endsWith === '.js'){
                    console.log(`No command found ending with ".js"`);
                }

                else{
                    const command = require('./Commands/${command}')
                    client.commands.get(command).execute(message, args)
                }
            })
        }
    })
};
wooden kindle
#

I HAVE A BIG BRAIN BLANK

#

${user.id} its that to get someones ID right

clever agate
#
client.on('messageCreate', message => {
    if(message.author.bot || !message.content.startsWith(prefix)) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/);

    if(message.content.startsWith === `${prefix}ping`){
        initiate("ping")
    }
});โ€Š
#

@sick fable

sick fable
#

thanks

clever agate
#

np

sick fable
#

lemme send ya my ping.js

#
const discord = require('discord.js');

module.exports = {
    name: "ping",
    description: "This command tells the bot ping.",
    execute(message, args){
        const embed = new discord.MessageEmbed()
        .setTitle('Client latency:')
        .setDescription(client.ws.ping)
        .setColor('#FFFF');

        message.channel.send('Pong!', embed)
        }
}
clever agate
#
function initiate(command, message, args){
    fs.readdir('./Commands', (err, files) => {
        if(err){
            console.log(err)
        }

        else{
            files.forEach(file => {
                if(!file.endsWith === '.js'){
                    console.log(`No command found ending with ".js"`);
                }

                else{
                    const command = require('./Commands/${command}')
                    client.commands.get(command).execute(message, args)
                }
            })
        }
    })
};โ€Š
signal summit
#

I use python and discord.py

Due to a stupid mistake of mine i got a recursion error(s) (line repeated 1k times)
I want to ask is it worth that the bot be shutdown and got it fixed or the error can be ignored for a while?
(Basically is that error fatal?)

clever agate
#
const discord = require('discord.js');

module.exports = {
    name: "ping",
    description: "This command tells the bot ping.",
    execute(message, args){
        const embed = new discord.MessageEmbed()
        .setTitle('Client latency:')
        .setDescription(client.ws.ping)
        .setColor('#FFFF');

        message.channel.send({content: 'Pong!', embeds: [embed]})
        }
}โ€Š```
#

@sick fable

sick fable
#

lemme see

clever agate
#
client.on('messageCreate', message => {
    if(message.author.bot || !message.content.startsWith(prefix)) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/);

    if(message.content.startsWith === `${prefix}ping`){
        initiate("ping", message, args)
    }
});โ€Šโ€Š
#

I at least think that's how it works

sick fable
#

didnt worked

quartz kindle
sick fable
#

lemme see what i can fix in the initiate function

quartz kindle
#

if it was fatal, your bot would crash and exit

#

unless you have it autorestarting

clever agate
#

@quartz kindle help him '-'

quartz kindle
#

in which case it depends how often the crash happens

clever agate
#

@sick fable send error for me

clever agate
#

ik LOL

quartz kindle
#

you are reading the files again on every command

sick fable
#

lemme last try

quartz kindle
#

if your bot is in 1000 servers, and people use 1000 commands, your bot will read the same file 1000x at once

sick fable
#

and if there's still error i will senmd

#

send

signal summit
quartz kindle
clever agate
#

no problem

sick fable
#

updated function

#
    const commandName = require(`./Commands/${command}`);
    client.commands.get(commandName).execute(message, args)
};```