#development

1 messages · Page 1867 of 1

earnest phoenix
#

How to fix buttons like when click on buttons next page show

rose warren
#

Global slash commands are cached for 1h. To test a slash command, use a guild-specific slash command. Those update immediately. Then when you're ready to deploy to your users, make it a global slash command.

earnest phoenix
#

I have this problem since yesterday @rose warren

#

Like this way is spam

earnest phoenix
#

@earnest phoenix actually i also help h python

#

Precisely I do not know how to do despite my multiple research @rose warren

#

if you can tell me how pls ?

#

(if you know)

rose warren
earnest phoenix
#

đŸ„Č

#

How to fix this code

quartz kindle
#

what is the problem?

earnest phoenix
#

@rose warren

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const config = require("../config.js")

module.exports = async (client) => {

    const rest = new REST({ version: '9' }).setToken(config.token);
    (async () => {
        try {
            console.log('Chargement des commandes (/)');
    
            await rest.put(
                Routes.applicationCommands("myclientid"),
                { body: client.commands },
            );
            await rest.put(
                Routes.applicationGuildCommands("myclientid", "834472071559512104"),
                { body: client.commands },
            );
    
            console.log('Chargement des commandes (/) effectué');
        } catch (error) {
            console.error(error);
        }
    })().then(() => {

        client.application?.commands.set([
            {
                name: "ping",
                description: "Affiche la latence."
            },
            {
                name: "help",
                description: "Affiche la page d'aide."
            }
        ])
        console.log("Le bot est prĂȘt !")
    })

};```

I did as you told me and it's good I see nothing, now I want to put some but it does not appear in my slash commands
near stratus
earnest phoenix
#

?

#

why do you send me this

near stratus
#

"How to delete a global command"
you asked this

quaint seal
#

Where do I go to get a ticket bot

near stratus
quaint seal
#

Thank you

earnest phoenix
#

but now when i want to create a slash command, doesn't create :/

near stratus
earnest phoenix
#

Did you wait an hour ? - no

#

What was the error ? - no

#

Is it guild command or global ? - global

#

i will try in guild

near stratus
#

Global commands may take upto an hour to update
Wait some time

earnest phoenix
#

ok

near stratus
#

Use guild commands for testing

earnest phoenix
#

yes thc

near stratus
#

They're instant

earnest phoenix
#

x

wheat mesa
#

(And DMs too!)

near stratus
near stratus
wheat mesa
#

Not specific to DMs, but slash commands load instantly in DMs

near stratus
#

ooh

wheat mesa
#

You can add in your own logic to make certain commands only usable in DMs though

earnest phoenix
#

Its work but

#

when i try to create a new command, the slash command appears but he respond me "Interaction failure"*

#
guild.commands.set([
            {
                name: "ping",
                description: "Affiche la latence."
            },
            {
                name: "help",
                description: "Affiche la page d'aide."
            },
            {
                name: "test",
                description: "test"
            }
        ])```
#

and the interaction reply it's created for this slash command

#

I have the impression that the command is not recognized by the bot, yet it is there since it displays it to me in the slash command

#

yes! when i log client.commands.get(commandName); (commandName is the commandName option in interactionCreate event, so it's the name of the interaction) he send me undefined

#

same problem when i use .create() method

#

so if u have an solution ? @near stratus

eternal osprey
#
 if (reaction.emoji.name === "🌯" && user.id !== client.user.id) {
      reaction.users.remove(user)
      console.log(user.id)
      let pipo = makeid(5)
         channel1 = await message.guild.channels.create(`🌯${pipo}`, {
     
            type: 'text',
            permissionOverwrites: [
              {
                id: rolehello, 
                deny: ['VIEW_CHANNEL']
              },
              {
                id: message.guild.id, 
                deny: ['VIEW_CHANNEL']
              },
              {
                id: user.id,
                allow: ['VIEW_CHANNEL']
              },
            ]
          });
          channel1.send(embed2).then(m => m.react(`đŸ—‘ïž`));
        
      


        }```why is this damn code creating multiple channels each time?
earnest phoenix
#

Anyone help me to fix buttons code

azure lark
#

is this correct?
await client.application.commands.set(slash)
as i am getting an error telling me commands in not defined

tulip ledge
azure lark
#

do i have to have to guild input?

tulip ledge
#

no

#

guild is optional

azure lark
#

if i dont input guild will it work on any guild

tulip ledge
#

yes

azure lark
#

alr

hybrid cargo
#

check if u have the process running on more than 1 terminal

eternal osprey
#

nope that's not the thing

earnest phoenix
#
module.exports = {
    name: 'kill',
    aliases: ['Kill'],
    description: "Kill a user",
    execute(client, message, success, failed, args, Discord){
        
        let userN =  message.mentions.users.first()
        const killArray = ["flew too close to the sun and died", "died by forgetting how to breathe", "died attempting to eat Sofa's cooking", "died after calling Zaz flat", "got hit by a car that ran into their house", "died after begging for admin perms", "commited toaster bath", "got sick and tired of the server owners constant bullying and got banned attempting to talk about it", "died"];
        const randKill = killArray[Math.floor(Math.random() * killArray.length)];

        const killArray2 = ["died attempting to hug", "was shot to death for peeking at", "went missing after exposing", "died after eating food made by", "died after receiving a kiss from"];
        const randKill2 = killArray2[Math.floor(Math.random() * killArray2.length)];

        if (!userN){
            message.channel.send("Kill someone else not yourself");
        }  else {
            message.channel.send("**" + userN.username + " " + randKill + "**" || "**" + userN.username + " " + randKill2 + " " + message.author.username + "**")
        }
    }
}
``` my kill command doesnt work ![sotired](https://cdn.discordapp.com/emojis/725574482022105158.webp?size=128 "sotired") 
This is the error I'm getting 

```let userN =  message.mentions.users.first() || message.guild.users.cache.get(args[0]);
                                      ^

TypeError: Cannot read property 'users' of undefined
#
îș§ npm start
npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-09-05T10_35_17_716Z-debug.log
exit status 1
#

What is that error

hybrid cargo
hybrid cargo
earnest phoenix
#

Code

hybrid cargo
#

The code is not the problem

#

Try npm run start

earnest phoenix
earnest phoenix
# hybrid cargo Try `npm run start`
npm run start
npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-09-05T10_37_53_594Z-debug.log
îș§
hybrid cargo
#

Yes, u do not have a script named "start"

earnest phoenix
hybrid cargo
earnest phoenix
hybrid cargo
earnest phoenix
thin bramble
#

Hello! Sorry if this is the wrong channel but my bot currently runs on replit.com and needs significant storage space to store images. I purchased the hacker plan to get 5gb of storage and that has now run out so I am looking for a simple cloud storage that can be accessed, read and written to with python. If anyone knows of any please either dm me or reply to this message so I get a notification. Thanks so much 😄

clever agate
#

you are wearing?

#

@earnest phoenix which version of Discord.js are you using?

earnest phoenix
#

I used the same on my v13 one and tried every possible thing sotired

split hazel
#

there it is

#

v12 is completely different from v13

#

you sure you ported everything?

earnest phoenix
# split hazel you sure you ported everything?

yeah earlier used to get errors when I ran the node . command. But now with this ( downvote ) I am not getting error until I run the kill command, bot starts properly

module.exports = {
    name: 'kill',
    aliases: ['Kill'],
    description: "Kill a user",
    execute(client, message, success, failed, args, Discord){
        
        let userN =  message.mentions.users.first();
        const killArray = ["flew too close to the sun and died", "died by forgetting how to breathe", "died attempting to eat Sofa's cooking", "died after calling Zaz flat", "got hit by a car that ran into their house", "died after begging for admin perms", "commited toaster bath", "got sick and tired of the server owners constant bullying and got banned attempting to talk about it", "died"];
        const randKill = killArray[Math.floor(Math.random() * killArray.length)];

        const killArray2 = ["died attempting to hug", "was shot to death for peeking at", "went missing after exposing", "died after eating food made by", "died after receiving a kiss from"];
        const randKill2 = killArray2[Math.floor(Math.random() * killArray2.length)];

        if (!userN){
            message.channel.send("Kill someone else not yourself");
        }  else {
            message.channel.send("**" + userN.username + " " + randKill + "**" || "**" + userN.username + " " + randKill2 + " " + message.author.username + "**")
        }
    }
}

clever agate
delicate shore
#

can I get attachments from a slash command
or is it not possible

median raft
#

What would be the hosting server location for my bot?

rose warren
#

Your vps, replit, heroku, pc... Wherever you're hosting it

low bone
#

avatarURL is function

#

Add () to the end

clever agate
#

and also you can: js message.author.avatarURL({dynamic: true});

earnest phoenix
#
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const config = require("../config.js")

module.exports = async (client) => {

    const rest = new REST({ version: '9' }).setToken(config.token);
    (async () => {
        try {
            console.log('Chargement des commandes (/)');
    
            await rest.put(
                Routes.applicationCommands("883621594877009921"),
                { body: client.commands },
            );
            await rest.put(
                Routes.applicationGuildCommands("883621594877009921", "834472071559512104"),
               { body: client.commands },
            );
    
            console.log('Chargement des commandes (/) effectué');
        } catch (error) {
            console.error(error);
        }
    })().then(() => {
        const guild = client.guilds.cache.get("834472071559512104")
        guild.commands.set([
            {
                name: "ping",
                description: "Affiche la latence."
            },
            {
                name: "help",
                description: "Affiche la page d'aide."
            },
            {
                name: "test",
                description: "test"
            }
        ]).then(() => {
            console.log(`${client.commands.size} commandes ont étées chargées.`)
        })
    });
};```

I actually use guild slash command, only 2 command of 3 worked on my bot (help and pi,g) but the test slash command doesn't work, why?
When my bot is ready, i log the count of commands and he say me 2 and not 3... why ? someone can help me pls thx
#

What is the command to install discord.js v12

eternal elbow
#
/**
   * What is this
   * @param {UserID} invite Invite code or URL
   * @returns {Promise<Message>}
   * @example
   * exmaple.function({});
   */

How exactly are they used or what is their full name?

azure lark
#

i am trying to make a file inside of a file using fs but it dosent seem to work, this is the code i am using

        if (err) {
            throw err;
        }
});```
but its not creating the files, can anyone help?
eternal elbow
azure lark
#

what?

eternal elbow
azure lark
#

never hear of a folder my file, what is it?

eternal elbow
azure lark
#

yes

#

are you asking if im trying to make a folder?

eternal elbow
#

Now, back to our question, are you trying to create a folder or my file?

eternal elbow
azure lark
#

well, yes,

#

im trying to make a folder inside a folder

eternal elbow
#

If youre trying create file use fs.writeFile

azure lark
#

im trying to make a folder not a file

eternal elbow
azure lark
#

no

quartz kindle
#

use recursive: true

eternal elbow
quartz kindle
eternal elbow
#

I was going to write exactly that

azure lark
#

like,

        if (err) {
            throw err;
        }

});```
#

?

quartz kindle
#

yes

azure lark
#

okay

quaint wasp
#

what the heck is this Error: \\?\C:\My Projects\ella\ella\node_modules\canvas\build\Release\canvas.node is not a valid Win32 application.

#

its the latest version...

azure lark
quaint wasp
#

ping in replies

quartz kindle
#

creates a folder and all parent folders if they dont exist

quartz kindle
quaint wasp
#

yea

quartz kindle
#

you cant do that

#

delete it

quaint wasp
#

oh-

#

alr

#

whoa

#

frick

alpine lagoon
#

Help.

earnest phoenix
#

it is used for typescript intellisense and generating documentation

near grotto
#

I am getting this error when I'm trying to set a playlist thumbnail as an embed thumbnail

wheat mesa
#

Seems like it couldn’t interpret the url as it said

rose warren
wheat mesa
#

Yeah you’re inputting an object and all it wants is a string

#

My brain didn’t read past the part where it said “as string”

coarse topaz
#

Hi, how can I know if it's the first or the second time a user has reacted to a message? (With different reactions) - discord.js

quartz kindle
#

reactions have a .count property

coarse topaz
#

couldn't find something similar by checking docs, but sure, will try it out!

earnest phoenix
wheat mesa
#

discord isn’t defined

#

Idk much about python but you’re supposed to import the discord module before trying to use it

wheat mesa
#

You didn’t import it in your file

earnest phoenix
#

How to import?

wheat mesa
#

You can just install a package and expect to it magically work, you have to import it

#

Something like “from discord import discord”

#

But I don’t use python

#

So I don’t really know

coarse topaz
#

@earnest phoenix Just did some search on google and looks like you've to put
import discord
at the beginning of your code

wheat mesa
#

I recommend learning the language before trying to make a discord bot

timid lily
#

are there any bot devs using djs sharding here

coarse topaz
timid lily
#

djs says "Sharding is required" even though i do shard

#

config.shards is set to 3 atm

quartz kindle
#

how many guilds is your bot in?

timid lily
#

2.6k

#

thats why it says that

#

and i cant start it up any more

modest maple
#

and how many shards did you define in config?

quartz kindle
#

show your main.js

timid lily
timid lily
#

it works on my pc but not my vps

modest maple
#

I have a question. Is this bot, using slash commands hmm

quartz kindle
#

is there anything else here?

timid lily
quartz kindle
#

i mean inside the client config

timid lily
#

but that doesnt matter it worked before

timid lily
#

the bot works just sharding doesnt

quartz kindle
#

remove the totalShards option

#

since it defaults to auto anyway

timid lily
#

but auto doesnt work

quartz kindle
#

it should?

#

why doesnt it work

timid lily
#

when i put in auto

quartz kindle
#

are you using any env variables?

timid lily
#

no

#

do i need to pass token?

quartz kindle
#

for auto i think so yes

timid lily
#

bruh

#

great that thats documented

brave garnet
#

:| i see that today this channel is also busy? okeh, bye

timid lily
#

now it says this

#

okay lets see

#

no, still the same

quartz kindle
#

you're on v13 right?

timid lily
#

yes

slim heart
#

when you initialize your Client pass a shards option that’s equal to [0, 1]

timid lily
#

uh what

quartz kindle
#

console.log(process.env) in your main.js

timid lily
#

it has the token in it

slim heart
#

oh i see oops

quartz kindle
#

see if you find SHARDING_MANAGER in it

timid lily
slim heart
#

well how many shards are running also? cuz if it’s only like 2 you should just do internal sharding

timid lily
#

but not even that works

slim heart
#

you can just ditch the sharding manager and use internal sharding

timid lily
inland locust
#

Hello! :>

timid lily
feral aspen
#

Why the lines?

timid lily
#

can somebody create a thread

slim heart
quartz kindle
#

is SlashBot a regular discord.js?

#

or a different package

timid lily
#

djs

#

normal one

quartz kindle
#

console.log(client.options)

#

does it have shards and shardCount?

timid lily
#

wait

#

no

quartz kindle
#

it doesnt?

timid lily
#

wait

#

yes

#

3

boreal iron
slim heart
#

you’re doing client.login right?

timid lily
timid lily
slim heart
#

just makin sure

timid lily
#

the bot worked fine before

quartz kindle
#

wait

timid lily
#

just sharding broke

quartz kindle
#

why 0,1,2? since when does the manager do that?

timid lily
#

i did that

brave garnet
#

when will conversation end?

quartz kindle
#

wut

timid lily
slim heart
#

no the shards option is only for internal sharding

#

i said that’s an alternative

timid lily
#

okay what now

slim heart
#

if you wanted to do that you would just run the client exactly the same and scrap the sharding manager

quartz kindle
#

well decide, you want the sharding manager or internal sharding?

timid lily
#

i dont care

#

it just has to work

quartz kindle
#

then use internal sharding lol

timid lily
#

yeah how

coarse topaz
# quartz kindle reactions have a .count property

Just realized it's not what I'm exactly looking for
I'd rather know if there's a second reaction (given by a specific user) in the whole collection, if there's, then remove the first reaction given by that user, and leave the second one... I'm testing with .first() but I can't get it yet

quartz kindle
#

shards: "auto" in main.js

#

and run node main.js

#

delete the manager file

brave garnet
#

:/

#

no no, talk talk, it was just emoji, i didnt wanted to interrupt your conversation, its okay :')

timid lily
#

and how to with sharding manager

mild umbra
#

um question how do i receive a request or something when someone votes? like would i just await or idk how to do that

timid lily
#

because this would be only temporary

quartz kindle
timid lily
#

it just said "Sharding required"

quartz kindle
#

i wanted to check if the manager is setting the client shards correctly

timid lily
#

it literally spammed it

#

wait

#

could it be that my host doesnt like env

#

that djs breaks bc of that

quartz kindle
#

the env was working, we tested it

timid lily
#

on my pc

#

not on my vps

quartz kindle
#

?

#

where is it not working?

#

pc or vps

timid lily
#

vps

quartz kindle
#

but pc works?

timid lily
#

it works fine on pc

#

with same token

quartz kindle
#

then test on vps

#

not on pc

timid lily
#

i cant

quartz kindle
#

wat

timid lily
#

i gave my friend the code

#

and he hosted it

quartz kindle
#

dude

timid lily
#

i dont have any access

quartz kindle
#

if you want to troubleshoot why something doesnt work on the vps, you have to test it on the vps

#

no way in hell you gonna figure out why it doesnt work on the vps if it works on the pc

timid lily
#

yeah i cant

boreal iron
#

poor Tim

brave garnet
#

you ended talking? or i should go playing slitherio?

rose warren
quartz kindle
#

its possible the vps doesnt like the sharding manager, especially if its one of those shitty pterodactly panels or whatever

#

but you cant do anything if you dont have access

brave garnet
rose warren
#

Maybe you needed to provide more context

brave garnet
rose warren
#

Just ask

#

If someone can help you they will

brave garnet
#

i dont think so. and okay. continue your talking. sorry for my msgs =p

rose warren
brave garnet
#

do your great work. mine isnt even good. bye

#

i go playing slither =p

timid lily
quartz kindle
#

good luck

brave garnet
#

ye, good luck \😉

#

\😉

jovial nexus
#

how can i see how many active voice connections my bot has with djs v13?

signal estuary
#
let message = msg.channel.send({ content: "test" })
ERROR: message.edit() is not a function
quartz kindle
#

await msg.channel.send

brave garnet
quartz kindle
#

no

brave garnet
#

? await ctx. ... is in pithon...
WAT ?!

quartz kindle
#

many languages have the await keyword

brave garnet
#

D:

#

and weird signs like >= or }; ?

quartz kindle
#

yes

brave garnet
#

;-;

quartz kindle
#

most languages have them

brave garnet
#

except of pithon where arent weird signs. oof

median raft
#

Where does one accept an invitation to the App whitelist of a discord bot?

quartz kindle
#

there are

brave garnet
#

and now isnt there any other conversation in background? or i should start streaming slither in #609604489900589066

simple stump
#

I'm trying to check if an user reacts with ✅ or the red cross (can't get the emoji lol), but when reacting, nothing happens. I don't get a reply or anything.
Code:

client.on('messageCreate', async message => {
    if (message.content === `${prefix}test`) {
        await message.reply("this is just a test lol");
        message.react('✅').then(r => {
            message.react('❌');
        });

        const filter = (reaction, user) => {
            return ['✅'].includes(reaction.emoji.name) && user.id === message.author.id;
        };

        message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '✅' || reaction.emoji.name == '❌'),
            { max: 1, time: 30000 }).then(collected => {
                if (collected.first().emoji.name == '✅') {
                    message.reply("yes")
                } else {
                    message.reply('idk');
                }
            }).catch(() => {
                message.reply('No reaction after 30 seconds, operation canceled');
            });
            }
});
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('884081521839976498');

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

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

djs v12 no errors at all just the message wont send

quartz kindle
#

did you check if the event is even received?

#

do you have the guild members intent?

signal estuary
#
                    collector.on('collect', (ButtonInteraction) => {
                        let id = ButtonInteraction.customId

                    })

How can I get a button by ID. So I dont want to get the button I clicked. I want to get a specific button (in the buttonRow, too), so I can disable him
So is there a: ButtonInteraction.getButtonByID('') function or sth like that?

hollow loom
#

@Tim#2373 its djs v12

#

do i still need it

brave garnet
hollow loom
#

who pong

brave garnet
#

ping pong?

sick fable
#
Now attempting to load all the command handlers.
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found```
#

why is that?

quartz kindle
#

if you are not using the intents client option in your code, it should be enabled by default in v12, but still needs to be on in the dev portal

hollow loom
#

oh okay thanks

brave garnet
#

all things done or i should make a second stream with slither?

slender thistle
quartz kindle
#

dude just ask your question

brave garnet
#

okeh. stream :/

sick fable
#

đŸ˜©

slender thistle
#

Fun

#

Show your cog commands and how you load it

sick fable
# slender thistle Show your cog commands and how you load it
import discord
from discord.ext import commands
import random

class fun(commands.Cog):
	
	def __init__(self, client):
		self.client == client
		
	@commands.Cog.listener()
	async def on_ready(self):
		print("Successfully logged into the bot")
	@commands.command()
	async def ping(self, ctx):
		 await ctx.send("Pong!")
	
	@commands.command()
	async def _8ball(self, ctx, *,question = None):
		if question == None:
			await ctx.send(f"{ctx.author.mention}, Please mention a question.")
			
		else:
				answers = ["No.", "Never gonna happen.", "Shut the fuck up bitch.", "I don't know.", "Maybe.", "Yes.", "Defenitely gonna happen.", "Aw hell nah."]
				embed = discord.Embed(title = "8Ball", colour = discord.Colour.green(), timestamp = ctx.message.created_at)
				embed.add_field(name = "‱Question", value = f"_{question}_", inline = False)
				embed.add_field(name = "‱What I say", value = random.choice(answers), inline = False)
				embed.add_footer(text = f"Requested by {ctx.author.name}")
				await ctx.channel.send(embed = embed)
			
	
	
def setup(client):
	client.add_cog(fun(client))
#

idk if you remember me 😭

#

came on python since yesterday

slender thistle
#

That makes sense, okay

#

Now, how do you load the extension?

feral aspen
#

Hey.. quick question, sorry to interupt. Did I do something here wrong?

let string = "Ayo";

let replacing = (input) => {
  input.replace('Ayo', 'Oof');
  return input;
};

console.log(replacing('Ayo')) // Ayo
slender thistle
#

.replace returns the modified version probably

#

as opposed to modifying the original string

sick fable
slender thistle
#

Huh

#

Do the other commands work in that cog though?

#

hold on

slender thistle
#

here

wheat mesa
#

You can do ```js
let string = "Ayo";

let replacing = (input) => {
input = input.replace('Ayo', 'Oof');
return input;
};

console.log(replacing('Ayo')) // Oof

sick fable
#

Just focus on the code line lmao

earnest phoenix
#

Does it make sense to make a web page with nodejs?

sick fable
#

and here's my full code:

import discord
from discord.ext import commands
import os


client = commands.Bot(command_prefix = "--")


filecount = 0
@client.command()
async def load(ctx, extension):
	for filename in os.listdir('./commands'):
		if filename.endswith == ".py":
			client.load_extension(f"cogs.{extension[::-3]}")

filecount = 0
@client.command()
async def unload():
	for files in os.listdir('./commands'):
		for filenames in files:
			filecount += 1
			if filenames.endswith == ".py":
				client.load_extension(f"{cogs.filenane[::-3]}")
				print("Unloaded all the commands.")
				
	await ctx.send(f"I have unloaded {filecount} number of files.")
	filecount = 0
	
@client.command()
async def reload():
		for files in os.listdir('./commands'):
			for filenames in files:
				filecount += 1
				if filenames.endswith == ".py":
					client.unload_extension(f"{cogs.filenane[::-3]}")
					client.load_extension(f"{cogs.filename[::-3]}")
					print("Reloaded all the commands.")
					break
					
					await ctx.send(f"I have reloaded {filecount} number of files.")
					
	
client.run('Token')
sick fable
#

but it's a pain in the ass to code a webpage using nodejs

brave garnet
#

-_- okeh. i'll go to other server -_-
-_- bye -_-

boreal iron
#

Read the fucking channel etiquette and stop bitching around

brave garnet
earnest phoenix
#

swearing is not against the rules, before reporting be sure the member is actually breaking rules.

brave garnet
#

;-;

brave garnet
#

anyways - continue your discussion

#

im not here

boreal iron
#

That’s the price for not banning kids of Discord đŸ€Šâ€â™‚ïž

brave garnet
#

?

quartz kindle
#

if someone can help you, they will

boreal iron
#

Acting like 9

modest maple
brave garnet
#

not a kid but not yet adult. this is in my country =p

pallid jungle
#
          if (message.mentions.has(client.user)) {
            message.reply({ content: `Yo` });
        }
#

If i mentioned here, everyone, or replied to the bot it will send the message

boreal iron
#

U wanna probably search the user mentions

brave garnet
digital ibex
#

thats a google question

brave garnet
#

nope. cause pithon at me is 3.8 , not 3.3

#

and its not at google

#

anyways - i'll ask someone on dm in tweeter, maybe will get answer faster :/

sick fable
#

I'm autistic

#

I was gonna add the {} after cogs but thanks for pointing out my mistake.

slender thistle
#

Did you hide-

#

Okay

#

That was quick

#

Anyhoo you seem to hide some parts of your code

round cove
#

hi

brave garnet
#

hey =]

round cove
#

I was watching chat

slender thistle
#

And if not, some parts aren't making sense

brave garnet
#

same, watching chat

slender thistle
#

Can you like

#

Just get tf outta here if you don't have a question or are helping

brave garnet
#

i was talkin with mod. you get out >:-|

#

[-_-]

slender thistle
#

You're being offtopic FYI

sudden geyser
brave garnet
#

@round cove also offtopic? hes a mod btw

boreal iron
#

How can somebody be that annoying god damn

slender thistle
#

The cogs shit within the snippet you sent

brave garnet
#

me or vedant?

sudden geyser
slender thistle
#

Oh wait no it's a folder

#

What about filename though still

boreal iron
brave garnet
#

;kill Shivaco

#

;kill Vedant

#

oof

sick fable
slender thistle
round cove
sick fable
brave garnet
slender thistle
#

Yeah but where's the loop where you define filename?

round cove
brave garnet
#

anyways bye - i have u mooted so i wont see pings

sick fable
slender thistle
#

Bye and no one cares regardless

sick fable
#

And sorry for wasting both of our time

#

:)

slender thistle
#

Bleh it's fine

brave garnet
#

i'll faster get answer on tweeter than here :/

boreal iron
#

That’s what this channel is made for

brave garnet
#

i dont think so, there are only general channels =]

sick fable
slender thistle
#

For your impatient ass' issue, hacknorris, try retyping the function stuff manually again. If that doesn't work, scroll up and see what can be wrong above

slender thistle
sick fable
slender thistle
#

Get your shit straight and stop scting like a child dude

sick fable
#

Shivaco you gotta chill lol

#

Just ignore and move on lol

#

đŸ€Ł

boreal iron
#

Kids will never learn if you just ignore them

sick fable
#

But they will shut the fuck up if you keep on ignoring them

#

I've tested it on so many 12 year olds online

#

And it works out well

slender thistle
#

Force of habit

sick fable
#

Aah I see lmao

brave garnet
#

:-|

slender thistle
#

Harsh truth over silence, essentially. Anyhoo back to what I was saying

#

@brave garnet your issue could be happening because of syntax error around if not in earlier lines than the interpreter is reporting

brave garnet
sick fable
#

Whats the problem hacknorris

brave garnet
#

do u want all the source?

sick fable
#

Send it up I'll see what I can do

brave garnet
#

moment

slender thistle
#

I just said the error could be caused by something around the reported line and not the line itself

#

Why the pass_context though

brave garnet
#

so why points in d in def?

slender thistle
#

It's redundant since v1.0

brave garnet
slender thistle
#

It doesn't make any difference

brave garnet
#

makes becoz without it wasnt working. and tihs part doesnt stop bot. i dot yet know what ;-;

sick fable
#

@slender thistle I got the error again

#

Cogs not defined

#

Sending the code

#

And I know shit about it rn lmao

#
@client.command()
async def load(ctx, extension):
	for files in os.listdir('./commands'):
		if extension in files:
			client.load_extension(f"cogs.{extension[::-3]}")
lyric mountain
#

Do note, dpy has ceased development

sick fable
#

I know

brave garnet
#

me 2

sick fable
#

I'm just updating my bot with the new codes

#

And will move onto typescript or js soon

brave garnet
#

js is đŸ€ź

slender thistle
#

Py is đŸ€ź

brave garnet
#

?

#

nope

slender thistle
brave garnet
#

and what bout bash?

slender thistle
#

I'm not sure what your directory looks like even

#

Is it cogs/<cog files here>?

slender thistle
sick fable
#

Javascript is meant for website regarding stuff

slender thistle
#

Notice how you put out an opinion without backing it up

brave garnet
#

bye

sick fable
#

And some backend dev

sudden geyser
#

JavaScript wasn't meant for the backend but here we are now

slender thistle
#

Keep your opinions to yourself if you ain't got the brass neck to back them up

sick fable
slender thistle
#

I don't know

slender thistle
#

Show me what your bot folder looks like

sick fable
#

K

#

Its:
./commands/{file}

#

Sending the code

slender thistle
#

Don't need code

#

Need screenshot of your bot folder

sick fable
#

That is it

slender thistle
#

And the commands folder

lyric mountain
#

Shiv means the directory tree

sick fable
#

Hmm holdup

#

my pc is fucked up/has some issues lmao so I'm coding it on my mobile meanwhile KEKW

slender thistle
#

Bleh

sick fable
#

lmfaoo

brave garnet
#

xdd

slender thistle
#

Okay

sick fable
#

I really can't code anything on my pc atm

slender thistle
#

So let me explain this

sick fable
#

it's like gone for repairing and all

#

so I'm coding it on mobile for some days KEKW

slender thistle
#

Whatever is considered an extension discord.py will import in a Python import-like manner

sick fable
#

aah

wooden kindle
#

im kinda new to using mongo how do i find my mongoURI

lyric mountain
#

Isn't that the path to the db?

slender thistle
#

That means if you want to refer to the fun.py file in the commands folder, you will either iterate over the directory's files by getting them via os.listdir (this allows for dynamic extension loading)

or

load_extension where the argument will be commands.fun

slender thistle
#

Because commands dir and fun Python file

sick fable
#

oh shit

#

I deadass got wym rn

slender thistle
#

You don't use cogs or filename outside of your cogs

#

Also, I'd suggest using == instead of in when iterating over the commands directory's contents

#

What I mean more precisely is as follows:

for extension in os.listdir("commands"):
    if extension[:-3] == cog_name:  # Where cog_name is the name of the cog received from the command itself
        bot.load_extension(f"commands.{cog_name}")
sick fable
#

👍

sick fable
#

in and == ig

slender thistle
#

Not exactly

#

in is inclusion, == is exact match

#
'a' in 'damn' is True
('a' == 'damn') is False
#

I'd suggest reading up on Python comparison operators

blissful coral
#

What does process.uptime() return

#

Seconds?

tulip ledge
#

milliseconds iirc

blissful coral
#

no way

boreal iron
#

Seconds

blissful coral
#

ok

#

thanks

tulip ledge
#

alright I'm retarded

boreal iron
#

lol

blissful coral
#

Yeah no way it returns milliseconds LMAO

#

Settings up grafana and influx 👀

boreal iron
#

I wonder why JS works with ms but nodejs with s as default val for the uptime

blissful coral
#

idk

latent quiver
#

Can I ask a js related questions here?

signal estuary
#
                    collector.on('collect', (ButtonInteraction) => {
                        let id = ButtonInteraction.customId

                    })

How can I get a button by ID. So I dont want to get the button I clicked. I want to get a specific button (in the buttonRow, too), so I can disable him
So is there a: ButtonInteraction.getButtonByID('') function or sth like that?

tulip ledge
#

discord also uses seconds

boreal iron
#

I was tricked too last time, don’t worry

slender thistle
boreal iron
tulip ledge
boreal iron
#

JS is just weird

latent quiver
#

I am getting undefined when I print it. But if I print it inside if its printing perfectly

blissful coral
#

Likin it ngl

signal estuary
tulip ledge
#

then save the buttons in an object i guess

#

"id": <MessageButton>

#

then just get the button with obj[id]

signal estuary
#

I will try it

latent quiver
#

okay

#

thanks

signal estuary
# tulip ledge then save the buttons in an object i guess
    let row = new MessageActionRow().addComponents(
        new MessageButton()
            .setEmoji('âȘ')
            .setStyle('SECONDARY')
            .setCustomId('wL'),
        new MessageButton()
            .setEmoji('◀')
            .setStyle('SECONDARY')
            .setCustomId('L'),
        new MessageButton()
            .setEmoji('▶')
            .setStyle('SECONDARY')
            .setCustomId('R'),
        new MessageButton()
            .setEmoji('⏩')
            .setStyle('SECONDARY')
            .setCustomId('wR')
    )

I cant define something inside the addComponents()

tulip ledge
#

then define it outside lol

sudden geyser
latent quiver
tulip ledge
#

yeah didn't notice

#

mb

signal estuary
tulip ledge
#

I use keyv

tulip ledge
sudden geyser
signal estuary
tulip ledge
#

no

latent quiver
tulip ledge
#

you can still do .addComponents(button)

sudden geyser
#

Well do you have a stacktrace

latent quiver
#

no

sudden geyser
#

can you get one

latent quiver
#

whats stracktrace. Let me google it first

lyric mountain
#

the big verbosy error

latent quiver
#

okay I think i can get stack trace

sudden geyser
#

I miss Rust error messages

sudden geyser
brave garnet
#

oh, empty now?

#

okey

#
import discord
from discord.ext import commands
from keep_alive import keep_alive
import json, random, requests, datetime, time, urllib.request, io, os, aiohttp
from datetime import datetime, timedelta
import math
import base64 as b64

intents = discord.Intents.all()
bot = commands.Bot(command_prefix='$', help_command=None, intents=intents)

with open("bad-words.txt", 'r') as f:
    global badwords
    words = f.read()
    badwords = words.splitlines()

@bot.listen("on_message")
async def swears(ctx):
    msg = ctx.content.lower()
    for word in badwords:
        if word in msg:
            await ctx.delete()

@bot.listen("on_message")
async def pingraid(ctx):
  msg = ctx.content.lower()
  if member.mention in msg:
    return

l = []
scam = requests.get(
    "https://script.googleusercontent.com/macros/echo?user_content_key=V1VRkcLy79NqRzGszzki5IwoqgfiRS0CPnpSth1jVdX0Z88w39o7tC71MMkAARMFYXSZIe5ysMkkTdp_V8q-gLFNUefAtxy5m5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnA1zRMJcOWhp5p8-TrasYiLfc8s82yHYvncMdEYM4VMzrAWyr3_vgWcPkd2qwPRs1bz0TAVXLS4Dleb--x_lwbJ0QrOacq8a_9z9Jw9Md8uu&lib=Mvhguv8KrjGlroshaZkuz2rjldAiTUHuJ"
)
Data = scam.json()
for i in Data:
    for key in i:
        l.append(i["put here stean scam: ↓↓↓"])

@bot.listen("on_message")
async def scam(ctx):
    global l
    for thing in l:
        if thing in ctx.content:
            await ctx.delete()

@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Activity(
        type=discord.ActivityType.listening, name="$man command..."))

@bot.command()
async def rm(ctx, arg1):
    channel = ctx.channel
    msg = await channel.fetch_message(arg1)
    await msg.delete()

@bot.command()
async def stat(ctx, member: discord.Member = None):
    if member == None:
        await ctx.send(f"`{ctx.message.author.status}`")
    else:
        await ctx.send(f"`{member.status}`"

@bot.command()
async def rn(ctx, channel: discord.TextChannel, arg1):
    await channel.edit(name=arg1)
#

all error

#

(hoping a god will enter 🙄 )

rose warren
#

You should post your error message too

lyric mountain
#

how does this even work?

#

I don't see member being defined anywhere

brave garnet
#

syntax error -> on line 69 (async def)

pale vessel
#

Nice

brave garnet
earnest phoenix
#

Whats the problem

brave garnet
#

at me or hookahoo?

quartz kindle
earnest phoenix
#

Okay how to solve it

lyric mountain
brave garnet
#

anyways - figured out for myself where i got bug. thk u but u were helpless :/

slender thistle
slender thistle
brave garnet
#

;kill 884131985369481276

slender thistle
#

Glad to hear you solved it yourself but your ass ain't innocent here either

near grotto
#

what prefix should I keep for my bot?

sudden geyser
#

whatever you want

slender thistle
#

Whatever is related to it

sudden geyser
#

but you may end up just using slash commands

slender thistle
#

Or anything convenient

boreal iron
#

You should think about moving to slash commands anyway

near grotto
#

@opal spruce hi

brave garnet
#

?

near grotto
#

k

foggy shard
#

my discord bot is conneted to the website i mean the bot fetchs my data to my website is there any host to host them both at the same project?

slender thistle
#

Any machine that can run your bot and the website at the same time

slender thistle
#

And what I mean by that is that it can handle running both

#

The rest is up to you

foggy shard
near grotto
foggy shard
#

alr tried and didnt work

quartz kindle
#

then you did it wrong

foggy shard
#

can ya join my repl to helpp

near grotto
foggy shard
#

ok check dm

near grotto
#

k

boreal iron
#

great got a little insect between glass and display

slender thistle
#

Damn attracting bugs

boreal iron
#

lmao

hearty hollow
#

can anyone help me, when you do the command lets say -ping how do I make it so the -ping is deleted? Could anyone send me the code for it or where I can learn how to do it please

boreal iron
#

@slender thistle

rose warren
sudden geyser
#

That's the programming language.

#

Discord.js? Eris? etc.

hearty hollow
#

ye discord.js

sudden geyser
#

Just call .delete() on the Message instance

wheat mesa
boreal iron
#

not allowed to talk in here freerealestate

wheat mesa
#

😉

foggy shard
#

my discord bot is conneted to the website i mean the bot fetchs my data to my website is there any host to host them both at the same project?

boreal iron
#

Didn't you like the answers you got already?

foggy shard
#

nupe

#

it didnt help tho

brave garnet
#

can i ask or channel busy?

foggy shard
#

ask

brave garnet
#

dis $#1t doesnt filter mentions. after looking to stackoverflow and docs i think it should...

@bot.listen("on_message")
async def pingraid(ctx):
  msg = ctx.content.lower()
  if len(ctx.mentions) >= 10 in msg:
    ctx.channel.send(f"why are you pinging too much @{ctx.author} ?")
    ctx.delete()
boreal iron
#

Nothing is for free, there's a list with providers u could use pinned in here

quartz kindle
foggy shard
#

breh

#

replit is not working 'if something is wrong with the code'

sick fable
foggy shard
#

u can come and check

sick fable
#

it should work ig

foggy shard
#

:||

quartz kindle
#

send link then

brave garnet
sick fable
brave garnet
#

k, thk

sick fable
#

and also do await ctx.channel.send("content") instead of ctx.channel.send(f"why are you...")

brave garnet
#

ye, ik. im just dumb and forgor to await 😂

#

edit - didnt yet worked sadly TwT

#

this. did yet nothing... TwT :

@bot.listen("on_message")
async def pingraid(ctx):
  msg = ctx.content.lower()
  if len(ctx.mentions) >= 10 in msg:
    await ctx.channel.send(f"why are you pinging too much @{ctx.author} ?")
    await ctx.delete()
#

@sick fable ↑↑↑

#

-_-

brave garnet
#

ye

sick fable
#

holdup lemme quickly code mine

brave garnet
#

okeh

simple stump
#

I'm trying to check if an user reacts with ✅ or the red cross (can't get the emoji lol), but when reacting, nothing happens. I don't get a reply or anything.
Code:

client.on('messageCreate', async message => {
    if (message.content === `${prefix}test`) {
        await message.reply("this is just a test lol");
        message.react('✅').then(r => {
            message.react('❌');
        });

        const filter = (reaction, user) => {
            return ['✅'].includes(reaction.emoji.name) && user.id === message.author.id;
        };

        message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '✅' || reaction.emoji.name == '❌'),
            { max: 1, time: 30000 }).then(collected => {
                if (collected.first().emoji.name == '✅') {
                    message.reply("yes")
                } else {
                    message.reply('idk');
                }
            }).catch(() => {
                message.reply('No reaction after 30 seconds, operation canceled');
            });
            }
});
brave garnet
#

or yet debugging?

sick fable
brave garnet
#

okeh

quartz kindle
#

do the initial reactions work?

#

does the 30 second message work?

brave garnet
sick fable
brave garnet
#

ohkay

#

py 3.8 at me btw

modest maple
#

Sip real skid moment

modest maple
#

omg BRO

#

so cool

#

! @lost berry check this dude out

boreal iron
#

lmao

quartz kindle
#

6 views

#

lel

sick fable
#

didn't worked lmao @brave garnet

split hazel
#

gonna subscribe

brave garnet
#

;-;

modest maple
#

Sip Just on the Python side of stuff

sick fable
#
@client.event
async def on_message(message):
	try:
		for mentions in message.content.mentions:
			if len(message.content.mentions)>= 10:
				await message.delete()
				await message.channel.send("..")
	except Exception as error:
		await message.channel.send(error)
       break
#

here's my current code

modest maple
#

right

sick fable
#

which is total aids

split hazel
#

:000 you were doing coke in that video????

modest maple
#

where are you getting mentions from

brave garnet
brave garnet
modest maple
#

secondly

#

well you're not

#

cuz you're pointing to attrs that dont exist

sick fable
brave garnet
#

?

modest maple
#

content is a string

brave garnet
#

i didnt had it...

sick fable
#

you gotta use for loops to figure out the mentions and all that bullshit

brave garnet
#

i used message

sick fable
#

bro

quartz kindle
#

lmao

sick fable
#

content is a string

modest maple
#

KannaWhat that code makes no readable sense

sick fable
#

lmaoo ikr

modest maple
#

if you can iterate over it, you can get the length

#

ergo

modest maple
#

thats not the point

#

thats no automod

#

because it doesnt work

sick fable
#

I'm going to sleep

sick fable
#

I will figure it out tomorrow

brave garnet
#

;-;

sick fable
#

and will let you know

modest maple
#

wearyaf Litterally just get the length of message.mentions

brave garnet
#

;;;;-;;; i'll faster get answer from tweeter i see than from here..

modest maple
#

you didnt

#

I've seen your code

brave garnet
#

i did. moment

modest maple
#

you did, virtually the opposite

sudden geyser
brave garnet
#
@bot.listen("on_message")
async def pingraid(ctx):
  msg = ctx.content.lower()
  if len(ctx.mentions) >= 10 in msg:
    await ctx.channel.send(f"why are you pinging too much @{ctx.author} ?")
    await ctx.delete()
#

nope

modest maple
#

well what does in do

#

I want you to think about what you're actually writing

brave garnet
simple stump
quartz kindle
brave garnet
lyric mountain
#

await ctx.delete() ah yes, turning a ping raid into a GHOST ping raid

#

what could be better?

modest maple
#

honestly its fine

brave garnet
#

so what i should do?

modest maple
#

because thats not a function

brave garnet
#

to filter dis shit?

lyric mountain
brave garnet
#

ikr. but it doesnt even detect... it doesnt even message on it . nothing

lyric mountain
#

ik, I'm just commenting on message deletion

brave garnet
#

ikr?

lyric mountain
#

not on the issue itself

brave garnet
#

so what. no way to detect? without iterating all string for <!@>

lyric mountain
#

that's with chillfish

hearty hollow
#

how do I delete the command with a command handler

sick fable
#

bro

#

code a function outside the event

#

add whatever the stuff you want

modest maple
sick fable
#

and make a dictionary or a list which has every possible reasons of pings in it( <@!> or @)

sick fable
#

that's what I could've do if I was there

#

lmao

brave garnet
#

so why dpy have mesage.mentions function?

quartz kindle
modest maple
#

Sip I've told them

#

they just

lyric mountain
#

btw, when testing don't try pinging the same user multiple times

modest maple
#

this is just a battle of bad code i swear

lyric mountain
#

bcuz it'll only count as 1 mention

brave garnet
#

WHAT? ONE MENTION IN 10 PINGS? THK

quartz kindle
#

???

lyric mountain
#

like @brave garnet @brave garnet @brave garnet @brave garnet

#

not 4, but 1

brave garnet
#

ye, this i tried to debug 😂

#

exactly

lyric mountain
#

most libs consider only distinct mentions

brave garnet
#

đŸ€Šâ€â™€ïž

#

but i dont have 10 pepol in server...

#

one moment....

lyric mountain
#

add 10 bots

brave garnet
#

or 2

brave garnet
modest maple
#

Linter deciding to just, not lint hahayes

lyric mountain
#

stained IDE đŸ˜©

quaint wasp
#

does 32767 (all intents) includes privledged intetnts?

lyric mountain
#

dies 💀

quaint wasp
#

😐

sudden geyser
lyric mountain
#

ye, it does due to GUILD_MEMBERS and GUILD_PRESENCES

quaint wasp
#

o-...

split hazel
#

clean it up

lyric mountain
#

see? the rust is even visible /s

quaint wasp
#

is there like a function like

const myIntents = new Intents();
myIntents.add({ intents: 32767} );
myIntents.remove( { stuff } )  // <----
const client = new Client({ intents: myIntents });
blissful coral
#

If it isn't documented then no

modest maple
#

Sip You can just do that with bitwise operations

#

👏 They're just bitflags people

quaint wasp
#

oh wait it is 🙂

lyric mountain
#

intents aren't actually represented by an integer but a binary sequence

#

it's easier to visualize like that

blissful coral
#

yis

lyric mountain
#

you just need to know which indexes are the perms you want to remove

modest maple
#

Sip Well, they are integers

#

they're bit flags

lyric mountain
#

everything is integer if u try hard enough

modest maple
#

its not even something you need to try to do

#

its literally number operations.

sudden geyser
quaint wasp
#

thanks thumbs_up

#

how do I check my discord version...

#

:/

sudden geyser
#

For what

quaint wasp
#

I wanna see what I got to see if i need to upgrade..

#

bc I cant find it in my configs..

earnest phoenix
#

How do I know if the message channel is a community channel?

blissful coral
#

Channel#type

earnest phoenix
#

For djs it doesnt work

blissful coral
#

Wdym

#

That is a djs prop

earnest phoenix
#

It shows only text or voice

boreal iron
#

What's a community channel then?

earnest phoenix
blissful coral
#

thats a text channel...?

earnest phoenix
#

Yes

blissful coral
#

the type is equal to text then

earnest phoenix
#

But i wanna return if the channel is for community

blissful coral
#

Wdym "for community"

boreal iron
#

GUILD_TEXT - a guild text channel

blissful coral
#

Public?

earnest phoenix
blissful coral
#

announcement channels

earnest phoenix
#

I'm making a server setup command and it should delete all channels

#

But if the channel is set for community it can't delete it and throws an error

#

I want it to detect this and continue without deleting that channel

#

It is more clear?

near stratus
earnest phoenix
#

Can i check if it is deletable

#

Like member.kickable()

#

Channel.deleteable()

blissful coral
#

Yes

#

that is a prop

royal portal
#

botum randomly broke, am not sure what this is cryangeryBOYE

boreal iron
#

You should think about handling your errors

#

At least handling the process errors

royal portal
#

it happens when you start the bot

boreal iron
#

Doesn't the fact you need to handle errors or your process will die

#

(at least in newer node versions)

royal portal
#

i never updated node

#

nothing was updated

boreal iron
#

Doesn't the fact you need to handle errors

#

If you don't catch any promise you're using, then at least catch the (unhandled) process errors

#

For example:

for(const event of ["uncaughtException", "unhandledRejection"])
{
    process.on(event, (error) => { console.error(error); }); 
}
#

Which will obviously handle rejections and exceptions

#

That still doesn't change the fact your promise throws an error and need to find out why.

earnest phoenix
#
let value = 2 
if(value != 3) return;
console.log("Value detected as 2")
#

It doesnt return...

boreal iron
#

!==

earnest phoenix
#

Still same

royal portal
#

was doing that for weeks

#

it was in the code

#

fixed it now

#

i was getting 429

earnest phoenix
#
let x = message.guild.ownerID 
    let y = message.author.id
    if(x === y) {
      message.reply("Yes")
    } else {
      message.reply("No")
    }
boreal iron
#

You're still on djv12?

earnest phoenix
#

No 13

#

Its really sucks

#

Its working while evalving but not in code

boreal iron
#

There’s not ownerID property

#

It’s now ownerId

earnest phoenix
#

Oh

#

Thanks for help it really made me crazy RooSip

boreal iron
#

Np

#

Needed to figure that out the hard way, too

pallid jungle
#
Error: Cannot find module 'discord-buttons'
Require stack:
- E:\C) Developing\Wolfy Djs-13\node_modules\utils-discord\index.js
const Util = require('utils-discord')
lament rock
#

don't use discord-buttons since Discord.js natively supports them now

pallid jungle
#

For mongoose

quartz kindle
#

utils-discord requires it

pallid jungle
quartz kindle
#

the error says its missing

#

just install it

pallid jungle
#

Can i use it with another way without package ?

const data = await Util.mongoFind(guildSchema, { guildID: message.guild.id})
pallid jungle
# quartz kindle the error says its missing
E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\APIMessage.js:9
class sendAPICallback extends dAPIMessage {
                              ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\APIMessage.js:9:31)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\WebhookClient.js:2:20)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\node_modules\discord-buttons\src\v12\Classes\MessageComponent.js:1:23)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
quartz kindle
#

post an issue on their github

#

or join their discord server

pallid jungle
#

ok

split hazel
#

discordjs ecosystem is hell

sudden geyser
#

what's wrong with it

pallid jungle
#
    if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
    ^

ReferenceError: GuildData is not defined

setcode

    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}>`})

schema

const mongoose = require('mongoose')

const guildSchema = new mongoose.Schema({
    GuildID: { type: String },
    ChannelID: { type: String }
})

module.exports = mongoose.model('guildSettings', guildSchema)

Someone help please

quartz kindle
#

the error is about GuildData

#

the code you sent doesnt even have GuildData

pallid jungle
#

oh wait

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

Did you define GuildData before that? You’re assigning GuildData but never declaring it

#

You’ve got GuildData = blahblah but not let GuildData = blahblah unless you defined it before that

#

That would raise an error of its own actually so nvm

quartz kindle
#

console.log(GuildData) before using it

#

what does schema.create return?

azure lark
#

I it possible to make a cli very simply using an npm or something?

quartz kindle
#

yes its possible to make a command line program using node.js, if thats what you're asking

azure lark
#

yes, is there a npm or something so I dont have to code it all?

lament rock
#

just use the built in repl module

azure lark
#

that means I have to do it on repl

quartz kindle
#

what

#

what do you want to do even?

azure lark
#

I want to make customs commands

#

like, simply setup

#

simply beeing like npm or git

lyric mountain
#

easy life eh?

azure lark
#

?

quartz kindle
#

there are modules that can help you, but you still have to code something lol

lyric mountain
#

use some botmaker if u want easy plug 'n play stuff, just don't expect anything sweet or fancy

azure lark
#

yeah, but something to make it easier

lyric mountain
#

you mean making a library?

azure lark
#

yes

#

I'll show something similar to what in trying to make

lyric mountain
#

ah, then I apologise, I thought u wanted a cheesy way of making a bot without coding

azure lark
#

lol no worries

quartz kindle
#

start with a basic command line input helper

#

for example minimist

earnest phoenix
#

@bot.command()
async def testvote(ctx):

  headers = {
  "Authorization": "a"
  }
  r = requests.get(f'https://top.gg/api/bots/882268179991257109/check?userId={ctx.message.author.id}', headers=headers)
  print(r.text)
#

why doesnt this work

#

i obviously changed my token but

lyric mountain
#

doesn't python require waiting for async stuff?

sudden geyser
#

requests is synchronous

#

So no awaiting is necessary

pallid jungle
sudden geyser
#

But mixing synchronous code with Discord.py is discouraged

pallid jungle
#
    if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})
    ^

ReferenceError: GuildData is not defined

setcode

    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}>`})

schema

const mongoose = require('mongoose')

const guildSchema = new mongoose.Schema({
    GuildID: { type: String },
    ChannelID: { type: String }
})

module.exports = mongoose.model('guildSettings', guildSchema)

to know the channel

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

that's all codes

earnest phoenix
#

how would i check the response text for user voting

#

if r.text == "voted":

lyric mountain
earnest phoenix
#

doesnt work

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
            })
        }
    } catch (error) {
        console.log(error)
    }
    if(GuildData.ChannelID) return message.channel.send({ content: `Current channel is <#${GuildData.ChannelID}>`})

Not working

quartz kindle
#

you defined it inside the try block

#

so it only exists there

pallid jungle
#

oh

#

why channel is not defined ?

ReferenceError: channel is not defined
    at Object.execute (E:\C) Developing\Wolfy Djs-13\commands\test\testagain.js:17:24)
    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)
    }
lyric mountain
#

ChannelID: channel

#

should be ChannelID: message.channel.id