Skip to content

Commit

Permalink
fix: sp tip email without prefixes (#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
trkhoi authored Dec 21, 2023
1 parent c0f55d5 commit 8733b11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 4 additions & 9 deletions src/commands/tip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ const textCmd: Command = {
return
}

const mailPrefixes = ["email:", "gmail:", "mail:"]
const mailPrefix = mailPrefixes.find((p) => target.startsWith(p))
// tip mail
if (mailPrefix) {
args[1] = target.replace(mailPrefix, "") // remove email prefix
const expression: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i
if (expression.test(target)) {
await tipMail(msg, args)
return
}
Expand Down Expand Up @@ -197,11 +194,9 @@ const slashCmd: SlashCommand = {
return
}

const mailPrefixes = ["email:", "gmail:", "mail:"]
const mailPrefix = mailPrefixes.find((p) => target.startsWith(p))
// tip mail
if (mailPrefix) {
args[1] = target.replace(mailPrefix, "") // remove email prefix
const expression: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i
if (expression.test(target)) {
await tipMailSlash(i, args)
return
}
Expand Down
2 changes: 0 additions & 2 deletions src/commands/tip/mail/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export async function execute(
msgOrInteraction: Message | CommandInteraction,
payload: any,
) {
console.log("check payload", payload)

// send transfer request
const {
data,
Expand Down

0 comments on commit 8733b11

Please sign in to comment.