Skip to content

Instantly share code, notes, and snippets.

@mikan-megane
Created July 10, 2025 11:40
Show Gist options
  • Select an option

  • Save mikan-megane/98199675cf2f86cc554aa62c569c1112 to your computer and use it in GitHub Desktop.

Select an option

Save mikan-megane/98199675cf2f86cc554aa62c569c1112 to your computer and use it in GitHub Desktop.
return (async () => {
// 優先順位(指定外は最優先)
const DomainOrder = this.quicktext.variables[0]
.split(",")
.map((domain) => domain.trim());
let { to, cc } = await this.compose.getComposeDetails();
DomainOrder.toReversed().forEach((domain) => {
const otherTo = to.filter((address) => !address.includes(domain));
if (otherTo.length) {
cc = to.filter((address) => address.includes(domain)).concat(cc);
to = otherTo;
}
});
to = [...new Set(to)];
cc = [...new Set(cc)].sort(
(a, b) =>
DomainOrder.findIndex((domain) => a.includes(domain)) -
DomainOrder.findIndex((domain) => b.includes(domain))
);
await this.compose.setComposeDetails({ to, cc });
return "";
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment