question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bot doesn't respond for Recap Time Probot App

See original GitHub issue

Bug Report

Current Behavior The bot doesn’t respond to any command I give in the testing issue.

const getConfig = require("probot-config");
const mongoose = require("mongoose"); // Will be removed soon
const commands = require("probot-commands");
const createScheduler = require("probot-scheduler");
const RT_Stale = require("./lib/stale");

// The first code was derived from probot-stale plugin
module.exports = async app => {
  // Visit all repositories to mark and sweep stale issues
  const scheduler = createScheduler(app);

  // Unmark stale issues if a user comments
  const events = [
    "issue_comment",
    "issues",
    "pull_request",
    "pull_request_review",
    "pull_request_review_comment"
  ];

  app.on(events, unmark);
  app.on("schedule.repository", markAndSweep);

  async function unmark(context) {
    if (!context.isBot) {
      const recaptime_plugins_stale = await forRepository(context);
      let issue = context.payload.issue || context.payload.pull_request;
      const type = context.payload.issue ? "issues" : "pulls";

      // Some payloads don't include labels
      if (!issue.labels) {
        try {
          issue = (await context.github.issues.get(context.issue())).data;
        } catch (error) {
          context.log("Issue not found");
        }
      }

      const staleLabelAdded =
        context.payload.action === "labeled" &&
        context.payload.label.name ===
          recaptime_plugins_stale.config.staleLabel;

      if (
        recaptime_plugins_stale.hasStaleLabel(type, issue) &&
        issue.state !== "closed" &&
        !staleLabelAdded
      ) {
        recaptime_plugins_stale.unmarkIssue(type, issue);
      }
    }
  }

  async function markAndSweep(context) {
    const stale = await forRepository(context);
    await stale.markAndSweep("pulls");
    await stale.markAndSweep("issues");
  }

  async function forRepository(context) {
    let config = await getConfig(context, "recaptime_config.yml");

    if (!config) {
      scheduler.stop(context.payload.repository);
      // Don't actually perform for repository without a config
      config = { perform: false };
      print("Something fishy on some repositories: No configuration files.");
    }

    config = Object.assign(config, context.repo({ logger: app.log }));

    return new RT_Stale(context.github, config);
  }
};

module.exports = robot => {
  // Type `/label foo, bar` in a comment box for an Issue or Pull Request to be labeled
  commands(robot, "addlabel", (context, command) => {
    const labels = command.arguments.split(/, */);
    const confirmation_addlabel = context.issue({
      body:
        "Successfully added the specified labels in the `label` parameter. Refresh this page to see latest content." +
        "If the problem occurs or the label/s you specified is not added as expected, please [contact Support](https://forums.devhubcentral.ml)," +
        "[create an new issue](https://probot-app) or fork this project"
    });
    return context.github.issues.addLabels(context.issue({ labels }));
    return context.github.issues.createComment(confirmation_addlabel);
  });
  commands(robot, "rmlabel", (context, command) => {
    const labels = command.arguments.split(/, */);
    const confirmation_rmlabel = context.issue({
      body:
        "Successfully removed the specified labels in the `label` parameter. Refresh the page to" +
        "see latest content. If the problem occurs, please [contact Support](https://forums.devhubcentral.ml)"
    });
    return context.github.issues.removeLabels(context.issue({ labels }));
    return context.github.issues.createComment(confirmation_rmlabel);
  });
  commands(robot, "help", (context, command) => {
    const botcommands_help = context.issue({
      body:
        "## Bot Commands Help\n" +
        "To see the full list of the commands, see [documentation for the full cheat sheetinstead](https://probot-docs.recaptime.tk/cheat-sheet/commands)"
    });
    return context.github.issues.createComment(botcommands_help);
  });
  // Checks whetever the bot is still working.
  commands(robot, "connect", (context, command) => {
    const statusChecks = context.issue({
      body: "I'm alive and usually responds my system at"
    });
    return context.github.issues.createComment(statusChecks);
  });
  commands(robot, "test", (context, command) => {
    const statusChecks = context.issue({
      body: "I'm alive and usually responds my system at"
    });
    return context.github.issues.createComment(statusChecks);
  });
};

}

The latest code can be found here in GitHub or in GitLab

Expected behavior/code The command/s should be work as expected, even with Markdown.

Environment

  • Probot version(s): 9.6.4
  • Node/npm version: Node 12/npm 9.6.4
  • OS: (I am using Glitch, but I don’t know what version and OS]

Possible Solution

Additional context/Screenshots image

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
issue-label-bot[bot]commented, Nov 18, 2019

Issue-Label Bot is automatically applying the label bug 🐞 to this issue, with a confidence of 0.98. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

0reactions
ajhalili2006commented, Dec 20, 2019

Hello I’m not sure I understand your latest question there @AndreiJirohHaliliDev2006.

According to the error logs in your original post, there’s an error coming from probot-scheduler:

image

Would you mind closing this issue and opening a new one in probot-scheduler? I’m guessing its something to do with the versioning of @octokit/rest used between probot and probot-scheduler. Thanks!

Okay. I’ll close this one and creating a new issue in probot-scheduler. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discord Bot Troubleshooting - Scryfall
The bot does not reply at all. Check the Discord status to see if anything is currently affecting messages. Make sure the bot...
Read more >
Discord music bot sending "The application did not respond ...
I know I can defer the reply for up to 15 minutes, but since it is a queue system the command could be...
Read more >
A GitHub Bot to ensure your code does not misspell WordPress
A bot to fix any misspelled mention of WordPress in your code. The bot checks the files in your pull request and asks...
Read more >
Beep Boop: 6 Bots To Better Your Open Source Project - Twilio
You can build your own Probot apps, or you can take advantage of the ... As of the time of this writing, all...
Read more >
Automating GitHub with Probot - Changelog
We talk with Brandon Keepers and Bex Warner about GitHub's Probot — GitHub Apps to automate and improve your workflows.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found