Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
schuyberg committed Mar 24, 2024
2 parents dcc7190 + 66cec5a commit 25a1f6b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
CommandInteraction,
MessageReaction,
PartialMessageReaction,
PartialUser,
Expand All @@ -9,6 +10,7 @@ import {
bankerRoleId,
officerRoleId,
bankTransactionsChannelId,
modRoleId,
} from "../../../config";
import {
ReactionAction,
Expand All @@ -28,31 +30,44 @@ class BankRequestFinishedReactionAction extends ReactionAction {
if (this.message.channel.id !== bankRequestsChannelId) {
return;
}

// filter non-finish emoji reactions
if (this.reaction.emoji.name !== "✅") {
return;
// mark finished
if (this.reaction.emoji.name === "✅") {
const bankTransactionsChannel = await getTextChannel(
bankTransactionsChannelId
);
let transactionContent = this.message.content + ` -- ✅ by ${this.user}`;
if (!this.message.author?.bot) {
transactionContent = this.message.author?.toString() + ": " + transactionContent;
}
bankTransactionsChannel?.send(transactionContent);
// authorize user
const reactor = await this.members?.fetch(this.user.id);
if (
!(
reactor?.roles.cache.has(bankerRoleId) ||
reactor?.roles.cache.has(officerRoleId) ||
reactor?.roles.cache.has(modRoleId)
)
) {
return;
}
this.message.delete();
}

// authorize user
const reactor = await this.members?.fetch(this.user.id);
if (
!(
reactor?.roles.cache.has(bankerRoleId) ||
reactor?.roles.cache.has(officerRoleId)
)
) {
return;
// delete
if (this.reaction.emoji.name === "❌") {
const reactor = await this.members?.fetch(this.user.id);
if (
!(
reactor?.roles.cache.has(bankerRoleId) ||
reactor?.roles.cache.has(officerRoleId) ||
reactor?.roles.cache.has(modRoleId)
) || this.message.mentions?.parsedUsers.hasAny(this.user.username ?? "")
) {
return;
}
this.message.delete();
}

const bankTransactionsChannel = await getTextChannel(
bankTransactionsChannelId
);
let transactionContent = this.message.content + ` -- ✅ by ${this.user}`;
if (!this.message.author?.bot) {
transactionContent = this.message.author?.toString() + ": " + transactionContent;
}
bankTransactionsChannel?.send(transactionContent);
this.message.delete();
}
}
2 changes: 1 addition & 1 deletion src/features/bank-request-info/bank-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const services: Service[] = [
"_NFP Bank or EC Tunnel_",
"PP4DKP (Platinum Pieces for Dragon Kill Points) Fundraising",
"PP4DKP runs on a monthly cycle with DKP recorded the following month",
"1k = 1 DKP; 5 maximum",
"1k = 1 DKP; 30 maximum",
"No fractional DKP or rounding; Only PP, no items",
],
},
Expand Down

0 comments on commit 25a1f6b

Please sign in to comment.