#development
1 messages Β· Page 562 of 1
Yea
You need to rename your script to something else, preferrably not a standard python module.
@keen drift just ask the question /shrug
failed /shrug
it's also in the topic don't ask to ask
I did, if it detects the file it crashes and when i remove the json file its fine but cant save data
So uh, how does env passing work in docker and kube
Do I need to do anything special in dockerfile
idk wild
maybe someone else knows
go to the python discord support server
if there is one
docker run -e K=V image
And in kube?
Β―_(γ)_/Β―
wew
guys pls suggest improvements to my site
See this article on http://css-diary.com/css-gradient-ball/ Forked from Nikul Lakhani's Pen [CSS Gradient Ball/Sphere...
ty
.sphere{
box-shadow: left_position top_position blur distance colour inset;
box-shadow: -5px -5px 5px 5px rgba(0,0,0.0.5) inset;
}
http://tech.chitgoks.com/2013/05/08/how-to-add-css-inner-shadow-in-textfield-or-textarea-in-java-fx/
This is how you add an inner shadow effect to either a text field or text area in Java FX.
squares

π©
Wait is this supposed to be like those science things
that you slide the balls on the rod
ye
ahh
Someone know a package for transform 1000 to 1K
?
i make that if(curargent > 999) { curargent = `${curargent / 1000}K` } else { curargent = curargent }
So its working but
if i have 1234 credits he say 1.234K
@keen drift round?
wot
No
do you know what rounding is
wew first grade all over
Rounding a number is when you take a number and "bump it up" or "bump it down" to a nearby and "cleaner" number
you can round 1.234k to 1k
and if a number is at a variable of 5, then your round up
Math.round?
yeah
don't worry we're all stupid
@keen drift you know what?
you stupid
stinking
fish

wow fishy stop ignoring my dms
smh, I didn't ignore it, just didn't read it yet
hey guys, i'm new in here, as well, in bot development. I just made a bot in discord.js by node.js, and my bot only stays online when i run the code.
it has any way so i can set the bot online without leaving my code running? because i would need to let my computer on
do i pay anything?
got it
do you have any indication?
yup
like do you want a link to a host?
just a trustable one
sure give me a sec
here's a decent one from https://digitalocean.com
https://wp.mypip.pw/Yd8mv
https://vultr.com/ can do cheaper with
https://wp.mypip.pw/Ysvwh
there are a huge range of options as well, hope this all helps https://kens-bakery.club/DFiV4
I wouldn't use that
You can get way more, way cheaper with https://silkyservers.com
looks sketchy tbh
i've had experience with vultr and they're rather good @daring sage
π
@earnest phoenix silky's website is literally a template
From their sponsor
got it, thanks @sick cloud
π
swifti why would you do that though
I wouldn't use that
you make it sound like vultr and DO are dodgy
they're super well known and trusted
what kind of css would remove the borders off this
i tried this
table, thead, tr, th, tbody {
border: none !important;
outline: none !important;
}
``` but had no success there
can i have the link
to that page?
yes
it's on another bot list
ok well ill go to it but yes
alrighty
.markdown-body table,
.markdown-body td,
.markdown-body tr,
.markdown-body th,
.markdown-body thead,
.markdown-body tbody {
border:none !important;
outline:none !important;
}
awesome, thanks
Hey My pc isnβt working and I need help in creating a discord bot
use glitch
reactions:
Collection [Map] {
'π' => [MessageReaction],
'π' => [MessageReaction],
'π
' => [MessageReaction],
'π€' => [Circular],
'π' => [MessageReaction],
'π' => [MessageReaction] },
Hey can someone explain to me why one of the emojis is "Circular"?
This is in MessageReaction
Thanks
Quick question
Is using a database to keep track of starboard messages overkill? Or should I just keep track of say, last 100 starred messages or something?
Makes sense
@crude portal google told me this
Thanks! Lol I should've google it myself

Is there anyway to get the raw data object from the User instance in discord.js master?
congratulations
lol
help me..!
i want logging some one change nickname
clinet.on("guildMemberUpdate", async (oldMember, newMember) => {
if(oldMember.nickname == undefined){
var old = oldMember.username
}else if(oldMember.nickname == null){
var old = oldMember.username
}else{
var old = oldMember.nickname
}
if(newMember.nickname == undefined){
var newm = newMember.username
}else if(newMember.nickname == null){
var newm = newMember.username
}else{
var newm = newMember.nickname
}
console.log(old)
console.log(newm)
var logs = oldMember.guild.channels.find(c => c.name === 'wλ΄-λλ€μ-μ
λ°μ΄νΈ-μΆκ°μ€');
if (!logs) return
if(old !== newm){
const cembed = new Discord.RichEmbed()
.setTitle("μ μ μ
λ°μ΄νΈλ¨")
.setColor("RANDOM")
.setDescription(`μ : **${old}**\nν : **${newm}**`)
.setTimestamp(new Date());
logs.send(cembed)
}else{
return
}
});
i write like it
bot working
but.. bot print oldMember.username or newm = newMember.username
= null or undefined... help me T.T
because the event also fires for new nicknames and removed nicknames
old or new could be null
Yes @sick cloud i'm agree with You
oh..
how can i fix it..?
I think in your last if
um... i can't understand..
clean your code
maybe you'd actually understand it better if it wasn't a crazy mess
oh i got it..
i fix that source
Aight
So its made in discord.py
But how do i make the bot respond to a message
for example if i write in the chat "reeee" the bot responds "reeeee"
Well I dont use python, I suggest you read the docs then
Yeah i did
However it doesnt mention exactly how to solve my situation as far as i can tell
that's because ur supposed to use ur brain to put 2 and 2 together
Ty dad
you have a message event listener in the library which does something whenever your bot receives a message
said message has content, check if the content is "reeee" and if so reply to it
- you learn python and you understand the basics of programming
- you make a bot and learn the documentation and get provided the basics of how to manipulate the library
- you put 2 and 2 together
Cheers @marble needle
i suggest you do what @languid dragon told you before attempting to write a bot, especially the first point
PFF
woah imagine having to learn about what you want to do before doing it 
ikr
hell naw
jumping right into the deep end and asking people for help > fuck yeah
Damn right
he left
probably expected to get working code thrown his way
yeah, i told him that is not easy, and that he has to install the environment and dependencies and what not, and send him a guide
he sends me a screenshot of the guide and asks "where do i click now?"
should've told him to set up a dev env on his main rig and remote desktop to do work from his phone 
he doesnt have a pc
well, that's unfortunate
coding on your phone doesn't seem like the most convenient thing either
I coded my bot on my phone 
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ninja\Desktop\bot
gyp ERR! node -v v11.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok```
im getting this when im trying to rebuild node-gyp meaning i cant install any of the addons i need
@earnest phoenix coding is one thing, coding AND running/hosting is another
my bad then lul
but yeah he wanted run it on his phone, because he had no computer and no vps
may aswell code on paper
js
Oh
@slim heart did you change/update node?
bindings are locked to specific versions
i dont have a binding file
and idk what it is
im at the binding.gyp wiki page and i dont get it
do i put it in package.json?
no, binding files are for building native code
so what do
let me check their github
I think I'm crazy, but I think I saw that thumbnail floating in that embed
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ninja\Desktop\bot\bck\node_modules\bignum
gyp ERR! node -v v11.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bignum@0.13.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bignum@0.13.0 install 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\ninja\AppData\Roaming\npm-cache\_logs\2019-01-28T16_38_37_839Z-debug.log```
@slim heart from what i understood, node-gyp is not native and doesnt need to be built
just needs to be installed globally
i did
i just installed those too tho
you have python 2.7 right?
how do i check
python --version
fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib\libeay32.lib
does bignum require openssl?
bignum
Arbitrary precision integral arithmetic for Node.js using OpenSSL.```
alright ill go download that
Anybody here knowledgeable with discord.py?
Nani
just post your question, if its a simple issue, even people who are not very knowledgeable might be able to help
good day,
i'd be very thankful if you could help me.
i have a certain audio within a Buffer in nodejs.
i can successfully fs.writeFileSync('file.wav',buffer) and play file.wav on my pc.
How can i play that buffer with discordjs' connection.playStream() / playArbitraryInput() / ... ?
When feeding the buffer into the play function(s), i get an error message stating TypeError: this.inputMedia.pipe is not a function I have tried converting the buffer to a stream with ReadableStreamBuffer.put(buffer);. When i feed the stream into the play functions i dont get an error message anymore, but the sound doesnt play. The bots speaking indicator (the circle around the profilepic) is not showing up.
What can i do?
(without saving a temporary file on my pc!)
Well is this.inputMedia.pipe a function 
i guess it is on a stream object, not on a buffer object. i dont know
@inner jewel i need your wisdom real real yasmin please
will something like this work
if (!msg.guild.me.permissions.has('ATTACH_FILES') || !msg.channel.permissions.for(client.user.id).has('ATTACH_FILES')) return send(`I don't have permission to send files to this channel.`);
Anyone know any good AI apis, just a simple api to respond to questions, and return a answer in JSON
cleverbot
Someone know how i can restart a jar file on java out of memory error?
Like kill it then restart it
cleverbot
Okay ty π
how do we get our bot certified
thanks
can someone tell me, or know any good videos on how to add a soundboard/music to a discord.js bot?
don't use videos for learning
most people use lavalink and whatever lavalink wrapper there is for d.js now
google around
there's a guide on the discord.js site
@eternal nymph stop trying to advertise
@loud salmon
Banned FortKajπ#5861 (@eternal nymph)
@loud salmon what'd he do
posted invite links
nice
like a bitch
is yardim a prefix now
yes
yes its my custom prefix
back when bo had custom prefixes 
back when bot had dashboards so they don't need commands
When I check the logs for my bot, I see that I occasionally get a weird error:
`events.js:188
throw err;
^
Error: Unhandled "error" event. ([object Object])
at Client.emit (events.js:186:19)
at WebSocketConnection.onError (/home/ubuntu/DB/node_modules/discord.js/src/ client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/home/ubuntu/DB/node_modules/discord.js/node_modules/w s/lib/event-target.js:128:16)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)
at _receiver.cleanup (/home/ubuntu/DB/node_modules/discord.js/node_modules/w s/lib/websocket.js:211:14)
at Receiver.cleanup (/home/ubuntu/DB/node_modules/discord.js/node_modules/ws /lib/receiver.js:557:13)
at WebSocket.finalize (/home/ubuntu/DB/node_modules/discord.js/node_modules/ ws/lib/websocket.js:206:20)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)`
I don't know why this error is happening and if anything is causing it, it's happening in servers I'm not in.
It isn't super often, but it makes my bot crash.
Well it crashes because its unhandled
But what triggers the error event?
Not sure, but you may want an error event to handle it
I'll do that, but I wish I knew why it happened
When it is logged you should have more info
Ok
No im fr
Ok
So like I'm on the discordbots.org website.
And everytime I attempt to upvote.
It keeps authorizing as my alt account
How do I switchh it to my main?
π€¦
You need to log out of the account in the web browser
then log in with the correct one
Go to "open discord"
What do you think I did?
Did you ever log out on the dbl website?
Take a picture
Whatever kiddo
of your dbl page
Lmao, what do you think this is? A fucking hotel? Leave me a bad review skid and get outa my bedrooms π
haha
or he just didn't do any of the things he said he did
and he felt embarrassed that he didn't think of it first

what would be a good monitoring/managing solution for pm2?
Like something where i can host the website and i can restart and view metrics from certain processes etc.
I try like 3 different npm packages but they all have random problems and dont work
@slim heart If you have a the GitHub Student Pack, you can get $50 in credits on DigitalOcean
You can also get more credits if u use my referall link π
any ideas on how do i get the current count of a vc where my bot is?
i want to add a skip vote function for music
Cached voice states
You need to reference w/e lib you are using for it
im using simple-youtube-api, ytdl-core, and ffmpeg with opusscript
Reference to your Discord lib
d.js
now reference to w/e place it has voice states
?
maybe 
hmmm
trying now lol
so I have this bot
that is deployed to heroku
written in ruby
so it plays music using the gem's play_dca
but then its stuttering
so i was wondering is it the gem's limitation or heroku or am I doing something wrong
Sorry for the trouble my bot caused few lines of codes got deleted which caused the trouble fixed it now @void mantle
heroku was good until second season, third one sucks
We will approve it once we have testing it gain @twin locust
Ok np
like im not an anime fan but heroku is one of the few i tried watching
hmmm

heoku?
haikyu?
@drowsy lily There is no anime named heroku
pls move this to #memes-and-media
because this is not the channel for this conversation
if you are doing music free hosting wont cut it
const { client } = require('../index.js');
class Info {
static userInfo(ID) {
return client.guilds.get('495953092743921664').members.get(ID).user;
}
}
module.exports = Info;
help me
i dont think you can require client from your index like that
require discord and get the client from that
or pass it along with the function
can you give a example?
?
const Discord = require('discord.js');
const client = new Discord.Client();
class Info {
static userInfo(ID) {
let guild = client.guilds.get('495953092743921664');
let user = guild.members.get(ID).user;
return user;
}
}
module.exports = Info;
ok
?
umm
then how I get in this
make a command class
then when loading the command pass the client instance with it
so that you can access this.client
hm
const Discord = require('discord.js');
class PBL extends Discord.Client {
constructor (opt) {
super (opt);
}
}
module.exports = PBL;
now ?
what are you trying to do?
if you want to pass client into that class
class Stuff {
constructor(client) {
this.client = client
}
getUser() {
this.client.users.get()
}
}
module.exports = Stuff;
// main.js
const SomeStuff = require('path to stuff file');
const client = new Discord.Client();
const stuff = new SomeStuff(client);
stuff.getUser();
although if you dont understand classes and how they work, then dont use it yet.
Hey, new to this stuff and was wondering how people set up allowing your bots prefix to be changed? And any pointers would be much appreciated
Ah thanks
I use sqlite for my storage, it works pretty well if you're new to database stuff, but there are LOTS of options, to choose and learn.
Hello, i have wav audio data in form of a UInt8Array. How do i have to convert it, so i can feed it into the connection.play() function?
if i am using node.js
i have the code in but how do i execute it in terminal whats the command?
node <filename>
yeah but thats not working node turns yellow and im not good at this yet its my first time
define "turns yellow"
it turns yellow when i type node but everything else isnt
screenshot?
inb4 its just his shell syntax highlighting the command
but its not working
just send a screenshot of your terminal
is anything in the file?
can you take a screenshot of what you are doing
gotta have node installed to use it and code in the file you are trying to execute
and all the modules you require 
I donβt wanna leak my token and stuff
π
that means the file was executed and then exited
meaning your file doesnt have anything in it that keeps it running
obviously its an issue with your code then
okay so just back track and code it again?
youre already a bot developer, how do you not know how to make a bot
its easy
show us your file, just remove the token from it
missing the function
hm?
Its not a function
this is node, you can do the arrow syntax - yes
How does that not error anyways
but you still need the ,
he has an extra }
or client.on("ready", () => {})
so do that?
okay thx
hi guys. This is my first ever bot build, building one to play sound effects on command. Any tips/advise?
have you tried doing simpler (text only) commands first?
learn how to code before jumping into bots
@versed cedar you need to add an callback function
like this
client.on('ready', function() {
// your code
})
or with ES6 syntax
client.on('ready', () => {
// your code
})
and you don't need to learn how to code before jumping into bots

i think it's the best way to learn coding
by doing fun stuff like making discord bots
You should know how to make an if statement imo
lul, gotta learn the basics before applying the 'learning by doing' concept to some degree
I started learning by making a bot
knew nothing previous to making one
definitely not the best way to learn, but it sure as heck works
until you come into a dev channel asking for help with something simple
so?
are you saying that there shouldn't be any simple questions? 
not saying it doesn't work, but it's not as fun if you end up running into issues all the time that could've easily been avoided by looking into the basics
Asking a question every error you run into isnt how I believe you should learn. Yes, questions are good, but you should know how to debug and find errors in your code by yourself aswell.
he knows how to do it know
@earnest phoenix can you not send that in every channel... It's spam
`
It's above tab
And below escape
iOS or Android
Hold β and swipe to the left most one
No
Lmao
There you go
discord.io is broken, no?
That's what I'm sure about. I'm really new to coding.
dont use discord.io
OK, what should I use instead? In case it's not already obvious, I've been working with a tutorial! lol
use a different tutorial
Amending to discord.js gives the same error
your package.json seems to be broken
oh its an issue with your package.json
make sure you're using neutral double quotes, not typographic quotes
ie: this " " not this β β
Yep those are the wrong "
This is the current script
ah, ok. let me try chaning
brilliant, thank you
It's thrown up some warnings though. Do any of them require immediate attention?
nope, those are all safe to ignore
It can't find 'discord.io' as a module
Looking at the earlier screenshot it looks like you installed discord.js
because you're trying to require a module you dont have
So you probably have something like const Discord = require("discord.io");
what command do i need instead?
Rephrasing then, what do I need instead of node bot.js?
but that's what's caused the above...
because node bot.js runs the bot.js file
ah rats
If you're using discord.io code you should probably change it
just find that require("discord.io")
I believe discord.io isn't maintained anymore
Discord.io doesnt work anymore iirc
...right... let's try again! lol
Geronimo!! Brilliant, thanks for now all!
Can't bring the bot online... now what have I broken?
so what library are you using now instead of discord.io
discord.js
they have a working implementation as simple as it gets on their homepage
I'm using node bot.js, but it's not responding...
define "Not responding"
still not coming online
Hang on... Is this the problem?
is it because I haven't 'named' the bot, and therefore the command is wrong?
you're not even connecting
you're missing <client>.login(<token>); at the end of your file
where <client> is "bot" in your case and <token> is a string of your bot's token
so put that on line 40?
yea
your bot's token
the long one i've got in the auth file?
did you create an application via discord's developer panel
yea
you access that with auth.token or whatever you called the key in your json object
OK, changed those, but my CMD prompt seems to be having a problem with the token. should it have "" on it?
I'm learning slowly! lol
or wait, you're not supposed to put "" around auth.token
what problem is it having
it needs to have "" around it in your json file
yeah it does in the json
i added "" to the token in the js, CMD is just rerunning now
is it still erroring out
you could use console.log(); for starters to have readable console output that isn't an object lmao
that being said, there doesn't seem to be anything wrong with that
your client did what it was supposed to do on the ready event
yep, bot online now! π
so I just leave the CMD screen open now, and leave it alone to keep it running, yeah?
yes
.sendMessage() is also deprecated, use message.channel.send() instead
the shell is essentially your bot, if your close the shell your bot will go offline
Right... so the good news is the bot now functions.
Bad news is that it's not working as I would like it to.
that would be message.content.substring
message is an object containing a shit ton of stuff
message.content is the actual text that the user sends
In theory, I should type DD/Ping! and get Pong! back
so what should line 23 be? if (message.content.substring(0, 1) == 'DD/') {?
exactly
actually lemme check docs real quick
i dont know why you would use .substring tho
message.content is enough
what do you want to achieve with substring
Got a bit of a stupid issue.
Built in a help command that's meant to return a list of all commands if you just use help with no command afterwards. But it's not recognising the blank. Works if I use it for commands though
yours is easier to resolve than mine i suspect, nuclear! lol
Probably lol. The reason my bot broke earlier was because I missed a space bar
I'm still learning how to build bots and code... as you've seen it's a slow process! xD
Fixed it by replacing '' with null smh
Good luck fixing your thing though!
@pastel edge to figure out whether or not your message starts with your prefix you can take a different and probably better approach, look into String.prototype.split() on mdn
nvm i meant .split()
which line?
the one where you're trying to figure out your prefix
I though my prefix was DD/ ?
if you split message.content with a whitespace you get an array of words in the message, array[0] should be the command, now you can split the command with "" (without anything) and set a limit of your prefix length. That will split your command into two array elements, index 0 which should be your prefix and index 1 which should be the command
I assume I need to be looking at the following line:
- if (message.content(0, 1) == 'DD/') {*
Am I right so far?
var msg_arr = message.content.split(" "); //Split message into array
var cmd = msg_arr[0]; //First element is your command
var cmd_arr = cmd.split("", <yourprefix>.length); //splits your command into two elements, [0] should be the alleged prefix
Like i say, i'm a real rookie with coding, hence all the stupid sounding questions
everyone started at some point its alright
yes you need to be looking at what you highlighted
given what i sent earlier (the codeblock) you can check if(cmd_arr[0] === "DD/"){ ... }, the command you want to process would effectively be cmd_arr[1]
so in theory, if i remove 24 and 25, and replace them with the var coding you gave me, would that fix it?
Assuming you want to ensure a space between the prefix and command
at the moment, what i'm hoping to get from the bot is as follows:
Me: DD/Ping!"
Bot: Pong!
i would suggest making the prefix lowercase
The DD/?
ok. out of interest, any particular reason?
some people don't capitalize sentences and if it's case sensitive, the bot won't read it
also generally good practice
but your choice
is there any way to program the bot not to be case sensitive on the prefix?
Is there no js function for "ignore case"
it's not by default π€
fair. thanks for the input
okay
<client>.on("message", (message) => {
var msg_arr = message.content.split(" "); //Split message into array
var cmd = msg_arr[0]; //First element is your command
var cmd_arr = cmd.split("", <yourprefix>.length); //splits your command into two elements, [0] should be the alleged prefix
if(cmd_arr[0] === "DD/"){ //If command starts with your prefix...
//do cmd stuff
}
}
this should do the job without the substring memery
Rye, do I use that in place of lines 24&5?
Or is that in addition to what I already have?
That's line 20, yeah
djs passes a single message object
you'll have to get the user, the user's id and whatnot from the message object itself
so does that mean that message should just be ' ' ?
that means you remove every parameter you are passing in the event listener other than message
on line 20 everything you threw into the brackets except for message doesn't belong there, you can call it however you want it will always represent the message your bot received but the on.message listener only passes one thing
bot.on('message', function(message){. . .});
or with arrow notation bot.on('message', (message) => {});
both essentially the same thing
line 20 amended, is now:
bot.on('message', function(message){. . .}); {
HOWEVER
I now can't bring the bot online
back to sqaure one! lol.
placeholders
. . . isnt valid js syntax
or valid syntax in any programming language lol
rookie mistake much! lol
?
{ . . . } is used to replace actual function content you put into the function body
the . . . to be more specific
What's up?
so line 20 is now bot.on('message', function(message)); {
the semicolon doesn't belong there
semicolon gone
bot.on("message", async (message) =>{ }
you don't specifically need the async keyword for it to work
Function only creates a function if I am not mistaken
Did you look at the discord.js docs?
https://i.ryeqb.me/5818ce1369.png doesnt seem like they're playing around with async in their example so
You don't need it, but it's not a bad idea to include so you know that it's an asynchronous function
You're talking to a rookie here... small words please! lol
i suggest you get yourself a code editor that clearly highlights syntax errors
https://discord.js.org/#/docs/main/stable/examples/ping look at the example here
easier to work with that and spot minor mistakes
wym notepad++ best IDE
Never use notepad++
using notepad++
i'd rather write code on paper
Use vsc
failing to understand sarcasm
Visual studio code
notepad++ isnt bad
a notepad with advanced features
It's not, but for a rookie, don't use it unless you want to suffer
ok. let's go back to the beginning
on topic: https://i.ryeqb.me/1db47797c2.png the second ) brace doesn't belong here
thats line 20 for you
message.content returns a string
what do i need to change on line 23?
Also you don't need to do bot.message.channel.send just do message.channel.send
it's not a function thus cannot be passed parameters
Where are you learning to make a discord bot Delta?
here it seems
hehe, was using an online tutorial, but judging by what i've been told here, it looks like it's very out of date
if you're using youtube;
since you were trying to use discord.io earlier you're probably trying to use discord.io elements in discord.js
Go on the you Tubes and look up source code discord bot tutorial, and follow his guide
good name! lol
ok-ish explanations on how to do discord bots in js using djs
Docs, and the you Tubes are your best friends here
if your familiar with javascript
the docs won't help you all that much if you dont know basic syntax
do not use youtube tutorials for learning, reasons stated above
i mean they will but to a limited extent
if someone suggests you to use youtube tutorials over something else, they most likely did that too and their bot is probably very shitty
We'll use yt tutorials for learning how to make the shell of your bot, and for someone that is new that would be very useful to use
you're completly ignoring the fact that you need to know a language to make anything in it, e.g a bot
so where it says client.on, i need to type bot.on etc, correct?
Client.on is bot.on
so one and the same?
how did you name your variable?
he named it bot
so you'll have to use "bot" wherever the docs or tutorials mention "client"
yup
You would know that you pay attention to that you have var bot = Discord.Client();
Yes do that, const will be a lot better to use than var
doesnt really change much except throw an error when you attempt to change it
so everywhere i have var needs to be ammended to const?
just good to define constants as const tho
no

only use constant if your not going to change the value
Only things that wont change
of that variable
normally your modules wont change
And use the let keyword and the const keyword to define variables
If you don't know when to use which one, take the codeacmady Js course
I use var π’
You can use var, but let and const will be more handy to use than just using var, but there are times that var is best to use
iirc var and let just changes the scope
brilliant. so now that we're back to the start, that still doesn't resolve the fact that my existing code seems to have crashed...
where it can be used
I would tell you this Delta, rewrite your code
message.content is not a function, it returns a string
you already said that
you cannot slam brackets onto everything
What he means is message.content is not a method, or function(both are valid) this means it doesn't take in any parameters, so I would change that to message.contenr.startsWith("<string>");
Good news. sending the command no longer sends the bot offline
the 'ready' event doesn't pass any parameter, what's "evt" doing in the callback
bad news; it's not returning the expected response
you never log in
bruh
he probably just removed that because of his token on the screenshot
Oh did not see that there
^
he removed the token
he was logged in before
ah
hes just not using it for whatever reason
Delta send me a server invite link in dms, will try to see what's wrong
Rye, should i have auth being referred to in the bot script then?
if your json config looks like this (for example)
{
"token" : "hue"
}```
you access your token with auth.token
Its not that mates
if you use "auth.token" in the login method you don't have to modify your code to take screenshots
He forgot to include the prefix
i had that feeling but meh
right, so correcting those
- How do i add the prefix?
- what do i add on the login line?
to refer back to auth
bot.login(auth.whateveryourtokenkeyiscalledinyourjsonfile);
it only checks if the message starts with ping, its not checking for a prefix anyways wym
Yee
so bot.login(auth.auth); ?
https://discordapp.com/channels/264445053596991498/272764566411149314/539907675027406850 alright ive explained prefix stuff here imma head to bed im tired lmao
You can do that if you want to
whatever your token is defined as in your json file
π glhf
So do auth.token
bot.login(auth.token); ?
Yup
brilliant
Yee
set a variable in your config
under your bot.on("message"..... Put let prefix = "dd/";
Tony you don't need to have it in config
I do it in the message event because they can customize it
It doesn't matter where it is, as long it's defined in your file it works
you can set prefixes in a global variable/object at the beginning of the file
the aim for this bot is that it plays soundbites on command
Tim knows all
yeah but static content in the file is dumb
It's not dumb
essentially any command needs to have dd/ first ideally
my average config now:
{
"token": "token",
"invite": "https://discordapp.com/oauth2/authorize/?permissions=0&scope=bot&client_id=id",
"prefixes": ["...", "<@id> ", "<@!id> "],
"botLists": {
...
}
}
So in your message.content.startsWith(); do prefix + "ping"
so if (message.content.startsWith(dd/+ "ping")) { ?
no
Put your let prefix = "dd/"; on line 22
message.content.startsWith(prefix + "ping"); just like that
i think at this point you're better off checking the website i linked earlier and rewriting your entire bot without the stuff that deprecated tutorial taught you
there's gotta be some initiative from your side aswell, we can't sit here for hours on end repeating ourselves 3 times a minute
Is there an error
if you were to read line 20 you'd figure out what the error is without any console output
*23 actually
Mmm yea
He might have not restarted his bot in his cmd
bruh.mp3
because you arent doing what we've told you to do
i've been trying to follow advise... have rewriten bot as suggested
trying to launch now
bingo
rewriting != changing one line of code
and you're still not using your config file like you should
Well... For the command I use a Command Handler so the commands are files in a folder called commands
you referring to the login bit, Rye?
yes
i tried it, but couldn't bring the bot online with it
just to confirm, it should be bot.login("token"), yes?
Did you type bot.login(config.token);?
bot.login(auth.token); in your case
ok, thank you
so what do i need to do to configure it to require a prefix? i can't figure that out...
currently lines 17-22 are as follows:
bot.on("message", (message) => {
let prefix = "dd/";
if (message.content.startsWith('prefix' + "ping"); {
message.channel.send("pong!");
}
});
let prefix = "<prefix>"; or let prefix = auth.prefix; above the command
now i'm getting an error brining the bot online
do i just need to take out the ; that it's pointing to?
yes
Please
Learn javascript
Before making a bot with it
All of these issues can be solved if you know what youre doing
There are some great guides pinned
@glossy sphinx Pls dont sam random bs
right... bot online sans prefix commands
ok... i'm off to try and figure out how to add a prefix command that doesn't crash the bot. thanks all for your time, support and patience thus far; i'll try not to bug you any more tonight!
i need help making commands in node.js
hey what can i do to make my bot repeat a message twice , 2 different messages?
send
send
Well if its 2 different messages its not a repeat and that above
hey guys how do you assign bots so they can only say their commands in chosen channels?
Any JS devs wanna collab with me? This bot is very important to me and I would appreciate the help :>
Dm me if so
@signal prairie whats a command handler?
Anyone wanna try out my bot and give feedback
i will
I dm u
k
Can u guys help me get my bot online pls!!π π π
My bot is offline!!
I need to get my bot online!
I'm totally new!
English and Hindi
...
programming language
you cant just tell a bot to login and go online you have to program your bot to do whatever it does
woU leaked token
@thick trellis delete that image
also why are you running a bot on your phone π
@slim heart Can't i make a bot on mobile??
no
Ok there is literally no way of creating a bot on mobile??
Hey so I want to use a command to edit messages and embeds. So say i sent my rules in an embed but instead of resending it, to edit it. I cant find any videos how to do this and im not so good at reading docs and learning so anyone know of any vids or anything?
save the message sent as a variable
refer to it later
let m = await message.channel.send("stuff") await m.edit("not stuff")
I have just updated my Discord.NET version to stable 2.0.1, and I'm having some errors for the embeds. Can someone help me with that?
Maybe there's a build() method or something. Check its documentation
can embeds take an svg as an image?
@upper tundra like Kef said you need to close the embedbuilder with a .Build()
okay
and whats wrong
Yea the .Build() fixed the error, thanks π
Hey does anyone know what Discord.Message in Discord JS gives?
huh
So it's the same as msg in client.on("message", msg => ...)?
But it's defined out of the message event
where's this apparent Discord.Message
It's the same as Discord.Client() but it's Discord.Message



