Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Max2408 authored May 24, 2021
1 parent 666f83a commit e43ff15
Show file tree
Hide file tree
Showing 27 changed files with 871 additions and 243 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ We have a new system in our api which will block the use of some emails, domains
Mostly the temp mail service will be blocked, but if someone else doesn't follow our T&S their email or domain can be banned.

- [List of Blocked Domains](./blocked/blockeddomains.md)
- [List of Blocked Domain Extensions](./blocked/blockedExtensions.md)

## Versions

| beCoditive Versions | Status | Support |
|---------------------|------------------|-----------------------------|
| v2.1.x | In development | Code Only |
| v2.0.0 | Current | Both(API and Code) |
| v1.0.0 | Depreciated | Code Only (Not Recommended) |


## Nodejs Module
If you are using nodejs and want to use our api it will be more easier to use it by your [NPM Package](https://www.npmjs.com/package/becoditive).<br>
Expand Down Expand Up @@ -40,6 +50,14 @@ This Project already has a .replit file configured!
you can change all the files and use it for your projects also.
But you have to give credits to `beCoditive`.

## Contributors
<br><br>
<a href="https://github.com/beCoditive/beCoditive-API/graphs/contributors">
<img src="https://contrib.rocks/image?repo=beCoditive/beCoditive-API"/>
</a>
<br><br>


> Made By beCoditive ©2021
> Front End Made by [Aditya Jha](https://github.com/AdityaXJha)
22 changes: 2 additions & 20 deletions Src/Controllers/Admin.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
const APIKEYS = require('../../models/apikeys')

function uuid() {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

const randomChoice = function(container) {
return Math.floor(Math.random() * container.length)
}
const randomCharacterFrom = function(length) {
return characters.charAt(randomChoice(characters))
}

const makeKeyPart = function(length) {
return Array(length).fill().map(function() {
return randomCharacterFrom(length)
}).join('')
}

return `${makeKeyPart(8)}-${makeKeyPart(4)}-${makeKeyPart(4)}-${makeKeyPart(4)}-${makeKeyPart(12)}`
}

const uuid = require('../Utilities/functions').uuid

exports.newAPIKEY = async(req, res, next) => {
try{
Expand Down Expand Up @@ -59,4 +41,4 @@ exports.newAPIKEY = async(req, res, next) => {
})
}
}
}
}
2 changes: 1 addition & 1 deletion Src/Controllers/Animals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Animals = require('../../models/animals')
const Auth = require('./auth')


exports.cat = async(req, res, next) => {
try{
Expand Down
95 changes: 91 additions & 4 deletions Src/Controllers/Games.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const neverhaveiever = require('../../models/neverhaveiever')
const trivia = require('../../models/trivia')
const wouldyourather = require('../../models/wouldyourather')


exports.guess = async(req, res, next) => {
try{
const data = require('../Data/Games/Guess.json')
Expand All @@ -15,15 +20,43 @@ exports.guess = async(req, res, next) => {

exports.trivia = async(req, res, next) => {
try{
const data = require('../Data/Games/trivia.json')
const data = await trivia.find()
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
question : randomData.question,
category : randomData.category,
options : randomData.options,
options : randomData.option,
answer : randomData.answer,
difficulty : randomData.difficulty,
correct_option : randomData.correct_option
})
}catch(error){
res.status(500).json({
"error": error
})
}
}

exports.never = async(req, res, next) => {
try{
const data = await neverhaveiever.find()
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
question : randomData.question,
nsfw : randomData.nsfw
})
}catch(error){
res.status(500).json({
"error": error
})
}
}

exports.would = async(req, res, next) => {
try{
const data = await wouldyourather.find()
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
question : randomData.question,
nsfw : randomData.nsfw
})
}catch(error){
res.status(500).json({
Expand Down Expand Up @@ -108,6 +141,60 @@ exports.rockpaper = async(req, res, next) => {
"output": ans
})

}catch(error){
res.status(500).json({
"error": error
})
}
}

exports.eightball = async(req, res, next) => {
try{

let question = req.query.question

if(!question){
res.status(500).json({
"error": "no question was asked!",
"code" : 500
})
}

let ans = [
"Yes",
"No",
"Never",
"Of Course",
"Of Course Not",
"Once in a Million Years",
'It is certain',
'It is decidedly so',
'Without a doubt',
'Yes – definitely',
'You may rely on it',
'As I see it, yes',
'Most likely',
'Outlook good',
'Signs point to yes',
'Reply hazy, try again',
'Ask again later',
'Better not tell you now',
'Cannot predict now',
'Concentrate and ask again',
'My reply is no',
'My sources say no',
'Outlook not so good',
'Very doubtful',
"Don't count on it",
]

let randomAnswer = ans[Math.floor(Math.random() * ans.length)]

res.status(200).json({
"question": question,
"answer" : randomAnswer
})

}catch(error){
res.status(500).json({
"error": error
Expand Down
68 changes: 25 additions & 43 deletions Src/Controllers/Others.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,12 @@ const Jokes = require('../../models/jokes')
const Insults = require('../../models/insults')
const Flirts = require('../../models/flirt')
const Uselessweb = require('../../models/Uselessweb')
const stories = require('../../models/letsnotmeet')
const truthAndDare = require('../../models/truthordare')

function randomStr(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}

function uuid() {
var result1 = '';
var result2 = '';
var result3 = '';
var result4 = '';
var result5 = '';
let randomStr = require('../Utilities/functions').randomStr

var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var charactersLength = characters.length;

for ( var i = 0; i < 8; i++ ) {
result1 += characters.charAt(Math.floor(Math.random() * charactersLength));
}
for ( var i = 0; i < 4; i++ ) {
result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
}
for ( var i = 0; i < 4; i++ ) {
result3 += characters.charAt(Math.floor(Math.random() * charactersLength));
}
for ( var i = 0; i < 4; i++ ) {
result4 += characters.charAt(Math.floor(Math.random() * charactersLength));
}
for ( var i = 0; i < 12; i++ ) {
result5 += characters.charAt(Math.floor(Math.random() * charactersLength));
}

let final = `${result1}-${result2}-${result3}-${result4}-${result5}`

return final
}
let uuid = require('../Utilities/functions').uuid

exports.joke = async(req, res, next) => {
try{
Expand All @@ -61,6 +26,23 @@ exports.joke = async(req, res, next) => {
}
}

exports.letsnotmeet = async(req, res, next) => {
try{
let data = await stories.find()
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
title : randomData.title,
story: randomData.story,
author : randomData.author,
url : randomData.url
})
}catch(error){
res.status(500).json({
"error": error
})
}
}


exports.puns = async(req, res, next) => {
try{
Expand Down Expand Up @@ -283,10 +265,10 @@ exports.doesnotexists = async(req, res, next) => {

exports.truth = async(req, res, next) => {
try{
const data = require('../Data/Truth.json')
const data = await truthAndDare.find({category : "truth"})
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
truth : randomData.truth,
truth : randomData.question,
})
}catch(error){
res.status(500).json({
Expand All @@ -297,10 +279,10 @@ exports.truth = async(req, res, next) => {

exports.dare = async(req, res, next) => {
try{
const data = require('../Data/Dare.json')
const data = await truthAndDare.find({category : "dare"})
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
dare : randomData.dare,
dare : randomData.question,
})
}catch(error){
res.status(500).json({
Expand Down
Loading

0 comments on commit e43ff15

Please sign in to comment.