Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 17 additions & 44 deletions src/commands/autosetup/fun.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,22 @@ const StarBoard = require("../../database/models/starboardChannels");
module.exports = async (client, interaction, args) => {
const choice = interaction.options.getString('setup');

if (choice == "birthdays") {
interaction.guild.channels.create({
name: "birthdays",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(Birthdays, ch, interaction)
})
}

if (choice == "chatbot") {
interaction.guild.channels.create({
name: "chatbot",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(Chatbot, ch, interaction)
})
}

if (choice == "reviews") {
interaction.guild.channels.create({
name: "reviews",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(Review, ch, interaction)
})
}

if (choice == "suggestions") {
interaction.guild.channels.create({
name: "suggestions",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(Suggestion, ch, interaction)
})
}

if (choice == "starboard") {
interaction.guild.channels.create({
name: "starboard",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(StarBoard, ch, interaction)
})
const channelOptions = [
["birthdays", Birthdays],
["chatbot", Chatbot],
["reviews", Review],
["suggestions", Suggestion],
["starboard", StarBoard]
];

for (const [name, setup] of channelOptions) {
if (choice == name) {
interaction.guild.channels.create({
name: name,
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(setup, ch, interaction);
});
}
}
}

51 changes: 21 additions & 30 deletions src/commands/autosetup/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,28 @@ const levelLogs = require("../../database/models/levelChannels");
module.exports = async (client, interaction, args) => {
const choice = interaction.options.getString('setup');

if (choice == "serverLogs") {
interaction.guild.channels.create({
name: "server-logs",
permissionOverwrites: [
{
deny: [Discord.PermissionsBitField.Flags.ViewChannel],
id: interaction.guild.id
},
],
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(logs, ch, interaction)
})
}

if (choice == "levelLogs") {
interaction.guild.channels.create({
name: "level-logs",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(levelLogs, ch, interaction)
})
}
const channelOptions = [
["serverLogs", "server-logs", logs, {
deny: [Discord.PermissionsBitField.Flags.ViewChannel],
id: interaction.guild.id
}],
["levelLogs", "level-logs", levelLogs, {}], // No permissions needed
["boostLogs", "boosts", boostLogs, {}]
];

if (choice == "boostLogs") {
interaction.guild.channels.create({
name: "boosts",
type: Discord.ChannelType.GuildText
}).then((ch) => {
client.createChannelSetup(boostLogs, ch, interaction)
})
for (const [choiceName, channelName, setup, permissions] of channelOptions) { // For each channel option
if (choice == choiceName) {
const options = {
name: channelName,
type: Discord.ChannelType.GuildText
};
if (permissions.id) { // If permissions are needed
options.permissionOverwrites = [permissions];
}
interaction.guild.channels.create(options).then((ch) => { // Create the channel
client.createChannelSetup(setup, ch, interaction);
});
}
}
}

23 changes: 7 additions & 16 deletions src/commands/music/seek.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,15 @@ async function createProgressBar(total, current, size = 10, line = '▬', slider
const percentage = current / total;
const progress = Math.round((size * percentage));

if (progress > 1 && progress < 10) {
if (progress < 1) {
return [slider + line.repeat(9)];
} else if (progress > 9) {
return [line.repeat(9) + slider];
} else {
const emptyProgress = size - progress;
const progressText = line.repeat(progress).replace(/.$/, slider);
const emptyProgressText = line.repeat(emptyProgress);
const bar = progressText + emptyProgressText;
return [bar];
}
else if (progress < 1 || progress == 1) {
const emptyProgressText = line.repeat(9);
const bar = "🔘" + emptyProgressText;
return [bar];
}

else if (progress > 10 || progress == 10) {
const emptyProgressText = line.repeat(9);
const bar = emptyProgressText + "🔘";
return [bar];
return [progressText + emptyProgressText];
}
}
}
Expand All @@ -79,11 +71,10 @@ function format(millis) {
var h = Math.floor(millis / 3600000),
m = Math.floor(millis / 60000),
s = ((millis % 60000) / 1000).toFixed(0);
if (h < 1) return (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s ;
if (h < 1) return (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
else return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
} catch (e) {
console.log(String(e.stack).bgRed)
}
}