#development
1 messages Β· Page 363 of 1
Is there any other npm modules that can run your bot in the background (basically just keeping your bot on 24/7)
nodemon
but I would suggest pm2, if it's not working for you it's very likely a case of PEBCAK
I tried nodemon, it didn't keep it running.
But for now, I'm going to try nodemon.
Aaaand nodemon isn't working for some reason. Great.
I can't help you if you don't give me any error outputs π
Ok, here is the error output for pm2:
pm2' is not recognized as an internal or external command, operable program or batch file.
I installed using npm install pm2 -g, second attempt with npm install pm2 --save, then last npm i -g pm2. They all gave back the same message.
which is
pm2 is not recognized as an internal or external command, operable program or batch file.
that's the output of npm i -g pm2?
yes.
Lemme try again
Ok it's redownloading again, trying npm i -g pm2 again
the warns: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\pm2\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
ignore that
ik
Let's see if it'll run now
"'pm2' is not recognized as an internal or external command, operable program or batch file." RRREEEEEE
run the cmd as administrator .
ok
win32
sudo it 
Ok, so now I'm running cmd through admin, through system32 instead of my user. Correct?
yeah
that's just the path of where you currently are
k
just.
you don't really care since the install you want to do is global
install it.
just install pm2 right and you'll be fine
oml
maybe its a PATH probl
'pm2' is not recognized as an internal or external command,
operable program or batch file.
well

yeah its a path problem



yeah, but I just deleted the path that was causing the problem, as nodemon stopped working right as I set this shit path
so I'm crossing my fingers that my computer isn't fucked

ur computer doesn't like anything tbh 
my computer is fucked probably
are you using windows @trim plinth
nyes
solution: get a mac
i got all kinds of shit errors when i used windows to develop
i never had any issues on windows
besides when using natives
because micro$oft is retarded
thats because you know what you are doing 
windows is fairly the worst of the 3 "big" OS to develop, however as long as you don't fuck up you won't run into much issues
i had issues with like every damn framework i tried to use
I never had any issues back when I was still on windows, but linux is VERY NICe for dev
winblows
winbaguette
I am planning on getting a mac later on in life anyways
i've had zero issues with "serious" projects on windows
i didn't really got any too
aka not random proof of concept things i tried to do which i didn't even know if they were possible


Which major OS do you use? (react with Windows = πΈ, Linux = π², Mac = π )
No just no kill mac
u mean windows
^
k
Anyone know how to generate charts/graphs in NodeJS?
dunno
Can anyone here tell me how I would go about a queue system in C#? (I don't want to be spoonfed, I just want like an idea on what to do)
@earnest phoenix i don't know too much about C# but i would recommend you use a Queue<T> https://msdn.microsoft.com/en-us/library/7977ey2c(v=vs.110).aspx
you can use Queue<T>.Enqueue(T) to add an item to the end of the queue
ok, thank you so much
no problem :)
no
yeah
wait do you
that's a new rule they made @heady zinc
wahh
got certified when the rules were so much nicer
but i guess that make sense since certification's queue tends to be huge
feelsbadman
yeah
what do you mean?
Help I need an ID
please
@steel heath
Discord.JS
Node.JS
Simple Command with response.
if (msg === prefix + 'COMMANDNAME') {
message.channel.send 'RESPONSE'
}
what?
.
doesn't even work 
lol no run that vanilla and it wont
@earnest phoenix m8 search on youtube how to code a bot, if you don't know how to get a bot ID, you need some help
I said Discord.JS
ye no
=>msg is not defined
=>prefix is not defined
=>invalid syntax at message.channel.send 'reponse'
here is a proper line if you want your bot to respone to a text command:
therefore your code is wrong and anyway nobody needs it so you don't have to post it here
@earnest phoenix it's pretty clear you don't know what you're doing, that's fine.
you can look up tutorials online on how to code basic javascript, such as anidiots.guide or other youtube tutorials
.
``bot.on('message', function(message) {
if (message.author.equals(bot.user)) return;
if (!message.content.startsWith(prefix)) return;
var args = message.content.substring(prefix.length).split(' ');
switch (args[0].toLowerCase()) {
case '[command name]':
message.channel.sendMessage('[text here]');
break; } `` this is for a basic text reply command,
also you'd need to define other stuff
Mhm.
still don't see the point of posting your code here 
yeh
there is hella lot ways to make a reply
Could I post my Purge Code?
it heavily depends on the bot command handler
everyone here knows how to code so it has no purpose here
and everyone has mostly different ways of how to execute commands in code
so I suggest searching up a tutorial on yt
^
thats how I started
ye
i wasn't trying to be rude vandereems, it's just best if you have knowledge of javascript before trying to dabble with libs and stuff

?
eh
just look up a tutorial online vandereems
i think he's been trying to show off this whole time
.
you need to understand what you are coding before you can use discord.js
but didn't understand we all noticed he copy pasted
no offense but posting errors in chat is kinda bad practice
I suggest putting it in console, not chat
ofc you did
Its even labeled for noobs.
the simple fact there is that much comments
even though the code is without command handler
proves it
actually copy pasted comments

yeah, that actually kinda sells it. if this was your code, you wouldn't put so many comments like it was for someone to learn from
nobody else will see the code soo
I wanted to put it up for noobs out their.
why? nobody sees your bot code
really
we give you a chance
to admit
and actually starts to learn
so you can become a dev at some point
..
whats with the comments 
Silence
I'm not in this anymore.
tfw the comments talks about advanced stuff like promises and the commands are else if
SEE
yeah
and because i re-read my code
so if its private
then you know what you're doing
and you don't comment because
no one else is going to work on it
comments are readability just use a command handler

unless you are working with another dev, you wouldn't do breadcrumbs like that, that explain stuff you would already know
I do have another dev.
and you're other dev is a beginner 
@spiral owl
@earnest phoenix if you know how to code, define a variable right here, right now.
true
searching it up
wait I might be able to prove one sec
k
search up for the tutorial on the weeb 
@earnest phoenix
codecademy.com
now pls stop copy pasting
@earnest phoenix We aren't trying to demean you or bully you with the fact that you don't understand coding that well, everyone starts somewhere. We are telling you it's best if you simply look up a tutorial and actually grasp an understanding of the language you are coding in before making a Discord bot, it will really help you
@rich kiln exactly, you can easily just learn from codecademy
you guys probably arent helping all ganging up on him though
just saying
true
we should move it out of #development too
that too.
- a. Donβt spoon-feed or attack beginners.
Everyone starts somewhere and asking questions is smart. Do not attack people for not knowing how to code. Point them to great learning sources and help them with problems.
However, you shouldnβt just give them finished code because then they only learn to copy more.
b. If you are a beginner, have a will to learn and do not expect to be spoon-fed. - Be friendly to other users.
we know the rules no need to copy paste
ik
also get out of #development kthx
k
!listids
@fast solstice unable to fetch application? did you make a bot application first?
yeah
how long ago did you make it? someone here had a similar issue and they just waited a bit before adding their bot
I just made the application
have you actually coded the bot
you shouldn't add it if you haven't got anything on it 
how do you code it though?
i recommend going to anidiots.guide or discordjs.guide if you want to learn how to code a really basic bot
you can also look at javascript tutorials or youtube stuff
ok
what's the best way to overcome a crash due to internet being down for nodebots?
I currently just use forever to restart everything
no fancy try/catch shenegians?
well really, if it crashes, you probably just want to restart the app anyways
it's probably the best way to tell the app to clean up after itself
you never know what kind of state the websocket is in when it crashes
What would be the best way to create a channel object that I can then use send() on
in d.js
what do you want to do exactly
thanks
ππ»
wtf hachby get out of here
hachby
hi
@low rivet aight
the worker is off lmfao

how 2 switch on?
and toggle
@patent reef turn worker on
i got it now lol
OH im an idiot
2018-01-28T09:52:03.172776+00:00 app[worker.1]: NameError: name 'os' is not defined``
KEK
and maybe auto deploy
u can just add heroku as a remote on ur local git repo
git remote add heroku <url found in settings of app under "heroku git url">
then u can git push heroku master
except my music cog isnt working
2018-01-28T09:52:38.363311+00:00 app[worker.1]: Failed to load extension music
2018-01-28T09:52:38.363337+00:00 app[worker.1]: OSError: opus: cannot open shared object file: No such file or directory```
music doenst work in heroku from what i heard
opus isn't installed i think.
yes as in?
wish the bot i brought online had a ping fuction in it lol
um lemme run a ping and bfb
the fucker still works tho π
@low rivet should this work? https://elements.heroku.com/buildpacks/dubsmash/heroku-buildpack-opus
i would put that in the run console thing right?
um
i think so
@low rivet https://upldr.is-a-shit.host/2luUbB29.png
pretty decent

oh yes
don't expect anything to stay in local storage
which means no sqlite, no json editing
If anyone needs to get d.py rewrite into their requirements.txt add this:
-e git://github.com/Rapptz/discord.py.git@rewrite#egg=discord.py```
@low rivet meh.sh
heroku restarts every 20-30h and gets everything back again from the git repo thing
TIME TO STORE AN SQLITE DB ENCODED IN BASE64 IN AN ENV VAR


@patent reef you dont need to run the buildpack shit in console btw.
so how do I get opus?
btw you can't use the console once ur heroku hours expire
oh woe is me
but the bot will still run and all cos its a worker
can you still deploy tho?
yes
kek
all workers function as normal
on another nmote, you get 1000hours/month?
u told me
all i need is bot.logout()
await
heroku will restart 1/2 the time
is that because heroku is like OH SHIT FUCK THE PROCESS DIED
on another, unrelated note, is it possible to change_presence in d.py to streaming/listening/watching ?
yes
change the type=
yeah
@low rivet much better: https://upldr.is-a-shit.host/wGNVn0uz.png
its watching the market now
lol

i need to remember how to start a task on bot launch and have it run every like 300 seconds
i want @unique bronze to change its presence every so often
shit like "watching the stars" "playing with a rocket" "listening to the falcon heavy's roar"
they have an app?
@patent reef http://nezumiapp.com/
oh sheeettt
thx
tbh i just searched "Heroku"
welp nvm its not an app on iOS anymore
wtf all these Heroku clients "arent available in the US"
@whole mural they work for you?
Hello I would like on the site to update the server number of my bot only I am in a language script and I do not have a base can someone help me?
If I understand you correctly you want to post your server count to the API?
if so #312614469819826177
yes i know but i don't see an example for the language skript
Got a link to your lib docs?
what language is thing
oml
it's link with skript
wew a custom made lang
uh well
sorry i'm french in passing
you just need to make a post request to the stats api endpoint
with json body following the api docs
and the authorization header
okay thx
@patent reef did u get music working?
@low rivet Surprisingly, heroku seems to be very reliable π
@patent reef yteah they work
@low rivet TiMe tO MoVe aLl mY BoTs tO HeRoKu
@whole mural ur gay
No u
@earnest phoenix
{
"ignore": ["*.json", "*.png"]
}
its a json config file
and you can use nodemon --config [file] [script] to use it
@topaz fjord nu u
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'discord.js' ]
2 info using npm@5.6.0
3 info using node@v9.4.0
4 verbose stack C:\Program Files\nodejs\node_modules\npm\lib\install\and-add-parent-to-errors.js:1
4 verbose stack (function (exports, require, module, __filename, __dirname) {
4 verbose stack
4 verbose stack
4 verbose stack SyntaxError: Invalid or unexpected token
4 verbose stack at new Script (vm.js:51:7)
4 verbose stack at createScript (vm.js:138:10)
4 verbose stack at Object.runInThisContext (vm.js:199:10)
4 verbose stack at Module._compile (module.js:624:28)
4 verbose stack at Object.Module._extensions..js (module.js:671:10)
4 verbose stack at Module.load (module.js:573:32)
4 verbose stack at tryModuleLoad (module.js:513:12)
4 verbose stack at Function.Module._load (module.js:505:3)
4 verbose stack at Module.require (module.js:604:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\install\deps.js:16:28)
4 verbose stack at Module._compile (module.js:660:30)
4 verbose stack at Object.Module._extensions..js (module.js:671:10)
4 verbose stack at Module.load (module.js:573:32)
4 verbose stack at tryModuleLoad (module.js:513:12)
4 verbose stack at Function.Module._load (module.js:505:3)
5 verbose cwd E:\projects\Economy
6 verbose Windows_NT 10.0.16299
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "discord.js"
8 verbose node v9.4.0
9 verbose npm v5.6.0
10 error Invalid or unexpected token
11 verbose exit [ 1, true ]
maybe try reinstalling node and/or npm
wtf?
Or try installing from the git
@earnest phoenix pretty sure it's a dns lookup error
it fixable ?
Wait nvm
whats up
whats discordclients.org?
do you mean discordbots.org or is that a real thing
i just tried connecting to it and its not working
nooooooooooooooooooooooo
are you sure you dont have anything in your code trying to connect to that address
check your READY event for anything
Join my discord
Never host on free hosts
^
what are you hosting on @earnest phoenix
When I try to auth my bot, is says unkown error
lol
@earnest phoenix where do you get the error
Its fixed
@earnest phoenix lets talk over here
Oh okay
Probably javascript?
ok
I love djs but wasn't asking you lol
lost in translation
Can I see a screenshot of a little bit of your code
Yeah
bot.js
I got that
So I got like this code,
<client>.user.setPresence({
status: "online",
activity: {
name: "Donut: Rainbow Six",
type: 0,
url: "https://www.twitch.tv/discorddonut/"
}
})
Do I just copy and past the in between those } brackets?
I know that those brackets like end a certain piece of code.
im taking it you dont actually know much about javascript at all? @earnest phoenix
I highly suggest you go revise on server-side javascript online
You should probably learn a coding language before you make a bot
Googling terms such as node.js / server-side javascript / javascript tutorials would help
Diving straight into bot developing isn't the best idea, it'll wear you out fast and you'll get lost a lot
me
anyone know what kind of blankspace can be used in an embed value so that its just a title?
nevermind
\u200
what was the issue with installing?
Yep
?
i mean i just googled
python3 -m pip install discord.py works fine
\u200b as well
\u200D
@clear kernel ye
Okay, just 1 question. How do I update my bot when I changed something?
its 200b
Yep is cause in the installer he call 'python" with is probably python 2.7 ( by def if you have like terminator or Gnome )
because \u200 isn't a valid unicode escape
in most langs
Okay, just 1 question. How do I update my bot when I changed something?
unless you use arch or other "bleeding edge" distros
@earnest phoenix just restart it
what?
python3 -m pip install https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py
Yeah. but how.
no
rewrite > not-rewrite
how are u running it
Terminal
@abstract mango cough I USE ARCH
python on arch is aliased to py 3 by default
ya
Doesnt work
you have to use python2 if for, whatever reason, you wanna use that.
@whole mural NL?
if(message.guild.id === `407159833322586113`){
let member = message.mentions.members.first();
const role = message.guild.roles.find(`name`, args[1]);
if(!member) message.author.addRole(args[0]);
if(member) member.addRole(args[1]);
}else{
return;
}
}
``` i get `(node:11104) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje
ction id: 5): TypeError: Supplied parameter was neither a Role nor a Snowflake.`
you never use "role"
also have some patience, people dont need to reply instantly to your queries in #development
they will answer when they can, you dont need to ask people to answer in #general :]
@earnest phoenix what
Oeh
its because of my pfp isnt it?
Bcz of the pfp yes
lmao
Ahaa
Max le best.
Indeed
please take general conversation to #general
pls
its #development
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
oi
none of that
Β―_(γ)_/Β―
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
β¬ββ¬ γ( γ-γγ)
Aight
which lib
library
Uhm,
what language are you using?
Javascript
it's most likely discord.js then?
I have bot.js
bot.js is your file
At the top of your file, do you have anything that says require?
i'll just assume you're using discord.js since its one of the more popular libs for javascript
the only .js file i got is bot.js
i do recommend going to https://anidiots.guide or https://discordjs.guide for basic discord.js coding
A guide made by the community of discord.js for its users.
what's the first 3 lines of your code
read that
this https://discord.js.org is that ^ aka a "library"
it basically does all the hard stuff for you, API requests to Discord etc
javascript is a language
guys
My bot is working
Can I now like upload it to here? To test it and stuff?
ok so i have this bot command that post a message in chat case 'BOT': bot.sendMessage({ to: channelID, message: '/tts IM the best bot go get a life peace of ---- '
how to i make it use /tts in chat
uhm
XD
Bots can't use commands lol
dangit
XK i feel u
oh
how do i do that?
Your library should have a tts boolean
i dont think so
which library do you use?
yea
Yup as I suspected there is a flag
its mostly discord.js
that's for d.js
bot.sendMessage({
to: channelID,
message: 'XkijuX is the best executer ever'
tts = true
will that work XD
Uh
tts: true
You used an equals
:
Lol
Im feeling smart now, cuz i acctually knew it lol
that's fine lol
YEa i guess im triple gay #feelsgoodman
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
i get this error when im trying to run it
Have u installed discord.js?
Forgot a comma
or that
Can I upload a bot in here, even if I dont know what I am going to do with it yet?
ok so i just put in a ;
Oh I didnt see the dot lol
break;
// Just add any case commands if you want to..
case 'xkijux':
bot.sendMessage({
to: channelID,
message: 'XkijuX is the best executer ever'
tts: true ;
});
That's not how
XD
And wrong place lol
ahhh
And wrong character
Hey guys, I'm having some trouble with the API and postStats() - I'm only getting UnhandledPromiseRejectionWarnings with the status error 403...
"Unexpected end of input"
so im just put in }) and it should be fine`?
I said you're missing a comma
where
Wtf are you doing
same
"SyntaxError: Unexpected end of input"
break;
// Just add any case commands if you want to..
case 'xkijux':
bot.sendMessage({
to: channelID,
message: 'XkijuX is the best executer ever' , {
tts: true
});
like that?
Still not in correct place
a: b,
c: d,
e: f
comma in the wrong place, you're missing one and you have one extra
});
break;
// Just add any case commands if you want to..
case 'xkijux':
bot.sendMessage({
to: channelID,
message: 'XkijuX is the best executer ever' , {
tts: true
});
like that?
Dafaq
.
Where did that extra bracket requirement come from
im so lost
@patent reef Did you ever get voice to work on heroku?
??????
i searched on reddit XD
Rippu
RIP
Done
mkay, now ask your question without the token
// require the discord.js module
const Discord = require('discord.js');
// create a new Discord client
const client = new Discord.Client();
// when the client is ready, run this code
// this event will trigger whenever your bot:
// - finishes logging in
// - reconnects after disconnecting
client.on('ready', () => {
console.log('LETS GET THIS BITCH ROLLING');
});
client.on('message', message => {
if (message.content === '>ping') {
// send back "Pong." to the channel the message was sent in
message.channel.send('Pong.');
};
client.on('message', message => {
if (message.content === 'iPlayGucci') {
// send back "Is a sexy beast!" to the channel the message was sent in
message.channel.send('Is a sexy beast!');
};
// login to Discord with your app's token
client.login('TOKEN');
Hey guys, I'm having some trouble with the API and postStats() - I'm only getting UnhandledPromiseRejectionWarnings with the status error 403... Can somebody help me with that?
@devout chasm try googling 403
Give full error
I get
SyntaxError: Unexpected end of input
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Its the same
at new StatusCodeError (D:\Archiv\Projekte\Dev\Discord\musicBot\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.plumbing.callback (D:\Archiv\Projekte\Dev\Discord\musicBot\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (D:\Archiv\Projekte\Dev\Discord\musicBot\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.self.callback (D:\Archiv\Projekte\Dev\Discord\musicBot\node_modules\request\request.js:186:22)
at Request.emit (events.js:159:13)
at Request.<anonymous> (D:\Archiv\Projekte\Dev\Discord\musicBot\node_modules\request\request.js:1163:10)
at Request.emit (events.js:159:13)
at IncomingMessage.<anonymous> (D:\Archiv\Projekte\Dev\Discord\musicBot\node_modules\request\request.js:1085:12)
at Object.onceWrapper (events.js:254:19)
at IncomingMessage.emit (events.js:164:20)
at endReadableNT (_stream_readable.js:1062:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
(node:14820) 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:14820) [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.```
missing the closing brackets for the message events
Second or first one?
both
{} I asume these
possibly
Your bots one?
This piece of code worked just fine
client.on('message', message => {
if (message.content === '>ping') {
// send back "Pong." to the channel the message was sent in
message.channel.send('Pong.');
};
it's not fine
It did work tho
@earnest phoenix did you use the guide that was on medium?
it did not, or you didn't copy a line over
What do I need to change
close the message event
@elder rapids The discord token is correct, and the discordbots token is also correct
But same error
Were exactly?
@devout chasm you're not supposed to be passing a discord token
@earnest phoenix at the end
@uncut slate Sure
Still doesnt work
show me what you did
I have no idea were to put it, what line
case 'xkijux':
bot.sendMessage({
to: channelID,
message: 'XkijuX is the best executer ever'
tts: true
});
```
what do i have to do to fix this code im so lost
client.on('message', (natan_can_succ_my_dicc) => {
// Handle the message
});
@earnest phoenix this is what a normal message event looks like, adapt
@fleet mason you've been told 3 times already; you're missing a comma
i cant find out where
Did you try common sense a/o Google?
This is how mine looks
do i have it beetween tts: true and message command?
client.on('message', message => {
if (message.content === '>ping') {
// send back "Pong." to the channel the message was sent in
message.channel.send('Pong.');
@earnest phoenix yes, and it's not closed
Were do i put it then
look at the example I sent you and adapt π€·
You're missing a }
you miss a }
xD
Dang it
First :P
Were, after pong
after the semicolon
I feel stupid now XD
didn't close your if statement
Okay fixed ti
these are basics jesus
Great, and it still didnt work.
guys what kind of code enviroment/ texturer place should i use. Im currently in notepad but its messy af
I use Sublime Text
I use some good VS code
@mighty barn How's your bot called?
-bots
@worthy hedge
@safe kernel
@elder rapids Me too π
Ok thx
@mighty barn How are you sending the servercount to discordbots.org?
My code isn't working
I'm using Tonkku's example
Tonkku? Is there a link?
I'm using custom made mmLol
it's pinned in #312614469819826177
But I use a different language
huh, neat
@mighty barn Do I need a new dependency?
Don't think so snekfetch is already found in the node_modules
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
What do i replace the <.> with?

Yeah, but I checked it. Its all good. Exept those < >
also unprefixed responses arent good
Don't copy paste that's fully useless just make a clone of a git repo of some good bot if you want to copy past
If you didn't know what you are doing that's useless to code anything
Learn the base first if you don't know that's "<client>" is to replace with a object with the discord.client type
( here is client )
here you call the Function "setPresence()" from discord.client.user
You have already a discord.client know as "client"
so you can make client.user.setPresence()
Yeah I figured,
Please don't start coding with copy pasting that's useless better ask some poeple to explain you ^-^
Thats why I am asking. And im copying and pasting simply bcz if I take down other bots. I dont know what I have and what im working with.
Thats why I like to start from scratch
And just add all the code I need for what I want in my bot
Not more, not less
But learn what any fonction any syntax mean
So you can use it again
You didn't know what's client is and you ask for what to replace <client> by but you already use it so you don't know how youre previous code work exactly
And I am starting to learn coding, im getting game development / application developer education next year so yeha. I wanted a head start.
I searched it on google
xD
Gl
Good luck with you're if you have any question ask it that's a lot better π
Yeah, thats why I asked xd
Thanks π
anyone know how to map reaction stuff ?(please tag me)
if (command === "leaveserver") {
if(message.author.id !== botowner) {
message.reply('thois command is only for bot owner!!!');
return;
}
let guild = bot.guilds.get(args.toLeave);
guild.leave();
message.channel.send('Left guild.');
}
TypeError: Cannot read property 'leave' of undefined
message.guild.leave()?
ohh I see
@low rivet @whole mural nope :/
@earnest phoenix when u get the guild is it a string?
well what is args.toLeave?
args is id
why did you add toLeave?
ceause i see it at an github file
k
is there a command i can add to my bot that will show how many servers it is?
im using discord.js
yes
@tulip wave bot.guilds.size
that lol
lol thx
np
ok
(because it'll only be the total for that shard)
its only a small bot anyway
yup
Well if you don't ever plan to shard (aka go above 2,500 guilds) you're fine
But that's just for reference that it's not accurate after sharding
im not planning anything like that just yet
LUL
asking to fix code
it is on upside
I won't spoonfeed you :^)
k thanks
I am looking for a sorta randomizer piece of code.
For example, when I say "Hi" It could either say "Bye" or Hello"
create a list of all the outcomes you want then use a random number generator to generate a number between 0 and the list's size
Okay
@elder rapids would u have to like loop through shards and add the guild counts post-shard?
you should really be asking that in #general
this place is more for specific questions
no cause this is development
const cookies = require('quick.db'); // database
const moment = require('moment');
let today = moment().format('1')
if(message.guild.id === '383790085901910016') return;
cookies.fetchObject(`lastBump_${message.guild.id}`).then(i => {
if (i.text === today) return message.channel.send('**FAILED!** Your server already bumped today');
cookies.updateText(`lastBump_${message.guild.id}`, today).then(() => {
Why is my bot only returning FAILED Your server already bumped today? It's been doing it every day, and no one can bump there server with my bot.
Can someone please tell me why this doesn't play the second song in queue but says it is
const Discord = require('discord.js');
const fs = require('fs');
const config = require(`./../../config.json`);
const search = require('youtube-search');
const yt = require('ytdl-core');
var opts = {
maxResults: 10,
key: ''
};
function play(message){
message.channel.send(`Playing song **${queue[message.guild.id][0][0].title}**`);
const stream = yt(queue[guild.id][0][0].link, { filter : 'audioonly' });
const dispatcher = message.guild.voiceConnection.playStream(stream, { seek: 0, volume: 1 });
dispatcher.on('end', function(){
queue.shift(1);
play(message);
});
}
let queue = [];
module.exports.run = function(bot, command, args, message, updateJSON, addFooter){
if(args[0]=='queue'){
if(queue[message.guild.id]==undefined){
queue[message.guild.id] = [];
search(args.slice(1).join(' '), opts, function(err, results) {
if(err) return console.log(err);
queue[message.guild.id][0] = results;
});
}else{
search(args.slice(1).join(' '), opts, function(err, results) {
if(err) return console.log(err);
queue[message.guild.id][0] = results;
message.channel.send(`Queued song **${results[0].title}**`);
});
}
message.guild.members.get(message.author.id).voiceChannel.join();
}
if(args[0]=='play'){
play(message);
}
}
module.exports.help = {
names: ['music'],
usage: 'e-command <args>',
description: 'what?'
}```
done
ok
forgot about it
._.
k
insead of queue.shift(1)
may take a while though, I have to wait for songs to end...
I don't know any...
Does someone know a good SQLite alternative for node.js?
Can someone help me? When I do eg ??discrim 4275 I get 5 results of just me. What I'm using to search discrims is js if(isNaN(args[1])) return message.channel.send("That's not a valid discriminator!") var output = '\`\`\`fix\n' var found = false; client.guilds.forEach(function(guild) { guild.members.forEach(function(member) { if(member.user.discriminator == args[1]) { output += member.user.username + '#' + member.user.discriminator + '\n' found = true } }); }); if(found) { return message.channel.send(output + '\`\`\`'); } else { message.channel.send("Error! Found no users with the discriminator" + args[1]) }
,-,



