Fast, neat discord TUI written in Crystal

Releases:

  • v0.6.0 - April 5, 2019
  • v0.5.0 - March 25, 2019
  • v0.4.0 - March 22, 2019
  • v0.3.0 - March 20, 2019
  • v0.2.1 - March 20, 2019

Owner:

crcophony /kəˈkɒf(ə)ni/

read: cacophony

release badge I am not currently actively developing this project, but I will fix issues that arise

A simple Discord terminal ui written in Crystal.

Notice about notifications

I originally had the system set up to use dbus for a notification service. However, according to the dbus project;

NOTE ABOUT STATIC LINKING

We are not yet firmly freezing all runtime dependencies of the libdbus
library. For example, the library may read certain files as part of
its implementation, and these files may move around between versions.

As a result, we don't yet recommend statically linking to
libdbus. Also, reimplementations of the protocol from scratch might
have to work to stay in sync with how libdbus behaves.

To lock things down and declare static linking and reimplementation to
be safe, we'd like to see all the internal dependencies of libdbus
(for example, files read) well-documented in the specification, and
we'd like to have a high degree of confidence that these dependencies
are supportable over the long term and extensible where required.

As a result, I will be unable to compile a static binary that uses dbus for notifications. I will be removing the notification system from master and hosting it on a separate branch named with-notifs until a solution can be reached for this issue.

I apologise for this, and will continue looking for a way to remedy the situation.

WARNING

Self-bots are not allowed by Discord's Terms of Service. Using crcophony could technically count as using a self-bot. Use this project at your own risk, it isn't my fault if it gets you banned.

That being said, I'm trying my best to ensure the application is as safe as possible. You cannot do anything in crcophony that you can't do in the normal Discord client (in fact, there are things you can do in the Discord client that you can't do in crcophony) so it should be okay.

Bottom line: Use at your own risk

Keybinds

Normal

  • Ctrl+C: Quit Application
  • Enter: Send Message
  • Ctrl+W / Up: Scroll Up
  • Ctrl+S / Down: Scroll Down
  • Ctrl+N: Add line break to message input

Channel Switching

  • Ctrl+K: Open / Close Channel Selection Menu
  • Enter: Select Channel
  • Ctrl+W / Up: Scroll Selection Up
  • Ctrl+S / Down: Scroll Selection Down
  • ESC: Alternative Close Button

Usage

Using pre-built binary

Since the 0.1.0 release I have been including a static binary attached to releases. Here are instructions for running the application using these binaries;

  1. Go to the latest release and download the binary.
  2. Follow the steps in Gathering Data to set up your environment.
  3. Run ./crcophony from the directory you downloaded the binary to and it should run.

If the pre-built binary doesn't work, open an issue with as much information as possible (from log files and application error trace and such) and then maybe also try installing from source!

From source

If the pre-built binary didn't work for you, or you want to install from source by choice, here are the instructions;

  1. Install Crystal
  2. Install termbox following the instructions in their README.
  3. Clone this repo.
  4. Run shards install to install requirements.
  5. Follow the steps in Gathering Data to set up your environment.
  6. Run shards build to build the system, or use shards build --release to build with optimisations (slower build but potential speedups over non release mode).
  7. Run bin/crcophony to open the application.

Gathering Data

To use the system, you must gather the following information and export the data as environment variables. These variables are as follows;

  • CRCOPHONY_TOKEN: Your user token used to authenticate yourself with the client
  • CRCOPHONY_USER_ID: Your user id (might not be necessary, requires investigation and could be removed at a later point)

Here are the instructions for you to get these bits of data;

  1. Turn on Developer Mode
  2. To get the user_id, right click on your own name in the Users sidebar of any channel and click "Copy ID". This is the value you should put in as the user_id
  3. Follow this guide to get your token.

If you use the fish or bash shells, a sample .env file has been included in this project (.env.sample.fish and env.sample.bash respectively). Simply rename the appropriate file to .env, populate the strings inside with your gathered data and run source .env in the directory to get the correct environment variables created.

Contributing

  1. Fork it (https://github.com/freyamade/crcophony/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • freyamade - creator, maintainer

CHANGELOG

One stop shop for the updates made to the project with each version, and to check master's status against the latest release

master

with-notifs

The with-notifs branch is an up to date version of the application with additional notification support. To summarise what is said in the project README; I will be unable to provide a static executable that uses dbus for notifications. If you want this feature, you will have to build from source.

0.6.0 - Latest Release

  • Added multi line input that expands the prompt box accordingly (Ctrl+N to add a new line)
  • Fixed bug where characters always get added to the end of a prompt even when the cursor is moved elsewhere

0.5.0

  • Changed loading messages to use a progress bar
  • Added parsing of code blocks
  • Added syntax highlighting using the noir library
    • Currently, the lib only supports the following languages, and as such these are the only languages that will be highlighted
      • crystal
      • css
      • html
      • javascript
      • json
      • python
      • ruby
    • I'm currently trying to talk to the maintainer of the lib to allow me to add more lexers so this list should hopefully grow soon
  • Fixed bug where colouring text would interfere with the text wrapping process
  • Fixed bug where a message containing just an image would have a blank line
  • Added keybinds for up and down arrows to scroll through messages / channels

0.4.0

  • Removed duplicate colour names so all 256 colours are available
  • Now renders the timestamp at the right hand side of the screen, similar to some shell themes
  • Colour the title of embeds based on the colour that they are in the normal client
  • Added handling for Direct Messages and Group Chats

0.3.0

  • Usernames now have colours
    • Powered by 256 colour terminals. No idea what will happen if you run the system on a system with less colours.

0.2.1

  • Fixed rendering issue regarding embeds with multi line descriptions
  • Fixed major issue regarding the application taking a lot of CPU usage to just run idly

0.2.0

  • Fixed issue with parts of messages being removed during the text wrapping process
  • Fixed bug that caused channel names to appear twice in the switcher with no search, when your previous channel also has notifications
  • Slightly improved channel searching algorithm
    • Searcher currently only searches through channel names, doesn't include server names to avoid issues
    • Uses an improved algorithm that scores channel names instead of using basic levenshtein ratios
  • Handling of attachments
    • Attachments are now displayed as links below the message body
  • Handling of embeds
    • Embeds are now rendered in text form below the message body, and below any attachments

0.1.0

  • Currently this application only supports server channels. DMs and Group Chats will come later.
  • Mentions are parsed back into usernames, and any mention of the connected user will show up in yellow.
  • Loading channel history when a channel is changed to (this can and will be improved).
  • Long messages are wrapped.
  • Unread messages are kept track of per channel, and a total number can be found at the top right corner.
  • Channel Switching that behaves somewhat similarly to Discord's client
    • Without providing search text, it will display the previously visited channel and channels that have notifications
    • Typing search text will filter channels based on Levenshtein ratios
      • The algorithm could be improved somewhat however
Github statistic:
  • 7
  • 0
  • 2
  • 0
  • about 1 month ago

License:

MIT License

Links: