Giter Club home page Giter Club logo

botto-js's People

Contributors

williammck avatar garlic-os avatar

Stargazers

overlisted avatar Gabe Macken avatar Andrew avatar Andrejs Agejevs avatar Artha avatar  avatar  avatar  avatar  avatar kittum94 avatar Cezary Drożak avatar

Watchers

Gabe Macken avatar

botto-js's Issues

Stop storing data in files

I'd like to move the bot away from requiring persistent storage, so that in the future it can move into a Kubernetes cluster or other PaaS solution.

A/C:

  • Configuration (keys and channels) are moved to environment variables
  • Coin balances and message cache is stored in some sort of data store (postgres and redis, respectively? postgres for both?)

Empty generated messages restart the bot

Currently, we attempt to send all messages regardless of length to Discord's API.
As empty messages return a 400, and we don't catch that exception, the bot errors out and gets restarted.

A/C: Empty messages are no longer sent to Discord

Sending messages to channels without requisite permissions result in a restart

We don't currently have checks in place for whether we're able to send messages to a given channel.
Because of this, if a channel we're observing doesn't grant us send permissions, the bot will crash out and restart.
We should ideally check this before even generating a message, as otherwise we're spending useless cycles when another channel could instead get a message.

A/C: Stop generating messages for channels we can't send in

no such file or directory, open "[...]/cache/messages.json"

When freshly cloning the bot and attempting to run it for the first time with node . in the root project directory after filling in the discord token config and channels config, it will just throw this error:

node:fs:573
  return binding.open(
                 ^

Error: ENOENT: no such file or directory, open '/mnt/c/Users/letters/Projects/botto-js/src/discord/../../cache/messages.json'
    at Object.openSync (node:fs:573:18)
    at Object.readFileSync (node:fs:452:35)
    at #load (/mnt/c/Users/letters/Projects/botto-js/src/discord/cache.js:62:24)
    at new DiscordCache (/mnt/c/Users/letters/Projects/botto-js/src/discord/cache.js:13:15)
    at Object.<anonymous> (/mnt/c/Users/letters/Projects/botto-js/src/discord/cache.js:80:18)
    at Module._compile (node:internal/modules/cjs/loader:1434:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
    at Module.load (node:internal/modules/cjs/loader:1249:32)
    at Module._load (node:internal/modules/cjs/loader:1065:12)
    at Module.require (node:internal/modules/cjs/loader:1271:19) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/mnt/c/Users/letters/Projects/botto-js/src/discord/../../cache/messages.json'
}

Only config issue I can imagine is that I'm not providing any of the reddit config keys since I'm working on the discord part, but I can't see that causing this issue?
I'm using an Arch WSL2 instance on Windows 10

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.