This commit is contained in:
2022-05-09 19:09:18 +02:00
parent 371f31965a
commit c529e60cf3
14 changed files with 4021 additions and 3 deletions

58
README.md Normal file
View File

@@ -0,0 +1,58 @@
<h1 align="center">Welcome to UnknownAI 👋</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
<a href="https://github.com/MrUnknownDE/UnknownAI#readme" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a>
<a href="https://github.com/MrUnknownDE/UnknownAI/graphs/commit-activity" target="_blank">
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" />
</a>
<a href="https://github.com/MrUnknownDE/UnknownAI/blob/master/LICENSE" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/github/license/MrUnknownDE/UnknownAI" />
</a>
<a href="https://twitter.com/MrUnknownDE" target="_blank">
<img alt="Twitter: MrUnknownDE" src="https://img.shields.io/twitter/follow/MrUnknownDE.svg?style=social" />
</a>
</p>
> a bot from me (a noob) in NodeJS
### 🏠 [Homepage](https://github.com/MrUnknownDE/UnknownAI#readme)
### ✨ [Demo](https://mrunknown.de)
## Install
```sh
npm install
```
## Usage
```sh
node main.js
```
## Author
👤 **MrUnknownDE**
* Website: https://johanneskr.de
* Twitter: [@MrUnknownDE](https://twitter.com/MrUnknownDE)
* Github: [@MrUnknownDE](https://github.com/MrUnknownDE)
## 🤝 Contributing
Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/MrUnknownDE/UnknownAI/issues). You can also take a look at the [contributing guide](https://github.com/MrUnknownDE/UnknownAI/blob/master/CONTRIBUTING.md).
## Show your support
Give a ⭐️ if this project helped you!
## 📝 License
Copyright © 2022 [MrUnknownDE](https://github.com/MrUnknownDE).<br />
This project is [MIT](https://github.com/MrUnknownDE/UnknownAI/blob/master/LICENSE) licensed.
***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

47
commands/owner/eval.js Normal file
View File

@@ -0,0 +1,47 @@
const Discord = require('discord.js');
const config = require('../../configs/config.json');
const { embedcolor } = require('../../configs/config.json')
module.exports = {
config: {
name: 'eval',
description: 'Eval',
aliases: [""],
usage: '<user>',
accessableby: "not you",
},
run: async (client, message, args) => {
let array = config.dev
if(!array.includes(message.author.id.toString())) {
return message.channel.send("Only Developers can execute this command")
}
const content = message.content.split(" ").slice(1).join(" ");
const result = new Promise((resolve, reject) => resolve(eval(content)));
return result.then((output) => {
if(typeof output !== "string"){
output = require("util").inspect(output, { depth: 0 });
}
if(output.includes(client.token)){
output = output.replace(message.client.token, "T0K3N");
}
message.channel.send({embed:{
title: "EVAL",
description: `\`\`\`js\n${output}\`\`\``,
color: embedcolor
}});
}).catch((err) => {
err = err.toString();
if(err.includes(message.client.token)){
err = err.replace(message.client.token, "T0K3N");
}
message.channel.send(err, {
code: "js"
});
});
}

21
commands/utility/ping.js Normal file
View File

@@ -0,0 +1,21 @@
const Discord = require('discord.js');
const config = require('../../configs/config.json');
module.exports = {
config: {
name: 'Ping',
description: '',
aliases: [""],
usage: '',
accessableby: "",
},
run: async (client, message, args) => {
const embed = new MessageEmbed()
const latency = `\`\`\`ini\n[ ${bot.ws.ping}ms ]\`\`\``;
embed.setTitle(`Pong!`)
.setColor(embedcolor)
.addField('Latency', latency, true)
.setTimestamp();
message.channel.send(embed);
}
}

View File

@@ -0,0 +1,5 @@
{
"prefix": "ai.",
"dev": "155076323612688384",
"token": "NDIzMjE1NTM1ODkxODA4MjY2.GivmSm.WGaa5Ivx9Mzm64RrHECHjiTwilNOzgq6Hw1i_Y"
}

16
configs/emotes.json Normal file
View File

@@ -0,0 +1,16 @@
{
"load": "<a:correct4:739792153584205825>",
"verified": "<a:correct4:739792153584205825>",
"error": "<a:correct4:739792153584205825>",
"info": "<a:correct4:739792153584205825>",
"music": "<a:correct4:739792153584205825>",
"queue": "<a:correct4:739792153584205825>",
"success": "<a:correct4:739792153584205825>",
"music1": "<a:correct4:739792153584205825>",
"fun": "<a:correct4:739792153584205825>",
"chatbot": "<a:correct4:739792153584205825>",
"image": "<a:correct4:739792153584205825>",
"anime": "<a:correct4:739792153584205825>",
"nsfw": "<a:correct4:739792153584205825>",
"other": "<a:correct4:739792153584205825>"
}

20
configs/filters.json Normal file
View File

@@ -0,0 +1,20 @@
{
"bassboost": "Bassboost",
"8D": "8D",
"vaporwave": "Vaporwave",
"nightcore": "Nightcore",
"phaser": "Phaser",
"tremolo": "Tremolo",
"vibrato": "Vibrato",
"reverse": "Reverse",
"treble": "Treble",
"normalizer": "Normalizer",
"surrounding": "Surrounding",
"pulsator": "Pulsator",
"subboost": "Subboost",
"karaoke": "Karaoke",
"flanger": "Flanger",
"gate": "Gate",
"haas": "Haas",
"mcompand": "Mcompand"
}

15
events/client/ready.js Normal file
View File

@@ -0,0 +1,15 @@
const { PREFIX } = require('../../configs/config.json');
const moment = require('moment');
const chalk = require("chalk")
module.exports = async client => {
let totalUsers = client.guilds.cache.reduce((users , value) => users + value.memberCount, 0);
let totalGuilds = client.guilds.cache.size
let totalChannels = client.channels.cache.size
console.log(chalk.red`[${moment().format('YYYY-MM-DD HH:mm:ss')}] BOT: Active, Commands Loaded!`);
console.log(chalk.red`[${moment().format('YYYY-MM-DD HH:mm:ss')}] BOT: ${client.user.username} Logged In!`);
client.user.setPresence({ activity: { name: `${totalUsers} Users`, type: "PLAYING" }, status: "online" });
console.log(chalk.blue`[${moment().format('YYYY-MM-DD HH:mm:ss')}] BOT: Now ` + totalChannels + ` channels, ` + totalGuilds + ` Servers and ` + totalUsers + ` serving users!`);
}

45
functions.js Normal file
View File

@@ -0,0 +1,45 @@
module.exports = {
getMember: function(message, toFind = "") {
toFind = toFind.toLowerCase();
let target = message.guild.members.get(toFind);
if (!target && message.mentions.members)
target = message.mentions.members.first();
if (!target && toFind) {
target = message.guild.members.find(member => {
return (
member.displayName.toLowerCase().includes(toFind) ||
member.user.tag.toLowerCase().includes(toFind)
);
});
}
if (!target) target = message.member;
return target;
},
formatDate: function(date) {
return new Intl.DateTimeFormat("en-US").format(date);
},
promptMessage: async function(message, author, time, validReactions) {
// We put in the time as seconds, with this it's being transfered to MS
time *= 1000;
// For every emoji in the function parameters, react in the good order.
for (const reaction of validReactions) await message.react(reaction);
// Only allow reactions from the author,
// and the emoji must be in the array we provided.
const filter = (reaction, user) =>
validReactions.includes(reaction.emoji.name) && user.id === author.id;
// And ofcourse, await the reactions
return message
.awaitReactions(filter, { max: 1, time: time })
.then(collected => collected.first() && collected.first().emoji.name);
}
};

12
handlers/command.js Normal file
View File

@@ -0,0 +1,12 @@
const fs = require('fs');
module.exports = (client) => {
const load = dirs => {
const commands = fs.readdirSync(`./commands/${dirs}/`).filter(cmd => cmd.endsWith('.js'));
for (let cmd of commands) {
let pull = require(`../commands/${dirs}/${cmd}`);
client.commands.set(pull.config.name, pull);
if (pull.config.aliases) pull.config.aliases.forEach(cmd => client.aliases.set(cmd, pull.config.name));
};
};
["Folder Names Inside Commands folder"].forEach(cmd => load(cmd));
};

12
handlers/event.js Normal file
View File

@@ -0,0 +1,12 @@
const fs = require('fs');
module.exports = (client) => {
const load = dirs => {
const events = fs.readdirSync(`./events/${dirs}`).filter(events => events.endsWith('.js'));
for (let file of events) {
const events = require(`../events/${dirs}/${file}`);
let eventName = file.split('.')[0];
client.on(eventName, events.bind(null,client));
};
};
['client', 'guild'].forEach(events => load(events));
};

0
json.sqlite Normal file
View File

View File

@@ -1,5 +1,5 @@
const Discord = require('discord.js');
const config = require('./src/config.json');
const config = require('./configs/config.json');
const fs = require('fs');
const db = require('quick.db');
const path = require('path');

3758
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"description": "a bot from me (a noob) in NodeJS",
"main": "main.js",
"scripts": {
"test": "debug"
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
@@ -21,5 +21,14 @@
"bugs": {
"url": "https://github.com/MrUnknownDE/UnknownAI/issues"
},
"homepage": "https://github.com/MrUnknownDE/UnknownAI#readme"
"homepage": "https://github.com/MrUnknownDE/UnknownAI#readme",
"dependencies": {
"chalk": "^5.0.1",
"discord.js": "^13.6.0",
"fs": "^0.0.1-security",
"moment": "^2.29.3",
"npx": "^3.0.0",
"path": "^0.12.7",
"quick.db": "^7.1.3"
}
}