joharasmus / botsproject Goto Github PK
View Code? Open in Web Editor NEWThis project contains bots made for the programme IT-Spåret on Ädelfors Folkhögskola
This project contains bots made for the programme IT-Spåret on Ädelfors Folkhögskola
Worky currently publishes lots of ads that aren't relevant to us. I think we could add a few filters to get a better experience.
Add some doc-comments for clarification of the code.
It might be useful to have some way of informing other users on discord when a (major) push to this repo has been merged. I'm open for suggestions on the exact implementation of this service. Another bot? A webhook? Manual service? Smoke signals? Morse code? Just brainstorming...
Python is, have always been, and will always remain a dynamically typed language (with its own pros and cons). The last few versions of Python have tremendously refined its type hinting capabilities, though. One might ask then, what is type hinting? Well, it is the practice of introducing the syntactics of static typing without the semantics associated with it. In Python this is primarily used when writing function/method signatures.
Why do this? After all, type hinting is purely syntactical and doesn't make a difference when running code. Well, the primary reason is its versatile integration with the PyCharm IDE, which alerts the programmer when they write code that uses return types / parameters in a way that conflicts with their expected type. This leads to significant improvements regarding maintainability and readability.
The current implementation of Worky is lacking in some aspects, one of them being its statelessness. This leads to a few issues:
Those problems could be resolved by building a DB-backed stateful solution. The Platsbanken API documentation on GitLab recommends the usage of a dedicated SQL server which, considering the expected usage in this case, probably is overkill. The most trivial alternative implementation would be storage in raw .json files which could be manipulated directly by the Python stdlib. If that is too slow for us (most likely not!) we could try out a MongoDB(NoSQL)-backed storage. It would be more performant but also require more configuration and development.
I would recommend the first implementation (reading to / writing from raw .json files).
The current Python codebase is very fragile. Touch something, change some part, and it will fall apart in not-very-pretty ways. That could be remedied by adding simple exception handling, which would send a message to a dedicated bot-chat channel on the Discord server. The only way of knowing whether something bad has happened, currently, is the status of the bots - which is worse than printf-style debugging.
While not strictly code-related, it would be nice to move the bots to a discord team, in order to enable token sharing between members of the team. We might need 2FA for that, though maybe that only applies to me.
Setup the action runner to be hosted on the GCP instance - this would result in a much cleaner deployment, without SSH (hopefully)!
The bots are currently heavily uses code duplication and several other poor coding techniques, "smells". A thorough refactor could alleviate parts of this. A few suggestions of possible improvements (to get us started) are:
Do not hesitate to present other ideas (based on object oriented analysis, design patterns or principles)!
Since I've figured out that there's actually a free-forever offer on GCP (= Google Cloud Platform), I'm thinking of migrating this code to there. That would also make accessible a much wider range of choices for Operating Systems and software configurations, e.g. Ubuntu 22.04 - which supports recent versions of Python.
Primarily I would see this as an opportunity to get away from Oracle Linux, which has its own assortment of quirks (did someone mention dnf?).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.