Esempio n. 1
0
function awardUser($targetUser, $URL, $conn)
{
    $bountyInfo = getExistingBountyInfo($targetUser, $conn);
    $points = $bountyInfo['worth'];
    $targetClaim = $bountyInfo['id'];
    $data = array("text" => "@" . $targetUser . " has fulfilled their bounty for *" . $bountyInfo['worth'] . " points!*", "username" => "SlackBounty Sheriff", "mrkdwn" => true);
    addCredit($targetUser, $points, $URL, $conn);
    $sql = "DELETE FROM claims WHERE userID = :userID";
    $stmt = $conn->prepare($sql);
    $stmt->execute(array(":userID" => getUserID($targetUser, $conn)));
    $sql = "DELETE FROM board WHERE id = :claimID";
    $stmt = $conn->prepare($sql);
    $stmt->execute(array(":claimID" => $targetClaim));
    sendThis($data, $URL);
}
Esempio n. 2
0
// Determine message context
if ($slkChannel === "directmessage") {
    $msgCtxDM = true;
} else {
    $msgCtxDM = false;
}
switch ($prsParams[0]) {
    case 'help':
        bountyHelp($slkUsername, $webhookURL, $msgCtxDM, $conn);
        break;
    case 'claim':
        if (empty($prsParams[1])) {
            echo "Uh oh. You didn't supply a bounty ID. Do /bounty help for more info";
            break;
        } elseif (userOccupied($slkUsername, $conn)) {
            $existingBountyInfo = getExistingBountyInfo($slkUsername, $conn);
            echo "You already have a bounty claimed: " . $existingBountyInfo['name'];
            break;
        } else {
            userClaim($slkUsername, $webhookURL, $prsParams[1], $conn);
            // Actually perform the claim when user tables are complete
        }
        break;
    case 'award':
        if (!$isAdmin) {
            echo "Your account does not have access to this command.";
            break;
        } elseif (empty($prsParams[1])) {
            echo "Uh oh. You didn't supply a username. Do /bounty help for more info";
            break;
        } elseif (!checkUser($prsParams[1], $conn)) {