#development
1 messages · Page 1381 of 1
lol get him to reinstall nodejs
So I code this:
.addField('Status:', member.presence.status, true)
But when I send command, it just say offline, even I'm online
@warm marsh
Yeah?
yes
No
remove the number
that was just an example
x was also an example
pass args[0] or something
switch(args.shift()) {
case "ping":
message.channel.send("Pong!");
break;
case "invite":
// ...
break;
}```
hmm alright
Also make sure you lowercase args.shift
include the colon
lmao
bruh i messed up
After "case" keyword you put a colon @tawdry arrow
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
@tribal siren
What
it's work thx
you told me to tell him to send the error
Reinstall node.js
i need help i downloaded the node like 5 times and it doesnt work
Are you coding on Visual Studio Code?
yes
Reinstall node.js
@tribal siren he did
okay lol
You tryna get your code on?
ik it writes the problome
Send your code then
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)
token...........
YOU SENT YOUR TOKEN
i started yesturday lol
he will regenerate

just help him lol
I’m trying to find what’s wrong
the node PATH
@tardy hornet you know that code doesn’t look like it was made by someone who’s new to coding
ik
he helped me
a little
lol
yea yea
hm
he regenerated it
but still
we cant get verified bot developer badge now?
chill
it’s a token leak
we cant get verified bot developer badge now?
@earnest phoenix no
why not
HE REGENERATED IT
because of people who only code the bot because badges
?
yes
oh
which was not planned by discord
people started selling accounts with these badges
thus, forcing discord to remove it
Yeah
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
i submitted bot
then wait 5+ weeks
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
you should look into using oauth2.0 on discord: https://discord.com/developers/docs/topics/oauth2
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Hello
i wanna write a brooadcast bot code and need help
Dm Online
Or Everyone on the server by a command
dming every user on your server at once is also api abuse
That would be breaking discord rules Moon
ok
bruh
remember that bot that was spamming everyone’s DMs that it will boost their server 30 times?
still a thing
@earnest phoenix I found the error
and it was a stupid mistake
but still dunno y it started to give problems now 
hm? what is?
it was the img, sometime it was failing to create it
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)
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..
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???
the required file doesn't export a class by default
So your dir variable is wrong or you're missing exports = class {}
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
and wait...
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
help please
give your error message from console
huh?
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.js
14)
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.js
22)
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)
move code const embed = new MessageEmbed() after if(!message.mentions.users.first()) {
I have a question
client.users.cache.get it output is 1
why it don't output real number?
@midnight blaze I don't use Windows, but that usually means:
- You didn't install the command / software that adds the command.
- The command is installed, but wasn't added to your local PATH variable.
Meant @earnest phoenix *
move code
const embed = new MessageEmbed()afterif(!message.mentions.users.first()) {
@neon heart thank you so much
@earnest phoenix a bit confused. Could you re-explain your issue?
and show your code in that section
So only one user is cached.
I assume that's the bot account.
Do you have intents enabled?
nope
Then that's probably why you aren't getting anyone else.
hey could someone help me a bit out with my problem?
https://hatebin.com/tjviocowme this is the link to my binned code
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
@eternal osprey so you want command cookdowns??
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
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?
Do you have another message object, such as the one that's probably passed in the message event.
does anyone have any idea on how i could make tags command using discord.py
?
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
@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?
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
@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 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 infoshould give the info about bot, and the users shoul dbe able to create tags using
?tag createsomething like that..
for mine i just did addtag
hmm
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
createsubcommand. 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.
I mean, they did: ```js
let list = banned.map(user => user.tag).join('\n'); //line 1270
Which is weird because it's valid
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

if (user) {
const member = message.guild.member(user);
if (member) {
member
did it work?
oh
what version of discord.js are you using
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
Remove and spaces or tabs.
Show (part of) your code
guys
why is my code sending a new message super quick
eventhough i have a setinterval of 60 seconsd?
each raid command creates a new interval
how would i fix that?
if you do !raids 10 times, you will have 10 intervals running at the same time
yeah i know
but i only had !raids put in once
but each message sent like a fucking train
no cooldowns at all:
it should send a message every 60s
you're also sending a new message for each raid in data.raids
you have to change the structure of the entire command
how do I use internal sharding?
which lib
d.js
In the client settings specify the amount of shards you want to spawn
like this? https://cdn.yxridev.com/u/JVPRfZH5.png
shardCount
oh
I think
the bot turned on so I guess it works lmao
i have 6 invites, but it always shows 0
you're not resolving the promise
How so?
TypeError: Cannot read property 'uses' of undefined
It means it didn't find an invite that it's inviter was that ID
wait can you rebuild you sentence please?
u should first check if userInvites is null or not?
@rocky hearth it already is
I dont see, in the above code, atleast
please read my message
i know i have tried it
but it doesn't respond at all
if i use !check @eternal osprey
do u hv put async keyword?
fucking hell
BUT IT STILL DOES NOT WORK
lol, show the latest code
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;
do u hv put async keyword?
somewhere?
yeah on top in the message handler
It would have thrown an error if his function wasn't async already
Like await is only valid inside async functions
exactly
U said you're checking userInvites for null values.... but where?
if (useAmount === undefined)
under
useamount is a variable linked to useinvites.uses
put this on the very next line if(!userInvites) return;
bad practice, use if (!useAmount) {} instead
if ur userInvites is null, then how it can have uses property
optional chaining ftw
I wouldn't say it's bad practice but still works


yeah i changed them to const
@sudden geyser actually, what i sent was the one that is a bad practice
the amount could be 0, which is falsey
yeah, letting values be resolved implicitly imo is neither good or bad practice. Sometimes, it is wanted.
anyone that knows what's wrong?
Invites can have 0 uses tho, or the person you pinged has an invite more than 0 uses?
i am pinging myself
i basically have invited the whole server
so i should have an exact amount of 7
Can you show your latest code
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);
}
}
}
});
Or, a member can create more than a single invite which means it's trying to find an invite than has less uses
i've used my latest invite and then tested it out on another discord account
still displayed 0 after
How many invites you've created on your server?
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
also when i do !check
it will display TypeError: Cannot read property 'uses' of undefined
Congrats you just pinged a random user
🗿
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
whats the html attribute i need to edit to change the button colours?
you know like upvote/invite etc
inspect element on the button
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?
you can't download an npm for json
you must have a file called quiz.json
and I defined the user as (mUser)```
@feral aspen, what library are you using?
I am currently using Discord.js/node.js
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.
Im currently doing that for the ban command.
But can't seem to know how.
Do you know how, lite?
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
Oo. Alright, thank you! 🙂
Lmao what was that
Can I ask about how to make different bot function here
Yup
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
Database
?
I was about to say so lmao
Database
Kk lemme see
you can do a command like !setlink <link> that save the link in the database
Oh! Thank you
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}`)
?
Is there a way I can refuse the user by mentioning @ everyone or @ here
Then !showlink that get the data and fetch it on a message.channel.send(Link = ${linkdata})
so it can quickly return
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
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
Alright, so could you show me the fetching and posting command?
Sorry im very new to this
What database module you're gonna use?
Do you mean the portal, or the website I'm submitting it too
Again I'm kind of an noob
No no, you can choose you're database module, you can use quick.db for example
quick.db is really simple. Go to https://npmjs.com and search up quick.db. The docs are REALLY helpful on it
Can I get help with my above message.
To set it up, open your cmd, cd into your bot folder, and execute npm install quick.db
Make sure you’re appearing online
I think because you're are in status 'Not avaible'
It’s weird
They show do not disturb for me
Try setting online without Not avaible option
Okay
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
Yes.
How?
if(message.content.includes(“@everyone”) || message.content.includes(“@here”)) return message.reply(“You’re not allowed to ping.”)
!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
Tysm!
What?
nothing
The spoon feeding
ye
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
development is just spoon-feed-zone
^^
Everything in the world is copied from someone else
ye
@pale vessel Ye they're optional it work either btw lmao
.-.
Okayy
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?
I personally have never fired that event so I am unable to help. I apologize.
Try fetching the message before fetching tbe reaction
Also make sure the relevant partials are enabled in your client options
So if (reaction.message.partial)?
You can skip that and fetch it always
The fetch method gets from the cache if found
@honest inlet if you have problems with the code ping me
lol
ah yes ping me for free code snippets
ah yes ping me for free code snippets
@pale vessel No no for problem on the code i gave him
lmaoo
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('❌'));
});
}
});```
change setDescription?
change setDescription?
@trim saddle i mean ''n!oylama + test''
i want to be desc be test not changing from code
'n!' + 'oylama test'?
split everything from the command and prefix
how i do it
"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")
Pls weekly
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
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"
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
can you show your code please
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.
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
@feral aspen console.log(process.env.SAVE_CLIENT_ID) it's probably empty in that case fix that first
Ill see.
it doesnt work
When I startup the bot, it gives me that error
@stark abyss
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
ait ill try
oops
@atomic topaz avoid using var btw, just a tip
ah ok, should i use const? im new to coding
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
How do you verify bot
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
@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
ah, i did not know the term hoisted, cheers. I need to learn javascript ;-;
while this is intended, this can cause bugs due to its hoisting nature and scopes
wusup
whats the base for an event bot? like a bot that organizes events?
where do i start
wdym?
nvm, ima just attempt some tutorials online, prolly easier
oh ait
okay so- i need a command that creates an embed with user input. how?
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
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Ac...
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
Alright, thanks alot!
Hi My Bot Is Always Giving Certain Error Can Anyone Help Me
Give the code and the error
Hi My Bot Is Always Giving Certain Error Can Anyone Help Me
@earnest phoenix what error
Give the code and the error
@blissful coral
(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
dang thats a new one for me sorry
😦
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]);```
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
how do i kill my bot? like how do i stop it from running
just stop? process.exit() @atomic topaz
if you want to restart you'd need some sort of script/bash or a process manager
ah kk
currently i just needed to update the pfp which got fixed by running node bot.js again
these are your options afaik
- process.on('exit', () => {//run a bash script here to run the file again})
- nodemon
- pm2(most used)
- forever
- you can simply close node process via task manager
those all are valid options
can someone give me a free case command?
lol
Anyone know how i can run my Discord bot 24/7(I use BDFD)
we dont give code here @glossy tundra read rules about spoonfeeding
@high spear get a vps
Where
sorry
anywhere, be free or paid
ok
Digital ocean and AWS are my recommendations
o hey @opal plank have not seen you a long time
sup
yeah i took a break from this channel
sometimes it gets... well.... lets just say i needed a break
anyways how is your bot?
hey gguys
verified, 5k+ streams, doing goddamn well
yup
good for you
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
working on something new now
mine got added to 281
i have no clue why it is happening
talking to some of the streamers i had cuz some of them are looking out for my new project
my bot got added to 10 servers in 1h, i feel so proud, (total of 281)
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
yeah it is
not big enough to be trusted
ik
should be a walk in the park from there on out
uhh can someone help me?
mine get canceled in 3 days
uhh can someone help me?
@eternal osprey with?
with?
just send what
node .
@tardy hornet i just literally asked a few moments back
tada lol
though on the other hand, i got 19k emotes i can send out in chat like the one above. Yoinking emotes ftw
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
what
its a raid command?
yeah
..........
!raids is the call
ooowh
o i got scared bro
read along, you'll see what i mean by !raids
you should really use await dude
the command name
nothing malicious in the code.
your code slowly turning into a callback hell
you should really use await dude
@opal plank yeah
@earnest phoenix then there is an error
I can't make my bot online, it stops offline
@earnest phoenix show us the error
@opal plank hmm yeah i will 0/
same, i need to go back to coding
first i want to fix the setinterval command
@earnest phoenix buddy show your fucking terminal
e\✨r\✨r\✨o\✨r
show us the error
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
"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
I'll take it
that looks so hot tho
omg
notepad++ i use
@earnest phoenix
have a look at this first.
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
send your code? Maybe i can try to help?
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
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.
can you help me with an issue which I wrote above?
citate it?
what?
citate your problem
what does citate mean dude
okay heres the ss
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 .
@eternal osprey
can you help me with that
@cosmic spear .
@cosmic spear can you send a screenshot of the error or something please?
dude
I told you
there is no error
it just stucks at
promise pending
at console
@young flame what's the exact error you are getting
what line is it showing
we sharing our vsc? bet
uhh the Modlog.messages.fetch({limit:100})
Modlog is undefined
no it is
clearly is
modlog is defined
it is
no it isnt lol
yes @earnest phoenix i agree
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?
find() returns either a channel or null
if it returns null
null doesnt have .messages in it
what
though your compiler says undefined
your confusing af lmao
imma bonk you hard
i have .messages defined in something else
not the channel
alo
did you get that fucking hot background
@cosmic spear instead of waiting you can be ✨ productive✨
??
@cosmic spear show your fucking code or screenshot
you dont have anything to find lmao
i can't do shit w/o visualisation
im gonna slap you
find() returns either a channel or undefined
its returning undefined in your case
erwin bish. How did you get that background
yes
WELL
hhhhhhhhhhhhhhhhhh
erwin bish. How did you get that background
@eternal osprey i see no background?
BITCH SHOW ME YOUR FUCKING CODE
it's legit in discord.jsv12 documention doe
idfk how to spell that shit
it's a blur
is that just his vsc background?
he blurred his code
oh lmao
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
is it that fucking hard
you can see here, after => boolean): V(which is the channel, its an internal observable) or undefined
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
bitch how can i know what the problem is without seeing the fucking code you fucking stupid whore (i love you btw())
okay i give up
@eternal osprey are you autistic? do I look like I can see the problem?
which damned code bro
- Refuses to sends any code or so.

there is like 20 commands on my bot
@opal plank would this work
message.guild.channels.find(channel => channel.name === "channel-name");
(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
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
Promise { <pending> }
lmao
@opal plank i fucking love you
now you realize why i wanted to slap you xD

< 3
@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
please refer to #502193464054644737
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
please read #502193464054644737
ah
new error
so the case numbers work and stuff but uhh
it wont let me edit the reason
@opal plank come back lmao
this is the error i get
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
Spaghetti code
yes?
ah hold on
please refer to #502193464054644737 if you haven't even started coding it yet
these async functions gonna kill me
@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
^
as he said, learn py, go, or js
^
@earnest phoenix use PYTHON, Golang or JS
oye, get your ass over here, imma teach ya to debug stuff @young flame
@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
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?
oye, get your ass over here, imma teach ya to debug stuff @young flame
@opal plank o oki
you'll need to decide which language, python or go. One you have:
Python: https://www.python.org/
GoLang: https://golang.org/
hhhhhhhhhhh my headphones dont work
have you tried fixing them
yes
@young flame can you ehar me?
the one you want to use
you need to pick, i personally would pick golang
but if you want an easier time, pick python
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"
HhHhHhhHhHhHHhH
Popolar opinion: Js is better
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"

e!vitals
smh yaml is clearly the best language
yaml is better than python smh
@stark abyss dont use var ree
as easy as that

using var is a nice way to add bugs to your code
var do be kinda stinky doe
read the snippet i sent
im returning var before its even declared
no errors
imagine that in your code

dont be lazy, ditch vars
use rust like a pro dev
I see
they have their uses, this is not one of them
okay I'll use let from now on
const for stuff that doesnt change. let for stuff that changes
im rusty at coding so can i use rust
Yeah I know, and error still exists 
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


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
yes
yes
what did it return
bruh
what do you take me for
you're not cooperating
'732739821600112651',
'776562496735412304'
and are you sure the message is cached?
okay and how do I do that
await channel.messages.fetch(id)
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
oh

HEHEHEHE
its long intentionally, right?
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
One message removed from a suspended account.
One message removed from a suspended account.
lmao
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
lmao
tim rate my code
a solid 5/7
i have never seen so many ternaries in my life
lmao
if you dont get the ref, google "5/7 meme"
lmao









