Categorygithub.com/henesy/disco
modulepackage
0.0.0-20200313024015-ff90b1ac381a
Repository: https://github.com/henesy/disco.git
Documentation: pkg.go.dev

# README

disco: Discord client for 9front

Fork of theboxmage's discord-cli.

Ndb config is in $home/lib/disco.ndb for setting password, should be made automatically after first run. Alternatively, you may use factotum.

Install

Dependencies

  • 9fans.net/go/plan9
  • github.com/Plan9-Archive/libauth
  • github.com/mischief/ndb
  • golang.org/x/crypto
  • github.com/gorilla/websocket
  • github.com/bwmarrin/discordgo

Installation

% go get github.com/henesy/disco

Usage

% disco -h
Usage of disco:
  -n	Enable notifications
  -t	Hide timestamps in channel log
  -w string
    	Dimensions to pass through to statusmsg (default "10,10,260,90")

Commands

Commands available in chat:

CommandFunction
:qQuits disco
:gChange listening Guild
:c [n ?]Change listening Channel inside Guild, or list channels
:m [n]Display last [n] messages: ex. :m 2 displays last two messages
:pPulls up the private channel menu
:n nameChange nickname to name
:!Print current server information
:?List the available commands

You can regex the last message sent using a format such as:

s/forsynth/forsyth/

Config

A basic $home/lib/disco.ndb looks something like:

auth=pass
loadbacklog=true
messages=10
promptchar=→
timestampchar=>

[email protected]	password=somepassword1

Note that the auth= tuple accepts

auth=factotum

for authentication using a factotum key and will ignore the password= tuple.

If used, the factotum key should resemble something to the effect of:

proto=pass server=discordapp.com service=discord [email protected] !password=hunter2

Notes

If you can connect to a channel and see messages, but yours aren't sending, check to make sure your e-mail address is verified.

FAQ

Q: What if go get doesn't work?

A: If you want to use go get on 9front to install disco and its dependencies (recommended) you should use driusan's dgit as git. Alternatively, on 9front specifically, you can wrap Ori's git9.

Q: What if I can't login because of a captcha error?

A: You'll need to sign in to Discord via the web app (thus solving a captcha) using a browser with html5/js. I recommend an http proxy such as this in conjunction with a system with such a browser..

Q: What if I get an error about signing in from a new location?

A: Discord has sent you an e-mail with a location confirmation link, click it, no js should be required.

Problems

  • Does not create accounts for you, this still needs to be done in a browser/app
  • Does not support 2FA (Discord API explicitly does not allow this)

# Packages

Package DiscordState is an abstraction layer that gives proper structs and functions to get and set the current state of the cli server.

# Functions

AddUserChannel moves a user to a private channel with another user.
AddUserChannelMenu takes a user from the current guild and adds them to a private message.
CheckState checks the current state for essential missing information, errors will fail the program.
CreateConfig creates folder inside $home and makes a new empty configuration file.
ExtraGuildMenuOptions prints and handles extra options for SelectGuildMenu.
ExtraPrivateMenuOptions adds functionality to UserChannels.
GetConfig retrieves configuration file from $home/lib/disco.ndb, if it doesn't exist it calls CreateConfig().
Return the text currently in /dev/cons -- Plan9 only.
Nicely stringifies the useful info about a guild -- ends in \n.
Header simply prints a header containing state/session information.
InitWindow creates a New CLI Window.
LeaveServerMenu is a copy of SelectGuildMenu that leaves instead of selects.
MessagePrint prints one correctly formatted Message to stdout.
Msg is a composition of Color.New printf functions.
Notify uses Notify-Send from libnotify to send a notification when a mention arrives.
ParseForCommands parses input for Commands, returns message if no command specified, else return is empty.
Parse for guild-specific emoji.
ParseForMentions parses input string for mentions.
PrintMessages prints amount of Messages to CLI.
Turn raw mode off -- rio in Plan9 only.
Turn raw mode on -- rio in Plan9 only.
ReceivingMessageParser parses receiving message for mentions, images and MultiLine and returns string array.
ReplaceMentions replaces mentions to ID.
SelectChannel selects a new Channel.
SelectChannelMenu is a menu item that sets the current channel.
SelectDeletePrivate a private channel.
SelectDeletePrivateMenu deletes a user channel.
SelectGuild selects a new Guild.
SelectGuildMenu is a menu item that creates a new State on basis of Guild selection.
SelectPrivate a private channel.
SelectPrivateMenu is a menu item that changes to a private channel.
ShowContent shows default Channel content.
ShowEmptyContent shows an empty channel.

# Constants

Global Message Types.
No description provided by the author
Global Message Types.
Global Message Types.
No description provided by the author
Global Message Types.
Placeholder.
Version is current version const.

# Variables

Config is the global configuration of discord-cli.
No description provided by the author
Session is global Session.
State is global State.

# Structs

Configuration is a struct that contains all configuration fields.
HexColor is a struct gives RGB values.

# Type aliases

Types of auth we can do ­ add handling for new modes to atoam().
MsgType is a string containing global message type.