indicate if a user was already registered
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 38s Details

This commit is contained in:
Ladd Hoffman 2024-04-26 21:56:20 -05:00
parent 260de4e724
commit 6a644097fe
1 changed files with 11 additions and 1 deletions

View File

@ -126,10 +126,20 @@ const start = async () => {
console.log('error: failed to recover signature:', e.message);
}
if (account) {
try {
const authorAddress = await matrixUserToAuthorAddress.get(event.sender);
if (account === authorAddress) {
await client.sendNotice(roomId, `Matrix user ${event.sender} already linked to author address ${account}`);
} else {
await client.sendNotice(roomId, `Matrix user ${event.sender} was linked to author address ${authorAddress}, now linked to ${account}`);
}
} catch (e) {
// Not found
await client.sendNotice(roomId, `Registered matrix user ${event.sender} to author address ${account}`);
}
await matrixUserToAuthorAddress.put(event.sender, account);
await authorAddressToMatrixUser.put(account, event.sender);
}
await client.sendNotice(roomId, `Registered matrix user ${event.sender} to author address ${account}`);
};
// Before we start the bot, register our command handler