├── src ├── data │ ├── ga.json │ ├── afk.json │ └── config.example.json ├── structures │ ├── events.js │ ├── interactionCreate.js │ ├── ready.js │ ├── handler.js │ ├── messageCreate.js │ ├── dmMessage.js │ └── presenceUpdate.js └── commands │ ├── interaction │ ├── ping.js │ ├── afk.js │ ├── serverinfo.js │ ├── eval.js │ ├── avatar.js │ ├── userinfo.js │ ├── weather.js │ ├── mal.js │ ├── osu.js │ ├── stats.js │ ├── genshin.js │ └── help.js │ └── message │ ├── admin │ ├── user.js │ ├── say.js │ ├── kick.js │ ├── ban.js │ ├── mute.js │ ├── unmute.js │ └── warn.js │ ├── general │ ├── end.js │ ├── reroll.js │ ├── add.js │ └── register.js │ └── moderation │ └── nickname.js ├── start.bat ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ └── bug-report.md ├── workflows │ ├── ESLint.yml │ └── develop.yml └── dependabot.yml ├── .eslintignore ├── .gitignore ├── LICENSE ├── .circleci └── config.yml ├── index.js ├── SECURITY.MD ├── .env.example ├── deploy.js ├── .eslintrc.json ├── package.json ├── client.js └── README.md /src/data/ga.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /src/data/afk.json: -------------------------------------------------------------------------------- 1 | {"afkvalue":[]} -------------------------------------------------------------------------------- /start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | node . -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @Muunatic 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | .env 3 | cfg.js -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # modules 2 | node_modules 3 | 4 | # env 5 | .env 6 | 7 | # clientcfg 8 | config.json 9 | -------------------------------------------------------------------------------- /src/data/config.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientId": "clientId", 3 | "prefix": ["prefix"], 4 | "guildId": "guildId", 5 | "token": "token" 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | © 2021 - 2024 Muunatic. All Rights Reserved. 2 | 3 | This file is part of the RyU project. 4 | The RyU project can not be distributed without the express permission of Muunatic. 5 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | jobs: 4 | lint: 5 | docker: 6 | - image: cimg/node:16.20.2 7 | steps: 8 | - checkout 9 | - run: npm ci 10 | - run: npm test 11 | 12 | workflows: 13 | lint: 14 | jobs: 15 | - lint 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Changes 2 | 3 | 4 | ## Status 5 | 6 | 7 | - [ ] Follow the installation from **README**. 8 | - [ ] Run npm test. 9 | -------------------------------------------------------------------------------- /src/structures/events.js: -------------------------------------------------------------------------------- 1 | process.on('unhandledRejection', error => { 2 | console.error('Unhandled Promise Rejection:', error); 3 | }); 4 | 5 | process.on('uncaughtException', error => { 6 | console.error('uncaughtException:', error); 7 | }); 8 | 9 | process.on('uncaughtExceptionMonitor', error => { 10 | console.error('uncaughtExceptionMonitor:', error); 11 | }); 12 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { client } = require('./client'); 2 | 3 | require('./client'); 4 | require('./src/structures/handler'); 5 | require('./src/structures/ready'); 6 | require('./src/structures/events'); 7 | require('./src/structures/presenceUpdate'); 8 | require('./src/structures/interactionCreate'); 9 | require('./src/structures/messageCreate'); 10 | require('./src/structures/dmMessage'); 11 | 12 | client.login(process.env.CLIENT_TOKEN); 13 | console.log('Starting client'); 14 | -------------------------------------------------------------------------------- /SECURITY.MD: -------------------------------------------------------------------------------- 1 | # Vulnerability 2 | 3 | |Version|Vulnerability| 4 | |-|-| 5 | |5.5.3|:white_check_mark:| 6 | |5.5.2|:x:| 7 | |5.5.1-1|:x:| 8 | |5.5.1|:x:| 9 | |5.5.0|:x:| 10 | |5.4.1-2|:x:| 11 | |5.4.1-1|:x:| 12 | |5.4.1|:x:| 13 | |5.4.0|:x:| 14 | |5.3.0|:x:| 15 | |5.2.2|:x:| 16 | |5.2.1|:x:| 17 | |5.2.0|:x:| 18 | |5.1.1|:x:| 19 | |5.1.0|:x:| 20 | |5.0.3|:x:| 21 | |5.0.2|:x:| 22 | |5.0.1|:x:| 23 | |5.0.0|:x:| 24 | 25 | Please report security issues to [Muunatic](mailto:muunatic@typeslint.com) 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report here if you find a bug 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. 16 | 2. 17 | 3. 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Version** 23 | - Node.JS: v16.x.x 24 | - NPM: v8.x.x 25 | -------------------------------------------------------------------------------- /src/commands/interaction/ping.js: -------------------------------------------------------------------------------- 1 | const { SlashCommandBuilder } = require('@discordjs/builders'); 2 | 3 | module.exports = { 4 | data: new SlashCommandBuilder() 5 | .setName('ping') 6 | .setDescription('Client ping'), 7 | /** 8 | * @param {import("../../../client").interaction} interaction 9 | * @param {import("../../../client").client} client 10 | */ 11 | async execute(interaction, client) { 12 | interaction.reply(`Pong !! \`${client.ws.ping}ms.\` Latensi \`${Date.now() - interaction.createdTimestamp}ms.\``); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /src/structures/interactionCreate.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../../client'); 2 | 3 | client.on('interactionCreate', async interaction => { 4 | 5 | if (!interaction.isCommand()) return; 6 | if (!interaction.guild) return; 7 | 8 | const command = client.commands.get(interaction.commandName); 9 | 10 | if (!command) return; 11 | 12 | try { 13 | await command.execute(interaction, client); 14 | } catch (error) { 15 | console.error(error); 16 | await interaction.reply({ content: process.env.DEFAULT_ERROR, ephemeral: true }); 17 | } 18 | 19 | }); 20 | -------------------------------------------------------------------------------- /src/commands/message/admin/user.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../../../../client'); 2 | const { Permissions } = require('discord.js'); 3 | 4 | module.exports = { 5 | name: 'user', 6 | /** 7 | * @param {import("../../../../client").message} message 8 | * @param {Array} args 9 | */ 10 | execute(message, args) { 11 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 12 | const dmUser = client.users.cache.get(args[0]); 13 | dmUser.send(args.slice(1).join(' ')); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /.github/workflows/ESLint.yml: -------------------------------------------------------------------------------- 1 | name: ESLint 2 | 3 | on: 4 | push: 5 | branches: [ v5 ] 6 | pull_request: 7 | branches: [ v5 ] 8 | 9 | jobs: 10 | lint: 11 | runs-on: windows-latest 12 | strategy: 13 | matrix: 14 | node-version: [16.20.2] 15 | steps: 16 | - uses: actions/checkout@v3 17 | - name: Use Node.js ${{ matrix.node-version }} 18 | uses: actions/setup-node@v3 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | - name: install npm 22 | run: npm install npm@8.19.3 -g 23 | - name: install dependencies 24 | run: npm ci 25 | - name: run lint 26 | run: npm test 27 | -------------------------------------------------------------------------------- /.github/workflows/develop.yml: -------------------------------------------------------------------------------- 1 | name: ESLint develop 2 | 3 | on: 4 | push: 5 | branches: [ develop ] 6 | pull_request: 7 | branches: [ develop ] 8 | 9 | jobs: 10 | lint: 11 | runs-on: windows-latest 12 | strategy: 13 | matrix: 14 | node-version: [16.20.2] 15 | steps: 16 | - uses: actions/checkout@v3 17 | - name: Use Node.js ${{ matrix.node-version }} 18 | uses: actions/setup-node@v3 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | - name: install npm 22 | run: npm install npm@8.19.3 -g 23 | - name: install dependencies 24 | run: npm ci 25 | - name: run lint 26 | run: npm test 27 | -------------------------------------------------------------------------------- /src/commands/interaction/afk.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const { SlashCommandBuilder } = require('@discordjs/builders'); 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('afk') 7 | .setDescription('Set AFK'), 8 | /** 9 | * @param {import("../../../client").interaction} interaction 10 | */ 11 | async execute(interaction) { 12 | const afkJson = require('../../../data/afk.json'); 13 | afkJson.afkvalue.push(interaction.user.id); 14 | fs.writeFileSync('./src/data/afk.json', JSON.stringify(afkJson)); 15 | interaction.reply(`**\`${interaction.user.username}\` telah AFK!**`); 16 | interaction.member.setNickname(`[AFK] ${interaction.user.username}`); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # NOTE : RENAME THIS TO .ENV 2 | 3 | # REQUIRED VAL 4 | 5 | CLIENT_TOKEN=CLIENT_TOKEN 6 | 7 | PREFIX=CLIENT_PREFIX 8 | 9 | SERVERID=YOUR_GUILD_ID 10 | 11 | DISCORDLINK=YOUR_GUILD_LINK 12 | 13 | OWNERID=OWNER_ID 14 | 15 | # OPTIONAL VAL 16 | 17 | CHANNELLOGID=CHANNEL_ID 18 | 19 | CHANNELLOGPRIVATE=CHANNEL_ID 20 | 21 | OSU_API=OSU_API 22 | 23 | GENERALCHAT=CHANNEL_ID 24 | 25 | EVERYONE_ID=ROLE_ID 26 | 27 | MOD_ROLE=ROLE_ID 28 | 29 | MUTE_ROLE=ROLE_ID 30 | 31 | REGISTER_ID=ROLE_ID 32 | 33 | UNREGISTER_ID=ROLE_ID 34 | 35 | activityRole1=ROLE_ID 36 | 37 | activityRole2=ROLE_ID 38 | 39 | activityRole3=ROLE_ID 40 | 41 | activityRole4=ROLE_ID 42 | 43 | activityRole5=ROLE_ID 44 | 45 | activityRole6=ROLE_ID 46 | 47 | # DO NOT CHANGE 48 | 49 | DEFAULT_ERROR="**[0] - Error !!**" -------------------------------------------------------------------------------- /src/structures/ready.js: -------------------------------------------------------------------------------- 1 | const { client, packageJson } = require('../../client'); 2 | 3 | client.on('ready', () => { 4 | 5 | console.log(client.user.username + '#' + client.user.discriminator + ': ' + '\x1b[32m' + 'Hello, World!' + '\x1b[0m'); 6 | 7 | const presenceList = [ 8 | `Version ${packageJson.version} | /help`, 9 | `${process.env.DISCORDLINK} | /help`, 10 | `${client.guilds.cache.size} server | /help` 11 | ]; 12 | 13 | let i = 0; 14 | setInterval(() => { 15 | const index = Math.floor(i); 16 | client.user.setActivity({ name: presenceList[index], type: 'COMPETING', url: 'https://www.twitch.tv/discord' }); 17 | i = i + 1; 18 | console.log(presenceList[index]); 19 | if (i === presenceList.length) i = i - presenceList.length; 20 | }, 5000); 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /src/commands/message/admin/say.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../../../../client'); 2 | const { Permissions } = require('discord.js'); 3 | 4 | module.exports = { 5 | name: 'say', 6 | /** 7 | * @param {import("../../../../client").message} message 8 | * @param {Array} args 9 | */ 10 | execute(message, args) { 11 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 12 | const channel = client.channels.cache.get(args[0]); 13 | if (!client.channels.cache.get(args[0])) return message.channel.send(process.env.DEFAULT_ERROR); 14 | if (!args[1]) return message.channel.send('**Berikan args**'); 15 | channel.send(args.slice(1).join(' ')); 16 | message.react('✅'); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /src/structures/handler.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const { Collection } = require('discord.js'); 3 | const { client } = require('../../client'); 4 | 5 | client.commands = new Collection(); 6 | 7 | const interactionFiles = fs.readdirSync('./src/commands/interaction').filter(file => file.endsWith('.js')); 8 | for (const file of interactionFiles) { 9 | const command = require(`../commands/interaction/${file}`); 10 | client.commands.set(command.data.name, command); 11 | } 12 | 13 | fs.readdirSync('./src/commands/message/').forEach(dir => { 14 | const commandFiles = fs.readdirSync(`./src/commands/message/${dir}`).filter(file => file.endsWith('.js')); 15 | for (const file of commandFiles) { 16 | const command = require(`../commands/message/${dir}/${file}`); 17 | client.commands.set(command.name, command); 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /src/commands/message/general/end.js: -------------------------------------------------------------------------------- 1 | const { Permissions } = require('discord.js'); 2 | const { manager } = require('../../../../client'); 3 | 4 | module.exports = { 5 | name: 'end', 6 | /** 7 | * @param {import("../../../../client").message} message 8 | * @param {Array} args 9 | */ 10 | execute(message, args) { 11 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 12 | if (!args.join(' ')) return message.channel.send(`${process.env.PREFIX}end `); 13 | const msgId = args[0]; 14 | manager.end(msgId).then(() => { 15 | message.channel.send('**Success !!**'); 16 | }).catch(() => { 17 | message.channel.send('ID tidak ditemukan'); 18 | }); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /src/commands/message/general/reroll.js: -------------------------------------------------------------------------------- 1 | const { manager } = require('../../../../client'); 2 | const { Permissions } = require('discord.js'); 3 | 4 | module.exports = { 5 | name: 'reroll', 6 | /** 7 | * @param {import("../../../../client").message} message 8 | * @param {Array} args 9 | */ 10 | execute(message, args) { 11 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 12 | if (!args.join(' ')) return message.channel.send(`${process.env.PREFIX}reroll `); 13 | const msgId = args[0]; 14 | manager.reroll(msgId).then(() => { 15 | message.channel.send('Rerolled'); 16 | }).catch(() => { 17 | message.channel.send('ID tidak ditemukan'); 18 | }); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /deploy.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const { REST } = require('@discordjs/rest'); 3 | const { Routes } = require('discord-api-types/v10'); 4 | const { token, clientId } = require('./src/data/config.json'); 5 | 6 | const commands = [].map(command => command.toJSON()); 7 | 8 | const commandFiles = fs.readdirSync('./src/commands/interaction').filter(file => file.endsWith('.js')); 9 | for (const file of commandFiles) { 10 | const command = require(`./src/commands/interaction/${file}`); 11 | commands.push(command.data.toJSON()); 12 | } 13 | 14 | const rest = new REST({ version: '10' }).setToken(token); 15 | 16 | (async () => { 17 | 18 | try { 19 | console.log('Refreshing...'); 20 | await rest.put(Routes.applicationCommands(clientId), { body: commands }); 21 | console.log('Deployed!'); 22 | } catch (error) { 23 | console.error(error); 24 | } 25 | 26 | })(); 27 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | time: "07:00" 8 | timezone: "Asia/Jakarta" 9 | open-pull-requests-limit: 20 10 | target-branch: "develop" 11 | labels: 12 | - "dependencies" 13 | commit-message: 14 | prefix: "chore" 15 | include: "scope" 16 | ignore: 17 | - dependency-name: "discord.js" 18 | update-types: ["version-update:semver-major"] 19 | - dependency-name: "@discordjs/builders" 20 | update-types: ["version-update:semver-major"] 21 | - dependency-name: "@discordjs/rest" 22 | update-types: ["version-update:semver-major"] 23 | - dependency-name: "discord-api-types" 24 | update-types: ["version-update:semver-major"] 25 | - dependency-name: "discord-giveaways" 26 | update-types: ["version-update:semver-major"] 27 | - dependency-name: "eslint" 28 | update-types: ["version-update:semver-major"] 29 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "commonjs": true, 5 | "es2021": true 6 | }, 7 | "extends": "eslint:recommended", 8 | "parserOptions": { 9 | "ecmaVersion": 12 10 | }, 11 | "rules": { 12 | "arrow-parens": ["warn", "as-needed"], 13 | "comma-dangle": ["warn", "never"], 14 | "comma-style": ["warn", "last"], 15 | "eol-last": ["warn", "always"], 16 | "indent": ["warn", 4, { 17 | "MemberExpression": 0, 18 | "SwitchCase": 1 19 | }], 20 | "keyword-spacing": ["warn", { 21 | "after": true, 22 | "before": true 23 | }], 24 | "no-multiple-empty-lines": ["warn", { 25 | "max": 1, 26 | "maxEOF": 0 27 | }], 28 | "no-trailing-spaces": 1, 29 | "no-unused-vars": 1, 30 | "no-useless-escape": 0, 31 | "quotes": ["warn", "single"], 32 | "semi": 1, 33 | "semi-style": ["warn", "last"] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ryu", 3 | "version": "5.5.3", 4 | "description": "Powerful Discord Automaton", 5 | "main": "index.js", 6 | "type": "commonjs", 7 | "scripts": { 8 | "start": "node index.js", 9 | "deploy": "node deploy.js", 10 | "test": "eslint ." 11 | }, 12 | "homepage": "https://github.com/Muunatic/RyU", 13 | "author": "Muunatic", 14 | "license": "UNLICENSED", 15 | "dependencies": { 16 | "@discordjs/builders": "^1.10.1", 17 | "@discordjs/rest": "^1.7.1", 18 | "cpu-stat": "^2.0.1", 19 | "discord-api-types": "^0.37.119", 20 | "discord-giveaways": "^5.2.2", 21 | "discord.js": "^13.17.1", 22 | "dotenv": "^16.4.7", 23 | "genshin-db": "^5.2.0", 24 | "mal-scraper": "^2.13.2", 25 | "moment": "^2.30.1", 26 | "moment-timezone": "^0.5.48", 27 | "ms": "^2.1.3", 28 | "msn-weather-api": "^0.3.1", 29 | "node-osu": "^2.2.1" 30 | }, 31 | "devDependencies": { 32 | "eslint": "^8.57.1" 33 | }, 34 | "engines": { 35 | "node": ">=16.20.2", 36 | "npm": ">=8.19.4" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/commands/interaction/serverinfo.js: -------------------------------------------------------------------------------- 1 | const { SlashCommandBuilder } = require('@discordjs/builders'); 2 | const { MessageEmbed } = require('discord.js'); 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('serverinfo') 7 | .setDescription('Server info'), 8 | /** 9 | * @param {import("../../../client").interaction} interaction 10 | */ 11 | async execute(interaction) { 12 | const msgEmbed = new MessageEmbed() 13 | 14 | .setColor('#89e0dc') 15 | .setTitle('Info Server') 16 | .setThumbnail(`${interaction.guild.iconURL({format : 'png', dynamic : true, size : 4096})}`) 17 | .setDescription(`Nama server : **${interaction.guild.name}**\n\nID server : **${interaction.guild.id}**\n\nJumlah member : **${interaction.guild.memberCount}**\n\nServer dibuat pada tanggal : **${interaction.guild.createdAt}**`) 18 | .setFooter({text: `Info server ${interaction.guild.name}`, iconURL: interaction.guild.iconURL({format : 'png', dynamic : true, size : 1024})}) 19 | .setTimestamp(); 20 | 21 | interaction.reply({embeds: [msgEmbed]}); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/commands/interaction/eval.js: -------------------------------------------------------------------------------- 1 | const { SlashCommandBuilder } = require('@discordjs/builders'); 2 | const { inspect } = require('util'); 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('eval') 7 | .setDescription('Eval') 8 | .addStringOption(value => 9 | value.setName('value') 10 | .setDescription('Eval value') 11 | .setRequired(true) 12 | ), 13 | /** 14 | * @param {import("../../../client").interaction} interaction 15 | */ 16 | async execute(interaction) { 17 | const args = interaction.options.get('value').value; 18 | if (interaction.user.id !== process.env.OWNERID) return interaction.reply(process.env.DEFAULT_ERROR); 19 | 20 | try { 21 | const result = await eval(args); 22 | let output = result; 23 | if (typeof result !== 'string') { 24 | output = inspect(result); 25 | } 26 | interaction.reply({content: output}); 27 | } catch (error) { 28 | console.log(error); 29 | interaction.reply(process.env.DEFAULT_ERROR); 30 | } 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /src/commands/message/admin/kick.js: -------------------------------------------------------------------------------- 1 | const { Permissions } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: 'kick', 5 | /** 6 | * @param {import("../../../../client").message} message 7 | * @param {Array} args 8 | */ 9 | execute(message, args) { 10 | if (!message.member.permissions.has(Permissions.FLAGS.KICK_MEMBERS)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 11 | const user = message.mentions.users.first(); 12 | if (user) { 13 | const member = message.guild.members.resolve(user); 14 | if (member) { 15 | member.kick(`Telah dikick dari server oleh ${message.author.username}`).then(() => { 16 | if (args[1]) return message.channel.send(`**${user.tag} Telah dikick dikarenakan ${args.slice(1).join(' ')}**`); 17 | if (!args[1]) return message.channel.send(`**${user.tag} Telah dikick**`); 18 | }); 19 | } else { 20 | message.channel.send('**User tidak ditemukan**'); 21 | } 22 | } else { 23 | message.channel.send('**Mention user untuk melakukan kick**'); 24 | } 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /src/commands/message/admin/ban.js: -------------------------------------------------------------------------------- 1 | const { Permissions } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: 'ban', 5 | /** 6 | * @param {import("../../../../client").message} message 7 | * @param {Array} args 8 | */ 9 | execute(message, args) { 10 | if (!message.member.permissions.has(Permissions.FLAGS.BAN_MEMBERS)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 11 | const user = message.mentions.users.first(); 12 | if (user) { 13 | const member = message.guild.members.resolve(user); 14 | if (member) { 15 | member.ban({ 16 | days: 0 17 | }).then(() => { 18 | if (args[1]) return message.channel.send(`**${user.tag} Telah diban permanen dikarenakan ${args.slice(1).join(' ')}**`); 19 | if (!args[1]) return message.channel.send(`**${user.tag} Telah diban permanen**`); 20 | }); 21 | } else { 22 | message.channel.send('**User tidak ditemukan**'); 23 | } 24 | } else { 25 | message.channel.send('**Mention user untuk melakukan ban**'); 26 | } 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/commands/interaction/avatar.js: -------------------------------------------------------------------------------- 1 | const { SlashCommandBuilder } = require('@discordjs/builders'); 2 | const { MessageEmbed } = require('discord.js'); 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('avatar') 7 | .setDescription('Get Avatar') 8 | .addUserOption(option => 9 | option.setName('user') 10 | .setDescription('Mention user') 11 | ), 12 | /** 13 | * @param {import("../../../client").interaction} interaction 14 | */ 15 | async execute(interaction) { 16 | const userValue = interaction.options.getUser('user') || interaction.user; 17 | const usernameValue = interaction.options.getUser('user') || interaction.member.user; 18 | const msgEmbed = new MessageEmbed() 19 | 20 | .setColor('#89e0dc') 21 | .setTitle('Avatar') 22 | .setDescription(`Avatarnya ${usernameValue.username}`) 23 | .setImage(`${userValue.avatarURL({format : 'png', dynamic : true, size : 4096})}`) 24 | .setFooter({text: `Direquest oleh ${interaction.member.nickname || interaction.user.username}`, iconURL: interaction.user.avatarURL({format : 'png', dynamic : true, size : 1024})}); 25 | 26 | interaction.reply({embeds: [msgEmbed]}); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/commands/interaction/userinfo.js: -------------------------------------------------------------------------------- 1 | const { SlashCommandBuilder } = require('@discordjs/builders'); 2 | const { MessageEmbed } = require('discord.js'); 3 | 4 | module.exports = { 5 | data: new SlashCommandBuilder() 6 | .setName('userinfo') 7 | .setDescription('User info'), 8 | /** 9 | * @param {import("../../../client").interaction} interaction 10 | * @param {import("../../../client").client} client 11 | */ 12 | async execute(interaction) { 13 | const msgEmbed = new MessageEmbed() 14 | 15 | .setColor('#89e0dc') 16 | .setTitle(`${interaction.user.username} Info`) 17 | .setThumbnail(`${interaction.user.avatarURL({format : 'png', dynamic : true, size : 4096})}`) 18 | .setDescription(`Username : **${interaction.user.username}**\n\nNickname : **${interaction.member.nickname || interaction.user.username}**\n\nID : **${interaction.user.id}**\n\nTanggal dibuatnya akun : **${interaction.user.createdAt}**\n\nTanggal join server : **${interaction.member.joinedAt}**\n\nRole : **<@&${interaction.member.roles.highest.id}>**`) 19 | .setFooter({text: `Direquest oleh ${interaction.member.nickname || interaction.user.username}`, iconURL: interaction.user.avatarURL({format : 'png', dynamic : true, size : 1024})}) 20 | .setTimestamp(); 21 | 22 | interaction.reply({embeds: [msgEmbed]}); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /src/commands/message/moderation/nickname.js: -------------------------------------------------------------------------------- 1 | const { MessageCollector, Permissions } = require('discord.js'); 2 | 3 | module.exports = { 4 | name: 'nickname', 5 | /** 6 | * @param {import("../../../../client").message} message 7 | * @param {Array} args 8 | */ 9 | execute(message, args) { 10 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_NICKNAMES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 11 | if (!message.mentions.users.first()) return message.channel.send(`Mention user untuk menggunakan command\n\n ${process.env.PREFIX}nickname `); 12 | const memberName = message.mentions.members.first(); 13 | message.channel.send('**Please confirm your choice**\n\`\`\`[Yes] or [No]\`\`\`'); 14 | const collector = new MessageCollector(message.channel, m => m.author.id === message.author.id, { time: 10000 }); 15 | collector.on('collect', message => { 16 | const msgCt = message.content.toLowerCase(); 17 | if (msgCt === 'yes') { 18 | memberName.setNickname(args.slice(1).join(' ')); 19 | message.channel.send(`Nickname <@${memberName.id}> telah diubah menjadi **${args.slice(1).join(' ')}**`); 20 | collector.stop(); 21 | } else if (msgCt === 'no') { 22 | message.channel.send('**Canceled**'); 23 | collector.stop(); 24 | } 25 | }); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /src/structures/messageCreate.js: -------------------------------------------------------------------------------- 1 | const fs = require ('fs'); 2 | const { client } = require('../../client'); 3 | 4 | client.on('messageCreate', async message => { 5 | 6 | const args = message.content.slice(process.env.PREFIX.length).trim().split(/ +/); 7 | const command = args.shift().toLowerCase(); 8 | 9 | if (!message.content.startsWith(process.env.PREFIX) || message.author.bot) return; 10 | if (!message.guild) return; 11 | 12 | if (!client.commands.has(command)) return; 13 | 14 | try { 15 | client.commands.get(command).execute(message, args, client); 16 | } catch (error) { 17 | console.error(error); 18 | message.reply(process.env.DEFAULT_ERROR); 19 | } 20 | 21 | const afkJson = require('../data/afk.json'); 22 | 23 | if (afkJson.afkvalue.indexOf(message.author.id) !== -1) { 24 | afkJson.afkvalue.splice(afkJson.afkvalue.indexOf(message.author.id), 1); 25 | fs.writeFileSync('./src/data/afk.json', JSON.stringify(afkJson)); 26 | message.member.setNickname(message.author.username); 27 | message.channel.send(`**\`${message.author.username}\` telah kembali dari AFK!**`); 28 | } 29 | 30 | let mentioned = message.mentions.members?.first(); 31 | 32 | if (mentioned) { 33 | if (afkJson.afkvalue.indexOf(mentioned.id) !== -1) { 34 | return message.channel.send(`**\`${mentioned.user.username}\` sedang AFK!**`); 35 | } else { 36 | return; 37 | } 38 | } else if (mentioned == undefined) { 39 | return; 40 | } 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /src/commands/message/admin/mute.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../../../../client'); 2 | const { MessageEmbed, Permissions } = require('discord.js'); 3 | 4 | module.exports = { 5 | name: 'mute', 6 | /** 7 | * @param {import("../../../../client").message} message 8 | */ 9 | execute(message) { 10 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 11 | if (!message.mentions.users.first()) return message.channel.send('**Mention user untuk melakukan mute**'); 12 | const muteRole = message.guild.roles.cache.get(process.env.MUTE_ROLE); 13 | const mentionUsername = message.mentions.users.first(); 14 | const mentionMember = message.mentions.members.first(); 15 | if (mentionMember.roles.cache.get(process.env.MUTE_ROLE)) return message.channel.send('**User masih dimute**'); 16 | mentionMember.roles.add(muteRole); 17 | message.channel.send(`**<@${mentionMember.id}>** telah dimute oleh **<@${message.author.id}>**`); 18 | 19 | let channellog = client.channels.cache.get(process.env.CHANNELLOGID); 20 | let channellogembed = new MessageEmbed() 21 | 22 | .setColor('#ff0000') 23 | .setAuthor({name: 'Member Muted', iconURL:message.author.avatarURL({format : 'png', dynamic : true, size : 1024})}) 24 | .setDescription(`**⚠️ - ${mentionUsername.username} dimuted oleh ${message.author.username}**`) 25 | .setTimestamp(); 26 | 27 | channellog.send({embeds: [channellogembed]}); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /src/commands/message/admin/unmute.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../../../../client'); 2 | const { MessageEmbed, Permissions } = require('discord.js'); 3 | 4 | module.exports = { 5 | name: 'unmute', 6 | /** 7 | * @param {import("../../../../client").message} message 8 | */ 9 | execute(message) { 10 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 11 | if (!message.mentions.users.first()) return message.channel.send('**Mention user untuk melakukan unmute**'); 12 | const muteRole = message.guild.roles.cache.get(process.env.MUTE_ROLE); 13 | const mentionUsername = message.mentions.users.first(); 14 | const mentionMember = message.mentions.members.first(); 15 | if (!mentionMember.roles.cache.get(process.env.MUTE_ROLE)) return message.channel.send('**User tidak dimute**'); 16 | mentionMember.roles.remove(muteRole); 17 | message.channel.send(`**<@${mentionMember.id}>** telah diunmute oleh **<@${message.author.id}>**`); 18 | 19 | let channellog = client.channels.cache.get(process.env.CHANNELLOGID); 20 | let channellogembed = new MessageEmbed() 21 | 22 | .setColor('#00ff00') 23 | .setAuthor({name: 'Member Unmuted', iconURL:message.author.avatarURL({format : 'png', dynamic : true, size : 1024})}) 24 | .setDescription(`**⚠️ - ${mentionUsername.username} diunmuted oleh ${message.author.username}**`) 25 | .setTimestamp(); 26 | 27 | channellog.send({embeds: [channellogembed]}); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /src/commands/message/general/add.js: -------------------------------------------------------------------------------- 1 | const ms = require('ms'); 2 | const { Permissions } = require('discord.js'); 3 | const { manager } = require('../../../../client'); 4 | 5 | module.exports = { 6 | name: 'add', 7 | /** 8 | * @param {import("../../../../client").message} message 9 | * @param {Array} args 10 | */ 11 | execute(message, args) { 12 | if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) return message.channel.send('Kamu tidak memiliki izin untuk menggunakan command ini'); 13 | if (!args[0]) return message.channel.send(`${process.env.PREFIX}giveaway ****