#💻︱programming
1 messages · Page 35 of 1
is it possible to somehow import import_this.py from script.py ike this in py?
project/
folder1/
script.py
folder2/
import_this.py
../folder2/import_this.py?
../dir
idk if that works in peethon but it works in everyother language
so ya
idk if there are any bukkit devs here, but if so, can someone tryna help me figure this one out?
Does anyone know how to update the xrot (head going up and down) of an entity properly? I'm trying for an iron golem to look from 0 to 45 in 20 ticks, but it just looks at 0 the whole time and doesn't update, even though the value does change...
I tried doing just #setXRot(...) too, but same effect.
Do you have that inside a runnable? Also, what is rest?
it's for a custom runnable, overriding the tick method
rest is tickCount % 1300 running when tickCount % 1300 < 100. So rest is between 0 and 100
but the equation works fine, and the xrot does update when I print it in the console after each assignment, but the entity's head pos just doesn't update besides to 0
What if you use getBukkitEntity().setLocation(w, x, y, z, y, p)?
doesn't that have the same effect as teleport
there's no setLocation method on Entity
getBukkitEntity().setRotation(getBukkitYaw(), (20 - (40 - rest)) * 2.25f);
getBukkitEntity().teleport(location);
setXRot(...);
I was just about to suggest setRotation, lol
the thing is that the values do update, but the physics don't
Where are you checking your values? Same place where you're setting your entity's rotation?
yup a bit after
unless it's being changed again in the super idk
wait actually..
lmaooo i wanna cry that works
the super was overriding the look dir
._.
happy birthday @sly mist
not right channel but
happi day of comming out
+emoji 
what
lol
"comming out"
Dk if this has anything to do with programming but this seems like a good place to ask, for the bedrock version, how do you connect from one world to another
It's the same as the java way
Omg I look smart rn
When I actually jsut looked at mitgoblas answer to the question in staff help that you just asked 2mins ago
es
bungeecord
:0 chickon
BungeeCord won’t work for bedrock - if you want to connect multiple bedrock servers I’d suggest WaterdogPE
what is dogwater, i have been hearing it a lot
i would just use the normal way of connecting servers just transfer them
The only issue with the transfer packet is it’s very slow
Since the client fully disconnects you and reconnects you to another server, given the login speed of Bedrock, it’s not really feasible for most use cases
na, it is better then lag
tbh waiting for a game is better then laging overall
What do you mean?
Ñ
Hello people who talk in here, if we were to theoretically have some form of public API, what sort of data or endpoints would you like to have accessible?
Hi Ben I love you
- Stats
- Online players
- Last online
- If a player has played before
- Stats per version (aka players on 1.12.2 Java or 1.17 Bedrock)
- Total stats of gamemodes, like total kills, total deaths
- LEADERBOARDS
player count per gamemode
Is this stats.cubecraft.net?
also the ability to disallow people from seeing anything? :p
like in settings^
Confusion
A public api which can be accessed by making requests
out of interest what kind of data would you be scared of other people seeing? just your stats ingame?
Leaderboards
Online stats per gamemode
Player profiles including rank, playtime, level, achievements etc if accessible
Loot and store items
Appeals/banned status
Creating reports (?)
ranks, level for sure rn its annoying and i have to use screen scraping, also stats leaderboardsf achievements
but for statistics like play time appeals/bans im not sure its to personal
Everyone can see if you're banned or not rn anyway so k don't see how is that too personal
yes but not how many times you were banned and/ ur appeals
Yes and that's not what I meant, also you can see if the person has appealed or their appeals bas been denied rn too
aah okay
My stats in-game too, sometimes prefer just for things to be secret
activity, online times, what you're doing atm
very likely we wouldn't provide that data
hey, i have a question. i use Whatsapp quite regularly, and i want to make a bot for Whatsapp the same way i have a bot for discord. there are apps in the play store for this, however i want to make it myself. any idea on how i can do this?
Since whatsapp belongs to facebook you should check https://developers.facebook.com and if not this is the only thing google shows https://www.whatsapp.com/business/api
@kind brook
^
I don't think whatsapp has a public api, if it would it'd be the first result in google
for personal purposes
hm. i guess ill check out the business api then. im still quite confused how auto Whatsapp reply apps on the play store exist without a personal api
they use the one I sent
it's the business api intended for- well businesses
https://www.facebook.com/business/m/whatsapp/business-api you'd have to lie about being a company here
In order to ensure a high quality experience for our users, we're in a limited public preview of the WhatsApp Business API. Submit for consideration or reach to your representative.
That clears that up
I still don't understand tho-
Would this be on a website?
@gentle patio No, an api allows you to request data to use on your application
Basically a connection
Add leaderboards back.
Add total time played (all players combined)
How many players have ranks (EX. 837 Gold) (BE EX. 735 ViP2)
Since you can connect with passport show your online friends. And what gamemodes they are in.
Only if connected by passport^
everything from here: plancke io/hypixel/player/stats/hypixel
plancke io/hypixel/boosters/ and this
plancke io/hypixel/leaderboards/ and this
and maybe this but i dont think anyone would every use this: plancke io/hypixel/punishments/
basically everything the hypixel api has
I see, and Cubecraft are going to be having one now?
"if we were to theoretically have some form of public API" 😛 ben is just asking questions
ben pro dev
hopfully you do not get ppls hopes up and then not do it 😳
isnt that what the leaking rule is for xd
this site is rlly cool, i would like all of these
✨ geyser ✨
Yes but that’s for existing java servers, not bedrock servers
Cubecraft moment
Wat
Just do a cubecraft
geyser isn’t used on cubecraft
Well.. our version of bungee/waterfall we use on cc has deviated very far from upstream - we wouldn’t be able to support bedrock players otherwise 🙂
Make java server bedrock
geyser got so good that it can be used as a bedrock server
and tbh there is like no reason to use something like pmmp or nukkit anymore because of it
I mean if you used a bedrock proxy like waterdogpe I’m sure it would work with geyser
bungee works with geyser too
yes
The flow would be geyser -> bungee -> java server in that case tho
vs waterdogpe -> geyser -> java server
dont see a problem there?
I’m not saying there is 🙂
Make geyser a actual server software for bedrock and java
So you don’t have an extra connection????
And each player connection is matched by UUID or xbox ID
So a BootyBooty on Java can be on the server the same time a BootyBooty on bedrock is
but- that would not be geyser anymore then lol
Well then call it
Crater
Cause
That comes after the geyser
but that would lose it's point?
No
geyser is a proxy, not a server software
making it server software, would make it lose its purpose
Basically, and it would be a massive pain to continuously maintain with new Minecraft versions ^^
It’s a proxy for the sake of allowing you to join any java edition server
If you run geyser as a plugin, it directly injects into the netty connection so the same channel is being used rather than there being two netty channels with packets being thrown from one to the other
I see no need for that tbh, just sounds like more work
Yea that runs bad
Yes
But if you did do it like that it could make it look better
For bedrock players
It runs fine
It’s a nice performance boost from not utilizing the same channel
The packet translation time is negligible
Well yea but like
I’ll randomly sit there connecting to a server for 10minutes cause why not
And I can’t use commands without crashing
that has absolutely nothing to do with how packets are translated btw
anyone here who has experience with g cloud, specifically cloud functions?
I need help deploying a function, everything is fine I just do not know how to set up the entry point caller correctly since none of my files is main.py
Idk ik using geyserconnect doesn’t work as well as a server with geyser in it
Cause /fill crashes me
That sounds more like your client acting up
Cube lags like crazy some times
Took me this many attempts on trying to figure out how to rotate an entity's head to my liking using NMS packets ._.
Reason why it took me that many attempts is cause I had no idea how MC calculated the yaw until I stumbled upon this
Make look up too
Weird question but since he showed villagers this is what it reminded me of
In eggwars
Can you make the nametag a 3x3 hitpox instead of a 0.001x0.001 hotbox?
nametags dont have a hitbox
So like it’s physically impossible to place blocks on villager
There is a hitbox above every players head and villagers tho?
There does seem to be a hitbox, but it's not the villager's name, as Redned said, nametags don't have a hitbox. He most likely means the invisible armor stand that holds onto the custom text which does have a hitbox (In Java edition, if you spectate an EggWars game I believe you can see this armor stand)
As for players, there's nothing there that would prevent you from hitting a player behind it
basically what hackers just described ^^
Weird. Iirc, if you try to shoot with a bow through the armor stand the arrow will just bounce off
SO isn't it still possible to make it a 3x3 tho?
That is true too
There does seem to be a bigger-than-usual hit box around the EggWars villager, but it's honestly fine as it is right now
I'm not sure what you mean by a 3x3
why not make a custom entity likew with deathboxes?
however on bedrock you can use newlines on nameplates
if that is what you are asking?
yeah well that's just due to the fact that we cancel block placements right next to the shop 😄
yEA
But
your hitboxes with deathboxes work well
you can hit through them
but not place in them
and since they are stagnant you can't ghost block on or through it
you can also place through
And you can set it up like Dropped entities. where it only loads in within 16blocks over render distance. so it shouldn't affect gameplay
since custom entity, not a player
it shouldn't ruin anything
hello
✨ floodgate ✨
Well yea but that just makes the bedrock player a cracked account
With a Steve with an arm for a hand and hand for an arm
dont know if it has been said but maybe player levels?
maybe also leaderboards but that's bad for CaloriMod so maybe not
Also aren't you worried about abuse for queueing
Like seeing someone's win ratio and quitting if there are good players
you could make that a bannable offense, like hypixel did
it's not like you can easily track something like that
its a message to mod developers tho
Ultimately that's already possible though - theoretically you could go in-game, scan the leaderboards using a mod then make it so it notifies you if anyone in-game has enough wins
Nothing is set in stone then - I'm not guaranteeing or confirming that we will have one anytime soon, just asking that if we did, what people would like to see in it :D
Yea but skins no transfer unless you link your bedrock to java
People already do this
Like SlinkyGnu who will just leave the game if someone he lost against(who is LB) is in the game
- stats
- when joined (if you have that stored)
- active time (calculate it now i guess)
- Online, game playing (sounds cool so ya :))
- level & xp(now this is the most important stat since we can't see it)
- last active
- leaderboard position (if you calculate it after 50)
- in game prefix
- player count
- did player ever join
skins work afaik
will test later
as far as i know
i thought it was a arabic word ngl
@wheat relic just tested it, skins work
does anyone know if there's a site that shows player count of minecraft overtime?
Earth skin never worked for me
can't you just search on google for it
google™️ always works
i got more ideas but they are for when new games come out so i am not telling
can you give me the shadders pls
you could just hook up the forum packet and just use that as api from a client, no need for scaning and stuff
custom geometry skins dont work ofc since thats not a thing on java
but its possible to implement that
Yea so make a bedrock server than java kids can join
Or so only bedrock players see it or just remove custom geometry with a flat one
you can disable that very easily
i am updating this list but it is pointless lmfao
ñ
i am noob, get the dogo checked
I cant even create a snake game in python. The dogs is broken. Sniff.dll is broken
@untold grail if we are "theoretically" geting api, when will it come out
@tawdry radish
but if it does when?
3 years
lmao it got forwarded 1 year ago and yet nothing happend till now
gotta stay optimisic
Hi im trying to screen scrape a web page in java
but i get 403 error
anyone knows how to fix this ¯_(ツ)_/¯
403 = forbidden
that means website got anti bot thing, add delay for your web scraper and it might work
ight will try tho i doubt it works
it might not work since it got anti bot thing
or it might be due to something else
@minor roost i think it is the headers
hmm wdym
it might be that the scrape lib you using uses headers which makes the website think you are a bot
tbh idk
does it send 403 when you request page, or soemthing else?
yea it sends 403 error
but when?
did it send you when you requested the page, or when you requested content
when requesting the page sadly
i see, can't help peace out
yea will use other site thanks for help tho
np
Can't give any answers on that unfortunately - but will see what I can do :D
it would be cool though
btw do you guys store when a player joined cubecraft?
like the date or stuff?
we do!
https://github.com/quartzexpressDEV/CDCC im proud of this ngl
:0 now finaly people gonna be happy to see who is og and stuff if api comes out
let me just make a website template thing for when api comes out
was about to message you about that lmfao
lol
you want to make website?
:D
i can do it
Website template🧐
well
wana learn new stuff while making it?
eh we gonna make stats website, wana join gang
But u don't even know much about the endpoints
only front end
Ohh then alr
backend later
i can make a sketch up of how it would look if you want .-.
lmao that 50$ mango db credit gonna be used now
not right now, but we would need to cache the data to reduse stress on cc api once it comes out
yes

json still superior
mongo db is json
ngl i am hyped
so, what framework we gonna use we gonna 100% use tailwind for css no quesions asked


still hyped though 
tbh api endpoint about when player first joined would bring people who left cause of the birthday event thing
chattriggers rhino
susy baka i am talking abot frontend framework, vue, react, svelte(they said svelte fast)
@untold grail if you do release an API make sure you also release a wrapper for it, at least in Java <3
why you need wrapper, raw http request better
you can even get rate limited for sending too many requests
i will make a deno and rust wrapper .-.
So I do not have to waste time for classes to make these requests and have objects already
deno is js
why make classes
be chad, make requests by /path/to/endpoint
that's not how you work
in java and c# u need classes
JSON is a data format
it would be cool if ben used graphql too 😳
we would not have these issues
but rest better in my eyes
i am gonna make a design brb
Looks like microsoft rewards layout but grayscaled
eh my brain smol, gonna add a graident in the back ground, put the gamertag and there xbox pfp in that circle thing
😳
True
i need help rq
how to get an image's coordinates in html
?
i mean
i can't really just count pixels
w3schools didn't give me a tutorial or a site to calculate/get pixels
Image coordinates?
Send the tutorial you've used :}
I used w3schools
And there's no tutorial for it
And tho... Uh.. There is one but it's so hard
Just go to w3schools, learn html, images, image map, and scroll down a bit
Wow, honestly I didn't even know HTML had sth like this
Which basically means I know nothing about these so I can't help, sorry :/
It's HTML5 👀
That's likely something you will not be able to do with HTML5 alone, you'll need to use Javascript
wdym by image coordinates?
imagine width and height?
@untold grail so who needs to give you go ahead to make the api?
idk if this fits here, my own cpu design running a simple calculator app!
I've been working on it for a few weeks
susy baka
that cool ngl
logisim?
Hello,how do i do successful website?
I want to be helper
But
I dont know how to make a sucessful sebsite
🥺
In a resource pack error it tells me
[ITEM][ERROR]-Missing Icon for data-driven item 'egg:special_egg'.```
how to fix?
If you want to become a helper you need at least 5 website reports. That means you must have at least 5 successful reports of rule breakers on the forums (You can report them here: https://cbecrft.net/bedrockreports)
Or /sr
yes, logisim-evolution
🔫 learn html and css and js
it is for a school project
Tyty
im learning python, my head hurts after a few lessons
I'd be interested to know your thoughts on why that is 🙂
why?
ikr uwu++ oop is way better
the class structure gives makes me loose braincells whenever I
see it
like wth is init
``
it looks alot more clean in languages such as java or c#
a function to construct the class
so thats pythons cunstroctur?
__init__ = initialise method
ok
[ITEM][ERROR]-Missing Icon for data-driven item 'egg:special_egg'.```
How to fix? Owo custom items hot
I want a texture for boomboom egg
you've not added the texture to the item_texture.json
https://wiki.bedrock.dev/guide/custom-item.html#item-texture-and-its-shortname
python is meant to be a simple language and its oop destroys the purpose of it
its better to write python code without using classes
I disagree with you there, OOP is incredibly important with Python to having structured code
But would it be in the folder “egg” or is the name of it called “egg:special_egg.png”
It's telling you your item called egg:special_egg is missing a texture. The link I sent you have a guide on setting up an icon to an item
@spring tiger can i ping play.cubecraft.net to get how many players online?
like every 10 secs .-.
python is not a fully oop language tho
there are libs for that
so I think you can
there are but i am bored i like doing everything by my self .-.
so u dont really need to use its classes in most cases
not realy that hard too tbh
you don't but it's useful sometimes
send this packet
then you get this packet
and bam you got player online count
The only reason it is not fully OOP is because you don't need to write classes to run some code, unlike languages such as Java that require a main. That doesn't discredit its OOP features however, it's still massively useful and important to learn to use
You know
For python being a “simple language” I do see it a lot. Even if it’s not the greatest I see it used for some complicated things
If you want a simple coding language thats something like css or HTML
I think you're putting yourself at a disadvantage not using classes, because they allow you to do all sorts of things such as bundling data and functionality together.
I couldn't imagine trying to write much of the code I do without classes, there would be an incredible amount of hardcoded things..
hmm, i think you can use the dict
not the best practice if you're going for readability and maintainability
yes
there are also more efficient storage methods than dicts
oop was made for better readability + better way to store data so it gud 👍
put it this way, if I use a dict to represent a student:
student_one = dict(name="Student One", age=16, modules=['Maths', 'Science', 'IT'])
There is nothing stopping me from putting in garbage values.
def create_student(name: str, age: int, modules: list):
return dict(name=name, age=age, modules=modules)
student_one = create_student("Student One", 16, ['Maths', 'Science', 'IT'])
student_two = create_student("Student One", 63457, ['Chocolate', 'Coffee', 'Oranges'])
student_three = ...
So by using classes, you can make your code far more readable, but also use functionality to prevent garbage inputs/outputs!
class Student(object):
def __init__(self, name: str, age: int, modules: list):
self.name = name
self.age = self.check_age(age)
self.modules = self.check_modules(modules)
@staticmethod
def check_age(age: int):
if age >= 12 and age <= 18:
return age
raise ValueError('Age must be between 12 and 18')
@staticmethod
def check_modules(modules: list):
# Could add a check to another object that stores all the modules in the school!
if len(modules) < 1:
raise Exception('Student requires at least 1 module!')
elif len(modules) > 5:
raise Exception('Student is on too many modules!')
self.modules = modules
# lots of other methods for manipulating Student
def set_name(self, name: str):
self.name = name
def set_age(self, age: int):
...
cool
@untold grail you don't got anyone for approving it>>
'???
He just wrote this and u just said 'cool' 🥺
@tawdry radish no... Not that-
my brain does not work at 10pm at night
I like python
nah
do it, it gonna be def worth it
:D
umm i have installed it, now what?
learn it
@spring tiger you are my only way
🤔
As in, the coordinates the user clicked on inside the image?
yes
You could use paint software like paint.net to see the coordinates of the picture, then put those in that element
Actually this seems to be the exact tool you're looking for
https://www.image-map.net/
Could anyone help me with a quick SQL question?
I have a test tomorrow and one of the assignments for practice is "Show all information of all employees whose DEPARTMENT_ID is between 90 and 20 NOT INCLUDING those two values"
So I tried:
SELECT * FROM employees WHERE department_id BETWEEN 20 AND 90;
But that INCLUDES the two values. I'd use 21 and 89 but that's not what my teacher wants i think hahaha
We HAVE to use BETWEEN AND btw, cause i looked it up online and it's all suggesting to use a different method
@hearty bloom @plush walrus oi
hallo
hello help
Can you do SQL anyway?
excuse me xdd ofc
well- your profile desc says JS, TS, Java PHP and Elixir but no SQL
and oh Python too
because SQL isnt a coding language
Of course u can
but I dont consider them coding languages
If u cant do HTML then how could you code at all
lol true
I would just do WHERE department_id > 20 AND department_id < 90
you could do: WHERE department_id BETWEEN 20 AND 90 AND department_id NOT IN (20, 90)
but that kinda ugly xd
I'm late
@small hare
and he gon
np
You look shiny in blue
you look shiny in red
anyone used svelte kit?
Anyone knows how to screen scrape with htmlUnit?
hihihihi
just use puppeteer
Need something with java
there is a wrapper i think
@gaunt berry btw we need a logo for CubeStats
is Cube in blue and Stats red gud??
ya we not doing that
we just using text
CubeStats
Ohhh I misread
lol we knew we could get sued for using logo so we just using text .-.
Unlikely you'd be sued instantly, probably a cease & desist first
But it's great you respect the copyright laws 👍
Beautiful
now make it as a nft

Hi gameing gods
am I broken or w3schools won't let me set up my space name?
Space name "name" is not available, please choose another.
the "name"
why..
WOW
random letters actually worked
i don't want that 
@gaunt berry how does this look?
Looks good
i need better dark colors though
i need 10 noice dark colors 
Orange better
imagine using orange theme

also got it just today
should i try to get in 😳
Im the best controller player (;
- ur wrong
- talk in general or smthing
What you making
// keys.js
connect(this) {
return mysql.createConnection({
host: this.host,
user: this.user,
password: this.password,
database: this.database
});
}```
```js
// index.js
const api_keys = require("./mysql/keys")
const keys = new api_keys.Keys();
keys.connect()
SyntaxError: Unexpected token 'this'
have issues importing class in js
you don't need to pass in this like in python

just put the function in the class brackets thing and done
oH
also use import api_keys from "./mysql/keys"
If you are on 1.14+ of node .-.
ye I am on node 16
it better syntax 
yep just use es import since it even gives better suggestions imo
const keys = new Keys() TypeError: Keys is not a constructor
const mysql = require("mysql");
class Keys {
constructor(host, user, password, database) {
this.host = host;
this.user = user;
this.password = password;
this.database = database;
}
connect() {
return mysql.createConnection({
host: this.host,
user: this.user,
password: this.password,
database: this.database
});
}
disconnect(connection){
connection.disconnect()
}
test(){
console.log("func")
connection = this.connect()
console.log("connected")
this.disconnect(this, connection)
console.log("disconnected")
}
}
module.exports = Keys;```
other file?
wait
you need to do
const mysql = require("mysql");
export class Keys {
constructor(host, user, password, database) {
this.host = host;
this.user = user;
this.password = password;
this.database = database;
}
connect() {
return mysql.createConnection({
host: this.host,
user: this.user,
password: this.password,
database: this.database
});
}
disconnect(connection){
connection.disconnect()
}
test(){
console.log("func")
connection = this.connect()
console.log("connected")
this.disconnect(this, connection)
console.log("disconnected")
}
}
rather then using module.exports
but I am using CommonJS

nvm fixed
oh ok
module.exports = Keys; --> module.exports.Keys = Keys;
maybe i am using to much deno
also use deno, why you using node 
you also could do
module.exports = { Keys };
:)
:0
but module.exports = Keys should work if he did
import api_key from "./mysql/keys" 
😳 new video from fireship
https://www.youtube.com/watch?v=xT8oP0wy-A0
Kotlin is a programming language designed as a modern alternative to Java. It supports functional patterns, coroutines, multi-platform compilation, and is now the recommended language for Android mobile development.
#programming #android #100SecondsOfCode
🔗 Resources
Kotlin Docs https://kotlinlang.org/
Kotlin on Android https://developer.and...
Cause Ive done something that may be similar
cursed_python
that more cursed than my life
nice constructor
And devs/ mods etc by chance can yiu add the snowman tag gamemode from last yesr again for this christmas? It was incredibly fun!
it gonna be there 🤫
Tysm! <3
am not cc dev though, this is not the channel to ask about that stuff too
Sorry, I just joined by chance can I be informed which channel is?
how to code🙂
what do you want to code
@tawdry radish not the kind of welcoming attitude I want to see here 😄
sure, but telling someone to not ask and just go on youtube is not really a nice way to start off 😛
how else would you be able to help, since you can't realy explain a whole programing language in a discord chat
for a start, asking what anderson just asked and find out what they're interested in
i see
then as you've probably seen me already do, introduce them to easy-to-learn sites
youtube is not always a good option, because its hard to tell from a thumbnail if its easy or not. I especially do not like the "learn this language in 1 video of 6 hours long" because programming can't be taught in such a crammed time
but before that
i read this, that why i gave vague answer
everyone is welcome here to talk about code regardless of experience, don't want to scare them off and make this channel feel like an exclusion zone only for experienced programmers to talk in
oke
let me just make a message listing some stuff then since everyone be asking vague questions :/
since everyone has been asking vague quesions like "how to code"
Pick one language from the list below and ask "how do i get started coding in <language>"
that would be much better since we know what you want to do :)
game development: c#, python
web development: html, css, js (learn all 3 of them cause yes)
app development (win, android, ios, etc): dart / flutter, swift, java
ml: python
all the categories are like general stuff which most beginners want to learn so I put them in, if you want to do stuff in an category that is not in the list then you can ask about how to get started in that category :)
About this, usually I would send a good video or website but I got muted for sending rust-lang book url, since then am not sending links any more, also I got muted when I was trying to get it whitelisted :/
Yea @tawdry radish go watch youtube to learn how to be a nice person smmhhh
Agreed the bot do be kinds bad sometimes
the bot blocks any link other than the ones we have whitelisted
this is far easier than us just blacklisting links, because so many new discord scam links are being posted everyday
feel free to message me the link so I can add it, or post the link in a format that it wont get automatically deleted i.e python dot org
just math pretty much
Yeah correct
the amount of xp needed for each level is known
thats pretty neat
Yeahh
may I ask which bot is it
my bot
Oh, interesting
Just asking because I've already seen bots that do that too
Oh interesting
but looks really cool!
Thanks :D
Hey, could someone explain to me why does the last return not being returned if keys.check() is true?
function api_key_is_valid(req, res) {
const api_key = req.get("Authentication");
if (keys.check(api_key, function(err, result) {
if (result == false) {
res.status(403).send({"message": "403: Forbidden"});
return false
}
}))
return true;
}```
Not much i can understand but is it because you forgot to put an else statement?
but the return is at the bottom
so it should be ran if nothing has be returned before
Oof i have no idea- if it was python, the code would have stopped running if it ran into an error unless the error was handled using something
well there is no error, the code is just running not the way I'd want 😃
Have bot click link and check if the site is secure or not. Owowo
There's not really a way to do that consistently, and seems a bit of an excessive approach to the problem xd
It won't let me send a domain name in staff help for it to get whitelisted
try "domain dot com"
Or smth like that
I sent a list of domains to get added to whitelist but I got muted in staff help instead ._.
Yeah, it will mute you for that, hence I said you can message me/a staff member privately or format them differently @tawdry radish
put them in a text file
There is a new type of scam where everyone in a server gets a crypto scam in dms using spam bots
Ok
We can't stop the DMs being sent, because it's in a private conversation
Na this one is a virus now
It on different level
Every day a partnered server gets hit with this
Or big server
Add youtube auto flag feature on sites and bot clicks them
Over engineering best engineering
Doing bare minimum bad always do the best
can you guys reduse mute time for links
since every discord steam scam is gonna only send a link once
in every channel
hmm what lib you using?
i suggest you just console.log() in every block of code so you know where code breaks 
Express
i see, have you tried console.log() in every block?
I'll try
@plush walrus i think you should put brackets around return true
not the issue but better to work with that
So I changed my code a little and now the issue is, the statement is returned before defined, hence this console output:
sql res - true```
```js
function api_key_is_valid(req, res) {
const api_key = req.get("Authentication");
var key_presence = check_key_presence(req, res);
if (key_presence) {
var _res = keys.check(api_key, function(err, result) {
console.log("sql res - " + result);
return result;
});
console.log("returned _res - " + _res);
if (_res == false) {
res.status(403).send({"message": "403: Forbidden"});
return false
} else {
return true;
}
}
}```
well can you send keys.check code
the issue is there
@plush walrus alr simple fix would be
function api_key_is_valid(req, res) {
const api_key = req.get("Authentication");
var key_presence = check_key_presence(req, res);
if (key_presence) {
let _res;
keys.check(api_key, function(err, result) {
console.log("sql res - " + result);
_res = result;
});
console.log("returned _res - " + _res);
if (_res == false) {
res.status(403).send({"message": "403: Forbidden"});
return false
} else {
return true;
}
}
}
since keys.check does not return anything and the function passed in's parms are result and err
you could just throw an error (or do something with the err)
if it returns a result
Just making _res = result would fix it
check(key, callback){
const hashed_key = createHash("sha256").update(key).digest("hex");
var connection = this.connect()
connection.query(`SELECT user_id from api_keys where api_key = '${hashed_key}';`, function(err, result){
if(err) throw err;
if(result.length == 0){
callback(null, false);
}
else{
callback(null, true);
}
});
this.disconnect(connection);```
does not really fix it
aka same result
hmmm
@plush walrus first of all
just remove callback function and return true or false
since err is not used
this
so
first of all you don't need callback function (even if it is async or await)
you could just return true or false
function check (key) {
//..
let res;
connection.query(`SELECT user_id from api_keys where api_key = '${hashed_key}';`, function(err, result){
if(err) throw err;
if(result.length == 0){
res = false;
}
else{
res = true;
}
});
//..
return res;
}
function api_key_is_valid(req, res) {
const api_key = req.get("Authentication");
if (keys.check(api_key))
{
return true;
} else {
res.status(403).send({"message": "403: Forbidden"});
return false
}
}
^^ this should fix everything (unless connection.query function is async)
@plush walrus check again i forgot something
alright
so did it fix everything?
hm not really
I get 403 even if sql query returns true
console.log("key check - " + keys.check(api_key))
if (keys.check(api_key)) {
return true;
} else {
res.status(403).send({"message": "403: Forbidden"});
return false
}
}```
`key check - undefined`
I am afraid that connection.query() is async
that's why I was using callback
you should not do that
@plush walrus can i get docs?
Uh I am not sure where the docs are but here is the github repo:
https://github.com/mysqljs/mysql
my brain stoped working
@plush walrus why do you need to return true or false after sending response?
because this is a function to check if key is valid
if it is, other code executed
i see
am sorry i can't realy help you rn, i have to study, anyways i think you can fix this issue by using a promise (not sure though)
_gud video - https://www.youtube.com/watch?v=RvYYCGs45L4_
yup, that has fixed it issue
Although the code is pretty crappy rn, it works 
:0
The code if anyone is interested:
check(key) {
const connection = this.connect();
const api_key = createHash('sha256').update(key).digest('hex');
return new Promise(function(resolve, reject) {
connection.query("SELECT user_id FROM api_keys WHERE api_key = ?", [api_key], function(err, rows) {
if (err) throw err;
if (rows.length > 0) {
resolve(true);
}
else {
resolve(false);
}
});
connection.end();
});
}``` ```js
function api_key_is_valid(req, res) {
const api_key = req.get("Authentication");
if (check_key_presence(req, res)) {
return new Promise(function(resolve, reject) {
keys.check(api_key).then(result => {
if (result) {
resolve(result);
} else {
res.status(403).send({"message": "403: Forbidden"});
resolve(result);
}
});
}
)} else {
return new Promise(function(resolve, reject) {
resolve(false);
});
}
}```
btw rather then using function(resolve, reject){} you can just use (resolve,reject) => {}
also use let rather then var since var will add the variable to global object and let will only add it to scope
where exactly?
every where
you can declare a function with no name using an arrow
ye I was following like const for variables that are not gonna be changed and var for everything else lol
you could use this syntax on normal functions too
// arrow syntax
let func = () => {}
// normal syntax
function func() => {}
i mean still use const for variables that are not gonna change, just change var to let .-.
alright, thanks!
@dawn parcel send forumula here
huh
ill give you some hints of it!!
- Cubecraft levels start at requiring 1000 xp to complete level 1
- Each level you advance, 200 xp is added to gain to advance to the next level, example: level 1: 1000 xp, level 2: 1200 xp....
hmm
@tawdry radish apply the arithmetic progression formula, basically divide the required xp by the winning xp
Also this if statement should give an input error if required < 0 or xp < 0:
so
f(x) = 800 + (x * 200)
x is level
Oh
what output does this give?
Does it give the required xp
ya
And what is 800
800 for first level
no
yes
800 isnt for the first level
yes
it is 1000
its right
let me walk you through it
there are multiple ways
f(x) = 800 + (x*200)
lets say x = 1
800 + 1 * 200 = 1000
lets say x = 2
800 + 2 * 200 = 1200
lets say x = 3
800 + 3 * 200 = 1400
proof
what you used?
i think i am understanding that one
what is An?
An = Number of terms or a specific term
i see
an could be replaced with Term number basically
So like Term5 = The First Term of the sequence + (Term4)*Difference
i changed the formula into simpler words xd
so
lets say x = 1
1000 + (1-1)200?
x = level
oh
level 1
eh my formula better since one addition and multiplication
Yes
both are fine
first one faster .-.
your formula is more straight forward than mine
yes .-.
anyways
you know js?

i mean i can do a little bit of js
mm
the only thing i have done in js is a bot with a ping command and a purge command
thats it!
you know about css and html then?

uwu++??
uwu ++
Really-
its really good
its a real language

you cant really do much with it but it works
lol
:0
🙏 rip
may god have mercy on us
you need to pass in a html file?
he deleted the github repo 
you should ping a mod about that stuff :)
not that you can't ping admins about it, but you mostly won't get reply if you ping admin
sorry lol
hey
hi
elo
@dense zinc i am your first github star 
Thanks haha
I don’t do open source much
i stared your about me page
Thank you I’m famous now
np ;)
@gaunt berry press ctrl + k on github weebsite
i liek new feature 
i can finaly look through my repos without going to my profile
what does it do
^
im in school rn i cant really test it
Hi
bro what is this
it predicts exactly what i want
with the correct variable name
with the correct everything
im in love
have you pressed ctrl+space, it will show you multiple solutions
i think thats the shortcut on vscode
it isnt
ctrl+enter?
alt + ]
according to the docs
but ctrl enter works too
dont really need it tho when it gets the right one every time
yeah alt + ] and alt + [ is to cycle them there and then
sometimes ctrl+enter can have a better solution when you read them than the one that it immediately suggests you in the code
I still can't figure out the shortcut in intellij
for >2 years that i'm using it
im just spamming my keyboard with stuff and hoping it pops up xd
oh no
ive been trying to fix this bug for like 2 hours
only to then realize i forgot a promise
THANK U JAVASCRIPT VERY COOL
oof
use typescript 
@dawn parcel oi can you send me invite to your bot in dms not here
_the lvl calc thing
_
js > ts
The bot isn't public.
It only works for whitelisted servers :O
_send meh invite to testing server 🔫 _
send me link to public server then
Okay sure 👍!
@gaunt berry https://www.youtube.com/watch?v=U3aXWizDbQ4 les go we got c in 100 seconds
The C Programming Language is quite possibly the most influential language of all time. It powers OS kernels like Linux, Windows, and Mac and many other low-level systems. Its syntax has inspired many other languages, including Cpp, Csharp, Java, JavaScript, Go, Perl, and more.
#programming #compsci #100SecondsOfCode
🔗 Resources
C Manuel h...
print f be like
int c = 0;
c++;
int c = 0;
c--;
why does python live on land?
because it is above c level
Lol
That is literally me
I spent like 3hours working on code and it turns out I just forget one ,
Ew that reminds me I use to make android apps
And I was spending so much time on trying to open the calculator in the notes app
And I forgot 1 thing
But I made a hot browser app too
this why i don't even use a programing language if it does not have a linter 
linter op
make joke simpler
It tells me what is going wrong in coding software but half the time I don’t use it it just depends
Some times I’ll use Intelliji or whatever it’s called
Or I’ll use a notes app
use vscode 
My guy
I like me wae better cause it was the way I was doing it in skool
In a notes app that has a preview screen
you shall suffer cause of that 
Python and c are coding languages and this joke "explains" why python is better
Its not funny if I explain it though xD
Is it tho?
Idk you tell me
Idk I never used them XD
pythong not gud change my mind
Entirely depends on your use case 🙂
no {} = bald 
reee this took me 4 hours to find out what the error was
gonna start making client soon tho 
😮
GL
lmao just typed git vommit by accident and looks like I'm not alone 
https://github.com/JoeNyland/git-vommit
lmfao
git vomit
me and the bois
9223372036854775807
january 1st, 1970
Ooo very spoopy
Anyone has an idea why flask.request.remote_addr always returns 127.0.0.1 even when running on a server (gcloud app engine) and using waitress for running
from waitress import serve
serve(app, host="0.0.0.0", port=5000)```
https://flask.palletsprojects.com/en/2.0.x/api/?highlight=request%20remote_addr#flask.Request.remote_addr
this might be a solution to your question: https://stackoverflow.com/a/22936947
route = request.access_route + [request.remote_addr]
raw_ip = next((addr for addr in reversed(route) if addr not in trusted_proxies), request.remote_addr)```
does not seem to work
guys does anyone know how cc connects players to difference proxys?
By code
but what code
Cubecraft code
what cubecraft code 
.
i mean like
how you guys connect players to as proxy, us proxy and eu proxy? with one ip
and we even get different ping in different regions so i assume something happens 
Bungees in different regions
Matchmaking thread explains the info we use to put you into the correct region
https://www.cubecraft.net/threads/behind-the-cube-4-matchmaking-madness.292726/
i did not mean match making
I ment like when players join the server
how do they get connected to different regions proxy with just one ip when you just join one ip
Hello
elo
me and the bois don't have to worry thinking internet is down anymore
I'm gonna pretend like it has NEVER happened to me and like I haveve NO IDEA what that site is about
i don't have to pretend since i never typed github _its pined 😉 _
Imagine
printnbr = (n Number::Integer) {?n<0{print('-');printnbr(-n)}??n>9{printnbr(n/10);printnbr(n%10)}?!{print('0'+n)}}
console.log('hello world');
I guess I'm a programmer now...
Wait.... minecraft development is java right?
Not necessarily 😋
console.log('ikr >:) i just cut my finger with a sharp thingy oof');```
so i can develop minecraft plugins with JS?
Depends on the server
Yes you can
Console.log('oof, that must have hurt');
in theory
I've done it
in reality youd use papermc anyway which is java
Depends on the software like I'm not sure which this runs off but a good amount of stuff is done in pmmp which is PHP
console.log("ah, sorry, i forgot to introduce myself. My name is one punch man, what about you?");```
pmmp sucks butt
my whole life is a lie...
literally every other software is java
Cap
nah
you can do anything with any complete language
How bout all bedrock things?
Console.log("most people know me as 'matriox is pro'")
even scratch if you can somehow add some io
bds and pmmp are like the only softwares that arent java
Fair enough
What about custom softwares though?
console.log('sheeeeeeeeeesh, you famous *jealous face*');```
guys try C
we cant count those
it's simple and efficient
True
Never really seen a language of c# but I imagine that it would be pretty good
console.log("yo look what I've learned right now")```
```JS
let aa = "aa"
console.log(aa + ">:)")```
use ``
gtg applying to join the dev team for cubecraft
pls
quit javascript
C by default
I'm learning java rn, but on Spigot API
Personally I prefer c#
js best
Cap
it's decent, better than the kids js


