All checks were successful
Build and push Doorman UI / API / docker (push) Successful in 1m22s
24 lines
646 B
JavaScript
24 lines
646 B
JavaScript
exports.handler = async function(context, event, callback) {
|
|
const response = new Twilio.Response();
|
|
|
|
const discordPath = Runtime.getFunctions()['common/discord'].path;
|
|
const discord = require(discordPath);
|
|
|
|
let msg = event.msg;
|
|
|
|
if (event.json && event.json != "undefined") {
|
|
const fingerprint = JSON.parse(event.json)?.fingerprint;
|
|
msg += `\`\`\`# Unlocked by\n${JSON.stringify(fingerprint, null, 4)}\`\`\``;
|
|
}
|
|
|
|
console.log(event.msg);
|
|
|
|
// user must be in "Doorman" server
|
|
await discord.sendMessageToUser(context,
|
|
event.discordUser,
|
|
msg,
|
|
).catch((e) => console.error(e));
|
|
|
|
return callback(null, response);
|
|
};
|