diff --git a/.github/ubiquibot-config.yml b/.github/ubiquibot-config.yml
index b800b7a18..9559018f8 100644
--- a/.github/ubiquibot-config.yml
+++ b/.github/ubiquibot-config.yml
@@ -31,3 +31,4 @@ priority-labels:
auto-pay-mode: true
analytics-mode: true
max-concurrent-bounties: 2
+promotion-comment: `\n
If you enjoy the DevPool experience, please follow Ubiquity on GitHub and star this repo to show your support. It helps a lot!
`
\ No newline at end of file
diff --git a/src/bindings/config.ts b/src/bindings/config.ts
index 369269688..60e0eb5dd 100644
--- a/src/bindings/config.ts
+++ b/src/bindings/config.ts
@@ -20,6 +20,7 @@ export const loadConfig = async (context: Context): Promise => {
incentiveMode,
networkId,
issueCreatorMultiplier,
+ promotionComment,
} = await getWideConfig(context);
const publicKey = await getScalarKey(process.env.X25519_PRIVATE_KEY);
@@ -37,6 +38,9 @@ export const loadConfig = async (context: Context): Promise => {
priorityLabels,
commentElementPricing,
},
+ comments: {
+ promotionComment: promotionComment,
+ },
payout: {
networkId: networkId,
rpc: rpc,
diff --git a/src/handlers/comment/handlers/index.ts b/src/handlers/comment/handlers/index.ts
index b9005f1b9..9f7276f3e 100644
--- a/src/handlers/comment/handlers/index.ts
+++ b/src/handlers/comment/handlers/index.ts
@@ -41,12 +41,12 @@ export const commentParser = (body: string): IssueCommentCommands[] => {
export const issueClosedCallback = async (): Promise => {
const { payload: _payload } = getBotContext();
+ const { comments } = getBotConfig();
const issue = (_payload as Payload).issue;
if (!issue) return;
try {
const comment = await handleIssueClosed();
- const promotionCommnet = `\nIf you enjoy the DevPool experience, please follow Ubiquity on GitHub and star this repo to show your support. It helps a lot!
`;
- if (comment) await addCommentToIssue(comment + promotionCommnet, issue.number);
+ if (comment) await addCommentToIssue(comment + comments.promotionComment, issue.number);
} catch (err: unknown) {
return await addCommentToIssue(`Error: ${err}`, issue.number);
}
diff --git a/src/types/config.ts b/src/types/config.ts
index 3862e783d..d24cfd52b 100644
--- a/src/types/config.ts
+++ b/src/types/config.ts
@@ -62,6 +62,10 @@ export const SodiumSchema = Type.Object({
privateKey: Type.String(),
});
+export const CommentsSchema = Type.Object({
+ promotionComment: Type.String(),
+});
+
export const BotConfigSchema = Type.Object({
log: LogConfigSchema,
price: PriceConfigSchema,
@@ -72,6 +76,7 @@ export const BotConfigSchema = Type.Object({
mode: ModeSchema,
assign: AssignSchema,
sodium: SodiumSchema,
+ comments: CommentsSchema,
});
export type BotConfig = Static;
diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts
index acc1d962f..f1740ff1f 100644
--- a/src/utils/helpers.ts
+++ b/src/utils/helpers.ts
@@ -82,6 +82,16 @@ export const getAnalyticsMode = (parsedRepo: WideRepoConfig | undefined, parsedO
}
};
+export const getPromotionComment = (parsedRepo: WideRepoConfig | undefined, parsedOrg: WideOrgConfig | undefined): string => {
+ if (parsedRepo && parsedRepo["promotion-comment"] && typeof parsedRepo["promotion-comment"] === "string") {
+ return parsedRepo["promotion-comment"];
+ } else if (parsedOrg && parsedOrg["promotion-comment"] && typeof parsedOrg["promotion-comment"] === "string") {
+ return parsedOrg["promotion-comment"];
+ } else {
+ return "";
+ }
+};
+
export const getIncentiveMode = (parsedRepo?: WideRepoConfig, parsedOrg?: WideOrgConfig): boolean => {
if (parsedRepo && parsedRepo["incentive-mode"] && typeof parsedRepo["incentive-mode"] === "boolean") {
return parsedRepo["incentive-mode"];
diff --git a/src/utils/private.ts b/src/utils/private.ts
index 00d6e917a..ff3952cd4 100644
--- a/src/utils/private.ts
+++ b/src/utils/private.ts
@@ -13,6 +13,7 @@ import {
getPriorityLabels,
getTimeLabels,
getCommentItemPrice,
+ getPromotionComment,
} from "./helpers";
const CONFIG_REPO = "ubiquibot-config";
@@ -53,6 +54,7 @@ export interface WideConfig {
"time-labels"?: WideLabel[];
"priority-labels"?: WideLabel[];
"auto-pay-mode"?: boolean;
+ "promotion-comment"?: string;
"analytics-mode"?: boolean;
"incentive-mode"?: boolean;
"max-concurrent-bounties"?: number;
@@ -137,6 +139,7 @@ export const getWideConfig = async (context: Context) => {
bountyHunterMax: getBountyHunterMax(parsedRepo, parsedOrg),
incentiveMode: getIncentiveMode(parsedRepo, parsedOrg),
commentElementPricing: getCommentItemPrice(parsedRepo, parsedOrg),
+ promotionComment: getPromotionComment(parsedRepo, parsedOrg),
};
return configData;