Skip to content

Commit

Permalink
started working on the databse connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
mushahidq committed Mar 21, 2021
1 parent d8304ea commit bfb6b55
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
node_modules/

# Environment variables
.env
.env

#CockroachDB cert
certs/
9 changes: 4 additions & 5 deletions commands/accept.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { prefix, channelid } = require('../config.json')
const fetch = require('node-fetch')
const querystring = require('querystring')

module.exports = {
name: 'accept',
Expand All @@ -14,16 +13,16 @@ module.exports = {
var i = 0;
message.channel.send('The statements are:');
for (result of response.results) {
quiz.questions[i] = result.question;
quiz.questions[i] = decodeURI(result.question);
if (result.correct_answer === 'True') {
quiz.answers[i] = querystring.stringify(result.question.slice(0, -1) + " is true.");
quiz.answers[i] = decodeURI(result.question.slice(0, -1) + " is true.");
} else if (result.correct_answer == 'False') {
quiz.answers[i] = querystring.stringify(result.question.slice(0, -1) + " is false.");
quiz.answers[i] = decodeURI(result.question.slice(0, -1) + " is false.");
}
message.channel.send(`\n${quiz.questions[i]}`);
console.log(quiz.answers[i]);
i++;
}
console.log(quiz.answers);
}
else {
message.channel.send(`${message.author} no one has challenged you to a duel as of now.`);
Expand Down
2 changes: 2 additions & 0 deletions db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE TABLE IF NOT EXISTS duelbot.users (userid INT PRIMARY KEY, wins INT, losses INT, ties INT);
CREATE TABLE IF NOT EXISTS duelbot.duels (challengerid INT, participantid INT, winnerid INT, tie INT);
133 changes: 133 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"discord.js": "^12.5.1",
"dotenv": "^8.2.0"
"dotenv": "^8.2.0",
"pg": "^8.5.1"
}
}

0 comments on commit bfb6b55

Please sign in to comment.