AngeCI's Documentation
Welcome to the documentation hub of AngeCI. See the sidebar for the list of documentations available.
Site powered by mdBook.
Projects
Web Boardgame Library Collection
The aim of this project is to create libraries as lightweight and portable as possible for various boardgames. See the demo on this site.
The libraries are targeted to be suitable for:
- Provide functions as detailed as possible, such as game replay and analysis
- Widgets embedded into various webpages
- Bundling into standalone apps (via frameworks like Tauri and Electron)
Web Chess Board
Position format
Each piece is represented by a hexadecimal digit, then encode the whole number with base64. This application includes a converter that can convert between FEN format and the custom base64 position format.
| Piece | White | Black |
|---|---|---|
| King | 1 | 9 |
| Queen | 2 | a |
| Rook | 3 | b |
| Knight | 4 | c |
| Bishop | 5 | d |
| Pawn | 6 | e |
Empty squares are represented by 0.
Addtional informations such as castling rights, en passant files and number of turns are encoded after a colon.
| Bit index | Meaning |
|---|---|
| 0 | Side to move, 0 for white, 1 for black. |
| 1 | Black’s long castle |
| 2 | Black’s short castle |
| 3 | White’s long castle |
| 4 | White’s short castle |
| 5-7 | En passant file, only the file is encoded. 0 for a-file, 7 for h-file. |
| 8 | En passant availability |
| 9-14 | Number of turns since the last capture or pawn move. |
| 15-23+ | Number of turns since the beginning of the entire game. |
The starting position encoded into the custom base64 position format is: vNqdy+7u7u4AAAAAAAAAAAAAAAAAAAAAZmZmZjRSFUM:eAAA
Moves format
Moves are represented by the source square and the destination square only. Each square is represented by a base64 character. This application includes a converter that can convert between algebraic notation, UCI format and the custom base64 moves format.
Black
A B C D E F G H
I J K L M N O P
Q R S T U V W X
Y Z a b c d e f
g h i j k l m n
o p q r s t u v
w x y z 0 1 2 3
4 5 6 7 8 9 + /
White
Sample game
Regular algebraic notation:
1. e4 h5
2. d4 a6
3. Nc3 h4
4. Bg5 Nc6
5. d5 e5
6. Bxd8 b6
7. Bxc7 Nge7
8. dxc6 f6
9. Nd5 a5
10. cxd7+ Kxd7
11. Bb5+ Ke6
12. Nf4+ Kf7
13. Bc4+ Be6
14. Bxe6+ Ke8
15. Qd8+ Rxd8
16. Bxd8 Ng6
17. Nxg6 a4
18. O-O-O Bc5
19. Nxh8 Bd4
20. Bc7 Ke7
21. Bf5 b5
22. Nf3 a3
23. Nxd4 g6
24. Nxg6+ Ke8
25. Nxb5 axb2+
26. Kxb2 Kf7
27. Rd7+ Ke8
28. Re7#
UCI format:
e2e4 h7h5 d2d4 a7a6 b1c3 h5h4 c1g5 b8c6 d4d5 e7e5 g5d8 b7b6 d8c7 g8e7 d5c6
f7f6 c3d5 a6a5 c6d7 e8d7 f1b5 d7e6 d5f4 e6f7 b5c4 c8e6 c4e6 f7e8 d1d8 a8d8
c7d8 e7g6 f4g6 a5a4 e1c1 f8c5 g6h8 c5d4 d8c7 e8e7 e6f5 b6b5 g1f3 a4a3 f3d4
g7g6 h8g6 e7e8 d4b5 a3b2 c1b2 e8f7 d1d7 f7e8 d7e7
Custom base64 moves format:
0kPfzjIQ5qfn6eBSjbMceDJRDKGMbSNVqbQYSLEL9ZLUblUNZiCUiUNE7DADKDMWlWYg86FaWH
ajDKEMUdRZ+tgotjOWHWMEjZox6xEN7LNELM
Web Chinese Chess Board
Position format
Each piece is represented by a hexadecimal digit, then encode the whole number with base64. This application includes a converter that can convert between FEN format and the custom base64 position format.
| Piece | White | Black |
|---|---|---|
| King/General (將/帥) | 1 | 9 |
| Advisor (士/仕) | 2 | a |
| Bishop/Elephant (象/相) | 3 | b |
| Knight/Horse (馬/傌) | 4 | c |
| Rook (車/俥) | 5 | d |
| Cannon (炮/砲/包) | 6 | e |
| Pawn/Soldier (卒/兵) | 7 | f |
Empty squares are represented by 0.
The starting position encoded into the custom base64 position format is: 3LqavNAAAAAADgAADg8PDw8PAAAAAAAAAAAAcHBwcHBgAABgAAAAAAVDISNF
Map viewer
UI buttons
- Search 🔎:
- Upload file 📁:
- Paste from clipboard 📄:
- Projection controls 🗺️:
- Polygon editor ✏️:
- Layer selector:
- Layer controls:
- Geolocation: Attempts to geolocate the user.
URL queries
https://angeci.github.io/map/?<queries>
q: General searching.utm: UTM coordinates.mgrs: Military Grid Reference System (MGRS) coordinates.plus: Plus Code.mdh: Maidenhead Locator System (MLS).gh: Geohash.osm: OpenStreetMap short URL format.hk1980: HK1980 grid coordinates.twd67: TWD67 grid coordinates.twd97: TWD97 grid coordinates.ll: WGS84 coordinates.z: Zoom level.
UTM coordinates
Format: UTM zone + easting + northing
https://angeci.github.io/map/?utm=50Q+209108+2485039
MGRS coordinates
- 100 km grid:
https://angeci.github.io/map/?mgrs=51QTF
- 10 m grid:
https://angeci.github.io/map/?mgrs=37QED+8562+6913
Plus Code
- Global Plus Code:
https://angeci.github.io/map/?plus=7PXM93MQ+V8
- “4+x” local Plus Code, relative to the current map centre:
https://angeci.github.io/map/?plus=MM89+6V
- Local Plus Code, with locality specified:
https://angeci.github.io/map/?plus=MM89+6V+Tokyo,+Japan
https://angeci.github.io/map/?plus=MM89+6V+JP-13
Padded Plus Code:
https://angeci.github.io/map/?plus=9C000000+
https://angeci.github.io/map/?plus=7PXM0000+
https://angeci.github.io/map/?plus=8Q6QC600+
Maidenhead Locator System
Can support up to 10 digits “extended subsquares” precision.
https://angeci.github.io/map/?mdh=OL72ck71
Geohash
https://angeci.github.io/map/?gh=wt0rjmk6
OpenStreetMap short URL format
https://angeci.github.io/map/?osm=7QEy3mFcb
HK1980 grid coordinates
Northing first, then easting.
https://angeci.github.io/map/?hk1980=823764,837329
TWD67 grid coordinates
Easting first, then northing.
https://angeci.github.io/map/?twd67=317321,2785079
TWD97 grid coordinates
Easting first, then northing.
https://angeci.github.io/map/?twd97=318149,2784873
Direct GPS coordinate (WGS84) specification
Latitude first, then longitude.
https://angeci.github.io/map/?ll=39.90647,116.39125
https://angeci.github.io/map/?ll=39d54m23.3s,116d23m28.5s
https://angeci.github.io/map/#39.90647,116.39125
https://angeci.github.io/map/#39d54m23.3s,116d23m28.5s
HKTWUncycBot
IM 群組聊天機器人
<正式名稱待定>是一個由 AngeCI 所製作的多用途機器人。目前(計劃)支持部署於以下平台:Telegram、Discord、Matrix。此機器人之源碼可於此處找到。
本機器人目前支援(或計劃支援)的功能如下,讀者可點擊下表之連結以查看該功能的詳細說明。請注意有部份功能可能會在一部份群組被禁用。
- 配置指南
- API 查詢
- 查詢帳戶跨平台聯繫
- 群組設置
- 群組驗證機制
- 聊天記錄搜索
- DM 轉發
- 貼圖搜索
- 發送隨機貼圖
/spam指令- Emoji 字典
- 聖經查詢
- 五子棋(目前不支持禁手)
- 國際象棋
- 中國象棋
- 漢語拼音、注音、Raven 碼轉換
置頂消息同步- ||可能還有一些隱藏的除錯指令||
指令列表
general類:/start,/help,/idping類:/pingchat_history類:/search(/\grep)pin類:/pincheckuser類:/checkuserrandom_sticker類:/sticker,/sticker_statsticker_search類:/sticker_search,/sticker_statspam類:/spamemoji_dict類:/emojilist,/emojidictbible類:/search_bible,/info_bible5m類:待定ch類:待定xq類:待定raven類:/pinyin,/pinyindc,/zhuyindcdebug_commands類:/echo,/getfileid,/flag,/sendtext,/sendsticker,/forward,/forward2
/id、/checkuser 和所有屬於 debug_commands 類別的指令均需要進階白名單權限才可執行。
/start 指令
目前只支持對 /start 指令回應固定字串信息。訊息內容可在 config.json 文件中定義。
如果字串不存在或者為空字串,那麼機器人就不會響應 /start 指令。
/help 指令
輸出幫助訊息,幫助訊息內容可在 config.json 文件中定義。
/ping 指令
用以檢測消息橋是否正常運作。為了防止重覆推送消息(特別是 Telegram),某些功能可能會需要一直 ping 橋。
DM 轉發
配置指南
config.json 文件格式:
{
"bot_tokens": {
"telegram": "<TELEGRAM_BOT_TOKEN>",
"discord": "<DISCORD_BOT_TOKEN>",
"matrix": "<MATRIX_BOT_TOKEN>"
},
"global_switch": {
"general": true,
"ping": true,
"chat_history": true,
"pin": true,
"checkuser": true,
"random_sticker": true,
"sticker_search": true,
"spam": true,
"emoji_dict": true,
"bible": true,
"5m": true,
"ch": true,
"xq": true,
"raven": true,
"debug_commands": true,
"throw_error": true
},
"whitelist_enabled": true,
"language_list": ["en", "zh-TW", "zh-CN"],
"chat_history_directory": "history",
"account_info_file": "users.json",
"group_info_file": "groups.json",
"sticker_file": "stickers.json",
"sticker_index_file": "stdb.json",
"spam_config_file": "spam_config.json",
"emoji_dict_file": "emoji_dict.json",
"bible_file": "bible.json",
"tg_start_msg": ["Start command received."],
"tg_help_msg": [
"Currently supported commands: /start, /help, /sticker, /sticker_stat, /getfileid",
"In order to make users feel better, debug commands are neither registered on Telegram nor show here.",
"/start 內置起動按鈕。\n/help 輸出幫助。\n/echo 重複信息。\n/flag 輸入國家地區代碼,輸出旗幟,稍後將實作自動修正功能。\n/sendtext 發送文字信息,目前只支持純文字。\n/sendsticker 發送貼圖。 \n/forward 轉發信息。\n/forward2 轉發信息,命令格式跟 forward 有點不同。\n/pinyin 輸出漢語拼音,注意多音字可能無法正確判斷。\n/pinyindc 拼音解碼。(使用本機器人取得編碼)\n/zhuyindc 注音輸入法解碼。\n本機器人有隱藏指令,請慎用。\n"
],
"emoji_dict_template": "${emoji}\n*U\\\\+${codepoint} “${name}”*\nShortcode: ${shortcode}\n\n${description}",
"strict_whitelist_telegram": [1, 2, 3],
"strict_whitelist_discord": [1, 2, 3],
"strict_whitelist_telegram": ["@mod1:ltgc.cc","@mod2:ltgc.cc"]
}
手動發送訊息指南
多平台
單平台
Telegram
使機器人手動發送 Telegram 訊息,可用以下 Telegram 機器人指令(需要進階白名單):
/sendtext <target> <text>
/sendsticker <target> <sticker_id>
/forward <src_chat_id> <msg_id>
/forward2 <target_chat_id>
Discord
Matrix
機器人配置指南
首先,開啟用以運作機器人之伺服器的命令列,輸入以下指令下載機器人程式:
git clone https://github.com/AngeCI/im-bot.git
安裝依賴:
cd im-bot
npm install
然後輸入以下指令開始運行機器人:
node main.js > <stdout> 2> <stderr>
當中 <stdout> 是普通日誌檔案的路徑、<stderr> 是錯誤日誌檔案的路徑。若不提供日誌路徑,機器人就不會保留日誌。
API 查詢
帳戶跨平台聯繫
作為一個多平台機器人,提供多個平台帳號的自動連結是必須的。
查詢帳戶跨平台聯繫
checkuser 指令
- 用法:
/checkuser |<用戶名、用戶 ID 或用戶連結>| - 用戶 ID 若無指定平台前綴,機器人將嘗試自動偵測,否則默認查詢呼叫指令的平台。
- 用戶 ID 平台前綴:
-
tg,tgx: Telegram。帶「x」的為十六進制。
-
dc,dcx: Discord。帶「x」的為十六進制。
-
mx: Matrix。
- 若此指令用於回覆另一條信息,將查詢被回覆訊息之出者。
- 若此指令沒有回覆訊息,亦無於指令後提供參數,則默認為查詢指令呼叫者。
手動配置帳戶跨平台聯繫表
帳戶列表的地址可於 config.json 中指定(默認為 users.json)。各個欄位所需要的格式如下:
- 跨平台用戶標識:字串,作為機器人對用戶的主要標識名稱。
- Telegram 用戶編號:可選 52 位元整數。
- Discord 用戶編號:可選 64 位元整數,基於平台相容性考慮,必須儲存成由兩個 32 位整數組成的數組,高位在前低位在後。
- Matrix 用戶 ID:可選字串,必須為
@<username>:<homeserver>.<tld>的完整格式。 - Telegram 用戶名稱:可選字串,作為方便提及用戶的緩存數據。
- Discord 用戶名稱:可選字串,作為方便提及用戶的緩存數據。
- 偽基百科(正體中文)用戶名。此項信息受
user_wiki_info群組選項控制。 - 偽基百科(粵語)用戶名。此項信息受
user_wiki_info群組選項控制。 - 元偽基用戶名。此項信息受
user_wiki_info群組選項控制。 - 維基百科用戶名。此項信息受
user_wiki_info群組選項控制。 wiki_remarks選項:可選字串,作為只在user_wiki_info群組選項開啟的群組上顯示的額外帳戶信息。
{
"users": {
"<name>": {
"telegram": 9007199254740991,
"telegram_username": "<username>",
"discord": [4294967296, 4294967296],
"discord_username": "<username>",
"matrix": "@<username>:<homeserver>.<tld>",
"uncyc_tw": "<username>",
"uncyc_yue": "<username>",
"uncyc_meta": "<username>",
"wikipedia": "<username>",
"remarks": "<remarks>",
"wiki_remarks": "<wiki_remarks>"
}
}
}
自動同步
群組設定
群組設定位於 group_info_file 通用選項所指向的文件中(默認為 groups.json)。
- Telegram 用戶編號:可選 52 位元整數。
- Discord 群組編號:可選 64 位元整數,基於平台相容性考慮,必須儲存成由兩個 32 位整數組成的數組,高位在前低位在後。
- Matrix 群組標識:可選字串,必須為
!<group_id>:<homeserver>.<tld>的完整格式。 - 群組語系:字串。
- 指令類別選項:可選布爾值,指令類別的名稱可在此處找到。
user_wiki_info選項:可選布爾值,若此項開啟,則查詢帳號資訊時會輸出共筆網站相關的額外信息。throw_error選項:可選布爾值,決定是否向群組推送機器人的錯誤信息。
{
"Group 1": {
"telegram": 0,
"discord" [0, 0],
"matrix": "!<group_id>:<homeserver>.<tld>",
"lang": "zh-TW",
"general": true,
"ping": true,
"chat_history": true,
"pin": true,
"checkuser": true,
"user_wiki_info": true,
"random_sticker": true,
"sticker_search": true,
"spam": true,
"emoji_dict": true,
"bible": true,
"5m": true,
"ch": true,
"xq": true,
"raven": true,
"debug_commands": true,
"throw_error": true
}
}
群組驗證機制
聊天記錄搜索
貼圖搜索
發送隨機貼圖
/spam 指令
Emoji 字典
Emoji 字典是一個以假正經角度解釋繪文字釋義的機器人。
指令列表
/emojilist: 列出所有字典文件繪文字。/emojidict: 查詢指定繪文字的釋義,可於指令後附上,或者回覆一個帶有繪文字的信息來查詢。
字典格式
字典文件名應在 config.json 文件中指定。
{
"🍇": {
"codepoint": "1F347",
"name": "Grapes",
"shortcode": ["grapes"],
"description": "提子,提防騙子。"
},
...
}
聖經查詢
聖經查詢功能有兩個指令:search_bible 和 info_bible。
search_bible 指令
- 用法:
/search_bible <書卷代號> <章節編號> |<譯本名稱>| - 若未指定譯本名稱,將在群組選項尋找默認使用的譯本。
info_bible 指令
- 用法:
/info_bible <譯本名稱> - 輸出指定譯本的資訊。
譯本代號
| 譯本名稱 | 數字代號 | 文字代號 |
|---|---|---|
| 新標點和合本(繁體中文;神版) | 0 | cunp-t-1 |
| 新標點和合本(繁體中文;上帝版) | 1 | cunp-t-2 |
| 新標點和合本(簡體中文;神版) | 2 | cunp-s-1 |
| 新標點和合本(簡體中文;上帝版) | 3 | cunp-s-2 |
書卷代號
| 中文名稱 | 英文名稱 | 代號 |
|---|---|---|
| 創世記 | Genesis | gen |
| 出埃及記 | Exodus | exo |
| 利未記 | Leviticus | lev |
| 民數記 | Numbers | num |
| 申命記 | Deuteronomy | deu |
| 約書亞記 | Joshua | jos |
| 士師記 | Judges | jdg |
| 路得記 | Ruth | rut |
| 撒母耳記上 | 1 Samuel | 1sa |
| 撒母耳記下 | 2 Samuel | 2sa |
| 列王紀上 | 1 Kings | 1ki |
| 列王紀下 | 2 Kings | 2ki |
| 歷代志上 | 1 Chronicles | 1ch |
| 歷代志下 | 2 Chronicles | 2ch |
| 以斯拉記 | Ezra | ezr |
| 尼希米記 | Nehemiah | neh |
| 以斯帖記 | Esther | est |
| 約伯記 | Job | job |
| 詩篇 | Psalms | psa |
| 箴言 | Proverbs | pro |
| 傳道書 | Ecclesiastes | ecc |
| 雅歌 | Song of Songs | sng |
| 以賽亞書 | Isaiah | isa |
| 耶利米書 | Jeremiah | jer |
| 耶利米哀歌 | Lamentations | lam |
| 以西結書 | Ezekiel | ezk |
| 但以理書 | Daniel | dan |
| 何西阿書 | Hosea | hos |
| 約珥書 | Joel | jol |
| 阿摩司書 | Amos | amo |
| 俄巴底亞書 | Obadiah | oba |
| 約拿書 | Jonah | jon |
| 彌迦書 | Micah | mic |
| 那鴻書 | Nahum | nam |
| 哈巴谷書 | Habakkuk | hab |
| 西番雅書 | Zephaniah | zep |
| 哈該書 | Haggai | hag |
| 撒迦利亞書 | Zechariah | zec |
| 瑪拉基書 | Malachi | mal |
| 馬太福音 | Matthew | mat |
| 馬可福音 | Mark | mrk |
| 路加福音 | Luke | luk |
| 約翰福音 | John | jhn |
| 使徒行傳 | Acts | act |
| 羅馬書 | Romans | rom |
| 哥林多前書 | 1 Corinthians | 1co |
| 哥林多後書 | 2 Corinthians | 2co |
| 加拉太書 | Galatians | gal |
| 以弗所書 | Ephesians | eph |
| 腓立比書 | Philippians | php |
| 歌羅西書 | Colossians | col |
| 帖撒羅尼迦前書 | 1 Thessalonians | 1th |
| 帖撒羅尼迦後書 | 2 Thessalonians | 2th |
| 提摩太前書 | 1 Timothy | 1ti |
| 提摩太前書 | 2 Timothy | 2ti |
| 提多書 | Titus | tit |
| 腓利門書 | Philemon | phm |
| 希伯來書 | Hebrews | heb |
| 雅各書 | James | jas |
| 彼得前書 | 1 Peter | 1pe |
| 彼得後書 | 2 Peter | 2pe |
| 約翰一書 | 1 John | 1jn |
| 約翰二書 | 2 John | 2jn |
| 約翰三書 | 3 John | 3jn |
| 猶大書 | Jude | jud |
| 啟示錄 | Revelation | rev |