├── yaml └── test.yml ├── .replit ├── commands ├── fun │ ├── module.json │ ├── chat.js │ ├── binary.js │ └── gayrate.js ├── admin │ ├── module.json │ ├── ban.js │ └── kick.js ├── api │ ├── module.json │ ├── shorturl.js │ └── pinterest.js ├── music │ ├── module.json │ ├── nowplaying.js │ ├── pause.js │ ├── skip.js │ ├── stop.js │ ├── resume.js │ ├── loop.js │ ├── shuffle.js │ ├── volume.js │ ├── seek.js │ ├── play.js │ └── queue.js ├── util │ ├── module.json │ └── docs.js ├── economy │ ├── module.json │ ├── store.js │ ├── work.js │ ├── deposit.js │ └── balance.js ├── anime │ ├── module.json │ ├── hug.js │ └── kiss.js ├── dev │ ├── module.json │ ├── github.js-test │ └── eval.js └── general │ ├── module.json │ ├── ping.js │ ├── help.js │ ├── afk.js │ ├── avatar.js │ └── prefix.js ├── json.sqlite ├── .gitignore ├── .github ├── dependabot.yml ├── workflows │ ├── greetings.yml │ └── codeql-analysis.yml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── core ├── emojis.json ├── utils.js ├── KurapikaClient.js ├── KurapikaClientUtil.js └── KurapikaMusicHandler.js ├── index.js ├── structures ├── User.js ├── Message.js ├── Guild.js └── GuildMember.js ├── .env-example ├── config.js ├── listeners ├── guildBanAdd.js ├── roleCreate.js ├── roleDelete.js ├── guildMemberRemove.js ├── channelCreate.js ├── channelDelete.js ├── ready.js ├── guildBanRemove.js ├── guildCreate.js └── message.js ├── bot.js ├── LICENSE ├── package.json └── README.md /yaml/test.yml: -------------------------------------------------------------------------------- 1 | a: 2 | - b 3 | c: d -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | language = "nodejs" 2 | run = "npm start" -------------------------------------------------------------------------------- /commands/fun/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Fun" 3 | } -------------------------------------------------------------------------------- /commands/admin/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Admin" 3 | } -------------------------------------------------------------------------------- /commands/api/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": ":fire: Api" 3 | } -------------------------------------------------------------------------------- /commands/music/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Music" 3 | } -------------------------------------------------------------------------------- /commands/util/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": ":gear: Util" 3 | } -------------------------------------------------------------------------------- /commands/economy/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": ":moneybag: Economy" 3 | } -------------------------------------------------------------------------------- /commands/anime/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Anime", 3 | "hide": false 4 | } -------------------------------------------------------------------------------- /commands/dev/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Developer", 3 | "hide": true 4 | } -------------------------------------------------------------------------------- /json.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/syrup/kurapika/master/json.sqlite -------------------------------------------------------------------------------- /commands/general/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "General", 3 | "hide": false 4 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | log 4 | json.sqlite 5 | RankCard.png 6 | commands/general/help2.js 7 | commands/admin/slowmode.js-a 8 | commands/music/lyrics.js 9 | config.js -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "22:00" 8 | open-pull-requests-limit: 10 9 | -------------------------------------------------------------------------------- /core/emojis.json: -------------------------------------------------------------------------------- 1 | { 2 | "error": "", 3 | "happy": "", 4 | "loading_dc": "", 5 | "windows_loading": "" 6 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { ShardingManager } = require('discord.js'); 2 | const manager = new ShardingManager('./bot.js', { token: process.env.TOKEN }); 3 | 4 | manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`)); 5 | manager.spawn(); -------------------------------------------------------------------------------- /structures/User.js: -------------------------------------------------------------------------------- 1 | const { Structures } = require("discord.js") 2 | 3 | Structures.extend("User", User => { 4 | class KurapikaUser extends User { 5 | constructor(...args) { 6 | super(...args) 7 | } 8 | 9 | 10 | 11 | } 12 | return KurapikaUser 13 | }) -------------------------------------------------------------------------------- /.env-example: -------------------------------------------------------------------------------- 1 | TOKEN=your amazing discord bot token 2 | MONGO_PASS=your mongo password delete if you selfhost 3 | MONGO_USER=your mongo username delete if you selfhost 4 | LAVA_HOST=your lavalink host url 5 | LAVA_PORT=your lavalink port 6 | LAVA_PASS=your lavalink password 7 | GENIUS=your genius token this is optional -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | defaultPrefix: 'ku.', 3 | ownerID: ["681843628317868049"], 4 | // u can use {user} for user mention {server} for server name {userTag} for user tag {level} for level 5 | levelUp: "Congrulations {user}, You just level up **{level}** 🎉", 6 | // ur hastebin, make sure to add /documents at the end 7 | hastebin: "https://hastebin.mioun.my.id/documents" 8 | }; -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/first-interaction@v1 10 | with: 11 | repo-token: ${{ secrets.GITHUB_TOKEN }} 12 | issue-message: 'Message that will be displayed on users'' first issue' 13 | pr-message: 'Message that will be displayed on users'' first pr' 14 | -------------------------------------------------------------------------------- /listeners/guildBanAdd.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class GuildBanAddListener extends Listener { 4 | constructor() { 5 | super('guildBanAdd', { 6 | emitter: 'client', 7 | event: 'guildBanAdd' 8 | }); 9 | } 10 | 11 | async exec(guild, user) { 12 | this.client.logger.log('info', `${user.tag} has been banned in ${guild.name}`); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /listeners/roleCreate.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class RoleCreateListener extends Listener { 4 | constructor() { 5 | super('roleCreate', { 6 | emitter: 'client', 7 | event: 'roleCreate' 8 | }); 9 | } 10 | 11 | async exec(role) { 12 | this.client.logger.log('info', 13 | `The role ${role.name} has been created in ${role.guild.name}` 14 | ); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /listeners/roleDelete.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class RoleDeleteListener extends Listener { 4 | constructor() { 5 | super('roleDelete', { 6 | emitter: 'client', 7 | event: 'roleDelete' 8 | }); 9 | } 10 | 11 | async exec(role) { 12 | this.client.logger.log('info', 13 | `The role ${role.name} has been deleted in ${role.guild.name}` 14 | ); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /listeners/guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class GuildMemberRemoveListener extends Listener { 4 | constructor() { 5 | super('guildMemberRemove', { 6 | emitter: 'client', 7 | event: 'guildMemberRemove' 8 | }); 9 | } 10 | 11 | async exec(member) { 12 | this.client.logger.log('info', `${member.user.tag} has been kicked in ${member.guild.name}` 13 | ); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /listeners/channelCreate.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class ChannelCreateListener extends Listener { 4 | constructor() { 5 | super('channelCreate', { 6 | emitter: 'client', 7 | event: 'channelCreate' 8 | }); 9 | } 10 | 11 | async exec(channel) { 12 | this.client.logger.log('info', 13 | `The channel ${channel.name} has been created in ${channel.guild.name}` 14 | ); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /listeners/channelDelete.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class ChannelDeleteListener extends Listener { 4 | constructor() { 5 | super('channelDelete', { 6 | emitter: 'client', 7 | event: 'channelDelete' 8 | }); 9 | } 10 | 11 | async exec(channel) { 12 | this.client.logger.log('info', 13 | `The channel ${channel.name} has been deleted in ${channel.guild.name}` 14 | ); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /commands/dev/github.js-test: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch"); 2 | 3 | class Github { 4 | constructor(name) { 5 | this.name = name 6 | this.baseURL = "https://api.github.com/users/" 7 | } 8 | 9 | async getName() { 10 | let res = await fetch(this.baseURL+this.name).then(res => res.json()) 11 | return res.login; 12 | } 13 | 14 | async getInfo() { 15 | let res = await fetch(this.baseURL+this.name).then(res => res.json()) 16 | return res 17 | } 18 | 19 | } 20 | 21 | module.exports = Github; -------------------------------------------------------------------------------- /bot.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | 3 | const { prefix, ownerID } = require("./config.js"); 4 | const path = require("path"); 5 | const KurapikaClient = require('./core/KurapikaClient.js'); 6 | const express = require("express"); 7 | const app = express(); 8 | const client = new KurapikaClient({ ownerID }, { 9 | fetchAllMembers: true, 10 | disableMentions: "everyone", 11 | disableEveryone: true 12 | }); 13 | 14 | app.get("/", (req, res) => { 15 | res.send("Ready!") 16 | }) 17 | 18 | app.listen(process.env.PORT) 19 | client.login(process.env.TOKEN); -------------------------------------------------------------------------------- /commands/general/ping.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class PingCommand extends Command { 4 | constructor() { 5 | super("ping", { 6 | aliases: ["ping"] 7 | }) 8 | this.name = "ping" 9 | this.description = "pong!" 10 | } 11 | 12 | async exec(message) { 13 | const m = await message.util.send("pinging..") 14 | const ping = Math.round(m.createdTimestamp - message.createdTimestamp); 15 | return message.util.send(`:ping_pong: Pong! \`${this.client.ws.ping}\`ms\n:fire: \`${ping}\`ms`) 16 | } 17 | } 18 | 19 | module.exports = PingCommand; -------------------------------------------------------------------------------- /listeners/ready.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class ReadyListener extends Listener { 4 | constructor() { 5 | super('ready', { 6 | emitter: 'client', 7 | event: 'ready' 8 | }); 9 | } 10 | 11 | async exec() { 12 | this.client.logger.log('info', `${this.client.user.tag} is now ready!`); 13 | 14 | const nodes = [...this.client.manager.nodes.values()]; 15 | for (const node of nodes) { 16 | try { 17 | await node.connect(); 18 | } catch (e) { 19 | this.client.manager.emit('error', e, node); 20 | } 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /structures/Message.js: -------------------------------------------------------------------------------- 1 | const { Structures } = require('discord.js'); 2 | const { Collection } = require("discord.js"); 3 | 4 | Structures.extend('Message', Message => { 5 | class KurapikaMessage extends Message { 6 | constructor(...args) { 7 | super(...args); 8 | 9 | this.say = this.say; 10 | } 11 | 12 | say(msg) { 13 | return this.channel.send(msg) 14 | } 15 | 16 | get channels() { 17 | let col = new Collection() 18 | let r = /<#(\d+)>/gi 19 | let channel = r.exec(this.content) 20 | 21 | if(this.content.includes("<#") && this.content.match(r)) { 22 | let id = channel.id 23 | 24 | col.set(id, channel) 25 | } 26 | } 27 | } 28 | 29 | return KurapikaMessage; 30 | }); -------------------------------------------------------------------------------- /commands/api/shorturl.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const tinyurl = require("tinyurl"); 3 | 4 | class ShortUrlCommand extends Command { 5 | constructor() { 6 | super("shorturl", { 7 | aliases: ["shorturl", "short"], 8 | cooldown: 100000 9 | }) 10 | 11 | this.name = "shorturl"; 12 | } 13 | 14 | exec(msg) { 15 | let args = msg.content.slice(msg.guild.prefix.length).trim().split(/ +/).slice(1) 16 | 17 | console.log(args) 18 | 19 | let url = args[0] 20 | 21 | tinyurl.shorten(url, (res) => { 22 | msg.util.send(`This: ${res}`) 23 | }, err => { 24 | msg.util.send(`Oh no, ${err}`) 25 | }) 26 | } 27 | } 28 | 29 | module.exports = ShortUrlCommand; -------------------------------------------------------------------------------- /commands/fun/chat.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const Alexa = require("alexa-bot-api"); 3 | const ai = new Alexa("aw2plm"); 4 | 5 | class ChatCommand extends Command { 6 | constructor() { 7 | super("chat", { 8 | aliases: ["chat"] 9 | }) 10 | 11 | this.name = "chat" 12 | this.description = "enable/disable ChatBot" 13 | this.usage = "chat <#channel>" 14 | this.example = "chat enable #chatbot" 15 | } 16 | 17 | async exec(msg) { 18 | const args = msg.content.slice(msg.guild.prefix).trim().split(" ").slice(1) 19 | console.log(args) 20 | 21 | if(args[0] === "enable") { 22 | var id = args[1].replace(/<#/g, "").replace(/>/g, "") 23 | msg.guild.setChat(id) 24 | console.log(id) 25 | } 26 | else if(args[0] === "disable") { 27 | msg.guild.deleteChat(id) 28 | } 29 | } 30 | } 31 | 32 | module.exports = ChatCommand; -------------------------------------------------------------------------------- /listeners/guildBanRemove.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | 3 | module.exports = class GuildBanRemoveListener extends Listener { 4 | constructor() { 5 | super('guildBanRemove', { 6 | emitter: 'client', 7 | event: 'guildBanRemove' 8 | }); 9 | } 10 | 11 | async exec(guild, user) { 12 | if (!guild) return; 13 | 14 | // Fetch entry relating to action 15 | let entry = await guild.find_entry( 16 | 'MEMBER_BAN_REMOVE', 17 | e => 18 | e.target.id === user.id && 19 | e.createdTimestamp > Date.now() - 1000 * 60 20 | ); 21 | if (!entry) return; 22 | 23 | // Fetch entries (w/ entry prepended) 24 | let entries = guild.push_entry(entry, user.tag); 25 | 26 | // Check limits 27 | guild.check_limits(entries, entry.executor.id, 'unbans'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /commands/music/nowplaying.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class NowPlayingCommand extends Command { 4 | constructor() { 5 | super('nowplaying', { 6 | aliases: ['nowplaying', 'np'] 7 | }); 8 | 9 | this.name = 'nowplaying'; 10 | this.description = 'Show the current playing song'; 11 | this.example = 'nowplaying'; 12 | this.usage = 'nowplaying'; 13 | } 14 | 15 | async exec(msg) { 16 | const args = msg.content 17 | .slice(msg.guild.prefix) 18 | .trim() 19 | .split(/ +/) 20 | .slice(1); 21 | 22 | const util = this.client.util; 23 | const { music } = msg.guild; 24 | if (!music.player || !music.player.playing) 25 | return msg.channel.send( 26 | util.embed().setDescription('❌ | Currently not playing anything.') 27 | ); 28 | msg.channel.send( 29 | util 30 | .embed() 31 | .setDescription(`🎶 | Now playing **${music.current.info.title}**.`) 32 | ); 33 | } 34 | } 35 | 36 | module.exports = NowPlayingCommand; 37 | -------------------------------------------------------------------------------- /commands/general/help.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const { MessageEmbed } = require("discord.js"); 3 | 4 | class HelpCommand extends Command { 5 | constructor() { 6 | super('help', { 7 | aliases: ['help', 'h', '?'], 8 | category: "General", 9 | description: { 10 | content: "Show help command", 11 | usage: "help [command name]", 12 | example: ["help", "help"] 13 | }, 14 | args: [{ 15 | id: "command", 16 | type: "commandAlias", 17 | default: null 18 | }] 19 | }); 20 | } 21 | 22 | async exec(msg, { command }) { 23 | const em = new MessageEmbed() 24 | .setTitle(`${this.client.user.username} Help`, this.client.user.displayAvatarURL({ format: "png" })) 25 | .setDescription(`Type ${msg.guild.prefix}help [command name] for more information`) 26 | .setFooter(`Req by: ${msg.author.tag}`, msg.author.displayAvatarURL({ format: "png", dynamic: true })) 27 | 28 | if(!command) { 29 | 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /commands/anime/hug.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const Discord = require("discord.js"); 3 | const fetch = require("node-superfetch"); 4 | 5 | class HugCommand extends Command { 6 | constructor() { 7 | super("hug", { 8 | aliases: ["hug"] 9 | }) 10 | 11 | this.name = "hug" 12 | this.description = "Hug someone" 13 | this.usage = "hug <@user>" 14 | this.example = "hug @Kurapika#1116" 15 | } 16 | 17 | async exec(msg) { 18 | let user = msg.mentions.users.first() 19 | if(msg.author.id === user.id) return msg.util.send("Hug yourself ❤") 20 | if(!user) return msg.util.send("Mention Someone"); 21 | 22 | const { body: hug } = await fetch.get("https://nekos.life/api/hug"); 23 | 24 | let em = new Discord.MessageEmbed() 25 | .setTitle("Hug ❤") 26 | .setDescription(`${msg.author.tag} Hug ${user.tag}`) 27 | .setImage(hug.url) 28 | 29 | return msg.util.send(em) 30 | 31 | } 32 | } 33 | 34 | module.exports = HugCommand; -------------------------------------------------------------------------------- /commands/economy/store.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const Discord = require("discord.js"); 3 | 4 | class StoreCommand extends Command { 5 | constructor() { 6 | super("store", 7 | { 8 | aliases: ["store"] 9 | }) 10 | this.name = "store" 11 | this.description = "Show store" 12 | this.usage = "store" 13 | this.example = "store" 14 | } 15 | 16 | async exec(msg) { 17 | let item = { 18 | ability: { 19 | Sword: { 20 | 21 | } 22 | }, 23 | magic: ["Speed"] 24 | } 25 | 26 | let ec = this.client.db.get(`economy.${msg.guild.id}.${msg.author.id}`) 27 | 28 | let em = new Discord.MessageEmbed() 29 | .setTitle("Store") 30 | .setDescription(`You currently have \`${ec.money}\` in your Account`) 31 | 32 | for(i in item) { 33 | for(c of item[i]) { 34 | em.addField(`**${c}** - \`\``) 35 | } 36 | } 37 | 38 | } 39 | 40 | } 41 | 42 | module.exports = StoreCommand; -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 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. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /listeners/guildCreate.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require('discord-akairo'); 2 | const Discord = require("discord.js"); 3 | 4 | module.exports = class ReadyListener extends Listener { 5 | constructor() { 6 | super('guildCreate', { 7 | emitter: 'client', 8 | event: 'guildCreate' 9 | }); 10 | } 11 | 12 | async exec(guild) { 13 | let em = new Discord.MessageEmbed() 14 | .setTitle("Guild Joined") 15 | .addFields({ 16 | name: ' | Name: ', 17 | value: guild.name, 18 | inline: true 19 | }, { 20 | name: " | Member: ", 21 | value: guild.memberCount, 22 | inline: true 23 | }, { 24 | name: " | Guild ID: ", 25 | value: guild.id, 26 | inline: true 27 | }) 28 | .setFooter(`Total guilds ${this.client.guilds.cache.size}`) 29 | .setColor("RANDOM") 30 | 31 | for(let a of this.client.config.ownerID) { 32 | this.client.users.cache.get(a).send(em) 33 | } 34 | } 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /commands/general/afk.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const Discord = require('discord.js'); 3 | 4 | class AfkCommand extends Command { 5 | constructor() { 6 | super('afk', { 7 | aliases: ['afk'] 8 | }); 9 | 10 | this.name = "afk" 11 | this.description = "Set your afk.\nthis command is **Maintenance**" 12 | this.usage = "afk " 13 | this.example = "afk breakfast" 14 | } 15 | 16 | async exec(message) { 17 | return message.util.send("Maintenance...") 18 | let args = message.content 19 | .slice(this.client.commandHandler.prefix(message).length + 4) 20 | .split(" "); 21 | 22 | let reason = args.join(' '); 23 | 24 | try { 25 | let user = message.guild.member(message.author.id); 26 | user.setAfk(reason); 27 | 28 | let em = new Discord.MessageEmbed() 29 | .setTitle('AFK ' + user.user.tag) 30 | .setDescription(`I Seted your AFK: ${reason}`) 31 | .setColor('RANDOM'); 32 | 33 | message.util.send(em); 34 | } catch (e) { 35 | message.util.send('Oh no, ' + e.message); 36 | } 37 | } 38 | } 39 | 40 | module.exports = AfkCommand; 41 | -------------------------------------------------------------------------------- /commands/economy/work.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const ms = require("parse-ms"); 3 | 4 | class WorkCommand extends Command { 5 | constructor() { 6 | super("work", { 7 | aliases: ["work", "w"], 8 | cooldown: 3 9 | }) 10 | 11 | this.name = "work" 12 | this.description = "earn a money" 13 | this.usage = "work" 14 | this.example = "work" 15 | } 16 | 17 | exec(msg) { 18 | let cold = this.client.db.get(`economy.${msg.guild.id}.${msg.author.id}.cooldown`) 19 | let timeout = 600000; 20 | let cooldown = timeout - (Date.now() - cold) 21 | if(cooldown > 0) { 22 | let time = ms(cooldown) 23 | 24 | return msg.util.send(`Please wait until ${time.minutes}m ${time.seconds}s because you have been work`) 25 | } else { 26 | let earn = Math.floor(Math.random() * 500) + 1 27 | msg.member.setMoney(earn) 28 | msg.util.send(`You worked and earn \`${earn}\``) 29 | } 30 | 31 | this.client.db.set(`economy.${msg.guild.id}.${msg.author.id}.cooldown`, Date.now()) 32 | } 33 | } 34 | 35 | module.exports = WorkCommand -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Miouns 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /commands/anime/kiss.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const Discord = require('discord.js'); 3 | const fetch = require('node-superfetch'); 4 | 5 | class KissCommand extends Command { 6 | constructor() { 7 | super('kiss', { 8 | aliases: ['kiss'] 9 | }); 10 | 11 | this.name = "kiss" 12 | this.description = "Kiss someone" 13 | this.usage = "kiss <@user>" 14 | this.example = "kiss @Kurapika#1116" 15 | } 16 | 17 | async exec(message) { 18 | let user = message.mentions.users.first(); 19 | 20 | let args = message.content.slice(this.client.commandHandler.prefix(message).length + 4) 21 | 22 | if(!args) return message.util.send("Mention Someoned") 23 | 24 | const { body: kiss } = await fetch.get( 25 | 'https://nekos.life/api/v2/img/kiss' 26 | ); 27 | 28 | if(message.author.id === user.id) return message.util.send("Love yourself ❤") 29 | 30 | const em = new Discord.MessageEmbed() 31 | .setTitle('Kiss ❤') 32 | .setColor(0x34eb3d) 33 | .setDescription(`UwU ${message.author.tag} kissed ${user.tag}`) 34 | .setImage(kiss.url); 35 | 36 | return message.util.send(em) 37 | } 38 | } 39 | 40 | module.exports = KissCommand; 41 | -------------------------------------------------------------------------------- /core/utils.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const prettyMilliseconds = require("pretty-ms"); 3 | 4 | module.exports = { 5 | embed: () => { 6 | return new MessageEmbed() 7 | .setColor("#99AAB5"); 8 | }, 9 | durationToMillis: (dur) => { 10 | return dur.split(":").map(Number).reduce((acc, curr) => curr + acc * 60) * 1000; 11 | }, 12 | millisToDuration: (ms) => { 13 | return prettyMilliseconds(ms, { colonNotation: true, secondsDecimalDigits: 0 }); 14 | }, 15 | chunk: (arr, size) => { 16 | const temp = []; 17 | for (let i = 0; i < arr.length; i += size) { 18 | temp.push(arr.slice(i, i + size)); 19 | } 20 | return temp; 21 | }, 22 | isValidURL: (url) => { 23 | return /^https?:\/\/((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(#[-a-z\d_]*)?$/i 24 | .test(url); 25 | }, 26 | shuffleArray: (arr) => { 27 | for (let i = arr.length - 1; i > 0; i--) { 28 | const j = Math.floor(Math.random() * (i + 1)); 29 | [arr[i], arr[j]] = [arr[j], arr[i]]; 30 | } 31 | return arr; 32 | } 33 | }; -------------------------------------------------------------------------------- /commands/economy/deposit.js: -------------------------------------------------------------------------------- 1 | const { Command }= require('discord-akairo'); 2 | const Discord = require('discord.js'); 3 | 4 | class DepositCommand extends Command { 5 | constructor() { 6 | super("deposit", { 7 | aliases: ['deposit', 'depo'], 8 | cooldown: 3000 9 | }) 10 | 11 | this.name = "deposit" 12 | this.decription = "Save your money in bank" 13 | this.usage = "deposit " 14 | this.example = "deposit 1000" 15 | } 16 | 17 | exec(msg) { 18 | let args = msg.content.slice(msg.guild.prefix).trim().split(/ +/).slice(1) 19 | let amount = args[0] 20 | 21 | if(msg.member.economy.money < amount) return msg.util.send("You dont have "+ amount + " money in your account") 22 | else if(msg.member.economy.money < 0) return msg.util.send("You have 0 money in your account") 23 | 24 | msg.member.removeMoney(amount) 25 | msg.member.setBank(amount) 26 | let em = new Discord.MessageEmbed() 27 | .setTitle(msg.author.tag) 28 | .setDescription(`Saving your **${amount}** money in Bank\nNow you have ${msg.member.economy.money} money in your account`) 29 | .setTimestamp() 30 | .setFooter("Req by: "+msg.author.tag, msg.author.displayAvatarURL()) 31 | 32 | msg.util.send(em) 33 | 34 | } 35 | 36 | } 37 | 38 | module.exports = DepositCommand; -------------------------------------------------------------------------------- /commands/music/pause.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class PauseCommand extends Command { 4 | constructor() { 5 | super('pause', { 6 | aliases: ['pause', 'ps'] 7 | }); 8 | 9 | this.name = "pause"; 10 | this.description = "Pause the music"; 11 | this.example = "pause"; 12 | this.usage = "pause"; 13 | } 14 | 15 | async exec(msg) { 16 | const util = this.client.util; 17 | const { music } = msg.guild; 18 | if (!music.player || !music.player.playing) 19 | return msg.channel.send( 20 | util.embed().setDescription('❌ | Currently not playing anything.') 21 | ); 22 | if (!msg.member.voice.channel) 23 | return msg.channel.send( 24 | util.embed().setDescription('❌ | You must be on a voice channel.') 25 | ); 26 | if ( 27 | msg.guild.me.voice.channel && 28 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 29 | ) 30 | return msg.channel.send( 31 | util 32 | .embed() 33 | .setDescription( 34 | `❌ | You must be on ${ 35 | msg.guild.me.voice.channel 36 | } to use this command.` 37 | ) 38 | ); 39 | 40 | try { 41 | await music.pause(); 42 | msg.react('⏸️').catch(e => e); 43 | } catch (e) { 44 | msg.channel.send(`An error occured: ${e.message}.`); 45 | } 46 | } 47 | } 48 | 49 | module.exports = PauseCommand; -------------------------------------------------------------------------------- /commands/music/skip.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class SkipCommand extends Command { 4 | constructor() { 5 | super('skip', { 6 | aliases: ['skip'] 7 | }); 8 | 9 | this.name = "skip"; 10 | this.description = "Skip the current playing song"; 11 | this.example = "skip"; 12 | this.usage = "skip"; 13 | } 14 | 15 | async exec(msg) { 16 | const util = this.client.util; 17 | const { music } = msg.guild; 18 | if (!music.player || !music.player.playing) 19 | return msg.channel.send( 20 | util.embed().setDescription('❌ | Currently not playing anything.') 21 | ); 22 | if (!msg.member.voice.channel) 23 | return msg.channel.send( 24 | util.embed().setDescription('❌ | You must be on a voice channel.') 25 | ); 26 | if ( 27 | msg.guild.me.voice.channel && 28 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 29 | ) 30 | return msg.channel.send( 31 | util 32 | .embed() 33 | .setDescription( 34 | `❌ | You must be on ${ 35 | msg.guild.me.voice.channel 36 | } to use this command.` 37 | ) 38 | ); 39 | 40 | try { 41 | await music.skip(); 42 | msg.react('⏭️').catch(e => e); 43 | } catch (e) { 44 | msg.channel.send(`An error occured: ${e.message}.`); 45 | } 46 | } 47 | } 48 | 49 | module.exports = SkipCommand; -------------------------------------------------------------------------------- /commands/music/stop.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class StopCommand extends Command { 4 | constructor() { 5 | super('stop', { 6 | aliases: ['stop', "sp"] 7 | }); 8 | 9 | this.name = "stop"; 10 | this.description = "Stop the current playing song"; 11 | this.example = "stop"; 12 | this.usage = "stop"; 13 | } 14 | 15 | async exec(msg) { 16 | const util = this.client.util; 17 | const { music } = msg.guild; 18 | if (!music.player || !music.player.playing) 19 | return msg.channel.send( 20 | util.embed().setDescription('❌ | Currently not playing anything.') 21 | ); 22 | if (!msg.member.voice.channel) 23 | return msg.channel.send( 24 | util.embed().setDescription('❌ | You must be on a voice channel.') 25 | ); 26 | if ( 27 | msg.guild.me.voice.channel && 28 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 29 | ) 30 | return msg.channel.send( 31 | util 32 | .embed() 33 | .setDescription( 34 | `❌ | You must be on ${ 35 | msg.guild.me.voice.channel 36 | } to use this command.` 37 | ) 38 | ); 39 | 40 | try { 41 | await music.stop(); 42 | msg.react('⏹️').catch(e => e); 43 | } catch (e) { 44 | msg.channel.send(`An error occured: ${e.message}.`); 45 | } 46 | } 47 | } 48 | 49 | module.exports = StopCommand; -------------------------------------------------------------------------------- /commands/music/resume.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class ResumeCommand extends Command { 4 | constructor() { 5 | super('resume', { 6 | aliases: ['resume', 'res', 'continue'] 7 | }); 8 | 9 | this.name = "resume"; 10 | this.description = "Resume the current paused song"; 11 | this.example = "resume"; 12 | this.usage = "resumes"; 13 | } 14 | 15 | 16 | async exec(msg) { 17 | const util = this.client.util; 18 | const { music } = msg.guild; 19 | if (!music.player || !music.player.playing) 20 | return msg.channel.send( 21 | util.embed().setDescription('❌ | Currently not playing anything.') 22 | ); 23 | if (!msg.member.voice.channel) 24 | return msg.channel.send( 25 | util.embed().setDescription('❌ | You must be on a voice channel.') 26 | ); 27 | if ( 28 | msg.guild.me.voice.channel && 29 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 30 | ) 31 | return msg.channel.send( 32 | util 33 | .embed() 34 | .setDescription( 35 | `❌ | You must be on ${ 36 | msg.guild.me.voice.channel 37 | } to use this command.` 38 | ) 39 | ); 40 | 41 | try { 42 | await music.resume(); 43 | msg.react('▶️').catch(e => e); 44 | } catch (e) { 45 | msg.channel.send(`An error occured: ${e.message}.`); 46 | } 47 | } 48 | } 49 | 50 | module.exports = ResumeCommand; -------------------------------------------------------------------------------- /commands/music/loop.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class LoopCommand extends Command { 4 | constructor() { 5 | super('loop', { 6 | aliases: ['loop', 'lp'] 7 | }); 8 | 9 | this.name = 'loop'; 10 | this.description = 'loop the current playing song'; 11 | this.example = 'loop'; 12 | this.usage = 'loop'; 13 | } 14 | 15 | async exec(msg) { 16 | const args = msg.content 17 | .slice(msg.guild.prefix) 18 | .trim() 19 | .split(/ +/) 20 | .slice(1); 21 | 22 | const util = this.client.util; 23 | const { music } = msg.guild; 24 | if (!music.player) 25 | return msg.channel.send( 26 | util.embed().setDescription('❌ | Currently not playing anything.') 27 | ); 28 | if (!msg.member.voice.channel) 29 | return msg.channel.send( 30 | util.embed().setDescription('❌ | You must be on a voice channel.') 31 | ); 32 | if ( 33 | msg.guild.me.voice.channel && 34 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 35 | ) 36 | return msg.channel.send( 37 | util 38 | .embed() 39 | .setDescription( 40 | `❌ | You must be on ${ 41 | msg.guild.me.voice.channel 42 | } to use this command.` 43 | ) 44 | ); 45 | 46 | music.loop = !music.loop; 47 | 48 | msg.channel.send( 49 | util 50 | .embed() 51 | .setDescription(`✅ | Loop ${music.loop ? 'enabled' : 'disabled'}.`) 52 | ); 53 | } 54 | } 55 | 56 | module.exports = LoopCommand; 57 | -------------------------------------------------------------------------------- /structures/Guild.js: -------------------------------------------------------------------------------- 1 | const { Structures } = require('discord.js'); 2 | const config = require("../config.js") 3 | const MusicHandler = require("../core/KurapikaMusicHandler.js") 4 | 5 | Structures.extend('Guild', Guild => { 6 | class GuildExt extends Guild { 7 | constructor(...args) { 8 | super(...args); 9 | 10 | this.music = new MusicHandler(this); 11 | } 12 | 13 | // Returns the Guild prefix 14 | // .prefix 15 | get prefix() { 16 | return this.get('prefix', config.defaultPrefix); 17 | } 18 | 19 | // The following methods are all namespaced by Guild ID. 20 | // Examples: 21 | // .get('loggingChannelID', [fallback]); 22 | // .set('loggingChannelID', '383430486506340352') 23 | get(key, fallback) { 24 | return this.client.db.get(`${this.id}.${key}`) || fallback; 25 | } 26 | 27 | set(key, data) { 28 | return this.client.db.set(`${this.id}.${key}`, data); 29 | } 30 | 31 | delete(key) { 32 | return this.client.db.delete(`${this.id}.${key}`); 33 | } 34 | 35 | setChat(id) { 36 | return this.client.db.set(`chat.${this.id}`, id) 37 | } 38 | 39 | deleteChat(id) { 40 | return this.client.db.delete(`chat.${this.id}`) 41 | } 42 | } 43 | 44 | return GuildExt; 45 | }); 46 | -------------------------------------------------------------------------------- /commands/fun/binary.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class BinaryComand extends Command { 4 | constructor() { 5 | super('binary', { 6 | aliases: ['binary', 'bin'] 7 | }); 8 | 9 | this.name = "binary" 10 | this.description = "encode or decode message in binary" 11 | this.example = "binary encode hello world" 12 | this.usage = "binary " 13 | } 14 | 15 | encode(char) { 16 | return char 17 | .split('') 18 | .map(str => { 19 | const converted = str.charCodeAt(0).toString(2); 20 | return converted.padStart(8, '0'); 21 | }) 22 | .join(' '); 23 | } 24 | 25 | decode(char) { 26 | return char.split(" ").map(str => String.fromCharCode(Number.parseInt(str, 2))).join(""); 27 | } 28 | 29 | exec(message) { 30 | let args = message.content.slice(this.client.config.defaultPrefix.length).trim().split(/ +/).slice(1) 31 | var binary; 32 | 33 | let options = ["decode", "encode"] 34 | 35 | if(!args[0]) return message.util.send(`Type this \`${message.guild.prefix} \``) 36 | else if(!options.includes(args[0])) return message.util.send("Invalid option") 37 | 38 | if(args[0] === "decode") { 39 | let char = args.slice(1).join(" ") 40 | binary = this.decode(char) 41 | } else if(args[0] === "encode") { 42 | let char = args.slice(1).join(" ") 43 | binary = this.encode(char) 44 | } 45 | 46 | return message.util.send(binary) 47 | } 48 | 49 | } 50 | 51 | module.exports = BinaryComand; -------------------------------------------------------------------------------- /commands/general/avatar.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const Discord = require("discord.js") 3 | 4 | class AvatarCommand extends Command { 5 | constructor() { 6 | super("avatar", { 7 | aliases: ["avatar", "ava", "pfp"] 8 | }) 9 | 10 | this.name = "avatar" 11 | this.usage = "avatar " 12 | this.example = "avatar Kurapika" 13 | this.description = "Get your / member avatar" 14 | } 15 | 16 | async exec(msg) { 17 | let args = msg.content 18 | .slice(msg.guild.prefix) 19 | .trim() 20 | .split(/ +/) 21 | .slice(1) 22 | 23 | 24 | let user = await msg.mentions.users.first() 25 | 26 | let em = new Discord.MessageEmbed() 27 | .setFooter("Req by: "+msg.author.tag) 28 | 29 | if(!user && args[0]) { 30 | user = await this.client.util.getMember(msg, args.join(" ")) 31 | em.setAuthor(`${user.user.tag} Avatar`, user.user.displayAvatarURL({ dynamic: true })) 32 | em.setImage(user.user.displayAvatarURL({ dynamic: true, size: 1024 })) 33 | } else if(user) { 34 | em.setAuthor(`${user.tag} Avatar`, user.displayAvatarURL({ dynamic: true })) 35 | .setImage(user.displayAvatarURL({ dynamic: true, size: 1024 })) 36 | } else { 37 | em.setAuthor(`${msg.author.tag} Avatar`, msg.author.displayAvatarURL({ dynamic: true })) 38 | .setImage(msg.author.displayAvatarURL({ dynamic: true, size: 1024 })) 39 | } 40 | 41 | msg.util.send(em) 42 | 43 | } 44 | 45 | } 46 | 47 | module.exports = AvatarCommand; -------------------------------------------------------------------------------- /commands/music/shuffle.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class ShuffleCommand extends Command { 4 | constructor() { 5 | super('shuffle', { 6 | aliases: ['shuffle', 'sf'] 7 | }); 8 | 9 | this.name = "shuffle"; 10 | this.description = "Play a random Song from queue"; 11 | this.example = "shuffle"; 12 | this.usage = "shuffle"; 13 | } 14 | 15 | async exec(msg) { 16 | const util = this.client.util; 17 | const { music } = msg.guild; 18 | if (!music.player || !music.player.playing) 19 | return msg.channel.send( 20 | util.embed().setDescription('❌ | Currently not playing anything.') 21 | ); 22 | if (!music.queue.length) 23 | return msg.channel.send( 24 | util.embed().setDescription('❌ | Queue is empty.') 25 | ); 26 | if (!msg.member.voice.channel) 27 | return msg.channel.send( 28 | util.embed().setDescription('❌ | You must be on a voice channel.') 29 | ); 30 | if ( 31 | msg.guild.me.voice.channel && 32 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 33 | ) 34 | return msg.channel.send( 35 | util 36 | .embed() 37 | .setDescription( 38 | `❌ | You must be on ${ 39 | msg.guild.me.voice.channel 40 | } to use this command.` 41 | ) 42 | ); 43 | 44 | music.queue = util.shuffleArray(music.queue); 45 | 46 | msg.channel.send( 47 | util 48 | .embed() 49 | .setDescription( 50 | `✅ | Queue shuffled! Type \`${ 51 | msg.guild.prefix 52 | }queue\` to see changes.` 53 | ) 54 | ); 55 | } 56 | } 57 | 58 | module.exports = ShuffleCommand; 59 | -------------------------------------------------------------------------------- /commands/music/volume.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class VolumeCommand extends Command { 4 | constructor() { 5 | super('volume', { 6 | aliases: ['volume', 'vol'] 7 | }); 8 | 9 | this.name = "volume"; 10 | this.description = "Set the volume\nMax 200"; 11 | this.example = "volume 70"; 12 | this.usage = "volume "; 13 | } 14 | 15 | async exec(msg) { 16 | const args = msg.content 17 | .slice(msg.guild.prefix) 18 | .trim() 19 | .split(/ +/) 20 | .slice(1) 21 | 22 | const util = this.client.util; 23 | const { music } = msg.guild; 24 | const newVolume = args[0]; 25 | if (!music.player || !music.player.playing) return msg.channel.send(util.embed().setDescription("❌ | Currently not playing anything.")); 26 | try { 27 | if (!newVolume || isNaN(newVolume)) { 28 | msg.channel.send(util.embed().setDescription(`🔉 | Current volume \`${music.volume}\`.`)); 29 | } else { 30 | if (!msg.member.voice.channel) 31 | return msg.channel.send(util.embed().setDescription("❌ | You must be on a voice channel.")); 32 | if (msg.guild.me.voice.channel && !msg.guild.me.voice.channel.equals(msg.member.voice.channel)) 33 | return msg.channel.send(util.embed().setDescription(`❌ | You must be on ${msg.guild.me.voice.channel} to use this command.`)); 34 | 35 | await music.setVolume(newVolume); 36 | msg.channel.send(util.embed().setDescription(`🔉 | Volume set to \`${music.volume}\`.`)); 37 | } 38 | } catch (e) { 39 | msg.channel.send(`An error occured: ${e.message}.`); 40 | } 41 | } 42 | } 43 | 44 | module.exports = VolumeCommand; -------------------------------------------------------------------------------- /commands/economy/balance.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const Discord = require("discord.js"); 3 | 4 | class BalanceCommand extends Command { 5 | constructor() { 6 | super("balance", { 7 | aliases: ["balance", "bal"] 8 | }) 9 | 10 | this.name = "balance" 11 | this.description = "check your balance or your friend balance" 12 | this.usage = "balance [@user]" 13 | this.example = "balance" 14 | } 15 | 16 | exec(msg) { 17 | let user = msg.mentions.users.first() 18 | let you = msg.member 19 | 20 | let em = new Discord.MessageEmbed() 21 | .setColor("RANDOM") 22 | .setFooter(`Req by: ${msg.author.tag}`) 23 | .setTimestamp() 24 | 25 | if(!user) { 26 | em 27 | .addFields( 28 | { 29 | name: "Money", 30 | value: you.economy.money.toLocaleString(), 31 | inline: true 32 | }, 33 | { 34 | name: "Bank", 35 | value: you.economy.bank.toLocaleString(), 36 | inline: true 37 | } 38 | ) 39 | .setTitle(`${you.economy.user.tag} Balance`) 40 | } else { 41 | user = msg.guild.member(user) 42 | em 43 | .addFields( 44 | { 45 | name: "Money", 46 | value: user.economy.money.toLocaleString(), 47 | inline: true 48 | }, 49 | { 50 | name: "Bank", 51 | value: user.economy.bank.toLocaleString(), 52 | inline: true 53 | } 54 | ) 55 | .setTitle(`${user.economy.user.tag} Balance`) 56 | } 57 | 58 | msg.util.send(em) 59 | } 60 | 61 | } 62 | 63 | module.exports = BalanceCommand; -------------------------------------------------------------------------------- /commands/general/prefix.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class PrefixCommand extends Command { 4 | constructor() { 5 | super('prefix', { 6 | aliases: ['prefix'], 7 | args: [ 8 | { 9 | id: 'prefix' 10 | } 11 | ], 12 | channel: 'guild' 13 | }); 14 | this.description = "Change bot prefix for this server" 15 | this.name = "prefix" 16 | this.usage = "prefix " 17 | this.example = "prefix ku." 18 | } 19 | 20 | async exec(message, args) { 21 | // Fetch the stored prefix 22 | const prefix = message.guild.prefix; 23 | 24 | // Return with the current prefix if none in arguments 25 | if (!args.prefix) 26 | return message.util.send( 27 | `*The prefix is currently **\`${prefix}\`***\n*You can change it by doing **\`${prefix}prefix \`***` 28 | ); 29 | 30 | // Check guild administrator permission 31 | if (!message.member.hasPermission('ADMINISTRATOR')) 32 | return message.util.send('***Sorry**, invalid permissions.*'); 33 | 34 | // Check if similar prefix 35 | if (prefix === args.prefix) 36 | return message.util.send( 37 | '***Sorry**, that is already the prefix.*' 38 | ); 39 | 40 | // Update the prefix 41 | message.guild.set(`prefix`, args.prefix); 42 | 43 | // Return with the updated prefix 44 | return message.util.send( 45 | `*Successfully changed the prefix from **\`${prefix}\`** to **\`${args.prefix}\`***` 46 | ); 47 | } 48 | } 49 | 50 | module.exports = PrefixCommand; 51 | -------------------------------------------------------------------------------- /commands/admin/ban.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | 3 | class BanCommand extends Command { 4 | constructor() { 5 | super("ban", { 6 | aliases: ["ban"] 7 | }) 8 | 9 | this.name = "ban" 10 | this.description = "Ban someone" 11 | this.usage = "ban <@user> [reason]" 12 | this.example = "ban @someuser#1234 break rules" 13 | } 14 | 15 | exec(message) { 16 | let args = message.content.slice(message.guild.prefix.length).trim().split(/ +/).slice(1) 17 | 18 | if(!message.member.permissions.has("BAN_MEMBERS")) return message.util.send("bruh, You don't have permissions `BAN_MEMBERS`") 19 | if(!message.guild.member(this.client.user).permissions.has("BAN_MEMBERS")) return message.util.send("seriously? you don't give me `BAN_MEMBERS` permission") 20 | 21 | let m = message.mentions.users.first() 22 | let user = message.guild.members.resolve(m) 23 | let me = message.guild.members.resolve(this.client.user) 24 | 25 | if(!m) return message.util.send("please mention someone to ban") 26 | 27 | let reason = args.slice(2).join(" ") 28 | 29 | if(!reason) { 30 | reason = "No reason" 31 | } 32 | 33 | if(user.id === me.id) return message.util.send("Why you want to ban me?") 34 | 35 | if(me.roles.highest.position <= user.roles.highest.position) { 36 | return message.util.send("I can't ban it maybe because the role is higher than mine") 37 | } 38 | 39 | try { 40 | user 41 | .ban(reason) 42 | .then(() => { 43 | message.util.send("Successfully banned "+m.tag) 44 | }) 45 | } catch (e) { 46 | message.util.send(`Cannot ban this user, Because: \`${e.message}\``) 47 | } 48 | } 49 | } 50 | 51 | module.exports = BanCommand; -------------------------------------------------------------------------------- /commands/admin/kick.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | 3 | class KickCommand extends Command { 4 | constructor() { 5 | super("kick", { 6 | aliases: ["kick"] 7 | }) 8 | 9 | this.name = "kick" 10 | this.description = "Kick someone" 11 | this.usage = "kick <@user> [reason]" 12 | this.example = "kick @someuser#1234 break rules" 13 | } 14 | 15 | exec(message) { 16 | let args = message.content.slice(message.guild.prefix.length).trim().split(/ +/).slice(1) 17 | 18 | if(!message.member.permissions.has("KICK_MEMBERS")) return message.util.send("bruh, You don't have permissions `KICK_MEMBERS`") 19 | if(!message.guild.member(this.client.user).permissions.has("KICK_MEMBERS")) return message.util.send("seriously? you don't give me `KICK_MEMBERS` permission") 20 | 21 | let m = message.mentions.users.first() 22 | let user = message.guild.members.resolve(m) 23 | let me = message.guild.members.resolve(this.client.user) 24 | 25 | if(!m) return message.util.send("please mention someone to kick") 26 | 27 | let reason = args.slice(2).join(" ") 28 | 29 | if(!reason) { 30 | reason = "No reason" 31 | } 32 | 33 | if(user.id === me.id) return message.util.send("Why you want to kick me?") 34 | 35 | if(me.roles.highest.position <= user.roles.highest.position) { 36 | return message.util.send("I can't kick it maybe because the role is higher than mine") 37 | } 38 | 39 | try { 40 | user 41 | .kick(reason) 42 | .then(() => { 43 | message.util.send("Successfully kicked "+m.tag) 44 | }) 45 | } catch (e) { 46 | message.channel.send(`Cannot kick this user, Because: \`${e.message}\``) 47 | } 48 | } 49 | } 50 | 51 | module.exports = KickCommand; -------------------------------------------------------------------------------- /commands/api/pinterest.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const { Command } = require('discord-akairo'); 3 | const axios = require('axios'); 4 | 5 | class PinterestCommand extends Command { 6 | constructor() { 7 | super('pinterest', { 8 | aliases: ['pinterest', 'pin', 'pint'] 9 | }); 10 | 11 | this.name = "pinterest" 12 | this.description = "search pinterest image" 13 | this.usage = "pinterest " 14 | this.example = "pinterest minecraft" 15 | } 16 | 17 | async getImage(key) {/* 18 | const { data: res } = await axios.get( 19 | 'http://api.fdci.se/sosmed/rep.php?gambar=' + key 20 | ); 21 | 22 | let i = Math.floor(Math.random() * res.length); 23 | 24 | if (!res[i]) i = i+1; 25 | 26 | console.log(res) 27 | 28 | return res[i]; 29 | */} 30 | 31 | async exec(message) { 32 | 33 | 34 | let args = message.content 35 | .slice(this.client.config.defaultPrefix.length) 36 | .trim() 37 | .split(/ +/) 38 | .slice(1); 39 | 40 | let key = encodeURIComponent(args.join(' ')); 41 | if (!key) return message.util.send('Give me Arguments to search'); 42 | 43 | const { data: res } = await axios.get( 44 | 'http://api.fdci.se/sosmed/rep.php?gambar=' + key 45 | ); 46 | 47 | let i = Math.floor(Math.random() * res.length); 48 | 49 | if (!res[i]) i = i+1; 50 | 51 | key = decodeURIComponent(key) 52 | 53 | let em = new Discord.MessageEmbed() 54 | .setAuthor( 55 | key, 56 | 'https://assets.stickpng.com/images/580b57fcd9996e24bc43c52e.png' 57 | ) 58 | .setImage(res[i]) 59 | .setFooter("Powered By: FDCI Cyber Security - fdcicyber.org/pinterest-search-image") 60 | .setTimestamp() 61 | .setColor("RANDOM") 62 | 63 | message.util.send(em); 64 | } 65 | } 66 | 67 | 68 | module.exports = PinterestCommand; 69 | -------------------------------------------------------------------------------- /commands/fun/gayrate.js: -------------------------------------------------------------------------------- 1 | const { Command } = require("discord-akairo"); 2 | const { MessageEmbed } = require("discord.js"); 3 | 4 | class GayrateCommand extends Command { 5 | constructor() { 6 | super("gayrate", { 7 | aliases: ['gayrate', "gay"], 8 | args: [ 9 | { 10 | id: "member", 11 | type: 'string', 12 | match: 'text', 13 | limit: 3000, 14 | prompt: { 15 | start: msg => `${msg.member}, Who?` 16 | } 17 | } 18 | ] 19 | }) 20 | this.name = "gayrate" 21 | this.usage = "gayrate " 22 | } 23 | 24 | async exec(message, { member }) { 25 | const args = message.content 26 | .slice(message.guild.prefix) 27 | .trim() 28 | .split(/ +/) 29 | .slice(1) 30 | 31 | console.log(member) 32 | let user; 33 | 34 | if(member.startsWith("<@")) { 35 | user = await this.client.util.getMember(message, member.match(/<@(\d+)>/)[1]) 36 | } else { 37 | user = await this.client.util.getMember(message, member); 38 | } 39 | 40 | 41 | 42 | 43 | const gay = Math.floor(Math.random() * 100) 44 | 45 | let em = new MessageEmbed() 46 | .setTitle(user.user.username+" gayrate") 47 | .setDescription(` Counting..`) 48 | .setTimestamp() 49 | .setColor("RANDOM") 50 | .setFooter(`Req by: ${message.author.tag}`) 51 | 52 | const em1 = new MessageEmbed() 53 | .setTitle(user.user.username+" gayrate") 54 | .setDescription(`${user.user} is ${gay}% 🏳🌈`) 55 | .setTimestamp() 56 | .setColor("RANDOM") 57 | .setFooter(`Req by: ${message.author.tag}`) 58 | 59 | 60 | const msg = await message.util.send(em) 61 | 62 | setTimeout(() => { 63 | msg.edit(em1) 64 | }, 5000) 65 | } 66 | } 67 | 68 | module.exports = GayrateCommand; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kurapika-bot", 3 | "version": "v2.0.0", 4 | "description": "Just bot", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node index.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/Miouns/kurapika.git" 13 | }, 14 | "author": "", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/Miouns/kurapika/issues" 18 | }, 19 | "homepage": "https://github.com/Miouns/kurapika#readme", 20 | "dependencies": { 21 | "@allvaa/get-lyrics": "^1.1.4", 22 | "@discordjs/opus": "^0.4.0", 23 | "@lavacord/discord.js": "0.0.7", 24 | "alexa-bot-api": "^0.2.1", 25 | "axios": "^0.21.1", 26 | "canvacord": "^5.0.8", 27 | "captcha-canvas": "^2.2.2", 28 | "child_process": "^1.0.2", 29 | "common-tags": "^1.8.0", 30 | "discord-akairo": "8.1.0", 31 | "discord-canvas": "^1.4.1", 32 | "discord-xp": "^1.1.7", 33 | "discord.js": "12.5.1", 34 | "discord.js-menu": "^2.3.1", 35 | "dotenv": "^8.2.0", 36 | "express": "^4.17.1", 37 | "genius-lyrics": "^4.2.7", 38 | "genius-lyrics-api": "^3.0.6", 39 | "lavacord": "^1.1.9", 40 | "mailist": "^1.0.3", 41 | "moment": "^2.29.1", 42 | "mongodb": "^3.6.4", 43 | "mongoose": "^5.11.14", 44 | "ms": "^2.1.3", 45 | "node-fetch": "2.6.1", 46 | "node-superfetch": "^0.1.11", 47 | "parse-ms": "^2.1.0", 48 | "path": "0.12.7", 49 | "pretty-ms": "^7.0.1", 50 | "quick.db": "7.1.3", 51 | "reconlx": "^1.2.41", 52 | "tinyurl": "^1.1.7", 53 | "winston": "^3.3.3", 54 | "xml": "^1.0.1", 55 | "xmlhttprequest": "^1.8.0" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /commands/util/docs.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const fetch = require('node-superfetch'); 3 | const qs = require('querystring'); 4 | 5 | class DocsCommand extends Command { 6 | constructor() { 7 | super('docs', { 8 | aliases: ['docs'], 9 | args: [ 10 | { 11 | id: 'docs', 12 | type: 'string', 13 | match: 'text', 14 | limit: 3000, 15 | prompt: { 16 | start: msg => `${msg.member} Would you like to search?\nType: ` 17 | } 18 | }, 19 | { 20 | key: "flag", 21 | type: "options" 22 | } 23 | ] 24 | }); 25 | 26 | this.name = 'docs'; 27 | this.description = 28 | 'Search documentation of discord.js\n*Supported discord-rpc, discord-akairo, discord.js-commando*'; 29 | this.usage = 'docs [stable|master|rpc|commando|akairo-master]'; 30 | this.example = 'docs client stable'; 31 | } 32 | 33 | async exec(msg, { docs }) { 34 | console.log(docs) 35 | let args = msg.content 36 | .slice(msg.guild.prefix) 37 | .trim() 38 | .split(/ +/) 39 | .slice(1) 40 | 41 | const SOURCES = [ 42 | 'stable', 43 | 'master', 44 | 'rpc', 45 | 'commando', 46 | 'akairo', 47 | 'akairo-master', 48 | '11.5-dev' 49 | ]; 50 | 51 | let source = SOURCES.includes(args.slice(-1)[0]) ? args.pop() : 'stable'; 52 | if (source === '11.5-dev') { 53 | source = `https://raw.githubusercontent.com/discordjs/discord.js/docs/${source}.json`; 54 | } 55 | try { 56 | const queryString = qs.stringify({ 57 | src: source, 58 | q: docs 59 | }); 60 | const { body: embed } = await fetch.get( 61 | `https://djsdocs.sorta.moe/v2/embed?${queryString}` 62 | ); 63 | if (!embed) { 64 | return msg.util.reply( 65 | "I couldn't find the requested information. Maybe look for something that actually exists the next time!" 66 | ); 67 | } 68 | return msg.util.send({ embed }); 69 | } catch (e) { 70 | return msg.util.send( 71 | `Oh no an error occured :( \`${e.message}\` try again later` 72 | ); 73 | } 74 | } 75 | } 76 | 77 | module.exports = DocsCommand; 78 | -------------------------------------------------------------------------------- /listeners/message.js: -------------------------------------------------------------------------------- 1 | const { Listener } = require("discord-akairo"); 2 | const Alexa = require("alexa-bot-api"); 3 | const ai = new Alexa("aw2plm"); 4 | const Levels = require("discord-xp"); 5 | Levels.setURL(process.env.MONGO_USER && process.env.MONGO_PASS ? `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@cluster0.iknae.mongodb.net/discord?retryWrites=true&w=majority` : "mongodb://localhost/discord") 6 | 7 | module.exports = class MessageListener extends Listener { 8 | constructor() { 9 | super("message", { 10 | emitter: "client", 11 | event: "message" 12 | }) 13 | } 14 | 15 | async exec(msg) { 16 | /* 17 | let afk = msg.member.afk 18 | let afkID = afk.user.id 19 | if(afk) { 20 | msg.member.deleteAfk() 21 | 22 | msg.channel.send(` Welcome back, ${msg.member}`) 23 | } else if(msg.content.includes(afkID)) { 24 | msg.channel.send(`Sorry this user is currently AFK\n Reason: \`${afk.reason}\``) 25 | } 26 | */ 27 | 28 | if(msg.author.bot || !msg.guild) return 29 | 30 | let xp = Math.floor(Math.random() * 10) + 1 31 | let levelUp = await Levels.appendXp(msg.author.id, msg.guild.id, xp) 32 | 33 | if(levelUp) { 34 | let user = await Levels.fetch(msg.author.id, msg.guild.id) 35 | let msgLevelUp = this.client.config.levelUp 36 | .replace(/{user}/g, `${msg.author}`) 37 | .replace(/{server}/g, `${msg.guild}`) 38 | .replace(/{userTag}/g, msg.author.tag) 39 | .replace(/{level}/g, user.level) 40 | 41 | msg.channel.send(msgLevelUp) 42 | } 43 | 44 | let channelID = this.client.db.get(`chat.${msg.guild.id}`); 45 | 46 | let channel = msg.guild.channels.cache.get(channelID) 47 | 48 | if(!channel) return 49 | 50 | if(!msg.channel.id === channelID) return 51 | 52 | if(msg.channel.id === channelID) { 53 | if(msg.author.bot) return 54 | let content = msg.content 55 | 56 | const reply = await ai.getReply(content) 57 | 58 | msg.channel.send(reply) 59 | } 60 | 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /structures/GuildMember.js: -------------------------------------------------------------------------------- 1 | const { Structures } = require('discord.js'); 2 | const moment = require('moment'); 3 | 4 | Structures.extend('GuildMember', GuildMember => { 5 | class GuildMemberExt extends GuildMember { 6 | constructor(...args) { 7 | super(...args); 8 | } 9 | 10 | get afk() { 11 | let afk = { 12 | reason: this.getAfk(), 13 | user: this.user 14 | } 15 | return afk; 16 | } 17 | 18 | getAfk() { 19 | return this.client.db.get(`afk.${this.guild.id}.${this.id}`); 20 | } 21 | 22 | setAfk(reason) { 23 | if (!reason) return TypeError('No Reason provided'); 24 | 25 | this.client.db.set(`afk.${this.guild.id}.${this.id}`, reason); 26 | } 27 | 28 | setAfkDate() { 29 | let date = new Date(); 30 | date = moment.utc(date).format('DD - MM - YYYY | hh:mm:ss A'); 31 | 32 | this.client.db.set(`afk.${this.guild.id}.${this.id}.date`, date); 33 | } 34 | 35 | getAfkDate() { 36 | this.client.db.get(`afk.${this.guild.id}.${this.id}.date`); 37 | } 38 | 39 | deleteAfk() { 40 | this.client.db.delete(`afk.${this.guild.id}.date`); 41 | 42 | this.client.db.delete(`afk.${this.guild.id}.${this.id}`); 43 | } 44 | 45 | get economy() { 46 | let economy = { 47 | money: this.client.db.get(`economy.${this.guild.id}.${this.id}.money`) || 0, 48 | bank: this.client.db.get(`economy.${this.guild.id}.${this.id}.bank`) || 0, 49 | cooldown: this.client.db.get(`economy.${this.guild.id}.${this.id}.cooldown`), 50 | user: this.user 51 | } 52 | return economy; 53 | } 54 | 55 | setMoney(amount) { 56 | return this.client.db.add(`economy.${this.guild.id}.${this.id}.money`, amount) 57 | } 58 | 59 | setBank(amount) { 60 | return this.client.db.add(`economy.${this.guild.id}.${this.id}.bank`, amount) 61 | } 62 | 63 | removeMoney(amount) { 64 | return this.client.db.subtract(`economy.${this.guild.id}.${this.id}.money`, amount) 65 | } 66 | 67 | removeBank(amount) { 68 | return this.client.db.subtract(`economy.${this.guild.id}.${this.id}.bank`, amount) 69 | } 70 | 71 | 72 | } 73 | 74 | return GuildMemberExt; 75 | }); 76 | -------------------------------------------------------------------------------- /core/KurapikaClient.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { 3 | AkairoClient, 4 | CommandHandler, 5 | ListenerHandler 6 | } = require('discord-akairo'); 7 | const { ownerID, defaultPrefix } = require('../config.js'); 8 | const config = require('../config.js'); 9 | const { Manager } = require('@lavacord/discord.js'); 10 | const KurapikaClientUtil = require('./KurapikaClientUtil.js'); 11 | const db = require('quick.db'); 12 | const winston = require('winston'); 13 | 14 | require('../structures/Guild.js'); 15 | require('../structures/GuildMember.js'); 16 | require('../structures/Message.js'); 17 | // require('../structures/User.js'); 18 | 19 | module.exports = class KurapikaClient extends AkairoClient { 20 | constructor(...args) { 21 | super(...args); 22 | 23 | this.logger = winston.createLogger({ 24 | transports: [ 25 | new winston.transports.Console(), 26 | new winston.transports.File({ filename: 'log' }) 27 | ], 28 | format: winston.format.printf( 29 | log => `[${log.level.toUpperCase()}] ${log.message}` 30 | ) 31 | }); 32 | 33 | this.manager = new Manager(this, [ 34 | { 35 | id: 'main', 36 | host: process.env.LAVA_HOST, 37 | port: process.env.LAVA_PORT, 38 | password: process.env.LAVA_PASS 39 | } 40 | ]); 41 | 42 | this.commandHandler = new CommandHandler(this, { 43 | directory: path.join(__dirname, '..', 'commands/'), 44 | handleEdits: true, 45 | storeMessages: true, 46 | commandUtil: true, 47 | 48 | prefix: message => (message.guild ? message.guild.prefix : defaultPrefix) 49 | }); 50 | 51 | this.listenerHandler = new ListenerHandler(this, { 52 | directory: path.join(__dirname, '..', 'listeners/') 53 | }); 54 | 55 | this.util = new KurapikaClientUtil(this); 56 | this.config = config; 57 | this.db = db; 58 | } 59 | 60 | async login(token) { 61 | this.commandHandler.loadAll(); 62 | this.commandHandler.useListenerHandler(this.listenerHandler); 63 | this.listenerHandler.loadAll(); 64 | 65 | this.manager 66 | .on('ready', node => console.log(`Node ${node.id} is ready!`)) 67 | .on('disconnect', (ws, node) => 68 | console.log(`Node ${node.id} disconnected.`) 69 | ) 70 | .on('reconnecting', node => 71 | console.log(`Node ${node.id} tries to reconnect.`) 72 | ) 73 | .on('error', (error, node) => 74 | console.log(`Node ${node.id} got an error: ${error.message}`) 75 | ); 76 | 77 | return super.login(token); 78 | } 79 | }; 80 | -------------------------------------------------------------------------------- /commands/dev/eval.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const fetch = require('node-fetch'); 3 | const Akairo = require("discord-akairo"); 4 | const Discord = require('discord.js'); 5 | const axios = require("axios"); 6 | const config = require("../../config.js"); 7 | 8 | class EvalCommand extends Command { 9 | constructor() { 10 | super('eval', { 11 | aliases: ['eval', 'e', 'ev'], 12 | ownerOnly: true, 13 | category: "Dev", 14 | description: { 15 | content: "Evaluate Command", 16 | usage: "eval ", 17 | example: ["eval 1+1", "eval message.channel.send(\"Hello world\")", "eval msg.channel.send(\"Hello world\")"] 18 | } 19 | }); 20 | } 21 | 22 | async clean(client, text) { 23 | if (text && text.constructor.name == 'Promise') text = await text; 24 | if (typeof text !== 'string') 25 | text = require('util').inspect(text, { 26 | depth: 1 27 | }); 28 | 29 | const token = RegExp(`${client.token}`, "gi") 30 | const mongo_pass = RegExp(`${process.env.MONGO_PASS}`, "gi") 31 | const mongo_user = RegExp(`${process.env.MONGO_USER}`, "gi") 32 | 33 | text = text 34 | .replace(/`/g, '`' + String.fromCharCode(8203)) 35 | .replace(/@/g, '@' + String.fromCharCode(8203)) 36 | .replace(token, '') 37 | .replace(mongo_pass, "") 38 | .replace(mongo_user, ""); 39 | 40 | return text; 41 | } 42 | 43 | hastebin(input, extension) { 44 | return new Promise(function(res, rej) { 45 | if (!input) rej('[Error] Missing Input'); 46 | fetch(config.hastebin, { 47 | method: 'POST', 48 | body: input 49 | }) 50 | .then(res => res.json()) 51 | .then(body => { 52 | res( 53 | config.hastebin.split("documents")[0] + 54 | body.key + 55 | (extension ? '.' + extension : '') 56 | ); 57 | }) 58 | .catch(e => rej(e)); 59 | }); 60 | } 61 | 62 | async exec(message) { 63 | let args = message.content.slice(message.guild.prefix.length).trim().split(/ +/).slice(1) 64 | let code = args.join(" ") 65 | try { 66 | const evaled = eval(code); 67 | const clean = await this.clean(this.client, evaled); 68 | if (clean.length > 2000) 69 | message.util.send(await this.hastebin(clean)); 70 | else message.util.send(`\`\`\`js\n${clean}\n\`\`\``); 71 | } catch (err) { 72 | message.util.send( 73 | `\`ERROR\` \`\`\`xl\n${await this.clean( 74 | this.client, 75 | err 76 | )}\n\`\`\`` 77 | ); 78 | } 79 | } 80 | } 81 | 82 | module.exports = EvalCommand; -------------------------------------------------------------------------------- /commands/music/seek.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const durationPattern = /^[0-5]?[0-9](:[0-5][0-9]){1,2}$/; 3 | 4 | class SeekCommand extends Command { 5 | constructor() { 6 | super('seek', { 7 | aliases: ['seek'] 8 | }); 9 | 10 | this.name = 'seek'; 11 | // this.description = "Pause the music"; 12 | // this.example = "pause"; 13 | // this.usage = "pause"; 14 | } 15 | 16 | async exec(msg) { 17 | const args = msg.content 18 | .slice(msg.guild.prefix) 19 | .trim() 20 | .split(/ +/) 21 | .slice(1); 22 | 23 | const util = this.client.util; 24 | const { music } = msg.guild; 25 | if (!music.player || !music.player.playing) 26 | return msg.channel.send( 27 | util.embed().setDescription('❌ | Currently not playing anything.') 28 | ); 29 | if (!msg.member.voice.channel) 30 | return msg.channel.send( 31 | util.embed().setDescription('❌ | You must be on a voice channel.') 32 | ); 33 | if ( 34 | msg.guild.me.voice.channel && 35 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 36 | ) 37 | return msg.channel.send( 38 | util 39 | .embed() 40 | .setDescription( 41 | `❌ | You must be on ${ 42 | msg.guild.me.voice.channel 43 | } to use this command.` 44 | ) 45 | ); 46 | 47 | if (!music.current.info.isSeekable) 48 | return msg.channel.send( 49 | util.embed().setDescription("❌ | Current track isn't seekable.") 50 | ); 51 | 52 | const duration = args[0]; 53 | if (!duration) 54 | return msg.channel.send( 55 | util 56 | .embed() 57 | .setDescription( 58 | '❌ | You must provide duration to seek. Valid duration e.g. `1:34`.' 59 | ) 60 | ); 61 | if (!durationPattern.test(duration)) 62 | return msg.channel.send( 63 | util 64 | .embed() 65 | .setDescription( 66 | '❌ | You provided an invalid duration. Valid duration e.g. `1:34`.' 67 | ) 68 | ); 69 | 70 | const durationMs = util.durationToMillis(duration); 71 | if (durationMs > music.current.info.length) 72 | return msg.channel.send( 73 | util 74 | .embed() 75 | .setDescription( 76 | '❌ | The duration you provide exceeds the duration of the current track.' 77 | ) 78 | ); 79 | 80 | try { 81 | await music.player.seek(durationMs); 82 | msg.channel.send( 83 | util 84 | .embed() 85 | .setDescription( 86 | `✅ | Seeked to ${util.millisToDuration(durationMs)}.` 87 | ) 88 | ); 89 | } catch (e) { 90 | msg.channel.send(`An error occured: ${e.message}.`); 91 | } 92 | } 93 | } 94 | 95 | module.exports = SeekCommand; 96 | -------------------------------------------------------------------------------- /commands/music/play.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | 3 | class PlayCommand extends Command { 4 | constructor() { 5 | super('play', { 6 | aliases: ['play', 'p'] 7 | }); 8 | 9 | this.name = "play"; 10 | this.description = "Play a music"; 11 | this.example = "play"; 12 | this.usage = "play "; 13 | } 14 | 15 | async exec(msg) { 16 | const args = msg.content 17 | .slice(msg.guild.prefix) 18 | .trim() 19 | .split(/ +/) 20 | .slice(1) 21 | 22 | const util = this.client.util; 23 | const { music } = msg.guild; 24 | if (!msg.member.voice.channel) 25 | return msg.channel.send( 26 | util.embed().setDescription('❌ | You must be on a voice channel.') 27 | ); 28 | if ( 29 | msg.guild.me.voice.channel && 30 | !msg.guild.me.voice.channel.equals(msg.member.voice.channel) 31 | ) 32 | return msg.channel.send( 33 | util 34 | .embed() 35 | .setDescription( 36 | `❌ | You must be on ${ 37 | msg.guild.me.voice.channel 38 | } to use this command.` 39 | ) 40 | ); 41 | 42 | if (!music.node || !music.node.connected) 43 | return msg.channel.send( 44 | util.embed().setDescription(`❌ | Lavalink node not connected.`) 45 | ); 46 | 47 | const query = args.join(' '); 48 | try { 49 | const { 50 | loadType, 51 | playlistInfo: { name }, 52 | tracks 53 | } = await music.load( 54 | util.isValidURL(query) ? query : `ytsearch:${query}` 55 | ); 56 | if (!tracks.length) 57 | return msg.channel.send( 58 | util.embed().setDescription("❌ | Couldn't find any results.") 59 | ); 60 | 61 | if (loadType === 'PLAYLIST_LOADED') { 62 | for (const track of tracks) { 63 | track.requester = msg.author; 64 | music.queue.push(track); 65 | } 66 | msg.channel.send( 67 | util 68 | .embed() 69 | .setDescription( 70 | `✅ | Loaded \`${tracks.length}\` tracks from **${name}**.` 71 | ) 72 | ); 73 | } else { 74 | const track = tracks[0]; 75 | track.requester = msg.author; 76 | music.queue.push(track); 77 | if (music.player && music.player.playing) 78 | msg.channel.send( 79 | util 80 | .embed() 81 | .setDescription( 82 | `✅ | **${track.info.title}** added to the queue.` 83 | ) 84 | ); 85 | } 86 | 87 | if (!music.player) await music.join(msg.member.voice.channel); 88 | if (!music.player.playing) await music.start(); 89 | 90 | music.setTextCh(msg.channel); 91 | } catch (e) { 92 | msg.channel.send(`An error occured: ${e.message}.`); 93 | } 94 | } 95 | } 96 | 97 | module.exports = PlayCommand; -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '28 16 * * 1' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | language: [ 'javascript' ] 32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 33 | # Learn more: 34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v2 39 | 40 | # Initializes the CodeQL tools for scanning. 41 | - name: Initialize CodeQL 42 | uses: github/codeql-action/init@v1 43 | with: 44 | languages: ${{ matrix.language }} 45 | # If you wish to specify custom queries, you can do so here or in a config file. 46 | # By default, queries listed here will override any specified in a config file. 47 | # Prefix the list here with "+" to use these queries and those in the config file. 48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 49 | 50 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 51 | # If this step fails, then you should remove it and run the build manually (see below) 52 | - name: Autobuild 53 | uses: github/codeql-action/autobuild@v1 54 | 55 | # ℹ️ Command-line programs to run using the OS shell. 56 | # 📚 https://git.io/JvXDl 57 | 58 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 59 | # and modify them (or add more) to build your code if your project 60 | # uses a compiled language 61 | 62 | #- run: | 63 | # make bootstrap 64 | # make release 65 | 66 | - name: Perform CodeQL Analysis 67 | uses: github/codeql-action/analyze@v1 68 | -------------------------------------------------------------------------------- /commands/music/queue.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord-akairo'); 2 | const emojis = ["◀", "⛔", "▶"]; 3 | 4 | class QueueCommand extends Command { 5 | constructor() { 6 | super('queue', { 7 | aliases: ['queue', 'q'] 8 | }); 9 | 10 | this.name = "queue"; 11 | this.description = "Display the song queue"; 12 | this.example = "queue"; 13 | this.usage = "queue"; 14 | } 15 | 16 | async exec(msg) { 17 | const util = this.client.util; 18 | const { music } = msg.guild; 19 | if (!music.player || !music.player.playing) 20 | return msg.channel.send( 21 | util.embed().setDescription('❌ | Currently not playing anything.') 22 | ); 23 | if (!music.queue.length) 24 | return msg.channel.send( 25 | util.embed().setDescription('❌ | Queue is empty.') 26 | ); 27 | 28 | const queue = music.queue.map( 29 | (t, i) => `\`${++i}.\` **${t.info.title}** ${t.requester}` 30 | ); 31 | const chunked = util.chunk(queue, 10); 32 | let currPage = 0; 33 | 34 | const embed = util 35 | .embed() 36 | .setAuthor( 37 | `${msg.guild.name} music queue.`, 38 | msg.guild.iconURL({ dynamic: true }) 39 | ) 40 | .setDescription(chunked[0].join('\n')) 41 | .setFooter(`Page 1 of ${chunked.length}.`); 42 | 43 | try { 44 | const queueMsg = await msg.channel.send(embed); 45 | 46 | if (chunked.length > 1) { 47 | for (const emoji of emojis) { 48 | await queueMsg.react(emoji); 49 | } 50 | awaitReactions(queueMsg); 51 | } 52 | } catch (e) { 53 | msg.channel.send(`An error occured: ${e.message}.`); 54 | } 55 | 56 | function awaitReactions(queueMsg) { 57 | const collector = queueMsg.createReactionCollector( 58 | (reaction, user) => { 59 | return ( 60 | emojis.includes(reaction.emoji.name) && user.id === msg.author.id 61 | ); 62 | }, 63 | { 64 | max: 1, 65 | time: 30000 66 | } 67 | ); 68 | 69 | collector 70 | .on('collect', reaction => { 71 | reaction.users.remove(msg.author); 72 | 73 | const emoji = reaction.emoji.name; 74 | if (emoji === emojis[0]) currPage--; 75 | if (emoji === emojis[1]) return collector.stop(); 76 | if (emoji === emojis[2]) currPage++; 77 | currPage = 78 | ((currPage % chunked.length) + chunked.length) % chunked.length; 79 | 80 | const embed = queueMsg.embeds[0] 81 | .setDescription(chunked[currPage].join('\n')) 82 | .setFooter(`Page ${currPage + 1} of ${chunked.length}.`); 83 | 84 | queueMsg.edit(embed); 85 | 86 | awaitReactions(queueMsg); 87 | }) 88 | .on('end', (_, reason) => { 89 | if (['time', 'user'].includes(reason)) queueMsg.reactions.removeAll(); 90 | }); 91 | } 92 | } 93 | } 94 | 95 | module.exports = QueueCommand; -------------------------------------------------------------------------------- /core/KurapikaClientUtil.js: -------------------------------------------------------------------------------- 1 | const { ClientUtil } = require('discord-akairo'); 2 | const { MessageEmbed } = require('discord.js'); 3 | const prettyMilliseconds = require('pretty-ms'); 4 | const axios = require('axios'); 5 | 6 | 7 | class KurapikaClientUtil extends ClientUtil { 8 | constructor(client) { 9 | super(client); 10 | 11 | this.getMember = this.getMember; 12 | this.emojis = require("./emojis.json") 13 | } 14 | 15 | embed() { 16 | return new MessageEmbed().setColor('#99AAB5'); 17 | } 18 | 19 | durationToMillis(dur) { 20 | return ( 21 | dur 22 | .split(':') 23 | .map(Number) 24 | .reduce((acc, curr) => curr + acc * 60) * 1000 25 | ); 26 | } 27 | 28 | millisToDuration(ms) { 29 | return prettyMilliseconds(ms, { 30 | colonNotation: true, 31 | secondsDecimalDigits: 0 32 | }); 33 | } 34 | 35 | chunk(arr, size) { 36 | const temp = []; 37 | for (let i = 0; i < arr.length; i += size) { 38 | temp.push(arr.slice(i, i + size)); 39 | } 40 | return temp; 41 | } 42 | 43 | isValidURL(url) { 44 | return /^https?:\/\/((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(#[-a-z\d_]*)?$/i.test( 45 | url 46 | ); 47 | } 48 | 49 | shuffleArray(arr) { 50 | for (let i = arr.length - 1; i > 0; i--) { 51 | const j = Math.floor(Math.random() * (i + 1)); 52 | [arr[i], arr[j]] = [arr[j], arr[i]]; 53 | } 54 | return arr; 55 | } 56 | 57 | async webhook(url, msg, opt = {}) { 58 | let { data: web } = await axios.get(url); 59 | 60 | if (!typeof opt === 'object') 61 | return Error('That arguments `opt` must be object'); 62 | 63 | if (typeof msg === 'object') opt['embeds'] = [msg]; 64 | else opt['content'] = msg; 65 | 66 | return axios.post(url, opt); 67 | } 68 | 69 | async getMember(message, toFind = '') { 70 | toFind = toFind.toLowerCase(); 71 | 72 | let target = message.guild.members.cache.get(toFind); 73 | 74 | if (!toFind) { 75 | target = message.member; 76 | } 77 | 78 | if (!target && message.mentions.members) 79 | target = message.mentions.members.first(); 80 | 81 | if (!target && toFind) { 82 | target = message.guild.members.cache.find(member => { 83 | return ( 84 | member.displayName.toLowerCase().includes(toFind) || 85 | member.user.tag.toLowerCase().includes(toFind) 86 | ); 87 | }); 88 | } 89 | 90 | if (!target) { 91 | return message.channel.send({ 92 | embed: { 93 | description: 'User Not Found', 94 | color: 'RED' 95 | } 96 | }); 97 | } 98 | 99 | return target; 100 | } 101 | 102 | getChannel(guild, channel, caseSensitive, wholeWord) { 103 | let ch = parseInt(channel) 104 | 105 | if(isNaN(ch)) { 106 | return this.resolveChannel(channel, guild.channels.cache, caseSensitive, wholeWord) 107 | } else { 108 | return guild.channels.cache.get(channel); 109 | } 110 | } 111 | } 112 | 113 | module.exports = KurapikaClientUtil; -------------------------------------------------------------------------------- /core/KurapikaMusicHandler.js: -------------------------------------------------------------------------------- 1 | const { Rest } = require('lavacord'); 2 | const util = require('./utils'); 3 | 4 | module.exports = class KurapikaMusicHandler { 5 | /** @param {import("discord.js").Guild} guild */ 6 | constructor(guild) { 7 | this.guild = guild; 8 | this.volume = 100; 9 | this.loop = false; 10 | this.previous = null; 11 | this.current = null; 12 | this.queue = []; 13 | /** @type {import("discord.js").TextChannel|null} */ 14 | this.textChannel = null; 15 | } 16 | 17 | get voiceChannel() { 18 | return this.guild.me.voice.channel; 19 | } 20 | 21 | /** @returns {import("../structures/MusicClient")} */ 22 | get client() { 23 | return this.guild.client; 24 | } 25 | 26 | get player() { 27 | return this.client.manager.players.get(this.guild.id) || null; 28 | } 29 | 30 | get node() { 31 | return this.client.manager.nodes.get('main'); 32 | } 33 | 34 | reset() { 35 | this.loop = false; 36 | this.volume = 100; 37 | this.previous = null; 38 | this.current = null; 39 | this.queue = []; 40 | this.textChannel = null; 41 | } 42 | 43 | /** @param {import("discord.js").VoiceChannel} voice */ 44 | async join(voice) { 45 | if (this.player) return; 46 | await this.client.manager.join( 47 | { 48 | channel: voice.id, 49 | guild: this.guild.id, 50 | node: this.node.id 51 | }, 52 | { selfdeaf: true } 53 | ); 54 | 55 | this.player 56 | .on('start', () => { 57 | this.current = this.queue.shift(); 58 | if (this.textChannel) 59 | this.textChannel.send( 60 | util 61 | .embed() 62 | .setDescription( 63 | `🎶 | Now playing **${this.current.info.title}**.` 64 | ) 65 | ); 66 | }) 67 | .on('end', data => { 68 | if (data.reason === 'REPLACED') return; 69 | this.previous = this.current; 70 | this.current = null; 71 | if (this.loop) this.queue.push(this.previous); 72 | if (!this.queue.length) { 73 | this.client.manager.leave(this.guild.id); 74 | if (this.textChannel) 75 | this.textChannel.send( 76 | util 77 | .embed() 78 | .setDescription('✅ | Queue is empty. Leaving voice channel..') 79 | ); 80 | this.reset(); 81 | return; 82 | } 83 | this.start(); 84 | }) 85 | .on('error', console.error); 86 | } 87 | 88 | /** @param {import("discord.js").TextChannel} text */ 89 | setTextCh(text) { 90 | this.textChannel = text; 91 | } 92 | 93 | async load(query) { 94 | const res = await Rest.load(this.node, query); 95 | return res; 96 | } 97 | 98 | async start() { 99 | if (!this.player) return; 100 | await this.player.play(this.queue[0].track); 101 | } 102 | 103 | async pause() { 104 | if (!this.player) return; 105 | if (!this.player.paused) await this.player.pause(true); 106 | } 107 | 108 | async resume() { 109 | if (!this.player) return; 110 | if (this.player.paused) await this.player.pause(false); 111 | } 112 | 113 | async skip() { 114 | if (!this.player) return; 115 | await this.player.stop(); 116 | } 117 | 118 | async stop() { 119 | if (!this.player) return; 120 | this.loop = false; 121 | this.queue = []; 122 | await this.skip(); 123 | } 124 | 125 | async setVolume(newVol) { 126 | if (!this.player) return; 127 | const parsed = parseInt(newVol, 10); 128 | if (isNaN(parsed)) return; 129 | await this.player.volume(parsed); 130 | this.volume = newVol; 131 | } 132 | }; 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ❗ARCHIVE 2 | will create a new repository for the slash command. 3 | 4 | Done: https://github.com/Syrup/kurapika-update/ 5 | 6 | --- 7 | 8 | 9 | 10 | 11 | # Kurapika 12 | [![Discord Bots](https://top.gg/api/widget/status/707651800072716360.svg)](https://top.gg/bot/707651800072716360) 13 | [![Discord Bots](https://top.gg/api/widget/upvotes/707651800072716360.svg)](https://top.gg/bot/707651800072716360) 14 | 15 | ### Note 16 | > Don't forget to do `npm install --save` before running the bot!!!! 17 | 18 | # Navigation 19 | --- 20 | - [Kurapika](#kurapika) 21 | - [Tutorial](#tutorial) 22 | - [Environment setup](#environment-setup) 23 | - [Bot configuration](#bot-configuration) 24 | - [Features](#features) 25 | - [Send Message As Webhook](#send-message-as-webhook) 26 | - [Example](#example) 27 | - [getMember](#getmember) 28 | - [Example](#example-1) 29 | - [getChannel](#getchannel) 30 | - [Example](#example-2) 31 | 32 | 33 | # Tutorial 34 | ###### Environment Setup 35 | rename `.env-example` to `.env` 36 | now open `.env` file and fill in each variable according to the instructional 37 | 38 | 39 | ###### Bot Configuration 40 | open `config.js` file 41 | now replace `YOUR DISCORD ID, YOUR DISCORD ID 2` with your discord id and replace `YOUR DISCORD ID 2` your friend discord id 42 | and replace `prefix` with your discord prefix 43 | 44 | ###### Run Bot 45 | Run the bot with bash command `npm start` or `node index.js` 46 | 47 | 48 | 49 | ### And Done 🖐️ 50 | 51 | # Features 52 | 53 | ### Send Message as Webhook 54 | ```js 55 | this.client.util.webhook(urlWebhook, message, opt) 56 | ``` 57 | 58 | | Name | Type | Default | Description | Required | 59 | |------------|---------------------------------------------------------------------------------------------------|---------|-------------------------|----------| 60 | | urlWebhook | **String** | `none` | Your webhook URL | `true` | 61 | | message | [MessageEmbed](https://discord.js.org/#/docs/main/stable/class/MessageEmbed) or **String** | `none` | Can be embed or message | `true` | 62 | | opt | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | `none` | Options | `false` | 63 | 64 | 65 | #### Example 66 | ```js 67 | const { MessageEmbed } = require("discord.js"); 68 | let url = "Your Webhook URL" 69 | let embed = new MessageEmbed() 70 | .setTitle("Hello") 71 | .setDescription("World") 72 | 73 | let opt = { 74 | username: "Happy", 75 | avatar_url: message.author.displayAvatarURL(), 76 | content: "this is optional" 77 | } 78 | 79 | this.client.util.webhook(url, embed, opt) 80 | ``` 81 | 82 | return [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) 83 | 84 | ### getMember 85 | ```js 86 | this.client.util.getMember(message, name) 87 | ``` 88 | 89 | | Name | Type | Default | Description | Required | 90 | |---------|--------------------------------------------------------------------|---------|------------------|----------| 91 | | message | [Message](https://discord.js.org/#/docs/main/stable/class/Message) | `none` | message | `true` | 92 | | name | Snowflake or Username | `none` | maybe id or name | `true` | 93 | 94 | 95 | #### Example 96 | ```js 97 | (async () => { 98 | let member = await this.client.util.getMember(message, "Syrup") 99 | return member 100 | })() 101 | ``` 102 | 103 | or 104 | 105 | ```js 106 | async function user(message, name) { 107 | const member = await this.client.util.getMember(message, name) 108 | return member 109 | } 110 | 111 | user(message, "Kurapika") 112 | ``` 113 | 114 | return [GuildMember](https://discord.js.org/#/docs/main/stable/class/GuildMember) 115 | 116 | ### getChannel 117 | ```js 118 | this.client.util.getChannel(guild, channel, caseSensitive, wholeWord) 119 | ``` 120 | 121 | #### Example 122 | ```js 123 | this.client.util.getChannel(message.guild, "general", true) 124 | ``` 125 | 126 | | Name | Type | Default | Description | Required | 127 | |---------------|-----------------------------------------------------------------------------------------------------|---------|---------------------------------------------|----------| 128 | | guild | [Guild](https://discord.js.org/#/docs/main/stable/class/Guild) | `none` | Guild to check | `true` | 129 | | channel | Snowflake or Channel Name | `none` | maybe the channel id or name | `true` | 130 | | caseSensitive | [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | `false` | Makes checking by name case sensitive. | `false` | 131 | | wholeWord | [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | `false` | Makes finding by name match full word only. | `false` | 132 | 133 | > This maybe the same as [resolveChannel](https://discord-akairo.github.io/#/docs/main/master/class/ClientUtil?scrollTo=resolveChannel) but I have kept it simple :) 134 | 135 | return [Channel](https://discord.js.org/#/docs/main/stable/class/Channel) 136 | 137 | --- 138 | [![Discord Bots](https://top.gg/api/widget/707651800072716360.svg)](https://top.gg/bot/707651800072716360) 139 | --------------------------------------------------------------------------------