This commit is contained in:
2022-05-09 19:29:50 +02:00
parent d81722dec8
commit af29582c00
19 changed files with 209 additions and 6 deletions

4
.gitignore vendored
View File

@@ -102,3 +102,7 @@ dist
# TernJS port file
.tern-port
# Discord-Bot Configs
./configs/config.json

91
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,91 @@
# Contributing
When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
## Pull Request Process
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent.
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [https://github.com/MrUnknownDE/UnknownAI/blob/main/version][version]
[homepage]: https://github.com/MrUnknownDE/UnknownAI
[version]: https://github.com/MrUnknownDE/UnknownAI/blob/main/version

View File

@@ -21,7 +21,7 @@
### ✨ [Demo](https://mrunknown.de)
## Install
## Install (Node.JS 16.15.0v & NPM 8.5.5v)
```sh
npm install

15
commands/utility/hello.js Normal file
View File

@@ -0,0 +1,15 @@
const Discord = require('discord.js');
const config = require('../../configs/config.json');
module.exports = {
config: {
name: 'Hello',
description: '',
aliases: [""],
usage: '',
accessableby: "",
},
run: async (client, message, args) => {
message.channel.send("Hello <3");
}
}

View File

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

27
main.js
View File

@@ -1,19 +1,38 @@
// PACKAGES
const Discord = require('discord.js');
const config = require('./configs/config.json');
const fs = require('fs');
const db = require('quick.db');
const path = require('path');
const client = new Discord.Client();
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
const path = require("path");
const client = new Discord.Client;
const { Player } = require('discord-player');
const player = new Player(client);
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
client.player = player;
client.emotes = require('./configs/emotes.json')
client.filters = require('./configs/filters.json');
["aliases", "commands"].forEach(cmd => client[cmd] = new Discord.Collection());
["console", "command", "event"].forEach(events => require(`./handlers/${events}`)(client));
client.categories = fs.readdirSync('./commands');
fs.readdir('./player/', (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./player/${file}`);
let eventName = file.split(".")[0];
console.log(`Loading player event ${eventName}`);
client.player.on(eventName, event.bind(null, client));
});
});
// EVENTS
client.on('ready', async() => {
console.log('UnknownAI Started!');

11
package-lock.json generated
View File

@@ -12,6 +12,7 @@
"chalk": "^5.0.1",
"discord.js": "^13.6.0",
"fs": "^0.0.1-security",
"loader": "^2.1.1",
"moment": "^2.29.3",
"npx": "^3.0.0",
"path": "^0.12.7",
@@ -490,6 +491,11 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"node_modules/loader": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/loader/-/loader-2.1.1.tgz",
"integrity": "sha1-iEixKj8AVy5aQkkzPM2seXc/tAI="
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
@@ -2559,6 +2565,11 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"loader": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/loader/-/loader-2.1.1.tgz",
"integrity": "sha1-iEixKj8AVy5aQkkzPM2seXc/tAI="
},
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",

View File

@@ -26,6 +26,7 @@
"chalk": "^5.0.1",
"discord.js": "^13.6.0",
"fs": "^0.0.1-security",
"loader": "^2.1.1",
"moment": "^2.29.3",
"npx": "^3.0.0",
"path": "^0.12.7",

3
player/botDisconnect.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, queue) => {
message.channel.send(`${client.emotes.error} - Music stopped as i have been disconnected from the channel !`);
};

3
player/channelEmpty.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, queue) => {
message.channel.send(`${client.emotes.error} - Music stopped as there is no more member in the voice channel !`);
};

21
player/error.js Normal file
View File

@@ -0,0 +1,21 @@
module.exports = (client, error, message, ...args) => {
switch (error) {
case 'NotPlaying':
message.channel.send(`${client.emotes.error} - There is no music being played on this server !`);
break;
case 'NotConnected':
message.channel.send(`${client.emotes.error} - You are not connected in any voice channel !`);
break;
case 'UnableToJoin':
message.channel.send(`${client.emotes.error} - I am not able to join your voice channel, please check my permissions !`);
break;
case 'VideoUnavailable':
message.channel.send(`${client.emotes.error} - ${args[0].title} is not available in your country! Skipping...`);
break;
case 'MusicStarting':
message.channel.send(`The music is starting... please wait and retry!`);
break;
default:
message.channel.send(`${client.emotes.error} - Something went wrong ... Error : ${error}`);
};
};

3
player/noResults.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, query) => {
message.channel.send(`${client.emotes.error} - No results found on YouTube for ${query} !`);
};

3
player/playlistAdd.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, queue, playlist) => {
message.channel.send(`${client.emotes.music} - ${playlist.title} has been added to the queue (**${playlist.tracks.length}** songs) !`);
};

3
player/queueEnd.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, queue) => {
message.channel.send(`${client.emotes.error} - Music stopped as there is no more music in the queue !`);
};

3
player/searchCancel.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, query, tracks) => {
message.channel.send(`${client.emotes.error} - You did not provide a valid response ... Please send the command again !`);
};

View File

@@ -0,0 +1,6 @@
module.exports = (client, message, query, tracks, content, collector) => {
if (content === 'cancel') {
collector.stop();
return message.channel.send(`${client.emotes.success} - The selection has been **cancelled** !`);
} else message.channel.send(`${client.emotes.error} - You must send a valid number between **1** and **${tracks.length}** !`);
};

11
player/searchResults.js Normal file
View File

@@ -0,0 +1,11 @@
module.exports = (client, message, query, tracks) => {
message.channel.send({
embed: {
color: 'BLUE',
author: { name: `Here are your search results for ${query}` },
footer: { text: 'This bot uses a Github project made by Zerio (ZerioDev/Music-bot)' },
timestamp: new Date(),
description: `${tracks.map((t, i) => `**${i + 1}** - ${t.title}`).join('\n')}`,
},
});
};

3
player/trackAdd.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, queue, track) => {
message.channel.send(`${client.emotes.music} - ${track.title} has been added to the queue !`);
};

3
player/trackStart.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = (client, message, track) => {
message.channel.send(`${client.emotes.music} - Now playing ${track.title} into ${message.member.voice.channel.name} ...`);
};