Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a param for empty wallet #25

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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```");
Keyrxng marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -512,6 +512,7 @@ function createContext(issue: Record<string, unknown>, sender: Record<string, un
taskStaleTimeoutDuration: "30 Days",
maxConcurrentTasks: 3,
startRequiresWallet: false,
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