-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
113 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { EmbedBuilder } = require("discord.js"); | ||
const { Database } = require("st.db"); | ||
const ytsr = require("@distube/ytsr"); | ||
|
||
const SStats = new Database("./settings/models/chart.json", { databaseInObject: true }); | ||
|
||
module.exports = { | ||
name: ["topchart"], | ||
description: "Display top song most recent playable.", | ||
category: "Utilities", | ||
run: async (client, interaction) => { | ||
await interaction.deferReply({ ephemeral: false }); | ||
|
||
const all = SStats.all().slice(0, 10); | ||
|
||
all.sort((a, b) => { | ||
return b.data - a.data; | ||
}); | ||
|
||
var index = 0; | ||
|
||
for (let i = 0; i < all.length; i++) { | ||
const total = all[i].data; | ||
index = (index + total) | ||
} | ||
|
||
const TopChart = []; | ||
for (let i = 0; i < all.length; i++) { | ||
const format = `https://youtu.be/${all[i].ID}`; | ||
const search = await ytsr(format); | ||
const track = search.items[0]; | ||
|
||
TopChart.push( | ||
`**${i + 1}.** [${track.name}](${track.url}) | **Playable:** \`${all[i].data}\` | ||
`) | ||
} | ||
|
||
const str = TopChart.join(''); | ||
|
||
const embed = new EmbedBuilder() | ||
.setColor(client.color) | ||
.setAuthor({ name: `Top Charts`, iconURL: interaction.guild.iconURL({ dynamic: true })}) | ||
.setThumbnail(client.user.displayAvatarURL({ dynamic: true, size: 2048 })) | ||
.setDescription(`${str == '' ? ' No Playable' : '\n' + str}`) | ||
.setFooter({ text: `Total Song • ${SStats.all().length} | Total Playable • ${index}` }) | ||
|
||
|
||
return interaction.editReply({ embeds: [embed] }) | ||
} | ||
} |
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,48 @@ | ||
const { EmbedBuilder } = require("discord.js"); | ||
const { Database } = require("st.db"); | ||
|
||
const BStats = new Database("./settings/models/stats.json", { databaseInObject: true }); | ||
|
||
module.exports = { | ||
name: ["usablestats"], | ||
description: "Display all commands stats usable.", | ||
category: "Utilities", | ||
run: async (client, interaction) => { | ||
await interaction.deferReply({ ephemeral: false }); | ||
|
||
const all = BStats.all().slice(0, 10); | ||
|
||
all.sort((a, b) => { | ||
return b.data - a.data; | ||
}); | ||
|
||
var index = 0; | ||
|
||
for (let i = 0; i < all.length; i++) { | ||
const total = all[i].data; | ||
index = (index + total) | ||
} | ||
|
||
const TopUsable = []; | ||
for (let i = 0; i < all.length; i++) { | ||
const name = all[i].ID.UppertoLowerCase(); | ||
const usable = all[i].data; | ||
|
||
TopUsable.push( | ||
`**${i + 1}.** ${name} | **Usable:** \`${usable}\` | ||
`) | ||
} | ||
|
||
const str = TopUsable.join(''); | ||
|
||
const embed = new EmbedBuilder() | ||
.setColor(client.color) | ||
.setAuthor({ name: `Usable Commands!`, iconURL: interaction.guild.iconURL({ dynamic: true })}) | ||
.setThumbnail(client.user.displayAvatarURL({ dynamic: true, size: 2048 })) | ||
.setDescription(`${str == '' ? ' No Usable' : '\n' + str}`) | ||
.setFooter({ text: `Total Command • ${BStats.all().length} | Total Usable • ${index}` }) | ||
|
||
|
||
return interaction.editReply({ embeds: [embed] }) | ||
} | ||
} |
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
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 @@ | ||
{} |
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 @@ | ||
{} |