Git Product home page Git Product logo

botsproject's People

Contributors

joharasmus avatar

Watchers

 avatar  avatar

Forkers

smoozie

botsproject's Issues

Discord message upon bot update

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...

Google Cloud Platform

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?).

More robust code

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.

Stateful Worky

The current implementation of Worky is lacking in some aspects, one of them being its statelessness. This leads to a few issues:

  1. Worky is "stupid" in the sense that it repeats recently created/updated ads on restarts.
  2. Worky will miss ads if the hosting cloud platform goes offline for some time.

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).

Python type hints

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.

Discord teams

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.

More relevant work ads

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.

Refactor bots

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:

  1. Reimplement the bots using OOP design, as in the official Discord.py documentation.
  2. Extract common functionality to a "base" bot class, and let our specific implementations inherit from it.

Do not hesitate to present other ideas (based on object oriented analysis, design patterns or principles)!

Self hosted action runner

Setup the action runner to be hosted on the GCP instance - this would result in a much cleaner deployment, without SSH (hopefully)!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.