#development
1 messages ยท Page 514 of 1
You could instead use Promise.all()
that way, if one promise fails, you'll be able to get the error
Promise.all(message.guild.members.map(async m => await m.setNickname('whatever'))
.then(callback)
.catch(console.error)```
you just copied my code word for word
ยฏ_(ใ)_/ยฏ
and you can't use implicit return with an if statement 
I was happy too early...
"if(message.channel.permissionsFor("the ID of my bot").has("SEND_MESSAGES")){" shows as correct code, but don't prevent the error ๐
*the error that happens when people use a command in a channel where the bot can't respond...
@high tinsel which error is it
UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
@hushed berry
Wait, embeds have separated persons?
If so, how do I include more permissions in this thing?
@hushed berry
hasPermission can take an array of permissions
canine have you seen the docs
yes, embeds have separate permissions
Do you know how is it called, I can't find it... @quartz kindle
EMBED_LINKS
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
I tought EMBED_LINKS was just for links displaying as embeds...
embeds are one thing
since embed is basically a json object, im pretty sure they are sent to the api and stored somewhere
and discord loads them like they would any other url
You are right, now it works!
How can I run another NodeJS file from within my original NodeJS file?
require
yes, if the file is exporting a function
what if its not
then it wont work
can i get the guild from a channel?
yes
how?
do I need to do anything else other than the require then?
@fervent delta DiscordJS?
no
yep
@fervent delta channel.guild then
i need to get the guild from the channel in which a message is sent
and message has no channel property
nO
<message>.channel
ohyeah
some css on the site won't work, i can't get the color in <code> to change
it's on red, even with !important
@sick cloud try changing b
link?
its b right
remove white where
it shows as default for me
but then again, the entire dbl website is screwed up for me
none of my actual bots are certified
oh lul
waiting for apps
i set mine, but it never shows for me
its been like 2 weeks
i even tried in other browsers
i dont see any gradients @sick cloud 
ur using dark theme
scam confirmed
ok
someone give me blurple color
@earnest phoenix lookup discord branding
ugh but i have to open a new tab

anyone elses lavalink just break after newest d.js update
Anyone knows how to get amount of users that talking in one specific channel from yesterday?
for example : in #general there are 7 active user that chat yesterday
I tried using
client.on('message', msg =>{
const channel = msg.channel.name === 'some-channel';
channel.fetchMessage()
.then(message => console.log(message.content))
.catch(console.error);
})
But it prints nothing
Anyone can help?
๐ฉ
basically you are doing true/false.fetchMessage()
also i believe its .fetchMessages()
step 1: learn to code
step 2: read docs
step 3: profit
step 4: use profit to buy vps
const app = express();
const server = http.createServer(app);
app.get('/',function(req,response){
console.log("[SERVER]" + "received from "+req.get("X-Forwarded-For")+" : "+req.method+" "+req.originalUrl+" (Authorization: "+req.get("Authorization")+")");
});
app.post('/',function(req,res){
console.log(req);
});
server.listen(3000, () => {
console.log('[SERVER] Listening');
});
my server
Hosted on: http://0.0.0.0:3000/dblwebhook
And ik that dbl can access it as it logs a different ip
which isn't mine
meh i tried the vote event nothing happened
if i have a command like -create -d some args -p some more args, whats the most efficient way to capture them in an object, like { d: "some args", p: "some more args" }
split them according to the params (-p, -d) and capture what lies in front of them
and then convert it into an object
Any ideas on how to do custom scrollbar css for iframes?
i dont think you can for iframes
the site inside the iframe itself needs the CSS IIRC
np
im sure you know already but here's a good resource for custom css scrollbars
https://www.w3schools.com/howto/howto_css_custom_scrollbar.asp
@languid dragon didn't work but thanks โค
maybe you could find an answer on this @floral stone https://stackoverflow.com/questions/2280645/how-to-style-the-scrollbar-of-on-iframe
no cross browser rip
Help pls
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
What do I put for "password" in this?
ping me if you reply


@midnight widget is that the thing you see here
https://discordbots.org/api/docs#mybots
along with the token?
yes
k thanks
Wat does this mean? The image
It's telling you how to install the Library of Discord.JS
d.js has installed, continue
read the guide
hey how do I store the ouath2 session of my user so that when they open my website back they are logged in automatically
create a cookie
Ye but the thing is I don't know what to store in it xd, I'm kinda new when it comes to oauth2
is it the oauth2_state, oauth2_token or what
oh well i guess im trying too hard lmao
ye but it didn't really say anything about storing a session but nvm imma just do what tim said
import session from flask and just session['oauth2_token'] = token 
doesnt work for me 
whats not working
It still asks for authorization when i relaunch the website
I store credentials in my db
mmm imma just read mee6 source
Cookies seem to be the easiest way to do things with oauth
Storing in a database seems a bit unneeded
well cookies are limited
@earnest phoenix I mean like I store the name, id, and tag so I don't need to readd to my db

That's kinda weird too
Just store the id, and fetch the user when you need their info
hey yeah... im currently improving my python skills and would like to programm a discord bot in python.
right now, im adding my bot.
so: Whats the Bot Prefix? where is it used/displayed?
can someone give me an example?

hey yeah... im currently improving my python skills and would like to programm a discord bot in python.
right now, im adding my bot
so: Whats a variable? how do I use one? (i havent a clue about programming)
can somebody spoonfeed me?
sure man
tfw i dont even use python
but its probably
prefix = "autism"
and it work
ez clap
python hella gay btw
the bot prefix is literally just what comes before a command xP
for some reason. I can't install firebase. and only firebase. its wierd.
it also gives the same error on blank projects, lul.

https://hastebin.com/ejujemokij.js
https://gyazo.com/a7ae33b3ec84d6cbc5c8721ee77c0126
And if i restart the bot
works
if (!lng[message.guild.id]) {
lng[message.guild.id] = {
lng: 'en'
}
} else {
lng[message.guild.id] = { lng: `${args[1]}` };
}```
it only updates if it already exists. if it doesnt exist it resets to "en" and doesnt update
ok
and if u need the setup source is [ https://hastebin.com/onizumequy.js ]
this is the index where the prefix is set [ https://hastebin.com/awaguqiliz.js ]
P. S. [ if i restart the bot , it will work ]
like the prefix is ok
{"501383981690781706":{"prefixes":"="}}
is set but does not work
@quartz kindle
hmm
your prefix is being updated only in the update file, not in the main file
main file -> load prefix
update file -> load prefix again
update file -> change prefix
update file -> save prefix to file
your main file is never updated
your function has to somehow send the new prefix back to the main file
and what i need to delete?
@quartz kindle
if(!prefixes[message.guild.id]){
prefixes[message.guild.id] = {
prefixes: 't!'
};
}
bcause "i have this const prefix = prefixes[message.guild.id].prefixes; "
Why can't you just put something like this before your command handler
if (prefixes[message.guild.id]) prefix = prefixes[message.guild.id].prefixes
else prefix = "default prefix"
the problem is that he loads the prefix into memory in his main file
and his other files load the prefix again from file
the prefix in the main file remains untouched still in memory
and .....how i can fix it ๐
rip
like i don't understand what is the problem
all your files get the new prefix when they are executed
but your command files get executed every time a command is run
but your main file only gets executed once
oh
so you have to change your system
or move everything that needs a prefix to command files
so you have nothing that needs it in your main file
ok i will try
anyways, its not a good idea to read and write files that much
"so you have nothing that needs it in your main file"
So should I make an event handler?
@quartz kindle
Because I do not know how to do it
hmmm
what you could do
is remove the database files from all your commands
and have them only in your main file
and pass them through your command handler
also, move the entire settings update function into the main file
something like this
main file -> load all databases
main file -> update settings
main file -> handle commands
command file -> execute```
you have to resolve the prefix and language in the main file, before you send it to the command file
and your update settings command has to be inside the main file, not in a separate file
so it updates the settings that are in memory there
bot.on("message", function (message) {
try {
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
//=== [ No Bugs ] ===\\
if(!prefixes[message.guild.id]){
prefixes[message.guild.id] = {
prefixes: 't!'
};
}
if(!lng[message.guild.id]) {
lng[message.guild.id] = {
lng: 'en'
}
}
const prefix = prefixes[message.guild.id].prefixes;
//=== [ Ping Message ] ===\\
if(message.content === `<@${bot.user.id}>`|| message.content === `<@!${bot.user.id}>`) {
var embed = new Discord.RichEmbed()
.setTitle(`My prefix in this guild is \`${prefix}\``)
.setColor(config.bot.maincolor)
message.channel.send(embed).then(msg => { msg.delete(10000) })
}
//=== [ Main Feautures ] ===\\
var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
if (message.author.equals(bot.user)) return;
if (!message.content.startsWith(prefix)) return;
let cmd = args.shift().toLowerCase();
//=== [ Command Handler ] ===\\
try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
} catch(e) { console.log(e) }
});
move this
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));```
outside of the message event
ok
you only need to load the files once, not every time
bot.on("message", function (message) {
try {
//=== [ No Bugs ] ===\\
if(!prefixes[message.guild.id]){
prefixes[message.guild.id] = {
prefixes: 't!'
};
}
if(!lng[message.guild.id]) {
lng[message.guild.id] = {
lng: 'en'
}
}
const prefix = prefixes[message.guild.id].prefixes;
//=== [ Ping Message ] ===\\
if(message.content === `<@${bot.user.id}>`|| message.content === `<@!${bot.user.id}>`) {
var embed = new Discord.RichEmbed()
.setTitle(`My prefix in this guild is \`${prefix}\``)
.setColor(config.bot.maincolor)
message.channel.send(embed).then(msg => { msg.delete(10000) })
}
//=== [ Main Feautures ] ===\\
var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
if (message.author.equals(bot.user)) return;
if (!message.content.startsWith(prefix)) return;
let cmd = args.shift().toLowerCase();
//=== [ Command Handler ] ===\\
try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
} catch(e) { console.log(e) }
});
this
yes, you can check what is the current language, and pass the language to your command handler
commands.run(bot, message, args, language)
so your command files know what language it is
without loading the language file
first i need to define the language
const language = lng[message.guild.id].lng;```
done
yes
and your update settings functions need to be inside the main file
like your ping command
done
Main file =
commands.run(bot, message, args, language);
Inside the command =
exports.run = async (bot, message, args , language) => {
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
this
yes
instead of lng, you use language that you have in the command handler
and prefix you dont need
ok
and i need to remove this
if (!prefixes[message.guild.id]) {
prefixes[message.guild.id] = {
prefixes: 't!'
};
}
if (!lng[message.guild.id]) {
lng[message.guild.id] = {
lng: 'en'
}
}
from the command
yes
ok
and from the set prefix command i can delete this?
fs.writeFile("./assets/prefixes.json", JSON.stringify(prefixes), (err) => {
if (err) console.log(err)
});
fs.writeFile("./assets/languages.json", JSON.stringify(lng), (err) => {
if (err) console.log(err)
});
@quartz kindle
Hmm...I detect some dynamic JSON usage
no, you need that to save the settings if your bot restarts
but put it in the main file
what?
if(!prefixes[message.guild.id]){
prefixes[message.guild.id] = {
prefixes: 't!'
};
}
if(!lng[message.guild.id]) {
lng[message.guild.id] = {
lng: 'en'
}
}
const prefix = prefixes[message.guild.id].prefixes;
const language = lng[message.guild.id].lng;
//=== [ Main Feautures ] ===\\
var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
if (message.author.equals(bot.user)) return;
if (!message.content.startsWith(prefix)) return;
let cmd = args.shift().toLowerCase();
//=== [ Command Handler ] ===\\
try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args, language, prefix); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
fs.writeFile("./assets/prefixes.json", JSON.stringify(prefixes), (err) => {
if (err) console.log(err)
});
fs.writeFile("./assets/languages.json", JSON.stringify(lng), (err) => {
if (err) console.log(err)
});
not this?
nope
and the writeFile must be inside the code to change prefix
yes, that
the entire code
but it's a problem
fs.writeFile("./assets/prefixes.json", JSON.stringify(prefixes), (err) => {
if (err) console.log(err)
});
fs.writeFile("./assets/languages.json", JSON.stringify(lng), (err) => {
if (err) console.log(err)
});
to prefixes and lng i put language and prefix?
you put whatever you loaded using readFile
hmm
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
i need to put again this ? =))))
in the set command
const prefixes = readFile(etc...);
bot.on("message")
if(command for changing prefix) {
check if prefix is valid
prefixes[guild].prefixes = newprefix
fs.writeFile(prefixes)
}```
in the main file
yes
And yet I'm curious
after all, do I remove it from the set command?
ย ย ย ย ย ย ย ย fs.writeFile ("./ assets / prefixes.json", JSON.stringify (prefixes), (err) => { ย ย ย ย ย ย ย ย ย ย ย ย if (err) console.log (err) ย ย ย ย ย ย ย ย }); ย ย ย ย ย ย ย ย fs.writeFile ("./ assets / languages.json", JSON.stringify (lng), (err) => { ย ย ย ย ย ย ย ย ย ย ย ย if (err) console.log (err) ย ย ย ย ย ย ย ย });
remove it from everywhere, except the set command that is inside the main file
ok , i can't make a set command with a handler?
nope
you have to delete the set command file
and move the set function to the main file
because thats where the prefix is sitting in memory
@quartz kindle https://hastebin.com/huyopedexu.js
Please say "it's good"
Useful nodejs function for whoever wants itjavascript function mkdir(path) { let fullPath = "./"; path.split("/").forEach(folder => { if (folder !== ".") { if (!fs.existsSync(`${fullPath}${folder}`)) fs.mkdirSync(`${fullPath}${folder}`); fullPath += `${folder}/`; } }) }
what
and the fs.writeFile() looks incomplete, where is the rest of the code? utf-8, callback console.log
Why are there spaces in your path?
ok
and so you stop the function if message comes from a bot
before you start doing stuff
put it after you set prefix and language
and before the startswith
like this ?
https://hastebin.com/oyetijavoy.js
just , without
if (message.author.equals(bot.user)) return;
ok
including your own bot
if(isNaN(args[1])
works?
that will stop numbers yes. accepts only text
bc i want to put this to set prefix
you want to prevent numbers in the prefix?
either if(!isNaN(args[1])) return
or you can remove numbers with regex and continue
Is msg.author.equals(client.user) faster than msg.author.id === client.user.id?
strict comparison should always be faster than any function
Hello! My bots gives out this error when I use command suggestion.
I require assistance
cannot read property tag of undefined
suggestion.js line 11
whatever is before tag is either wrong, empty or non-existent
I dont understand
you didnt change anything?
now
is it correct?
ohh
Either do message.author.tag or message.member.user.tag
console error : [TREVIL-CMD-ERROR] set not found. (from command handler)
and the source
https://hastebin.com/ofugodiqes.http
FUCK THIS SHIT
@quartz kindle
you dont check if a command exists
let commands = require(./Commands/${cmd}.js);
if you do prefix lalala it will look for lalala.js
hmm ... i can put
return;
}```
better do something else
when your bot starts, on the top of the file, where you do fs.readFile
yes
do fs.readdir
and save it in an array
so you know which commands exist in the commands folder
var dir = "./Commands"
fs.readdir(dir, (err, files) => {
}
wherever you want, just before .on("message")
once I have given my bot access to all the info it needs (it's 4 books of rpg traps), what else will it need before it's allowed on the botlist website?
I know it'll need to be online
use readdir to get an array
aaa I know i'm noob , how =)))
like ["command1.js","etc.js,"bla.js""]
and then do if(array.includes(cmd)) { command handler }
or if(!array.includes(cmd)) return
you can use const commandlist = fs.readdirSync("./commands")
but then the array has .js but cmd doesnt
sometime today, would it be alright if I try to invite my bot over to one of the 2 testing channels?
you have to apply in the website
if your bot is approved, then it will be added
then you can use the testing channels
ah, ok
if the bot is minimally functional, it will be accepted
at least one working command, that isnt ping or help
I have several
if(array.includes(`${cmd}.js`)) {
let cmd = args.shift().toLowerCase();
try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args, language, prefix); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
if(!array.includes(`${cmd}.js`)) return;
}
like this?
@quartz kindle
wot
- I advise against reading commands synchronous ly if you can avoid it
your catch block will catch everything including what happens to the command
you already have cmd = args.shift().toLowerCase(); before, no?
no
var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
if(message.author.bot) return;
if (!message.content.startsWith(prefix)) return;
let cmd = args.shift().toLowerCase();```
so remove it
array is the name of the array you created with readdir
that contains all the file names
thats the address of the folder
or
const commandlist = fs.readdirSync("./Commands")
ok
so commandlist.includes()
show your main file
why did you put your entire bot file inside the readdir callback? lmao
do it like this
//=== [ require files ] ===\\
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
let config = require('./assets/config.json');
let commandlist = fs.readdirSync("./Commands");
//=== [ Events ] ===\\```
and remove the other one you did
const commandlist = fs.readdirSync("./Commands") // <-- remove
const prefix = prefixes[message.guild.id].prefixes;
const language = lng[message.guild.id].lng;```
and
if(commandlist.includes(`${cmd}.js`)) {
try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args, language, prefix); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
if(!commandlist.includes(`${cmd}.js`)) return; // <-- remove this
}```
Or don't read commands synchronously
I tend to tell people, why do things synchronously and block the event loop, when you can use async
Kind of defeats the main idea of nodejs
๐คฆ
once its working, then we can move to fix it
same prob
@_@
y
If not, then you're making it very hard on him and you
Hmm...I'm not convinced.
๐คท I'm noob =)))
Scrolling up, there were some mistakes that were easily preventable...
try putting a console.log(commandlist,prefix,language)
here
//=== [ CMDS ] ===\\
if(message.content === `${prefix}set`) {```
before the if
lets see if everything is correct
//=== [ CMDS ] ===\
if(message.content === `${prefix}set`) {
console.log(commandlist,prefix,language)```
? =))
console.log(commandlist,prefix,language) if(message.content
i don't think
console.log(if
[ 'setup.js' ] 't!' 'en'
@quartz kindle
looks correct
ik
and if you do t!set nothing happens?
yes
it's broken i think
it's because the command it's broken
if(message.content === `${prefix}set1`) {
message.reply('coaie');
}
and reply the message
Why you use messagecontent :/
idk
is dis java OwO
=)))
the reply works?
yes
try console.log(args)
in the same place as the reply
see if the args are correct
something inside the command is broken
yeah
the prob is args i think
[ 'set' ]
same
what's the wrong
var args =
message.content.substring(prefix.length).split(" ")
or
message.content.split(" ").slice(1);```
the second option is better i think
lol
//=== [ Command Handler ] ===\\ let cmd = args.shift().toLowerCase();
TypeError: Cannot read property 'toLowerCase' of undefined
@quartz kindle it's because i changed the args?
yes
if you do message.content.shift()
you dont need to do args
shift() modifies the original
where ? to if(message.content === ${prefix}set) {
better do like this
cmd = message.content.split(" ").slice(0,1);```
but cmd contains the prefix as well
so you can do cmd = message.content.split(" ").slice(0,1).slice(prefix.length);
wait no
cmd = message.content.split(" ").slice(0,1).join("").slice(prefix.length);
lmao
im getting tired lul
i should get paid for this lmao
oh yea
Lol
and inside the command
It does not work like that, but let it do something else, separate
cmds is message.content.split(" ").slice(1) ?
var cmds = message.content.split(" ").slice(0,1).join("").slice(prefix.length);
let cmd = args.shift().toLowerCase();
the thing is
slice doesnt modify the original
shift does
for example
array = [a,c,b,d];
array.slice(1) // [b,c,d]
array.slice(0,1) // [a]
console.log(array) // [a,b,c,d] not changed
array.shift() // [a]
console.log(array) // [b,c,d] shift removed a from the original```
and this is wrong message.content.split(" ").slice(0,1).join("").slice(prefix.length);
so when you do args.shift() you're deleting the 1st item from args
that one uses slice, not shift, so it doesnt delete the original
no
just delete everything
and start from message.content
and do what i said
args = message.content.split(" ").slice(1);
cmd = message.content.split(" ").slice(0,1).join("").slice(prefix.length);
args go to the set command
cmd goes to command handler
if your command is t!set % for example
args = ["%"]
cmd = "set"
I assume that a Java.gitignore template would also work for javascript
try running cmd as admin
think you,re missing gyp
do non-cert bots get full html access in long description?
alright cool thanks
is there any way that i can get the information about a server in another shard without using broadcasteval?
whats that
internal sharding is on d.js master and it treats all shards as one
im using d.js master's sharding manager
well im just trying to make something to check if the bot is in a guild
I heard shard 0 is the main shard that works with all other shards
shard 0 gets all the dms I thought
I don't think shard 0 has all the data though
This is kind of a dumb question but how do you add clickable text like โsupport server | invite | voteโ with all being clickable with different links
Lib d.js
[Support Server](https://dis.gg/xxx) | [Invite](https://d.app/xxx) | [Vote](https://d.org/bot/xxx)
Alright
@steel heath just broadcast eval getting the guild
one will return null, the other wont
you will only be able to get the guild if your in it
Something like the footer part?
no u need quotes around it
ik but when i try that with EJS it keeps logging memory leak warnings of message event
.setFooter(โSupport Serverโ) this doesnโt work either or do the quotes need to be on the out side of the brackets?
Around the whole thing
@steel heath what does ejs have to do with this?
i am trying to build up a dashboard with it 
Markdown isn't supported in the footer
Iโm so dumb ๐
ejs doesn't have anything to do with getting guilds ๐
well i was trying to broadcasteval inside it
Well, dont. Lol
fw = await ctx.send("The following users are in the blacklist:")
for people in bl:
if people == "Def": continue
peopler = client.get_user(people)
people1t = peopler.discriminator
people1n = peopler.name
ee = f"{fw.content}\n{people1n}#{people1t}"
if people == len(bl) + 1 and not len(bl) == 1:
fw.edit(content=ee)
if fw.content == "The following users are in the blacklist:":
await fw.edit(content="No users are in the blacklist. **WOW!**") #runs, even if there are people
return```
then how do i fetch all guilds, render it inside to the file and check if the guild exist
Soo, .addField(โSupport Serverโ) also doesnโt work, can anyone just give me a example please, I donโt use mark down that much.
Maybe you should Google it ๐
You're on the right track, just not there completely
This is what I found
Update to latest master so you can use internal sharding and don't need to use broadcast eval
how do i use that
This is only available if you install the latest master branch
npm i discord.js/discordjs
If you are not on the correct version, you will get an error about an invalid option.
// Internally sharding automatically
const Discord = require('discord.js');
const client = new Discord.Client({ shardCount: 'auto' });
// Interally sharding with specific shards
const Discord = require('discord.js');
const client = new Discord.Client({ shards: [0, 1] });
it fucks d.js-lavalink
lmao
SyntaxError: can't assign to operator
Reloading...
File "C:\Users\TeeHee\Desktop\UltraBot\bot.py", line 202
await ctx.send("Command list:{0} - {1}".format('\n'.join([cmd.qualified_name for cmd in client.commands]),''.join([cmd.brief for cmd+1 in client.commands])))
^
SyntaxError: can't assign to operator
but why
I still canโt figure out markdown with links
Iโve looked everywhere
That doesnโt work
what are you trying to do
@steel heath show your code.
i just dont want to show this yet cuz i dont think im going to figure it out but lol, this thing mustve worked imo:
and the ejs part:
Uhm
ah i need one more loop for broadcasteval
Also. In the loop, that condition will always return true
oops
Since the broadcastEval returns an array
Which is truthy in this scenario
@zenith moss bro. The answer is in that picture
yeah i just realised that too but whats the other ways
It doesn't work for me or I am just being dumb
You have the right idea, you're just missing it slightly
The picture literally tells you how to do it
Oh well
I'd use a for..of loop, that way you can actually take advantage of await. Second, I would filter the array for values that are truthy, and see if there is anything then.
So something like
Array.filter(arg => arg)[0]
?
I said for...of
And why are awaiting filter which is not a promise and is synchronous.
ah, wait, i need to learn how to use it
idk ew
for (let guild of req.user.guilds) {
const check = await client.shard.broadcastEval(`this.guilds.has('${guild.id}')`);
const filter = check.filter(c => c == true)[0];
if (filter) guildExist.push(g.id)
}``` umm
why not check.find(c => c == true)
sure
@zenith moss FYI in discord markdown links only work in embeds and webhook messages
I know
but cant webhooks send embeds
I am using it in a embed
ded
that code didnt work
just like i expected
wait
oh god
yay
really
@earnest phoenix thanks โฅ, it looks like it's working now: tyvm
also thanks @inner jewel for that suggestion thanks really
i was trying to build these 3 lines for couple hours
await Promise.all(req.user.guilds.map(guild =>
client.shard.broadcastEval(`this.guilds.has('${guild.id}')`)
.then(r=>r.find(c => c == true))
.then(r=>r ? guild.id : null)
)).filter(r => r !== null)```
this would allow running all evals in parallel
umm, thanks but how and where can i use that, like, do i replace the code up there ^ or...
that would return an array with the existing guild ids
~~can i get some examples
~~
Hey, how can I add my bot to the server of yours again I was using a code that anyone who votes on the bot would receive a thank you only that he started to do mass dm sorry for what happened
Code I used
message.author.send('Obrigado por votar ativei seu vip')
})```
**I fixed the bug**
you never use the voted value
I figured it out finally, thanks @earnest phoenix
@inner jewel what the heck?
await Promise.all(req.user.guilds.map(guild =>
client.shard.broadcastEval(`this.guilds.has('${guild.id}')`)
.then(r=>r.find(c => c == true))
.then(r=>r ? guild.id : null)
)).filter(r => r !== null)```
seems a bit more verbose, and not really needed
Any know the code to repeat the songs ?
that runs all the evals in parallel
instead of serially
for-of + await in the loop body will only start the next eval after the current one finishes
so im trying to add functionality to scrape discord issues and post them as they become available
ie, this
fun
It wont be accurate tbh
Discord status page lies
the only thing that doesn't is the ping 
right now im scraping https://discord.statuspage.io/history.json and https://discord.statuspage.io/incidents/<incident code>
the second one being more accurate

was wondering if anyone had a better idea than just running the whole thing through beautifulsoup and checking the "status code"
of course the json doesnt need to go through bs4
just throw me a ping ig ๐
^
and you'll get json back
json doesnt have the handy things im referring to as status codes
identified, update, resolved
they do not
thats the api not the current issue ๐คฆ
how sad
scraping will just get you banned
@placid flax the json does have it
also http://status.discordapp.com/incidents.json works well
Discord's Incident and Scheduled Maintenance History
how does that get me banned
shows the code in the incident array for the month
for one, this bot isnt on DBL, two, discord uses statuspage which is a third party error reporting company
look there
such hostility for a simple question
is this what you want
scraping wont do shit
yes thats what i want
then there
https://status.discordapp.com/index.json GET request to it
incidents arr
๐
the whole purpose of this was to post the incidents to a channel as they occur, not repeatedly scrape through all of the issues. tl;dr im too lazy to open status.discordapp.com and i want a bot to post it for me
unless bot gateway dies then rip
i dont see how thats bannable 
i wish discord update their status page more often
a lot of the incidents doesn't get recorded
@placid flax bannable as in, your IP will get blocked by statuspage :p
shrug, im just clarifying what they meant
got me all worried
can't you use webhooks?
possible
yeah lol
hey, I'm trying to set up webhooks for tracking votes, but I can't seem to get anything to happen - I made a webhook in a server of mine and copied the url into my bot's edit page but when i click either the test or save button nothing happens
thatd actually be better
dunno how to use webhooks for that tho since statuspage allows you to subscribe via json and shit but discord only has email notificatiosn enable-
wellp
nevermind
i spose i need to learn more about statuspage

thatll work thank
โค
idk why i can't seem to save or test the url i have for my webhook in my edit page
@sonic badge does the url have 0.0.0.0
It's just the URL generated when I create a webhook user in my server - I thought that's what I needed to copy
It doesn't have 0.0.0.0 anywhere in it
oh no
its not a discord webhook
you need to receive the post request in your webserver
if you use JS then dblapi.js can handle it for you
BTW go to #topgg-api
@languid dragon That helped, thank you.
Umm...
How do we go about adding modlogs? Like the ones in dyno?
what lang?
JS
Currently using djs
use the events
gross commando
My index will get cluttered
anyways
np
Lol
commando is not only gross, but slow
yes
One of the slowest frameworks you could ever choose
I've used my fair share of frameworks: until I came to a conclusion that I hated them all
i havent tried any
Not all because they were bad, just because of the lack of control I had when using them
i complain about things that reminds me of the old me
i like to do everything myself
when you use a command framework, you give up a lot of control
i remember why i moved to d.js
over how the nitty gritty things are handled
it can also be a pain in the ass to debug, because you have no idea what the framework is doing
is it bad that i moved to d.js without a framework only because i didn't know how to make a ban command in commando?
what
commando is d.js
yes i know
so what you said doesnt make sense.
darn
And uhm
i wanted to look "relatable" but now i look stupid
making a ban command is literally the same thing regardless of what framework you are using
look
maybe the arg parsing is different, but the core code for the ban is the same
i didn't know that in march
inb4 google makes a framework:
"ok google, ban user id"
Alexa, ban 419243569820336130
Siri, ban Alexa
ok google ban siri
cleverbot, ban google
bing, ban cleverbot
yandex/yahoo/duckduckgo/ask ban everyone to #shitpost
k cool
Hey guys, what version of Node should I install?
10.13.0 or 11.1.0
whichever you want
oki
hwo to remove this ugly line from dbot bot page
i dont mind having ads
but like the line is bad
f12 -> inspect with dev tools in browser -> find the class/id -> hide it with css 
but what IS it? i cant find it
throw err
^
Error: Could not locate the bindings file. Tried:
โ /rbd/pnpm-volume/91372360-a950-4a6f-9b0f-7167d6107039/node_modules/.registry.npmjs.org/better-sqlite3/4.2.0/node_modules/better-sqlite3/build/better_sqlite3.node```
how can i fix that
@bright spear i ll try
No it's not.
Sure it doesn't scale well enough to serve a discord bot on hundreds of thousands of guilds but it's good enough for most use cases below that, and saves you a ton of trouble figuring out how to run a full blown database service without losing or exposing data, how to keep it available, and how to back it up correctly.
anyone know how to fix this in bootstrap?
@sick cloud show code?
Can someone tell me how a basic antispam would work?
Do i store the values in an array?
you can do something like fetching last 5 messages and get total time interval
but doing that for every single user is quite expensive
you could set up a database that records message timestamps with auto-expire of like 5 seconds
and check if user has too many messages in the db
yeah you can do auto expire with setTimeout
Are they even using JavaScript?
no idea
.
I'm using Discord.js
I'd like to store several things somewhere, like prefixes
Hello
What are embeds?
embeds are the nice messages in the box
An int
.members - list
.member_count - int
k
:wesmart:
can someone do like a database 101
databases store data
they do? 






no dont. ur markup probably just wrong