#development

1 messages · Page 1469 of 1

lyric mountain
#

What about an image to text bot?

cerulean ingot
#

is that even possible

lyric mountain
#

Yep

hollow sedge
#

probably

#

you just connect it to an api

lyric mountain
#

Python dudes do it all the time

hollow sedge
#

or use a module

mellow kelp
#

yeah

#

its kinda easy actually

#

just did it some days ago

opal plank
#

all ur homies will now have their coding license revoked

mellow kelp
opal plank
#

i want names, 40 cents for each head you bring me

#

point the sinners

crimson vapor
#

alright im back

#

wait

#

if I turn myself in do I get 40 cents?

opal plank
crimson vapor
#

stonks though tbh

zenith terrace
rancid sand
#

do you guys use any tool to collect stats for your bots? i.e how many servers its in

mellow kelp
#

yeah me

zenith terrace
#

Probably quite a few of us

mellow kelp
#

client.guilds.cache.size

zenith terrace
#

Or bot depending what people use

outer zenith
#

smh

zenith terrace
#

Ima change mine to ahhh so it has to be ahhh.guilds.cache.size

vagrant venture
#

.hola pendejadas

mellow kelp
#

probably the best decision you've ever taken KEKW

rancid sand
earnest phoenix
#

So as some may know, there's this <Client>#api method in discord.js which returns a noop function everytime you access a property of it and it kind of like collects them all in a bucket and does this kind of thing, anyone know how something like this could be made?

zenith terrace
outer perch
#

just bot

#

😊

crimson vapor
#

this.client

mellow kelp
#

guys lets do a poll

#

1️⃣ - bot gang
2️⃣ - client gang

crimson vapor
#

bot is only people who followed tutorials

mellow kelp
#

i use client

#

(voted for both because poll)

crimson vapor
#

because its easier to say bot than client to newbies

mellow kelp
#

yea

earnest phoenix
pale vessel
#

client because that's what it's named internally

hollow sedge
#

I actually like using bot

#

Because that is what the class is called in discord py

mellow kelp
#

wait i thought it was client there too

pale vessel
#

probably different

quiet ridge
#

Hey, have a discord.py bot running in 2k guilds on 2 shards, but the TopGG page isn't showing the shard count. I'm using the python topgg library, and have autopost setup. It keeps the server count updated, but doesn't seem to update the shard count. This is the current TopGG code:

class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = TOP_TOKEN
        self.dblpy = dbl.DBLClient(
            self.bot, self.token, autopost=True,
        )
        # Autopost will post your guild count every 30 minutes

    async def on_guild_post():
        print("Posted to top.gg")

Does anyone know how I would fix this?

fierce ether
#

async function getembedcolor(client){
const guildSettings = await GuildConfig.findOne( { guildID: message.guild.id } );
const embedcolor = guildSettings.embedcolor
return embedcolor
}


module.exports = {
getembedcolor,``` how can i pass message into this?
pale vessel
#

You can make it a function

fierce ether
#
 * @param {User} [user] - The user that executed the command that resulted in this embed
 * @param {object} [data]
 * @param {client} [client] - - Data to set in the rich embed
 * @param {string} [message]
 */


module.exports = class SnowflakeEmbed extends MessageEmbed {
  
  constructor (user, data, message, client = {}) {
    super(data)
    let color = getembedcolor(message)
    console.log(color)
    this.setColor().setTimestamp()
    if (user) this.setFooter(`Command Ran By ${user.tag}`, user.displayAvatarURL()) 
    if (!user) this.setFooter('Snowflake Discord Bot') 
  }```
#

tryna use it here

#

and it is a function

twilit geode
#

+1 for client gang

mellow kelp
#

yes

pale vessel
#

For getembedcolor, you can make it accept message instead and use message.client

#

and you also will have access to the message itself

fierce ether
#

TypeError: Cannot read property 'client' of undefined

#

let color = getembedcolor(message.client)

#

as such right?

mellow kelp
#

message doesn't have a client

fierce ether
#

or in the function?

pale vessel
mellow kelp
#

wait really

#

gasp

pale vessel
fierce ether
#

so whys it undefined?

pale vessel
#

because message is not defined

fierce ether
#

i dont know how to define message inside of the constructer then

#

constructor (user, data, message, client = {}) { i thought that worked tbh

mellow kelp
#

pass it as a constructor parameter maybe?

pale vessel
#

you should put message, not message.client since you wanted to use message.guild.id in that function

#

but that's not the problem here

fierce ether
#
  <rejected> TypeError: Cannot read property 'guild' of undefined```
twilit geode
#

define guild with discord.js

pale vessel
#

it's not passing message correctly

twilit geode
#

const guild = require("discord.js")

fierce ether
#

but whys it not passing message correctly?

#
const guildSettings = await GuildConfig.findOne( { guildID: message.guild.id } );
const embedcolor = guildSettings.embedcolor
return embedcolor
}


module.exports = {
getembedcolor,
"ERRORCOLOR": "#f53939"
}``` this is correct right?
crimson vapor
fierce ether
#

it dosent work @crimson vapor

pale vessel
twilit geode
pale vessel
#

you're high

crimson vapor
#

nah

#

mine better

twilit geode
#

it was about guild

pale vessel
#

No 🧢

twilit geode
#

like message.guild

crimson vapor
#

guild isnt anything in discord.js tho

#

classes use capital first letter

fierce ether
#

async function getembedcolor(message) {
const guildSettings = await GuildConfig.findOne( { guildID: message.guild.id } );
const embedcolor = guildSettings.embedcolor
}


module.exports = {
getembedcolor,
"ERRORCOLOR": "#f53939"
}```
#
  constructor (user, data, message, client = {}) {
    super(data)
    this.setColor(getembedcolor(message)).setTimestamp()
    if (user) this.setFooter(`Command Ran By ${user.tag}`, user.displayAvatarURL()) 
    if (!user) this.setFooter('Snowflake Discord Bot') 
  }```
#
TypeError [COLOR_CONVERT]: Unable to convert color to a number.```
pale vessel
#

Again, message isn't being passed correctly which is why it's undefined

#

Can you show me how you used SnowflakeEmbed?

crimson vapor
#

@fierce ether

fierce ether
#

new Snowflake(author)

#

that isnt the error

#

const guildSettings = await GuildConfig.findOne( { guildID: message.guild.id } );

pale vessel
#

But it also needs, data, message, and client?

fierce ether
#

i need to pass message so i can get the embed color from the db

pale vessel
fierce ether
#

the snowflake embed works

#

thats not the error

pale vessel
fierce ether
#

its trying to set the color but it cant fetch it from the db because message is undefined

#

@pale vessel it always works lol

pale vessel
#

I guess they're from the super()

#

But it's weird that message is defined there but not in the function, where you pass the message

fierce ether
#

well i can get the guild id

#

so how can i make the guild config use that

#

only getting this error now @pale vessel

#
TypeError [COLOR_CONVERT]: Unable to convert color to a number.```
#
const GuildConfig = require('../database/schemas/GuildConfig');

async function getembedcolor(data) {
const guildSettings = await GuildConfig.findOne( { guildID: data.guild.id } );
const embedcolor = guildSettings.embedcolor
return embedcolor
}


module.exports = {
getembedcolor,
"ERRORCOLOR": "#f53939"
}```
pale vessel
#

What's guildSettings.embedcolor?

fierce ether
#
  constructor (user, data, message, client = {}) {
    super(data)
    let color = getembedcolor(data)
    this.setColor(color).setTimestamp()```
pale vessel
#

Ah, await your function

fierce ether
#

returns #fff001

pale vessel
#

Try awaitng it

fierce ether
#

SyntaxError: await is only valid in async function

#

and constructers cant use await

#
module.exports = class SnowflakeEmbed extends MessageEmbed {
  constructor (user, data, message, client = {}) {
    super(data)
    let color = await getembedcolor(data)
    this.setColor(color).setTimestamp()
    if (user) this.setFooter(`Command Ran By ${user.tag}`, user.displayAvatarURL()) 
    if (!user) this.setFooter('Snowflake Discord Bot') 
  }```
pale vessel
#

You can make it a method

fierce ether
#

how

pale vessel
#
async build() {
    let color = await getenbedcolor();
    ...
    
}```
fierce ether
#

under super?

pale vessel
#

you need the data, yeah I guess

fierce ether
remote mantle
#

guys i get code support here right?

pale vessel
#

Not there

fierce ether
#

where

pale vessel
#

something like this```js
class SnowflakeEmbed extends MessageEmbed {
constructor (user, data, message, client = {}) {}
async build() {
let color = await getenbedcolor();
...

}

}

const embed = await new SnowflakeEmbed(author).build();```

crimson vapor
#

you need to call super or it will error

fierce ether
#

so how do i use async aswell @crimson vapor

crimson vapor
#

in the constructor?

#

you can't

crimson vapor
#

well you can

#

but not like that

earnest phoenix
#

Wait

#

How can i put any message in that boxes?

earnest phoenix
#

O wait nvm

#

js a

#

xd

#

js Some code

#

Hmmm

crimson vapor
#

``` not `

earnest phoenix
#

Oh

#

js Hello

#
So
#

Oh right

#

Thx

mellow kelp
#
const a = 'poggers'
earnest phoenix
#
let author = message.author;
#

´´´js
if (message.author.bot) return;
´´´

#

uh

#

oh

#
if (message.author.bot) return;
#
client.on('message', async message => {
     if (message.content) {
    var operation = Math.floor(Math.random() * 5000);
     if (operation == '479') { 
      message.channel.send('You found the secret message :eyes:')
   }
}
});
#

;u

#

i always use the async

#

;u

stable nimbus
#
await botdb.queryPromise(`SELECT * FROM server WHERE serverid = ${message.guild.id}`).then(async function(results){
            if(results[0].embeds === 0) {
                //
            }
            else {
                if(!message.guild.me.hasPermission(`EMBED_LINKS`)) {
                    await message.channel.send(`Hey <@${message.author.id}>! You have embeds enabled, but I can't \`Embed Links\`! I need to be able to do this!`);
                }
            }
            return;
        });

I need help figuring out this god damn return if someone could help.

#

I've tried every combination I can think of but it won't stop the functions from running.

odd stratus
#

What's wrong with it

earnest phoenix
#

Where can I find the best reminder bot

ivory seal
#

is something wrong with discord

#

im getting a error 500

rocky hearth
#

for TS: I have a type Alpha = 'A' | 'B' | 'C';
How do I make Alpha so that it also has the lowercase letters in it.

tame kestrel
rocky hearth
#

Thanks, but I just came to know that ts, has a powerfull Template Literal Types
And it is possible

#

Or I say, more than that

tame kestrel
gilded olive
#

タフ

pale vessel
#

weeb

rocky hearth
#

Can you tell me why this doesn't produces red line in my editor? for ts

#

I should not be able to add null's here, as the type is set to Piece

gilded olive
regal kiln
#

}
}

earnest phoenix
#

Hey, my command system for my bot that I've been using for months now just stopped working, I don't think I touched it or anything, could somebody take a look at it and tell me if something is wrong?


bot.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')
}
});
#

have you made any changes to your code

#

before it stopped working

#

you return if the message startswith the prefix, I think there should be !

fierce holly
#

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\

earnest phoenix
#

How do I check if there is a specific user of a specific guild?

#

in which library

#

discord.js

#

if fetch throws an error, the user doesn't exist in the guild

earnest phoenix
earnest phoenix
#

Not to my knowledge...

earnest phoenix
#

you're missing an inverter

earnest phoenix
#

bruh

#

does the event fire in the first place?

#
const Guild = client.guilds.cache.get('ID')
if (Guild) {
      guild.members.fetch('ID')
        .then(console.log)
        .catch(console.error);
     }```
#

yes, that would be correct

earnest phoenix
#

🤔

#

what's your actual code

#

we can't help you if you omit parts of it

#

all of my code is right here:

const Discord = require('discord.js');
const bot = new Discord.Client();
const prefix = '!';

bot.on("ready", () => {
    console.log('Bot is online.')
})

bot.on('message', message =>{
    if(message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();
    if(command === 'ping') {
        message.channel.send('pong')
}
});

bot.login('token')
#

where's the part for the xp

#
var stats = {};
if (
    fs.existsSync('stats.json')){
    stats = jsonfile.readFileSync('stats.json');
}

bot.on('message', (message) => {
    if(message.author.id == bot.user.id)
       return;

    if (message.guild.id in stats === false) {
        stats[message.guild.id] = {};
    }

    const guildStats = stats[message.guild.id];
    if (message.author.id in guildStats === false) {
        guildStats[message.author.id] = {
            xp: 0,
            level: 0,
            last_message: 0
        };
    }

    const userStats = guildStats[message.author.id];
    if (Date.now() - userStats.last_message > 30000) {
    userStats.xp += random.int(15, 25);
    userStats.last_message = Date.now();

    const xpToNextLevel = 5 * Math.pow(userStats.level, 2) +50 * userStats.level + 100;
    if (userStats.xp >= xpToNextLevel) {
        userStats.level++;```
#

oh dear

#

do you hook into the message event multiple times

#

Nope

#

what

#

are you on any sort of drugs

#

No lmao

#

did he mean it's another whole bot

#

i-

#

Was going to say I just tried it on another bot and it didn't work

#

oh my fucking god

#

i asked you to see if the event's firing in the first place

#

in the current code

#

does d.js enable all the intents but the privileged ones by default though?

#

nope

#

djs doesn't use intents by default at all

#

oh, so he should explicitly enable the message intent?

#

Did you mean to add console.log and see that? @earnest phoenix

#

Because I did that and still no

earnest phoenix
earnest phoenix
earnest phoenix
#

huh

#

are you using djs v12

#

how do I check?

#

your package.json

#

12.5.1

#

🤔

#

the code you provided should work just fine

#

oh

#

you've got a syntax error

#

how tf did that even run

#

what you provided shouldn't even run

#

No, one of the embeds I defined earlier I typed wrong, instead of rankcard it was rankcrad...

#

what

#

\😳

quartz kindle
#

That bracket is for the if

earnest phoenix
#

oh

#

oh

#

i didn't even notice it

#

Hey tim! nice to see you, always when I need help lol-

#

Yeah, it's fixed now, sorry about wasting your time

misty sigil
#

haha

quartz kindle
#

That code will work with any 1char prefix tho

earnest phoenix
#

they mentioned an embed being their issue but there is no mention of an embed there

#

they're omitting parts of their code 🤷‍♂️

misty sigil
#

just make your prefix 60 chars long demoSmart

misty sigil
#

too

quartz kindle
#

prefix = "AAAAAAAAAAAAAAA"

misty sigil
#

AAAAAAAAAAAAAAAA

earnest phoenix
#

yeah but you can't omit code if you expect help

#

At my first glance over the commands I added I must have missed the type

misty sigil
#

it’s like asking why a database query won’t work

earnest phoenix
#

imagine calling mr. repair man to fix your fridge and you keep showing him a brand new fridge which is perfectly fine, instead of your broken one

misty sigil
#

but only including the code around it

#

entirely removing the query

earnest phoenix
#

it was legit a chain of else if's I don't think it's really needed when I thought it was the part that was broken was up there

#

I have 90 commands, was I going to paste all of them here? lol

#

bin services exist 🤷‍♂️

misty sigil
#

bin services?

earnest phoenix
#

no, I was going to paste the first one that can be used as a test no matter what

#

hastebin etc

misty sigil
#

and 90 commands in an

earnest phoenix
#

you should read that page

misty sigil
#

else if chain?

earnest phoenix
#
if(command === 'ping') {
        message.channel.send('pong')
else if(command === 'marco') {
        message.channel.send('polo!')

else if chain, idk what else to call it

#

and then I just repeated the else if code

misty sigil
#

... how many commands again

earnest phoenix
#

too many, I estimate it's around 90...

misty sigil
#

you need a command handler.

earnest phoenix
#

Voltrex must be proud of you

#

That seems like a lot of work mattt

#

are you using v12

#

yes

#

🤔

#

cache shouldn't be undefined

quartz kindle
#

Are you sure?

earnest phoenix
#

i don't know

misty sigil
earnest phoenix
#

in VSCode i didn't get a error like this

quartz kindle
#

console.log(Discord.version)

earnest phoenix
#

🙄

misty sigil
#

not compared to fucking pain with else if statements

earnest phoenix
#

but in glitch i got one

#

i think i using v11 in glitch?

quartz kindle
#

show your glitch package.json

earnest phoenix
misty sigil
#

it’s not v12

quartz kindle
#

Yup

misty sigil
#

it’s v11

quartz kindle
#

V11

pale vessel
#

Bro use ourcord sure

earnest phoenix
#

how to i make it v12?

quartz kindle
#

Change the version

earnest phoenix
#

npm i discord.js

quartz kindle
#

Just type 12.5.1 in the package.json

#

And restart the bot

earnest phoenix
#

okay

#

@quartz kindle it work now?

misty sigil
quartz kindle
#

Save the file

earnest phoenix
#

okay

#

yes it works!

#

i now get another error .-.

#

@quartz kindle

copper cradle
#

catch takes an arg

#

an error

#

it must be catch() {}

earnest phoenix
#

my bot's code don't have catch function

copper cradle
#

wair

#

wait

pale vessel
#

you have to upgrade your node version

copper cradle
#

it doesn't require the ()

earnest phoenix
copper cradle
#

yeah upgrade your node version

earnest phoenix
#

my bot is now v12

copper cradle
#

node version

pale vessel
#

Node, not d.js

copper cradle
#

not d. js version

earnest phoenix
#

how to upgrade node.js on glitch?

#

by npm install node.js?

copper cradle
#

no

earnest phoenix
#

by npm install discord.js?

copper cradle
#

omg

#

I feel sleepy

#

imma head out

earnest phoenix
#

help

pale vessel
#

Change 8.x to 12.x in your package.json

#

Under engines

#

and then restart your bot

earnest phoenix
#

thanks

#

Yeah it installed

#

I don't get any errors now

earnest phoenix
pale vessel
#

no

earnest phoenix
#

fuck

#

anyway how do you add inline fields to messageembed?

#
.addField(..., ..., true);
#

tried that didn't work

pale vessel
#

you need two or more fields

#

with inline

earnest phoenix
#

I did have

#

the field right before it was inline

#
let embed = new Discord.MessageEmbed()
			.setTitle(`List of emotes in guild ${message.guild.name}`)
			.addField(`#${i}`, `\u200b`)
			.addField(`Name`, emoji.name, true)
			.addField(`Preview`, `${emoji}`, true)
			.addField(`Source`, source)
			;
#

@pale vessel

#

hey stinky dev help me

pale vessel
#

what does it look like

pale vessel
#

br

#

you're on mobile

earnest phoenix
#

I know

#

That's why I'm testing by rotating my phone screen

pale vessel
#

that won't work

earnest phoenix
#

fuck discord

#

🖕

#

fun fact

#

desktop, android and ios all run on different frameworks lmfao

#

that's why everything is so inconsistent

pale vessel
#

what would be the ideal framework for this type of application

#

that's cross platforms

earnest phoenix
#

imo react native

#

id use a potato

i mean potatoes can conduct electricity

pale vessel
#

is flutter good

earnest phoenix
#

never tried it

#

people say flutter is smoother than react native but i yet have to try it

pale vessel
#

eh, sounds very subjective

willow mirage
#

i wish js can be like java

#

when you install java jdk, then you can run java every where

earnest phoenix
#

...node works like that too

lusty quest
#

also in worst case containers exist

#

if you find some OS that wont run node but docker as example. but this is probably never the case

willow mirage
glacial drum
#

Hello guys, my boot has been closing towards the morning hours for a few days, I try to open it at these hours, and nothing comes out in the cmd part, it stays like this, what should I do?

quartz kindle
#

client.on("debug", console.log)

#

add that to your code

glacial drum
pale vessel
#

Define client

glacial drum
#

I don't understand what I need to do

stable frost
#
class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

    async def on_guild_post():
        print("Server count posted successfully")

    @commands.Cog.listener()
    async def on_dbl_vote(data):
        print(data)
        c.execute(f'''INSERT INTO vote VALUES ('{data.user}', NULL)''')
        user_result = bot.fetch_user(data.user)
        embed = discord.Embed(description = 'Vote', color = 0x00ff99)
        embed.add_field(name = f'User has voted and recieved a reward!', value = '[Vote Discord Empire at top.gg](https://top.gg/bot/780041639514996787)')
        embed.set_author(name = user_result, icon_url = user_result.avatar_url)
        channel = await bot.fetch_channel(790163457358037012)
        webhook.send(username = bot.user.name, avatar_url = bot.user.avatar_url, embed=embed)

    @commands.Cog.listener()
    async def on_dbl_test(data):
        print(data)
        c.execute(f'''INSERT INTO vote VALUES ('{data.user}', NULL)''')
        user_result = bot.fetch_user(data.user)
        embed = discord.Embed(description = 'Vote', color = 0x00ff99)
        embed.add_field(name = f'User has voted and recieved a reward!', value = '[Vote Discord Empire at top.gg](https://top.gg/bot/780041639514996787)')
        embed.set_author(name = user_result, icon_url = user_result.avatar_url)
        channel = await bot.fetch_channel(790163457358037012)
        webhook.send(username = bot.user.name, avatar_url = bot.user.avatar_url, embed=embed)```
Bot doesnt react on vote, why ?
misty sigil
glacial drum
#

of course

#

I did what your friend above said

earnest phoenix
#

@glacial drum your client is defined with a different name probably

#

Also are you using discord.js or something else?

glacial drum
#

yes I'm doing it via dbm

earnest phoenix
#

Bro define client

#

Or if you dont know how to, go read djs documentation, or learn js

#

conat client = new Discord.Client()

#

ig he named it bot

#

like my code

stable frost
#

Anyone there who can help me with Python ?

earnest phoenix
stable frost
#

Hahaha first line xD

stable frost
earnest phoenix
#

ask shiv idk python

#

python is gay ngl

#

js is lesbian

stable frost
#

okay lol

#

But uhm I need answers 😂

earnest phoenix
#

Chat dead

#

@everyone bring it back to life and win a FREE PS4!!!

blazing ravine
#

why im getting this error..

last blade
#

Komut bu

earnest phoenix
#

I dont know bdfd

last blade
#

Aga be

#

Herkes pc deb yapiyo

earnest phoenix
#

konow wait bruh

regal kiln
#

Ben de yok.

last blade
#

.d

regal kiln
#

Nomention tel için flananmı

last blade
#

Bdsript

#

İcin

#

Bdscript

regal kiln
#

Zor değil mi telden kod yazmak.

#

Ben sıkılırım

last blade
#

Zor ama kod bilgin olunca basit

regal kiln
last blade
#

Ok

earnest phoenix
#

I think we don't speak Turkish here

regal kiln
#

Bilmiyorum
Bdfd

pale vessel
#

AlexFlipnote API no longer supports bdfd due to it requiring the authorization header

misty sigil
#

loooool

open rune
#

anybody help please, how do I store local variable into global?

bot.on("message", message() => {
  var variableA = '...' // This is the variable I want to store as public
})

bot.on("guildMemberAdd", member => {
  console.log(`this is ${variableA}`);
})
earnest phoenix
#

declare it outside of the arrow function

#

you might not want to do that though

#

it doesn't support concurrency well*

#

you're going to experience race conditions

topaz epoch
#

return variableA ?

earnest phoenix
#

thats not how that works

feral aspen
#
const mongoose = require("mongoose");

const socialSchema = mongoose.Schema({
    name: String,
    userID: String,
    bio: String,
    privacy: Boolean,
})
module.exports = mongoose.model("Social", socialSchema);
```I currently have this schema for my social commands, whenever I update them, It doesn't update for all the users, even when they perform a social command.
open rune
#

@earnest phoenix @topaz epoch Thank you for helping.

feral aspen
#

Like I change or add, example I add

/// ...
privacy: Boolean,
Test: Number, // Example...
#

When I add that, it doesn't add for all the users.. what can I do?

rocky hearth
#

Guyz I'm facing a weird issue since 2days for Typescript. :(
I see NO errors(red lines) in vscode.
But when I run the code, it is producing the errors seen on the right side.
I'm trying to set some Global Types but sadly it is not working.

tired panther
#

how do I edit a dm message?

quartz kindle
#

The same way you edit any other message

tired panther
#

by their ids

#

const msg = await message.guild.channels.cache.get(" ").messages.fetch({
id: client.msgsent.get(message.id)})

#

I know that

#

but this is just for guilds

#

dms are not guild specified?

quartz kindle
#

You need to fetch the dmchannel

vague imp
#

i was getting there but yes what Tim said

quartz kindle
#

Lol sorry

tired panther
quartz kindle
#

Check the docs

#

There should be something like user.createDM()

tired panther
#

kk

#

did not find it, just something like fetch()

quartz kindle
tired panther
#

and what does this Channel do?

quartz kindle
#

This is the dm channel

#

You can fetch the message from it

tired panther
#

my brain 🤯

#

So how will I know fetch the Id, I mean my idea:

Someone reacts on the bot dms message
It will refresh the content @quartz kindle
Do I need therefore the .createDM() method?

regal smelt
#

@tired panther imagine a DM channel as a regular channel without a guild

tired panther
quartz kindle
#

Dm reactions are same as any other reaction

tired panther
#

because the reaction parameter has the id

quartz kindle
#

You get a reactionAdd event

tired panther
regal smelt
#

I believe that dming a user effectively creates a DM channel

tired panther
#

xD

#

So how do I get the Id of the channel?

regal smelt
#

I see that Tim is currently having a stroke

tired panther
#

xD, sorry

#

the messagereactionadd event just triggers on guild channels 😭

quartz kindle
tired panther
#

do I have to contact discod

#

@quartz kindle or add this in client?

#
    autoReconnect: true,
    partials: ["MESSAGE", "CHANNEL", "GUILD_MEMBER", "REACTION", "MESSAGE", "USER"]
}); ?
quartz kindle
#

Yes

tired panther
#

will this effect something?

#

when I do not include there something

quartz kindle
#

This will enable you to receive events from non-cached structures

#

For example, reactions on old messages

#

From before your bot started

tired panther
quartz kindle
#

No

tired panther
#

okay thx

quartz kindle
#

But you will need to handle partial events

tired panther
#

how?

quartz kindle
#

For example, a partial message only has id, not content, no embeds, no nothinf

tired panther
#

ok

quartz kindle
#

If message.partial === true

tired panther
#

okay

#

if (user.partial) await user.fetch();
if (reaction.partial) await reaction.fetch();
if (reaction.message.partial) await reaction.message.fetch();

#

?

quartz kindle
#

Yes

tired panther
#

ah okay, I thought a extra handler xD

#

So okay, now how to edit a message by their ids, did not this one time xD

quartz kindle
#

You have the reaction, and you have reaction.message

#

So you can just .edit() it

tired panther
#

reaction.message.edit() so easy? @quartz kindle

quartz kindle
#

Yes

tired panther
#

okay will try this

#

thx so much

rose warren
#

In DJS, I can't get the member count for a guild without the intents right?

earnest phoenix
#

incorrect

opal plank
#

you just dont have members cache

rose warren
#

so memberCount will work?

opal plank
#

should yah

earnest phoenix
#

How do i fix this to make it a hyper link?

mellow kelp
#

im pretty sure hyperlinks like that can only be sent on embed descriptions

earnest phoenix
#

do i have to put this "'"

#

'

#

okay

waxen tinsel
#

Yes, hyperlinks are embeds only

earnest phoenix
#

ah okay

waxen tinsel
#

So a bug caused by my update to the intents gateway resulted in my bot getting flagged/quarantined. How likely is it that my appeal will be successful at this point?
@ me when responding please.

pale vessel
#

They will most like approve it @waxen tinsel

#

A friend of mine accidentally spammed the API by fetching message history thousands of times and got his bot flagged. He appealed and eventually got his bot unflagged

earnest phoenix
#

So like this?

pale vessel
#

Hyperlinks won't work with footer text

#

Only title, field value and descriptions

earnest phoenix
#

ah okay

pale vessel
#

For title, you need to pass the url property to the embed, it's little different than a markdown hyperlink

mellow kelp
#

wait they worked on the title?

#

oh k

waxen tinsel
# pale vessel A friend of mine accidentally spammed the API by fetching message history thousa...

500+ hours of work for this to happen :(
My bot essentially DMed people every time they reacted to a message..
Whenever someone causes an error via reaction or message, I ask them for permission to send me the errors and explain the info involved so that they have more control over their info and privacy. I was unaware of the bug for 3 hours, and this was happening to 5.8k people. I took bot offline the second I found out, but was too late apparently

quartz kindle
#

Rip

waxen tinsel
#

The worst part is timing. Content creators are covering the bot on Tuesday.. I need the bot unblocked by then.. but I have gone 2 days with no response from discord. Any idea or estimates on how long they may take?

lusty quest
#

did you got API locked or completely flagged?

waxen tinsel
lusty quest
#

gg

#

idk could be a week

waxen tinsel
#

Damnit

earnest phoenix
#

you should try asking in the developer server

#

you have a bigger chance to get in contact with an employee

waxen tinsel
#

Can you dm a link?

#

Bruh I literally got screwed by a combination of intents and protecting user privacy ..

earnest phoenix
lusty quest
earnest phoenix
#

thank

waxen tinsel
#

👍

hard anchor
#

Hi, someone knows how to import images for discord.js

solemn latch
#

From discordjs?

#

Like from discord? Or importing from what

hard anchor
#

I want to import images from my pc

mellow kelp
#

to attach them?

solemn latch
#

Pretty sure you just use FS for that.

earnest phoenix
mellow kelp
#

client.guilds doesn't have an array method

#

you're probably looking for client.guilds.cache.array()

earnest phoenix
#

okay thanks

earnest phoenix
#

print(f'Failed to load extension {extension}', file=sys.stderr)

SyntaxError: invalid syntax

Why do I get this error?

mellow kelp
#

that's a python-specific question

sudden geyser
#

SyntaxError: invalid syntax

#

You have some sort of invalid syntax in one of your python files.

#

I don't know if it's that one, but see if you have a stacktrace that points to the file

#

And check your Python version

carmine summit
#

How do I turn off the bot?

#

Like process.stop()

#

process.kill()

pale vessel
#

process.exit()

carmine summit
#

Ok thanks

pale vessel
#

if you have a process manager like pm2 it might restart it

carmine summit
#

Yeah I knwo

earnest phoenix
#

ping me

mellow kelp
#

bruh this aint for that

sudden geyser
#

well you never logged it to the console

#

You only log the possible error

#

also I recommend you use the ID rather than the guild name to find it

upbeat prairie
#

So

#

Hai guys

earnest phoenix
#

@earnest phoenix are you trying to get your bot to give you a invite to the guilds it joins

#

Instead I recommend only generating invites if you run a command with the guild id or something

#

Not every guild the bot joins

sudden geyser
#

or just generate a permanent invite and store it

tired panther
#

I just need partial when the bot was offline and it want to fetch something??

odd stratus
#

It's happening when I try using my >rank command on a specific user

solemn latch
#

🤔 simple get?

mellow kelp
#

give more context

#

what are you trying to do

odd stratus
#

It's a rank card

#

Only happening with this specific user

solemn latch
#

what are you using simple-get for?

mellow kelp
#

yeah

solemn latch
odd stratus
#

I'm not 🤔 I'm using canvacord for the rank card in my rank code

#

Idk what modules its using

solemn latch
#

does this user not have a pfp?

odd stratus
#

They do

mellow kelp
#

i think its the loadImage function

solemn latch
#

yeah

#

are you fetching an image from somewhere?

mellow kelp
#

the image you're trying to load probably doesn't exist

odd stratus
#

That's how my card card looks

#

But doesn't load for a specific user

#

No idea why cause it just happened today

mellow kelp
#

their pfp might not exist

#

are you using avatarURL or displayAvatarURL?

odd stratus
mellow kelp
#

um

solemn latch
#

the error seems to originate from your canvas, not the embed

crimson vapor
#

poggers

odd stratus
#

Had them change their pfp and yeah still doesn't work

#

Damnit

earnest phoenix
#

Hey, please help me. How can i make live counter to my bot? Discord.js is the language
So i want to use this in Bot stats.

pale vessel
#

Canvas uses simple get

distant cobalt
#
else if(message.client.member.permissions.has("MANAGE_CHANNELS")){```
Theres something wrong
pale vessel
#

Whatever you're trying to load returned 404

distant cobalt
#

Erm

#

Huh

tired panther
#
const now = Date.now()
const cooldownAmount = 3000;
let timestamps = new Map();
  if (timestamps.has(user.id)) {
        const expirationTime = timestamps.get(user.id).now + cooldownAmount;
    
        if (now < expirationTime) {
          const timeLeft = (expirationTime - now) / 1000;
          return console.log(timeleft)
        }
      }
timestamps.set(user.id, {
            user: user.id,
            now: now      
        });
setTimeout(() => timestamps.set(user.id, {
            user: "1234567898765",
            now: now      
        }), cooldownAmount);
``` making a cooldown for reactions, why is this not working?
earnest phoenix
pale vessel
#

permissions.has() also works

#

hasPermission() is a shortcut for that not really, it gets all permission from the member's roles combined and check them

earnest phoenix
#

message.client.member owo what's that

tired panther
earnest phoenix
#

@tired panther my fucking god are you defining a new cooldown amount every time the command is run

#

and timestamps isn't set beforehand

tired panther
earnest phoenix
#

you literally just sent a big chunk of code without explanation lmao

tired panther
#

its for a event

earnest phoenix
#

ok?

#

continue plz

prime glacier
#
 throw e;
    ^

SyntaxError: Error parsing /home/ubuntu/secret/package.json: Unexpected token < in JSON at position 108
    at parse (<anonymous>)
    at readPackage (internal/modules/cjs/loader.js:270:20)
    at readPackageMain (internal/modules/cjs/loader.js:305:15)
    at tryPackage (internal/modules/cjs/loader.js:315:15)
    at Function.Module._findPath (internal/modules/cjs/loader.js:690:18)
    at resolveMainPath (internal/modules/run_main.js:12:25)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:65:24)
    at internal/main/run_main_module.js:17:47 {
  path: '/home/ubuntu/secret/package.json'
}```
earnest phoenix
#

@prime glacier your package.json is wrong

tired panther
#
const cooldownAmount = 9000;
let timestamps = new Map();
module.exports = async(client, reaction, user) => {
if(user.bot) return
////////////////////cooldown set

  if (timestamps.has(user.id)) {
        const expirationTime = timestamps.get(user.id).now + cooldownAmount;
    
        if (now < expirationTime) {
          const timeLeft = (expirationTime - now) / 1000;
          return console.log(timeLeft)
        }
      }
timestamps.set(user.id, {
            user: user.id,
            now: now      
        });
setTimeout(() => timestamps.delete(user.id), cooldownAmount);
}

it can just set one time the cooldown, then it does not work

prime glacier
# earnest phoenix <@555652788592443392> your package.json is wrong
{
  "name": "secret",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "dependencies": {
    "ascii-table": "0.0.9",
    "colornames": "^1.1.1",
    "dotenv": "^8.2.0",
    "figlet": "^1.5.0",
    "genius-lyrics": "^3.0.0",
    "google-play-scraper": "^8.0.2",
    "nekos.life": "^2.0.7",
    "quick.db": "^7.1.1",
    "request": "^2.88.2",
    "simple-youtube-api": "^5.2.1",
    "superagent": "^6.1.0",
    "twemoji-parser": "^13.0.0",
    "weather-js": "^2.0.0",
    "ytdl-core": "^4.2.1"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/HYPEDemonXD/secret.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/HYPEDemonXD/secret/issues"
  },
  "homepage": "https://github.com/HYPEDemonXD/secret#readme"
}```
pale vessel
#

Remove that leading comma

#

Under license

prime glacier
earnest phoenix
#

position 108
hmm

#

should be somewhere in dependencies

prime glacier
#

what to do can someone help please Sad

earnest phoenix
#

Lemme try parse with my bot

#

If it parses fine idk what's causing error

pale vessel
#

E

hasty mulch
#

Anyone know how to fix an Error 13 on a Raspberry Pi via Terminal?

earnest phoenix
#

69%

#

@prime glacier it's in the test script

eternal osprey
crimson vapor
#

im not a fan of the massive lists

#

some formating would go a long way

hollow sedge
#

Maybe organize them into categories

umbral zealot
#

that bright red/orange bar with almost unreadable menu items is a no from me.

earnest phoenix
#

Hi, how can I convert an emoji format to the emoji name
Like ![upvote](https://cdn.discordapp.com/emojis/778416296630157333.webp?size=128 "upvote") => upvote
I don't know regex zoomeyes

sudden geyser
#

Your library may already provide a regex for you. What library are you using?

#

The regex is quite simple though.

earnest phoenix
#

discord.js

sudden geyser
slate grotto
earnest phoenix
#

yea I already did that .replace(/<?(a)?:?(\w{2,32}):(\d{17,19})>?/g, '') but I can only replace the emojis from the message

#

I want to convert an emoji format to an emoji name

#

so? thonkku

sudden geyser
earnest phoenix
#

Thanks! hashflushed

#

It worked, thanks again

crimson vapor
earnest phoenix
solemn latch
#

why are you using .mentions.members if you need the user

earnest phoenix
crimson vapor
#

why are you using like 3 if statements when you could use 1 map

umbral zealot
#

So get the mentions.users.first()

umbral zealot
#

yo'ure probably getting an error because the member isn't cached.

earnest phoenix
#

um

#

i try

crimson vapor
#

mentions doesn't fetch the user?

#

wow

tired panther
#

What is the lightest node js ide?

#

for discord js

solemn latch
#

nodepad

earnest phoenix
mellow kelp
#

you have to check if the message actually has mentions

solemn latch
#

are you checking if any members are mentioned first?

tired panther
mellow kelp
#

just check the size

#

it's not that hard

earnest phoenix
#

Okay

#

.-. i don't know how. Im an idiot

crimson vapor
mellow kelp
#

yes

solemn latch
earnest phoenix
tired panther
crimson vapor
#

how

#

vsc is so light

mellow kelp
#

except when you install

#

69k+ extensions

crimson vapor
#

well

#

dont tho

mellow kelp
#

yea

#

but for quick stuff i just Right click -> Edit with notepad++

crimson vapor
#

for quick stuff ill use vsc

#

because fast

mellow kelp
#

makes sense

umbral zealot
mellow kelp
#

my laptop takes ages to boot up vscode KEKW

earnest phoenix
crimson vapor
#

LOL

mellow kelp
umbral zealot
#

I should have not fixed it. oh well.

mellow kelp
#

im not going to spoonfeed ya

crimson vapor
#

my laptop opens vsc instantly

earnest phoenix
mellow kelp
crimson vapor
#

I have a mac air 2015

umbral zealot
crimson vapor
#

running linux

mellow kelp
#

pog

#

now im trying to exit a tmux session with a running process

#

help

crimson vapor
#

fun

mellow kelp
#

wait i did it

#

nvm

crimson vapor
#

idk how to do client side rendering so im making my pages server side

mellow kelp
#

i dont understand it either

solemn latch
#

isnt server side rendering harder 🤔

mellow kelp
#

but react router dom does it for me so

crimson vapor
#

is it?

#

idk

#

maybe I mean different things

mellow kelp
#

ig its less resource intensive to use client-side rendering

#

you just send the files once

#

and the client renders different stuff depending on the route or something

crimson vapor
#

does anyone like doing meta tags?

rapid wave
mellow kelp
#

if its for opengraph, yes

rapid wave
crimson vapor
#

whats opengraph?

crimson vapor
mellow kelp
#

this thing some websites use for displaying content preview

#

like

#

when you send a link on discord

crimson vapor
#

o

mellow kelp
#

This

crimson vapor
#

yeah thats what I mean

umbral zealot
crimson vapor
#

I need to do that

mellow kelp
#

<meta name="og:title" content="Epic Website" />

crimson vapor
#

yea

mellow kelp
#

i think it was something like that

#

yea

umbral zealot
crimson vapor
#

it seems like so much work to do it for like 10 pages

rapid wave
#

its too big

crimson vapor
#

ok

earnest phoenix
#

![z4_BalanceLogo](https://cdn.discordapp.com/emojis/782995046605127721.webp?size=128 "z4_BalanceLogo") Why its not working?

earnest phoenix
rapid wave
#

guys can someone help me?

#

my background photo doesnt fit to website

crimson vapor
#

SPAs?

umbral zealot
#

"single page applications"

serene knoll
#

🇦🇿

earnest phoenix
#

that

crimson vapor
#

oh

#

wow

#

cheating

umbral zealot
#

Basically make your damn site in React and stop editing each HTML file separately 😂

#

damn pleb

crimson vapor
#

ejs go brrrrr

umbral zealot
#

EJS is like PHP templates for javascript

earnest phoenix
#

react is jsx

#

so fun

#

it feels like a fever dream

umbral zealot
#

It's 2020 if you don't want to get laughed out of a tech interview for "making ejs sites" better start learning React or Vue.

mellow kelp
#

yo how about this framework

#

looks very epic to me

crimson vapor
#

LOL

modern summit
#

Hey i need help setting up the webhooks for voting data (Python)

midnight imp
#

sa

slate grotto
#

as

#

knk v12 olduğunu nasıl anlıyorusn

midnight imp
#

const x = new Discord.MessageEmbed()

#

embed messagembed olarak tanımlanmış

earnest phoenix
#

Dont talk Turkish in here

midnight imp
#

v11de richembed diye tanımlanır

#

oh okey

slate grotto
#

@midnight imp saol knk ❤️

midnight imp
eternal osprey
hollow sedge
#

use bulleted lists or a table?

crimson vapor
#

tables are cool

eternal osprey
crimson vapor
#

- commandName

eternal osprey
#

owh no i get it.

#

i thought that it was part of top.gg but it's html.

hollow sedge
#

thats markdown

#

what million sent

#

you can use html or markdown

earnest phoenix
#

anyone can help me?

#

how do i do to test vote?

crimson vapor
boreal flume
#

Can anyone teach me how to use discord OAUTH-2?

split hazel
#

anyone know the best redis lib for nodejs?

cyan sand
#

So i need vps advice, i have my bot on 200+ servers atm and my cpu is lagging behind with all the calls it receives, i was thinking of using with galaxygate or vultr but im not sure on either or if theres a better option what do y'all use?

young flame
#

shivaco is certainly enjoying himself smh

earnest phoenix
#

lmfaoo KEKW

young flame
#

@earnest phoenix it gets even better

earnest phoenix
#

LMFAOOO

young flame
#

i cant bruh

willow mirage
#

Sup

#

what is going on here ?

willow mirage
young flame
#

yea

willow mirage
#

DAMM

#

that is fricking nice

young flame
#

well the chat command is using googles adaptive api

willow mirage
#

oh

#

i thought u made the AI

#

bruh

young flame
#

eh

#

i did

#

kinda

willow mirage
#

like u programm all of the AI

#

not using any API

young flame
#

most of the responses are from the api i made

willow mirage
#

but it is nice

#

bot

young flame
willow mirage
#

nice

young flame
#

i use adaptive for like auto monitoring chats

willow mirage
#

well it is not AI

#

it is ML

young flame
#

ye

willow mirage
#

machine learning

#

ye

young flame
#

LMFAO

#

to a bottum

#

hes been typing for atleast 5 mintues

earnest phoenix
willow mirage
#

wait it is learning or wha

earnest phoenix
#

im not going to sleep so i can see this lmfaoo

willow mirage
#

but it is kinda nice bro

young flame
#

hes convinced it he is god

willow mirage
#

LMAO

young flame
#

KEK oh god

willow mirage
#

i see

#

it is Python right ?

young flame
#

nope

#

97% djs

earnest phoenix
#

@young flame i wanna join that server just to see shiv talking to the bot

willow mirage
#

WHAT

#

i thought Shivaco is py

earnest phoenix
#

pog

willow mirage
#

so?

young flame
#

he just joined to help me test commands

ember crystal
#

my bot got in

boreal flume
#

Does anyone here want to team up with me to create a game bot?
Language => Discord.js

gilded olive
#

Pog

young flame
#

@earnest phoenix lmfao

gilded olive
#

E

boreal flume
#

I can do that

#

It's been a while since I worked with py tho lmao

young flame
gilded olive
#

What game?

young flame
#

i cant bruh

#

wtf "howls"

gilded olive
#

"howls"

boreal flume
#

Just a game, we can come up with our own concepts

young flame
#

this is the best thing ever

boreal flume
#

LMFAO

earnest phoenix
#

might as well jump into UE

#

why do people restrict themselves to discord but get these amazing ideas for games

young flame
boreal flume
young flame
boreal flume
boreal flume
#

LMAO

young flame
#

he said poggers it said not you

boreal flume
#

LMFAO

mellow kelp
weak parrot
#

What?

young flame
boreal flume
young flame
mellow kelp
#

lmao same

#

i need to see this by myself

stable nimbus
#

So I get this error when I run my administrative command, and as far as I can tell noting is wrong, but the block of code that it is referencing is definitely strange, as its referencing my custom prefix block.

const prefixes = await botdb.queryPromise(`SELECT * FROM server WHERE serverid = ${message.guild.id}`).then(async function(results){
            if(!results[0].prefix) {
                return config.prefix;
            }
            else {
                return results[0].prefix;
            };
        }); 

Help

eternal osprey
#

hey

#

how do i change the border color of tables?

earnest phoenix
#

you should also sanitize your queries

stable nimbus
#

It is however.

earnest phoenix
#

🤔

stable nimbus
#

Running it in a private discord server.

earnest phoenix
#

are you on v12?

stable nimbus
#

Latest

earnest phoenix
#

huh

#

log the message object

stable nimbus
#
[2020-12-20 15:32:37.796]: LOG I have updated fuzzyfurry069#0420's command count!
Lifetime Commands: 276,
Daily Commands: 276
[2020-12-20 15:32:37.798]: LOG I have ran: .help
[2020-12-20 15:32:37.799]: LOG Server Info: Discord Bot Test, 681643102787862530,
Encode URI: Discord%20Bot%20Test,
Message Author: fuzzyfurry069#0420,
Encode URI: fuzzyfurry069#0420

It logs everything as it should be though.

earnest phoenix
#

are you using intents?

stable nimbus
#

smol brain

young flame
#

shivaco is apparently marrying it so thats that

stable nimbus
#

discord.js v12.5.1

earnest phoenix
young flame
#

lmao

odd stratus
#

Does anyone know how to get a MongoDB's latency and have it show up in a ping command

earnest phoenix
drifting wedge
#

how can i get my website to show up when u google it?

#

rn it does, but its like bottom bottom

#

for it to sho

mellow kelp
#

i'd like to know too KEKW

drifting wedge
#

some pages are invalid

#

@earnest phoenix

earnest phoenix
#

yeah quite a bit

#

sec

drifting wedge
#

wait tho

#

those pages r fine

#

how can i get it to show up higher?

earnest phoenix
#

SEO

drifting wedge
#

i have the keywords im looking for

earnest phoenix
drifting wedge
#

so basically just need people using it now

#

?

earnest phoenix
#

and do proper SEO

drifting wedge
#

ye

#

like traffic is the main thing right?

earnest phoenix
#

yes

#

to get traffic in the first place you need to have good SEO

#

check out google lighthouse

#

tells you what google doesn't like about your site

drifting wedge
#

92 seo

#

86 best practicies

#

80 accessibility

#

92 preformance

#

@earnest phoenix

earnest phoenix
#

pretty good

drifting wedge
#

so im happy

hollow sedge
#

they probably lost out on performance huh

gilded olive
#

Make sure to fill your description

#

And there must be only like 1 h1 tag

#

Google detects if you just spam h1