mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-07-17 09:26:20 -05:00
* compiles but looks ugly * create sr record working version * validate and tsify * chakra ui v 1.0 icon fixes * new ui first ver * remove unused icon * remove imports , color picker work * color picker done * set bg color proper * suggests vouches page * remove unused deps * voting history page * build analyzer improvements * calendar page new * footer stay down * ui refresh stuff * x trends dont show tier if no weapons * draft cup page new look * plus faq page * cra 4 beta * top logo placed center * weapon images new import style * top nav aling correctly in mobile resolution * nav changes * initial xleaderboard * peak x powers backend * graphql codegen * switched to apollo/client package * initial xleaderboard table * insert player ids * dataloaders * ts-node dev dep * x leaderboard basic * xleaderboard testing * x rank placements backend * all leaderboards frontend components initial * pagination tweaking * ran prettier * leaderboards doneish * top 500 browser basic * top 500 browser * pagination tweaks * implemented filters * user page placements * remove useless * useEffect only call on name change * markdown use new table style * use mode images * search by player id * link to xsearch from leaderboards * translated * disable next if no pagecount * remove comment
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
const webhook = require("webhook-discord");
|
|
|
|
function sendFAPostToDiscord(args) {
|
|
const Hook = new webhook.Webhook(process.env.FA_WEBHOOK_URL);
|
|
|
|
const msg = new webhook.MessageBuilder()
|
|
.setName(args.user.username)
|
|
.setColor("#2c5364")
|
|
.addField("", `<@${args.user.discord_id}>`)
|
|
.addField(
|
|
"",
|
|
`[User page on sendou.ink](https://sendou.ink/u/${args.user.discord_id})`
|
|
);
|
|
|
|
if (args.can_vc) {
|
|
const can_vc = args.can_vc.toLowerCase();
|
|
msg.addField("Voice Chat", can_vc[0].toUpperCase() + can_vc.slice(1));
|
|
}
|
|
|
|
if (args.playstyles) {
|
|
msg.addField(
|
|
"Playstyle",
|
|
args.playstyles.map((playstyle) => playstyle.toLowerCase()).join(", ")
|
|
);
|
|
}
|
|
|
|
if (args.user.weapons.length > 0) {
|
|
msg.addField("Weapons", args.user.weapons.join(", "));
|
|
}
|
|
|
|
if (args.past_experience) {
|
|
msg.addField("Past experience", args.past_experience);
|
|
}
|
|
|
|
if (args.activity) {
|
|
msg.addField("Activity", args.activity);
|
|
}
|
|
|
|
if (args.looking_for) {
|
|
msg.addField("Looking for", args.looking_for);
|
|
}
|
|
|
|
if (args.description) {
|
|
msg.addField("Description", args.description);
|
|
}
|
|
|
|
if (args.user.twitter_name) {
|
|
msg.setAvatar(`https://avatars.io/twitter/${args.user.twitter_name}`);
|
|
}
|
|
|
|
if (args.user.country) {
|
|
const top500string = args.user.top500
|
|
? " <:top500:594551830764191763>"
|
|
: "";
|
|
msg.setText(`:flag_${args.user.country}:${top500string}`);
|
|
}
|
|
|
|
return Hook.send(msg);
|
|
}
|
|
|
|
module.exports = sendFAPostToDiscord;
|