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

edit whenzero message #186

Merged
merged 3 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
Binary file removed data/dumbledore.db
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
},
JASON_MOM: 'Not much is known about Jason\'s mom, except that she is thought to be responsible for the great internet unplugging of 2016',
},
WHENZERO: 'Hmm....You can\'t give point!!! before you give point, you have to answer to other\'s question!',
WHENZERO: 'Hmm... You don\'t have your own points. before giving points to someone, you should answer to other\'s question and get extra points.',
FAIL_POINT_TO: 'Well... you can\'t award points to me, the professor.'
},
DB: {
Expand Down
4 changes: 3 additions & 1 deletion lib/controller/awardPoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const { DB, OUTPUT } = require('../const');

async function awardPoints(message) {
const fromUser = await this.convertToUserName(message.user);
const botName = this.name;
let point = 0;
let userId = '';
const botName = this.name;

if (this.isReactionEvent(message)) {
point = 10;
Expand All @@ -14,10 +14,12 @@ async function awardPoints(message) {
userId = ([(message.text.substring(message.text.indexOf('@') + 1).split('>')[0])]).join();
point = parseInt(message.text.split(' ')[0].replace(/[^\d.]/g, ''), 10);
}

const userName = await this.convertToUserName(userId);
// const user = message.item_user;
if (typeof botName === 'undefined' || typeof userId === 'undefined' || typeof point === 'undefined') return;
if (userName === botName) return this.slackBot.awardPointsCallback(message, OUTPUT.FAIL_POINT_TO);

const Student = new Parse.Object(DB.STUDENT.CALL);
const query = new Parse.Query(Student);
query.equalTo(DB.STUDENT.BOT_ID, this.id);
Expand Down
3 changes: 2 additions & 1 deletion page/src/components/LoginModal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';//import react
// import react
import React from 'react';
import PropTypes from 'prop-types';
import { Button, Header, Icon, Modal, Form } from 'semantic-ui-react';

Expand Down