#development
1 messages · Page 470 of 1
lmfao
@topaz fjord help me
my bot has too high ping
dont run a public bot if you're not gonna run it on a vps imo
I have 45p
Get better internet @earnest phoenix
what is a p
That's how u fix it
If I didn't want to live in my room my bots ping would be better
p is pence aka british version of cents
45p= £0.45
whats a module that i should use for making http requests in python
found requests but idk if i should use that
¯_(ツ)_/¯
Don't use request
then what do i use
aiohttp
async with aiohttp.ClientSession() as cs:
async with cs.get("https://thonk.com/data.json") as r:
res = await r.json()
print(res["data"])```
Is there a way to enable cookies using cURL?
Rather, using curl-request?
https://www.npmjs.com/package/curl-request
for any of you using express and express-session. I have auth functions implemented (which are async).js api.post('/user', async (req, res) => { id = req.body.id password = req.body.password rememberMe = req.body.rememberMe const data = await auth.login(id, password) // await the login if (!data) { res.status(400).json({}) return } req.session.token = data.id // set the session if (!rememberMe) { req.session.cookie.maxAge = 900000 // shorten cookie life if session doesn't need to be remembered } res.json(data) // finally return the data })
this middleware is being called from the browser after the data returns, and as you can see the expires didn't update as well as the store itself is nowhere to be found
and no req.session.save and then to return the data in the callback doesn't work
im not super familiar with express, but if that middleware is async, wouldnt it run, but then immediately go on to the route?
what im saying is maybe you have some kind of race condition going on
I also have this middleware before all of this and yes there is a race condtion and making it sync doesn't work eitherjs api.use('*', (req, res, next) => { Promise.resolve(next()).catch(next) })
ahh ok. 🤔
as you can see the database did update but not in time
for the record I made everything sync again and used promises insread
Is there a way to embed the vote button for my bot into my website?
Didn't know what other channel to post this in
umm can't you just redirect to your_bot_dbl_website/vote?
i want the actual button to be on the website i dont want the user to be directed to an external site
so like
no, and im guessing dbl also blocks iframing
so probably not
k
rip
I think I will try and use passport
it looks way better than express-session and can be customized
hello, can someone help me with this? i'm using node.js
let dom = (body, callback = () => {}) => jsdom.env(body, (err, window) => {
^
TypeError: jsdom.env is not a function
jsdom.env is not a function
djs
Is there any way to force users to cache or otherwide get an accurate number?
you can add the member count of all servers but then you'd have to remove duplicates somehow
My friend told me to do ```Client.on('message', function(message){
if(message.content.startWith(prefix + "const cooldown = new Set();
const Discord = require("discord.js");
const package = require("../package.json")
exports.run = (client, message) => {
let guild = message.guild;
// message.delete(3000);
var bpmb = client.ping;
var bpm = bpmb.toFixed()
let os = require("os");
var usageMb = process.memoryUsage().heapUsed / 1024 / 1024;
var usage = usageMb.toFixed(2);
/*
Cooldown for the command
*/
if (cooldown.has(message.author.id && message.guild.id))
return message.reply(This command have a cooldown of 5 **Minutes**); // this will check if the users is in the cooldown
cooldown.add(message.author.id && message.guild.id);
setTimeout(() => {
cooldown.delete(message.author.id && message.guild.id);
}, 300000);
/*
Fetch the client info and parse it into an embed
*/
const embed = new Discord.RichEmbed()
.setAuthor(${clieient.user.username} Info Below, client.user.displayAvatarURL)
.addField("❤ BPM", bpm, true)
.setThumbnail(client.user.displayAvatarURL)
.setColor(3118751)
.addField("MB usage", ${usage}MB, true)
.addField("Discord.js", ${Discord.version}, true)
.addField("ArsBot", ${package.version}, true)
.addField("npm", ${process.version}, true)
.addField("Users", ${client.users.size.toLocaleString()}, true)
// .addField("Bot Platforn:", os.process.platform(), true)
.addField("Click the emoji", [🤖](https://discordapp.com/oauth2/authorize?permissions=8&scope=bot&client_id=Bots client id), true)
.addField("Channels Overall", client.channels.size, true)
.addField("Guilds Overall", client.guilds.size, true);
message.channel.send({
embed
}).catch(e => logger.error(e))
};
module.exports.help = {
name: "botinfo"
}
Code for command
}
}")```
But it wont work
Well i put it in and saved it amd it did nothing so i can't be more specific than that
if(message.content.startWith(prefix + "const cooldown = new Set();what- u have a message evnt but using module.exports
- logger isnt defined
The command he found on GitHub
Hahaha I didn't even read the code, that's horrible
this looks borrowed...
@neon schooner why my bot is muted?
Because it responds without prefix.
Ohh.
@neon schooner Thank you , i will make up the problem, after making how can i repair it? Can I apply to you ?
Do I have to apply to you*
You can poke any of us, but I will be gone in ~30 minutes.
Okey thank you.
@earnest phoenix you shouldnt need sharding at 800 servers
if your bot isnt responding its a code issue
check the console for errors?
No.
any errors?
Alright I think I might be retarded, So I must have change my prefix and completely forgot, Just disregard what I said. Sorry.
lol its ok
Happens to the best of us
js is a lang
recommend you to use codecademy @earnest phoenix
@smoky spire What do you mean by trash paramater
It’s so that the link is different every time so it can’t rely on cache
@glossy talon
Is anyone familiar with the curl-request NPM package?
.
anyone ever had this issue with lavalink?

thats a great time unit
ikr
started getting msgs at 5am that music broke
and audio player wouldnt start even after reboot 
stupid intermittent issues with useless errors
Asking for a friend who uses discord.js. Is it possible to get the owner of a guild by the guild ID?
The owner ID.
client.guilds.get("id").owner```
Forgot to mention the only problem. The bot is not in the server.
I forgot to include that lol.
Then you can't get the guild owner.
Nice developing work, but maybe to make it easier for the developers general, it's the possibilty to HTML & CSS bigger
and then concentrate on difficult languages like PHP, Javascript & MySQL
javascript is pretty easy
Aw heck. Thanks though. 
help
check line 365
yeah?
?
async def on_member_join(member):
with open('users.json', 'r') as f:
users = json.load(f)
await update_data(users, member)
with open('users.json', 'w') as f:
json.dump(users, f)
@bot.event
async def on_message(message):
with open('users.json', 'r') as f:
users = json.load(f)
await update_data(users, message.author)
await add_experience(users, message.author, 5)
await level_up(users, message.author, message.channel)
with open('users.json', 'w') as f:
json.dump(users, f)
async def update_data(users, user):
if not user.id in users:
users[user.id] = {}
users[user.id]['experience'] = 0
users[user.id]['level'] = 1
async def add_experience(users, user, exp):
users[user.id]['experience'] += exp
async def level_up(users, user, channel):
experience = users[user.id]['experience']
lvl_start = users[user.id['level']
lvl_end = int(experience ** (1/4))
if lvl_start < lvl_end
await bot.send_message(channel, '{} has leveled up to level {}'.format(user.mention, lvl_end))
users[user.id]['level'] = lvl_end```
this is code
btw
what's wrong with it?
;__;
ohh
s!play
soo my bot gains votes and servers really fast... can someone send me a good sharding tutorial for jda or give a short explaination how sharding works in detail?
^
TypeError: Class constructor Client cannot be invoked without 'new'
at Object.<anonymous> (C:\Users\user\Desktop\Echo\index.js:2:21)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3```
what does that mean?
this is self-explanatory
i mean the error tells you what you cannot do and tells you what to do to fix it
i can't help you more than that
so basically it cant have new in the code?
uh
fixed it
operable program or batch file.```
How do I fix that?
I have not had those errors before
That's erroring because Client is a class and you're not instantiating it with new
new Constructor() is how you invoke constructors to create a new object
Yes
So you just need to do const bot = new Discord.Client();
^
And for your second error, n doesn't exist in your PATH so it's unsure what to execute @earnest phoenix
Otherwise it would be just calling the Discord.Client() method and catching its return value with const bot, which not allowed because Client is a constructor
Show me what you're trying to run in the console
Might be trying to type node 🤔
That's what I thought too
@frigid bone My friend fixed it for me
Why does it spam Hello, 👋 how are you? When i say Hello.
Make sure it's not responding to itself..
client.on("message", (message) => {
if (message.content.startsWith("Hello")) {
message.channel.send("Hello, 👋 how are you?");
}
});
thats the code
so maybe dont check if it starts with hello
but if the content alone is hello
then it wont respond to it self 
or just check if the message author is a bot 
but you can also do if(message.author.bot) return;
That way it won't ever respond to itself, and ignore other bots

on a bot invite link, can you pre-specify a guild
like as a suggestion
Anyone wanna collab on a bot?
u dont just ask that sort of stuff
...
Why?
function googlesrch(search) { var srch = ""; if(search.startsWith('!google ')){srch=search.replace('!google ', '');}else{srch=search;} google(srch, function(e,r){ let re = new Discord.RichEmbed() .setTitle("I think this is all I can find...") .setAuthor("Trevor", client.user.avatarURL) .setColor(3447003) .setDescription("I sniffed all around the world of Google. Hope this is correct!") .addBlankField(true); try{ for (var i=0; i<5; i++){ var t = ""; if(r.links[i].title.length>256){ t = r.links[i].title.substring(0,250)+"..." }else{ t=r.links[i].title }; if(t!==null|r.links[i].description!==null|r.links[i].link!==null){ re.addField("["+t+"]("+r.links[i].link+")", r.links[i].description); } } return re; }catch(e){ return error_embed(e); }
EMPTI MESSAGE? WHY, ITS NOT EMPTY
if(msg.content.startsWith('!google ')){
msg.channel.send(googlesrch(msg.content));
}
fucucucucucukcufuck
do console.log(the output)
Then it's empty
You mean ||, maybe?
Embeds can't have empty fields
FUCK WHO WILL HELP ME? FUCK YOU JAVASCRIPTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
var srch = "";
if(search.startsWith('!google ')){srch=search.replace('!google ', '');}else{srch=search;}
google(srch, function(e,r){
let re = new Discord.RichEmbed()
.setTitle("I think this is all I can find...")
.setAuthor("Trevor", client.user.avatarURL)
.setColor(3447003)
.setDescription("I sniffed all around the world of Google. Hope this is correct!")
.addBlankField(true);
try{
for (var i=0; i<5; i++){
var t = "";
if(r.links[i].title.length>256){
t = r.links[i].title.substring(0,250)+"..."
}else{
t=r.links[i].title
};
if(t!==null|r.links[i].description!==null|r.links[i].link!==null){
re.addField("["+t+"]("+r.links[i].link+")", r.links[i].description);
}
}
return re;
}catch(e){
return error_embed(e);
}```
SHIT
Ok i ask discord.js
So you are using the googlesrch function to send the embed?
Yes
Because from what I see it isn't returning anything.
return re
You seem to be having a problem with nested functions.
hi
You are returning in the google function.
return re;
Not in the main function.
Yes. But the main function is not returning that.
Try setting a variable in the googlesrch scope and instead of returning re set the variable to re then return that variable in the googlesrch function.
Show code
var srch = "";
var ret;
if(search.startsWith('!google ')){srch=search.replace('!google ', '');}else{srch=search;}
google(srch, function(e,r){
let re = new Discord.RichEmbed()
.setTitle("I think this is all I can find...")
.setAuthor("Trevor", client.user.avatarURL)
.setColor(3447003)
.setDescription("I sniffed all around the world of Google. Hope this is correct!")
.addBlankField(true);
try{
for (var i=0; i<5; i++){
var t = "";
if(r.links[i].title.length>256){
t = r.links[i].title.substring(0,250)+"..."
}else{
t=r.links[i].title
};
if(t!==null|r.links[i].description!==null|r.links[i].link!==null){
re.addField("["+t+"]("+r.links[i].link+")", r.links[i].description);
}
}
ret = re;
}catch(e){
ret = error_embed(e);
}
});
return ret;
}```
@gilded blaze
Oh wait. That's cause google returns a promise. It's returning ret before google calls your callback.
You could make the function return a promise and just await it when you use it.
Then just resolve re which means you don't have to use ret.
why is ret undefined 
not inside callback

https://discordbots.org/api/bots/458431964119040000/check?userId={ctx.author.id}?trashhere={random.randint(1, 1000)}
So why does this no longer work
I added a trashhere to the get
And it no longer works
I added a Trashhere so it would start updating the links info
But it now always gives a no
Is a problem with strings and backslashes on windows, an r before the " should work > r"C:\Users\etc"
I want to give a role to my voters who have a code ready
How can I make a command like t+votecheck and if you didn't vote it would say you didn't but if you did it would say you did
someone please help
any1 know why this is happening to me? https://inovus.co/yF4tQD.png
uhh
if you could help, and want to do a VS:Code live share DM me
u using pylint?
yep
ok. how do i uninstall, im pretty dump
pip uninstall pylint
k kool thanks
i did that (get pylint) and it said something 100% valid was invalid code
how can I check if a user voted, in dblapi.js
by using webhook, then saving to a db and check there.
how do I see what the 2nd message is so I can see what it is so like >setting true/dalse
how @earnest phoenix
up to you to implement
wdym
help plz
The Bot Client ID isn't correct it is the id of you discord bot
okay thanks
no problem
if(messageid !=='296750415964274689')```
Would this work?
Why do you split and join? That is redundant.
i has disable the leveling up message, will my bot get unmute? my bot name @dim trail
yes i has fix it @gleaming glen
does anyone know how to convert ctx.author.status into a string?
without doing an ext.commands converter
ReferenceError: guild is not defined
.addField(`Server name:`, `${guild.name}`)
Shouldn't guild not need to be defined
ty
OAuth2 says not a well formed URL, any way to fix?
The URL is https://shoown.glitch.me (due to me running a dashboard from there), and all it says it's not a well formed URL.
Sorry for not explaining earlier
Kan Iemand helpen weet niet hoe ik veder met de bot moet
Want dit staat er Please enter at least 300 characters excluding special characters in your detailed description. If you use iframes, you need to use at least 300 more characters..
Dus wat moet ik dan doen?
u gotta have at least 300 characters in ur long desc
english would be better
Where is that
Yes, but what do I have to do there? I do not understand that
What your bot is about
I don't know why they changed it to that, it's stupid imo
If your bot gets declined, you have to retype it
why does my bot say its undefined https://i.imgur.com/qN7hqnN.png
.addField(`Server Member Count:`, `${guild.member_count}`)
.count?
So should drop '' about your bot ''
exactly
@earnest phoenix Discord.js?
TypeError: Cannot read property 'count' of undefined @gleaming glen
I put this down there about your bot but remains the same report
guild.memberCount
u can easily find this kinda stuff in docs
I'm getting the guild. things from the doc
I put this down there about your bot but remains the same report
@earnest phoenix ty and the something_something just do somethingSomething?
it depends on what you are trying to get, but with member count, yes
so if its undefined do that
Best bet.
👌
How do I fix that now especially bone does it because I really do not succeed I still do not understand what to put down there or Where I can find it at that Detailed description of your bot *
HTML & Markdown allowed, minimum 300 characters
Hello??
Describe/list your bot commands, for example.
Is that in my discord?
what are u trying to do?
Make your own bone but do not come out
i dont understand what u r doing, its there when trying to add a bot
I do not understand what I should put down here. Detailed description of your bot *
HTML & Markdown allowed, minimum 300 characters and if I like that If you just help me Well would be nice
just describe about your bot that you want to add there
whats a guilds splash
it's for partnered guilds
no
its the background of the invite screen
but you can only set it if the server is partnered or verified
const prefix = ";" if (message.content.startsWith(prefix + "ping") { // code here}
Can you send a Link where I can find it because it can not find it
@grizzled isle
Hello??
Hey can someone help me find a way for my bot to stop listening into this server
It is basically getting ddos-ed
Or if some mod can kick it
That doesnt make sence
If you are doing a collab on a bot is it possible to have 2 ownerID's in the config.json?
2018-08-25T21:12:49.041253+00:00 app[worker.1]: [debug] message-sent-to-bot: (264445053596991498)
2018-08-25T21:12:49.072477+00:00 app[worker.1]: [debug] message-sent-to-bot: (264445053596991498)
I get these each time a message is sent
Yes?
@rustic axle In your code let it check if the message is coming from that server using the server id, if it is then return;
Thats not called ddosing wth
Its a joke
Just disable it for the guild id
Oh yeah you are right
Ok but uhm, if you are doing a collab on a bot is it possible to have 2 ownerID's in the config.json?
ye
Would you separate them using a comma then or what?
arrays work in json files
oh i gotta learn arrays now then 
its literally just ["id1", "id2"]
o, oki ty
My Bot Doet het niet
I do not have a site so I can make a bone
@red parcel are you using one of the dbl api libs? (also this would be better in #topgg-api)
i fixed it i think i need someone to test
How do I get mn bot Online
What are you using to run it
I do it via Google Dan via DEVELOPER PORTAL
I bet he just created an app
you know... those type of people that think it's so easy to make the bot they want
Without reading up anything yea.... and google is staring you in the face to be used
How is it then?
Are you hosting it on google cloud computers and what language?
No
But you said you were using Google?
he googled the dev portal
Thats for APIs releated to Googles own services not Discord
How Dan?
Look up tutorials on Google/YouTube to learn how to create a bot
does anybody know how to setup skysilk?
What is that?
my dms are locked, and so are friend requests
Have you tried pinging your host ip?
what is that
just tell me where you are stuck
bit low
bet you couldnt get it to 20,000
uh so how come your getting 16second ping

Are you using a website to ping that or your own computer?
you still didn't provide any information on where you are stuck in skysilk
open up command prompt and type ping (ip)
I cant connect to it can mean a lot, not just what you are thinking of 
I'm still clueless as to what exactly you want to connect, or connect with and connect to
Same 
no need to blur your computer name
hmmm timeouts
i dont want you seeing my name @ruby dust
@ruby dust how do you connect to the vps
So are you not able to connect to your vps?
idk how
You have putty?
I use filezilla for file transfer, and putty as terminal
yes
nice
Port 22?
putty twice
yes
and when you attempt to connect what does it bring up?
then you type in root right?
Yes you login as root
when ever you say root i wonder wtf you are saying
actually if you want to access root, you'll have to have a private key generated from your putty instead of logging into one of the users
Does it give you a user?
no
I have a ssh
No not if you set up private keys in the first place
you have to create one via root
the only access to root is by using a private key, yes
a key is a file that you should have generated from putty
dont let me put a password
It does
no
it's hidden
it dont
But it doesnt show what letters you type

usually you'd want to create a user, that process may differ depending on what OS you use
smh all of you use vps like scrubs just use a github public repository as a user database and heroku as server smh
lol
so everyone's data can be hacked
you don't generally want to run anything on root because it's an alias to windows administrator access, which would really fuck up your system if not treated carefuly
shit you outsmarted me 
Aslong as the root password isnt 123 then you're fine 
adduser (username)
did you get the current password from the provider?
hes in
if yes you should change it right away using passwd
uh to add new user do - adduser (name) then usermod -aG sudo (name) then su (username) to login
once you'll be done with whatever you're doing, you'd want to install tmux, which is what originally used to create sessions (aka multiple command prompts on windows) and actually run your programs on the cloud instead of locally
Kayo your using special characters in your name right?
or use system services
yeah stay here to tell me how after @ruby dust
and have the system watch your stuff
uh just letters?
yes
Kayo what it looks like
but its not Kayo
its a name but it looks like Kayo
Clolololo
I can't stay any longer, just type apt get tmux and then google the tmux commands
can I not use windows remote
how do i make an account @fast marten
adduser Kayo
yes
try with all lower case?
welp worked
Hey how do you send a message to a channel before bot.on(message, funct.)
Because I tried it in bot.on(ready, funct.)
but it doesn't work
screenshot?
Room Number []:
Oh just press enter till you get a question saying if the information is correct and put yes or y
how do i login
wait before you do so
it exited
?
and said the user already exxists
Room Number []: ^Cadduser: `/usr/bin/chfn kayo' exited from signal 2. Exiting.
root@Kayo:~# newuser kayo
Command 'newuser' not found, did you mean:
command 'newusers' from deb passwd
Try: apt install <deb name>
root@Kayo:~# adduser kayo
adduser: The user `kayo' already exists.
now do su kayo
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Yeah that just means when you need permissions for a command put sudo in front of it to run it as root
now it says name@Kayo:/root$
uh your probably already in it
yes you do
yes
now what
what are you wanting to do
what library?
js
sudo apt-get install nodejs probably
I recommend using the ppa way
sftp
then be able to edit it
or git

I like to know here so I dont spend 10 hours googles it
more like 10 minutes but k
nice turtle
you can use an sftp program like filezilla to transfer files
Tim
o yes when I need it https://i.imgur.com/NKgas1o.png
hi there, if anyone uses dbm does anyone know why i get this on play youtube video:
Error: \\?\C:\Users\node_modules\node-opus\build\Release\node-opus.node is not a valid Win32 application.
\\?\C:\Users\node_modules\node-opus\build\Release\node-opus.node
tried reinstalling node-opus
its trying to execute a .node :?
did it run gcc on install?
File is corrupt, bad, or missing.
- If the hard disk drive is corrupted or bad it can cause working programs to fail either because not all the data can be read from the hard disk drive or because the program has become corrupted while on the drive. Run scandisk and defrag on the hard disk drive to check for any potential errors.
- If you're running the program from a shortcut on the computer, verify that the program is still on the computer. In some cases if the program is no longer installed on the computer you may get this error.
File is not designed for your version of Windows:
- If you're trying to run a program that is not designed for your version of Windows you may get this error.
- Although many older programs designed to work in older versions of Windows will work with new versions of Windows, unfortunately, not all programs will work.
- If the program is an older MS-DOS program or early Windows program you may get this error.
- If the program is designed for a 64-bit version of Windows and you're running it in a 32-bit version of Windows, it will not work and generate this error.```
oh
probably second part
can you open git bash (or anything else that has the file command) and file <that file>
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('I have successfully connected to the channel!');
const dispatcher = connection.playFile('songs/' + `${songnames[randomNo]}` + '.mp3');
if (message.content.toLowerCase().startsWith(config.prefix + 'volume')) {
let volume = args[0];
dispatcher.setVolume(`${volume} / 100`);
}``` heres my bot code, in discord.js
i need help with my volume command, it just wont change
oh
the command im running is >volume 50
i think it should take 50 and divide by 100, to set volume to 0.5
^

case "play":
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('I have successfully connected to the channel!');
const dispatcher = connection.playFile('songs/' + `${songnames[randomNo]}` + '.mp3');
if (message.content.toLowerCase().startsWith(config.prefix + 'volume')) {
let volume = args[1];
dispatcher.setVolume(volume / 100);
}
})``` heres what ive got now then
it still doesnt work though
it plays music off my osu lool
Wait shouldn't volume be args[0]
If you use it as
+volume 50
i tried it as args[0] and args[1]
Wait how you think you can have command in command
probably if it was separate commands cant get dispatcher
yea
Ah
Ik how then
let volume = args[1]
dispatcher.setVolume(volume / 100)
}```
so command will be play volume 50
@fiery birch
It should work
@fierce thorn that doesn't work either
Can you show me code
case "play":
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('I have successfully connected to the channel!');
const dispatcher = connection.playFile('songs/' + `${songnames[randomNo]}` + '.mp3');
if (args[0] === "volume") {
let volume = args[0];
dispatcher.setVolume(volume / 100);
}```
Is there any error?
no
i tried let volume = args[1] as well
Try learning more JavaScript.
good help, real useful lool
debug your code
put console.logs everywhere, read the code flow, identify where the issue is, and fix
no bugs show up though
im just not that good to even do much, wip
ill just abandon the volume command
try removing the double quotes around volume
small chance it would work
it depends on the context of the rest of your program
then the problem is the dispatcher
@earnest phoenix How does one webhook 🅱
what does this mean
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
const fs = require("fs")
const warns = JSON.stringify(fs.readFile('../warns.json', 'utf8'))
let user = msg.guild.member(msg.mentions.users.first())
if(!user) return msg.reply("Hmmmm I won't be able to successfully warn someone unless you mention them.")
let userd = JSON.stringify(fs.readFileSync("././storage/warns.json", "utf8"))
if(!userd[user.id]) {
(userd[user.id]) = {
warns: 0
}
}
userd[user.id].warns++
fs.writeFile('././storage/warns.json', JSON.stringify(userd), (err, call) => {
if(err) msg.channel.send(err)});
msg.channel.send("I have issued a warning to the user: " + user +".")
},```
literally says what it means
¯_(ツ)_/¯
should I keep my bot in 1 file or start to do things like exports.conf
you're mixing up readFile and readFileSync
readFileSync is not async, meaning it will block your code until its node, and doesnt have callbacks.
readFile is async, meaning it will not block your code, but it needs a callback to know what to do after its finished.
also use a database and not json
rethonk >>
but I think i'm gonna start making my bots with multiple files
Well it depends... like my bot has just one file with 300+ lines of code and 3 supporting files but to be honest I could break it up further or I could make it into one huge file totaling 600+ lines of code. It depends on what you want and what will be easier for you. If you don't want a huge block of text then break it up. If you don't want a ton of files then make it into one. @earnest phoenix
my bot has like 3 files with 1-2k lines each

0,0
my main file is only ~120 line
and im still using a json database xD
heck
i use no db and no bot 
pls use a text file
in short, its fine to use json, but you need to be careful with it, because if you use it wrong, it can lead to corruption
thats how I store songs for my audio bot... in a text file even tho heroku allows for me to use a db 😂
for example, writefile and writefilesync will both corrupt the json file if they are interrupted in the middle of saving due to a bot restart or crash, and will make you lose the entire json file
i use json for my leveling
ur banned
lol
oh i remember
use vb script to automate marcos so it save stuff in an excel file
i use floppy disk database
I use ftp
each user has a floppy disk
google sheet database is actually a great idea if for example, you want a community run database containing stuff like trivia
500 rows in my economy table
nice
heck
i store passwords in the text file in the downloads folder of windows
no
boi
here is the ip and port
who stores password
its port fowarded
when you can remember it
my ip is 127.0.0.1 have fun ddosing me
what if you forget the password
okay
uh
you don't forget it
use ur own decrypt algorithm
i've used the same one for years
you cant decrypt hashes
only bruteforce them
ok then
or dictionary attacks
bruteforce the hash then to get the password back
here is a tip
just give the password to the attacker and they won't attack you...
no encryption needed
who wants my password
make your password 2444666668888888 and tell them the password is 12345678
yes
does anyone know what this means?
path.js:1086
cwd = process.cwd();
^
Error: ENOTCONN: socket is not connected, uv_cwd
at Object.resolve (path.js:1086:25)
at startup (internal/bootstrap/node.js:252:32)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
anyone know how to obfuscate new Date()
new (window[[0, 17, 30, 21].map(x=>String.fromCodePoint(parseInt(new String(x+44), 16))).join("")])()
using discord js, js case "play": message.member.voiceChannel.join() .then(connection => { // Connection is an instance of VoiceConnection message.reply('I have successfully connected to the channel!'); const dispatcher = connection.playFile('songs/' + `${songnames[randomNo]}`); if (command === pause) { dispatcher.pause(); };
pause command wont work
you cant put if(command === pause) inside the .then
uhh
alr
sec
case "play":
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('I have successfully connected to the channel!');
const dispatcher = connection.playFile('songs/' + `${songnames[randomNo]}`);
})
if (command === 'pause') {
dispatcher.pause();
};``` @bright spear still doesnt work
is there an error?
its not
the code you sent doesnt include if (command === 'play')
if i had them as seperate cases it'd return dispatcher not defined
use message.guild.me.voice.channel.connection.dispatcher.pause()
and keep them seperate
well
if ur on pre-12 change voice.channel to voiceChannel @fiery birch
@frank forge no
dont take other's code
write ur own
alr that works
tyvm
@bright spear aaa, once its paused i cant resume
thonk
message.guild.me.voiceChannel.connection.dispatcher.resume();```
did you make a resume command?
yea that
none
how do I run a jar file in background? (linux)
let user = msg.mentions.members.first();
let args = msg.content.split(" ").slice(1)
if (!args[0]) return msg.channel.send("Hmmm, looks like you didn't tell me a user to check!")
let embed = new Discord.RichEmbed()
.setTitle("Checking...")
.setDescription("Please wait while I run a few tests to see if the user is bannable by me.")
msg.channel.send({embed})
await new Promise(resolve => { setTimeout(resolve, 5000) })
if (user.bannable !== 'false') {
embed.setTitle("This user is not bannable.").setColor("RED").setDescription("Please make sure I am a higher role then the user so I can ban them successfully.")
msg.channel.send({embed})
}
else {
embed.setTitle("This user is bannable!").setColor("GREEN").setDescription("Good news! I can ban this user! If you find a bug please use >bug to report it, thanks!")
msg.channel.send({embed})
}
},```
This always says someone is bannable when its === and someone isnt bannable when its !==
case "play":
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
const dispatcher = connection.playFile('songs/' + `${songnames[Math.floor(Math.random() * 350)]}`);
message.react('▶')
dispatcher.on('end', () => {
sleep(5000);
connection.playFile('songs/' + `${songnames[Math.floor(Math.random() * 350)]}`);
return;
});```
need help letting this keep looping, discordjs. when a song ends, plays a new one and then it stops, i'd rather have it just not stop tho
@earnest phoenix change user.bannable !== 'false' to !user.bannable
any help pls
What lang @fiery birch ?
darn can not help you i only know discord.py
Aw, ty tho
have u tried the API server for help?
alr
@earnest phoenix change 'false' to false
no quote
@fiery birch have that as a play() function and call it on end.
Discord.js
It has the message author
Would I say if(message.author === pineapplefan1234YT#9295); or === server nickname, or === pineapplefan1234YT
Message author is a user object, check the tag parameter of it, if you want to compare username and discriminator
Or, better, check for ids
message.author.id === '123...'
But would it just be if(... === Jokersus#????)
message.author.tag would be jokersus#3343
Ok
So if(message.author.username === jokersus);
Or would it have to be the server nickname
Would be the username
If you need nicknames, and other guild+specific properties, you should check the message.member parameter
I advise you to check the docs btw https://discord.js.org/#/docs/main/stable/class/Message
Thanks
Like I said, it's better to store ids of whitelisted users somewhere, and check that instead of usernames
Since that's practically impossible to fake, but anyone can easily change their username
How do I get the error from an Error() without the trace?
You should be able to use Error.Message depending on the language you use
What databases do people use for there bots?
PostgreSQL
I switched from mongodb to mysql
I have used many databases before but i mostly use json
It doesn't matter tbh, as @quartz kindle said, JSON could also work pretty well
Not if you're using a VPS
Although if your sharding there is chance of data loss
Well, you can't really access it if it's on VPS
And updating your bot might overrwrite the file
well, true, but only if you're working with a big amount of data
my json databases are under 1mb
i mean any sort of DB on dedicated server with enough ram
Unless you have VPS with only dedi storage 
as long as ur working set in memory
ur chilling
like thing about it
even if EVERY command took 1 databse read/write
you would need astronomically high command use
Sigh rewriting like 40 commands sure is fun
to even start stressing the database
DB can be run on VPS quite easily
load db into object at startup. only write when changes happen. profit
I'm guessing some people use there DB for alot of things
For stuff like a game or economy yea but if its just a simple guild config json is the way to go
people who use command handlers and module exports which need new bindings on every file probably need a new db connection and transaction for each file that needs it
1 connection pool 
yeah but most people dont do it
yeah i forked enmap just to pass my own db connection into it
1 connection per guild
10k guilds
its a joke since it has a shorthand for instanciating multiple enmaps but uses a new db connectio nfor eah 
Ah
Can bots use animated emojis ?
yes
<a:whatever:id>
get baguetted u facken furry
oi
it works, ty
text.replace(/\{\{([^}]+)\}\}/g, function(i, match) {
ok i dont understand this, but i want it if i type "(lmao)" it replaces lmao with something, i already set up before but it only works with {{
-help
I did node . to run my bot and it popped up with this what does it mean?
it means you added multiple message listeners
and you probably didnt want to
cause: bad code
Can I delete the code to fix it?
what are you doing with 11 message listeners
just put everything in those listeners into 1 
@earnest phoenix I ended up having it as a function like you said, tyty
Can't you just save all voters to a database?
Yes use the /votes endpoint to get the last 100 upvoters
nvm
use the votes endpoint to get the last 1000 votes, then setup a webhook for votes from then on
and check your own db for votes instead then 
"Yes use the /votes endpoint to get the last 100 upvoters" how that?
@earnest phoenix ty, but are you sure that that works for smaller bots(with under 1000votes) too?
webhooks work for any bot
u should use it, so that you dont have to check the dbl api for votes
Hey guys !
I add a bot on discordbot
But on the my bots page I don't see the bot, so I can't have the API key, so how do I do I get the API key ?
wdym by API key
The discordbot token
There is no slot for a token
If someone would say "give me your bot token" they're remotely trying to steal your bot
It need a discordbot token, no ? But where can I find it, that's my question
On discordbots.org ?










