#development
1 messages · Page 847 of 1
No, the Secret token is your bot's password
W-
The client id is the id of your bot
The bot has a password?
So I could log in to my bot right now?
no, you cant
It's a token on the developer portal
W-
Yeah
The token of the bot is what makes it online
It can be used to access your bot.
The Client Secret is the token used to authorize your bot
Sorry, *your code
to be run on the application id
Basically, it shows which code belongs to the bot or not
Oh.
My client Id is the same to @dusty moat
If client id was a password anyone can get it by pinging bot
Yes it is the same with your Bot's User ID
Well before I do I'll read mre of this Windows Getting Started at Bot Developing.
If client is was a password anyone can get it by pinging bot
@pallid zinc Not the ID, the Secret
then I can code!
Client Secret
Token ??
422087909634736160
Discord Server List
8005
The official Discord bot for the Discord Server List!
discord.js
N/A
1526
126
No server count
@fossil oxide

@languid dragon 
@bitter sundial 
What is this?
keep commands out of here
what this mean?
-bots 414622975598395398
okay, jesus im so sorry
https://discordapp.com/developers/applications/BOT_ID/bot @earnest phoenix
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Hello! Any person know how to do premium feaatures? Like if you UpVote the bot 5 times you can run a command?
nope.
Sorry.
Any other person know?
Grayald manybe in #topgg-api
Can anyone tell me what this means?
this script downloads third party software
This script will direct to Chocolatey to install packages. By using
Chocolatey to install a package, you are accepting the license for the
application, executable(s), or other artifacts delivered to your machine as a
result of a Chocolatey install. This acceptance occurs whether you know the
license terms or not. Read and understand the license terms of the packages
being installed and their dependencies prior to installation:
- https://chocolatey.org/packages/chocolatey
- https://chocolatey.org/packages/python2
- https://chocolatey.org/packages/visualstudio2017-workload-vctools
This script is provided AS-IS without any warranties of any kind
Chocolatey has implemented security safeguards in their process to help
protect the community from malicious or pirated software, but any use of this
script is at your own risk. Please read the Chocolatey's legal terms of use
as well as how the community repository for Chocolatey.org is maintained.
Press any key to continue . . .
Just license agreement nothing major just press any key to continue
Ok.
nothing interesting, just do what it wants you to do
how to get a prefix?
define one
where?
Hello! Any person know how to do premium feaatures? Like if you UpVote the bot 5 times you can run a command?
Any person know?
I know what a prefix is, but I do not know how to get one.
Maybe try and put the prefix before the commands in the code, for each command name?
Okay, so I fixed this, but it still doesn't work.```js
if (command === "balance") {
var output = await eco.FetchBalance(user.id);
var user;
if (message.author.id !== config.ownerID) {
user = message.author;
} else if (message.author.id === config.ownerID) {
user = message.members.mentions.first();
}
const baleembed = new Discord.MessageEmbed()
.setAuthor(${user.tag}, ${user.avatarURL()})
.setColor([173, 216, 230])
.addField("Balance", "" + ${output.balance} + "")
.setFooter(${footer}, ${user.avatarURL});
message.channel.send(baleembed);
}
Grayald all I knew is this is related to dbl API you can ask in #topgg-api
Kayui any error
No, but it doesn't run
Is there an error log message?
(Am I learning or getting dumber? Lol)
Is there an error log message?
(Am I learning or getting dumber? Lol)
@earnest phoenix I just said, no
Oh.
If you are not getting any errors then something is wrong with your command system
I thought you meant there was no error you can see in the code.
Probably should console.log it to see if it exists
My other commands are working
Try use console.log('Test'); in your code and see what parts work
All right, a sec
Yes
@high bough error?
Yes did you read the guide
OOOF.
@high bough error?
@zenith terrace NO
I just saw you need discord.js and I was like W-
Lol.
I was like W- I already have a .js file.
Do you need node.js AND discord.js!?!?!?
@earnest phoenix
npm install --save node@12.13.0
npm install --save discord.js@12.1.1
Kayui I can see you are not sending any message if the message.author.id !== Config.ownerId
@earnest phoenix how old are you 
I am not telling you private info.
Kayui I can see you are not sending any message if the message.author.id !== Config.ownerId
@pallid zinc It will affect the messag, but the message is sent automatically
Yeah, but I have Autism, so it is hard for me to think straight.
so i suggest you take a huge step back and actually learn programming before jumping into bot development
U are only sending message when both IDs are same
If it's owner, then it will define user as members.mentions.users.first() otherwise, it will only define user as message.author
I'm learning programming now, I am just making sure I have everything right.
Start from the basic, dude.
check if your id is correct in config
Yes
Oh, I made a bit of correction```js
if (command === "balance") {
var output = await eco.FetchBalance(user.id);
var user;
if (message.author.id !== config.ownerID) {
user = message.author;
} else if (message.author.id === config.ownerID) {
user = message.members.mentions.first();
if (!user) {
user = message.author
}
}
const baleembed = new Discord.MessageEmbed()
.setAuthor(${user.tag}, ${user.avatarURL()})
.setColor([173, 216, 230])
.addField("Balance", "" + "" + "")
.setFooter(${footer}, ${user.avatarURL});
message.channel.send(baleembed);
}
Try sending hello message inside the if statement
Woohoo!
if (command === "balance") {
var user;
if (message.author.id !== config.ownerID) {
user = message.author;
} else if (message.author.id === config.ownerID) {
user = message.members.mentions.first();
if (!user) {
user = message.author
}
}
var output = await eco.FetchBalance(user.id);
const baleembed = new Discord.MessageEmbed()
.setAuthor(`${user.tag}`, `${user.avatarURL()}`)
.setColor([173, 216, 230])
.addField("**Balance**", "**" + `${output.balance}` + "**")
.setFooter(`${footer}`, `${user.avatarURL}`);
message.channel.send(baleembed);
}
Oh.
Try logging the user in both case
It wouldnt be qualified as spamming
Try logging the user in both case
@pallid zinc I played with it a bit, and only the embed won't show up
The conditions doesn't matter, it just won't show up
Ok
Common issue?
See Kayui much cleaner code and easy to understand if something breaks :/
It mean send the embed inside the if statement
See Kayui much cleaner code and easy to understand if something breaks :/
@prime cliff yeah, true
Btw does djs even allow both user.avatarURL() and user.avatarURL ?
Actually, I think I've found the issue
Btw does djs even allow both user.avatarURL() and user.avatarURL ?
@prime cliff Djs 12.1.1 uses user.avatarURL() instead of user.avatarURL
(node:7512) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.footer.icon_url: Not a well formed URL.
Yeah, something's up
I literally didn't see that xd
Actually, it was just that my coding skills are so low, I didn't notice this.
var user = message.members.mentions.first();
Which is supposed to be
var user = message.mentions.users.first();
XD, but thanks @prime cliff
div id="list"
div id="1"
div id="2"
really basic layout of my code there
$('div#list').each((i, elem) => {
$(`div#${elem.id}`)
});
that's what i'm trying to use but all i get is the original div (div#list)
so how do i fix that so i can get each div.id (div.1/2)
Hello i want to use external emoji in discord embed have u got a cod to help me ?
what
client.emojis.find(emoji => emoji.name === "yourCustomEmojiName");
in emoji.name i put the name of the emoji to use in my embed ?
Yep
This @dreamy breach client.emojis.find(emoji => hammer === ">:paladium_hammer:689575253751365743<");?
just: paladium_hammer
So I have an array with some file names and a function which downloades the files by their filenames and I want to download them at the same time and do a console.log when all the files finished downloading. To download them at the same time I use forEach, and to console.log when all the files downloaded, I use a ```js
if(arr.indexOf(element) == arr.length - 1) console.log('files downloaded successfully')
What should I do?
So:
client.emojis.find(emoji => emoji.id === "689575253751365743");
Or: client.emojis.find(emoji => emoji.name === "paladium_hammer");
@earnest phoenix
Okai
searching by emoji id is btter
yep to avoid issue if there is multiple emoji with the same name.
^
and how to use this emoji ?
wdym?
const botconfig = require("../botconfig.json");
const red = botconfig.red;
const green = botconfig.green;
const orange = botconfig.orange;
const moment = require("moment");
moment.locale("fr");
console.log(`Prêt à pendre des commandes Chef !`)
module.exports.run = async (bot, message, args, client, user, emojis) => {
client.emojis.find(emoji => emoji.id === "689575253751365743");
let good = new Discord.RichEmbed()
.setDescription(`${emoji_hear} test pour hammer `)
.setColor("GREEN")
.setFooter(`Shop`)
message.delete().catch(O_o=>{});
channel.send(good);
}
module.exports.help = {
name: "test"
}```
It's my cod
Just put:
const emoji_hear = client.emojis.find(emoji => emoji.id === "689575253751365743");
Okai
channel.send()
Umh... I have this error but i have defind my emojis
at Object.module.exports.run (/home/container/Commandes/test.js:12:27)
at module.exports (/home/container/Events/message.js:16:17)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:789:20)
(node:25) 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:25) [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.```
In HTML, what's the exact difference between name and id attributes?
What's ur discord.js version? @earnest phoenix
v11
Try to move to latest
But i change all my cod ?
Maybe
Except if you are using some specific v11 function, moveto v12 will not affect a lot of things
Oh I'm stupid
Yeha sry, missread the error log
So put:
const emoji_hear = bot.emojis.find(emoji => emoji.id === "689575253751365743");
Just i test
@barren swallow But he also have client on the function x)

Guys see this ```const Discord = require("discord.js");
const botconfig = require("../botconfig.json");
const red = botconfig.red;
const green = botconfig.green;
const orange = botconfig.orange;
const moment = require("moment");
moment.locale("fr");
console.log(Prêt à pendre des commandes Chef !)
module.exports.run = async (bot, message, args, client, user, emojis) => {
const emoji_hear = bot.emojis.find(emoji => emoji.id === "690098366453252126");
let good = new Discord.RichEmbed()
.setDescription(`${emoji_hear} test pour hammer `)
.setColor("GREEN")
.setFooter(`Merci d'avoir fait appelle au Zelkoa - Faction Shop`)
message.delete().catch(O_o=>{});
message.channel.send(good);
}
module.exports.help = {
name: "test"
}``` = my cod and say this
What's ur client variable?
did you define the Client as bot or client?
@slender thistle isnt it like user usernames and ids, its just better to use the id for storing and stuff?
That's why I asked
Yes
Id is unique ? @slender thistle
Well apart from that 
Did u check stack?
Of course, there's more to it than that, but it will definitely get you thinking in the right direction.```
Yeah, reading right now :p
Second answer explained it just fine
😉
Either way, thank you 
And how to solve my probleme ?
@earnest phoenix Comment tu définis ton client ?
Replace client.emojis.find with bot.emojis.find
Bah module.exports.run = async (bot, message, args, client, user, emojis) => {
Non mais comment tu initialises ton client.
Dans ta classe main
Will help him @barren swallow ;p
Wait why you have both bot and client
🙂 👍
can some one help with my bot? i have come to the part that i have to get the bot to that i need to get my bot up runing
@pallid zinc That's strange x)
Bah enfaite je sais pas je vois rien dans mon main
@earnest phoenix what's up?
Ask ur issue @earnest phoenix
Hmm maybe I noob
C'est quoi la classe ou tu te login avec le bot @earnest phoenix et là où tu initialises la commande.
i need to get my bot up runing. how do i do that?
@pallid zinc No! xD
mon index.js
Yep
@earnest phoenix do you have any programming knowledge?
@earnest phoenix what have you done so far?
no
const client = new Discord.Client();
client.commands = new Discord.Collection();
const fs = require('fs');
const prefix = "s!"
fs.readdir('./Commandes/', (error, f) => {
if (error) { return console.error(error); }
let commandes = f.filter(f => f.split('.').pop() === 'js');
if (commandes.length <= 0) { return console.log('Aucune commande trouvée !'); }
commandes.forEach((f) => {
let commande = require(`./Commandes/${f}`);
console.log(`${f} commande chargée !`);
client.commands.set(commande.help.name, commande);
});
});
fs.readdir('./Events/', (error, f) => {
if (error) { return console.error(error); }
console.log(`${f.length} events chargés`);
f.forEach((f) => {
let events = require(`./Events/${f}`);
let event = f.split('.')[0];
client.on(event, events.bind(null, client));
});
});
client.login('ah ah lol');```
Mon index.js
If think you don't understand what the principe of:
module.exports.run = async (bot, message, args, client, user, emojis) => {
Client client bot any difference
You aren't obliged to put any variable, you have to choose which one you want to get from tje index.js file.
^^
So idk why there is user and emojis params.
@earnest phoenix what have you done so far?
Since you can get them with message and bot.
Woh !
Idk
i have connected my bot to my server, but not other than that i think
Just go to index file second line second word change it to bot
@pallid zinc smh
I replace all client with bot
@earnest phoenix what's your message event
@earnest phoenix here's how a bot works:
when you create a bot application in discord, you are basically creating an account for your bot. it gives you a login code known as token, and an url to add your bot to servers.
Now you need to use this token to make your bot login. A bot is a program that runs on some computer or server and uses the token to login to discord in order to interact with it like a real user, but with automation. Creating a bot requires knowledge of programming/coding, and you need to build the program that will run the bot
hey are there any ppl here who cam help me in html stuff ?
Omg so long msg
the double @ xD
post your issue here
^
We can all help you together
umm actually we are trying to make our own bot list we need help
Oh well
That's funny.
@earnest phoenix here's how a bot works:
when you create a bot application in discord, you are basically creating an account for your bot. it gives you a login code known as token, and an url to add your bot to servers.
Now you need to use this token to make your bot login. A bot is a program that runs on some computer or server and uses the token to login to discord in order to interact with it like a real user, but with automation. Creating a bot requires knowledge of programming/coding, and you need to build the program that will run the bot
@quartz kindle how to do that? i have added my bot to my server
Asking for help in another bot list.
@earnest phoenix dont ask in a bot list ppl to make another bot list
i know
seems kinda stoopid
thats why i am not asking them
@earnest phoenix you need to learn programming. pick a beginner-friendly programming language such as javascript or python and look into some basic courses online
I replace all client with bot and no work
So... what's the issue?
@earnest phoenix that wasn't the problem
or hire a teacher to teach you
hire tim
What's your message event
ok
I have a program for that @earnest phoenix
What's the probleme
umm can anyone help me make it ? we have codes
I want to use a external emoji
@earnest phoenix what's your message event
How can I put a picture of the bot on .setFooter?
It's under development and might lag on big servers - loading users.
@earnest phoenix First fix your class load.
@earnest phoenix
.setFooter("Message", client.user.avatarURL)
umm can anyone help me make it ? we have codes
So you need a frontend developer for your botlist
What's class load ?!
Class is a file of your project. So fix the way you are registering commands.
How you are loading commands.
shivaco, you a frontend dev?
so how do i get messagecontent before /?
idk
Eh... can copy stuff here and there and know how to style most stuff
@earnest phoenix what's your message event?
I have a program for that @earnest phoenix
@elder vine can you send link in dm?
help me pls?
@thorny meteor explain
it's this ```const Discord = require('discord.js');
const prefix = 's!';
const fs = require("fs");
module.exports = (client, message) => {
if (message.author.bot || message.channel.type === 'dm') { return; }
if (!message.channel.permissionsFor(client.user).has('SEND_MESSAGES')) { return; }
if (!message.content.startsWith(prefix)) { return; }
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let commande = args.shift();
let cmd = client.commands.get(commande);
if (!cmd) { return; }
cmd.run(client, message, args);
};```
Ehh sure.
so how do i get messagecontent before /?
Let me get a link
input: !test hey/bro
output: hey
1 sec
Now what's the command file @earnest phoenix
.split("/")
i want args as the message content before /
.split("/")
@quartz kindle i tried this give messagecontent after /
ok
it's this ```const Discord = require("discord.js");
const botconfig = require("../botconfig.json");
const red = botconfig.red;
const green = botconfig.green;
const orange = botconfig.orange;
const moment = require("moment");
moment.locale("fr");
console.log(Prêt à pendre des commandes Chef !)
module.exports.run = async (bot, message, args, client, user, emojis) => {
const emoji_hear = bot.emojis.find(emoji => emoji.id === "690098366453252126");
let good = new Discord.RichEmbed()
.setDescription(`${emoji_hear} test pour hammer `)
.setColor("GREEN")
.setFooter(`Merci d'avoir fait appelle au Zelkoa - Faction Shop`)
message.delete().catch(O_o=>{});
message.channel.send(good);
}
module.exports.help = {
name: "test"
}```
let split = message.content.split('/')```
more code
split[1]
@earnest phoenix console.log bot.emojis
first item will be / right?
"a/b".split("/") = ["a","b"]
? what ?
[0] = "a"
[1] = "b"
let split = message.content.split('/')
const test = new Discord.MessageEmbed()
.setTitle(split[1])
message.channel.send(test)```
In the cmd console.log(bot.emojis)
ok after ?
What does it log in console?
i startd
console.log(bot.emojis)
ReferenceError: bot is not defined
at Object.<anonymous> (/home/container/Commandes/test.js:9:13)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at commandes.forEach (/home/container/index.js:14:28)
at Array.forEach (<anonymous>)```
error
Bruh
@earnest phoenix did you copy all that code from somewhere?
copying code is not a good idea
No ? Just in other command in my bot
Don’t lie 😅
because code is very specific, it only works in the exact situation it was mode to work on. if you copy and paste code that was not made specifically for your use case, it will never work
can i remove a certain message from the message content?
yes
whats the syntax?
a word
is it always the same word? located anywhere in the message?
@barren swallow After error ?
yes
.replace("word","")
what will be inside the second quotes?
what to replace with
message.split(‘word’).join(‘ ‘) can be useful for a replace all.
@earnest phoenix where is the console.log?
"" = replace with nothing
where is ? in my cmd
nothing means empty message or whatever that is left after removing the word?
The console.log(bot.emojis)
"abcd".replace("b","") = "acd"
"abcd".replace("b","f") = "afcd"
Inside the module.exports.run?
no
Ok no error after ?
And what does it log?
clear.js commande chargée !
Prêt à pendre des commandes Chef !
cmd.js commande chargée !
Prêt à pendre des commandes Chef !
finish.js commande chargée !
help.js commande chargée !
ping.js commande chargée !
Prêt à pendre des commandes Chef !
refus.js commande chargée !
test.js commande chargée !
2 events chargés
ShoP's est en ligne.
this
bot.py
import os
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
client = discord.Client()
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
client.run(TOKEN)
can someone help me?
..wtf.. this in all my console
😄
wtf 😂
Ok
you're logging an object prolly
Then the emoji Id correct?
@earnest phoenix top left.
@earnest phoenix thats python code. if you want to make a bot using python, you need to learn python programming
It's a emoji on other server
@earnest phoenix console log emoji_hear
@earnest phoenix is the bot in the server?
@earnest phoenix it depends on what kind of keyboard u got 
...no...
@earnest phoenix SMH
"SMH" ?
at Object.module.exports.run (/home/container/Commandes/test.js:11:13)
at module.exports (/home/container/Events/message.js:16:17)
at Client.emit (events.js:198:13)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:789:20)
(node:24) 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:24) [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.```
@earnest phoenix
STOP tagging me.
You will get a response when someone is available to respond.
Laptops have varying keys.
Top left button, under the esc, typically. depends on what keyboard.
@earnest phoenix the bot must be in the server
What
^^
iara going wild 
Okay it's good @barren swallow but in my console
Ye don't worry, incite the bot to the serve the emojis in and try agaian
@earnest phoenix looks like either you are logging the "message" object or "guild" object, either way somewhere you are console logging something
def not a msg
How do you loop a command?
Or how do you use that look thing
Jees my english does somone understand me ?😂
Python
Oh ty for trying
@wise quartz You need to use flush on the print statement
python doesnt rlly do that kind of progress bar
A little more explaination?
to make it update that one line without printing a new one
use in a print statment
flush=True
I don't think ur understanding my point
the progress bar can just be done with lines
Look lemme explain what i wanna do ok?
or other Unicode
ngl thought u were talking about that guy xD
my bad
what was your issue / what do you wanna do
I am doing a countdown command. What should the command do is you give it a number and the bot starts counting down from that number like 10 9 8 7 6... etc
So what i am trying to do
Is
First send the number then edit the message and send the number by -1
Then loop that
Then i add an if so if the number is 0
make a talk and asyncio.sleep ig
Say finished
How? Thats my question
I have "[object Promise]" how can I convert it to string?
async def my_loop():
while True:
print("i no block pa pa")
async def main():
asyncio.get_event_loop().create_task(my_loop())
example of using loop tasks
I've been working since the morning I'll go crazy
The closest to the bot host
Where is the host located?
Well, find out where the glitch host you're on is hosted by pinging.
its hosted on aws
region
america most likely
^
Alessandro
Yes.
Add new db user
and set atlas admin
save the password you created there for later
now to add ip
0.0.0.0
You want to allow access from all locations (0.0.0.0)
to whitelist all
Let me see.
Should be Network access
Go to Network Access
add ip address
And whitelist all ips
0.0.0.0
Or click the button that says whitelist all ips or something
yes
Yes.
Then go to Clusters - and click connect
then connect with your application
Copy the string
connect your application
Copy that string
and that you will use by mongoose.connect()
then mongoose.connect(CONNECT_STRING, { useNewUrlParser: true, useUnifiedTopology: true });
yes
yes
and change the username:password - to the password that you created in the earlier steps
yes
change <password> with the password you created in as atlas admin
no
without
Use the string here
mongoose.connect(CONNECT_STRING, { useNewUrlParser: true, useUnifiedTopology: true });
as the CONNECT_STRING
also
and download the npm package
add log
npm install mongoose
mongoose
How do I send a message in DM? It says shit about promises idk how that is I just wanna send somethi ng
https://little-files.glitch.me/data?file=53OO00IK.png how do i use it
Discord.js btw
Does it work for users too? @elder vine
Like message.author.send("hi");
@sullen salmon define the user
Huh?
Yes.
like user = message.mentions.user.first();
You can now make models and start using the database
user.send('gay')
Hmm it's rejecting probably because no common servers
they are called schema
You can't DM them if they're not in a common server, if I'm correct.
sure
In index.js
no.
you can make a schema but the mongodb string should be in the main file.
like where you're handling stuff.
How do I check for common servers?
Discord.js v11 or v12?
Latest
@earnest phoenix coz index.js is ur start up file
and mongoose has to connect to ur project on startup
nope
well
if u have a command handler
ur index.js reads the command files
so they are connected to ur index.js
You only need it in index.js
Connecting it multiple times will cause errors.
It's fine, just connect mongoose in index file
No problem.
?
Use the string you created
Login using email and password
yea what about the dashboard
No problem
Hmm..
hm...
1 sec
const mongoose = require('mongoose');
mongoose.connect(process.env.DBTOKEN, {
useNewUrlParser: true,
useUnifiedTopology: true
});
This should work...
You should make it in a config.js
and
const dotenv = require('dotenv');
dotenv.config();
let config = {
mongodb: process.env.MONGODB,
}
module.exports = config
and use config.mongodb instead
idk if it caught it as a string or not..
Weird..
where did you put dbtoken?
did you do
DBTOKEN=string here
const dotenv = require('dotenv');
dotenv.config();
let config = {
mongodb: process.env.MONGODB,
}
module.exports = config
paste this
and install dotenv module
then use
const config = require("./config")
in index.js
and:
mongoose.connect(config.mongodb, {
useNewUrlParser: true,
useUnifiedTopology: true
});
@earnest phoenix you use glitch, yes?
He does.
He doesn't need dotenv
owo
Glitch automatically handles env files
Well, might be good for deployment to vps etc. later
show me the string (remove password ofc.)
lol
remove the secret stuff 😛
the mongodb string without password
Why MONGODB= twice?
Looks fine
You used the password for the Bot_Discord user that you created inside the atlas?
and removed the <>
this is mine
so it works now?

Well, good it works now tho.
Np
Hi
No, just do your research and it should go fine.
look for code thats spawning somthing but never closing it
highly doubt it
unless you're creating a new DBL in your message event or something stupid
umm anyone who is pro in html ?
It posts randomly
umm anyone who is pro in html ?
@earnest phoenix
im tryna transpile some stuff that doesnt flag errors in ts but the ts generated code does error
idk whether that should ever happen
or if its better to open an issue on the ts repo
plz help me
Help is not asking someone to code your whole website.
ohk sorry
You should begin learning yourself html, css, and javascript I KNOW YOU.
I don't know, check the error.
How do I start a new Command?
Do you use a cmd handler in a folder Aayala?
no?
Click it, Alessandro
Aayala, how does the current code look like?
Use hasteb.in
No.
Click on the Botdiscord Alessandro
what are you showing?
What is that?
Go to clusters
show more
than just the text
Do you have issues with it?
oh, that might be why
gl leny
When i do this the bot keeps repeating itself how can i fix that?
var myGuild = bot.guilds.cache.find(g => g.id == guild_id)
var logChannel = myGuild.channels.cache.find(c => c.id == channel_id)
logChannel.send(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`)```
Which guild are you tryna send to, one or all
yeah
.get(guild_id)
I want it to log its own messages just not the ones in that channel its posting the logs to
Ok
let tim = bot.fetchUser('180112943612952577').makeUptime24/7()
if(tim).makeUptime24/7 === true, stayInDevelopmentChat.toHelpPeople;
bot.login(timToken)```
Hi
@heavy anchor then make it ignore that channel
if(message.channel.id === logschannelid) return
if(message.channel.id === logChannel.id) {
//what you want it to do in that channel
}
//rest of the logging of it's own message
}```
how do I make it ignore the DMs?
if(message.channel.type === 'dm') return; - discord.js
check for existance of guild, or check for channel type
alr thanks
.makeUptime24/7() is invalid tho
and you cant name a function as 7 lmao
Shhhhh
lmao
I mean technically you can but you can't call it like that ;d
let tim = bot.fetchUser('180112943612952577').makeUptimeForever()
if(tim).makeUptimeForever === true, stayInDevelopmentChat.toHelpPeople;
bot.login(timToken)```
Hah
Changed
how would you declare it?
knowing javascript, there's probably some weird way to get it to work
actually went and did that xD
@zenith terrace your code is still wrong lmao
well you'd have to do it in an object / class
fetchUser is a promise
Y u bully ;-;
let tim = bot.users.get('180112943612952577').makeUptimeForever()
if(tim).makeUptimeForever === true, stayInDevelopmentChat.toHelpPeople;
bot.login(timToken)```
:)
Better be right

istg tim stahp ruining the fun 😂
n7
pfft
[]
if something piques my interest i become unstoppable
lol i see
Am I just being stupid now the bot is not posting anything
bot.on('message', msg => {
if (msg.channel.id === 694345224381530172) {
console.log(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
var myGuild = bot.guilds.cache.get(g => g.id == 692419586242641925);
var logChannel = myGuild.channels.cache.get(c => c.id == 694345224381530172);
logChannel.send(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
};
});```
7()
@heavy anchor that will make it post only if the messages come from that channel
change the numbers to strings
it takes a snowflake
Now I know not to be near tim with joke codes 
<3
yes but gives you a coding lesson when you are only joking lol
if (tim.isJoking) Nightmarionne.destroy()
lmao
thats tim on so many levels 
Well consider yourself lucky cause this server isn't supposed to offer coding support.
do you guys make your bots do anynthing special on april 1st?
any ideas?
^
mine trolls people
make a 1% chance to post an "interesting" video instead of the command.
How do I add another code for a command?
Mine just plays the same song if anyone queues
Have your bot make it look like its been hacked 
It just doesn't care what you queued and just plays https://www.youtube.com/watch?v=dQw4w9WgXcQ
Rick Astley's official music video for “Never Gonna Give You Up”
Listen to Rick Astley: https://RickAstley.lnk.to/_listenYD
Subscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/subscribeYD
Follow Rick Astley:
Facebook: https://RickAstley.lnk.to/f...
10/10
kind of what youtube did once
Uhm
how is your current command coded?
a basic way to make multiple commands is like this js if(message.content === "pb!hug") { // do hug command } else if(message.content === "pb!ping") { // do ping command } etc...
etc
if you are gonna make commands that require a user input, like "pb!command something", then you can use message.content.startsWith("pb!command") instead
I'm trying to get them to ping a user when they are hugged
message.mention[1] hugged message.mention[2]
or 0, 1
depending on if your language is bad
Yeah @quartz kindle
/home/container $ node bot.js
/home/container/bot.js:1220
client.on("message", (message)) => {
SyntaxError: Unexpected token .
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
```Error... Why it doesn't work??

@wide wharf https://lumap.is-inside.me/nOvOCH0k.png remove one of the ) plz
But the error is about the .
idc
client.on("message", (message)) => {
remove it first
It's needed:
client.on**("message", (message))** => {
It should be
client.on("message", (message) => {
})```
@wide wharf hell no
Owh okay
ur ending it before it even started
Lemme test...
you don't even need the round brackets around message
unless 😳 it has more than one argument
I am part of the Python initiative, we don't believe in the cult of {}
doing client.on('message',(message)) => {} is like client.on(), its useless
CF8, do you know the way of dictionaries. 
https://lumap.is-inside.me/aj9xtUAW.png found it uwu
owo
what's it for? logging?
old content
I need help because I made a bot where they can respond to you when you hug them, and I'm having a difficult time getting said bot to communicate.
That's my code
May I ask something??
yes u can
second what?
@earnest phoenix client.on('message'
oh
What service do you guys use to keep your bots online?
there should be only one
@clear wraith I have a vps, so I need nothin to keep it up
There I did it
so now
Ok, Well my bot keeps going down.. so im not sure what service to use for it
I am there
what u dont understand
I don't understand how to ping a user when my bot hugs them
is ur bot even working
?
client.on('message', message => {
if (!message.content.startsWith(prefix))
return;
if (message.content === 'replaced') {
message.channel.send('why did you say the r word?');
}
else if (message.content === '!pb tickle') {
message.channel.send('Stop tickling me! *Laughing*.');
}
else if (message.content === '!pb hug') {
// grab the "first" mentioned user from the message
// this will return a `User` object, just like `message.author`
const taggedUser = message.mentions.users.first();
message.channel.send(`I'll hug you I guess only because you asked. * hugs: ${taggedUser.username}*`);
}
});
should just be this
Ok It works but there is a small issue it spams the response
What do I do?
Also this pops up on the })
which one did it spam
the tickle
ik
put **return ** before every message.channel.send
this does not work I'm an Idiot idk what I'm doing
bot.on('message', msg => {
if(msg.channel.id === 694345224381530172) return
var myGuild = bot.guilds.cache.find(g => g.id == 692419586242641925);
var logChannel = myGuild.channels.cache.find(c => c.id == 694345224381530172)
logChannel.send(`${msg.author.username}: "${msg.content}" ${msg.guild.name} ${msg.guild.id}`);
});```
a,d they are strings too
not actual numbers
and doing that will cause ratelimits
ur bot will lag af
if(command === 'test'){
const filter = (msg) => msg.author.id === message.author.id
message.channel.send('test3').then(() => {
message.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
.then(collected => {
message.channel.send(`Test1`);
})
.catch(collected => {
message.channel.send('Test2');
});
});}
Why dont work?
what dont work
the boy dont say nothing
v11 or v12?
v11.5/6
lmao
It keeps Re-posting its own messages from channel it's not supposed to have access to
@heavy anchor its logic
catch collected lol
its not even that bad?
u have to do something if message.author is client.user @heavy anchor
sec tim
look at this
Like this?
oh lord
@earnest phoenix it will work yea
He's still doing it :_:
Lumap
:v
so basically to fix my music bot I have to go back to discordjs v11 and node v10 mhm
Do you know how I can get the bot to send its invite link?
literally send it
copy paste the invite link
Can someone help me? im tryting to do that a command can only be executed if you have upvote my bot (for example 5 times)
Its still spamming 😫 👌
show full code
thought wrong
Can someone help me? im tryting to do that a command can only be executed if you have upvote my bot (for example 5 times)
?
here's my code
@quartz kindle
it's a mess
y does this n0t w0rk
let content = message.content.split(" ");
let command = content[5];
let args = content.slice(1);
let prefix = config.prefix;
//checks if message contains a command and runs it
let commandfile = client.commands.get(command.slice(prefix.length));
if(commandfile) commandfile.run(client,message,args);
error i get:
node:313856) 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:313856) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of undefined
?
can someone tell me what the difference between these 3 are
do you re-login when your bot disconnects?
google?
says its a backup file but I never made a backup file
console log content
should you relogin when your bot disconnects?
nop
it should reconnect
How do I fix it?
lmao imagine creating one command for each argument
^
how would I bulkDelete messages while ignoring any boost messages
msg.channel.fetchMessages({ limit: 100})
.then(messages => {
messages.forEach(messag => {
if(messag.type.includes("USER_PREMIUM_GUILD_SUBSCRIPTION")) return;
message.delete()
})
} );
I tried this, but its a bit... slow, and also deleted one of the boost msgs
You can ignore any sort of messages
I removed the messages
Please don't delete each message one by one.
message.delete()
/
|
i think that was supposed to be 'messag' because theres nothing defined as 'message'
Ye, i had accidentally added the e
ok
Hello Bois
<Message>.type is a string. Keep an array of the boost types, and filter those. Example:
(fetchedMessages).filter((msg) => msg.type !== "theType")
y does that not work?
client.on("message", async message => {
//a little bit of data parsing/general checks
if(message.author.bot) return;
if(message.channel.type === 'dm') return;
let content = message.content.split(" ");
let command = content[0];
let args = content.slice(1);
let prefix = config.prefix;
//checks if message contains a command and runs it
let commandfile = client.commands.get(command.slice(prefix.length));
if(commandfile) commandfile.run(client,message,args);
})
everything is defined
for example the "config.prefix"
config is defined
and yeah
I don't have that thing you told me to remove @zenith terrace \
NotSteve do you get an error message.
send ur code then, the updated one
nop
whenever i try to send
a cmd
it just doesn't trigger anything
i can send source lol
You could try logging each variable to see what doesn't look right. If commandfile is undefined, either the command doesn't exist or the variables you use to get it aren't right.
okay
undefined?
always undefined
:/
this part is changing it
but
let props = require(`./commands/${f}`);
console.log(`${f} loaded!`);
client.commands.set(props.help.name, props);
this part works but idk if the "client.commands.set" part works
what r u tryna do
client.commands = new Discord.Collection();
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`);
console.log(`${f} loaded!`);
client.commands.set(props.help.js.name, props);
client.commands.set(props.buy.js.name, props);
client.commands.set(props.bal.js.name, props);
client.commands.set(props.balance.js.name, props);
});
client.on("message", async message => {
let content = message.content.split(" ");
let command = content[0];
let args = content.slice(1);
let prefix = config.prefix;
//checks if message contains a command and runs it
let commandfile = client.commands.get(command.slice(prefix.length));
if(commandfile) commandfile.run(client,message,args);
console.log(commandfile)
})
very long
but
yeah
i just want it load cmds from other local files
for exmple
example*
o k i h a v e n o e x a m p l e s
lol
How to display other user's complete activity details?
I could only able to make display Activity name
presence.activities
I want to display it's details like if someone user is playing Visual Studio code then it'll display :-
Playing Visual studio code || Editing index.js || workspace
i load files from an local machine folder and then
i check if one of them are typed (part which doesn't work)
so yeah
@muted bramble raw api calls perhaps
discord api docs, make a api request through your lib
Ah
Actually I have seen discord.js api but I didn't understand
That's why I asked here
Is there a way to simplify isNan(a) || isNaN(b) || isNan(x) in js
You could turn it into a method @slender thistle
use function
Put all the values in an array and then you can iterate through the array checking if it's a number or not
@slender thistle
const arr = [ "a", "b", "c" ]
arr.some(s => isNaN(s))
Exactly
Because it was a dev question and I am a good bean 
i think that's the only way
how ya become a library dev?
d
by being a recognised dev for a lib
Oh, .some returns a boolean
that's even better, ty 
your file is not a database.



