Coder Social home page Coder Social logo

cycle-five / cracktunes Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 2.0 5.1 MB

A hassle-free, highly performant, host-it-yourself Discord music bot with YouTube and Spotify support. Powered by yt-dlp and crackling Rust code.

Home Page: https://cracktun.es

License: MIT License

Dockerfile 0.43% Rust 99.02% Shell 0.51% Nix 0.04%
bot discord discord-bot music music-bot rust

cracktunes's Introduction

CrackTunes

A hassle-free, highly performant, host-it-yourself, cracking smoking Discord music bot

builds.sr.ht status GitHub CI workflow status Dependency status MIT License Rust Version

Aknowledgements

Thanks to the guys over at alwaysdata for hosting the website, web portal, email, etc for this project for free, in their Open Source program.

Deployment

Usage

  • Create a bot account
  • Copy the token and application id to a .env with the DISCORD_TOKEN and DISCORD_APP_ID environment variables respectively.
  • Define DATABASE_URL, PG_USER, PG_PASSWORD for the Postgres database.
  • Optional define SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET for Spotify support.
  • Optional define OPENAI_API_KEY for chatgpt support.
  • Optional define VIRUSTOTAL_API_KEY for osint URL checking.
  • Use .env.example as a starting point.

Docker FIXME

docker run -d --env-file .env --restart unless-stopped --name cracktunes ghcr.io/cycle-five/cracktunes:latest

Development

Make sure you've installed Rust. You can install Rust and its package manager, cargo by following the instructions on https://rustup.rs/. After installing the requirements below, simply run cargo run.

Linux/MacOS FIXME

The commands below install a C compiler, GNU autotools and FFmpeg, as well as yt-dlp through Python's package manager, pip.

Linux FIXME

apt install build-essential autoconf automake libtool ffmpeg
pip install -U yt-dlp

MacOS FIXME

brew install autoconf automake libtool ffmpeg
pip install -U yt-dlp

Windows FIXME

If you are using the MSVC toolchain, a prebuilt DLL for Opus is already provided for you.
You will only need to download FFmpeg, and install yt-dlp which can be done through Python's package manager, pip.

pip install -U yt-dlp

If you are using Windows Subsystem for Linux (WSL), you should follow the Linux/MacOS guide, and, in addition to the other required packages, install pkg-config, which you may do by running:

apt install -y pkg-config

Testing

The following command will run all tests:

cargo +nightly test --all-features --workspace

Some tests are available inside the src/tests folder, others are in their respective files. It's recommended that you run the tests before submitting a Pull Request. Increasing the test coverage is also welcome. Test coverage is tracked using tarpaulin.

cargo +nightly tarpaulin --all-features --workspace

Linting

cargo +nightly clippy --profile=release --all-features --workspace -- -D warnings -D clippy:all

Build

cargo +nightly build --profile=release --features crack-osint,crack-bf,crack-fpt --workspace --locked

Distribution

cargo dist init --hosting github
# make change `pr-run-mode = "upload"`
git add .
git commit -am "chore: cargo-dist"
cargo dist build --profile=release --features crack-gpt,crack-bf,crack-osint

Release

git tag vX.X.X
git push --tags

# publish to crates.io (optional)
cargo publish

Docker Compose

Within the project folder, simply run the following:

docker build -t cracktunes .
docker compose up -d

Originally forked from Parrot

cracktunes's People

Contributors

cycle-five avatar aquelemiguel avatar afonsojramos avatar dependabot[bot] avatar joao-conde avatar staticrocket avatar rafaeldamasceno avatar github-actions[bot] avatar venturapereira avatar antonio-bennett avatar dannyps avatar simonrask avatar giladwo avatar

Stargazers

Chop Chop  avatar wood avatar никита avatar  avatar RealTimeChris avatar Achim Winter avatar Tony avatar KH Saad avatar Brandon Marsh avatar

Watchers

Kostas Georgiou avatar RealTimeChris avatar  avatar

cracktunes's Issues

Codebase Architecture Docs

🧐 Rationale

Documentation is good.

📝 Description

Use figma or something, high level diagram.

➕ Additional Information & References

No response

Get Playlog Working

  • Playlog should be written to the postgres database asynchronously.
  • Add paging to the embed.

Test Coverage > 23%

🧐 Rationale

More test coverage is better.

📝 Description

Get the covecov test coverage with tarpaulin above 23%

➕ Additional Information & References

No response

Break Code Into Features

In Rust, you can separate code into "features" which can be turned on or off at compile time. This can greatly reduce the binary size and the length of the builds for situations where not everything is needed.

Playlist Features

  • Save the current queue as a playlist
  • Get the name of loaded playlists from the spotify API

movesong command

Command called /movesong <at> <to> that moves the song at index at to the index to.

Add help option to all commands

🧐 Rationale

Explain what the commands do.

📝 Description

Self evident.

➕ Additional Information & References

No response

Mock rusty_ytdl responses in unit tests

🧐 Rationale

We currently make real requests to youtube, which really knows it's a robot when coming from GitHub. Mock these so they don't all fail.

📝 Description

Mock the responses for the unit tests.

➕ Additional Information & References

No response

Play Album Version

🧐 Rationale

For many songs, the YouTube version that is selected is the music video. Usually I want the album version of a song to play and not the music video.

📝 Description

Create an option in the play command, and possibly a toggle mode that makes the bot look for album versions if it can.

➕ Additional Information & References

No response

Re-enable playlist support.

🧐 Rationale

Playlist support is implemented, should have the commands available.

📝 Description

Connect the commands back into the frontend of the bot and test.

➕ Additional Information & References

No response

changenicks

🧐 Rationale

.

📝 Description

Renames all users in the guild
to a random nick name from a themed list of names. Use your
own custom list, or choose from one of the many I've
pre-curated and use in my own server.

➕ Additional Information & References

No response

Race Condition with Autoplay and Stop

📝 Description

There seems to be a race condition possible when a user calls /stop at the same time that the bot is trying to execute the next autoplaying song, see attached screen shot.
Screenshot 2024-03-18 193754

🪜 Reproduction Steps

  1. Use /stop after the autoplay text message appears and before the embed does
  2. The /stop command times out

ℹ Environment / Computer Info

  • 0.3.0:
  • Operating System:

📸 Screenshots

No response

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.