-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from AkimotoRyou/AkimotoRyou-Repl.it-1
Migrating to Repl.it
- Loading branch information
Showing
9 changed files
with
154 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = { | ||
name: 'turnoff', | ||
aliases: ['shutdown', 'stop'], | ||
level: 'Owner', | ||
guildOnly: true, | ||
args: false, | ||
usage: false, | ||
description: 'Turn off the bot.', | ||
note: false, | ||
async execute(param, message, args) { | ||
const config = param.config; | ||
const getEmbed = param.getEmbed; | ||
|
||
const successEmbed = getEmbed.execute(param, config.info_color, "Turning Off", `**Turning off in** : **${Math.round(param.client.ws.ping)}** ms`); | ||
const noPermEmbed = getEmbed.execute(param, config.warning_color, "Missing Permission", "You don't have permission to run this command."); | ||
|
||
if (message.author.id === config.botOwnerID) { | ||
// bot owner | ||
console.log("Turning Off..."); | ||
message.channel.send(successEmbed).then(() => { | ||
process.exit(1); | ||
}); | ||
} else { | ||
// Not bot owner | ||
return message.channel.send(noPermEmbed); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"prefix" : "=", | ||
"botOwnerID" : "", | ||
"cooldown" : "0", | ||
"maintenance" : "0", | ||
"mainServerID" : "", | ||
"threadServerID" : "", | ||
"categoryID" : "", | ||
"logChannelID" : "", | ||
"botChannelID" : "", | ||
"adminRoleID" : "", | ||
"modRoleID" : "", | ||
"mentionedRoleID" : "", | ||
"info_color" : "#add8e6", | ||
"warning_color" : "#ffff00", | ||
"error_color" : "#ff0000", | ||
"received_color" : "#00ffff", | ||
"sent_color" : "#00ff00" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,50 @@ | ||
module.exports = { | ||
name: "updateActivity", | ||
async execute(param) { | ||
const activities = param.activities; | ||
const client = param.client; | ||
const config = param.config; | ||
const prefix = config.prefix; | ||
const activity = param.activity; | ||
const ThreadDB = param.ThreadDB; | ||
|
||
const threads = await ThreadDB.findAll({ attributes: ["userID"] }).catch( | ||
error => {console.log(error)} | ||
); | ||
const threadServer = client.guilds.cache.get(config.threadServerID); | ||
let maxThreads = ""; | ||
if (threadServer) { | ||
const categoryChannel = threadServer.channels.cache.get(config.categoryID); | ||
if (categoryChannel) { | ||
const childSize = categoryChannel.children.size; | ||
const threadSize = threads.length; | ||
maxThreads = 50 - (childSize - threadSize); | ||
} else { | ||
maxThreads = 0; | ||
} | ||
} else { | ||
maxThreads = 0; | ||
} | ||
const activities = [ | ||
`${threads.length}/${maxThreads} Active threads | ${prefix}commands`, | ||
`Send me a message | ${prefix}help`, | ||
`Schick mir eine Nachricht | ${prefix}helpDE`, | ||
`Bana mesaj gönder | ${prefix}helpTR`, | ||
`나에게 메세지를 보내 | ${prefix}helpKR`, | ||
`Me mande uma mensagem | ${prefix}helpPT`, | ||
`Envoyez-moi un message | ${prefix}helpFR`, | ||
`Пришлите мне сообщение | ${prefix}helpRU`, | ||
`给我发一条信息 | ${prefix}helpCHS`, | ||
`給我發一條信息 | ${prefix}helpCHT`, | ||
`Envíeme un mensaje | ${prefix}helpES` | ||
] | ||
|
||
activities.shift(); | ||
activities.unshift(`${threads.length} Threads | ${param.config.prefix}commands`); | ||
if (config.maintenance == 0) { | ||
client.user.setActivity(activities[activity.index]); | ||
activity.index++; | ||
if (activity.index == activities.length) activity.index = 0; | ||
} else { | ||
client.user.setActivity("~ Under Maintenance ~"); | ||
} | ||
console.log(`> Activity Updated. Index : ${activity.index}`) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
const http = require('http'); | ||
const express = require('express'); | ||
const app = express(); | ||
app.get("/", (request, response) => { | ||
console.log(Date.now() + " Ping Received"); | ||
response.sendStatus(200); | ||
}); | ||
app.listen(process.env.PORT); | ||
setInterval(() => { | ||
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`); | ||
}, 280000); | ||
const server = express(); | ||
server.all('/', (req, res) => { | ||
res.send('Bot is running.') | ||
}) | ||
function keepAlive(){ | ||
server.listen(3000, () => {console.log("Server is ready.")}) | ||
} | ||
module.exports = keepAlive; |