All Projects → Naranbataar → MaSH

Naranbataar / MaSH

Licence: MIT License
A minimalistic Discord API wrapper made in Posix Shell

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to MaSH

Disqord
An asynchronous Discord API wrapper for .NET.
Stars: ✭ 155 (+604.55%)
Mutual labels:  discord-api, discord-library, discord-api-wrapper
Discord.CPP
Discord.CPP is a C++ library for interaction with the Discord API.
Stars: ✭ 46 (+109.09%)
Mutual labels:  discord-api, discord-library
QDiscord
QDiscord - An unofficial C++ and Qt wrapper for the Discord API.
Stars: ✭ 21 (-4.55%)
Mutual labels:  discord-api, discord-library
DPP
C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
Stars: ✭ 560 (+2445.45%)
Mutual labels:  discord-api, discord-api-wrapper
hata
Async Discord API wrapper.
Stars: ✭ 156 (+609.09%)
Mutual labels:  discord-api, discord-api-wrapper
library
🐍 A Python library for Discord.
Stars: ✭ 648 (+2845.45%)
Mutual labels:  discord-api, discord-library
Diskord
[Mirror of GitLab] A Kotlin client for Discord with a light wrapper on the REST APIs and a simple to use DSL for basic bots.
Stars: ✭ 146 (+563.64%)
Mutual labels:  discord-api, discord-api-wrapper
gencord
A simple, beginner-friendly, and easy-to-use library for interacting with the Discord API, with minimal syntax.
Stars: ✭ 20 (-9.09%)
Mutual labels:  discord-api, discord-api-wrapper
Clamor
The Python Discord API Framework
Stars: ✭ 14 (-36.36%)
Mutual labels:  discord-api, discord-api-wrapper
Discord-Selfbot
Discord.js selfbot
Stars: ✭ 24 (+9.09%)
Mutual labels:  discord-api, discord-library
calamity
A library for writing discord bots in haskell
Stars: ✭ 77 (+250%)
Mutual labels:  discord-api, discord-library
discljord
A Clojure wrapper library for the Discord API, with full API coverage (except voice, for now), and high scalability
Stars: ✭ 179 (+713.64%)
Mutual labels:  discord-api, discord-api-wrapper
disml
Pure OCaml bindings to the Discord API. Mirror of Gitlab repo.
Stars: ✭ 36 (+63.64%)
Mutual labels:  discord-api, discord-library
arcscord
A Discord library written in typescript
Stars: ✭ 18 (-18.18%)
Mutual labels:  discord-api, discord-library
discord-rose
The simple Discord library for advanced users
Stars: ✭ 37 (+68.18%)
Mutual labels:  discord-api, discord-library
Haxicord
The most popular discord API Haxe library (because no others are good enough to be called a library)
Stars: ✭ 42 (+90.91%)
Mutual labels:  discord-api, discord-library
SataniaBot
The most devilish bot for Discord!
Stars: ✭ 20 (-9.09%)
Mutual labels:  discord-api
Discord-Reposter
Bot for reposting Discord messages (work in progress)
Stars: ✭ 62 (+181.82%)
Mutual labels:  discord-api
Ellie
A bot for the Discord chat platform written in Rust with the Serenity library.
Stars: ✭ 14 (-36.36%)
Mutual labels:  discord-api
wymlp
tiny fast portable real-time deep neural network for regression and classification within 50 LOC.
Stars: ✭ 36 (+63.64%)
Mutual labels:  minimalistic

MaSH - A minimalistic Discord API wrapper compatible with Posix Shells

MaSH is a set of scripts for writing Discord Bots

Features

  • Follows the Unix Philosophy
  • Modular and reliable
  • Little to no abstraction
  • Unbloated and minimalistic
  • Universal, scripts/binaries of any language can
    interact using stdin/stdout
  • Wraps the entire REST API
  • Efficient rate limiting

Requirements

  • A POSIX environment
  • jq
  • curl
  • websocat
  • flock and stdbuf (already installed on most systems)

Example

PATH="$PATH:$(realpath MaSH)"
. MaSH/extra/utils.sh

export MASH_TOKEN="TOKEN"
export MASH_BOT=true
export MASH_SHARD=0,1
export MASH_GS=true
export MASH_INTENTS=

run_command(){
    message="$1"
    content="$(echo "$message" | jq -r '.d|.content')"
    content="${content#>}"; name="${content%% *}"; args="${content#$name}"

    eval "$(printf '%s\n' "$message" | get_args d:data:@)"
    eval "$(printf '%s\n' "$data" | get_args channel_id)"

    if [ "$(basename "$name")" != '..' ] && [ -f "commands/$name" ]; then
        content="$(printf '%s\n' "$message" | "commands/$name" $args 2>&1)"
    else
        content="$name?"
    fi

    set_args channel:channel_id content | mash api message send > /dev/null
}

mash start &

while [ ! -d .mash ]; do sleep 1; done
mash listen \
       | jq --unbuffered -cM 'select((.op==0 and .t=="MESSAGE_CREATE")) |
                              select((.d|.content|startswith(">")))' \
       | while read -r message; do
             run_command "$message" &
         done

Todo

  • Replace websocat with a simpler tool
  • Voice Support
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].