Merge branch 'develop' into 'master'
2.1.1 See merge request Dandellion/matrix-wug!9
This commit is contained in:
commit
dc45ff0df3
|
@ -20,8 +20,15 @@ For the PIE notation:
|
||||||
* Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal.
|
* Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal.
|
||||||
|
|
||||||
This is best learned by experimenting.
|
This is best learned by experimenting.
|
||||||
|
|
||||||
Inuktitut Syllabics: https://en.wikipedia.org/wiki/Inuktitut_syllabics
|
Inuktitut Syllabics: https://en.wikipedia.org/wiki/Inuktitut_syllabics
|
||||||
|
|
||||||
|
Iñupiatun Orthography:
|
||||||
|
|
||||||
|
* & for miniscule ł
|
||||||
|
* l% and n% for ł and ñ each
|
||||||
|
* g^, l^, &^ (or l%^ and l^%) n^, and r^ for ġ ḷ ł̣ ŋ ȓ each
|
||||||
|
|
||||||
These conversions were originally taken from [xsduan/conniebot](https://github.com/xsduan/conniebot), and the discord bot Tuugaalikkuluk (thanks!) But have later divirged a bit.
|
These conversions were originally taken from [xsduan/conniebot](https://github.com/xsduan/conniebot), and the discord bot Tuugaalikkuluk (thanks!) But have later divirged a bit.
|
||||||
|
|
||||||
To use the bot I run an instance at [@wug:dodsorf.as](https://matrix.to/#/@wug:dodsorf.as), you can invite it to a room or DM it to use the converter. Or you can read the setup instructions below to host your own!
|
To use the bot I run an instance at [@wug:dodsorf.as](https://matrix.to/#/@wug:dodsorf.as), you can invite it to a room or DM it to use the converter. Or you can read the setup instructions below to host your own!
|
||||||
|
|
46
index.ts
46
index.ts
|
@ -1,16 +1,13 @@
|
||||||
const version = "2.0.1";
|
const version = "2.1.1";
|
||||||
import x2i from "./x2i";
|
import x2i from "./x2i";
|
||||||
import { existsSync } from "fs";
|
import { existsSync } from "fs";
|
||||||
|
|
||||||
const config = (existsSync("./config.json")) ? require("./config.json") : {};
|
const config = (existsSync("./config.json")) ? require("./config.json") : {};
|
||||||
|
|
||||||
console.log(process.env.MATRIXDEV_HOMESERVER);
|
|
||||||
console.log(process.env.MATRIXDEV_TOKEN);
|
|
||||||
|
|
||||||
const MatrixClient = require("matrix-bot-sdk").MatrixClient;
|
const MatrixClient = require("matrix-bot-sdk").MatrixClient;
|
||||||
const AutojoinRoomsMixin = require("matrix-bot-sdk").AutojoinRoomsMixin;
|
const AutojoinRoomsMixin = require("matrix-bot-sdk").AutojoinRoomsMixin;
|
||||||
|
|
||||||
const homeserver = (config.homeserver || process.env.WUG_HOMESERVER || process.env.MATRIXDEV_HOMESERVER);
|
const homeserver = (config.homeserver || process.env.WUG_HOMESERVER || process.env.MATRIXDEV_HOMESERVER);
|
||||||
const token = (config.token || process.env.WUG_TOKEN || process.env.MATRIXDEV_TOKEN);
|
const token = (config.token || process.env.WUG_TOKEN || process.env.MATRIXDEV_TOKEN);
|
||||||
|
|
||||||
const client = new MatrixClient(homeserver, token);
|
const client = new MatrixClient(homeserver, token);
|
||||||
|
@ -29,6 +26,8 @@ async function handle(roomId, event) {
|
||||||
if (event.sender === await myself) { console.log("Wait a minute... That's me!"); return;};
|
if (event.sender === await myself) { console.log("Wait a minute... That's me!"); return;};
|
||||||
|
|
||||||
if (event.content.body === "!xhelp" || event.content.body === (await client.getUserProfile(await myself)).displayname + ": help") {help(roomId); return;};
|
if (event.content.body === "!xhelp" || event.content.body === (await client.getUserProfile(await myself)).displayname + ": help") {help(roomId); return;};
|
||||||
|
if (event.content.body === "!xik") {xik(roomId); return;};
|
||||||
|
if (event.content.body === "!pie") {xpie(roomId); return;};
|
||||||
if (event.content.body === "!xdebug") {debug(roomId); return;};
|
if (event.content.body === "!xdebug") {debug(roomId); return;};
|
||||||
|
|
||||||
console.log("Trying to convert the message!");
|
console.log("Trying to convert the message!");
|
||||||
|
@ -41,17 +40,48 @@ async function handle(roomId, event) {
|
||||||
|
|
||||||
|
|
||||||
function help(roomId) {
|
function help(roomId) {
|
||||||
var message = `Hi I can help you translate X-SAMPA, Z-SAMPA to IPA, and transcribe into proto-indo european notation!
|
var message = `Hi I can help you translate X-SAMPA, Z-SAMPA to IPA!
|
||||||
Use (x/z/p) together with either / or [] as delimeters
|
Use (x/z/p/i/ik) together with either / or [] as delimeters
|
||||||
x/"hEloU/ z[or\` 5aIk DIz] p/mreghnom/ 😀
|
x/"hEloU/ z[or\` 5aIk DIz] p/mreghnom/ 😀
|
||||||
|
|
||||||
I also can transcribe to Inuktitut Syllabics like this: i[tusaumaqattautijjutinik aulattijiit].
|
x - X-SAMPA - https://en.wikipedia.org/wiki/X-SAMPA
|
||||||
|
z - Z-SAMPA - http://www.kneequickie.com/kq/Z-SAMPA
|
||||||
|
p - Proto-Indo-European Notation (see !xpie)
|
||||||
|
i - Inuktitut Syllabics | https://en.wikipedia.org/wiki/Inuktitut_syllabics
|
||||||
|
ik - Iñupiatun Orthography (see !xik)
|
||||||
|
|
||||||
Find my source at https://github.com/Dali99/matrix-wug`;
|
Find my source at https://github.com/Dali99/matrix-wug`;
|
||||||
|
|
||||||
client.sendNotice(roomId, message);
|
client.sendNotice(roomId, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function xpie(roomId) {
|
||||||
|
var message = `This is a fun PIE notation
|
||||||
|
|
||||||
|
a preceding " is acute accent
|
||||||
|
a following : is the macron
|
||||||
|
a following . is the syllabicity marker
|
||||||
|
h always becomes superscript and v is superscript w.
|
||||||
|
Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal.
|
||||||
|
|
||||||
|
There's probably more, but this is best learned by experimenting (or reading https://github.com/dali99/matrix-wug/blob/master/x2i/apie-keys.yaml)
|
||||||
|
|
||||||
|
Thanks to conniebot (xsduan) for the encoding`;
|
||||||
|
|
||||||
|
client.sendNotice(roomId, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function xik(roomId) {
|
||||||
|
var message = `There are several distinct Iñupiatun orthographies, and I can type all of them.
|
||||||
|
& for miniscule ł
|
||||||
|
l% and n% for ł and ñ each
|
||||||
|
g^, l^, &^ (or l%^ and l^%) n^, and r^ for ġ ḷ ł̣ ŋ ȓ each
|
||||||
|
|
||||||
|
Thanks to Tuugaalikkuluk for the encoding`;
|
||||||
|
|
||||||
|
client.sendNotice(roomId, message);
|
||||||
|
}
|
||||||
|
|
||||||
async function debug(roomId) {
|
async function debug(roomId) {
|
||||||
var message = `Hi my name is ${await myself}, and I want to help you debug me!
|
var message = `Hi my name is ${await myself}, and I want to help you debug me!
|
||||||
I run version ${version} 💝 and currently reside in ${roomId}`;
|
I run version ${version} 💝 and currently reside in ${roomId}`;
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
- - l^%
|
||||||
|
- ł̣
|
||||||
|
- - l%^
|
||||||
|
- ł̣
|
||||||
|
- - L^%
|
||||||
|
- Ł̣
|
||||||
|
- - L%^
|
||||||
|
- Ł̣
|
||||||
|
|
||||||
|
- - g^
|
||||||
|
- ġ
|
||||||
|
- - G^
|
||||||
|
- Ġ
|
||||||
|
- - l^
|
||||||
|
- ḷ
|
||||||
|
- - l%
|
||||||
|
- ł
|
||||||
|
- - L^
|
||||||
|
- Ḷ
|
||||||
|
- - L%
|
||||||
|
- Ł
|
||||||
|
- - '&^'
|
||||||
|
- ł̣
|
||||||
|
- - N%
|
||||||
|
- Ñ
|
||||||
|
- - N^
|
||||||
|
- Ŋ
|
||||||
|
- - n%
|
||||||
|
- ñ
|
||||||
|
- - n^
|
||||||
|
- ŋ
|
||||||
|
- - r^
|
||||||
|
- ȓ
|
||||||
|
- - R^
|
||||||
|
- Ȓ
|
||||||
|
|
||||||
|
- - '&'
|
||||||
|
- ł
|
|
@ -37,6 +37,10 @@ const regex = OuterXRegExp(
|
||||||
const defaultMatchAction = (left: string, match: string, right: string) => left + match + right;
|
const defaultMatchAction = (left: string, match: string, right: string) => left + match + right;
|
||||||
|
|
||||||
const matchType: { [key: string]: IMatchInstructions } = {
|
const matchType: { [key: string]: IMatchInstructions } = {
|
||||||
|
ik: {
|
||||||
|
join: (_, match) => `- ${match}`,
|
||||||
|
keys: readKeys("./x2i/ik-keys.yaml"),
|
||||||
|
},
|
||||||
p: {
|
p: {
|
||||||
join: (_, match) => `*${match}`,
|
join: (_, match) => `*${match}`,
|
||||||
keys: readKeys("./x2i/apie-keys.yaml"),
|
keys: readKeys("./x2i/apie-keys.yaml"),
|
||||||
|
@ -48,6 +52,7 @@ const matchType: { [key: string]: IMatchInstructions } = {
|
||||||
keys: readKeys("./x2i/z2i-keys.yaml"),
|
keys: readKeys("./x2i/z2i-keys.yaml"),
|
||||||
},
|
},
|
||||||
i: {
|
i: {
|
||||||
|
join: (_, match) => `- ${match}`,
|
||||||
keys: readKeys("./x2i/i-keys.yaml"),
|
keys: readKeys("./x2i/i-keys.yaml"),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue