NIEL

$ pip install niel
> ...
$ niel
> Usage: niel [OPTIONS] COMMAND [ARGS]...
>
> niel
>
> Options:
> --version Show the version and exit.
> --help Show this message and exit.
>
> Commands:
> auth Start an authenticated session
> create Create a new rich menu
> default Show default rich menu identifier
> drop Drop rich menu identified by `menu-id`
> image Upload an image found by given `image-path` for the...
> set-default Set default rich menu identified by `menu-id`
Authenticate session (janky)
$ niel auth `<line-channel-access-token>`
>
$ source ~/.zshrc
>
$ source ~/.bashrc
The next shell environment you open, will now have $NIEL_AUTH_SESSION
defined as your inserted line-channel-access-token.
Next step, create a RichMenu with defined YAML-file
$ niel create example.yml
> richmenu-fd5610793084b22a00a8eeb3812d5dd8
The YAML-file needs to follow requirements defined by RichMenu object
definitions set by LINE Messaging API documentation for RichMenu object [4]
found in the appendix. The basics of a RichMenu object definition is as such:
RichMenu Schema
RichMenu {
areas: [{
action: {
altUri.desktop?: string
clipboardText?: string
data?: string
displayText?: string
initial?: string
inputOption?: string
label?: string
max?: string
min?: string
mode?: "date" | "datetime" | "time"
richMenuAliasId?: string
text?: string
type: "camera"
| "cameraRoll"
| "clipboard"
| "datetimepicker"
| "location"
| "message"
| "postback"
| "richmenuswitch"
| "uri"
uri?: string
}
bounds: {
height: number
width: number
x: number
y: number
}
}]
size: {
height: number
width: number
}
}
See more details on Action objects [1], Area objects [2],
Bounds objects [3] and RichMenu objects [4] schemas
and criteria under the appendix section.
$ niel image default.png richmenu-fd5610793084b22a00a8eeb3812d5dd8
> True
$ niel set-default richmenu-fd5610793084b22a00a8eeb3812d5dd8
> True
$ niel drop richmenu-fd5610793084b22a00a8eeb3812d5dd8
> True
$ niel drop richmenu-fd5610793084b22a00a8eeb3812d5dd8
> False
Disclosures
Feel free to make an issue if any vulnerabilities are found in the project.
Also, this command-line interface relies on the following dependencies so if any
of them have been found to be vulnerable, please create an issue and clarify
as such.
- click - Python composable command line interface toolkit
- httpx - A next generation HTTP client for Python. 🦋
- pydantic - Data validation using Python type hints
- rich - Rich text and beautiful formatting in the terminal
- yaml - Canonical source repository for PyYAML
Contributions
Unless LINE Messaging API changes, no planned changes on the project.
But if you want to try your hand at the project, here is the recommended
set-up for your local development environmnet.
$ pip install poetry
> ...
$ poetry shell
> ...
$ poetry install --with dev
> ...
This project has two development dependencies as such:
- mypy - Optional static typing for Python
- ruff - An extremely fast Python linter and
code formatter, written in Rust.
Recommended usage of said development dependencies.
$ mypy .
> ...
$ ruff format .
> ...
Roadmap
- Add command to list richmenus as found on this documentation section.
- Add command to check if given YAML-file is a valid richmenu as found on this documentation section.
- Add command to download previously uploaded RichMenu image. as found on this documentaion section.
Appendix
License
This project is licensed under the terms of the MIT license.