parent
6352890646
commit
2d3f0ea332
@ -1,132 +1 @@
|
||||
# ---> Node
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
node_modules
|
@ -0,0 +1,57 @@
|
||||
const {Command, Random} = require('../../lib.js');
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const guildsM = require('../../models/guilds.js');
|
||||
|
||||
module.exports = class leave extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'activateStrikes',
|
||||
group:'admin',
|
||||
aliases: ['aStrike'],
|
||||
description: 'Activates strikes for the guild. Can be called again to disable.',
|
||||
needsAdmin:true
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
const guild = message.guild.id
|
||||
guildsM.findOne({gID:guild}).then(g=>
|
||||
{
|
||||
g.strikes =!g.strikes;
|
||||
guildsM.updateOne({gID:guild}, g,{upsert:true}).then(updatedG=>
|
||||
{
|
||||
sendMessage(g.strikes);
|
||||
})
|
||||
})
|
||||
async function sendMessage(active){
|
||||
console.log(active?'Activate Music: -':'Disable Music: -', Author.username, 'on guild:', guild);
|
||||
const randomID = Random()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xd31f1f)
|
||||
.setTitle(active?'Music activated!':'Music disabled!')
|
||||
.setAuthor( {name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setTimestamp()
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const filter = i => i.customId === randomID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
class ban extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'ban',
|
||||
group:'admin',
|
||||
needsAdmin: true,
|
||||
description: 'Bans a user from the server.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args) {
|
||||
// Get the user mentioned in the message
|
||||
const user = message.mentions.users.first();
|
||||
// Check if the user mentioned exists and is not a bot
|
||||
if (!user || user.bot) {
|
||||
return new ErrorMessage(this.client).send(ErrorType.Arguments, message, ['User is a bot, or you sent something wrong.'])
|
||||
}
|
||||
|
||||
// Ban the user
|
||||
try {
|
||||
await user.ban();
|
||||
return message.channel.send(`${user.tag} was banned from the server.`);
|
||||
} catch (error) {
|
||||
return console.log(`Ban: An error occurred: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
}module.exports = ban;
|
@ -0,0 +1,122 @@
|
||||
|
||||
const {Command, ErrorMessage, ErrorType, Client, Message} = require('../../lib.js')
|
||||
|
||||
|
||||
|
||||
class clearchat extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'clearchat',
|
||||
needsAdmin: true,
|
||||
aliases:['clear'],
|
||||
description: 'Clears the channel where it was used, you can pass a message id to clear around it.'
|
||||
})
|
||||
this.client = client;
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
//verificar admin
|
||||
const Author = message.author.username;
|
||||
const channel = message.channel.name;
|
||||
console.log('ClearChat:',' - ', Author, 'on:', channel, args?args:'No limit' )
|
||||
//Verificar se está na sala bemvindo
|
||||
if(bemvindo(message))
|
||||
{
|
||||
clear(null, true, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
//verificar se tem argumentos
|
||||
if(args.length>0)
|
||||
{
|
||||
console.log("Info: !clearchat: has Args");
|
||||
if(correctArgs(this.client))
|
||||
{
|
||||
console.log("Info: !clearchat: arround argument:",args);
|
||||
clear(null,false, args,this.client);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("Info: !clearchat: Ammount:",args);
|
||||
clear(args, false, null,this.client);
|
||||
}
|
||||
//Quais-quer eventuais problemas são tratados na função
|
||||
}
|
||||
else
|
||||
{
|
||||
//caso normal, apenas apaga tudo.
|
||||
clear(null, false,null,this.client);
|
||||
}
|
||||
}
|
||||
//verificar se é a sala bem vindo
|
||||
/**
|
||||
*
|
||||
* @param {Message} message
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function bemvindo(message){
|
||||
|
||||
if(message.channel.id==='434713876836122626')return true;
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {number} costumLimit
|
||||
* @param {boolean} bemvindo
|
||||
* @param {string} around
|
||||
* @param {Client} client
|
||||
* @returns {void}
|
||||
*/
|
||||
async function clear(costumLimit, bemvindo, around,client)
|
||||
{
|
||||
message.delete();
|
||||
let limit = costumLimit || 99;
|
||||
if (limit > 100) {
|
||||
limit = 100;
|
||||
}
|
||||
var filter = {};
|
||||
filter.limit = limit;
|
||||
if(bemvindo) filter.after = '436122906565804032'
|
||||
filter.around = around;
|
||||
const fetched = await message.channel.messages.fetch(filter);
|
||||
//console.log("Info: !clearchat: ",fetched)
|
||||
message.channel.bulkDelete(fetched, true)
|
||||
.then(()=>
|
||||
{
|
||||
console.log("Info: !clearchat", 'CostumLimit?:',limit?limit:'N/A', 'Bemvindo?:', bemvindo,'Around?:', around?around:'N/A');
|
||||
})
|
||||
.catch((err)=>
|
||||
{
|
||||
//console.log(err)
|
||||
new ErrorMessage(client).send(ErrorType.OldMessages,message, ['Messages are too old and powerfull!']);
|
||||
})
|
||||
}
|
||||
|
||||
//verificar se os argumentos estão corretos
|
||||
/**
|
||||
*
|
||||
* @param {Client} client
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function correctArgs(client){
|
||||
|
||||
if(message.content.split(' ').length >2) {
|
||||
new ErrorMessage(client).send(ErrorType.Arguments, message, ['Use just one ID.']);
|
||||
}else{
|
||||
var arg = parseInt(message.content.split(' ')[1], 10);
|
||||
var arglenght = message.content.split(' ')[1].split('').length;
|
||||
|
||||
|
||||
if(typeof arg == "number"){
|
||||
|
||||
if(arglenght == 18) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
new ErrorMessage(client).send(ErrorType.NoArguments, message, ['Messages are too old and powerfull!']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}}module.exports = clearchat;
|
@ -0,0 +1,66 @@
|
||||
|
||||
const {Command, Random} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, } = require('discord.js');
|
||||
|
||||
|
||||
class createchannel extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'createchannel',
|
||||
description: 'Creates a text based channel on the category the command was used.',
|
||||
aliases: ['channel'],
|
||||
needsAdmin:true,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
async run(message, args)
|
||||
{
|
||||
//Check admin privilege
|
||||
var name = args.join(' ');
|
||||
//log the creation of a new channel.
|
||||
console.log("Creating a new channel on server:",message.guild.name," with the name:",name);
|
||||
//Actually create the channel.
|
||||
message.guild.channels.create({
|
||||
name: name,
|
||||
type: ChannelType.GuildText,
|
||||
parent: message.guild.channels.cache.get(message.channelId).parentId
|
||||
}).then(()=>
|
||||
{
|
||||
sendMessage(name)
|
||||
})
|
||||
|
||||
//Send message confirming the creation of said new channel.
|
||||
|
||||
async function sendMessage(name){
|
||||
const randomID = Random()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xd31f1f)
|
||||
.setTitle('New channel created!')
|
||||
.setAuthor( {name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setDescription(`${name}`)
|
||||
.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setTimestamp()
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const filter = i => i.customId === randomID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}module.exports = createchannel;
|
@ -0,0 +1,83 @@
|
||||
|
||||
const {Command, Random} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, PermissionFlagsBits} = require('discord.js');
|
||||
|
||||
|
||||
class createchannel extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'createvoicechannel',
|
||||
description: 'Creates a voice based channel on the category the command was used.',
|
||||
aliases: ['voicechannel'],
|
||||
needsAdmin:true,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
// Check admin privilege
|
||||
|
||||
// Store the channel name and the parent channel ID in local variables
|
||||
const name = args.join(' ');
|
||||
const parentId = message.guild.channels.cache.get(message.channelId).parentId;
|
||||
|
||||
// Log the creation of a new channel
|
||||
console.log(`Creating a new channel on server: ${message.guild.name} with the name: ${name}`);
|
||||
|
||||
// Use Promise.all() to create the channel and send the message in parallel
|
||||
await Promise.all([
|
||||
message.guild.channels.create({
|
||||
name,
|
||||
type: ChannelType.GuildVoice,
|
||||
parent: parentId
|
||||
}),
|
||||
sendMessage(name)
|
||||
]);
|
||||
|
||||
// Define the sendMessage() function using the async/await syntax
|
||||
async function sendMessage(name) {
|
||||
const costumID = Random();
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xd31f1f)
|
||||
.setTitle('New voice channel created!')
|
||||
.setAuthor({
|
||||
name: "Rem-chan",
|
||||
iconURL: "https://i.imgur.com/g6FSNhL.png"
|
||||
})
|
||||
.setDescription(`${name}`)
|
||||
.setFooter({
|
||||
text: 'Rem-chan em ',
|
||||
iconURL: "https://i.imgur.com/g6FSNhL.png"
|
||||
})
|
||||
.setTimestamp();
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(costumID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
);
|
||||
|
||||
await message.channel.send({
|
||||
ephemeral: true,
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
});
|
||||
|
||||
const filter = i => i.customId === costumID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({
|
||||
filter,
|
||||
time: 60000
|
||||
});
|
||||
|
||||
collector.on('collect', async m => {
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}module.exports = createchannel;
|
@ -0,0 +1,16 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
class prune extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'deletechannel',
|
||||
aliases:['delchannel'],
|
||||
description: 'Deletes the channel it was used in.',
|
||||
needsAdmin:true,
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
return message.channel.delete()
|
||||
}
|
||||
}module.exports = prune;
|
@ -0,0 +1,60 @@
|
||||
const {Command, Random} = require('../../lib.js')
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
|
||||
class Guilds extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'guilds',
|
||||
group:'admin',
|
||||
memberName: 'guilds',
|
||||
description: 'Shows a list of guilds that are using Rem-chan.'
|
||||
|
||||
})
|
||||
this.client = client;
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const payload = {embeds:[]}
|
||||
var i = 0;
|
||||
for (const guild of this.client.guilds.cache)
|
||||
{
|
||||
if (!payload.embeds[Math.floor(i / 25)])
|
||||
{
|
||||
payload.embeds.push(
|
||||
new EmbedBuilder()
|
||||
.setTitle('Servers hosting Rem-chan:')
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setColor(0xd31f1f)
|
||||
.setFooter({text:'Rem-chan em ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setTimestamp()
|
||||
)
|
||||
}
|
||||
payload.embeds[Math.floor(i/25)].addFields({name:guild[1].name, value:'With '+guild[1].members.cache.size+' Members'})
|
||||
i++;
|
||||
}
|
||||
const costumID = Random();
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(costumID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
await message.channel.send({ephemeral: true, embeds: payload.embeds, components: [row] });
|
||||
const filter = i => i.customId === costumID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}module.exports = Guilds;
|
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
const {Command, ErrorMessage, ErrorType} = require('../../lib.js')
|
||||
|
||||
class kick extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'kick',
|
||||
group:'admin',
|
||||
memberName: 'kick',
|
||||
description: 'Kicks a member from the server.',
|
||||
needsAdmin:true,
|
||||
hidden:true,
|
||||
|
||||
})
|
||||
this.client = client;
|
||||
}
|
||||
async run(message, args){
|
||||
|
||||
const user = message.mentions.users.first();
|
||||
// Check if the user mentioned exists and is not a bot
|
||||
if (!user || user.bot) {
|
||||
return new ErrorMessage(this.client).send(ErrorType.Arguments, message, ['User is a bot, or you sent something wrong.'])
|
||||
}
|
||||
|
||||
// Kick the user
|
||||
try {
|
||||
await user.kick();
|
||||
return message.channel.send(`${user.tag} was kicked from the server.`);
|
||||
} catch (error) {
|
||||
return console.log(`Kick: An error occurred: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}module.exports = kick;
|
||||
|
@ -0,0 +1,22 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
class prune extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'prune',
|
||||
group:'admin',
|
||||
description: 'Rebuilds the channel it was used in.',
|
||||
needsAdmin:true,
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
//Check administration privilege
|
||||
|
||||
let name = message.channel.name;
|
||||
|
||||
message.channel.clone([name, true, "text"])
|
||||
|
||||
message.channel.delete();
|
||||
}
|
||||
}module.exports = prune;
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
Purge by servers
|
||||
Acept multiple servers
|
||||
|
||||
|
||||
Purge roleless members
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
class purge extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'purge',
|
||||
group:'admin',
|
||||
memberName: 'purge',
|
||||
description: 'Kicks everyone that matches has no roles on the server and is on the server for more than 10 days.',
|
||||
needsAdmin:true,
|
||||
hidden:false
|
||||
})
|
||||
this.client = client;
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
// Filter the guild members to only include those with 0 roles and a user age of at least 10 days
|
||||
// console.log(message.guild.members.cache)
|
||||
const now = Date.now();
|
||||
await message.guild.members.fetch()
|
||||
const members = message.guild.members.cache.filter(
|
||||
m => m._roles.length == 0 && now - m.joinedTimestamp >= 10 * 24 * 60 * 60 * 1000
|
||||
);
|
||||
// Use the for...of loop to iterate over the filtered members
|
||||
for (const member of members)
|
||||
{
|
||||
// Kick each member with 0 roles and a user age of at least 10 days
|
||||
const m = message.guild.members.cache.get(member[0]);
|
||||
if (!m) return console.log('Purge: Member not valid')
|
||||
m.kick('Optional reason that will be displayed in the audit logs')
|
||||
.then(() => console.log(`Successfully kicked ${m.user.username}`))
|
||||
.catch(err => console.log(`Unable to kick ${member[0]}: ${err}`));
|
||||
}
|
||||
console.log(`Prune: ${members.size} members with 0 roles and a user age of at least 10 days are going to be kicked.`)
|
||||
// Send a confirmation message
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x0099FF)
|
||||
.setTitle('Purging Users with no roles.')
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setDescription('Kicked Members')
|
||||
.addFields(
|
||||
{ name: 'Kicked', value:`${members.size} members with 0 roles and a user age of at least 10 days.` }
|
||||
)
|
||||
.setTimestamp()
|
||||
.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
const costumID = require('../../lib').Random();
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(costumID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const filter = i => i.customId === costumID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
}module.exports = purge;
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Purge by servers
|
||||
Acept multiple servers
|
||||
|
||||
|
||||
Purge roleless members?
|
||||
Purge inactive members?
|
||||
Purge specific role?
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const channelM = require('../../models/channels')
|
||||
|
||||
const {Command, } = require('../../lib.js');
|
||||
|
||||
|
||||
class purge extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'removerustcommitschannel',
|
||||
aliases: ['unsetrustcommits','urustc'],
|
||||
description: 'Removes a channel from the rust commits feed.',
|
||||
needsAdmin:true,
|
||||
hidden:true
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
if(args.length==0) return sendMessage(false, 'No arguments')
|
||||
if(!typeof args[0]=='string' && isNaN(parseInt(args[0])) && !args[0].length==19) return sendMessage(false, 'Incorrect Arguments')
|
||||
channelM.find({cID:args[0]}).then(channel=>
|
||||
{
|
||||
if(channel.length==0) return sendMessage(false, 'ID not on the list.')
|
||||
channelM.findOneAndRemove(channel.id, (err)=>
|
||||
{
|
||||
if(!err)
|
||||
{
|
||||
sendMessage(true)
|
||||
}
|
||||
})
|
||||
}).catch
|
||||
|
||||
async function sendMessage(success,error)
|
||||
{
|
||||
const embed = new EmbedBuilder();
|
||||
embed.setColor(0x27e33d);
|
||||
embed.setThumbnail('https://i.imgur.com/g6FSNhL.png');
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('RemoveUnsetRustCommitsChannel')
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
embed.addFields({name:success?'Removed':'Error', value:success?'Successfully removed from the list.':error})
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
|
||||
const filter = i => i.customId === 'RemoveUnsetRustCommitsChannel';
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete()
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}module.exports = purge;
|
@ -0,0 +1,88 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const channelM = require('../../models/channels');
|
||||
|
||||
class setfreegameschannel extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'setFreegamesChannel',
|
||||
aliases:['freegamesc','freec'],
|
||||
description: 'Sets the channel that will receive the free games/deals updates.',
|
||||
needsAdmin:true,
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
//Check admin privilege
|
||||
if(args.length>0)
|
||||
{
|
||||
if(typeof args[0]=='string' && !isNaN(parseInt(args[0])) && args[0].length>17)
|
||||
{
|
||||
var newName = message.guild.channels.cache.get(args[0]).name;
|
||||
addChannel(args[0], newName);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage(2);
|
||||
}
|
||||
|
||||
//Message sending function
|
||||
async function sendMessage(modifier, name)
|
||||
{
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'});
|
||||
embed.setColor(0x110809);
|
||||
embed.setTimestamp()
|
||||
switch (modifier) {
|
||||
case 0:
|
||||
embed.setTitle(`Channel ${name} defined.`)
|
||||
break;
|
||||
case 1:
|
||||
embed.setTitle('Error');
|
||||
embed.setDescription('You do not have the required permissions')
|
||||
break;
|
||||
case 2:
|
||||
embed.setTitle('Error');
|
||||
embed.setDescription('Verify the arguments used.')
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('RemoveRustCommitsNewChannelMessage')
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === 'RemoveRustCommitsNewChannelMessage';
|
||||
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete()
|
||||
});
|
||||
}
|
||||
function addChannel(id, name)
|
||||
{
|
||||
var channel = new channelM();
|
||||
channel.name = name;
|
||||
channel.cID = id;
|
||||
channel.for = 'freegames';
|
||||
channel.save(err=>
|
||||
{
|
||||
if(err)console.log(err);
|
||||
sendMessage(0, name);
|
||||
})
|
||||
}
|
||||
}
|
||||
}module.exports = setfreegameschannel;
|
@ -0,0 +1,108 @@
|
||||
const {Command, Random, ErrorMessage, ErrorType} = require('../../lib.js')
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const roleRuleM = require('../../models/autoRoleRule');
|
||||
class setrustcommitschannel extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'setrolerule',
|
||||
aliases:['rolerule','setrr'],
|
||||
description: 'Sets a auto role rule. Requires four arguments in the following order: MessageID; RoleID; Emoji. \n MessageID refers to the message where Rem will look for reactions and then set a role to a user.',
|
||||
needsAdmin:true,
|
||||
});
|
||||
this.client = client;
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
|
||||
// Validate the command arguments
|
||||
const validationResult = await this.confirmArgs(message, args);
|
||||
if (validationResult === 'Error') return new ErrorMessage(this.client).send(ErrorType.Arguments, message)
|
||||
// Create a new role rule object
|
||||
//check if a role rule with there is already a role rule like this in this guild
|
||||
// this is !roleID !roleEmoji !mID !roleEmoji
|
||||
var rule = new roleRuleM();
|
||||
rule.gID = message.guildId
|
||||
rule.mID = validationResult.mID;
|
||||
rule.roleID = validationResult.roleID;
|
||||
rule.roleEmoji = validationResult.roleEmoji;
|
||||
rule.roleName = validationResult.roleName;
|
||||
rule.save(err=>
|
||||
{
|
||||
if(err)console.log(err);
|
||||
})
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
const randomID = Random();
|
||||
embed.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'});
|
||||
embed.setColor(0x110809);
|
||||
embed.setTimestamp()
|
||||
embed.setTitle(`${rule.roleName}'s rule defined.`)
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === randomID;
|
||||
message.channel.send({embeds: [embed], components: [row] });
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
_delete(message, m);
|
||||
});
|
||||
collector.on('end', async m=>
|
||||
{
|
||||
_delete(message,m);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Map<String,String>} message
|
||||
* @param {Array<String>} args
|
||||
* @returns {RoleModel}
|
||||
*
|
||||
*/
|
||||
async confirmArgs(message,args)
|
||||
{
|
||||
if(args.length<3) return 'Error'
|
||||
var mID = args[0];
|
||||
var roleID = args[1];
|
||||
var roleEmoji = args[2].split(':')[2].split('>')[0];
|
||||
var roleName;
|
||||
var m = await (async ()=>
|
||||
{
|
||||
for(const [id, channel] of this.client.channels.cache)
|
||||
{
|
||||
if(channel.type == 0)
|
||||
{
|
||||
try {
|
||||
const exists = await this.client.channels.cache.get(id).messages.fetch(mID);
|
||||
if(exists) return m = true;
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
const r = message.guild.roles.cache.get(roleID);
|
||||
const e = message.guild.emojis.cache.get(roleEmoji);
|
||||
|
||||
if(!m || !r || !e) return 'Error'
|
||||
roleName = r.name;
|
||||
return {mID, roleID, roleEmoji, roleName}
|
||||
}
|
||||
|
||||
}module.exports = setrustcommitschannel;
|
||||
|
||||
function _delete(message, m)
|
||||
{
|
||||
try {
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
const {EmbedBuilder} = require('discord.js');
|
||||
|
||||
const {Command} = require('../../lib.js')
|
||||
const channelModel = require('../../models/channels');
|
||||
|
||||
class setcrackwatchchannel extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'setcrackwatchchannel',
|
||||
group:'admin',
|
||||
memberName: 'setcrackwatchchannel',
|
||||
hidden:true,
|
||||
//! Crack watch is broken Not about to do a reddit crawler for this BS
|
||||
description: 'Este comando irá usar o canal indicado para mostrar os updates do site crackwatch. É necessário voltar a usar este comando cada vez que o bot tem uma atialização.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
//start channel array var
|
||||
|
||||
//Check admin privilege
|
||||
if(args.length>0)
|
||||
{
|
||||
sendMessage(0, novo);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage(2);
|
||||
}
|
||||
//Message sending function
|
||||
function sendMessage(modifier,channel2)
|
||||
{
|
||||
const embed = new EmbedBuilder
|
||||
embed.setFooter('Rem-chan em ', "https://i.imgur.com/g6FSNhL.png")
|
||||
embed.setAuthor("Rem-chan", "https://i.imgur.com/g6FSNhL.png")
|
||||
embed.setColor(0x11080981) // Alterar a cor
|
||||
embed.setTimestamp()
|
||||
switch (modifier) {
|
||||
case 0:
|
||||
embed.setTitle('Canal definido')
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 1:
|
||||
embed.setTitle('Erro');
|
||||
embed.setDescription('Não tem as permissões necessárias.')
|
||||
break;
|
||||
case 2:
|
||||
embed.setTitle('Erro');
|
||||
embed.setDescription('Verifique os parametros utilizados.')
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
message.channel.send({embed});
|
||||
}
|
||||
}
|
||||
}module.exports = setcrackwatchchannel;
|
@ -0,0 +1,63 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const channelM = require('../../models/channels');
|
||||
|
||||
class setrustcommitschannel extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'setrustcommitschannel',
|
||||
aliases:['rustcommits','rustc'],
|
||||
description: 'Sets the channel that will receive the rust commits.',
|
||||
needsAdmin:true,
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
//Check admin privilege
|
||||
if(args.length>0) return sendMessage(2);
|
||||
if(typeof args[0]=='string' && !isNaN(parseInt(args[0])) && args[0].length>17) return sendMessage(2);
|
||||
var newName = message.guild.channels.cache.get(args[0]).name;
|
||||
addChannel(args[0], newName);
|
||||
|
||||
//Message sending function
|
||||
async function sendMessage(modifier, name)
|
||||
{
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'});
|
||||
embed.setColor(0x110809);
|
||||
embed.setTimestamp()
|
||||
embed.setTitle(`Channel ${name} defined.`)
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('RemoveRustCommitsNewChannelMessage')
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === 'RemoveRustCommitsNewChannelMessage';
|
||||
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete()
|
||||
});
|
||||
}
|
||||
function addChannel(id, name)
|
||||
{
|
||||
var channel = new channelM();
|
||||
channel.name = name;
|
||||
channel.cID = id;
|
||||
channel.for = 'rust';
|
||||
channel.save(err=>
|
||||
{
|
||||
if(err)console.log(err);
|
||||
sendMessage(0, name);
|
||||
})
|
||||
}
|
||||
}
|
||||
}module.exports = setrustcommitschannel;
|
@ -0,0 +1,81 @@
|
||||
|
||||
|
||||
const {Command,ErrorMessage, ErrorType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('../../lib.js')
|
||||
const strikeM = require('../../models/strikes');
|
||||
|
||||
class strike extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'strike',
|
||||
group:'admin',
|
||||
description: 'Strikes an user. Usage !strike @USER REASON',
|
||||
needsAdmin:true,
|
||||
})
|
||||
this.client = client;
|
||||
this.message;
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
//Check admin privilege
|
||||
this.message = message;
|
||||
var confirm = await this.confirmArgs(message,args);
|
||||
if(confirm=='Error') return new ErrorMessage(this.client).send(ErrorType.Arguments, message, ['Use the mention method to pass the user.', 'Make sure you provide a reason.'])
|
||||
var strike = new strikeM();
|
||||
strike.strikerID = confirm.strikerID;
|
||||
strike.strokedID = confirm.strokedID;
|
||||
strike.guildName = message.guild.name;
|
||||
strike.guildID = message.guild.id
|
||||
strike.reason = confirm.reason;
|
||||
strike.date = Date.now();
|
||||
strike.save(err=>
|
||||
{
|
||||
if(err)console.log(err);
|
||||
this.sendMessage(confirm.strokedID,confirm.reason);
|
||||
message.delete();
|
||||
})
|
||||
}
|
||||
async sendMessage(strokedID, reason)
|
||||
{
|
||||
let name = this.client.guilds.cache.get(this.message.guildId).members.cache.get(strokedID);
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'});
|
||||
embed.setColor(0x110809);
|
||||
embed.setTimestamp()
|
||||
embed.setTitle(`Strike`)
|
||||
embed.setDescription(`${name} has been struck.`)
|
||||
embed.addFields({name:'Reason:', value:reason})
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('RemoveStrikeMessage')
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === 'RemoveStrikeMessage';
|
||||
|
||||
await this.message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const collector = this.message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
m.message.delete()
|
||||
.then(()=>
|
||||
{
|
||||
// console.log('Strikes: Embed Message: Deleted');
|
||||
})
|
||||
.catch(()=>
|
||||
{
|
||||
// console.log('Strikes: Embed Message: failed to delete.');
|
||||
})
|
||||
});
|
||||
}
|
||||
async confirmArgs(message,args)
|
||||
{
|
||||
if(args.length<2) return 'Error'
|
||||
if(!args[0].split('@')) return 'Error'
|
||||
let strikerID = message.author.id;
|
||||
let strokedID = args[0].split('@')[1].split('>')[0];
|
||||
return {strikerID, strokedID, reason:args.splice(-1,1).join(' ')}
|
||||
}
|
||||
}module.exports = strike;
|
@ -0,0 +1,33 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const {EmbedBuilder } = require('discord.js');
|
||||
|
||||
class coinflip extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'coinflip',
|
||||
description: 'Flips a coin.'
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var rand = 1 + Math.floor(Math.random() * 100);
|
||||
var title;
|
||||
var url;
|
||||
if (rand > 50) {
|
||||
url = 'https://cdn.ram.moe/HJSEfDUbl.gif';
|
||||
title = 'Tails';
|
||||
} else {
|
||||
url = 'https://cdn.ram.moe/Byu2fPLWg.png';
|
||||
title = 'Heads';
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x0099FF)
|
||||
.setTitle(title)
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setThumbnail(url)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' });
|
||||
message.channel.send({embeds:[embed]})
|
||||
}
|
||||
|
||||
}module.exports = coinflip;
|
@ -0,0 +1,19 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
|
||||
class diceroll extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'roll',
|
||||
aliases:['diceroll'],
|
||||
description: 'Rolls an icosahedral dice. (d20).'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var roll = Math.floor(Math.random()*20)+1;
|
||||
message.channel.send('Face shows the number:'+ roll);
|
||||
}
|
||||
}
|
||||
module.exports = diceroll;
|
@ -0,0 +1,26 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
module.exports = class report extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'certificate',
|
||||
group:'image',
|
||||
memberName: 'certificate',
|
||||
description: 'Coninhas certificate.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
|
||||
const embed = new EmbedBuilder;
|
||||
embed.setColor(0xeb7d00);
|
||||
embed.setTitle('Pode recolher o seu certificado na loja do cidadão mais proxima.')
|
||||
embed.setImage(`https://media.discordapp.net/attachments/662397316744871937/960689544003481600/unknown.png?width=912&height=701`);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
const axios = require('axios');
|
||||
class cry extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'cry',
|
||||
description: 'Publishes an images of the theme: cry.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
var cmd = 'cry';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
|
||||
}
|
||||
}module.exports = cry;
|
@ -0,0 +1,31 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
class cuddle extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'cuddle',
|
||||
group:'image',
|
||||
memberName: 'cuddle',
|
||||
description: 'Publishes an image of the theme: cuddle.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'cuddle';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = cuddle;
|
@ -0,0 +1,32 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
class hug extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'hug',
|
||||
group:'image',
|
||||
memberName: 'hug',
|
||||
description: 'Publishes an image of the theme: hug.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'hug';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
}
|
||||
}module.exports = hug;
|
@ -0,0 +1,32 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
class kiss extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'kiss',
|
||||
group:'image',
|
||||
memberName: 'kiss',
|
||||
description: 'Publishes an image of the theme: kiss.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'kiss';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
}
|
||||
}module.exports = kiss;
|
@ -0,0 +1,33 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
class lewd extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'lewd',
|
||||
group:'image',
|
||||
memberName: 'lewd',
|
||||
description: 'Publishes an image of the theme: lewd'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'lewd';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = lewd;
|
@ -0,0 +1,34 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class lick extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'lick',
|
||||
group:'image',
|
||||
memberName: 'lick',
|
||||
description: 'Publishes an images of the theme: lick.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'lick';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = lick;
|
@ -0,0 +1,33 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class owo extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'owo',
|
||||
group:'image',
|
||||
memberName: 'owo',
|
||||
description: 'Publishes an images of the theme: OwO.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'owo';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = owo;
|
@ -0,0 +1,34 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class pat extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'pat',
|
||||
group:'image',
|
||||
memberName: 'pat',
|
||||
description: 'Publishes an images of the theme: pat.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'pat';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = pat;
|
@ -0,0 +1,34 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class pout extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'pout',
|
||||
group:'image',
|
||||
memberName: 'pout',
|
||||
description: 'Publishes an images of the theme: pout.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'pout';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = pout;
|
@ -0,0 +1,36 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class rem extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'rem',
|
||||
group:'image',
|
||||
memberName: 'rem',
|
||||
description: 'Publishes an images of the theme: Our only waifu REM.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": "rem"}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = rem;
|
@ -0,0 +1,27 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
module.exports = class report extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'report',
|
||||
group:'image',
|
||||
memberName: 'report',
|
||||
description: 'Coninhas Report.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
|
||||
const embed = new EmbedBuilder;
|
||||
embed.setColor(0xeb7d00);
|
||||
embed.setTitle('É favor preencher:')
|
||||
embed.setImage(`https://cdn.discordapp.com/attachments/662397316744871937/852352291428499456/64327307_2251125638288816_7660501929683845120_n.jpg`);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class slap extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'slap',
|
||||
group:'image',
|
||||
memberName: 'slap',
|
||||
description: 'PPublishes an images of the theme: slap.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'slap';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = slap;
|
@ -0,0 +1,35 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class smug extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'smug',
|
||||
group:'image',
|
||||
memberName: 'smug',
|
||||
description: 'Publishes an images of the theme: smug.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'smug';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = smug;
|
@ -0,0 +1,35 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class stare extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'stare',
|
||||
group:'image',
|
||||
memberName: 'stare',
|
||||
description: 'Publishes an images of the theme: stare.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'stare';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
}
|
||||
}module.exports = stare;
|
@ -0,0 +1,35 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
;
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class tickle extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'tickle',
|
||||
group:'image',
|
||||
memberName: 'tickle',
|
||||
description: 'Publishes an images of the theme: tickle.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'tickle';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
|
||||
}
|
||||
}module.exports = tickle;
|
@ -0,0 +1,35 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const axios = require('axios')
|
||||
const {EmbedBuilder} = require('discord.js')
|
||||
|
||||
class triggered extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'triggered',
|
||||
group:'image',
|
||||
memberName: 'triggered',
|
||||
description: 'Publishes an images of the theme: TRIGGERED!'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
var cmd = 'triggered';
|
||||
var res = await axios.get('https://rra.ram.moe/i/r', {params: {"type": cmd}});
|
||||
var path = res.data.path.replace('/i/', '');
|
||||
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor(0xb50000);
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
embed.setTitle('Imagem:')
|
||||
embed.setImage(`https://cdn.ram.moe/${path}`);
|
||||
embed.setFooter({text:'Rem-chan em ', iconUrl:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setTimestamp();
|
||||
|
||||
|
||||
message.channel.send({embeds: [embed]});
|
||||
|
||||
|
||||
}
|
||||
}module.exports = triggered;
|
@ -0,0 +1,57 @@
|
||||
const {Command, Random} = require('../../lib.js');
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const guildsM = require('../../models/guilds.js');
|
||||
|
||||
module.exports = class leave extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'activateMusic',
|
||||
group:'music',
|
||||
aliases: ['music','amusic'],
|
||||
description: 'Activates music for the guild. Can be called again to disable.',
|
||||
needsAdmin:true
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
const guild = message.guild.id
|
||||
guildsM.findOne({gID:guild}).then(g=>
|
||||
{
|
||||
g.music =!g.music;
|
||||
guildsM.updateOne({gID:guild}, g,{upsert:true}).then(updatedG=>
|
||||
{
|
||||
sendMessage(g.music);
|
||||
})
|
||||
})
|
||||
async function sendMessage(active){
|
||||
console.log(active?'Activate Music: -':'Disable Music: -', Author.username, 'on guild:', guild);
|
||||
const randomID = Random()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xd31f1f)
|
||||
.setTitle(active?'Music activated!':'Music disabled!')
|
||||
.setAuthor( {name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.setTimestamp()
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const filter = i => i.customId === randomID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const mCommandModel = require('../../models/mcommands');
|
||||
const {ChannelType} = require('discord.js');
|
||||
module.exports = class leave extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'leave',
|
||||
group:'music',
|
||||
memberName: 'leave',
|
||||
description: 'Leaves the voice channel you currently are in.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
console.log('Leave: -', Author.username);
|
||||
const guild = message.guild.id
|
||||
const channel = message.channel.id
|
||||
const voice = message.member.voice.channel.id;
|
||||
const {ChannelType} = require('discord.js');
|
||||
if(message.guild.channels.cache.some(channel =>(channel.type == ChannelType.GuildText && channel.members.has('356104008366030863')&& channel.members.has(Author.id))))
|
||||
{
|
||||
addToDB('leave', guild, channel,voice);
|
||||
message.guild.voiceStates.cache.get('356104008366030863').disconnect()
|
||||
message.delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
message.reply('Rem isn`t in voice channel!')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function addToDB(Command, guild, channel, voice)
|
||||
{
|
||||
var command = new mCommandModel();
|
||||
command.command = Command;
|
||||
command.guild = guild;
|
||||
command.textchannel = channel;
|
||||
command.voice = voice;
|
||||
command.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
console.log(Command, '- added to DB')
|
||||
})
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const mCommandModel = require('../../models/mcommands');
|
||||
|
||||
|
||||
|
||||
module.exports = class skip extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'pause',
|
||||
group:'music',
|
||||
memberName: 'pause',
|
||||
description: 'Pauses the currently playing music'
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
console.log('Pause: -', Author.username)
|
||||
const guild = message.guild.id
|
||||
const channel = message.channel.id
|
||||
const voice = message.member.voice.channel.id;
|
||||
const {ChannelType} = require('discord.js');
|
||||
if(message.guild.channels.cache.some(channel =>(channel.type == ChannelType.GuildText && channel.members.has('356104008366030863')&& channel.members.has(Author.id))))
|
||||
{
|
||||
addToDB('pause', guild, channel,voice);
|
||||
|
||||
message.delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
message.reply('Not in voice channel!')
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
function addToDB(Command, guild, channel, voice)
|
||||
{
|
||||
var command = new mCommandModel();
|
||||
command.command = Command;
|
||||
command.guild = guild;
|
||||
command.textchannel = channel;
|
||||
command.voice = voice;
|
||||
command.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
console.log(Command, '- added to DB')
|
||||
})
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
const {Command, Random} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder,ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
const yts = require('yt-search');
|
||||
const QueueM = require('../../models/queue');
|
||||
|
||||
module.exports = class play extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'play',
|
||||
group:'music',
|
||||
memberName: 'play',
|
||||
description: 'Plays on the voice channel you currently are in. Supports youtube search and links.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const {voice} = message.member;
|
||||
const guild = message.channel.guild.id;
|
||||
var content = message.content;
|
||||
const channel = message.channel.id;
|
||||
const Author = message.author;
|
||||
|
||||
try
|
||||
{
|
||||
if(!voice.channel)
|
||||
{
|
||||
console.log('Play: Err: Not currently in a voice channel.')
|
||||
message.reply('Not currently in a voice channel.')
|
||||
return
|
||||
}
|
||||
else
|
||||
{
|
||||
if(content.includes('https')||content.includes('www'))//LINK
|
||||
{
|
||||
console.log('Play: -', Author.username,'Queued this link:',content.split('!play')[1],'on',message.channel.guild.name,"'s", message.channel.name)
|
||||
|
||||
if(content.includes('youtube') || content.includes('youtu.be'))//YT LINK
|
||||
{
|
||||
console.time('SearchL')
|
||||
if(!isPlayList(content))
|
||||
{
|
||||
content = content.split('&time=')?content.split('&time=')[0]:content;
|
||||
content = content.split('&ab_channel=')?content.split('&ab_channel=')[0]:content;
|
||||
const r = await yts( content.split('!play ')[1] )
|
||||
console.timeEnd('SearchL')
|
||||
addToQ(r.videos[0]);
|
||||
message.delete()
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var listID
|
||||
if(content.split('&list=')[1].includes('&'))
|
||||
{
|
||||
listID = content.split('&list=')[1].split('&')[0]
|
||||
}
|
||||
else listID = content.split('&list=')[1]
|
||||
console.log('Play: List: ListID:',listID)
|
||||
const list = await yts({listId:listID})
|
||||
list.videos.forEach(video=>
|
||||
{
|
||||
//console.log('Teste: PlayList: ForEach(video): video:', video)
|
||||
addToQ(video)
|
||||
})
|
||||
message.delete();
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
console.log('Play: List: Error:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
else //GET OUTTA HERE
|
||||
{
|
||||
message.channel.send('Either use a link from youtube or try searching by keywords.')
|
||||
}
|
||||
}
|
||||
else//search
|
||||
{
|
||||
console.log('Play: Searching for:', content.split('!play')[1])
|
||||
const r = await yts(content.split('!play ')[1])
|
||||
const videos = r.videos.slice( 0, 3)
|
||||
const embed = new EmbedBuilder();
|
||||
embed.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
embed.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'});
|
||||
embed.setTimestamp();
|
||||
embed.setColor(0xb50000);
|
||||
embed.setTitle('Searching for:'+ args.join(' '))
|
||||
embed.setImage(videos[0].thumbnail)
|
||||
const row = new ActionRowBuilder();
|
||||
const randomID = Random();
|
||||
videos.forEach( function ( v , i) {
|
||||
//console.log('Search:', v)
|
||||
const views = String( v.views ).padStart( 10, ' ' )
|
||||
embed.addFields( {name:`[ ${i} ] - ${ v.title }`,value:`${ v.author.name } | (${v.timestamp }) | ${ views } views`} )
|
||||
row.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`${randomID}PlayUserChoice${i}`)
|
||||
.setLabel(` ${i} `)
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
} )
|
||||
embed.addFields({name:'Cancel', value:'Press X'});
|
||||
row.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`${randomID}PlayUserChoice`)
|
||||
.setLabel(` X `)
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
);
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
|
||||
const filter = i => i.customId.startsWith(`${randomID}PlayUserChoice`);
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
// console.log(m)
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
if(m.customId != 'PlayUserChoice')
|
||||
{
|
||||
addToQ(videos[parseInt(m.customId.split(`${randomID}PlayUserChoice`)[1])])
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isPlayList(content)
|
||||
{
|
||||
if(content.includes('&list='))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
function addToQ(video)
|
||||
{
|
||||
|
||||
var queueItem = new QueueM();
|
||||
queueItem.songname = video.title;
|
||||
queueItem.songtime = video.seconds||video.duration.seconds;
|
||||
queueItem.songURL = video.url||'https://youtube.com/watch?v='+video.videoId
|
||||
queueItem.guild = guild;
|
||||
queueItem.textchannel = channel;
|
||||
queueItem.voice = voice.channel.id;
|
||||
queueItem.requester = Author.username;
|
||||
queueItem.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
//console.log('Play: Search: Item added to queue:', queueItem)
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Play: Error:', error);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
const mCommandModel = require('../../models/mcommands');
|
||||
|
||||
|
||||
module.exports = class leave extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'queue',
|
||||
group:'music',
|
||||
memberName: 'queue',
|
||||
description: 'Shows the queue for the current server.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
console.log('Queue: -', Author.username);
|
||||
const guild = message.guild.id
|
||||
const channel = message.channel.id
|
||||
const voice = message.member.voice.channel.id;
|
||||
const {ChannelType} = require('discord.js');
|
||||
if(message.guild.channels.cache.some(channel =>(channel.type == ChannelType.GuildText && channel.members.has('356104008366030863')&& channel.members.has(Author.id))))
|
||||
{
|
||||
addToDB('queue', guild, channel,voice);
|
||||
|
||||
message.delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
message.reply('Rem isn`t in a voice channel!')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function addToDB(Command, guild, channel, voice)
|
||||
{
|
||||
var command = new mCommandModel();
|
||||
command.command = Command;
|
||||
command.guild = guild;
|
||||
command.textchannel = channel;
|
||||
command.voice = voice;
|
||||
command.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
console.log(Command, '- added to DB')
|
||||
})
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const mCommandModel = require('../../models/mcommands');
|
||||
|
||||
|
||||
module.exports = class resume extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'resume',
|
||||
group:'music',
|
||||
memberName: 'resume',
|
||||
description: 'Resumes the currently playing music'
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
console.log('Resume: -', Author.username);
|
||||
const guild = message.guild.id
|
||||
const channel = message.channel.id
|
||||
const voice = message.member.voice.channel.id;
|
||||
const {ChannelType} = require('discord.js');
|
||||
if(message.guild.channels.cache.some(channel =>(channel.type == ChannelType.GuildText && channel.members.has('356104008366030863')&& channel.members.has(Author.id))))
|
||||
{
|
||||
addToDB('leave', guild, channel,voice);
|
||||
|
||||
message.delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
message.reply('Not in voice channel!')
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
function addToDB(Command, guild, channel, voice)
|
||||
{
|
||||
var command = new mCommandModel();
|
||||
command.command = Command;
|
||||
command.guild = guild;
|
||||
command.textchannel = channel;
|
||||
command.voice = voice;
|
||||
command.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
console.log(Command, '- added to DB')
|
||||
})
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
|
||||
const mCommandModel = require('../../models/mcommands');
|
||||
|
||||
module.exports = class skip extends Command
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
super(client, {
|
||||
name: 'skip',
|
||||
group:'music',
|
||||
memberName: 'skip',
|
||||
description: 'Skips the currently playing music'
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const Author = message.author
|
||||
console.log('Skip: -', Author.username);
|
||||
const guild = message.guild.id
|
||||
const channel = message.channel.id
|
||||
const voice = message.member.voice.channel.id;
|
||||
const {ChannelType} = require('discord.js');
|
||||
if(message.guild.channels.cache.some(channel =>(channel.type == ChannelType.GuildText && channel.members.has('356104008366030863')&& channel.members.has(Author.id))))
|
||||
{
|
||||
addToDB('skip', guild, channel,voice);
|
||||
|
||||
message.delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
message.reply('Not in voice channel!')
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
function addToDB(Command, guild, channel, voice)
|
||||
{
|
||||
var command = new mCommandModel();
|
||||
command.command = Command;
|
||||
command.guild = guild;
|
||||
command.textchannel = channel;
|
||||
command.voice = voice;
|
||||
command.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
console.log(Command, '- added to DB')
|
||||
})
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
|
||||
class say extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'say',
|
||||
group:'random',
|
||||
memberName: 'say',
|
||||
description: 'Rem-chan will send a message that you define.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
//say on channel
|
||||
console.log("Say: -",message.author.username,"- on: ",message.guild.name,"'s ",message.channel.name.toLowerCase(),":",args.join(' '))
|
||||
message.delete();
|
||||
message.channel.send(args.join(' '));
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = say;
|
@ -0,0 +1,39 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
const suggestionM = require('../../models/suggestion.js');
|
||||
|
||||
|
||||
class suggest extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'suggest',
|
||||
memberName: 'suggest',
|
||||
aliases: ['suggestion'],
|
||||
description: `You can suggest a command. Use the following format: !suggest COMMANDNAME ARGUMENTS -> ACTION `
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
console.log('Suggestion:', message.author.username, 'suggested', args);
|
||||
if(args.length>0)
|
||||
{
|
||||
var suggestion = new suggestionM();
|
||||
suggestion.authorID = message.author.id;
|
||||
suggestion.authorName = message.author.username;
|
||||
suggestion.authorPermissions = message.member.permissions.toArray();
|
||||
suggestion.guildID = message.guildId;
|
||||
suggestion.suggestion = message.content;
|
||||
suggestion.save(err=>
|
||||
{
|
||||
if(err)console.error(err)
|
||||
message.channel.send(`${message.author} your suggestion has been saved for future consideration, thank you.`);
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
message.channel.send(`${message.author} sent an empty suggestion. Use the command correctly by following the format: !suggest COMMANDNAME ARGUMENTS -> ACTION`);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = suggest;
|
@ -0,0 +1,21 @@
|
||||
const {Command} = require('../../lib.js')
|
||||
|
||||
|
||||
|
||||
class tableflip extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'tableflip',
|
||||
group:'random',
|
||||
memberName: 'tableflip',
|
||||
description: 'Flips a table.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
message.channel.send('(╯°□°)╯︵ ┻━┻');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = tableflip;
|
@ -0,0 +1,52 @@
|
||||
const {Command, aniList, Random} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
|
||||
|
||||
|
||||
class anime extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'anime',
|
||||
group:'pesquisa',
|
||||
memberName: 'anime',
|
||||
description: 'Shows info about a anime.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args){
|
||||
const data = await new aniList().searchAnime(args.join(' '));
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${data.title.romaji} (${data.title.native} / ${data.title.english})`)
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setColor(0x003284)
|
||||
.setDescription(data.description.replaceAll('<br>',' '))
|
||||
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
|
||||
.setImage(data.coverImage)
|
||||
.setThumbnail(data.coverImage)
|
||||
.setTimestamp()
|
||||
.addFields(
|
||||
{name:'Status:', value:data.status, inline:true},
|
||||
{name:'Episodes:', value:data.episodes.toString(), inline:true},
|
||||
{name:'Trailer:', value:data.trailer?(data.trailer.site=='yotube'?`https://www.youtube.com/watch?v=${data.trailer.id}`:`https://www.dailymotion.com/video/${data.trailer.id}`):'N/A'});
|
||||
const randomID = Random();
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === randomID;
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
|
||||
}module.exports = anime;
|
||||
|
@ -0,0 +1,50 @@
|
||||
const {Command, aniList, Random} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
|
||||
|
||||
class char extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'char',
|
||||
group:'pesquisa',
|
||||
memberName: 'char',
|
||||
description: 'Shows info about a character.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const data = await new aniList().searchChar(args.join(' '));
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${data.name.full} (${data.name.native})`)
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setColor(0x003284)
|
||||
.setDescription(data.description)//.split('~! ')[1].replaceAll('<br>', ' ').substring(0, 1500) + "...")
|
||||
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
|
||||
.setImage(data.image)
|
||||
.setThumbnail(data.image)
|
||||
.setTimestamp()
|
||||
.addFields(
|
||||
{name:'Gender:', value:data.gender, inline:true});
|
||||
const randomID = Random();
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === randomID;
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}module.exports = char;
|
@ -0,0 +1,45 @@
|
||||
const {Command, aniList, Random} = require('../../lib.js')
|
||||
|
||||
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
||||
|
||||
|
||||
class manga extends Command{
|
||||
constructor(client){
|
||||
super(client, {
|
||||
name: 'manga',
|
||||
group:'pesquisa',
|
||||
memberName: 'manga',
|
||||
description: 'Shows info about a manga.'
|
||||
|
||||
})
|
||||
}
|
||||
async run(message, args)
|
||||
{
|
||||
const data = await new aniList().searchManga(args.join(' '));
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${data.title.romaji} (${data.title.native} / ${data.title.english})`)
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setColor(0x003284)
|
||||
.setDescription(data.description)//.replaceAll('<br>', ' ').substring(0, 1500) + "...")
|
||||
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
|
||||
.setImage(data.coverImage)
|
||||
.setThumbnail(data.coverImage)
|
||||
.setTimestamp()
|
||||
const randomID = Random();
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
const filter = i => i.customId === randomID;
|
||||
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete();
|
||||
m.message.delete();
|
||||
});
|
||||
}
|
||||
}module.exports = manga;
|
@ -0,0 +1,7 @@
|
||||
exports.get = (io)=>
|
||||
{
|
||||
return(req,res)=>
|
||||
{
|
||||
res.render('addtodiscord')
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
exports.home = (io)=>
|
||||
{
|
||||
return(req,res)=>
|
||||
{
|
||||
res.render('home')
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
export function get(io: any): (req: any, res: any) => void;
|
||||
//# sourceMappingURL=bot.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../controller/bot.js"],"names":[],"mappings":"AAAc,2DAMb"}
|
@ -0,0 +1,2 @@
|
||||
export function home(io: any): (req: any, res: any) => void;
|
||||
//# sourceMappingURL=home.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../controller/home.js"],"names":[],"mappings":"AAAe,4DAMd"}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../models/channels.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBqB,qDAGpB"}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"version":3,"file":"mcommands.d.ts","sourceRoot":"","sources":["../../models/mcommands.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBqB,qDAGpB"}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../models/queue.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBqB,qDAGpB"}
|
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=musicWorker.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"musicWorker.d.ts","sourceRoot":"","sources":["../musicWorker.js"],"names":[],"mappings":""}
|
@ -0,0 +1,3 @@
|
||||
declare function _exports(io: any): any;
|
||||
export = _exports;
|
||||
//# sourceMappingURL=routes.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../routes/routes.js"],"names":[],"mappings":"AAGiB,wCAKhB"}
|
@ -0,0 +1 @@
|
||||
//# sourceMappingURL=rustCommitsWorker.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"rustCommitsWorker.d.ts","sourceRoot":"","sources":["../rustCommitsWorker.js"],"names":[],"mappings":""}
|
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=server.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.js"],"names":[],"mappings":""}
|
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=test.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../test.js"],"names":[],"mappings":""}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6"
|
||||
},
|
||||
"exclude": ["node_modules", "**/node_modules/*", "**/dist/**"]
|
||||
}
|
@ -0,0 +1,880 @@
|
||||
const path = require('path');
|
||||
const find = require('findit');
|
||||
const {Client,ClientOptions,GatewayIntentBits,Message, Partials, ActivityType,EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js')
|
||||
const roleRulesM = require('./models/autoRoleRule');
|
||||
module.exports.GatewayIntentBits = GatewayIntentBits;
|
||||
module.exports.Partials = Partials;
|
||||
module.exports.ActivityType = ActivityType;
|
||||
module.exports.EmbedBuilder = EmbedBuilder;
|
||||
module.exports.ActionRowBuilder = ActionRowBuilder;
|
||||
module.exports.ButtonBuilder = ButtonBuilder;
|
||||
module.exports.ButtonStyle = ButtonStyle;
|
||||
module.exports.Message = Message;
|
||||
|
||||
//@ts-check
|
||||
class CommandOptions
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String[]} aliases
|
||||
* @param {String} description
|
||||
* @param {Boolean} needsAdmin
|
||||
* @param {Boolean} hidden
|
||||
*/
|
||||
constructor (name, aliases, description, needsAdmin, hidden)
|
||||
{
|
||||
this.name = name;
|
||||
this.aliases = aliases;
|
||||
this.description = description;
|
||||
this.needsAdmin = needsAdmin;
|
||||
this.hidden = hidden;
|
||||
}
|
||||
}
|
||||
class command
|
||||
{
|
||||
/**
|
||||
* @param {_Client} client extends discord.js.Client
|
||||
* @param {CommandOptions} options extends Lib.Options
|
||||
*/
|
||||
constructor(client, options)
|
||||
{
|
||||
this.name = options.name;
|
||||
this.aliases = options.aliases;
|
||||
this.description = options.description;
|
||||
this.needsAdmin =options.needsAdmin;
|
||||
this.hidden = options.hidden;
|
||||
this.client = client;
|
||||
}
|
||||
}module.exports.Command = command;
|
||||
|
||||
// const {func}=require('lib.d.ts');
|
||||
// func('string');
|
||||
|
||||
class _Client extends Client
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {ClientOptions} options
|
||||
*/
|
||||
commands = new Map();
|
||||
constructor(options)
|
||||
{
|
||||
super(options)
|
||||
let finder = find(path.resolve('commands'));
|
||||
finder.on('file', file=>
|
||||
{
|
||||
let command = require(file);
|
||||
if(typeof command === 'function')
|
||||
{
|
||||
let c = new command(this);
|
||||
this.commands.set(c.name,{
|
||||
needsAdmin: c.needsAdmin?c.needsAdmin:false,
|
||||
command: command,
|
||||
});
|
||||
if(c.aliases)
|
||||
{
|
||||
for(var i =0; i<c.aliases.length+1; i++)
|
||||
{
|
||||
this.commands.set(c.aliases[i],{
|
||||
needsAdmin: c.needsAdmin,
|
||||
command: command,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
finder.on('end', ()=>
|
||||
{
|
||||
this.enableCommands();
|
||||
})
|
||||
this.RoleSetter();
|
||||
this.rustCommits = new rustCommits(this);
|
||||
this.freegames = new FreeGames(this);
|
||||
this.strikes = new Strikes(this);
|
||||
this.on('disconnect', (event) => {
|
||||
// Log a message to the console
|
||||
console.log(`Client disconnected: ${event.reason}`);
|
||||
});
|
||||
|
||||
// Register an event listener for the 'reconnecting' event
|
||||
this.on('reconnecting', () => {
|
||||
// Log a message to the console
|
||||
console.log('Client is reconnecting...');
|
||||
});
|
||||
|
||||
}
|
||||
/**
|
||||
* Register a group of commands under the folder commands
|
||||
* @param {String} name - Name of the group.
|
||||
* @param {String} folderName - Name of the folder.
|
||||
*/
|
||||
async enableCommands()
|
||||
{
|
||||
//use needs admin here!!!!
|
||||
this.on("messageCreate", message=>
|
||||
{
|
||||
if(message.content.startsWith('!'))
|
||||
{
|
||||
let commandName=message.content.split('!')[1].split(' ')[0];
|
||||
let args = message.content.split(`!${commandName}`)[1].split(' ');
|
||||
args = args.filter(n=>n);
|
||||
if(this.commands.get(commandName))
|
||||
{
|
||||
let needsAdmin = this.commands.get(commandName).needsAdmin;
|
||||
let isAdmin = this.guilds.cache.get(message.guild.id).members.cache.get(message.author.id).permissions.has('ADMINISTRATOR');
|
||||
let command = this.commands.get(commandName).command
|
||||
if((needsAdmin && isAdmin) || !needsAdmin) return new command(this).run(message, args);
|
||||
}
|
||||
new ErrorMessage(this).send(ErrorType.NotOnTheList,message)
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {String} name - Command Name
|
||||
* @returns {command}
|
||||
*/
|
||||
async RoleSetter ()
|
||||
{
|
||||
this.on('messageReactionAdd', (reaction, user)=>
|
||||
{
|
||||
(async ()=>
|
||||
{
|
||||
const rule = await roleRulesM.findOne({mID:reaction.message.id,roleEmoji:reaction._emoji.id}).then(rule =>{return rule}).catch(err=>{return null})
|
||||
if(rule)
|
||||
{
|
||||
console.log(`RoleAssignment: Guild:${this.guilds.cache.get(rule.gID)} Role ${rule.roleName} given to ${user.username}`)
|
||||
this.channels.cache.get(reaction.message.channelId).members.get(user.id).roles.add(rule.roleID)
|
||||
}
|
||||
})()
|
||||
})
|
||||
this.on('messageReactionRemove', (reaction, user)=>
|
||||
{
|
||||
(async ()=>
|
||||
{
|
||||
const rule = await roleRulesM.findOne({mID:reaction.message.id,roleEmoji:reaction._emoji.id}).then(rule =>{return rule}).catch(err=>{return null})
|
||||
if(rule)
|
||||
{
|
||||
console.log(`RoleAssignment: Guild:${this.guilds.cache.get(rule.gID)}: Removing, ${user.username}'s ${rule.roleName} role. `)
|
||||
this.channels.cache.get(reaction.message.channelId).members.get(user.id).roles.remove(rule.roleID)
|
||||
}
|
||||
})()
|
||||
})
|
||||
}
|
||||
|
||||
}module.exports.Client = _Client;
|
||||
const ErrorType =
|
||||
{
|
||||
Permissions: "Permissions",
|
||||
Arguments: "Arguments",
|
||||
NoArguments: "No Arguments Given",
|
||||
NotOnTheList: "Unknown Command",
|
||||
OldMessages: "Can't delete this messages."
|
||||
}
|
||||
module.exports.ErrorType = ErrorType;
|
||||
|
||||
class Channel
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {String} channelID
|
||||
*/
|
||||
constructor(channelID)
|
||||
{
|
||||
this.channel = channelID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports.Channel = Channel;
|
||||
/**
|
||||
*
|
||||
* @param {Number} length
|
||||
* @returns {String}
|
||||
*/
|
||||
function Random(length)
|
||||
{
|
||||
length?length:length=5;
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}module.exports.Random = Random;
|
||||
|
||||
class ErrorMessage
|
||||
{
|
||||
/**
|
||||
* @param {_Client} client
|
||||
*/
|
||||
constructor(client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {ErrorType} errorType
|
||||
* @param {Message} message
|
||||
* @param {[... String]} extraMessages
|
||||
*/
|
||||
|
||||
async send(errorType,message, extraMessages)
|
||||
{
|
||||
console.log('Sending Error Message')
|
||||
if (!message.channel.id) return;
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x4d0000)
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setTimestamp()
|
||||
.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
.addFields({name: 'Error:', value: 'something'})
|
||||
.addFields({name: 'Try:', value: 'something'});
|
||||
|
||||
switch (errorType) {
|
||||
case ErrorType.Arguments:
|
||||
embed.data.fields[0].value =ErrorType.Arguments;
|
||||
embed.data.fields[1].value = 'Verify the arguments provided.'
|
||||
break;
|
||||
case ErrorType.NoArguments:
|
||||
embed.data.fields[0].value =ErrorType.NoArguments;
|
||||
embed.data.fields[1].value = 'Provide the required arguments for this command.'
|
||||
break;
|
||||
case ErrorType.Permissions:
|
||||
embed.data.fields[0].value =ErrorType.Permissions;
|
||||
embed.data.fields[1].value = 'Ask this servers administrator to use the command.'
|
||||
break;
|
||||
case ErrorType.NotOnTheList:
|
||||
embed.data.fields[0].value =ErrorType.NotOnTheList;
|
||||
embed.data.fields[1].value = 'Use !help for the list of available.'
|
||||
break;
|
||||
case ErrorType.OldMessages:
|
||||
embed.data.fields[0].value =ErrorType.OldMessages;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(extraMessages)
|
||||
{
|
||||
for(var i = 0; i<extraMessages.length; i++)
|
||||
{
|
||||
embed.addFields({name:'Tip:', value:extraMessages[i]});
|
||||
}
|
||||
}
|
||||
const randomID = Random();
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(randomID)
|
||||
.setLabel('Remove this.')
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setEmoji('❌')
|
||||
);
|
||||
await this.client.channels.cache.get(message.channel.id).send({ephemeral: true, embeds: [embed], components: [row] });
|
||||
|
||||
const filter = i => i.customId === randomID;
|
||||
|
||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
||||
|
||||
collector.on('collect', async m =>
|
||||
{
|
||||
message.delete().then(()=>m.message.delete())
|
||||
.catch(()=>m.message.delete());
|
||||
});
|
||||
}
|
||||
|
||||
}module.exports.ErrorMessage = ErrorMessage;
|
||||
|
||||
/**
|
||||
* AniList Client -> Search Functions
|
||||
*/
|
||||
class AnimeInfo
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {String} title
|
||||
* @param {String} status
|
||||
* @param {String} episodes
|
||||
* @param {String} trailer
|
||||
* @param {String} description
|
||||
* @param {String} coverImage
|
||||
*/
|
||||
constructor(title, status, episodes, trailer, description, coverImage)
|
||||
{
|
||||
this.title = title;
|
||||
this.status = status;
|
||||
this.episodes=episodes;
|
||||
this.trailer = trailer;
|
||||
this.description = description;
|
||||
this.coverImage = coverImage;
|
||||
}
|
||||
}
|
||||
class CharInfo
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} gender
|
||||
* @param {String} image
|
||||
* @param {String} description
|
||||
*/
|
||||
constructor(name, gender, image, description)
|
||||
{
|
||||
this.name = name;
|
||||
this.gender = gender;
|
||||
this.image=image;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
class MangaInfo
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {String} title
|
||||
* @param {String} status
|
||||
* @param {String} description
|
||||
* @param {String} coverImage
|
||||
*/
|
||||
constructor(title, status, description, coverImage)
|
||||
{
|
||||
this.title = title;
|
||||
this.status = status;
|
||||
this.description = description;
|
||||
this.coverImage = coverImage;
|
||||
}
|
||||
}
|
||||
|
||||
class aniListCli {
|
||||
/**
|
||||
*
|
||||
* @param {String} ss - Search Query
|
||||
* @returns {AnimeInfo}
|
||||
*/
|
||||
async searchAnime(ss)
|
||||
{
|
||||
|
||||
var variables = {
|
||||
ss
|
||||
};
|
||||
var query = `query ($ss: String) {
|
||||
Media(search:$ss,type: ANIME) {
|
||||
id
|
||||
title {
|
||||
romaji
|
||||
english
|
||||
native
|
||||
}
|
||||
status
|
||||
episodes
|
||||
trailer {
|
||||
site
|
||||
id
|
||||
}
|
||||
description(asHtml:false)
|
||||
coverImage {
|
||||
large
|
||||
}
|
||||
}
|
||||
}`;
|
||||
var url = ``+'https://graphql.anilist.co',
|
||||
options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query,
|
||||
variables
|
||||
})
|
||||
};
|
||||
return await fetch(url, options).then(handleResponse)
|
||||
.then(handleData)
|
||||
.catch(handleError);
|
||||
function handleResponse(response)
|
||||
{
|
||||
return response.json().then(function (json)
|
||||
{
|
||||
return response.ok ? json : Promise.reject(json);
|
||||
});
|
||||
}
|
||||
function handleError(error) {
|
||||
return error;
|
||||
}
|
||||
function handleData(data) {
|
||||
return {
|
||||
title:data.data.Media.title,
|
||||
status:data.data.Media.status,
|
||||
episodes:data.data.Media.episodes,
|
||||
trailer:data.data.Media.trailer,
|
||||
description:data.data.Media.description,
|
||||
coverImage:data.data.Media.coverImage.large
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {String} ss - Search Query
|
||||
* @returns {CharInfo}
|
||||
*/
|
||||
async searchChar(ss)
|
||||
{
|
||||
|
||||
var variables = {
|
||||
ss
|
||||
};
|
||||
var query = `query ($ss: String) {
|
||||
Character(search: $ss, sort:SEARCH_MATCH) {
|
||||
id
|
||||
name {
|
||||
full
|
||||
native
|
||||
}
|
||||
gender
|
||||
image {
|
||||
medium
|
||||
}
|
||||
description(asHtml:false)
|
||||
}
|
||||
}
|
||||
`;
|
||||
var url = 'https://graphql.anilist.co',
|
||||
options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query,
|
||||
variables
|
||||
})
|
||||
};
|
||||
return await fetch(url, options).then(handleResponse)
|
||||
.then(handleData)
|
||||
.catch(handleError);
|
||||
function handleResponse(response)
|
||||
{
|
||||
return response.json().then(function (json)
|
||||
{
|
||||
return response.ok ? json : Promise.reject(json);
|
||||
});
|
||||
}
|
||||
function handleError(error) {
|
||||
return error;
|
||||
}
|
||||
function handleData(data) {
|
||||
return {
|
||||
name:data.data.Character.name,
|
||||
gender:data.data.Character.gender,
|
||||
image:data.data.Character.image.medium,
|
||||
description:data.data.Character.description,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {String} ss - Search Query
|
||||
* @returns {MangaInfo}
|
||||
*/
|
||||
async searchManga(ss)
|
||||
{
|
||||
|
||||
var variables = {
|
||||
ss
|
||||
};
|
||||
var query = `query ($ss: String) {
|
||||
Media(search: $ss, type: MANGA) {
|
||||
title {
|
||||
romaji
|
||||
english
|
||||
native
|
||||
}
|
||||
status
|
||||
description(asHtml: false)
|
||||
coverImage {
|
||||
large
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
var url = 'https://graphql.anilist.co',
|
||||
options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query,
|
||||
variables
|
||||
})
|
||||
};
|
||||
return await fetch(url, options).then(handleResponse)
|
||||
.then(handleData)
|
||||
.catch(handleError);
|
||||
function handleResponse(response)
|
||||
{
|
||||
return response.json().then(function (json)
|
||||
{
|
||||
return response.ok ? json : Promise.reject(json);
|
||||
});
|
||||
}
|
||||
function handleError(error) {
|
||||
return error;
|
||||
}
|
||||
function handleData(data) {
|
||||
return {
|
||||
title:data.data.Media.title,
|
||||
status:data.data.Media.status,
|
||||
description:data.data.Media.description,
|
||||
coverImage:data.data.Media.coverImage.large
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}module.exports.aniList = aniListCli;
|
||||
|
||||
const channelM = require('./models/channels');
|
||||
|
||||
class rustCommits
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {_Client} client
|
||||
*/
|
||||
constructor(client)
|
||||
{
|
||||
this.client = client;
|
||||
this.update();
|
||||
setInterval(() => {
|
||||
this.update();
|
||||
}, 3*60*1000);
|
||||
this.channels;
|
||||
}
|
||||
async update ()
|
||||
{
|
||||
const channels = await channelM.find({for:'rust'}).then(channels=>{return channels});
|
||||
this.channels = await this.resolveChannels(channels);
|
||||
const Res = await fetch("https://commits.facepunch.com/?format=json").then(handleResponse)
|
||||
.then(handleData)
|
||||
.catch(handleError);
|
||||
function handleResponse(response)
|
||||
{
|
||||
return response.json().then(function (json)
|
||||
{
|
||||
return response.ok ? json : Promise.reject(json);
|
||||
});
|
||||
}
|
||||
function handleError(error) {
|
||||
return error;
|
||||
}
|
||||
function handleData(data) {
|
||||
data.results.splice(30, 20);
|
||||
return data.results.filter(x=>x.repo.search(/rust/i)!=-1)
|
||||
}
|
||||
|
||||
for(var j = 0; j<this.channels.length; j++)
|
||||
{
|
||||
const Pos = Res.map(e => e.id).indexOf(this.channels[j].lastid);
|
||||
Res.splice(Pos, Res.length-Pos);
|
||||
for(var i = Res.length-1; i>0; i--)
|
||||
{
|
||||
if(Res[i].id > this.channels[j].lastid)
|
||||
{
|
||||
send(
|
||||
{
|
||||
|
||||
Author:Res[i].user.name,
|
||||
Avatar:Res[i].user.avatar,
|
||||
Time:Res[i].created.split("T")[1]+ " of "+ Res[i].created.split("T")[0],
|
||||
Content:Res[i].message,
|
||||
ID:Res[i].id,
|
||||
Repo:Res[i].repo,
|
||||
Branch:Res[i].branch
|
||||
}, this.channels[j].cID, this.client);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {RustCommit} commit
|
||||
* @param {Channel} channel
|
||||
*/
|
||||
function send(commit, channel, client)
|
||||
{
|
||||
client.channels.cache.get(channel).send({embeds:[
|
||||
new EmbedBuilder()
|
||||
.setColor(0xc23811)
|
||||
.setTitle(commit.Time)
|
||||
.setURL('https://commits.facepunch.com')
|
||||
.setAuthor({name:commit.Author, iconURL:commit.Avatar==''?"https://i.imgur.com/g6FSNhL.png":commit.Avatar,url:`https://commits.facepunch.com/${commit.Author.split(' ').join('')}`})
|
||||
.setDescription(commit.Content)
|
||||
.addFields(
|
||||
{ name:`${commit.Repo}`, value:`[${commit.Repo}/${commit.Branch}](https://commits.facepunch.com/r/${commit.Repo}/${commit.Branch}/ 'Branch Link')`},
|
||||
{ name: 'ID', value: commit.ID.toString() },
|
||||
)
|
||||
.setTimestamp()
|
||||
.setFooter({text:'Rem-chan on ', iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
]});
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {channelM} channels
|
||||
*/
|
||||
async resolveChannels(channels)
|
||||
{
|
||||
for await(var channel of channels )
|
||||
{
|
||||
if(this.client.channels.cache.get(channel.cID))
|
||||
{
|
||||
const Channel = this.client.channels.cache.get(channel.cID)
|
||||
const lastid = await Channel.messages.fetch({limit:1}).then(message=>
|
||||
{
|
||||
if(!message) return 0
|
||||
const [content] = message.values();
|
||||
if(!content||!content.embeds||!content.embeds.length>0) return 0;
|
||||
return parseInt(content.embeds[0].fields[1].value)
|
||||
})
|
||||
channel.lastid = lastid;
|
||||
}
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
}
|
||||
class RustCommit
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {String} Author
|
||||
* @param {String} Avatar - IMAGE URL
|
||||
* @param {String} Time
|
||||
* @param {String} Content
|
||||
* @param {Number} ID
|
||||
* @param {String} Repo
|
||||
* @param {String} Branch
|
||||
*/
|
||||
constructor(Author, Avatar, Time, Content, ID, Repo, Branch)
|
||||
{
|
||||
this.Author = Author
|
||||
this.Avatar = Avatar
|
||||
this.Time = Time
|
||||
this.Content = Content
|
||||
this.ID = ID
|
||||
this.Repo = Repo
|
||||
this.Branch = Branch
|
||||
}
|
||||
}
|
||||
class FreeGames
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param {_Client} client
|
||||
*/
|
||||
constructor(client)
|
||||
{
|
||||
this.client = client;
|
||||
this.update()
|
||||
setTimeout(() => {
|
||||
this.update();
|
||||
}, 3*60*1000);
|
||||
}
|
||||
async update()
|
||||
{
|
||||
const channels = await channelM.find({for:'freegames'}).then(channels=>{return channels});
|
||||
this.channels = await this.resolveChannels(channels);
|
||||
|
||||
const Res = await fetch('https://www.gamerpower.com/api/giveaways').then(handleResponse)
|
||||
.then(handleData)
|
||||
.catch(handleError);
|
||||
function handleResponse(response)
|
||||
{
|
||||
return response.json().then(function (json)
|
||||
{
|
||||
return response.ok ? json : Promise.reject(json);
|
||||
});
|
||||
}
|
||||
function handleError(error) {
|
||||
return error;
|
||||
}
|
||||
function handleData(data) {
|
||||
data.splice(10, data.length-10);
|
||||
return data
|
||||
}
|
||||
for(var j = 0; j<this.channels.length; j++)
|
||||
{
|
||||
const Pos = Res.map(e => e.id).indexOf(this.channels[j].lastid);
|
||||
Res.splice(Pos, Res.length-Pos)
|
||||
|
||||
for(var i = Res.length-1; i>0; i--)
|
||||
{
|
||||
if(Res[i].id > this.channels[j].lastid)
|
||||
{
|
||||
send(
|
||||
{
|
||||
ID:Res[i].id, //
|
||||
Title:Res[i].title, //
|
||||
Type:Res[i].type, //
|
||||
Thumb:Res[i].thumbnail, //
|
||||
Image:Res[i].image, //
|
||||
Description:Res[i].description, //
|
||||
Instructions:Res[i].instructions,//
|
||||
URL:Res[i].open_giveaway_url,//
|
||||
Platform:Res[i].platforms,//
|
||||
EndDate:Res[i].end_date,
|
||||
|
||||
}, this.channels[j].cID, this.client);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {FreeGameModel} game
|
||||
* @param {Channel} channel
|
||||
*/
|
||||
function send(game, channel, client)
|
||||
{
|
||||
client.channels.cache.get(channel).send({embeds:[
|
||||
new EmbedBuilder()
|
||||
.setColor(0x2d9134)
|
||||
.setURL(game.URL)
|
||||
.setTitle(game.Title)
|
||||
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
|
||||
.setDescription(game.Description)
|
||||
.setImage(game.Image)
|
||||
.setThumbnail(game.Thumb)
|
||||
.addFields(
|
||||
{ name: 'Platforms', value: game.Platform},
|
||||
{ name: 'Type of offer:', value: game.Type},
|
||||
{ name:'Instructions:', value:game.Instructions},
|
||||
{ name:`End date:`, value:`${game.EndDate}`},
|
||||
)
|
||||
.setTimestamp()
|
||||
.setFooter({text:`(${game.ID}) Rem-chan on `, iconURL:"https://i.imgur.com/g6FSNhL.png"})
|
||||
]});
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {channelM} channels
|
||||
*/
|
||||
async resolveChannels(channels)
|
||||
{
|
||||
for await(var channel of channels )
|
||||
{
|
||||
if(this.client.channels.cache.get(channel.cID))
|
||||
{
|
||||
const Channel = this.client.channels.cache.get(channel.cID)
|
||||
const lastid = await Channel.messages.fetch({limit:1}).then(message=>
|
||||
{
|
||||
if(!message) return 0
|
||||
const [content] = message.values();
|
||||
if(!content||!content.embeds||!content.embeds.length>0) return 0;
|
||||
return parseInt(content.embeds[0].footer.text.split('(')[1].split(')')[0])
|
||||
})
|
||||
channel.lastid = lastid;
|
||||
}
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
}
|
||||
|
||||
class FreeGameModel
|
||||
{
|
||||
/**
|
||||
* @param {String} ID
|
||||
* @param {String} Title
|
||||
* @param {String} Thumb
|
||||
* @param {String} Type
|
||||
* @param {String} Image
|
||||
* @param {String} Description
|
||||
* @param {String} Instructions
|
||||
* @param {String} URL
|
||||
* @param {String} Platform
|
||||
* @param {Date} EndDate
|
||||
*/
|
||||
constructor(ID, Title, Thumb,Type, Image, Description, Instructions, URL, Platform, EndDate)
|
||||
{
|
||||
this.ID = ID;
|
||||
this.Title = Title;
|
||||
this.Type = Type;
|
||||
this.Thumb = Thumb;
|
||||
this.Image = Image;
|
||||
this.Description = Description;
|
||||
this.Instructions = Instructions;
|
||||
this.URL = URL;
|
||||
this.Platform = Platform;
|
||||
this.EndDate = EndDate;
|
||||
}
|
||||
}
|
||||
const strikesM = require('./models/strikes');
|
||||
const guildsM = require('./models/guilds');
|
||||
class Strikes
|
||||
{
|
||||
constructor(client)
|
||||
{
|
||||
this.client = client;
|
||||
this.check();
|
||||
setInterval(() => {
|
||||
this.check();
|
||||
}, 5*60*1000);
|
||||
|
||||
//TODO: Handle old strikes
|
||||
//* Strikes life time should be difined by guild
|
||||
//* A default should be set
|
||||
//? 15 days
|
||||
|
||||
}
|
||||
async check()
|
||||
{
|
||||
const Strikes = await strikesM.find().then(s=>{return s});
|
||||
//console.log(Strikes);
|
||||
const guilds = await guildsM.find({strikes:true}).then(g=>{return g});
|
||||
if(!guilds) return console.log('Striker: No Guilds')
|
||||
var guildIds = [];
|
||||
for(var i = 0; i<guilds.length; i++)
|
||||
{
|
||||
guildIds.push(guilds[i].gID);
|
||||
}
|
||||
var filtered = Strikes.filter(
|
||||
(e) => {
|
||||
return guildIds.indexOf(e.guildID)>=0;
|
||||
}
|
||||
)
|
||||
guildIds.forEach(guild=>
|
||||
{
|
||||
filtered.forEach(strike=>
|
||||
{
|
||||
(async (guild, strike)=>
|
||||
{
|
||||
const ammount = await strikesM.find({guildID:guild, strokedID:strike.strokedID}).then(res=>{return res.length});
|
||||
if(ammount>2)
|
||||
{
|
||||
this.handleStroked(strike.strokedID, guild);
|
||||
}
|
||||
})(guild, strike)
|
||||
})
|
||||
})
|
||||
}
|
||||
handleStroked(user, guild)
|
||||
{
|
||||
strikesM.deleteMany({ guildID: guild, strokedID: user }, (err, res) => {
|
||||
if (!err) return console.log('Strikes Deleted')
|
||||
});
|
||||
// If the user is found, kick them from the server
|
||||
const member = this.client.guilds.cache.get(guild).members.cache.get(user);
|
||||
if (!member) return console.log('Strikes: Handle Strikened: Member not valid')
|
||||
console.log(member.user.username)
|
||||
member.kick('Optional reason that will be displayed in the audit logs')
|
||||
.then(() => console.log(`Successfully kicked ${user.user.username}`))
|
||||
.catch(err => console.log(`Unable to kick ${user.user.username}: ${err}`));
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let rolerule =
|
||||
new Schema(
|
||||
{
|
||||
gID: {type: String, required: false, max: 100},
|
||||
cID: {type: String, required: false, max: 100},
|
||||
mID: {type:String, required: true,},
|
||||
roleID:{type:String, required: true},
|
||||
roleEmoji:{type:String, required:true},
|
||||
roleName:{type:String, required: true},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const RoleRule = module.exports = mongoose.model('roleRule', rolerule);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
RoleRule.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let channel =
|
||||
new Schema(
|
||||
{
|
||||
name: {type: String, required: false, max: 100}, // Name for the sake of having one.
|
||||
cID: {type:String, required: true}, // channel id where to send updates
|
||||
for:{type:String, required: true}//Type of update channel (free games, rust commits)
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const Channel = module.exports = mongoose.model('channel', channel);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
Channel.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let guild =
|
||||
new Schema(
|
||||
{
|
||||
name: {type: String, required: false, max: 100},
|
||||
memberCount: {type:Boolean, required: true},
|
||||
gID:{type:String, required:true},
|
||||
strikes:{type:Boolean},
|
||||
music:{type:Boolean}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const Guild = module.exports = mongoose.model('guild', guild);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
Guild.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let mcommand =
|
||||
new Schema(
|
||||
{
|
||||
command: {type: String, required: true, max: 100},
|
||||
guild: {type: String, required: true, max: 100},
|
||||
textchannel:{type: String, required: true, max:100},
|
||||
voice:{type: String, required: true, max: 100}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const mCommand = module.exports = mongoose.model('mCommands', mcommand);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
mCommand.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let queue =
|
||||
new Schema(
|
||||
{
|
||||
songname: {type: String, required: true, max: 100},
|
||||
songtime: {type: String, required: true, max: 100},
|
||||
songURL:{type:String, required:true, max:100},
|
||||
guild: {type: String, required: true, max: 100},
|
||||
textchannel:{type: String, required: true, max:100},
|
||||
voice:{type: String, required: true, max: 100},
|
||||
requester:{type:String, required:false, max:100}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const Q = module.exports = mongoose.model('Queue', queue);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
Q.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let strike =
|
||||
new Schema(
|
||||
{
|
||||
strikerID: {type: String, required: false, max: 100},
|
||||
strokedID: {type:String, required: true,},
|
||||
guildName:{type:String, required: true},
|
||||
guildID:{type:String, required: true},
|
||||
reason:{type:String, required:true},
|
||||
date:{type:Date, required:true},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const S = module.exports = mongoose.model('strike', strike);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
S.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let suggestion =
|
||||
new Schema(
|
||||
{
|
||||
|
||||
authorID: {type: String, required: false, max: 100},
|
||||
authorName: {type:String, required: true},
|
||||
guildID: {type:String, required: true},
|
||||
authorPermissions: {type:Array, required: true},
|
||||
suggestion:{type:String, required: true}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
const Suggestion = module.exports = mongoose.model('suggestion', suggestion);
|
||||
module.exports.get = (callback, limit)=>
|
||||
{
|
||||
Suggestion.find(callback).limit(limit);
|
||||
}
|
@ -0,0 +1,209 @@
|
||||
console.time('Worker Start')
|
||||
const {Client, GatewayIntentBits, EmbedBuilder} = require('discord.js');
|
||||
const {createAudioPlayer, NoSubscriberBehavior, createAudioResource, joinVoiceChannel,VoiceConnectionStatus, AudioPlayerStatus, AudioResource} = require('@discordjs/voice');
|
||||
|
||||
|
||||
const bot = new Client({ intents: [GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildBans,
|
||||
GatewayIntentBits.GuildEmojisAndStickers,
|
||||
GatewayIntentBits.GuildIntegrations ,
|
||||
GatewayIntentBits.GuildWebhooks ,
|
||||
GatewayIntentBits.GuildInvites ,
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildPresences,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.GuildMessageTyping,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
GatewayIntentBits.DirectMessageReactions,
|
||||
GatewayIntentBits.DirectMessageTyping,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildScheduledEvents,
|
||||
GatewayIntentBits.AutoModerationConfiguration,
|
||||
GatewayIntentBits.AutoModerationExecution]});
|
||||
const mongoose = require('mongoose');
|
||||
const QueueM = require('./models/queue');
|
||||
|
||||
const Command = require('./models/mcommands');
|
||||
|
||||
const ytdl = require('ytdl-core');
|
||||
|
||||
const guild = process.argv[2];
|
||||
const name = process.argv[3];
|
||||
|
||||
var Pause = false;
|
||||
var currentID;
|
||||
|
||||
bot.login(process.env.discord_token).then(()=>
|
||||
{
|
||||
|
||||
console.log('WORKER:',name,'- Music: Guild: (', guild,')');
|
||||
console.timeEnd('Worker Start')
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.connect(process.env.mongoDB, {useNewUrlParser: true, useUnifiedTopology:true}).then(console.log('WORKER:',name,'- MONGODB: Connected')).catch(err=>console.log(err));
|
||||
music();
|
||||
});
|
||||
function music()
|
||||
{
|
||||
QueueM.find({guild:guild})
|
||||
.then(queue=>
|
||||
{
|
||||
if(queue.length>0)
|
||||
{
|
||||
var i = 0;
|
||||
do
|
||||
{
|
||||
if(i<queue.length)
|
||||
{
|
||||
|
||||
console.log('WORKER:',name,'- Music: ','Queue Size:', queue.length,'Queueing: Index:',i, 'Songname:', queue[i].songname);
|
||||
try
|
||||
{
|
||||
|
||||
play(queue[i].voice, queue[i].songURL, queue[i].id, queue[i].songname, queue[i].songtime, queue[i].textchannel);
|
||||
} catch (error)
|
||||
{
|
||||
console.log('WORKER:',name,'- Music: Error: Couldn`t connect to the voice channel.', error);
|
||||
}
|
||||
i=queue.length;
|
||||
}
|
||||
i++;
|
||||
//console.log('Worker:', name, '- I, before condition check:',i, 'length:', queue.length,'condition:', i<queue.length);
|
||||
}while((i<queue.length)==true)
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout(() =>
|
||||
{
|
||||
music();
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
}
|
||||
/**
|
||||
This is an asynchronous function that listens for commands in a guild and performs the appropriate action.
|
||||
The function takes two parameters: a player and a connection. The player can be paused, resumed, or stopped,
|
||||
and the queue can be skipped or displayed. The function runs continuously, checking for new commands and
|
||||
performing the appropriate actions.
|
||||
@param {AudioPlayer} player
|
||||
@param {VoiceConnection} connection
|
||||
*/
|
||||
async function commandListener(player, connection)
|
||||
{
|
||||
const command = await Command.findOne({guild:guild})
|
||||
if(!command) return commandListener(player, connector);
|
||||
switch (command.command) {
|
||||
case 'leave':
|
||||
player.stop();
|
||||
removeQueue();
|
||||
break;
|
||||
case 'pause':
|
||||
player.pause();
|
||||
break;
|
||||
case 'resume':
|
||||
|
||||
break;
|
||||
|
||||
case 'skip':
|
||||
removeFromQueue(currentID, player, connection);
|
||||
break;
|
||||
case 'queue':
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Command.findByIdAndDelete(command._id)
|
||||
.then(() => commandListener(player, connection))
|
||||
|
||||
}
|
||||
function removeQueue()
|
||||
{
|
||||
QueueM.deleteMany({guild:guild});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {String} voiceID - Voice Channel ID
|
||||
* @param {String} songURL - Song URL
|
||||
* @param {String} id - MongoDB ID
|
||||
* @param {String} songname - Song Name
|
||||
* @param {String} songtime - Song play time
|
||||
*/
|
||||
async function play ( voiceID, songURL, id, songname, songtime, text)
|
||||
{
|
||||
currentID = id;
|
||||
try
|
||||
{
|
||||
console.log('Worker:', name ,'- Play: ', voiceID, 'ytID',songURL.split('=')[1],id, songname, songtime, text)
|
||||
const connection = joinVoiceChannel({
|
||||
channelId: voiceID,
|
||||
guildId: guild,
|
||||
adapterCreator: bot.guilds.cache.get(guild).voiceAdapterCreator,
|
||||
});
|
||||
const player = createAudioPlayer({
|
||||
behaviors: {
|
||||
noSubscriber: NoSubscriberBehavior.Stop,
|
||||
}
|
||||
});
|
||||
connection.on(VoiceConnectionStatus.Ready, () =>
|
||||
{
|
||||
const resource = createAudioResource(ytdl(songURL,{ filter: 'audioonly', dlChunkSize: 0 }))
|
||||
player.play(resource);
|
||||
connection.subscribe(player);
|
||||
commandListener( player, connection);
|
||||
player.on(AudioPlayerStatus.Idle, ()=>
|
||||
{
|
||||
if(!Pause)
|
||||
{
|
||||
removeFromQueue(currentID, player, connection);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
console.log('Worker:', name ,'- Music: Play: Error: ', error)
|
||||
}
|
||||
}
|
||||
function playNext(player, voiceID, songURL, id, songname, songtime, text)
|
||||
{
|
||||
currentID = id;
|
||||
console.log('Worker:', name ,'- Play: ', voiceID, 'ytID',songURL.split('=')[1],id, songname, songtime, text)
|
||||
const resource = createAudioResource(ytdl(songURL,{ filter: 'audioonly', dlChunkSize: 0 }))
|
||||
player.play(resource);
|
||||
}
|
||||
async function removeFromQueue(id, player, connection)
|
||||
{
|
||||
console.log('Music: Find and Remove: id: ', id);
|
||||
QueueM.findByIdAndRemove(id, (err)=>
|
||||
{
|
||||
if(!err)
|
||||
{
|
||||
console.log('Worker:',name,'- Music: Song removed!')
|
||||
QueueM.findOne({guild:guild}, (err, next)=>
|
||||
{
|
||||
if(err) return console.log('Worker:', name, '- Error:', err);
|
||||
//console.log('Worker:',name,'- Music: More in queue?', next);
|
||||
if(next)
|
||||
{
|
||||
console.log('Worker:',name,'- Music: RFQ: Playing next. Next:', next.songname, next.songtime);
|
||||
playNext(player, next.voice, next.songURL, next.id, next.songname, next.songtime, next.textchannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Worker', name, ' - Music: RFQ: No more in Q, restarting.');
|
||||
connection.destroy();
|
||||
music();
|
||||
}
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Worker:',name,'- Music: Failed to remove song from queue!', err)
|
||||
music();
|
||||
}
|
||||
})
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "remchanv2",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "musicWorker.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js",
|
||||
"devStart": "nodemon server.js",
|
||||
"_test": "nodemon test.js",
|
||||
"musicWorker": "nodemon musicWorker.js 334456736633323520 Legendary"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.13.0",
|
||||
"axios": "^1.1.3",
|
||||
"bufferutil": "^4.0.7",
|
||||
"discord-ytdl-core": "^5.0.4",
|
||||
"discord.js": "^14.6.0",
|
||||
"ejs": "^3.1.8",
|
||||
"erlpack": "github:discord/erlpack",
|
||||
"express": "^4.18.2",
|
||||
"ffmpeg-static": "^5.1.0",
|
||||
"findit": "^2.0.0",
|
||||
"mongoose": "^6.7.2",
|
||||
"nodemon": "^2.0.20",
|
||||
"socket.io": "^4.5.3",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"utf-8-validate": "^5.0.10",
|
||||
"yt-search": "^2.10.3",
|
||||
"ytdl-core": "^4.11.2",
|
||||
"zlib-sync": "^0.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@1,900&display=swap');
|
||||
|
||||
body
|
||||
{
|
||||
margin:0;
|
||||
background-image: url("../images/wallhaven-650953.png");
|
||||
height:100%;
|
||||
width:100%;
|
||||
position:absolute;
|
||||
top:0%;
|
||||
left:0%;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.Footer
|
||||
{
|
||||
font-family:Verdana, sans-serif;
|
||||
color:rgb(14, 19, 19);
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
button
|
||||
{
|
||||
display:inline-block;
|
||||
padding:0%;
|
||||
margin:0;
|
||||
height:10%;
|
||||
width:30%;
|
||||
}
|
||||
.Discordbtn
|
||||
{
|
||||
position:static;
|
||||
}
|
||||
.DiscordAddBtn
|
||||
{
|
||||
height: 70%;
|
||||
width:70%;
|
||||
|
||||
}
|
||||
.githublogo
|
||||
{
|
||||
height:5%;
|
||||
width:5%;
|
||||
}
|
||||
.github
|
||||
{
|
||||
display:inline-block;
|
||||
padding:3%;
|
||||
font-family:Verdana, sans-serif;
|
||||
font-size:100%;
|
||||
font-weight:bolder;
|
||||
color:black;
|
||||
text-align: center;
|
||||
}
|
||||
h1
|
||||
{
|
||||
display:block;
|
||||
padding-bottom: 30%;
|
||||
color:rgb(0, 183, 255);
|
||||
font-size: 50px;
|
||||
font-family: 'Lato', sans-serif;
|
||||
font-weight: bolder;
|
||||
text-align: center;
|
||||
}
|
||||
a,
|
||||
a:link,
|
||||
a:visited,
|
||||
a:hover,
|
||||
a:active
|
||||
{
|
||||
text-decoration: none;
|
||||
color:black;
|
||||
}
|
||||
.center
|
||||
{
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
width: 50%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.verticalCenter
|
||||
{
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.container
|
||||
{
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
}
|
@ -0,0 +1,276 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@1,900&display=swap');
|
||||
|
||||
body
|
||||
{
|
||||
margin:0;
|
||||
background-image: url("../images/wallhaven-650953.jpg");
|
||||
height:100%;
|
||||
width:100%;
|
||||
position:absolute;
|
||||
top:0%;
|
||||
left:0%;
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-position: center;
|
||||
|
||||
}
|
||||
|
||||
.Footer
|
||||
{
|
||||
font-family:Verdana, sans-serif;
|
||||
color:rgb(14, 19, 19);
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
button
|
||||
{
|
||||
display:inline-block;
|
||||
padding:0%;
|
||||
margin:0;
|
||||
height:10%;
|
||||
width:30%;
|
||||
}
|
||||
|
||||
.DiscordAddBtn
|
||||
{
|
||||
position:absolute;
|
||||
top:45%;
|
||||
left:calc(50% - 17.5%);
|
||||
height: 10%;
|
||||
width:35%;
|
||||
|
||||
}
|
||||
.githublogo
|
||||
{
|
||||
height:5%;
|
||||
width:5%;
|
||||
}
|
||||
.github
|
||||
{
|
||||
display:inline-block;
|
||||
padding:3%;
|
||||
font-family:Verdana, sans-serif;
|
||||
font-size:100%;
|
||||
font-weight:bolder;
|
||||
color:black;
|
||||
position: absolute;
|
||||
top:55%;
|
||||
left:40vw;
|
||||
}
|
||||
h1
|
||||
{
|
||||
display:block;
|
||||
padding-bottom: 30%;
|
||||
color:rgb(0, 183, 255);
|
||||
font-size: 50px;
|
||||
font-family: 'Lato', sans-serif;
|
||||
font-weight: bolder;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.h3
|
||||
{
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: 60%;
|
||||
padding-top: 1%;
|
||||
}
|
||||
.bottom
|
||||
{
|
||||
position: absolute;
|
||||
top:98%;
|
||||
width: 85%;
|
||||
border-bottom: 2px solid #010f14;
|
||||
}
|
||||
a,
|
||||
a:link,
|
||||
a:visited,
|
||||
a:hover,
|
||||
a:active
|
||||
{
|
||||
text-decoration: none;
|
||||
color:black;
|
||||
}
|
||||
.center
|
||||
{
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
width: 50%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.verticalCenter
|
||||
{
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.container
|
||||
{
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.SideNav
|
||||
{
|
||||
overflow: hidden;
|
||||
background-color: #071c24;
|
||||
margin: 0 0 0 0;
|
||||
padding:0;
|
||||
width: 15%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
right: 0%;
|
||||
z-index: 1;
|
||||
border-left: 2px solid #010f14;
|
||||
|
||||
}
|
||||
|
||||
.SideNav ul
|
||||
{
|
||||
list-style: none;
|
||||
position: absolute;
|
||||
top:30%;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.SideNav a
|
||||
{
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.btLogin
|
||||
{
|
||||
float: left;
|
||||
color: #ffffff;
|
||||
background-color: #010f14;
|
||||
height: 30px;
|
||||
border-style: none;
|
||||
margin-left: 10%;
|
||||
}
|
||||
.btRegister
|
||||
{
|
||||
float: right;
|
||||
color: #ffffff;
|
||||
background-color: #010f14;
|
||||
height: 30px;
|
||||
border-style: none;
|
||||
margin-right: 10%;
|
||||
}
|
||||
button:hover
|
||||
{
|
||||
background-color: #7c949c ;
|
||||
}
|
||||
#iName
|
||||
{
|
||||
color: rgba(0, 0, 0, 0.377);
|
||||
}
|
||||
#iPassword
|
||||
{
|
||||
color: rgba(0, 0, 0, 0.377);
|
||||
}
|
||||
#iName:focus::placeholder
|
||||
{
|
||||
color:transparent;
|
||||
}
|
||||
#iPassword:focus::placeholder
|
||||
{
|
||||
color:transparent;
|
||||
}
|
||||
|
||||
#iName:focus
|
||||
{
|
||||
color: black
|
||||
}
|
||||
#iPassword:focus
|
||||
{
|
||||
color: black
|
||||
}
|
||||
#pLogin
|
||||
{
|
||||
color: ivory;
|
||||
text-align: Left;
|
||||
font: helvetica;
|
||||
font-size: 17px;
|
||||
text-decoration: none;
|
||||
margin-bottom: 45%;
|
||||
}
|
||||
div#password-constraints
|
||||
{
|
||||
margin: 5px 0 0 0;
|
||||
font-size: 16px;
|
||||
z-index: 0;
|
||||
}
|
||||
button#toggle-password
|
||||
{
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-weight: 300;
|
||||
padding-left: 2%;
|
||||
position: relative !important;
|
||||
color: rgb(0, 183, 255);
|
||||
top: -2.25vh !important;
|
||||
right: -10.5vw !important;
|
||||
margin-right: 3%;
|
||||
}
|
||||
label
|
||||
{
|
||||
color:ivory;
|
||||
}
|
||||
button#toggle-password {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-weight: 300;
|
||||
padding: 0;
|
||||
/* Display at the top right of the password section */
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -2px;
|
||||
}
|
||||
|
||||
div#password-constraints {
|
||||
display:none;
|
||||
margin: 5px 0 0 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
input[type=password]:hover div#password-constraints
|
||||
{
|
||||
background-color: black;
|
||||
display: block;
|
||||
}
|
||||
@media (min-width: 450px) {
|
||||
|
||||
button {
|
||||
font-size: 14px; /* fallback */
|
||||
font-size: var(--desktop-font-size);
|
||||
}
|
||||
button#signin {
|
||||
margin: 40px 0 0 0;
|
||||
}
|
||||
div#password-constraints {
|
||||
font-size: 14px;
|
||||
}
|
||||
input {
|
||||
font-size: 14px; /* fallback */
|
||||
}
|
||||
label {
|
||||
font-size: 14px; /* fallback */
|
||||
}
|
||||
}
|
||||
#Forgot
|
||||
{
|
||||
font-size: 12px;
|
||||
margin-left: 3%;
|
||||
}
|
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 256 KiB |
@ -0,0 +1,38 @@
|
||||
window.onload = function ()
|
||||
{
|
||||
document.querySelector('input#password').addEventListener('input', validatePassword);
|
||||
document.querySelector('button#toggle-password').addEventListener('click', togglePassword);
|
||||
}
|
||||
|
||||
function togglePassword()
|
||||
{
|
||||
const passwordInput = document.querySelector('input#password');
|
||||
const togglePasswordButton = document.querySelector('button#toggle-password');
|
||||
if (passwordInput.type === 'password') {
|
||||
passwordInput.type = 'text';
|
||||
togglePasswordButton.textContent = 'visibility_off';
|
||||
togglePasswordButton.setAttribute('aria-label',
|
||||
'Hide password.');
|
||||
} else {
|
||||
passwordInput.type = 'password';
|
||||
togglePasswordButton.textContent = 'visibility';
|
||||
togglePasswordButton.setAttribute('aria-label',
|
||||
'Show password as plain text. ' +
|
||||
'Warning: this will display your password on the screen.');
|
||||
}
|
||||
}
|
||||
function validatePassword()
|
||||
{
|
||||
const passwordInput = document.querySelector('input#password');
|
||||
let message= '';
|
||||
if (!/.{8,}/.test(passwordInput.value)) {
|
||||
message = 'At least eight characters. ';
|
||||
}
|
||||
if (!/.*[A-Z].*/.test(passwordInput.value)) {
|
||||
message += '\nAt least one uppercase letter. ';
|
||||
}
|
||||
if (!/.*[a-z].*/.test(passwordInput.value)) {
|
||||
message += '\nAt least one lowercase letter.';
|
||||
}
|
||||
passwordInput.setCustomValidity(message);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
const router = require('express').Router();
|
||||
const homeController = require('../controller/home.js');
|
||||
module.exports = (io)=>
|
||||
{
|
||||
router.route('/').get(homeController.home(io))
|
||||
return router;
|
||||
};
|
@ -0,0 +1,145 @@
|
||||
console.time('StartUp');
|
||||
const express = require('express');
|
||||
var app = express();
|
||||
const path = require('path');
|
||||
const http = require('http');
|
||||
const {Server} = require('socket.io');
|
||||
const mongoose = require('mongoose');
|
||||
const port = process.env.PORT || 5000;
|
||||
const {Client, GatewayIntentBits,Partials, ActivityType} = require('./lib.js');
|
||||
const Spawner = require('child_process');
|
||||
const guildsM = require('./models/guilds')
|
||||
|
||||
app.use(express.static(path.join(__dirname, "public")));
|
||||
app.set("view engine", "ejs");
|
||||
app.use(require('cors')())
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({extended:true}));
|
||||
|
||||
const mongoDB = process.env.mongoDB;
|
||||
|
||||
const server = http.createServer(app);
|
||||
const io = new Server(server);
|
||||
|
||||
var Childs = [];
|
||||
|
||||
server.listen(port, () =>
|
||||
{
|
||||
app.use('/', require('./routes/routes')(io));
|
||||
console.log(`Http-Server UP`);
|
||||
});
|
||||
|
||||
const bot = new Client({ intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildBans,
|
||||
GatewayIntentBits.GuildEmojisAndStickers,
|
||||
GatewayIntentBits.GuildIntegrations ,
|
||||
GatewayIntentBits.GuildWebhooks ,
|
||||
GatewayIntentBits.GuildInvites ,
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildPresences,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.GuildMessageTyping,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
GatewayIntentBits.DirectMessageReactions,
|
||||
GatewayIntentBits.DirectMessageTyping,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildScheduledEvents,
|
||||
GatewayIntentBits.AutoModerationConfiguration,
|
||||
GatewayIntentBits.AutoModerationExecution],
|
||||
partials: [
|
||||
Partials.Reaction,
|
||||
Partials.Message
|
||||
]
|
||||
});
|
||||
bot.login(process.env.discord_token);
|
||||
|
||||
bot.on('ready', () =>
|
||||
{
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.connect(mongoDB).catch(err=>console.log(err));
|
||||
console.log(`--------------------------\n ${bot.user.tag.split('#')[0]} \n Ready \n on `+bot.guilds.cache.size+" guilds \n serving "+bot.users.cache.size+" users \n--------------------------")
|
||||
bot.user.setPresence({
|
||||
activities: [{ name: `!help`, type: ActivityType.Listening }],
|
||||
status: 'online',
|
||||
});
|
||||
console.timeEnd('StartUp');
|
||||
|
||||
/* spawining a singe music worker for legendary
|
||||
|
||||
Spawner.fork('./musicWorker.js',['334456736633323520', 'Legendary'])
|
||||
|
||||
*/
|
||||
|
||||
music();
|
||||
setInterval(() =>
|
||||
{
|
||||
music();
|
||||
}, 60000);
|
||||
setInterval(() => {
|
||||
moveAFKs();
|
||||
}, 5*60*1000);
|
||||
});
|
||||
bot.on('guildCreate', guild=>
|
||||
{
|
||||
console.log('Added To guild', guild);
|
||||
var guild = new GuildM()
|
||||
});
|
||||
bot.on('guildDelete', guild =>
|
||||
{
|
||||
|
||||
});
|
||||
async function music()
|
||||
{
|
||||
//console.log('Music: Looking for Servers.')
|
||||
const ServersWithMusicOn = await serversWithMusicOn(bot.guilds.cache);
|
||||
if(!ServersWithMusicOn) return
|
||||
for(var server of ServersWithMusicOn)
|
||||
{
|
||||
if(!Childs[server.name])
|
||||
{
|
||||
console.log('Index: Starting Music Worker:', server.name,`(${server.gID})`)
|
||||
Childs[server.name] = Spawner.fork('./musicWorker.js',[server.gID, server.name]);
|
||||
}
|
||||
else
|
||||
{ //Health check
|
||||
(function (server)
|
||||
{
|
||||
Childs[server.name].on('exit', ()=>
|
||||
{
|
||||
console.log('Child DIED, spawning another.')
|
||||
Childs[server.name] = Spawner.fork('./musicWorker.js',[server.gID, server.name]);
|
||||
})
|
||||
})(server);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function moveAFKs(){
|
||||
//Gets the members inside the AFK channel
|
||||
let auxmembers = bot.channels.cache.get("335494006890823680").members
|
||||
//console.log("MoveAFK: Member list with "+ auxmembers.size+" members.")
|
||||
//Sorts through them looking for those who have the SS - Secret Services Role
|
||||
if(auxmembers.size >0)
|
||||
{
|
||||
//console.log("hosting:");
|
||||
}
|
||||
for(var [key, values] of auxmembers){
|
||||
//console.log(values.id);;
|
||||
if(values.roles.cache.has('693413934715240498')){
|
||||
//Upon fiding someoe that has said role.
|
||||
//Moves it to the correct Channel.
|
||||
values.voice.setChannel('839266096401874974')
|
||||
.then(() => console.log(`MoveAFK: Moved ${values.displayName}.`))
|
||||
.catch(console.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function serversWithMusicOn()
|
||||
{
|
||||
return await guildsM.find({music:true}).then(g=>{return g})
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
const {Client, GatewayIntentBits,Partials, AtivityType} = require('./lib.js');
|
||||
const mongoose = require('mongoose');
|
||||
const mongoDB = process.env.mongoDB;
|
||||
|
||||
const bot = new Client(
|
||||
{
|
||||
intents:
|
||||
[
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildBans,
|
||||
GatewayIntentBits.GuildEmojisAndStickers,
|
||||
GatewayIntentBits.GuildIntegrations ,
|
||||
GatewayIntentBits.GuildWebhooks ,
|
||||
GatewayIntentBits.GuildInvites ,
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildPresences,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.GuildMessageTyping,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
GatewayIntentBits.DirectMessageReactions,
|
||||
GatewayIntentBits.DirectMessageTyping,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildScheduledEvents,
|
||||
GatewayIntentBits.AutoModerationConfiguration,
|
||||
GatewayIntentBits.AutoModerationExecution
|
||||
],
|
||||
partials:
|
||||
[
|
||||
Partials.Reaction,
|
||||
Partials.Message
|
||||
]
|
||||
}
|
||||
)
|
||||
bot.login(process.env.discord_token);
|
||||
bot.on('ready', ()=>
|
||||
{
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.connect(mongoDB).catch(err=>console.log(err));
|
||||
console.log('Ready');
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
// Change this to match your project
|
||||
"include": ["*"],
|
||||
"exclude": ["node_modules/**"],
|
||||
"compilerOptions": {
|
||||
// Tells TypeScript to read JS files, as
|
||||
// normally they are ignored as source files
|
||||
"allowJs": true,
|
||||
// Generate d.ts files
|
||||
"declaration": true,
|
||||
// This compiler run should
|
||||
// only output d.ts files
|
||||
"emitDeclarationOnly": true,
|
||||
// Types should go into this directory.
|
||||
// Removing this would place the .d.ts files
|
||||
// next to the .js files
|
||||
"outDir": "dist",
|
||||
// go to js file when using IDE functions like
|
||||
// "Go to Definition" in VSCode
|
||||
"declarationMap": true
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
|
||||
<meta name="generator" content="2018.1.0.386"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<link rel="shortcut icon" href="images/favicon.ico"/>
|
||||
<title>Rem-chan at your service</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/addtodiscord.css" id="pagesheet"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="Container center verticalCenter">
|
||||
<h1 >Rem-chan</h1>
|
||||
<div class="DiscordBtn">
|
||||
<a class="a" target="_blank" href='https://discord.com/api/oauth2/authorize?client_id=356104008366030863&permissions=8&scope=bot'>
|
||||
<img class="DiscordAddBtn" alt="DiscordAddButton" src="./images/add-to-discord.png">
|
||||
</a>
|
||||
</div>
|
||||
<div class="github">
|
||||
<a target="_blank" class="githubbtn" href="https://github.com/masterhc/Discord-Bot">
|
||||
<img class="githublogo" style="vertical-align:middle" alt="github logo" src="images/github.png">
|
||||
<span style="vertical-align:middle"></span>GitHub</span>
|
||||
</a>
|
||||
</div>
|
||||
<h3>
|
||||
Rem themed discord bot. Everything you want in a bot, with a weabo twist.
|
||||
</h3>
|
||||
<div class="githubbtn">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="Footer">
|
||||
<p>Todos os direitos de autor pertencem aos autores de cada parte de codigo que lhe corresponde.</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
|
||||
<meta name="generator" content="2018.1.0.386"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<link rel="shortcut icon" href="images/favicon.ico"/>
|
||||
<title>Rem-chan at your service</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css" id="pagesheet"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="Container center verticalCenter">
|
||||
<h1 >Rem-chan</h1>
|
||||
</div>
|
||||
<div class="SideNav">
|
||||
<form action="/" method="post" Content-type:"application/json">
|
||||
|
||||
<h1 id="SingIn">Sign in</h1>
|
||||
|
||||
<section>
|
||||
<label for="email">Email</label>
|
||||
<input id="email" name="email" type="email" placeholder=" " autocomplete="username" required>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<label for="password">Password</label>
|
||||
<input id="password" name="password" type="password" autocomplete="current-password" aria-describedby="password-constraints" required>
|
||||
<button id="toggle-password" type="button" aria-label="Show password as plain text. Warning: this will display your password on the screen."><span class="material-symbols-outlined">
|
||||
visibility
|
||||
</span></button>
|
||||
<a id="Forgot" href="/resetPW">Forgot the password?</a>
|
||||
<div id="password-constraints">Eight or more characters, with at least one lowercase and one uppercase letter.</div>
|
||||
</section>
|
||||
|
||||
<button class="btLogin">Sign in</button><button class="btRegister"><a href="/register">Register</a>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="DiscordBtn">
|
||||
<a class="a" target="_blank" href='https://discord.com/api/oauth2/authorize?client_id=356104008366030863&permissions=8&scope=bot'>
|
||||
<img class="DiscordAddBtn" alt="DiscordAddButton" src="./images/add-to-discord.png">
|
||||
</a>
|
||||
</div>
|
||||
<div class="github">
|
||||
<a target="_blank" class="githubbtn" href="https://github.com/masterhc/Discord-Bot">
|
||||
<img class="githublogo" style="vertical-align:middle" alt="github logo" src="images/github.png">
|
||||
<span style="vertical-align:middle"></span>GitHub</span>
|
||||
</a>
|
||||
</div>
|
||||
<h3 class="h3">
|
||||
Rem themed discord bot. Everything you want in a bot, with a weabo twist.
|
||||
</h3>
|
||||
<div class="githubbtn">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="Footer">
|
||||
<p>Todos os direitos de autor pertencem aos autores de cada parte de codigo que lhe corresponde.</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue