Skip to content

Commit

Permalink
Merge pull request #25 from whck6/feature/new-text-config-param-for-e…
Browse files Browse the repository at this point in the history
…mpty-wallet

feat: add a param for empty wallet
  • Loading branch information
Keyrxng authored Aug 31, 2024
2 parents a094a8c + 8241c00 commit 78b19d2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ To configure your Ubiquibot to run this plugin, add the following to the `.ubiqu
taskStaleTimeoutDuration: "30 Days"
maxConcurrentTasks: 3
startRequiresWallet: true # default is true
emptyWalletText: "Please set your wallet address with the /wallet command first and try again."
```
# Testing
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/supabase/helpers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export class User extends Super {
if ((error && !data) || !data.wallets?.address) {
this.context.logger.error("No wallet address found", { userId, issueNumber });
if (this.context.config.startRequiresWallet) {
await addCommentToIssue(this.context, "```diff\n! Please set your wallet address with the /wallet command first and try again.\n```");
await addCommentToIssue(this.context, this.context.config.emptyWalletText);
throw new Error("No wallet address found");
} else {
await addCommentToIssue(this.context, "```diff\n# Please set your wallet address with the /wallet command in order to be eligible for rewards.\n```");
await addCommentToIssue(this.context, this.context.config.emptyWalletText);
}
} else {
this.context.logger.info("Successfully fetched wallet", { userId, address: data.wallets?.address });
Expand Down
1 change: 1 addition & 0 deletions src/types/plugin-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const startStopSchema = T.Object(
taskStaleTimeoutDuration: T.String({ default: "30 Days" }),
maxConcurrentTasks: T.Number({ default: 3 }),
startRequiresWallet: T.Boolean({ default: true }),
emptyWalletText: T.String({ default: "Please set your wallet address with the /wallet command first and try again." }),
},
{
default: {},
Expand Down
1 change: 1 addition & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ function createContext(
taskStaleTimeoutDuration: "30 Days",
maxConcurrentTasks: 3,
startRequiresWallet,
emptyWalletText: "Please set your wallet address with the /wallet command first and try again.",
},
octokit: new octokit.Octokit(),
eventName: "issue_comment.created" as SupportedEventsU,
Expand Down

0 comments on commit 78b19d2

Please sign in to comment.