Code Monkey home page Code Monkey logo

discordshim_rs's Introduction

discordshim_rs

Purpose

The purpose of this project is to act as a middleware between the OctoPrint-DiscordRemote plugin and discord. Originally, the plugin used discord.py, however, as discord.py advanced, it started to drop support for older python version. Separating the Discord and Octoprint parts of the plugin was the solution chosen, however, it has a few pros and cons:

Pros

  • Complete separation and decoupling of discord and plugin.
  • Simpler API, but only supports a subset of discord functionality.
  • Multi-tenant, a single DiscordShim can support multiple Octoprint plugins
  • No more requirement on creating a discord bot, new users can just use the existing bot
  • Power users can self-host DiscordShim for themselves.

Cons

  • There are privacy concerns, as the central DiscordBot sees all messages on all servers that it is added to.

Installation

Fastest way to setup the bot is to use the Docker Compose scripts.

cat <<EOT >> .env
BOT_TOKEN='$LIVE_BOT_TOKEN'
EXTERNAL_PORT=23416
EOT
docker-compose up --build -d

Development

CI

CI is hosted on a private gitlab, this is a mirror. If you wish to make a contribution, make a fork and MR as per standard github processes, and the merge will be made by the myself manually.

Testing

Rust Unit Tests

There are some rust unit tests, but no where near covered well enough.

Run with cargo test

Python System Tests

The python tests allow testing the shim end-to-end.

Run with:

# Start DiscordShim
BOT_TOKEN=$LIVE_BOT_TOKEN cargo run

# Start tests
BOT_TOKEN=$LIVE_BOT_TOKEN DISCORDSHIM_ADDR=127.0.0.1 DISCORDSHIM_PORT=53416 pytest

discordshim_rs's People

Contributors

cameroncros avatar slashlogin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

discordshim_rs's Issues

error: failed to select a version for the requirement `zip = "^1.2.1"`

Me again. Updated today and tried to build the latest version. I get the following error message using docker-compose up --build -d:

Step 10/18 : RUN cargo chef cook --release --recipe-path recipe.json
 ---> Running in c22c20052080
    Updating crates.io index
error: failed to select a version for the requirement `zip = "^1.2.1"`
candidate versions found which didn't match: 2.1.3, 2.1.2, 2.1.1, ...
location searched: crates.io index
required by package `discordshim v0.0.1 (/app)`
if you are looking for the prerelease package it needs to be specified explicitly
    zip = { version = "0.10.0-alpha.1" }
perhaps a crate was updated and forgotten to be re-vendored?
thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-chef-0.1.67/src/recipe.rs:218:27:
Exited with status code: 101
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ERROR: Service 'discordshim' failed to build: The command '/bin/sh -c cargo chef cook --release --recipe-path recipe.json' returned a non-zero code: 101

I changed the Cargo.toml file to 2.1.3 for zip package. It compiled and started, but I am not sure if that is the correct way to fix this error?

version `GLIBC_2.34' not found

Did a git pull to get latest code, did a docker compose down, and then docker compose up --build -d. It compiled and downloaded a few programs. All seemed to go well and it said container started. However it stops with an error:

✔ Network discordshim_rs_default          Created                                                                0.1s 
✔ Container discordshim_rs-discordshim-1  Created                                                                0.0s 
Attaching to discordshim_rs-discordshim-1
discordshim_rs-discordshim-1  | /usr/local/bin/discordshim: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/local/bin/discordshim)
discordshim_rs-discordshim-1  | /usr/local/bin/discordshim: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/local/bin/discordshim)
discordshim_rs-discordshim-1  | /usr/local/bin/discordshim: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/local/bin/discordshim)
discordshim_rs-discordshim-1 exited with code 0

I am not very familiar with compiling docker containers myself. It was working before the latest code.
EDIT I tried on another machine and got the same error. Also tried going back a few commits and still have the same error.

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.