Giter Site home page Giter Site logo

pauljac3-mastodon-bot's Introduction

pauljac3

The official bot for Pauljac3. Supports Mastodon and Bluesky. (and twitter now lol)

TODO

  • Random replies.
  • Timeline streaming. (probably not going to happen lmao)
  • Keyword replies.

Contribution

Any help with the development of the bot is extremely appreciated! You can submit bug reports and feature requests by using this repository's issues page. You can also submit pull requests (when I enable it) to contribute your own fixes and changes.

For historical reasons, issues and pull requests which modify the bot's posts will be deleted. With that said, you're more than welcome to create your own spinoffs of the bot!

Development

Preparing your environment

  1. Clone this repository.
  2. Copy .env.example to .env and fill with your development accounts' information.
  3. If IntelliSense is important to you, run the bot to download and cache modules with deno task start.

Before submitting pull requests

You must run deno task lint and deno task fmt before submitting your pull request. Additionally, deno task lint should return no errors.

pauljac3-mastodon-bot's People

Contributors

yeenbean avatar

Watchers

 avatar

pauljac3-mastodon-bot's Issues

Remove obsolete script files

The script files located in the project root were previously used to launch the bot. However, these scripts are now considered obsolete. Instead, the command deno task start should be used, as it is a cross-platform solution that replaces the previous scripts.

Implement post reply functionality

The bot currently lacks the ability to respond to posts. It is necessary to implement this feature, along with a dedicated file named "reply_file.txt" to store the replies.

Implement docker support

This is really to resolve the issue with the bot not starting automatically when I upgrade the container it runs in or the host machine. We are tired of pauljac being down!

Bot crashes during heartbeats if social service returns an error

The bot is crashing during heartbeats when a social service returns an unknown error which the bot cannot process. The code needs to be refactored to handle this sort of scenario correctly.

Below is an example of errors I've encountered when this occurs.

    09:45: Heartbeat
error: Uncaught MastoUnexpectedError: The server returned data with an unknown encoding. The server may be down.
    at HttpNativeImpl.<anonymous> (file:///Users/yeen/Library/Caches/deno/npm/registry.npmjs.org/masto/6.1.0/dist/index.js:927:27)
    at Generator.next (<anonymous>)
    at file:///Users/yeen/Library/Caches/deno/npm/registry.npmjs.org/masto/6.1.0/dist/index.js:76:71
    at new Promise (<anonymous>)
    at __awaiter (file:///Users/yeen/Library/Caches/deno/npm/registry.npmjs.org/masto/6.1.0/dist/index.js:72:12)
    at HttpNativeImpl.createError (file:///Users/yeen/Library/Caches/deno/npm/registry.npmjs.org/masto/6.1.0/dist/index.js:923:16)
    at HttpNativeImpl.<anonymous> (file:///Users/yeen/Library/Caches/deno/npm/registry.npmjs.org/masto/6.1.0/dist/index.js:906:34)
    at Generator.next (<anonymous>)
    at fulfilled (file:///Users/yeen/Library/Caches/deno/npm/registry.npmjs.org/masto/6.1.0/dist/index.js:73:58)
    at eventLoopTick (ext:core/01_core.js:183:11)

Time synchronization is ridiculously CPU intensive

come on man stop this nonsense

// Before triggering the heartbeat, we want to synchronize the thread so that the heartbeat starts at the top of the minute.
const now = new Date();
let next: Date;
if (now.getMinutes() == 59) {
if (now.getHours() == 23) {
next = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
0,
0,
0,
0,
);
} else {
next = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
now.getHours() + 1,
0,
0,
0,
);
}
} else {
next = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
now.getHours(),
now.getMinutes() + 1,
0,
0,
);
}

Create args for manually triggering functions

The idea is to make a few optional arguments to manually trigger functions, then exit once the function finishes its task. This will be useful when the bot is moved to a production server. We can leverage cron to get more precise timing with posts and responses, and it should hopefully reduce overhead since the bot won't be constantly running.

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.