Giter Club home page Giter Club logo

dash2's Introduction

Dash 2

A cleanroom rewrite of Dash on Lightbulb and Hikari.

Changes are documented in the changelog.

Installing

Running is easy if you have just and [Nix](https://nixos.org] installed.

direnv, and direnv-nix are also helpful, but not required.

OCI/Docker container with Nix

docker load < $(nix build .#dash-container)
# Jump to "Configuration", then run the container the normal way

Executable with Nix

nix build .#dash
# Jump to "Configuration", then...
./result/bin/dash

Manually without Nix

Install Poetry.

Copy the file named example.env in the root of the project to .env and modify it.

Alternatively, you can also use your hosting platform's method for setting environment variables.

Ensure you have a Discord bot token, then paste it into the DISCORD_TOKEN key.

Then, obtain a Giphy API token and paste it into the GIPHY_TOKEN key.

And, finally, run this to run the bot:

poetry install
python3 -m dash

Configuration

The bot is configured entirely through environment variables. Sample values are provided in extras/example.env.

Command prefix

DISCORD_PREFIX controls what the prefix of the commands is. It defaults to _.

Example value: ?

MediaWiki instance

MEDIAWIKI_API and MEDIAWIKI_BASE_URL control the API URL and the MediaWiki base URL for the MediaWiki extension.

MEDIAWIKI_API example value: https://ftb.fandom.com/api.php

MEDIAWIKI_BASE_URL example value: https://ftb.fandom.com/wiki/

Tokens

Ensure you have a Discord bot token, then set it in the DISCORD_TOKEN variable.

Then, obtain a Giphy API token and set it in the GIPHY_TOKEN variable.

Development

Install Nix, then use nix develop. If you have direnv and nix-direnv installed, you can use direnv allow and have the shell environment activated automatically.

dash2's People

Contributors

tomodachi94 avatar

Watchers

 avatar

dash2's Issues

Clarify tag names in bunny command

The command sometimes returns non-bunny output, for example:

Cocoon hatching, via Yoyo The Ricecorpse on GIPHY

In the upper right corner, there is an illustration of a bunny by a child. However, the GIF itself is of a cocoon.

Docstrings

Various commands are missing "docstrings", which show a short description in the help command:

Bot help
Uncategorised
โ€ข about -
โ€ข help - Displays help for the bot, a command, or a category.

Use _help [command] for more information.

Todos

  • Add docstrings to about command

Heroku deployment broken after extensions migration

Heroku deployment doesn't appear to work.

The behavior of the os.getcwd function appears to return /app/, whereas on a local machine it is /home/me/dashproj/dash. Note that the dash folder at the end, which contains the project's entire source, has been excluded from os.getcwd on Heroku.

Logs

Heroku

app[worker.1]: Thank you for using lightbulb!
app[worker.1]: Traceback (most recent call last):
app[worker.1]: File "/app/dash/main.py", line 20, in <module>
app[worker.1]:     bot.load_extensions_from(DASH_EXT_PATH)
app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/lightbulb/app.py", line 586, in load_extensions_from
app[worker.1]:     raise FileNotFoundError(f"'{path}' is not an existing directory")
app[worker.1]: FileNotFoundError: 'ext' is not an existing directory
heroku[worker.1]: Process exited with status 1
heroku[worker.1]: State changed from up to crashed

Debugging

$ heroku run python
Python 3.9.7 (default, Aug 30 2021, 22:04:11) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.abspath(os.getcwd())
'/app'

Workarounds

  • Detecting if the environment is Heroku and adapting to the platform seems like a rather hacky solution.
  • Hardcoding paths and recursively checking each one for a folder named ext. Again, rather hacky.
  • Cross fingers and hope this is a bad dream ๐Ÿคž

Changelogs

Changelogs allow users to see what has changed. Perhaps we should start keeping one?

Todos

  • Add backlog of changes made
  • Start using GitHub Releases

Run instructions

The bot is missing various instructions on running and usage.

Todos

  • Add run instructions to README

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.