#development
1 messages · Page 560 of 1
I dont just type it in because i want the bot to update this information as the site updates
now add them afterwards in a for loop.
for(whatever of whatevers)
embed.addfield('','');
Wait, hold up. I just got here. What your trying to do?
im trying to grab titles / links from a forum page and post it into a message
so as the titles/links change on the forums , they change when i run the command
@earnest phoenix you need to put the scraping code into the run function, so you can access the text and href field there ok?
Dont just request the data once then
but im a bot at coding so i rlly dont know what to do lol
let embed = new Discord.RichEmbed()
.setDescription("Rumble Fighter Announcements")
.setColor("#15f153");
$('.PreviewTooltip').each((i, el) => {
embed.addField('${text}','${href}')
});
thing is each topic is named text and href , so how could i get all 5 listed?
i dont understand
$('.PreviewTooltip').each((i, el) => {
embed.addField('${text}','${href}')
});
this is a loop
it adds multiple fields. one field is one heading+description
oh wow nice
this is the same loop you use for the console.log
image instead of console logging you add fields to your embed
as i said, the whole scraping function need to be in the run function, otherwise you cannot acces the $ object
some liek this
https://hastebin.com/cosaweboze.js
looks not bad
replace ' with `
right
.addField(name, value)?
Imma use what linc sent cuz i just messed something up
oo i put it in the wrong spot

oh wait looks like you did too , $ is still undefined
Can you show your code?
I forgot i was retarded
I cant help you is what im trying to say
The only reason id see for $ being undefined in that case is because the try/catch failed but im guessing you didnt get an error so i mean
Whatever, its 2 AM imma go to bed now
Gn
@earnest phoenix u still on?
yea wassup?
i did
also what are you trying to do?
$('.PreviewTooltip').each((i, el) => {``` ?
like cat food said , it was outside of the try/catch
i was trying to get titles and links from a forum page and send it into a message
are you sure u need $ instead of something else?
no this is exactly what i wanted
or u got it
basic but just want i wanted to accomplish for tonight, ill modify tomorrow xD
ok
Does anyone know how I could make a manual override function just for me? Maybe something like if(message.member.hasPermission(‘ADMINISTRATOR’) || {what do I put here(I have a let function that has my I’d named owner)} ?
Xignotic
if(message.author.id !== OWNER.ID) {
if(message.member.hasPermission('ADMINISTRATOR'){
}
}
but then if it is
So if it doesn't equal you it will check for the author has admin
Actually is terrible
XD
if(message.author.id !== OWNER.ID && !message.member.hasPermission("ADMINISTRATOR")) {
channel.send("No perms")
} else {
// Has perms
}```
would that really work tho?
It should

lmao I didn't update heroku in 4 months 😂
module.exports.help = {
name: 'help',
aliases: ['commands']
};
How i can add here a permision section?
@chrome olive message.member.hasPermission ?
oh ok
Is there a way to hide a link into a piece of text ?
markdown?
a tag with same style as regular text?
Is it possible to do a markdown on a web scrape generated loop message?
what
😂😂
Uhm yes?
what in the engl8sh w0rld
Breh it makes sense if you understand what I'm talking about lol
But alright I just wanted to know if it was possible
Just style the a tags i think
You started with a generic question of hiding a link into a piece of text w/o context
This is Discord, so I assumed you are talking about markdown
Then the web scraped generated loop message, I have no idea
where the punctuation at
Isn't it against discord's ToS to allow users to have timed api calls like say Rainbow roles or Changing bot presence?
Because @jaunty lake does something similar. Sending an API call every minute to change the name of a voice channel
So it isn't bannable?
Where can i report it?
idk, send an email to discord, or whatever, if it bothers you that much
:+1:
lil snitch lul
I wouldn't really care if the rainbow role was every 24 hours or so
Wait changing presence is against tos?
no
Yeah but every 30 seconds?
@steel oak
fake rythm xd
@spice wren
abusing the api is against the TOS, which means any form of excessive calls to the api
We have rate limits for a reason 
yes
in general, bots should only do something when responding to commands, they should not do something in time intervals without user input
specially if the time interval is very low
Yeah
it can be used to achieve interesting experimental features, but should not be used in large scale public bots
so 30 seconds is good?
What is usually done when you need another permission for a new feature, but your bot is already installed on servers? send error messages on feature use, telling them they should reinvite the bot to use that feature?
is it bad practice, will people be frowned upon when simply asking for admin or majority of roles (even tough they are not needed in the current state of the bot)?
@earnest phoenix
"web scraped generated loop message" could have also just said embed 😏
But its not sending a message or doing anything, its just switching its presence
Which users can also do very quickly
Where this error?
<?php
$output = "shell_exec('node simple/bot.js')";
if ($output === "Logged!") {
header (Location: http://smookywizard.net.ru/bot/started.html);
exit();
} else {
header (Location: http://smookywizard.net.ru/bot/fail.html);
exit();
};
?>
when I do a command, whatever aliases i have, will work on the previous command used? eg I run the command 8ball, then i use the alias botinfo, and it will run the 8ball command when i type botinfo? https://hastebin.com/kafufiyeru.js (msg event) https://hastebin.com/cimudalelu.js (index)
handled nvm
@zinc pawn check all your variables. sounds like you have a problem of not-declared, duplicate names, wrong scopes, wrong type(const let)
Hey, I got an error.
I have no idea on how to fix this right now.
HTTPSConnectionPool(host='link', port=443): Max retries exceeded with url: /sublink/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Some info:
Python: 3.7.1 64 bit
The website it certification states this:
idk if it has something to do with it.
But I think its on my side.
help
masterhacker
My above error got fixed.
How I fixed it:
Reinstalled Python- lol I had the 32 bit but my pc is 64 bit 🤦
does anyone know typescript ?
@earnest phoenix what are you trying to do? you're creating a string, not actually executing anything
Who can help me ? i want delete the "look screen for this" in my page of discordbot.org
@lofty hamlet css <style> .shapes-background { display:none; } </style>
in your bot's long descriptions
@uneven laurel what language & library
Thanks @idle mountain
npnp
client.users.size
but if you want only people with "online" status, then its more complicated
you need to loop over all users, and check their presence
are there SQL-like functions in js?
in C# we can do myCollection.Where(x => x.boolThatIsTrue)
and it'll filter out anything where boolThatIsTrue isn't true
array.filter(predicate).map(thing)
etc
check the methods on Array
the equivalent to that would be filter
well TIL, and Robin you can use that, bc it's neater in your code (and is probably faster?) ^
@idle mountain ?
How can I find the names of things to edit?
ex :.shapes-background {
Depends on the browser, on Chrome you right click > Inspect
on other browsers it's similar
a for loop would be the fastest way to get the count
it'll bring up a neat menu of all the items, just search around until it highlights the thing you want, then copy its class name and then put a dot in front of it in the css, ie if you wanted to edit a div with the name "mydiv", do css .mydiv { /*something here*/ }
if that's what you're asking
I'm not entirely sure
filtering (aka creating a new collection) is a bad way of counting
reduce would be better for that
ah
wonder why 
I suggest, Nebulus, that you learn CSS if you don't already, w3schools has some good tutorials on it
reduce can do it without copying
it's not that hard, you can understand all the basics in like 10 minutes
@inner jewel oh wow that's hot
https://pastebin.com/ubkRWb0u connection.play , connection isnt a function
how can i fix it?
If I get my bot to remove roles, but the person does not have they role, will it throw errors?
dont ghost mention random members @sturdy delta
Something dorky: I didn’t mean to, he’s a happy to help on another server, and I just copied and pasted and forgot to remove the ping
@sturdy delta yes it will
Whenever that happens i just use a try and catch and do nothing with the error as it is expected

i bet you 50% of js devs do that in here
Whats the point of handling the error when you know the cause? I mean i guess you could send "User doesn't have the role specified"
I guess you could use an if to see if they have it, but thats more work
or just handle the error since a "fix" would just detect the error before it attempts it
How do I do a bot user count?
My code right now is
bot.users.size and that just produces a number that keeps rising. I have guessed my bot has around 40k users but it’s only showing 16k? Anyone that may be able to help me?
Ah ok
const Discord = require('discord.js');
const database = require('../database');
module.exports.run = async (bot, message, args) => {
let abc = message.mentions.users.first()
database.Users.findOne({
"_id": message.author.id
}, function (erro, documento) {
if(documento){
let enbed = new Discord.RichEmbed()
.setColor('#FF0000')
.setDescription(`${abc}, aceita se casar com ${message.author}?`)
message.reply(enbed).then(msg => {
msg.react('530808552575467538')
msg.react('530808552575467528')
const sim = (reaction, user) => reaction.emoji.id === '530808552575467538' && abc.id === abc.id;
const sim2 = msg.createReactionCollector(sim, { time: 60000 });
const nao = (reaction, user) => reaction.emoji.id === '530808552575467528' && abc.id === abc.id;
const nao2 = msg.createReactionCollector(nao, { time: 60000 });
sim2.on("collect", async r => {
let embed = new Discord.RichEmbed()
.setColor('BLUE')
.setThumbnail(abc.avatarURL)
.setDescription(`${abc} e ${message.author} se casaram! 🙂`)
message.channel.send(embed)
documento.casado = true
documento.save()
})
nao2.on("collect", async r => {
let embed = new Discord.RichEmbed()
.setColor('RED')
.setThumbnail(abc.avatarURL)
.setDescription(`${abc} e ${message.author} não casaram! :eita:`)
message.channel.send(embed)
documento.casado = false
documento.save()
})
})}})
var pessoa = new database.Users({
_id: message.author.id,
level: 0,
xp: 0,
coins: 0,
rep: 0,
})
}
Help pls
you dont need two reaction collectors lol
also, there is nothing ending them, they will keep running for 60 seconds and will keep replying to the reactions
I get the Authorization header right, but the body of the post request is empty
How will collect X and V
nvm, im dumb
https://pastebin.com/y3c05pE3 How can I change this from searching a URL to searching URL and key terms?
think i got it tbh
Alright.
@empty axle js collector.on('collect', r => { if(r.emoji.id === "emoji id") { // something collector.stop() } else if(r.emoji.id === "other emoji id") { // something else collector.stop() } });
or you can use awaitReactions
ok
So I read a lot about say commands being a risk because of messages being reported 🤔
Would having the messages signed by the user make a difference?
So tag commands have the same risk?
if you add something like command executed by XYZ#1234 it may help you avoid a ban
may
discord t&s has a big history of stupid bans
ive never heard of bots being reported for say commands
pretty much every multipurpose bot has a say command
i've had a friend banned because of say commands
¯_(ツ)_/¯
user: <prefix>say gorelink
bot: gorelink
user: deletes message
user: reports bot
I feel like this is a stupid simple mistake but does anyone here have any idea why fil gives the correct list of message maps but prevMsg gives Promise { <pending> }?
Im using NodeJS because I was naive when starting out (i still am but slightly less) and it's too late to go back
//get previous message
async function lastMsg() {
//fetch channel's past 10 messages
var msgs = await msg.channel.fetchMessages({ limit: 10 })
//remove messages not by the author
var fil = msgs.filter(lsMsg => lsMsg.author.id != msg.author.id)
//log the messages (development only)
console.log(fil)
//return the messages
return fil
}
//fetch last messages
var prevMsg = lastMsg()
//log last messages (SHOULD be the same as before)
console.log(prevMsg)
I understand that the issue is to do with mixing async and sync but I'm using a function so I thought it would wait.
async function lastMsg() {
return new Promise(function(resolve, reject) {
var msgs = await msg.channel.fetchMessages({ limit: 10 });
var fil = msgs.filter(lsMsg => lsMsg.author.id != msg.author.id);
console.log(fil);
resolve(fil);
});
}
var prevMsg = await lastMsg();
console.log(prevMsg);```
Haven't tested it
but I think it'll work
@deft kestrel
@deft kestrel It's because an async function returns a promise. You should await or call .then(...) on that promise
Async functions are just a syntactic wrapper on top of promises
It's pending because the function executes asyncronously
The function immediately returns a promise, which is resolved later once it's fetched the messages
But fetching the messages is a different promise
and the first promise waits on the second one
A pending promise is just a promise that hasn't completed yet, and it'll call a callback you pass it using .then(...).
how do i get it into synchronous
You can't, that's a limitation of how nodejs works
because both you & Kie are thinking it's all async
the thing is i did something like this before cross-file
I don't know how async works n stuff I just used it once and thought I could help lol
it just wont work here
It's impossible to go sync, because if it's sync the promise will never resolve because it's being blocked by your sync code
okay well thanks for killing this conversation, and thank you Kie for at least trying
There is one way to do it, but it's fairly bad practice
Wait what are you trying to do?
He's trying to call an async function synchronously

Was that his question?
He was asking why he was getting a Promise { pending } instead of a value from his async function
then asked how to just get the value explicitly syncronously
js 100
congratulations, you just met the colored function problem
The problem is that it's literally impossible because nodejs is singlethreaded and sync code will block the event loop, thus preventing the promise from ever resolving
Isnt he just trying to get the previous message?
await is just sugar for CPS
aka it becomes .then()
it's not sync
just looks like it's sync
I just got 2000 messages tho, so I dont see why he couldnt get 1?
ok so um i have no idea how rethink works and one of my devs told me this is how to get a value other then the base thingy (id) and so I did this db.table('user_stats').getAll({username: req.query.username}).run().then(data=> etc. but this doesn't work, any idea how this works?
He's trying to grab data from an external api syncronously
it breaks the function and puts whatever is after the await into a callback
not from cached messages
There was a node module I'm trying to find which allowed you to jump between stack frames and thus execute async code "syncronously"
but I can't remember what it was called
also that's still async
that's a dangerous idea
because you're awaiting a promise
Yeah I would never use it in production
but it's super nifty
what have i created
that's what go does
it uses green threads for concurrency
once they hit IO, they're swapped out
found it
Non-blocking sync code
though it has to be wrapped inside a fiber, you can't just arbitrarily jump around
so depending on your needs you may not be able to get into a fiber
since fiber execution is async, it's just that once you're inside the fiber you can execute async code syncronously
async/await is almost always a better option though
yep
I tried using it as part of a sandboxed server administration eval bot awhile back (so it would run user code with what looks like a sync api), it worked out pretty well
had seperate protections for infinite loops though
How could I assign something a default value?
like mute time
if a mutetime is not provided
it assigns it a default one
use ||
as in var mutetime = value || 60
so if value is falsey (0 or NaN) it gets set to 60
Can't use that
wait what language are you using
I have to define the default another way
I got it though
ima do
let mutetime = args[2]
if(!mutetime) mutetime = 300000, msg.channel.send('You didn't supply a time so a default of 5m was assigned')
I think that will work
although that check I think is a bit wrong
What values could it be? You might want to Number.parseInt(...)
let mutetime = Number.parseInt(args[2]);
if (!mutetime) {
mutetime = 5 * 60 * 1000;
msg.channel.send("Mute time defaulted to 5 minutes")
}```
If it ends up being a non-number value (e.g. "foo") you'll get NaN, which is falsey and would thus trigger the default
0 would also trigger it
may want to check for negative numbers as well
let mutetime = parseInt(args[2]) || 300000 is just shorthand for let mutetime = parseInt(args[2]) if(!mutetime) mutetime = 300000
and Number.parseInt is the same as parseInt isnt it?
I prefer the latter just because it's more obvious what scope it's coming from
even though it exists in both
Does anyone know how to make an !apply command. Like someone does that, they get a Dm with 10 or so questions in an embed, then it gets their Answers, puts it into an embed and then sends it to a channel named applications
Is there a way to make the bot check if the person invoking the command is "Active on Mobile" or not?
(Discord.NET)
Isnt the mobile thing relatively new?
It may come in the future if it is
@sturdy delta this is possible yes. You will want to awaitMessages (d.js, there are also other ways to do it, if you dont want to use this) also, make sure the bot can dm them by using a try/catch for the first message and if it doesnt go through, then tell the user to allow dms to apply
Can someone help me out a bit with this https://pastebin.com/ZsQz2ijv
there isnt one
Im trying to figure out how to post the embed with info , then have the link sent to the 2nd half of the command which makes the bot join the voice channel and play what ever the link is
Is there any reason these are in seperate module.exports.runs
no reason , im just bad at coding lol
i couldnt get it all to fit under 1 without errors
I just was asking why its in there and not a function itself
Anyeays, does it get the result you want, the link i mean
the command literally does nothing but make my bot join the vc...
oh and when it joins the vc it says.. "sorry alrdy in a voice channel" lmao
but yea , thats all i know o-o
Then its probably a good idea to diagnose the issue 
I wish i could assist more, but i must go to bed now
I hope someone else can help you tho
is arg an array? python rewrite
I think it is
but just wanted to be sure
Also any suggestions on how to make a Logging channel cmd in python rewrite
@lusty dew do you mean *args?
If its a function you'rr trying to execute maybe help(function) could help you.
👍
Usually when you get an error like this
It is something before you use get
Show code plz
hastebin broken
I see it now
i know :/
@earnest phoenix why are you passing ops through module.exports if you have ops defined?
Traceback (most recent call last):
File "C:\Users\MHRO~1\AppData\Local\Temp\tmpt58muklupycharm-management\pip-10.0.1\setup.py", line 6, in <module>
from setuptools import setup, find_packages
ModuleNotFoundError: No module named 'setuptools'
how can i fix that problem
by the way i am trying to install packgaging tools
Thank you much
hello i want make move log with dbm how can i make ?,
Ask in the DBM servers
dbm wew
great, my bot is writing too fast to redis and it crashed
does anybody know how to make a spam filter
like if someone starts sending messages rapidly it gives them a local slowmode or something?
let cmdnr = colection.help.colection;
let cmds = [];
cmdnr.forEach(name => {
if(name.help.category === info)
{
cmds.push(name.help.name);
}
});
return '\`'+cmds.join('\`, \`')+'\`';
this can work???

good day,
when i broadcastEval and receive back an array of values, can i assume this array is sorted by shardid? first result is from shard with id 0 and last result from shard with max id? can i also assume there are no gaps in between shardids?
yes
okey so if i need a shard with a certain guild on it, i can address it by its position in the result of the broadcastEval(hasGuild(id))?
yep
What would happen if a shard were offline tho 
It wouldn't be online.
they reconnect automatically
u can set the retry limit and such and
i dont know how or why but you still can get information from offline shard
you can get the shard a guild belongs with some math
shard_id = (guild_id / Math.pow(2, 22)) % shard_count```
hey I have a question so I'm using mysql and I have a row with value: id, id, id
Now I split them so I got [ 'id', 'id', 'id']
Now how would I get the tags of these id's because if I would do client.users.get(id) it wont work
<@{ID}>
it's an array too
No it's I want to get the tags from the 3 id's in the array
map over them
so you want to get an array of 3 tags?
Yes
use .map()
That's the problem I've read like 3 documents watcged a video and I still don't get how mapping works
if you just want to mention there's no need to get the user object
just build the mention yourself
array.map(t => client.users.get(t).tag)
No I went the tag not the mention
or something like that
oh
tag = user#0001
Tag is name#discriminator
basically
literally just forEach over it
let array = ["id","id","id"];
array.map(item => do something with item and return it back to the array)
// map copies the array and then does operations to each item before returning it```
[1,2,3].map(t => t + 1) // [2,3,4]```
let [tag1, tag2, tag3] = array.map(...) :^)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-opus@0.3.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-opus@0.3.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
its been literally forever since i've seen this error
like what's up
i have build tools installed tho
anyone know whats wrong with this nginx config?
listen 443;
server_name play.jt3ch.net
location / {
proxy_pass "https://127.0.0.1:443";
}
}```
it just says nginx: [emerg] unknown directive "censorbot_panel" in c:\nginx-1.15.8/conf/nginx.conf:1
you're not supposed to rename server
nginx: [emerg] "server" directive is not allowed here in c:\nginx-1.15.8/conf/nginx.conf:1
you're using the wrong config file
i dont have a sites-available folder tho
conf-contrib-docs-html-logs-temp
nvm
you can use a server config inside the main nginx.conf if you put it inside an http block
server {
location
etc
}
}```
aah
alright thanks
wait still problem lol
i put it in the http block
or do i put it in server?
nvrm im dumb
works now?
yea
👍
i think™
xD
check how to install lzma-native on windows
you're probably missing a dependency or something
does anyone have a good meme generator similar to http://aws.random.cat/meow?
For?
He probably wants it to get a meme, idk
Why is that last console.log() undefined?
let mUser = message.mentions.members.first()
let mGame = mUser.presence.game
if (mGame.name === 'Spotify') {
console.log(mGame.assets);
console.log(mGame.assets.RichPresenceAssets);
}
// Output:
// RichPresenceAssets {
// largeText: '2002',
// smallText: null,
// largeImage: 'spotify:2c4c4fe5a1216866373548a755d787da23daeec6',
// smallImage: null }
// undefined
What is assets?
because there's no RichPresenceAssets property
assets is this output
// RichPresenceAssets {
// largeText: '2002',
// smallText: null,
// largeImage: 'spotify:2c4c4fe5a1216866373548a755d787da23daeec6',
// smallImage: null }
So what to do to get largeImage from
Game {
name: 'Spotify',
type: 2,
url: null,
details: 'Promises (with Sam Smith)',
state: 'Calvin Harris; Sam Smith; Jessie Reyez',
applicationID: null,
timestamps:
{ start: 2019-01-25T19:58:17.089Z,
end: 2019-01-25T20:01:50.398Z },
party: { id: 'spotify:365162284655443978' },
assets:
RichPresenceAssets {
largeText: 'Promises (with Sam Smith)',
smallText: null,
largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
smallImage: null },
syncID: '5N5k9nd479b1xpDZ4usjrg',
_flags: 48 }
RichPresenceAssets {
largeText: 'Promises (with Sam Smith)',
smallText: null,
largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
smallImage: null }
highest iq I have seen
server {
listen 443 ssl;
server_name play.jt3ch.net;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
proxy_pass "http://127.0.0.1:2001";
}
}
server {
listen 443 ssl;
server_name img.jt3ch.net;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
proxy_pass "http://127.0.0.1:8074";
}
}
server {
listen 443 ssl;
server_name nginx.jt3ch.net;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
proxy_pass "http://127.0.0.1:1002";
}
}
server {
listen 443 ssl;
server_name test.jt3ch.net;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
proxy_pass "http://127.0.0.1:3000";
}
}
server {
auth_basic "Administrator's Area";
auth_basic_user_file .htpasswd;
listen 443 ssl;
server_name db.jt3ch.net;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
proxy_pass "http://127.0.0.1:4352";
}
}``` whats wrong with this
everything works except for test.jt3ch.net
with then redirects to port 2001
as if it was play.
even when i make /test return req.headers it says its host is 127.0.0.1:2001
How i can searsh in array ex : ?searsh Ar
And the bot send all the array start with "Ar"
array.filter()
🤔
Thanks
@slim heart all others work? i dont see anything wrong with the config file
is there anything running on port 3000 that might redirect or something?
or maybe dns configuration?
ill try changing the port really quick see if anything changes
nope
even changing the port it still redirects
for no reason
check dns maybe?
for some reason i had to go all the way to god damn task manager and quit it
lmao


speaking of load balancing
was looking into google's load balancer service, so I can redistribute to my other nodes
looks expensive 
fonction.channellogs(message)
let xoargs = message.content.split(" ").slice(1);
let xo03 = xoargs.join(" ")
if (!xo03) return message.reply("Erreur :Croix: : `Entrez minimum une lettre à rechercher comme mot clé dans votre PC`")
const filterItems = (query) => {
return Dresseur.Sac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1);
};
message.channel.send(filterItems(xo03))
}```
How i can if the message of the bot content 2.000 caracters the bot send 2 messages
ok its still being really dumb for whatever reason when i completely remove the test.jt3ch.net block it still connects to the same thing sks
@lofty hamlet js .send(message,{split:true})
or {split:{splitoptions}}
i completely shutdown nginx and all their forwards still work ok wtf is happening
@quartz kindle any idea
im using cloudflare yea-
but like the entire api side of it is still working
wait no its not!
you're on windows right?
also yes
process
i just checked if it was a service
and no
hold on im purging the cloudflare cache
so yeah, i guess cloudflare caching is fucking it up
they have a page that tells you what features you should disable when running an api
where
You want your API to have enhanced performance and protection without blocking or breaking any legitimate traffic. Configuring Cloudflare using page rules can ensure your API reaps all the benefits...
ok thats even weirder, when i use my sharex host it even still picks up new images meaning its as if even tho its not cached its still making requests
.setColor(embedcolor)
.addField("Pokémons contenant : " + xo03, filterItems(xo03), { split: { maxLength: 100 }})
.setFooter(client.user.username + " - by Nebulus")
.setTimestamp()
message.channel.send(embed)```
And error max caracter
RangeError: RichEmbed field values may not exceed 1024 characters.
But message.channel.send(filterItems(xo03), { split: { maxLength: 2000 } }) work
im gonna go eat dinner if its not fixed by then by whatever cloudflare magic im gonna ping u and we can figure it out ok tim
@quartz kindle just for finish and i goin my bed i can detect if my message is empty ?
i try this but is not work
How do i fix it
can you link me to your bot on DBL website?
Idk what website that is
ok one sec
fix what
My bots responding to other bots
Yea
ok one sec
(i just fixed this for my own bot yesterday and it just got unmuted here like 3 mins ago for that xd)
What does the encoding property do with fs.writeFileSync?
wilfmaster, put this somewhere in your code
@bot.check_once
def is_user(ctx):
return not(ctx.author.bot)
Ok
every command that's called will go through that
Ummm im using client not bot
one sec
then replace it
Client and bot is two different things
how did you define your discord.Client
oh no
client = discord.Client
is not equal to
bot = commands.Bot()
I can use both but they write over the cmds
holy shit
I still used client = commands.Bot()
listen here
it works fine
you can set discord.Client to anything you want
ok
you can set anything to commands.Bot also
^
if he has it as client just replace bot in the code with client
wildmaster, can you send the code where you declare your client
not that hard
yes
Not very well
define your bot as thispieceoffuckingshitiworkon
ok you can help him
wildmaster just replace bot with client
Ok i added the code but idk if it worked
test it out?
Its muted
How?
.
run a command
Ok
I can't help this kid if he doesn't know how to run a cmd
It didnt work
havent used python in a while 
The cmds wont run
yeah ig he's not using rewrite
probably not
Samurai posted something?
oof just saw what he posted xD
Discord is taking a while to load things
Also with fs.writeFileSync
what does the encoding property do?
the encoding used for the data
how can i make an express server mask itself with a different express server (lol)
what
like i have an express server right and then i can do something like app.use( qhniuoqhdiqwn whatever, then point it to 192.168.0.69
@prime oriole since you don't use rewrite, you use the on_message event to direct the code to commands, right?
if msg is your message object
Ye
Yes
ok then do what samurai said
?
at the start of the method
if [message].author.bot:
return
replace [message] with whatever your argument variable name is
Wdym?
Yea
can i dm you
Yea
@slim heart like a redirect?
no kinda like a map
let code = Math.random().toString(36)
if (err){
let file = fs.writeFileSync(`${code}.txt`, err.stack)
msg.guild.channels.get('538529927352287235').send(file)
}
Is this how i'd write an error to a file and send the file to a specific channel?
like its pointing to my other computer but want is that it redirects if it's actually there but since its a testing point i want it to say that its not open if its not
like, you want to check if the server is reachable/working?
yes and then if it is working then it uses that point
you can use nginx for that
h ow
i have it on mine brb
alright, thanks
no
ur sending the contents of that file to a channel
wait no
huuuuh
whatre ya doin
No, writeFileSync returns undefined
@slim heart ```nginx
error_page 500 502 503 504 =200 @error;
location @error {
default_type application/json;
return 200 '{"status":"ERROR", "error": "temporarily unavailable"}';
}
that's is my nginx config file
or, if too big, you don't need to write to disk to send a file
oh alright so if it gets error 500-504(-501) it uses location @ Error?
and so does the person I am making the bot for
they also want me to write the error to a file
do i put that above or below location /
anywhere i guess, i have it above
which version of discord.py is this
Client.command()
async def help():
await client.say("msg")
its doing the same thing tim
maybe the error codes arent right? im trying to fetch it to see what the code may be but im not getting anything lol
here i get error 500 when node is not running
it works fine for me, like instantly
i think its just waiting for the bad response
do you get error 500 if you try to proxy it to a non-existing port?
in the browser
it still does its thing where it takes forever
and then doesnt even give me a response cuz cors
isn't arg in discord.py rewrite an array ?
oh wait proxy nginx shit yea
tim like it works itll eventually do it but it just like takes forever to load
Well its not *
*args would be in the argument call
you might want to also get the number out of it
I know discord.py rewrite has this property arg
k
tfw ur working on a bot list
I don't think you're allowed to ask questions about another botlist here
ur not
try catch is a language feature, not library
I got in trouble doing that before
pretty sure almost all languages have a try catch
py has one
try
pass
except e as Exception
pass```
Ye
^
Thanks
quick google search but no biggie
I didn't know if try and except was correct
I did google search it
but I didn't know if try and except was correct
just google "try catch in languagehere"
Hey so I was just wondering if you have any helpful sites or videos that would help me understand how to edit a message / embed using a bot.
All Im finding is how to edit a message within the code so message.channel.send(embed).then(e => { e.edit(embed2) })
Like a message you make in the code, I want to know how to be able to edit a message using a command and get the message id then it sends the edited version. I cant find any videos or anything on how to do something like that.
(using discord.js)
So I have this code
exports.run = async (client, message, args, level) => {
try {
let botid = args[0];
if(!botid) return message.reply("you must specify a bot id that is on discordbots.org");
client.dbl.getBot(botid).then(bot => {
const embed = new Discord.RichEmbed()
.setColor(randomColor)
.setThumbnail(`https://cdn.discordapp.com/avatars/${bot.id}/${bot.avatar}.png?size=2048 `)
.setAuthor(`${bot.username}#${bot.discriminator} (${bot.id})`, `https://cdn.discordapp.com/avatars/${bot.id}/${bot.avatar}.png?size=2048 ` )
message.channel.send({
embed
});
});
} catch (err) {
message.channel.send("that bot is not on discordbots.org! It is possible that a different error occurred!!");
console.log(err);
}
};
Not complete whatsoever
But if I do
the command with args[0] as a random number
The error gets logged
404 not found in console
The message.channel.send("that bot is not on discordbots.org") part never sends :/
@cobalt dune you need a message object to edit a message. You can do this by storing it as it's sent, or getting it later <message>.edit([content], [options])
with nginx im i have the basic_auth set up and .hwpasswd and what not and that all works great, but without saving the password it'll take another 5 minutes of being inactive on the page until it requires me to do it again meaning i can refresh all i want. is there a way to make it instantly require no matter what?
(more nginx yes
)
What would be some ways to check for an alternate account?
Kind of hard without IP
But you could just call it as a possible alt if its under X days old
@fluid spire try/catch doesnt work with .then() promises, only with await promises
if you use .then() you need to catch them with .catch() instead
q about JS: I have a variable that looks like this
const herbs = {
"edible":
[
{
"name":"Rosemary",
"desc": [
{
"info":"kkjjj",
"source":"Wikipedia"
},
{
"info":"kkjjj",
"source":"Herb Cottage"
}
]
},
{
"name":"Lavender",
"desc": [
{
"info":"kkjjj",
"source":"Wikipedia"
},
{
"info":"kkjjj",
"source":"Herb Cottage"
}
]
}
]
}
I want to print out the wikipedia info from the first array using a string, so I used the find function:
let findsource = "Wikipedia"
let result = herbs.find(r => r.edible[0].desc.source === findsource);
console.log(result.edible.desc.info);
And ofc i'm thrown with an error, is there any way I can search from my array using a string? maybe I should use includes()?
o holy gosh thats a big message
Hello, so i want to make a website with user can input their text there but confused in her text things, I do:
<textarea class="materialize-textarea"># Text With Markdown In Here and I want it converted to html like I use `#` and want it convert to `<h1>`</textarea>
``` But at the page only shown with text like a normal text ( not converted )
I use `<p>text here</p>` for that text ^
nvm, I got it
@earnest phoenix your array is inside edible not herbs
so it should be herbs.edible.find()
Thank you for answering my question @quartz kindle ! I added that in as you suggested but I’m still getting a type error 😞
Successfuly converted markdown to html but why it won't work 😦
you're adding it as text, not as html
well how does your code look like?
<p type="text/html">that long description here with markdown converted to html<p>
where is that? in your bot's edit page?
in dbl?
no
thats not dbl then
then show your code
your actual code, how are you converting/generating the page
First I generate it using marked package
then call it in ejs/html file
Result
:'/
👍
Oof html
mind posting a code snippet? 
No
client.on('message', (msg, message) => {
if (message.member.roles.has(456693113130582018)) {
if (msg.content === prefix + 'shutdown') {
setTimeout(shutreply, 60);
msg.channel.send(":octagonal_sign: **Завершение работы**!")
function shutreply() {
msg.react(":ballot_box_with_check:")
};
setTimeout(shutdown, 120);
function shutdown() {
process.exit(-1)
}};
} else {
client.on('message', msg => {
msg.reply(':octagonal_sign: **У вас недостаточно прав, обратитесь к @*Admin**');
})};
});```
if (message.member.roles.has(456693113130582018))
Give error
if (message.members.roles.has(456693113130582018))
Didn’t work?
are you using djs?
which library are you using then
can't think of any that passes two message objects on the message event 
I use only discord.js
what is it?
discord.js lib code, the event only passes one parameter, why are you passing "msg" and "message"
i must use only one?
yes
now
Oh I didn’t even notice that
client.on('message', msg => {
msg.reply(':octagonal_sign: **У вас недостаточно прав, обратитесь к @*Admin**');
})};```
if you don't ignore messages sent by bots you will reply to your own bot
ending up in an infinite loop
there's also no point in having multiple listeners for the same event you can put everything into a single one
And if I want to use otherwise
@marble needle i want to check user role, if he not admin send he message
I make it
And get infinity loop
give me a sec
remove the second listener and add a check for bots
return if msg.author.bot is true
no spoon feeding here, look-up documentation or some tutorials on a search engine called GOOGLE
^ can't possibly give you any more hints
@earnest phoenix ```js
// bad
client.on("message", msg => {
// something
})
client.on("message", msg => {
// something
})
//good
client.on("message", msg => {
if(msg.content === something) {
// something
}
if(msg.content === something) {
// something
}
})```
Thank
how to specify in if(!message.author.id) 2 user?
)
I'm noob
I write eval command for 2 users
if(!(message.author.id === '</>' || message.author.id === '</>')){ . . . }```
Thanks
A better way would just to but ids into an array and see if the array includes the id or not
My code is this hastebin
I have a problem
When i use this command the number is false the bot add too many 0
🤔
you're not converting to a number properly
its better if you convert it right at the beginning
achievement1 = Number(args.join(""))
also, you dont need to test for - to see if its negative
just check if its < 0
Thanks @quartz kindle i, go test
bot.on('guildMemberAdd', member => {
let guild = bot.guilds.get("242022034257870849");
bot.channels.get('361993945942589442').send(`Welcome ${message.member} to **${guild.name}**! You are user number **${guild.memberCount}**! :smile: \nPlease read [#445788244471447557](/guild/264445053596991498/channel/445788244471447557/) for the rules of the server and [#481606686419714068](/guild/264445053596991498/channel/481606686419714068/) for some useful information. If you would like special roles, you can opt in and get some in [#444235670685351953](/guild/264445053596991498/channel/444235670685351953/). If you need help with anything, don't hesitate to ask our staff team! \nWe hope you enjoy the server and may we meet again!`, {
file: "https://cdn.discordapp.com/attachments/309443624020475904/519647531102109728/sdf.gif"
});
});```
So I have this code to send a message in a channel to welcome someone. Problem is that I dont get any errors and it doesnt send the message, so I dont know what the problem is with it.
wild guess but aren't you supposed to get guild.channels instead of bot.channels
doublecheck the channel/guild ids and whether or not your bot even has writing access in said channel/guild
bot.channels.get works the same as guild.channels
Bot also is admin so it is able to send messages
I changed message.member to member and still nothing
yea noticed that after checking the documentation, haven't touched djs in a while
pretty sure this isn't valid file: "https://cdn.discordapp.com/attachments/309443624020475904/519647531102109728/sdf.gif"
discord files can't be urls
you need to send the actual data
maybe cause he used file instead of files and didn't add the brackets
^^
Yup
https://i-was-scammed-by.dabbot.org/83af2e.png the docs say both should work
¯_(ツ)_/¯
no
file: notAnArray vs files: [an, array]
reposting it after 30 seconds won't help you @uneven laurel
file is deprecated
depends on the branch he uses, its deprecated but might still work (should drop a warning)
anyway, even better way of finding what the error is there
If I do the code with a command and send the welcome message includes the file, it sends alright. But I added it to the bot.on and it doesnt work so I think its something to do with it, but I dont know what because I searched it up and all seems right
is to .send(...).catch(console.error)
Ill add the error and see what happens
wouldn't his app crash with said error even if he doesnt catch it
@uneven laurel Can you try to better format your question, I don't quite understand what you're trying to do.
Theres no error
It should work, but the fact it doesnt and there is no error for it not happening is just confusing the hell out of me.
isn't it kind of counter intuitive to have a command that tells people to use another command instead
@cobalt dune that code works for me
let bot = new (require('discord.js')).Client();
bot.on('guildMemberAdd', member => {
let guild = member.guild;
bot.channels.get('310856262235586570').send(`Welcome ${member} to **${guild.name}**! You are user number **${guild.memberCount}**! :smile: \nPlease read [#445788244471447557](/guild/264445053596991498/channel/445788244471447557/) for the rules of the server and [#481606686419714068](/guild/264445053596991498/channel/481606686419714068/) for some useful information. If you would like special roles, you can opt in and get some in [#444235670685351953](/guild/264445053596991498/channel/444235670685351953/). If you need help with anything, don't hesitate to ask our staff team! \nWe hope you enjoy the server and may we meet again!`, {
file: "https://cdn.discordapp.com/attachments/309443624020475904/519647531102109728/sdf.gif"
});
});
bot.on("ready", () => console.log("bot ready"));
bot.login(require("fs").readFileSync("token.txt").toString());```
it worked? for you?
Research the array.includes method @uneven laurel also as Rye said, it is kinda counterintuitive to do it that way
Now Im super confused as to why it doesnt work for me

try it in a different channel with a different id, can't think of any other reason that might cause this to fail
Ima try with my other bot, idk see if it works there.
I put the code in my testing bot and it worked great, just as I wanted so I will try to use a different channel then
Nope changed the channel and it still didnt work. So my bot just seems to not like this code
did you use the code natan posted?
I did
and I derped
I had to put bot bot.on"memberAdd" above the bot.on"ready" so it works now..
all this time and the issue was simple code placement..
I want to die
wat
your indentation suggests you had it inside something else https://javascript.is-bad.com/9718de.png
so the listener wasn't ever being added
damn didn't even notice
probably had it within the ready listener
if putting it above it worked
hmm probably
lol but you should see my indentation lmao
its baaad
I dont even try to make it look good just press enter here, tab there xD
that's gonna fuck you over sooner or later when your code becomes more complex and you need to take a solid 10 minutes to decipher your code because of bad readability 

