Skip to content

Commit

Permalink
Merge pull request #290 from hexathe6/challenges-command
Browse files Browse the repository at this point in the history
Changes to /rule 0
  • Loading branch information
theboxmage authored Mar 30, 2024
2 parents 561cf76 + 1860051 commit 730a797
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/commands/RuleCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class RuleCommand {

const rule = getConfigValue<Rule[]>("rules").find(rule => rule.triggers.includes(ruleName));

const ruleHeader = getConfigValue<Rule[]>("rules")[0] === rule ? "Info" : "Rule";

if (rule !== undefined) {
embed.setTitle(`Rule: ${rule.name}`);
embed.setTitle(`${ruleHeader}: ${rule.name}`);
embed.setDescription(rule.description);
embed.addFields([{ name: "To familiarise yourself with all of the server's rules please see", value: "<#240884566519185408>" }]);
embed.setColor(getConfigValue<GenericObject<ColorResolvable>>("EMBED_COLOURS").SUCCESS);
Expand Down
2 changes: 1 addition & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"rules": [{
"name": "Asking For Help",
"triggers": ["0", "ask", "help", "details"],
"description": "Help us to help you, instead of just saying \"my code doesn't work\" or \"can someone help me.\""
"description": "Help us to help you, instead of just saying \"my code doesn't work\" or \"can someone help me.\" Be specific with your questions, and [don't ask to ask](https://dontasktoask.com)."
},
{
"name": "Be Patient",
Expand Down
4 changes: 2 additions & 2 deletions test/commands/RuleCommandTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe("RuleCommand", () => {
const embed = replyStub.getCall(0).firstArg.embeds[0];

expect(replyStub.calledOnce).to.be.true;
expect(embed.data.title).to.equal("Rule: Asking For Help");
expect(embed.data.description).to.equal("Help us to help you, instead of just saying \"my code doesn't work\" or \"can someone help me.\"");
expect(embed.data.title).to.equal("Info: Asking For Help");
expect(embed.data.description).to.equal("Help us to help you, instead of just saying \"my code doesn't work\" or \"can someone help me.\" Be specific with your questions, and [don't ask to ask](https://dontasktoask.com).");
expect(embed.data.fields[0].name).to.equal("To familiarise yourself with all of the server's rules please see");
expect(embed.data.fields[0].value).to.equal("<#240884566519185408>");
expect(embed.data.color).to.equal(NumberUtils.hexadecimalToInteger(EMBED_COLOURS.SUCCESS.toLowerCase()));
Expand Down

0 comments on commit 730a797

Please sign in to comment.