#development

1 messages · Page 1381 of 1

tardy hornet
#

he cant now lol

warm marsh
#

lol get him to reinstall nodejs

tardy hornet
#

he did

#

like 5 times

faint stump
#

So I code this:

.addField('Status:', member.presence.status, true)

But when I send command, it just say offline, even I'm online

tawdry arrow
#

@warm marsh

warm marsh
#

Yeah?

tawdry arrow
#

like this ?

warm marsh
#

yes

#

No

#

remove the number

#

that was just an example

#

x was also an example

#

pass args[0] or something

tawdry arrow
#

i see

warm marsh
#
switch(args.shift()) {
  case "ping":
    message.channel.send("Pong!");
    break;

  case "invite":
    // ...
    break;
}```
tawdry arrow
#

hmm alright

warm marsh
#

Also make sure you lowercase args.shift

tawdry arrow
#

@warm marsh

warm marsh
#

include the colon

vale garden
#

lmao

tawdry arrow
#

bruh i messed up

vale garden
#

we can see

#

lol

quartz jewel
#

After "case" keyword you put a colon @tawdry arrow

tawdry arrow
#

alright i fixed it

pastel fossil
#

node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1

  • node .
  •   + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
tardy hornet
#

@tribal siren

tribal siren
#

What

tawdry arrow
#

it's work thx

tardy hornet
#

you told me to tell him to send the error

tribal siren
#

Reinstall node.js

pastel fossil
#

i need help i downloaded the node like 5 times and it doesnt work

tribal siren
#

Are you coding on Visual Studio Code?

pastel fossil
#

yes

tardy hornet
#

Reinstall node.js
@tribal siren he did

tribal siren
#

Shush

#

Let him answer for himself

tardy hornet
#

okay lol

tribal siren
#

You tryna get your code on?

pastel fossil
#

im trying to turn my bot on

#

@tribal siren

tribal siren
#

It’s node .

#

If you wanna run your code

pastel fossil
#

ik it writes the problome

tribal siren
#

Send your code then

pastel fossil
#

const Discord = require('discord.js')
const bot = new Discord.Client();
const token = 'Nzc2MzgxODMyOTg3MDE3MjE2.X60D7Q.G_6npT3THe5l5cqd9qLQ1seqNp0'

bot.on('ready', () =>{
console.log("this bot is online!");
bot.user.setActivity(%help, { type: 'PLAYING'}).catch(console.error);

})
bot.on('message', async (message)=>{
const prefix = '%'
if(!message.content.startsWith(prefix)){return}
if (message.author.bot) return;
if (message.channel.type === 'dm') return
let args = message.content.substring(prefix.length).split(" ");

switch (args[0]) {
case 'help':
message.channel.send('no commands for now')
break;

}
})
bot.login(token)

tardy hornet
#

token...........

tribal siren
#

YOU SENT YOUR TOKEN

pastel fossil
#

i started yesturday lol

tardy hornet
#

he will regenerate

tribal siren
tardy hornet
#

just help him lol

tribal siren
#

I’m trying to find what’s wrong

tardy hornet
#

the node PATH

tribal siren
#

@tardy hornet you know that code doesn’t look like it was made by someone who’s new to coding

tardy hornet
#

ik

pastel fossil
#

he helped me

tardy hornet
#

maybe i helped him a little

#

just to start it

tribal siren
#

a little

tardy hornet
#

lol

pastel fossil
#

yea yea

tribal siren
#

hm

tardy hornet
#

there is a problem with the node PATH

#

and i tried to help him

rustic nova
#

dude delete that message

#

@coral trellis token leak

tardy hornet
#

he regenerated it

tribal siren
#

but still

earnest phoenix
#

we cant get verified bot developer badge now?

tardy hornet
#

chill

tribal siren
#

it’s a token leak

#

we cant get verified bot developer badge now?
@earnest phoenix no

earnest phoenix
#

why not

tardy hornet
#

HE REGENERATED IT

tribal siren
#

because of people who only code the bot because badges

earnest phoenix
#

?

rustic nova
#

theres people who hunt badges

#

they do it just for the badge

tribal siren
#

yes

earnest phoenix
#

oh

rustic nova
#

which was not planned by discord

#

people started selling accounts with these badges

#

thus, forcing discord to remove it

tribal siren
#

Yeah

earnest phoenix
#

thats bad

#

people always misuse stuff

#

how do i get roles?

tribal siren
#

I remember some guy trying to buy account from me when I had a badge

#

I don’t have badge because uuuh let’s not talk about that

earnest phoenix
#

lol

#

how do i get a role

rustic nova
#

submit a bot

#

or boost

earnest phoenix
#

i submitted bot

rustic nova
#

then wait 5+ weeks

earnest phoenix
#

ohl

#

ohk

rustic nova
earnest phoenix
#

so many people submitting bots now

#

takes too long for verification

ionic shard
#

Hello, i have php site, with login, i want to have a feature where associate discord account with it..

so i can auto give role on discord when they connect account on site

can anyone link me some tutorial for this? i am not sure what to search

rustic nova
tame lava
#

Hello
i wanna write a brooadcast bot code and need help

rustic nova
#

elaborate broadcast

#

what should it do

tame lava
#

Dm Online
Or Everyone on the server by a command

sterile ridge
#

can someone give an example of delete author message

#

python?

#

please

rustic nova
#

dming every user on your server at once is also api abuse

zealous sable
#

That would be breaking discord rules Moon

tame lava
#

ok

tribal siren
#

bruh

#

remember that bot that was spamming everyone’s DMs that it will boost their server 30 times?

rustic nova
#

still a thing

little meteor
#

@earnest phoenix I found the error 0giggle and it was a stupid mistake

#

but still dunno y it started to give problems now laugh

earnest phoenix
#

hm? what is?

little meteor
#

it was the img, sometime it was failing to create it

sterile ridge
#

can someone give an example of delete author message
@sterile ridge I found it

#
@client.command()
async def say(ctx, message : str):
    await ctx.message.delete()
    await ctx.send(message)
ancient nova
#

what would I have to do to prevent people from spamming my bot's commands? Because it makes my bot lag to the point that the ping is over 2000k I set 3 seconds cooldown in each command but it doesn't exactly help..

dusky lagoon
#
C:\Users\Media\muchi\index.js:35
        let event = new (require(`./events/${dir}`))(client)
                    ^

TypeError: require(...) is not a constructor
    at C:\Users\Media\muchi\index.js:35:21
    at Array.forEach (<anonymous>)
    at C:\Users\Media\muchi\index.js:32:16
    at FSReqCallback.oncomplete (fs.js:156:23)
PS C:\Users\Media\muchi> ``` ok so im not getting this error can someone help me???
warm marsh
#

the required file doesn't export a class by default

#

So your dir variable is wrong or you're missing exports = class {}

tardy hornet
#

how do i download fetch?

#

npm i fetch?

midnight blaze
#

@tardy hornet

gusty quest
#

@earnest phoenix

#

Type here ur problems...

earnest phoenix
#

C:\Users\nsapo\OneDrive\Desktop\Discord Bot\Revenge-Bot>npm run dev

Revenge-Bot@1.0.0 dev C:\Users\nsapo\OneDrive\Desktop\Discord Bot\Revenge-Bot
nodemon ./src/bot.js

'nodemon' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Revenge-Bot@1.0.0 dev: nodemon ./src/bot.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Revenge-Bot@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nsapo\AppData\Roaming\npm-cache_logs\2020-11-12T13_30_30_394Z-debug.log

gusty quest
#

and wait...

stiff walrus
#
client.on('message', (message) => {
  if (message.content.toLowerCase() === 'n!' + 'avatar') {
  const { MessageEmbed } = require('discord.js');
  const embed = new MessageEmbed()
  if(!message.mentions.users.first()) {
    .setTitle('Avatarınız.')
    .setImage(message.author.displayAvatarURL({dynamic : true}))
    .setColor("RANDOM")
    .setAuthor('İşte avatarınız.')
    .setFooter(message.member.displayName +  ' tarafından istendi ')
    .setTimestamp();
    return message.channel.send(embed)
  } else {
    let User = message.mentions.users.first()
    .setImage(User.displayAvatarURL({dynamic : true}))
    .setColor(RANDOM)
    .setFooter(message.member.displayName +   ' tarafından istendi ')
    .setTimestamp();
    return message.channel.send(embed)
   }
 }
});```

i am trying to make avatar command but i cant do it , gives me error
#

pleadingpoint help please

neon heart
#

give your error message from console

stiff walrus
#

okay

#

1 second

neon heart
#

huh?

stiff walrus
#

ReferenceError: setTitle is not defined
at Client.<anonymous>
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (Bot\node_modules\discord.js\src\client\actions\MessageCreate.js3114)
at Object.module.exports [as MESSAGE_CREATE] Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js44422)
at WebSocketShard.onMessage Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage Bot
\node_modules\ws\lib\websocket.js:825:20)

neon heart
#

move code const embed = new MessageEmbed() after if(!message.mentions.users.first()) {

earnest phoenix
#

I have a question

#

client.users.cache.get it output is 1

#

why it don't output real number?

sudden geyser
#

@midnight blaze I don't use Windows, but that usually means:

  1. You didn't install the command / software that adds the command.
  2. The command is installed, but wasn't added to your local PATH variable.
midnight blaze
#

@sudden geyser what?

#

You pinged the wrong person

sudden geyser
#

Meant @earnest phoenix *

stiff walrus
#

move code const embed = new MessageEmbed() after if(!message.mentions.users.first()) {
@neon heart thank you so much

sudden geyser
#

@earnest phoenix a bit confused. Could you re-explain your issue?

#

and show your code in that section

earnest phoenix
sudden geyser
#

So only one user is cached.

#

I assume that's the bot account.

#

Do you have intents enabled?

earnest phoenix
#

nope

sudden geyser
#

Then that's probably why you aren't getting anyone else.

eternal osprey
#

hey could someone help me a bit out with my problem?

#

my code just searches too fast:

#

i would like to first automate it, but then let it cool down so it only works every 40s for example

arctic hare
#

@eternal osprey so you want command cookdowns??

viscid gale
#

ite guys this aint a discord question, but i wanna know if it possible
there's an event listener such as

document.addEventListener("keydown",function(ev){doRandomThings;ev.preventDefault()}

now i wanna do something kinda strange.. i made KeyboardEvent.prototype.preventDefault to be under my control.. and i wanna be able to activate the function that calls it(in that above listener)
the most i achieved was

KeyboardEvent.prototype.preventDefault=function(){console.log(this)}//returns ev
eternal osprey
#

nvm i already fixed it

#

hey people*
i have implemented a setinterval command with a timeout of 10secondss
however, i want this part of the code to actually be implemented right away:

.then(function (message) {
                        const reactionEmoji1 = message.guild.emojis.cache.find(emoji => emoji.name === 'valor');
                        message.react(reactionEmoji1);
                        const reactionEmoji2 = message.guild.emojis.cache.find(emoji => emoji.name === 'mystic');
                        message.react(reactionEmoji2);
                        const reactionEmoji3 = message.guild.emojis.cache.find(emoji => emoji.name === 'instinct');
                        message.react(reactionEmoji3);```

i cannot just simply move these out of the scope as they belong to the code above it.
could someone help?
sudden geyser
#

Do you have another message object, such as the one that's probably passed in the message event.

earnest phoenix
#

does anyone have any idea on how i could make tags command using discord.py
?

eternal osprey
#

this is my code

#

you see the problem is,

#

the message sends every 10seconds as i want

#

but the reactions too, so it takes 30 seconds to get all the reactions done and ready on each message

#

i want to remove the setinterval and react right away

sudden geyser
#

@sand dune can you show us around line 1270

#

For the record, it may not be a good idea to throw all your code into one large file.

#

@earnest phoenix what is it meant to do? A tags command is vague. Does it tag a user? Is it used as a shortcut to say some text?

viscid gale
#

Do you have another message object, such as the one that's probably passed in the message event.
@sudden geyser that's the only listener, like there is no global way to access it

#

i tried triggering the event manually

#

unresponsive

#

im gonna put that to the prevent default and try to manually trigger the listener again

pale vessel
#

was he even talking to you

#

(idk)

viscid gale
#

idk... event.. lol yea he prob wasnt talking

#

kek

sudden geyser
#

@eternal osprey if the reaction is supposed to be on the message that'll be sent in 10 seconds, you'll have to put yourself to that constraint. If you're listening for reactions on the base message (the one triggering the message) event, it's a matter of the name you give your variables.

Speaking of which, you never actually end the interval, and since you're sending a new message, this would cause a memory leak -- a very obvious one.

#

@viscid gale I was referring to Awesome.

earnest phoenix
#

@earnest phoenix what is it meant to do? A tags command is vague. Does it tag a user? Is it used as a shortcut to say some text?
@sudden geyser as a shortcut to say so text for example,
?tag info should give the info about bot, and the users shoul dbe able to create tags using
?tag create something like that..

halcyon kite
#

for mine i just did addtag

eternal osprey
#

hmm

sudden geyser
#

You'd need a database to store the contents of the tag persistently. The logic behind it should be self-explanatory though:

  • A user can create a tag with the create subcommand. Have the user specify a name for the tag which they can use to call the tag (?tag <name>).
  • When the user invokes the tag, get it from your database (or a cache if you'd prefer to keep it in memory) and respond with it.

It's not really a question on how to do it with discord.py. It's rather a question on how to do it in Python in general.

halcyon kite
#

@sand dune you did not define user in the code, what are you using

#

ok

sudden geyser
#

I mean, they did: ```js
let list = banned.map(user => user.tag).join('\n'); //line 1270

#

Which is weird because it's valid

halcyon kite
#

under if (message.content === "&listban") {

#

try const user = message.mentions.users.first(); if (user) { const member = message.guild.member(user); if (member) { member

#

or

#

yeah

pale vessel
halcyon kite
#
      if (user) {
        const member = message.guild.member(user);
        if (member) {
          member
#

did it work?

#

oh

pale vessel
#

what version of discord.js are you using

halcyon kite
#

so Version 12

#

What are you using to run the code like node

pale vessel
#

it should be banned.map(entry => entry.user.tag)

#

fetchBans() return a collection of entries that have the user, they're not simply just user objects

halcyon kite
#

ok

#

lol

delicate shore
#

How to make all text start from very left

solemn latch
#

Remove and spaces or tabs.

delicate shore
#

Oo

#

I think I already have

near stratus
#

Show (part of) your code

eternal osprey
#

guys

#

why is my code sending a new message super quick

#

eventhough i have a setinterval of 60 seconsd?

quartz kindle
#

each raid command creates a new interval

eternal osprey
#

how would i fix that?

quartz kindle
#

if you do !raids 10 times, you will have 10 intervals running at the same time

eternal osprey
#

yeah i know

#

but i only had !raids put in once

#

but each message sent like a fucking train

#

no cooldowns at all:

quartz kindle
#

you're also sending a new message for each raid in data.raids

eternal osprey
#

yeah but that's okay

#

i just want to set a cooldown on the send message

quartz kindle
#

you have to change the structure of the entire command

obtuse jolt
#

how do I use internal sharding?

cinder patio
#

which lib

obtuse jolt
#

d.js

cinder patio
#

In the client settings specify the amount of shards you want to spawn

obtuse jolt
cinder patio
#

shardCount

obtuse jolt
#

oh

cinder patio
#

I think

obtuse jolt
#

the bot turned on so I guess it works lmao

pale vessel
eternal osprey
#

i have 6 invites, but it always shows 0

pale vessel
eternal osprey
#

huh

#

so i have to add Promise.resolve()

earnest phoenix
#

Just resolve it with await

#

await message.guild.fetchInvites()

eternal osprey
#

hmm

#

that would return an erro tho

#

error*

earnest phoenix
#

How so?

eternal osprey
#

TypeError: Cannot read property 'uses' of undefined

earnest phoenix
#

It means it didn't find an invite that it's inviter was that ID

eternal osprey
#

wait can you rebuild you sentence please?

pale vessel
#

you're comparing an id with a member object

#

it would be userId.id

rocky hearth
#

u should first check if userInvites is null or not?

eternal osprey
#

@rocky hearth it already is

rocky hearth
#

I dont see, in the above code, atleast

pale vessel
#

please read my message

eternal osprey
#

i know i have tried it

#

but it doesn't respond at all

#

if i use !check @eternal osprey

rocky hearth
#

do u hv put async keyword?

pale vessel
#

my god

eternal osprey
#

I KNOW

#

i have changed it

#

once again

pale vessel
#

fucking hell

eternal osprey
#

BUT IT STILL DOES NOT WORK

rocky hearth
#

lol, show the latest code

eternal osprey
#
if(message.author.id === "345138133429649408"){
    if(message.content.startsWith('!check ')) {

    var userId = message.mentions.members.first();

    var userInvites = await message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === userId.id));

    var useAmount = userInvites.uses;
rocky hearth
#

do u hv put async keyword?
somewhere?

eternal osprey
#

yeah on top in the message handler

earnest phoenix
#

It would have thrown an error if his function wasn't async already

#

Like await is only valid inside async functions

eternal osprey
#

exactly

rocky hearth
#

U said you're checking userInvites for null values.... but where?

eternal osprey
#

if (useAmount === undefined)

#

under

#

useamount is a variable linked to useinvites.uses

rocky hearth
#

put this on the very next line if(!userInvites) return;

pale vessel
#

bad practice, use if (!useAmount) {} instead

rocky hearth
#

if ur userInvites is null, then how it can have uses property

pale vessel
#

optional chaining ftw

eternal osprey
#

wait i see

#

i messed up somewhee

sudden geyser
#

I wouldn't say it's bad practice but still works

pale vessel
earnest phoenix
eternal osprey
#

uhh

#

it still shows 0

#

invites

#

strange

earnest phoenix
#

Also using var is a bad practice

#

Use let or const

eternal osprey
#

yeah i changed them to const

pale vessel
#

@sudden geyser actually, what i sent was the one that is a bad practice

#

the amount could be 0, which is falsey

sudden geyser
#

yeah, letting values be resolved implicitly imo is neither good or bad practice. Sometimes, it is wanted.

eternal osprey
#

anyone that knows what's wrong?

earnest phoenix
#

Invites can have 0 uses tho, or the person you pinged has an invite more than 0 uses?

eternal osprey
#

i am pinging myself

#

i basically have invited the whole server

#

so i should have an exact amount of 7

earnest phoenix
#

Can you show your latest code

eternal osprey
#
   if(message.author.id === "345138133429649408"){
    if(message.content.startsWith('!check ')) {

    const userId = message.mentions.members.first();

    const userInvites = await message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === userId.id));

    const useAmount = userInvites.uses;

    if (useAmount === undefined) {
      const exampleEmbed1 = new Discord.MessageEmbed()
      .setColor('RANDOM')
      .setAuthor('Invite Manager')
      .setFooter("Command created for Awsome")
      .setDescription("<@" + userId.id + ">" +  ` has 0 invites`)
      message.channel.send(exampleEmbed1);
    }

    else {
     
        const exampleEmbed = new Discord.MessageEmbed()
        .setColor('RANDOM')
        .setAuthor('Invite Manager')
        .setFooter("Command created for Awsome")
        .setDescription("<@" + userId.id + ">" + ` has ${useAmount} invites`)
        message.channel.send(exampleEmbed);
      
        
    }
}
    }
});
earnest phoenix
#

Or, a member can create more than a single invite which means it's trying to find an invite than has less uses

eternal osprey
#

i've used my latest invite and then tested it out on another discord account

#

still displayed 0 after

earnest phoenix
#

How many invites you've created on your server?

eternal osprey
#

how can i see that?

#

basically, a lot

earnest phoenix
#

Then that's the issue

#

You have to first filter the invites to that user id, if it's size is 0, display 0, if not reduce uses of all invites and display them

eternal osprey
#

also when i do !check

#

it will display TypeError: Cannot read property 'uses' of undefined

earnest phoenix
#

Congrats you just pinged a random user

eternal osprey
#

but i cann check my own invites?

#

sorry

#

who the fuck names himself User

earnest phoenix
#

🗿

#

You have to filter it instead of finding it, first fetch the invites and filter it to that user, and if size is 0, say they never created an invite, if not then reduce all and display

#

anyone know how to force cache a message in discord.py

#

not sure if pulling a channel's pinned messages will cache them once retrieved

#

now that i think about it i might as well try it out myself lol

late light
#

whats the html attribute i need to edit to change the button colours?

#

you know like upvote/invite etc

solemn latch
#

inspect element on the button

feral aspen
#

How can I check if a user is in the server?

#

and I defined the user as (mUser)

tardy hornet
#

i have that defined, and my friend wants to download it and i forgot what to type to download it,

const quiz = require('./quiz.json');

#

npm i and then what?

feral aspen
#

you can't download an npm for json

#

you must have a file called quiz.json

#
and I defined the user as (mUser)```
sudden geyser
#

@feral aspen, what library are you using?

feral aspen
#

I am currently using Discord.js/node.js

sudden geyser
#

If you have a member cache, you can do <Guild>.members.get(...)

If you don't (or prefer to ask Discord directly so it's confirmed), use <Guild>.members.fetch instead. .members.fetch(...) will still look in the cache beforehand, so you don't have anything to lose.

#

.get(...) returns a GuildMember instance, while .fetch(...) returns a Promise<GuildMember>, so you'll need to resolve it first.

feral aspen
#

Im currently doing that for the ban command.

#

But can't seem to know how.

#

Do you know how, lite?

sudden geyser
#

Well, using it would be like so: ```js
// let's imagine mUser is a User instance and message is a Message instance.
let member = await message.guild.members.fetch(mUser.id); // Resolves the promise so member is an instance of GuildMember. If the user couldn't be found (somehow), an error will be thrown instead.

```js
// Now, let's imagine `mUser` is a `string` (the user ID) and `message` is a `Message` instance.
let member = await message.guild.members.fetch(mUser); // Same case as above except no `.id` property
feral aspen
#

Oo. Alright, thank you! 🙂

north birch
#

Lmao what was that

rough knot
#

I just got approoved by @drowsy crag Thx So Mutch ❤️

#

Can u send screenshot?

honest inlet
#

Can I ask about how to make different bot function here

north birch
#

Yup

honest inlet
#

Ok so

#

Is there a way to let people add their own links to commands? I'm making a promo bot and use Bot Designer For Discord

rough knot
#

Database

honest inlet
#

?

rough knot
#

and Webpage

#

I think

north birch
#

I was about to say so lmao

Database

honest inlet
#

Kk lemme see

north birch
#

you can do a command like !setlink <link> that save the link in the database

honest inlet
#

Oh! Thank you

feral aspen
#
let embedErrorOne = new Discord.MessageEmbed()
        .setDescription("❌ Please mention the message you are willing to send to the channel!")
        .setColor(colors.red)
            
        if(!args[0]) return message.channel.send(embedErrorOne)
    
        let argsresult;
        let mChannel = message.mentions.channels.first()
    
        argsresult = args.join(" ")

        message.channel.send(`${argsresult}`)
honest inlet
#

?

feral aspen
#

Is there a way I can refuse the user by mentioning @ everyone or @ here

north birch
#

Then !showlink that get the data and fetch it on a message.channel.send(Link = ${linkdata})

feral aspen
#

so it can quickly return

honest inlet
#

Ok, so would I be able to choose which command the link goes into or would it make a new comamd

#

Because for the sake of accessibility I'm trying to keep everything in categories so people can easily search

north birch
#

Ok, so would I be able to choose which command the link goes into or would it make a new comamd
@honest inlet I would make two command, one for setting, one for fetching and posting

honest inlet
#

Alright, so could you show me the fetching and posting command?
Sorry im very new to this

north birch
#

What database module you're gonna use?

honest inlet
#

Do you mean the portal, or the website I'm submitting it too

#

Again I'm kind of an noob

north birch
#

No no, you can choose you're database module, you can use quick.db for example

honest inlet
#

Ohh

#

So which do you reccomend

#

Quick.db?

north birch
#

I actually use it but it's not the best out there

#

but It's simple to use

honest inlet
#

Ok. So how can I set this, is there a website

#

Tysm for all this btw

agile lance
#

quick.db is really simple. Go to https://npmjs.com and search up quick.db. The docs are REALLY helpful on it

feral aspen
#

Can I get help with my above message.

north birch
#

To set it up, open your cmd, cd into your bot folder, and execute npm install quick.db

agile lance
#

Make sure you’re appearing online

north birch
#

I think because you're are in status 'Not avaible'

agile lance
#

You show offline for me

viscid jasper
#

What

#

I am online

agile lance
#

It’s weird

honest inlet
#

They show do not disturb for me

north birch
#

Try setting online without Not avaible option

viscid jasper
#

Okay

feral aspen
#
    let embedErrorOne = new Discord.MessageEmbed()
        .setDescription(":x: Please mention the message you are willing to send to the channel!")
        .setColor(colors.red)
            
        if(!args[0]) return message.channel.send(embedErrorOne)
    
        let argsresult;
        let mChannel = message.mentions.channels.first()
    
        argsresult = args.join(" ")

        message.channel.send(`${argsresult}`)

Is there a way I can refuse the user by mentioning @ everyone or @ here

agile lance
#

Yes.

feral aspen
#

How?

agile lance
#

if(message.content.includes(“@everyone”) || message.content.includes(“@here”)) return message.reply(“You’re not allowed to ping.”)

north birch
#

!setlink command

const db = require('quick.db')

module.exports = {
name: "setlink",
description: "Set your link",

run: async (client, message, args) => {
let link = args[0]
db.set('link',link)
message.channel.send('Link updated')

}}

!getlink command

const db = require('quick.db')

module.exports = {
name: "getlink",
description: "Get your link",

run: async (client, message, args) => {
let link = db.fetch('link')
if(link === null) {link = Not set yet}
message.channel.send(`Here's the link! ${link}`)

}}

@honest inlet

#

This should work

honest inlet
#

Tysm!

north birch
#

You're welcome

#

Remember to install quick.db first

pale vessel
#

bruh

#

did you just- ok

north birch
#

What?

pale vessel
#

nothing

north birch
#

Okay?

#

The {} at the if? lmao

nothing
@pale vessel

quartz kindle
#

The spoon feeding

pale vessel
#

ye

agile lance
#

I spoon fed to I think

#

if(message.content.includes(“@everyone”) || message.content.includes(“@here”)) return message.reply(“You’re not allowed to ping.”)
@agile lance with this

earnest phoenix
#

development is just spoon-feed-zone

agile lance
#

^^

quartz kindle
#

Everything in the world is copied from someone else

north birch
#

ye
@pale vessel Ye they're optional it work either btw lmao

pale vessel
#

what

#

oh well, forget about it

agile lance
#

.-.

north birch
#

Okayy

atomic parcel
#

Hey, is there a known bug with partial "messageReactionAdd"?
I'm running this script

client.on("messageReactionAdd", async (reaction, user) => {
  if (reaction.partial) {
    try {
      await reaction.fetch();
    } catch (e) {
      console.error(e);
      return;
    }
  }
  console.log(reaction.message.author + " reacted to a message");
}

I've noticed that if I run the bot and immediately react to an old message, nothing happens. However, if a new message gets sent, or an old message now gets reacted, old message reacts get console logged.

Has anyone encountered this?

agile lance
#

I personally have never fired that event so I am unable to help. I apologize.

quartz kindle
#

Try fetching the message before fetching tbe reaction

#

Also make sure the relevant partials are enabled in your client options

atomic parcel
#

So if (reaction.message.partial)?

quartz kindle
#

You can skip that and fetch it always

#

The fetch method gets from the cache if found

atomic parcel
#

ahh ok

#

Thanks

north birch
#

@honest inlet if you have problems with the code ping me

quartz kindle
#

Babysitter

#

Lmao

north birch
#

lol

pale vessel
#

ah yes ping me for free code snippets

north birch
#

ah yes ping me for free code snippets
@pale vessel No no for problem on the code i gave him

#

lmaoo

stiff walrus
#

i am trying to make a voting command. But in desc its still same how do i fix it?https://cdn.discordapp.com/attachments/746112011582308362/776518598188466196/unknown.png

client.on('message', async (message) => {
    if (message.author.bot) return;
    if (message.content.startsWith( 'n!' + 'oylama')) {
        if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('Oylama açmak için yetkin yetmiyor.');
        let repUser = message.mentions.members.first();
        const repVoteEmbed = new Discord.MessageEmbed();
        repVoteEmbed.setColor("RANDOM")
        repVoteEmbed.setTitle('Nova Bot | Oylama');
        repVoteEmbed.setDescription(`Emre çok iyi birisi `);
        repVoteEmbed.setTimestamp()
        repVoteEmbed.setFooter(`${message.author.tag} tarafından başlatıldı.`);
        message.channel.send(repVoteEmbed).then((msg) => {
            msg.react(`✔`).then(() => msg.react('❌'));
        });
    }
});```
trim saddle
#

change setDescription?

stiff walrus
#

change setDescription?
@trim saddle i mean ''n!oylama + test''
i want to be desc be test not changing from code

trim saddle
#

'n!' + 'oylama test'?

stiff walrus
#

I want to use "args" to set my description in my command

#

@trim saddle

trim saddle
#

split everything from the command and prefix

stiff walrus
#

how i do it

trim saddle
#

"n!coolcommand arg1 arg2 arg3".split(" ").shift()
.split will turn every space into an array of objects (["n!coolcommand", "arg1", "arg2", "arg3"])
.shift will remove the first entry in the array ("n!coolcommand")

tawny ermine
#

Pls weekly

quaint peak
#

is there anyway to send a different message if the embed is empty? im sending a thumbnail from an api and sometimes there isnt any image so it sends a blank embed

stark abyss
#

Does anyone know how to fetch a message from message url in djs

#

I was told to get guild+channel+message id from message url and then i fetch message from that channel

#

i know how to do the first basic part but I don't understand what they meant by "fetch message"

stuck ravine
#

Hello, anyone know how to fix this error?

atomic topaz
#

Seems like people aint getting much help in here but anyone know how to fix this?

#

its when i attempt to start the bot. Also, im rather new to bot developing

tight plinth
#

can you show your code please

feral aspen
#

I keep having this error.

#
        this.saveClientID = process.env.SAVE_CLIENT_ID.toLowerCase() === 'true';
                                                       ^

TypeError: Cannot read property 'toLowerCase' of undefined```
#

the play command won't seem to work.

atomic topaz
#
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
    colorize: true
});
logger.level = 'debug';
// Initialize Discord Bot
var bot = new Discord.Client({
   token: auth.token,
   autorun: true
});
bot.on('ready', function (evt) {
    logger.info('Connected');
    logger.info('Logged in as: ');
    logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
    // Our bot needs to know if it will execute a command
    // It will listen for messages that will start with `!`
    if (message.substring(0, 1) == '!') {
        var args = message.substring(1).split(' ');
        var cmd = args[0];
       
        args = args.splice(1);
        switch(cmd) {
            // !ping
            case 'ping':
                bot.sendMessage({
                    to: channelID,
                    message: 'Pong!'
                });
            break;
            // Just add any case commands if you want to..
         }
     }
});``` Thats my code
#

Currently im just testing around, so no insane cmds yet

#

literally my first time trying to start any bot

stark abyss
#

@feral aspen console.log(process.env.SAVE_CLIENT_ID) it's probably empty in that case fix that first

feral aspen
#

Ill see.

#

it doesnt work

#

When I startup the bot, it gives me that error

#

@stark abyss

stark abyss
#

hm

#

I am unsure then nani

feral aspen
#

the commands works on my other bot

#

but not here.

#

😐

atomic topaz
#
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
    colorize: true
});
logger.level = 'debug';
// Initialize Discord Bot
var bot = new Discord.Client({
   token: auth.token,
   autorun: true
});
bot.on('ready', function (evt) {
    logger.info('Connected');
    logger.info('Logged in as: ');
    logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
    // Our bot needs to know if it will execute a command
    // It will listen for messages that will start with `!`
    if (message.substring(0, 1) == '!') {
        var args = message.substring(1).split(' ');
        var cmd = args[0];
       
        args = args.splice(1);
        switch(cmd) {
            // !ping
            case 'ping':
                bot.sendMessage({
                    to: channelID,
                    message: 'Pong!'
                });
            break;
            // Just add any case commands if you want to..
         }
     }
});``` Thats my code

@tight plinth i assume you asked me? i need this issue fixed though if you know someone else who can help as i literally cant make the bot

tight plinth
#

try to use discord.js

#

it's easier

atomic topaz
#

ait ill try

fallen root
#

oops

opal plank
#

@atomic topaz avoid using var btw, just a tip

atomic topaz
#

ah ok, should i use const? im new to coding

opal plank
#

yeah, const or let

#

depending on your case

#

const is for stuff that doesnt change

#

if you try to change a const it'll error

#

let can vary

#

let a = 1;
a = 2 <== fine

const a = 1;
a = 2 <== error

native plinth
#

How do you verify bot

atomic topaz
#

ah yeah i getcha, my knowledge is as far as the variables and actual construction of coding i think

#

cheers my bot now doesnt die on startup

opal plank
#

@atomic topaz let and const are almost exactly like vars, they are declaring a variable. The issue with var is that its hoisted, which can lead to unintended bugs in your code

#

check thjis for example

#

the snippets are exactly the same, with the only difference being var vs let

#

i am returning var before i even assigned it, thats due to vars being hoisted when its compiled

#

a doesnt exist in the code, yet im returning it and it doesnt error

atomic topaz
#

ah, i did not know the term hoisted, cheers. I need to learn javascript ;-;

opal plank
#

while this is intended, this can cause bugs due to its hoisting nature and scopes

atomic topaz
#

hmm

#

thanks for helping, i appreciate it alot

opal plank
#

its fine, we all start somewhere. but rule of the thumb, avoid vars

#

np

atomic topaz
#

btw

#

quick question

opal plank
#

wusup

atomic topaz
#

whats the base for an event bot? like a bot that organizes events?

#

where do i start

opal plank
#

wdym?

atomic topaz
#

nvm, ima just attempt some tutorials online, prolly easier

opal plank
#

sketchy

#

dont do that

#

here, lemme point you towards a good guide

atomic topaz
#

oh ait

analog kettle
#

okay so- i need a command that creates an embed with user input. how?

opal plank
#

https://www.w3schools.com/js/ this for learning js, its interactive and friendly for people who are starting.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/ this is the same as above, but their docs are better explained and described, the downside is that the syntax might be scary for new people, though it is undoubtedly better.
https://discordjs.guide/ this is a guide for d.js for making a bot. Notice that knowing a bit of js beforehand is required.
@atomic topaz

#

i'd recommend learning variables, objects, arrays, map, functions, switch, if's and for loops. That should get you enough footing to make your own bot

atomic topaz
#

Alright, thanks alot!

opal plank
earnest phoenix
#

Hi My Bot Is Always Giving Certain Error Can Anyone Help Me

blissful coral
#

Give the code and the error

analog kettle
#

Hi My Bot Is Always Giving Certain Error Can Anyone Help Me
@earnest phoenix what error

blissful coral
#

Give the code and the error
@blissful coral

earnest phoenix
#

(node:6487) UnhandledPromiseRejectionWarning: Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (/rbd/pnpm-volume/1b497ee6-3021-425b-b226-3f25e43eddeb/node_modules/.registry.npmjs.org/discord.js/12.4.1/node_modules/discord.js/src/sharding/Shard.js:158:16)
at Object.onceWrapper (events.js:284:20)
at Shard.emit (events.js:196:13)
at Shard._handleExit (/rbd/pnpm-volume/1b497ee6-3021-425b-b226-3f25e43eddeb/node_modules/.registry.npmjs.org/discord.js/12.4.1/node_modules/discord.js/src/sharding/Shard.js:382:10)
at ChildProcess.emit (events.js:196:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
(node:6487) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6487) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
internal/modules/cjs/loader.js:613
throw err;
^

#

@analog kettle

analog kettle
#

dang thats a new one for me sorry

earnest phoenix
#

😦

atomic parcel
#

How do I send text and an embed in the same message?

#

How can I send a random message ?
@sand dune you mean made of random characters? Please specify what you mean by random

#
embeds = [embed1, embed2]
index = Math.floor(Math.random() * embeds.length);
message.channel.send(embeds[index]);```
woven sundial
#

hi, I'm looking for an api that returns a .png of a map from a place that I gave the name. Does anyone knows one ?

#

nvm, google maps api is doing it

atomic topaz
#

how do i kill my bot? like how do i stop it from running

spare goblet
#

depends on what language it is and what process manager you are using if any

opal plank
#

just stop? process.exit() @atomic topaz

#

if you want to restart you'd need some sort of script/bash or a process manager

atomic topaz
#

ah kk

#

currently i just needed to update the pfp which got fixed by running node bot.js again

opal plank
#

these are your options afaik

  1. process.on('exit', () => {//run a bash script here to run the file again})
  2. nodemon
  3. pm2(most used)
  4. forever
  5. you can simply close node process via task manager
#

those all are valid options

glossy tundra
#

can someone give me a free case command?

tardy hornet
#

lol

high spear
#

Anyone know how i can run my Discord bot 24/7(I use BDFD)

opal plank
#

we dont give code here @glossy tundra read rules about spoonfeeding

#

@high spear get a vps

high spear
#

Where

glossy tundra
#

sorry

opal plank
#

anywhere, be free or paid

high spear
#

ok

opal plank
#

Digital ocean and AWS are my recommendations

tardy hornet
#

o hey @opal plank have not seen you a long time

opal plank
#

sup

#

yeah i took a break from this channel

#

sometimes it gets... well.... lets just say i needed a break

tardy hornet
#

anyways how is your bot?

eternal osprey
#

hey gguys

opal plank
#

verified, 5k+ streams, doing goddamn well

tardy hornet
#

still growing?

#

yessssssssss

opal plank
#

yup

tardy hornet
#

good for you

opal plank
#

xD

#

ty

eternal osprey
#

i still have a problem with my setinterval code
it basically times my bot out for 1 minute
and then sends all the messages super fast:

https://hatebin.com/dqeindekdw
i want each message to be sent every 60 econdss
not all in once after the 60s cooldown

opal plank
#

working on something new now

tardy hornet
#

mine got added to 281

eternal osprey
#

i have no clue why it is happening

opal plank
#

talking to some of the streamers i had cuz some of them are looking out for my new project

tardy hornet
#

OOOO

#

good luck!

opal plank
#

ty 😄

#

❤️

tardy hornet
#

my bot got added to 10 servers in 1h, i feel so proud, (total of 281)

opal plank
#

eeeey lets goo

#

after you hit 100 ish it should only go up faster

#

a lot of people dont add small bots cuz they looks sketchy

tardy hornet
#

yeah it is

opal plank
#

not big enough to be trusted

tardy hornet
#

ik

opal plank
#

should be a walk in the park from there on out

eternal osprey
#

uhh can someone help me?

tardy hornet
#

omg erwin i cant believe you have done this

#

where is your nitro

#

@opal plank

opal plank
#

me have no moneys for nitro

tardy hornet
#

mine get canceled in 3 days

#

uhh can someone help me?
@eternal osprey with?

#

with?

#

just send what

#

node .

eternal osprey
#

@tardy hornet i just literally asked a few moments back

tardy hornet
#

tada lol

opal plank
#

though on the other hand, i got 19k emotes i can send out in chat like the one above. Yoinking emotes ftw

eternal osprey
#

i still have a problem with my setinterval code
it basically times my bot out for 1 minute
and then sends all the messages super fast:

https://hatebin.com/dqeindekdw
i want each message to be sent every 60 econdss
not all in once after the 60s cooldown
@eternal osprey here

tardy hornet
#

is it a raid command?

#

bro

#

wth

eternal osprey
#

what

tardy hornet
#

its a raid command?

eternal osprey
#

yeah

tardy hornet
#

..........

eternal osprey
#

!raids is the call

opal plank
#

not that kind of raid

#

its for pokemon go

eternal osprey
#

ooowh

tardy hornet
#

o i got scared bro

eternal osprey
#

read along, you'll see what i mean by !raids

tardy hornet
#

lol

#

i just read the title

opal plank
#

you should really use await dude

tardy hornet
#

the command name

eternal osprey
#

nothing malicious in the code.

opal plank
#

your code slowly turning into a callback hell

tardy hornet
#

you should really use await dude
@opal plank yeah

eternal osprey
#

@earnest phoenix then there is an error

tardy hornet
#

I can't make my bot online, it stops offline
@earnest phoenix show us the error

eternal osprey
#

@opal plank hmm yeah i will 0/

opal plank
#

same, i need to go back to coding

eternal osprey
#

first i want to fix the setinterval command

#

@earnest phoenix buddy show your fucking terminal

tardy hornet
#

e\✨r\✨r\✨o\✨r

eternal osprey
#

can you show your codeeee

#

môar code

tardy hornet
#

show us the error

eternal osprey
#

i think that the just created the bot. In the discord developer portal.

#

what language do you speak?

#

anyways broken tooth have you discovered how i could fix my setinterval problem?

#

@earnest phoenix show your code please

tardy hornet
#

"don't know your language"

e\✨ n\✨ g\✨ l\✨ i\✨ s\✨ h

#

anyways broken tooth have you discovered how i could fix my setinterval problem?
@eternal osprey nope, good luck there

eternal osprey
#

I'll take it

tepid gate
eternal osprey
#

that looks so hot tho

tardy hornet
#

omg

eternal osprey
#

YESSS

#

i am not even goinng into this

pale vessel
eternal osprey
#

@earnest phoenix

#

have a look at this first.

young flame
#

i'm making a reason command for a new discord bot i'm making and i want it to get all the messages from the modlogs channel but it keeps saying messages of undefined hhhh

eternal osprey
#

send your code? Maybe i can try to help?

young flame
#

Okay

#

My pc died so its gonna be a bit

cosmic spear
#

my console says there is a promise pending and it stucks on command loading phase

#

so my bot doesn't load

#

can you help me with that

eternal osprey
#

okay provide me an ss

#

code, whatever.

#

i cannot just visualise anythingg

#

yeah

#

but i wont help you if you don't know the basics.

#

you have done everything wrong you could.

cosmic spear
#

can you help me with an issue which I wrote above?

eternal osprey
#

citate it?

cosmic spear
#

what?

eternal osprey
#

citate your problem

cosmic spear
#

what does citate mean dude

young flame
#

okay heres the ss

eternal osprey
#

@cosmic spear just send the problem you have

#

@earnest phoenix i won't spoonfeed

cosmic spear
#

my console says there is a promise pending and it stucks on command loading phase
@cosmic spear .

#

so my bot doesn't load
@cosmic spear .

young flame
cosmic spear
#

can you help me with that
@cosmic spear .

eternal osprey
#

@cosmic spear can you send a screenshot of the error or something please?

cosmic spear
#

dude

#

I told you

#

there is no error

#

it just stucks at

#

promise pending

#

at console

eternal osprey
#

@young flame what's the exact error you are getting

young flame
eternal osprey
#

what line is it showing

opal plank
young flame
#

uhh the Modlog.messages.fetch({limit:100})

opal plank
#

Modlog is undefined

young flame
#

no it is

opal plank
#

clearly is

eternal osprey
#

modlog is defined

opal plank
#

js is case sensitive

#

modlog isnt the same as Modlog

young flame
opal plank
#

client isnt same as Client

#

then thats undefined

young flame
#

no it isnt lol

opal plank
#

it is

#

it wouldnt error if it had that

young flame
#

i took it from my other bot that works

#

?

eternal osprey
#

yes @earnest phoenix i agree

dense tartan
#

Hi peepz my bot is done and ready I want to add it to top.gg but it say me I have to join the discord bot list server to add bots, but I am in here or not thew right place?

opal plank
#

find() returns either a channel or null

#

if it returns null

#

null doesnt have .messages in it

young flame
#

what

opal plank
#

though your compiler says undefined

young flame
#

your confusing af lmao

opal plank
#

imma bonk you hard

young flame
#

i have .messages defined in something else

pale vessel
#

undefined iirc?

#

is it null actually?

young flame
#

not the channel

dense tartan
#

alo

opal plank
#

read that

eternal osprey
#

Erwin

#

how

cosmic spear
#

can someone help me?

#

I am tired of waiting

#

tbh

eternal osprey
#

did you get that fucking hot background

opal plank
#

@young flame

eternal osprey
#

@cosmic spear instead of waiting you can be ✨ productive✨

young flame
opal plank
#

read above

#

read this

#

carefully

#

what does find returns?

eternal osprey
#

@cosmic spear show your fucking code or screenshot

young flame
#

you dont have anything to find lmao

eternal osprey
#

i can't do shit w/o visualisation

opal plank
#

im gonna slap you

#

find() returns either a channel or undefined

#

its returning undefined in your case

eternal osprey
#

erwin bish. How did you get that background

young flame
#

yes

cosmic spear
#

WELL

opal plank
#

cuz its not matching naything

#

ITS UDNEFINED

young flame
#

hhhhhhhhhhhhhhhhhh

cosmic spear
#

this is the damn error when I try to run my bot

#

Promise { <pending> }

pale vessel
#

erwin bish. How did you get that background
@eternal osprey i see no background?

opal plank
#

WHICH I TOLD YOU

#

reee

eternal osprey
#

BITCH SHOW ME YOUR FUCKING CODE

young flame
#

it's legit in discord.jsv12 documention doe

opal plank
#

me and your compiler are telling you, its returning undefined

#

BRUH

eternal osprey
#

look

young flame
#

idfk how to spell that shit

pale vessel
#

it's a blur

opal plank
#

listen to me moon

#

very carefully

young flame
#

okay daddy erwin

eternal osprey
#

is that just his vsc background?

pale vessel
#

he blurred his code

eternal osprey
#

oh lmao

cosmic spear
#

@pale vessel

#

can you help me

opal plank
#

find() returns EITHER undefined if it didnt find anything, or the channel if it matches your function
let array = ['banana', 'apple']
let a = array.find('dog');
there isnt dog in that array, what you are tyring to do is the same, of course it'll return undefined
its because your function(aka your filter) isnt returning anything

eternal osprey
#

@cosmic spear send screenshot

#

for fuck sakes

#

bro

cosmic spear
#

dude

#

THERE

#

IS

eternal osprey
#

is it that fucking hard

cosmic spear
#

NO

#

SCREENSHOT

#

TO

#

SEND

#

because

#

the only issue

#

is

opal plank
#

you can see here, after => boolean): V(which is the channel, its an internal observable) or undefined

cosmic spear
#

me getting

#

Promise { <pending> }

#

this damned

#

console log

#

and

opal plank
#

@young flame

#

read above

young flame
#

find() returns EITHER undefined if it didnt find anything, or the channel if it matches your function
let array = ['banana', 'apple']
let a = array.find('dog');
there isnt dog in that array, what you are tyring to do is the same, of course it'll return undefined
its because your function(aka your filter) isnt returning anything
@opal plank HMMMMMMMMM

eternal osprey
#

bitch how can i know what the problem is without seeing the fucking code you fucking stupid whore (i love you btw())

young flame
#

okay daddy erwin

#

if you say so

eternal osprey
#

okay i give up

cosmic spear
#

@eternal osprey are you autistic? do I look like I can see the problem?

#

which damned code bro

eternal osprey
#
  1. Refuses to sends any code or so.
young flame
cosmic spear
#

there is like 20 commands on my bot

eternal osprey
#
  1. sends turkish shit to me
#

yeah i give up @earnest phoenix

young flame
#

@opal plank would this work

#
message.guild.channels.find(channel => channel.name === "channel-name");
cosmic spear
#

@eternal osprey I finally got an error while waiting

#

I got time out

eternal osprey
#

@cosmic spear send the fucking terminal shit

#

send a ss

#

please

cosmic spear
#
(node:577) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
    at /home/runner/Jutul/node_modules/discord.js/src/client/ClientManager.js:40:57
    at Timeout._onTimeout (/home/runner/Jutul/node_modules/discord.js/src/client/Client.js:436:7)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
(node:577) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:577) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
 
#

this is the error

#

with

opal plank
#

yes, it will work, IF there is a channel with that name. i never said that was wrong, i said that if it doesnt find anything that matches, it'll return undefined, which it did. Check before running the code if that variable has something after it has been ran

young flame
#

kk

#

OH

cosmic spear
#

Promise { <pending> }

young flame
#

OHH

#

I'M STUPID

#

LMFAO

opal plank
#

lmao

young flame
#

@opal plank i fucking love you

opal plank
#

now you realize why i wanted to slap you xD

young flame
opal plank
#

< 3

eternal osprey
#

@cosmic spear that's just a time out

#

wait

young flame
#

I DONT HAVE A CHANNEL WITH THAT NAME

#

poggers

#

brb

cosmic spear
#

@eternal osprey but I can't still run the bot

#

it was like running an hour ago

#

but I saw my bot was offline and when I enter my bot's console I saw that damn pending issue

#

@eternal osprey r u here?

#

will ya help me or nah

#

@earnest phoenix why

#

I understand, but what is the problem you are having.

#

@earnest phoenix

#

just go watch some tutorials on YouTube

rustic nova
#

if you do not understand anything inside #502193464054644737, then you do not own the required knowledge yet to be able to start a discord bot

young flame
#

ah

#

new error

#

so the case numbers work and stuff but uhh

#

it wont let me edit the reason

#

@opal plank come back lmao

#
if(command === "reason") {
    message.delete().catch(O_o=>{}); 
let caseNumber = args.shift();
  let newReason = args.join(' ');
  let Modlog = message.guild.channels.cache.find(channel => channel.name === "kyua-logs");

    await Modlog.messages.fetch({limit:100}).then((messages) => {
      const caseLog = messages.filter(m => m.author.id === client.user.id &&
      m.embeds[0] &&
      m.embeds[0].type === 'message' &&
      m.embeds[0].footer &&
      m.embeds[0].footer.text.startsWith('Case') &&
      m.embeds[0].footer.text === `Case ${caseNumber}`
    ).first();
    Modlog.messages.fetch(caseLog.id).then(logMsg => {
      const embed = logMsg.embeds[0];
      embedSan(embed);
      embed.description = embed.description.replace(`Awaiting moderator's input. Use ${prefix}reason ${caseNumber} <reason>.`, newReason);
      logMsg.edit({embed});
    });
})
  }
#

thats my code hhh

earnest phoenix
#

Spaghetti code

rustic nova
#

yes?

young flame
#

ah hold on

rustic nova
young flame
#

these async functions gonna kill me

earnest phoenix
#

@earnest phoenix if your new to coding I'd recommend you start with python or Golang

#

You can find resources for python at the python website or the python discord

#

That's your ide

#

What's your programming language

prisma oriole
#

a code editor has nothing to do with you knowing python

#

lol

earnest phoenix
#

^

prisma oriole
#

as he said, learn py, go, or js

earnest phoenix
#

^

prisma oriole
#

my brain

#

turkish isnt a programming language pepeFacepalm

earnest phoenix
#

@earnest phoenix use PYTHON, Golang or JS

opal plank
#

@young flame imma teach you something even better

#

come voice chat

prisma oriole
#

is he even listening

#

bro

#

i cant even tell if hes trolling

opal plank
#

oye, get your ass over here, imma teach ya to debug stuff @young flame

earnest phoenix
#

@earnest phoenix dude are you listening to me

#

Vscode is a ide

#

Python or go is a language that tells instructions to the computer to do stuff for example discord.py (a python library to connect to the discord api) is used to make discord bots and the one for go is discordgo

sudden geyser
#

a code editor has nothing to do with you knowing python
wait, you guys don't code in Google App Script and run your bot like that?

young flame
#

oye, get your ass over here, imma teach ya to debug stuff @young flame
@opal plank o oki

prisma oriole
young flame
#

hhhhhhhhhhh my headphones dont work

sudden geyser
#

have you tried fixing them

young flame
#

yes

opal plank
#

@young flame can you ehar me?

sudden geyser
#

the one you want to use

prisma oriole
#

you need to pick, i personally would pick golang

#

but if you want an easier time, pick python

sudden geyser
#

If you're a beginner I recommend Python, but it's your choice. You'll meet people who say "Use X" and "Use Y instead"

young flame
#

HhHhHhhHhHhHHhH

earnest phoenix
#

Python is easy

#

imagine using py or js

#

when theres

north birch
#

Popolar opinion: Js is better

stark abyss
#
    var linkContent = client.channels.cache.get(args[5]).messages.cache.get(args[6])
    console.log(linkContent.content); 
``` I am certain that args[5] is channel id and args[6] is message id but it gives me undefined
#

imagine using py or js
That's like saying imagine speaking "a language" or "another language"

restive notch
#

e!vitals

prisma oriole
#

smh yaml is clearly the best language

restive notch
#

e!vitals

#

oh im stupid

pale vessel
#

yaml is better than python smh

opal plank
#

@stark abyss dont use var ree

stark abyss
#

Okayyy

#

I am just so use to var it's hard to use let

pale vessel
#

no its not

#

type let instead of var

pale vessel
#

as easy as that

opal plank
#

var is hoisted

#

produces bugs

#

doesnt respect scopes since it attaches on functions

stark abyss
opal plank
#

using var is a nice way to add bugs to your code

pale vessel
#

var do be kinda stinky doe

opal plank
#

read the snippet i sent

#

im returning var before its even declared

#

no errors

#

imagine that in your code

#

dont be lazy, ditch vars

slim umbra
#

use rust like a pro dev

stark abyss
#

I see

opal plank
#

they have their uses, this is not one of them

stark abyss
#

okay I'll use let from now on

opal plank
#

const for stuff that doesnt change. let for stuff that changes

pale vessel
#

im rusty at coding so can i use rust

stark abyss
#

Yeah I know, and error still exists HinaPensive

opal plank
#

never said that'd fix it, i said not to use vars

#

cuz you'll be adding even more bugs onto of the ones u already have

stark abyss
#

Okay I get it Erwin

#
    var linkContent = client.channels.cache.get(args[5]).messages.cache.get(args[6])
    console.log(linkContent.content); 
``` I am certain that args[5] is channel id and args[6] is message id but it gives me undefined
young flame
#

HHH

#

i cant hear u lul

pale vessel
#

debug

#

log your args

stark abyss
#

yes

pale vessel
#

yes

stark abyss
#

i had

#

that's why i said "certain"

pale vessel
#

what did it return

stark abyss
#

numbers

pale vessel
#

bruh

stark abyss
#

what do you take me for

pale vessel
#

you're not cooperating

stark abyss
#

'732739821600112651',
'776562496735412304'

pale vessel
#

and are you sure the message is cached?

stark abyss
#

does that help ?

#

no

pale vessel
#

then its probably not cached

#

you have to fetch it

stark abyss
#

okay and how do I do that

pale vessel
#

await channel.messages.fetch(id)

opal plank
#

should i give a 4 line long single line?

#

i think i should

#
    let linkContent = (client.channels.cache.get(args[5]) ? client.channels.cache.get(args[5]) : client.channels.cache.fetch(args[5])).(messages.cache.get(args[6]) ? messages.cache.get(args[6]) : messages.fetch(args[6]))
    console.log(linkContent.content);

rate my cursed code

#

thats all technically one line

#

not even sure it'll work tbh

stark abyss
#

oh

opal plank
#

nah it wont run, syntax error

#

fuck

#

i can make it bigger though

stark abyss
opal plank
#

HEHEHEHE

pale vessel
#

its long intentionally, right?

stark abyss
opal plank
#

yes

#

im making it as cursed as possible

#

i THINK this should run

#
  let linkContent = ((client.channels.cache.get(args[5]) ? client.channels.cache.get(args[5]) : await client.channels.fetch(args[5])) as Discord.TextChannel).messages[this.cache.get(args[6]) ? this.cache.get(args[6]) : this.messages.fetch(args[6])]
#

dont you dare copy this

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

stark abyss
#

lmao

opal plank
#
    let channel = client.channels.cache.has(args[5])
      ? client.channels.cache.get(args[5])
      : await client.channels.fetch(args[5]), linkContent:Discord.Message;
    if(channel) linkContent = (channel as Discord.TextChannel).messages.cache.has(args[6])
      ? (channel as Discord.TextChannel).messages.cache.get(args[6])
      : await (channel as Discord.TextChannel).messages.fetch(args[6]);
console.log(linkContent)

less cursed but functional

stark abyss
#

I don't fully understand what's happening here but at this point idc if it works

quartz kindle
#

lmao

opal plank
#

tim rate my code

quartz kindle
#

a solid 5/7

opal plank
#

lmao

#

aint that bad

#

but fuck readability

prisma oriole
#

i have never seen so many ternaries in my life

opal plank
#

lmao

quartz kindle
#

if you dont get the ref, google "5/7 meme"

opal plank
#

technically 2 lines

#

wait rlly

#

hmm one sec

stark abyss
#

lmao

opal plank
#

lol

#

didnt know 5/7 was even a thing

quartz kindle
#

find the original imgur thread

#

its pure gold

stark abyss
#

pure entertainment