Added Source Code
This commit is contained in:
commit
3a67e3fcea
|
@ -0,0 +1 @@
|
|||
node_modules/*
|
|
@ -0,0 +1,112 @@
|
|||
const Discord = require('discord.js');
|
||||
const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] } );
|
||||
const {token,prefix} = require('./config.json')
|
||||
client.once('ready', () => {
|
||||
console.log('Ready!');
|
||||
});
|
||||
const { API } = require('nhentai-api');
|
||||
const log = console.log;
|
||||
const api = new API();
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const pagination = require('discord.js-pagination');
|
||||
|
||||
client.on('message', message => {
|
||||
if (message.content === 'h&nhentai') {
|
||||
// send back "Pong." to the channel the message was sent in
|
||||
message.channel.send('Lesss Goo !!');
|
||||
}
|
||||
});
|
||||
|
||||
client.on('message', message => {
|
||||
if (!message.content.startsWith(prefix) || message.author.bot) return;
|
||||
if(!message.channel.nsfw){ message.channel.send("This command can only be used in channels marked nsfw."); return; }
|
||||
const args = message.content.slice(prefix.length).trim().split(' ');
|
||||
const command = args.shift().toLowerCase();
|
||||
if (command === 'cover') {
|
||||
api.getBook(args[0]).then(book => {
|
||||
const coverEmbed = new Discord.MessageEmbed()
|
||||
.setColor("#fc0388")
|
||||
.setTitle(`${book.title.english}`)
|
||||
.setDescription(`${book.tags[0].name}, ${book.tags[1].name}, ${book.tags[2].name}, ${book.tags[3].name}`)
|
||||
.setURL(`https://nhentai.net/g/${book.id}`)
|
||||
.setImage(`${api.getImageURL(book.cover)}`, "\u200B")
|
||||
.addFields({ name: '❤️ *Favorites*', value: `${book.favorites}` })
|
||||
.setTimestamp()
|
||||
message.channel.send(coverEmbed);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
client.on('message', message => {
|
||||
if (!message.content.startsWith(prefix) || message.author.bot) return;
|
||||
const args = message.content.slice(prefix.length).trim().split(' ');
|
||||
const command = args.shift().toLowerCase();
|
||||
if (command === 'readall') {
|
||||
api.getBook(args[0]).then(book => {
|
||||
for (var i = 0; i < book.pages.length; i++) {
|
||||
const mangaEmbed = new Discord.MessageEmbed()
|
||||
.setColor("#057435")
|
||||
.setTitle(`${book.title.english}`)
|
||||
.setDescription(`${book.tags[0].name}, ${book.tags[1].name}, ${book.tags[2].name}, ${book.tags[3].name}`)
|
||||
.setURL(`https://nhentai.net/g/${book.id}`)
|
||||
.setImage(`${api.getImageURL(book.pages[i])}`, "\u200B")
|
||||
.addField(`❤️ *Favorites* ${book.favorites}`)
|
||||
.setTimestamp()
|
||||
message.channel.send(mangaEmbed);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
client.on('message', message => {
|
||||
if (message.author.bot) return;
|
||||
if (message.content.startsWith('emb2')){
|
||||
const Hebergeur = new Discord.MessageEmbed()
|
||||
.setColor("#057435")
|
||||
.setTitle("Name")
|
||||
.addField("**__Image Post : __**", "\u200B")
|
||||
.setTimestamp()
|
||||
|
||||
const Invisible = new Discord.MessageEmbed()
|
||||
.setColor("#057435")
|
||||
.setTitle("Ok It works !")
|
||||
.addField("**__👻 : __**", "\u200B")
|
||||
.setTimestamp()
|
||||
|
||||
const InfoBot = new Discord.MessageEmbed()
|
||||
.setColor("#0E4396")
|
||||
.setTitle("F")
|
||||
.addField("**__Create By Paimon__**", "\u200B")
|
||||
.setTimestamp()
|
||||
|
||||
const pages = [
|
||||
Hebergeur,
|
||||
Invisible,
|
||||
InfoBot
|
||||
]
|
||||
const emojiList = ["◀️", "▶️"];
|
||||
const timeout = '120000';
|
||||
pagination(message, pages, emojiList, timeout)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
client.on('messageReactionAdd', async (reaction, user) => {
|
||||
// When a reaction is received, check if the structure is partial
|
||||
if (reaction.partial) {
|
||||
// If the message this reaction belongs to was removed, the fetching might result in an API error which should be handled
|
||||
try {
|
||||
await reaction.fetch();
|
||||
} catch (error) {
|
||||
console.error('Something went wrong when fetching the message: ', error);
|
||||
// Return as `reaction.message.author` may be undefined/null
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Now the message has been cached and is fully available
|
||||
console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
|
||||
// The reaction is now also fully available and the properties will be reflected accurately:
|
||||
console.log(`${reaction.count} user(s) have given the same reaction to this message!`);
|
||||
});
|
||||
|
||||
client.login(token);
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"prefix":"n&",
|
||||
"token":""
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "sins-bot",
|
||||
"version": "1.0.0",
|
||||
"description": "A NSFW Discord Bot to fullfil your sins\"",
|
||||
"main": "bot.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/BRAVO68WEB/sins-bot.git"
|
||||
},
|
||||
"keywords": [
|
||||
"nhentai",
|
||||
"discordjs",
|
||||
"bot",
|
||||
"api"
|
||||
],
|
||||
"author": "BRAVO68WEB",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/BRAVO68WEB/sins-bot/issues"
|
||||
},
|
||||
"homepage": "https://github.com/BRAVO68WEB/sins-bot#readme",
|
||||
"dependencies": {
|
||||
"discord-paginationembed": "^2.1.0",
|
||||
"discord.js": "^12.5.3",
|
||||
"discord.js-pagination": "^1.0.3",
|
||||
"dou-api": "^1.1.6",
|
||||
"embed-paginator": "^1.0.2",
|
||||
"nana-api": "^1.1.4",
|
||||
"nhentai-api": "^3.0.2",
|
||||
"nhentai-node-api": "^1.1.2",
|
||||
"nhentai.js-api": "^2.2.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
// const { API, } = require('nhentai-api');
|
||||
// const log = console.log;
|
||||
|
||||
// const api = new API();
|
||||
|
||||
// api.getBook(331538).then(book => {
|
||||
// var cover = api.getImageURL(book.cover);
|
||||
// api.getImageURL(book.pages[1]);
|
||||
// log(cover);
|
||||
// });
|
||||
|
||||
// const { NHentai, NHentaiSort } = require('nhentai.js-api');
|
||||
|
||||
// const api = new NHentai();
|
||||
|
||||
// const doIt = async () => {
|
||||
// const results = await api.search('Teri Terio] Yukinya!', NHentaiSort.all_time);
|
||||
// if (results.total > 0) {
|
||||
// // 25 hentai max
|
||||
// for (const hentai of results.hentai) {
|
||||
// // console.log(
|
||||
// // hentai.title,
|
||||
// // hentai.id,
|
||||
// // hentai.url,
|
||||
// // hentai.cover,
|
||||
// // hentai.language
|
||||
// // );
|
||||
// if (hentai.language === 'english') {
|
||||
// const fullHentai = await hentai.fetch();
|
||||
// console.log(fullHentai.images);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // next page
|
||||
// await results.next();
|
||||
// }
|
||||
// }
|
||||
// doIt()
|
||||
|
||||
// const DouAPI = require("dou-api");
|
||||
// const dou = new DouAPI();
|
||||
|
||||
// Get gallery from book ID or book link
|
||||
// dou.g("14045").then((g) => {
|
||||
// console.log(g);
|
||||
// });
|
||||
|
||||
// dou.popular().then((pop) => {
|
||||
// console.log(pop);
|
||||
// });
|
||||
// dou.search(keyword["catgirl", 1, today]).then((search) => {
|
||||
// console.log(search);
|
||||
// })
|
||||
|
||||
const nhentai = require('nhentai-node-api')
|
||||
|
||||
nhentai.search('Cat', 'popular-week', 1)
|
||||
.then(results => {
|
||||
console.log(results);
|
||||
})
|
||||
.catch(err => console.log(err))
|
Loading…
Reference in New Issue