#development
1 messages · Page 752 of 1
nope
I dont wanna have to save the image as a file
I shouldnt fricken have to
Google is your best friend if you can’t figure something out
thats a rip
I wouldnt have asked if I hadn't googled
Got it
17th page of google
but I got it
also dying pls read the channel etiquette pinned, telling people to go to google doesn't really help D:
Yes but it should be a resource people need to learn to use
- If you know something, and someone asks a question about that thing, don't shit on them for asking. Either help them or stay quiet. If you don't have anything nice or helpful to say, keep quiet.
How to get the ID of the first channel on the server? How to send an invitation to the same channel to the console?
Please mention
@vagrant stream What language?
JavaScript
why are you generating invites to be sent to console
I was not shitting on them what the fuck
msg.guild.channels.first().id @vagrant stream
Dying I highlighted what you should have friend
Thanks
@vagrant stream do not generate invites without permission. It is not allowed and can get you banned from here and discord itself
@delicate zephyr 
I wasn’t shitting on you though. I was giving you a suggestion as if you rely on us too much you won’t learn anything
Okay, so I know the ID of the desired channel, how do I get the invitation URL to it?
@opaque eagle i got it
oh ok
@vagrant stream why do u want to make the invite>
But whatever, it was a mistake coming back here smh
D:
you're not saving the image, right... just create a png stream or a buffer
oh ok
@modest maple Interesting, must
just wanted to make sure
um, dying, he already said he used google excessively. He was asking here because according to him he was on the 16th page of google
@vagrant stream what?
I did not know this information else I wouldn’t have suggested googling
@vagrant stream do not generate invites without permission. It is not allowed and can get you banned from here and discord itself
😂
I did not know this information else I wouldn’t have suggested googling
then dont say "google it"
Oh....
@modest maple I want to be on the servers where my bot is, to watch all the errors
thats not allowed avenger
No one said "go spoonfeed"
uh, no one said that? He was simply asking a genuine question and you just told him to google despite not knowing the topic?
Like even though I figured it out what sinister said is a good example of how to help
you're not saving the image, right... just create a png stream or a buffer
I just said I’m done with the topic why continue it
I know, but this my bot is not popular, and my friends only use it, what difference does it make for what?
it breaks discord tos
two big No Nos
Be it for your friends or not, creating invites through your bot without the server members' consent is against Discord ToS,
Keep your curiosity limited
ToS?
i mean just enjoy ur bot not being given any permission at all when joining a server
Terms Of Service
Or straight up kicked 
Okay, I won’t do that, you warned me. But still how to do it?
we're not gonna teach you how to potentially break TOS
after learning your intention
Lol
😒

i already told him smh 😠
How to convert ID to channel name?
I didn’t see
Fetch the channel using the ID
Then get the name from the data you get back
Or how to send to the channel knowing its ID?
Get the channel with its ID and send to it?
@vagrant stream All your issues can be solved easily by reading your language documentation. Please go here for your language docs: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/614917425837768765
if you keep asking questions that can be easily solved by reading the documentation you will be punished
Ask you faster
I would doubt that
@lusty dew yes
uh
Searching the docs will entirely depend on you while asking someone will depend whether they know the answer and have the time/are willing to answer the question
last chance avenger, please, just read your language documentation and search for how to send a message to a channel
thank you.
chan = msg.guild.channels.first().id
client.channels.get(chan).send("Message")
Thanks =)
Uhhhhhh
shiv pls
you could just do
No I mean they could straight up access the first element of guild.channels
instead of re-getting it 
Xd
sry I meant
Message failed auto correct screwed it up
//fixed ver kek im dumb
msg.guild.channels[0].send("yeetus deletus")
K
channels is a collection, not an array
Lmao
i dont think you can use numbered indexes on it
Tim shhh
ugh
you can do this tho xd ```js
let channels = new Proxy(message.guild.channels,{
get: function(obj,prop) {
return [...obj.values()][prop]
}
});
channels[0].send("lul");
more work!
XD
or dis
let defaultChannel = "";
message.guild.channels.forEach((channel) => {
if (channel.type == "text" && defaultChannel == "") {
if (channel.permissionsFor(message.guild.me).has("SEND_MESSAGES")) {
defaultChannel = channel;
}
}
})
defaultChannel.send("ok")
if you just want to get the first channel the bot can send messages in
from the server
even shorter:
message.guild.channels.find((channel) => channel.type === "text" && channel.permissionsFor(message.guild.me).has(FLAGS.SEND_MESSAGES));```
how to do custom emojis with bots?
something with <e\🆔>
become !4165_Hyped_ZeroTwo
gonna try
id?
var emoji = client.emojis.find(e => e.id == 'id').toString()
if you don't want to use < >
ok
Lol
But with me it's working
it literally can't
the last two digits of a number becomes 00 for me with ids, so it can't.
Okay
Hmm
~
❯ nix-shell -p nodejs
these paths will be fetched (9.20 MiB download, 45.63 MiB unpacked):
/nix/store/2rbbn30ii3xi5aa9rdlgsw5xfk634wfg-nodejs-10.17.0
copying path '/nix/store/2rbbn30ii3xi5aa9rdlgsw5xfk634wfg-nodejs-10.17.0' from 'https://cache.nixos.org'...
~ via impure
❯ node
> 257521982021566464
257521982021566460
>
the id changes
👀

The ID changes exactly
So it doesn’t work
If the ID changes it’s not a valid ID anymore
@west raptor also what’s nix-shell?
Is it a custom shell or smth
Kinda, it's basically an isolated environment
Ah okay
https://nixos.org/ if you wanna learn more
Okay
Now for my question
When using Klasa (discord.js framework) how would I use the KlasaReady event
I know I gotta use the event class but idk how I’d go about doing that specific event
I assume it'd be something like this https://klasa.js.org/#/docs/klasa/stable/Tutorials/CreatingEvents
I'm guessing KlasaReady is basically just the ready event fired when the bot is ready?
taking a look, it does seem that way
so make a standard event how you usually would and for the event name it'd be klasaReady
Ohhh
I thought I had to include some random stuff oof
Okay thanks dream I missed that entirely
js supports big ints, but it is kinda impractical to use them
I've forgot how i could call first object in a object?
object[0] is giving me undefined/null.
objects are not ordered, they dont have a concept of first or last
you have to convert them or a part of them to an array by using Object.keys() / Object.values() / Object.entries()
Okay, ill try that. Thanks.
What would be the best way to make different kinds of ships for a sim bot
ships?
Like say 1 ship has a health of 100xp and can mine 200 ore every 20m or so
if you want to store them yes
Database
I know
But would I use an ID system or what? What’d be the best way of doing such a thing
well, can the user customize the ship?
Alright then so you could say have a class with the properties and when ever a new ship is created create the class and store it
i usually use twitter's snowflake system to generate ids
it is also what discord uses
Well the user themselves can’t make a ship
Ima have already made ships that the users can buy/upgrade too
it's basically the same concept, no?
if each ship is unique and all of them must be stored, then unique ids/snowflakes, else you can just store an entry for the user, containing stuff like ship type, component levels, xp and such
^
do you need to access ships without users?
like searching for highest level ship, biggest ship, etc
Well
https://hastebin.com/gafajawaye.js
What did i wrong there?
Yes kinda
what kind of database are you gonna use?
Ima have a "shop" that people can buy higher level ships
ohw shit
So I need to be able to track what the highest level ship is from the current ship they have
is each person limited to one ship or can they have many?
Default is 1
But they can buy a perk with in game currency to be able to run more ships
@earnest phoenix what why are you storing true/false as strings
And I’m using sequelize + Sqlite3
@west raptor idk
you're just making life harder on yourself
ok, so one way to do it is to have a dedicated table for ships
each ship will have an owner id, and all other properties
@west raptor well i could store them as non Strings but thats not the problem rn
from what i can see, your embed is empty because none of those conditions passed
ie, none of the database entries is null
Discord on my pc is stuck in a loop of installing the same update
@quartz kindle that’s the model I’m thinking you mean
if you make owner id unique, then each person can only have one ship
Oh true
instead you can make an auto incrementing id and have that as your primary key
Wdym
just make owner id an index
@fallen plinth Blizzard
what
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true
},
Okay
and add an index
And how would I use that
{
indexes:[
{
unique: false,
fields:['ownerId']
}
]
}
@earnest phoenix
@earnest phoenix stop??
define("ships", {columns}, {indexes});
Like that
?
Oh wait
I have to restart my pc hold up
module.exports.Ships = seq.define('ships', {
owner_id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
},
attck_boost: {
type: Sequelize.SMALLINT,
defaultValue: 1,
allowNull: false
},
def_boost: {
type: Sequelize.SMALLINT,
defaultValue: 1,
allowNull: false
},
health: {
type: Sequelize.SMALLINT,
defaultValue: 100,
allowNull: false
}
},
{
indexes: [
{
unique: false,
fields: ['owner_id']
}
]
})
like this tim?
@quartz kindle null is when it does not exits
@lusty dew yeah that should work
but owner_id should not be the primary key, nor auto increment
primaryKey and autoIncrement should be another field
Oh okay
@earnest phoenix yes, but does it exist?
no
Now I gotta figure out the class eek
you need to wait few seconds, cuz onGuildAdd (or wut evr it is) will be fired before even the guild is ready sometimes
wut
Hm
Don't think that is how it works
Tim, what would be the best approach for the class?
I have never really used classes so eek
why don't you write that online ?
what
What's the difference between mongoose's findOneAndUpdate() and updateOne()
running the robot but the website does not write that online
I understand and thank you for your prompt reply
@opaque eagle findOneAndUpdate returns a document
module.exports = class ShipBuilder {
constructor(health, power, ore_cap, def_boost, attk_boost, owner_id){
this.health = health;
this.power = power;
this.oreCap = ore_cap;
this.defBoost = def_boost;
this.attkBoost = attk_boost;
this.ownerID = owner_id
}
}
isn't this how I would setup my class?
updateOne does not
@lusty dew you dont actually need to use classes, you can use anything else that makes you more comfortable
Well
but if you wanna dive into classes, its worth the while
have you ever used prototypes?
classes, prototypes, instances, inheritance, etc... they are all connected, its like a whole world by itself
classes are basically a nicer way to create prototypes
in javascript EVERYTHING runs on prototypes
when you create an array, you're using a prototype
Ooo
an object, a string, a number
I didn't know that
everything uses prototypes
so basically, you when you have a piece of data, like "test" or 123
you have a data type, and methods attached to that data type
"test" is a string, and it has methods such as .length, etc
those are part of the prototype, or the object class
they are not actually part of the data
just attached to it
Yea
Makes sense
so basically in a class when you are doing
module.exports = class ShipBuilder {
constructor(health, power, ore_cap, def_boost, attk_boost, owner_id){
this.health = health;
this.power = power;
this.oreCap = ore_cap;
this.defBoost = def_boost;
this.attkBoost = attk_boost;
this.ownerID = owner_id
}
get() {
//blah
}
build() {
//build the ship
}
}
Would those be considered methods?
yes, get and build are methods
you can modify and extend prototypes and classes, like this
classes are the same, just with a neater syntax
Which is better for developing bots: PY or JS?
both are average
Preference
Use whatevever you are comfortable with
Okay so my question is
In the class how would I make the different types of ships?
the best way would be to create a base class and then extend it with specific ship classes
for example
@broken jay It really depends honestly
class BaseShip {
constructor(data) {
// build your base ship
}
}
class specialShip extends BaseShip {
constructor(data) {
super(data)
// build your specific ship
}
}```
Both have their pros and cons
in the base ship, you should have all the properties and methods that all ships have
and then in each specific ship, you have that ships specific properties and methods
and when you create a ship instance: let myShip = new specialShip(input)
wouldn't specialShip be bad naming
myShip creates a specialShip which in turn creates a BaseShip and joins everything together
Is there any article where is both pros and cons for developing discord bot?
No, not really
the only pros and cons is: which language are you more familiar with and prefer using, and which runtime you prefer running in your computer or vps
super gets things from the parent class
so when you create an extended class, you need to activate the parent as well
So essentially
But performance? Which is faster?
both are more or less equal in performance
Like do I do
*Typically though javascript is a little faster if you wanna get technical
but then it again
it comes down to how you optimize it
I am confused about this class thing xd
ok
Tim would I make a build method in the BaseShip class to build the default ship?
unless you wanna use "unbuilt" ships for anything
Hm
That actually gave me an idea
I could have the option to allow them to scrap the ship for parts and sell them to get some money to go towards a new ship
yeah you could give it a destroy() method for example
Well
user experience wise
Hm
Let me put this in a different perspective
You know those games where you build say a farm and it takes x time to finish the build
and it takes resources to build said farm
I was thinking of something kinda like that
You have to collect x amount of materials to be able to build a new ship
then you do need an unbuild status
just add a status property to the ship
and some kind of progress
Wdym status?
a ship that is not yet built is still a ship
one way to do it is to have a status property
so you can check ship.status
another way is to have a dedicated "unbuilt ship" class
Eek
Okay
So when I am doing the build method
do I just do something like
Wait
when making the build method
do I just give it all the health, def_boost, attk_boost, etc values and save them to the database?
or is there something specific I have to do
a class instance itself cannot be saved in a database, so you need to extract and rebuild your classes
so you need to give all the values to a constructor when you create a class
so that when you create an instance, you can supply existing data to it
lul
Tim
Do you mean like this
module.exports = class ShipBuilder {
constructor(health, power, ore_cap, def_boost, attk_boost, owner_id){
this.health = health;
this.power = power;
this.oreCap = ore_cap;
this.defBoost = def_boost;
this.attkBoost = attk_boost;
this.ownerID = owner_id
}
build(){
this.health = 100;
this.power = 1;
this.oreCap = 200;
this.defBoost = 1;
this.attkBoost = 1;
this.ownerID = someID
}
}
?
something like that yes, but an unbuilt ship is still a ship
so go ahead and js constructor(...,built) { this.built = built; } build() { if(this.built) return; }
so
module.exports = class ShipBuilder {
constructor(health, power, ore_cap, def_boost, attk_boost, owner_id, built){
this.health = health;
this.power = power;
this.oreCap = ore_cap;
this.defBoost = def_boost;
this.attkBoost = attk_boost;
this.ownerID = owner_id;
this.built = built
}
build(){
if(this.built) return;
this.health = 100;
this.power = 1;
this.oreCap = 200;
this.defBoost = 1;
this.attkBoost = 1;
this.ownerID = someID
}
}
and I am assuming the default of build should be false
or would it be true
Okay
then inside the build method, you should check if the owner has enough resources to begin building
Wait why won't I need ownerID in build method
because this ship already has an owner id
everything you put in the constructor is part of the class, and everything can be accessed from all its methods
Ah mk
so the build method will build a ship with default values
what about the ship type?
do all ship types have the same default values?
No
Each ship type has different values
health, def, attk, etc will be different
Also I just realized something
I am going to be using ore that they mine as the resources
I have yet to make the ore class
but still, learning classes is worth it, and coding oop does feel good af
you will probable end with something like a user class, which has an array of ship classes the user owns
and you can assign classes as properties of other classes and create circular dependencies
like djs does
for example, ```js
class Ship {
constructor(owner) {
this.owner = owner
}
}
class User {
constructor() {
this.ships = [];
}
buyShip(type) {
let ship = new Ship(this);
this.ships.push(ship);
}
}
so you can do user.ships[0].owner.ships[0].owner.ships[0].adInfinitum
user.buyShip() will create a ship and add it to the list of ships the user class has
user.ships is an array
you can make it an object or Map if you want
so user.ships[0] first ship in the array then you use .owner to see who owns the ship
why do you keep doing ships[0] after that
to demonstrate the circular dependency
Ah okay
we build a Ship class by supplying user's this, so ship.owner is a reference to the entire user class
no need to do stuff like users.find(user => user.id === this.ownerID)
if you want to find the owner object from within a ship instance
just a nice and tidy way to connect things
discord.js does this as well, such as message.guild
or message.channel
module.exports = () => {
class Coal {
constructor(price, type){
this.price = price;
this.type = type;
}
create(){
this.price = 10;
this.type = "Cheap"
}
}
class Diamond extends Coal {
constructor(data){
super(data)
}
create() {
this.price = 200;
this.type = "Expensive"
}
}
}
So something like this?
I am working on the Ore (resources)
the problem is
classes are supposed to be like a physical object you have in your hands and manage
resources are things you collect and spend
its kind of a different thing
you are not going to have 1 coal lying around and then do things with it are you?
like paint it pink or put wings on it
your classes are the user and the ships
resources can simply be a property that is part of the user
to keep track of how much the user has
Hm
How would I make it so it isn't resources in total but like
say for the next ship they need 2000 coal and 2000 iron
so like the more ships they have the more expensive it gets?
regardless of ship type
Yes
class User {
constructor() {
this.ships = []
this.iron = 0
this.coal = 0
}
buyShip() {
let cost = this.ships.length * 1000 + 1000;
if(this.iron > cost && this.coal > cost) {
let ship = new Ship(...);
this.ships.push(ship)
}
}
}```
in this case, i made cost a simple formula based on how many ships the person has
each ship increases the cost by 1000
Hm
Is there an easier way to do such a thing
Like the formula is perfect
but defining each ore like
this.coal
this.iron
this.diamond
etc
seems a bit of a tedious thing
as I plan on having 20-30 ores
well, you can put them in a resources object
this.resources = {
iron:0,
coal:0,
etc
}```
yup
You can extend classes
Yes I know
yeah
but would it be better to split them up?
Make it cleaner instead of like 10 classes in one file
probably
Okay
Oh i didn't know that's what you meant lol
should be yes
extending classes should be done when you have a base type of something, that has methods that all classes should share
for example, if you have baseClass.mymethod() and you extend it, then mymethod() will also be available in the extended class by default
Hmmm okay
Also
My big question is
How will I tell which ship they are trying to buy?
Cause they don't have to buy the next one avaliable
there are many ways to do this
there is something called static properties and static methods
a static property is a property attached to the class, but not to its instance
for example
class test {
constructor() {
}
ok() {
}
static ok() {
}
}
the static method is not available in an instance, meaning you can access it by test.ok but not by a = new test(); a.ok
so basically, you can use static properties and add metadata to a class, information about the class, methods that do not target instances
a class becomes an instance when you use new
Okay
That kinda makes sense
but how is this useful in telling what ship they are trying to buy
and what resources it takes to buy said ship
class Ship2 {
static requirements() {
return {iron: 10, coal: 10}
}
}
let reqs = Ship2.requirements();
if(iron > reqs.iron && coal > reqs.coal) {
let ship = new Ship2();
}
sure
another useful thing to know about classes, is to make use of getters and setters
they help make your code neater as well, basically if you would make Ship2.requirements() a getter, you would be able to use it like Ship2.requirements.iron instead of Ship2.requirements().iron
get requirements() {}
or in the above case static get requirements() {}
similarly, you can use set myMethod() {} if you want to do ship.myMethod = somevalue instead of ship.myMethod(somevalue)
the real advantage in using getters tho, is called lazy loading
you can use getters to generate data only when you access it
for example get time() { return new Date() } will always return the current time
but this.time = new Date(); will return the time when you created the instance
and both are used as Ship.time
Ahhh okay
Okay so in my ships.js file (holds all the ship related classes)
I have this
class RustBucket extends ShipBuilder {
constructor(data){
super(data)
}
static get requirements() {
return {coal: 3000, iron: 4000}
}
}
in my users.js (holds alll the user related classes)
Will I need to destruct the RustBucket class to get the requirements?
Like
const { RustBucket } = require('./ships')
module.exports = () => {
class User {
constructor(){
this.ships = [];
this.resources = {
iron:0,
coal:0,
diamond:0,
lapis:0,
emerald:0,
dragonDust:0,
darkCrystal:0,
uranium:0
}
}
buyShip(){
let cost = RustBucket.requirements.iron * 1000 && RustBucket.requirements.coal * 1000
//blah blah
}
}
}
But that doesn't seem to make sense actually
cause then that would be specific to one ship
you need to export the classes
module.exports = { RustBucket, OtherShip, etc }
then you can require them like that, or just require all of them
const ships = require("./ships")
then you can specify the ship in the buyShip method
buyShip(type)
then you can let cost = ships[type].requirements
and then js for(ore in cost) { if(this.resources[ore] < cost[ore]) return "not enough " + ore; }
and add the formula somewhere in there
you dont need to export the User class inside a function
unless you want to call it from a function but then you need to return it
module.exports = class {...}
User = require(...)
user = new User(...)
or
module.exports = (...) => { return class {...} }
User = require(...)
user = User(...);```
ore is red for some reason
Idk if it is the linter being weird
or if it is something else
When I hover over it, the thing says "Unresolved variable or type ore"
I think it is the linter acting up
Eek
probably being weird, cost should be an object
you can use other types of loops as well
buyShip(type){
let cost = ship[type].requirements
for(ore in cost){
if(this.resources[ore] < cost[ore]) return `Not enough ${ore}`
}
}
So like this then
no, requirements is the requirements object of the ship
you cant multiply an object by 1000
yeah
and then I would use the formula in the if statement right?
Can someone help me with mongodb... i keep getting this error: CastError: Cast to ObjectId failed for value "656271376638017556" at path "_id" for model "Guild"
I've always used Postgres
Mongodb is so new to me lol
anyways if someone can tell me why that happens it would help
cost is the requirements
ore is the ore itself
cost[ore] is the requirement for that specific ore
Okay
So I am assuming to make the formula I would do something like ore * 1000
or whatever
yeah, but double check your formula
if iron cost is 1000, cost[ore] * 1000 = 1000000
anyone know of a huge list of profanity I can stick in an array?
and you want to make it based on how many ships the user has
["Ollie"]
don't waste time on making word filters
there'll always be a way to bypass them
and you'll get more false positives than true positives
true
i tried to make an array filter once
it detected class in a codeblock as ass
Yeah, it's hell
theoretically speaking there would be ~1111998^1990 ways to bypass your filter
which is a huge number
yes
hmmm just found an npm package https://www.npmjs.com/package/noswearing
seems different from others
Roblox has the most sophisticated swear filter ever
yes it does
It's the worst one too
it catches everything...and more
It isnt even theirs
Still
i wouldnt be surprised if it is using ai
every filter depends on how restrictive the chat box is
ooooo
SuperCell uses it
@quartz kindle Would I simply do
let formula = this.ships.length * ore + 1000 as you did in your previous example for the formula
something like that yeah
figure it out :3
Yea I am trying
xd
So if cost is the requirements of that ship
and cost[ore] is the requirement for that specific ore
for some reason, this happened to my config:
https://pastebin.com/ieHDnrTj
function configSet(name, response) {
try {
config[name] = [response];
fs.writeFile("./config.json", JSON.stringify(config, null, 2), function(err) {
if (err) throw err;
});
output = 1
return output;
} catch(err) {
output = 0
return output;
}
}
function and
try {
eval(fs.readFileSync('moves//fighteval//' + move + ".txt").toString())
} catch(err) {
simpleEmbed(message, "Use a Move", 'An error has occured.\n**ERROR**: `Something went wrong when trying to compile "moves//fighteval//' + move + '.txt"`')
console.log(err)
return
}
configSet("fighthp_" + message.author.id.toString(), userhp);
configSet("fighthp_" + opponent.toString(), opponenthp);
code
dont ask me why im not using require
stop using json files as a database
@quartz kindle Would it be something like:
for(ore in cost){
let formula = this.ships.length * ore + 1000;
if(this.resources[ore] < cost[ore] / formula) return `Not enough ${ore}`
}
Wait no
oof
Anyone know how I could install node-gyp rebuild on ubuntu? I can't install npm modules.
npm ERR! errno 1
npm ERR! ref@1.3.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.3.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! /root/.npm/_logs/2019-12-22T19_49_31_125Z-debug.log
That would be bad
"Stop using json files as a database"
This. All of this.
@oak imp then use what as a database?
@wooden lance u need to install build-tools
a database
@shy turret sql
because json files are not a database
dont have it lol
thank you
sql is a language
sql database i meant
it's better than using text files as a database which i used to do
my bot still uses json lmao, and its at 2k guilds
it's better than using text files as a database which i used to do
it really isn't
it's equivalent
it's still sync IO operations
not really
I mean if you need something simple and lightweight, sqlite is a decent option @shy turret
how do i get sql
sql is a language
and u can use orm, and then its ez as json
for the second time
there are databases that implement sql
sqlite is one of them
Sequalize is a good orm
it's local so it's perfect for small bots
TypeORM or Sequelize on js 👌
@restive furnace just to clarify, am I installing it with npm, or something else?
apt
okay
sudo apt install build-tools should work
apt if you're on linux
he said he is on ubuntu
👍
Anyone know how I could install node-gyp rebuild on ubuntu? I can't install npm modules.
he said
I feel like I am doing something wrong
Building dependency tree
Reading state information... Done
E: Unable to locate package build-tools
your Tim free trial has expired
don't use json has a database isn't helping...
i dont want to rewrite the whole bot again
@wooden lance try google cuz there was an trick to fix that
ok
"how to install build tools on ubuntu xx.xx?"
@shy turret like I said, take a look at using sqlite
wait...
i dont want to rewrite the whole bot again
migrating to an actual database =/= whole ass rewrite
yep build-essential https://askubuntu.com/questions/398489/how-to-install-build-essential
if you don't want to, then don't complain for having problems with something that's been said to not be done
@wooden lance > https://askubuntu.com/questions/398489/how-to-install-build-essential i meant
go there
lel and now i have to wait for apt to install half a gb of stuff
centos xd
i've many times installed ubuntu desktop on ssh lol
and its like 5 gb
oof
if you're on a vps, half a gb of stuff will be done in couple minutes
u would think
ye and my internet is pretty fast so it download gb/2-3mins
xd
its one of fastest in my country
very slow when ur server is in germany
it is slow if ur vps on germany and u like somewhere like america or asutralia
australia
location shouldnt matter, whats your servers internet speed? 10mb?
i believe the speed is like, 100mb/s
so theorically is should be done in a minute
yes
100mb/s can download 750mb of data per minute
i have no clue it just says this
100mb/s download = normal, 30-40mb/s upload = normal in finland
usually when installing stuff with apt, its not the internet that makes it slow, is the actually installing process, disk write and cpu
@wooden lance => https://speedtest.net
and ss it
100mb/s 😳
it's a vps, i have no clue how i would do that
are you sure it's not 100mbps
im going to sound like an idiot here, but what's the difference?
From what it shows its 100mbps
megabytes vs megabits
Megabits most likely
mb/s = mbps ?
no
im confused
the difference is in casing but i always write in lowercase
Mb != MB
wot
mb per or / s
what
8Mbps = 1MB/s
okhe
@oak imp it's the same thing
because 8 bits is 1 byte
my downloading from steam is usually at 10mb/s
1 byte is 8bits
Megabits is not the same as megabytes, no
100mb/s would be 800mbps internet which is almost a gigabit connection which is rare
you just said Mb != MB lol
its not actually rare again in finland many of internet providers provide 1gb internet
MiB
Yep, Mb is shorthand for megabits, whereas MB is megabytes
who on earth came up with this system
what that's dumb as fuck
it's like that everywhere 
im still getting this error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ref@1.3.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.3.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! /root/.npm/_logs/2019-12-22T20_08_00_983Z-debug.log
``` aaaaaaaaaaaaaaaaaaaa
why does capitalization have to make that much of a difference
a lot of people confuse Mb with MB because a lot are tech illiterate and spread false information around
install better SQLite 3 for start
how else would you abbreviate them, dream
@oak imp i have no clue what ur saying
it follows SI system rules
they confuse it probably
Because not many people outside tech fields know the difference
lmao
windows is trash
Truth lolz
windows be a potato
it's all about macos or linux 
Windows is meant to be easy, not technologically accurate lmao
Because not many people outside tech fields know the difference
@oak imp tbf i only learned that today
it's not really taught
ur slow dream
I know
if you take IT it's one of the first lessons you have i think
We haven't been taught that neither in school nor in college

and I'm going for programming 
just learnt it passivley
nobody has time to differentiate them, we just use context. when talking about internet speeds, Bits is the defacto standard, regardless of which abbreviation you use, we all know what you're talking about
same with file sizes, but with bytes
- loses even more faith in the education system -
Wait... perchance are you both from the states?
@west raptor and @slender thistle I mean
node-gyp rebuild is still being annoying
I am far from the freedomland
the opposite
Russia?
close hit but this is getting #memes-and-media
Ah yes, apologies
@wooden lance look into rebuilding from source.
It works a little different
Might help ya
first they need to give the full error lol
which module are you trying to install btw?
@oak imp what is the command
Anyways, this developer kitteh is off for a shower and then chores. Good luck peeps lolz!
node-gyp is just a requirement, you dont need to explicitly install it
i am an idiot
I've found node-gyp issues are often the problem of not having windows build tools
but im not
sure if you;re using windows
nope, using ubuntu
o god this is long
not as long as a C program full of warnings because of outdated coding style
xD
pycharm is like that
has a go at you for not having a blank line at the end of your code
ah I get those all the time when compiling programs
they're not too bad
running gentoo you get used to them eventually
im just going to send the debug log because there is no way i am going to be able to copy all of this
is it a bunch of compile time warnings and errors
the bot's main library interacting with the Discord API
buyShip(type){
let cost = ship[type].requirements
for(ore in cost){
let formula = this.ships.length * ore + 1000;
if(this.resources[ore] < cost[ore] + formula) return `Not enough ${ore}`
}
let ship = new ship[type];
this.ships.push(ship)
}
I think I figured it out tim
there u go
No one is going to downlaod that
aaaaaaaaaa pastebin time
it's a log file dude
At least I wouldn't
it's a .log file...
number one rule of the internet
I still don't download files off the internet
i did
don't trust files
I'll download it for you
It doesn't matter what kind of file it is
it can be injected with malicious content either way
are you executing it? No

one question
165 warn enoent ENOENT: no such file or directory, open '/root/DiscordBotApp/package.json'
.>
These guys don't know how viruses work obviously
why don't you have package.json
@lusty dew dude, it's a log file. not an executable.
@quartz kindle
buyShip(type){
let cost = ship[type].requirements
for(ore in cost){
let formula = this.ships.length * ore + 1000;
if(this.resources[ore] < cost[ore] + formula) return `Not enough ${ore}`
}
let ship = new ship[type];
this.ships.push(ship)
}
I think I got it
@topaz fjord because it refuses to make one
Also it can be any kind of file, a virus can be launched if the file is opened
npm init
^
doesn't have to be an executable
o there u go
@lusty dew sorry but These guys don't know how viruses work obviously right back at you lol
🤷
fuck the virus
you cant put a fucking virus in a damn log file lol
if they want my data they can have it
also macos virus protection gang
@lusty dew also, your code is trying to multiply ore by 1000, which is the same as doing "iron" * 1000
It's just a log. If you have the time to put a virus in a log file to execute on open, you have too much time.
this is npm generated also
lol it worked
valid point
@quartz kindle Okay, so I am assuming I would have to get the value the same way I did before cost[ore]? You said it is the specific ore so shouldn't that be like 2000 * 1000 if iron is set to 2000\
yes
cost[ore] + formula will most likely be wrong
Why so?
if person has 1 ship, and the ship you're trying to buy costs 2000 iron
1 * 2000 + 1000 = 3000
cost[ore] + formula = 5000
yea
so that means the cost for the next ship would be 4000
that is assuming they want the next ship level
well, its fine, but its a different formula alltogether
Should I ask here about bot development only? I got question related to html
you can ask all development questions
It is development in general
That's what the topic of the channel said that's why asked
So I'm making a website
And I want to make 1 section cover the whole page
What would be a better formual to use?
Like when I go to the page, I will see one section with some texts and when I scroll, I should see another section with some texts so 1 section = 1 screenful or whatever you call it
your decision. the original formula is supposed to increase costs by 1000 for each ship. the way you did it increases cost by 1000 plus the base ship cost
@grave mist so you want it to scroll automatically?
so doing cost[ore] + formula is includingthe base ship cost as well?
or still have manual scrolling
Manual scrolling
What does vh mean
view height
yes
And btw, I used ```css
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
absolute position removes the content from the document flow
to center an element is better to use css display: block; margin: 0 auto;
Yea, but I mean the center of screen
vertical center too?
Yea