Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hotsu0p committed Feb 8, 2024
1 parent 26f5ca6 commit b2fff23
Show file tree
Hide file tree
Showing 29 changed files with 3,561 additions and 2,460 deletions.
818 changes: 403 additions & 415 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"canvas": "^2.11.2",
"chalk": "^4.1.0",
"channelsave-discord": "^1.5.0",
"chart.js": "^4.4.1",
"cheerio": "^1.0.0-rc.12",
"colors": "^1.4.0",
"common-tags": "^1.8.0",
Expand Down
42 changes: 42 additions & 0 deletions src/commands/games/wouldyourather.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const Command = require("../../structures/Command");


module.exports = class EmptyCommand extends Command {
constructor(...args) {
super(...args, {
name: "wouldyourather",
aliases: [],
description: "wouldyourather",
category: "General",
cooldown: 5,

});
}

async run(message) {
try {
const { WouldYouRather } = require('falgames');
const Game = new WouldYouRather({
message: message,
isSlashGame: false,
embed: {
title: 'Would You Rather',
color: '#551476',

},
buttons: {
option1: 'Option 1',
option2: 'Option 2',
},
timeoutTime: 60000,
errMessage: 'Unable to fetch question data! Please try again.',
playerOnlyMessage: 'Only {player} can use these buttons.'
});

Game.startGame();
} catch (error) {
console.error("Error in the empty command:", error);
message.channel.send("An error occurred. Please try again later.");
}
}
};
55 changes: 55 additions & 0 deletions src/commands/information/profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ProfileCommand.js
const Command = require("../../structures/Command");
const fs = require("fs");
const { MessageEmbed } = require("discord.js");

module.exports = class ProfileCommand extends Command {
constructor(...args) {
super(...args, {
name: "profile",
aliases: ["myprofile"],
description: "View or update your profile.",
category: "User",
cooldown: 5,
});
}

async run(message, args) {
try {
// Load existing profiles from JSON file
let profiles = {};
if (fs.existsSync("/home/vboxuser/Pogy-3/src/data/profiles.json")) {
const data = fs.readFileSync("/home/vboxuser/Pogy-3/src/data/profiles.json");
profiles = JSON.parse(data);
}

// Get member ID
const memberId = message.author.id;

// Check if the member has a profile
if (!profiles[memberId]) {
// Create a new profile if not exists
profiles[memberId] = {
username: message.author.username,
points: 0,
// Add more profile fields as needed
};
}

// Display the member's profile card
const profileEmbed = new MessageEmbed()
.setTitle(`${message.author.username}'s Profile`)
.addField("Points")
// Add more fields as needed
.setColor("#3498db"); // Set the embed color

message.channel.send(profileEmbed);

// Save updated profiles to JSON file
fs.writeFileSync("profiles.json", JSON.stringify(profiles, null, 2));
} catch (error) {
console.error("Error in the profile command:", error);
message.channel.send("An error occurred. Please try again later.");
}
}
};
62 changes: 62 additions & 0 deletions src/commands/stick/sticky.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const fs = require('fs');
const path = require('path');
const Command = require("../../structures/Command");

module.exports = class SetupStickyCommand extends Command {
constructor(...args) {
super(...args, {
name: "setupsticky",
aliases: ["setsticky"],
description: "Set up a sticky message in the current channel.",
category: "Moderation",
cooldown: 5,
guildOnly: true,
permissions: ["MANAGE_MESSAGES"],
});
}

async run(message, args) {
try {
const guildId = message.guild.id;
const stickyDataDir = path.join(__dirname, '..', '..', 'data', 'stickyData');
const filePath = path.join(stickyDataDir, `${guildId}.json`);

if (!fs.existsSync(stickyDataDir)) {
fs.mkdirSync(stickyDataDir, { recursive: true });
}

let stickyData = {};

if (fs.existsSync(filePath)) {
stickyData = JSON.parse(fs.readFileSync(filePath));
}

const stickyContent = args.join(' ') || 'This is a sticky message!';
const stickyChannelId = message.channel.id;

// Delete the previous sticky message if exists
const currentStickyMessageId = stickyData[stickyChannelId];
if (currentStickyMessageId) {
const previousStickyMessage = await message.channel.messages.fetch(currentStickyMessageId);
if (previousStickyMessage) {
await previousStickyMessage.delete();
}
}

// Send the new sticky message
const newStickyMessage = await message.channel.send(stickyContent);
stickyData[stickyChannelId] = newStickyMessage.id;
stickyData[`${stickyChannelId}_content`] = stickyContent; // Store the content in the data
saveStickyData(filePath, stickyData);

message.channel.send("Sticky message has been set up!");
} catch (error) {
console.error("Error in the setupsticky command:", error);
message.channel.send("An error occurred. Please try again later.");
}
}
};

function saveStickyData(filePath, data) {
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
}
58 changes: 58 additions & 0 deletions src/commands/testing/gametest
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const Command = require("../../structures/Command");
const Discord = require('discord.js'); // Import the Discord.js library

const prefix = '!'; // Set your desired prefix

module.exports = class EmptyCommand extends Command {
constructor(...args) {
super(...args, {
name: "empty2",
aliases: [],
description: "Empty command template.",
category: "General",
cooldown: 5,
});
}

async run(message) {
try {
const gridSize = 10;
let gameGrid = Array.from(Array(gridSize), () => new Array(gridSize).fill('◻️'));

// Create a new Discord.Client instance
const msg = message.channel
startTetrisGame(msg.channel);

function startTetrisGame(channel) {
// Initialize game state and send the initial game grid
gameGrid = Array.from(Array(gridSize), () => new Array(gridSize).fill('◻️'));
sendGameGrid(channel);

// Game loop
const gameInterval = setInterval(() => {
// Update game state here
// Check for user input, move pieces, update grid, etc.

// Send updated game grid
sendGameGrid(channel);
}, 1000); // Update every second

// End the game after a certain time or condition
setTimeout(() => {
clearInterval(gameInterval);
channel.send('Game Over!');
}, 60000); // End the game after 60 seconds
}

function sendGameGrid(channel) {
const gameMessage = gameGrid.map(row => row.join('')).join('\n');
channel.send(`\`\`\`${gameMessage}\`\`\``);
}

// Log in to Discord with the bot token
} catch (error) {
console.error("Error in the empty command:", error);
message.channel.send("An error occurred. Please try again later.");
}
}
};
47 changes: 47 additions & 0 deletions src/commands/testing/hidetest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// HideChannelsCommand.js
const Command = require("../../structures/Command");
const { createAudioPlayer, joinVoiceChannel, createAudioResource } = require('@discordjs/voice');
const { createReadStream } = require('fs');
const path = require('path');
module.exports = class HideChannelsCommand extends Command {
constructor(...args) {
super(...args, {
name: "hidechannels",
aliases: ["hidechans"],
description: "Hide all channels from regular members, making them visible only to owners and admins.",
category: "Moderation",
cooldown: 10,
// Add any other command options or configurations
});
}

async run(message) {
try {

// Fetch all channels in the server
const channels = message.guild.channels.cache;

// Iterate through each channel and update permissions
channels.forEach(async (channel) => {
try {
// Check if the channel is a text or voice channel
if (channel.type === "text" || channel.type === "voice") {
await channel.updateOverwrite(message.guild.roles.everyone, { VIEW_CHANNEL: false });
await channel.updateOverwrite(message.guild.ownerID, { VIEW_CHANNEL: true });
// You can add more roles (like admin roles) if needed

message.channel.send(`Channel ${channel.name} is now visible only to owners and admins.`);
}
} catch (error) {
console.error(`Error updating channel permissions for ${channel.name}:`, error);
message.channel.send(`An error occurred while updating permissions for ${channel.name}.`);
}
});

message.channel.send("All channels have been hidden from regular members.");
} catch (error) {
console.error("Error in the hidechannels command:", error);
message.channel.send("An error occurred. Please try again later.");
}
}
};
27 changes: 27 additions & 0 deletions src/commands/testing/how to use inpiut.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// EmptyCommand.js
const Command = require("../../structures/Command");
// Add any additional dependencies or modules as needed

module.exports = class EmptyCommand extends Command {
constructor(...args) {
super(...args, {
name: "slowmode",
aliases: [],
description: "Sets the slow mode of the current channel",
category: "Moderation",
cooldown: 5,

});
}

async run(message) {
try {
const test = message.content.split(" ");

message.channel.send("This is an empty command template. Implement your logic here." + test[1]);
} catch (error) {
console.error("Error in the empty command:", error);
message.channel.send("An error occurred. Please try again later.");
}
}
};
63 changes: 63 additions & 0 deletions src/commands/testing/mad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const { MessageActionRow, MessageButton } = require('discord.js');
const Command = require("../../structures/Command");

module.exports = class MadCommand extends Command {
constructor(...args) {
super(...args, {
name: "mad",
aliases: [],
description: "Create a Mad Libs story.",
category: "Fun",
cooldown: 5,
});
}

async run(message) {
const collectedWords = {
noun: "",
verb: "",
adjective: "",
};

const askForWord = async (wordType) => {
const row = new MessageActionRow().addComponents(
new MessageButton().setCustomId(`confirm_${wordType}`).setLabel('Confirm').setStyle('SUCCESS'),
new MessageButton().setCustomId(`retry_${wordType}`).setLabel('Retry').setStyle('PRIMARY'),
);

const sentMessage = await message.channel.send(`Enter a ${wordType}:`, { components: [row] });

const filter = (i) => i.user.id === message.author.id;
const collector = sentMessage.createMessageComponentCollector({ filter, time: 30000 });

return new Promise((resolve, reject) => {
collector.on('collect', async (i) => {
if (i.customId === `confirm_${wordType}`) {
collector.stop();
resolve(collectedWords[wordType]);
} else if (i.customId === `retry_${wordType}`) {
collector.stop();
const response = await askForWord(wordType);
collectedWords[wordType] = response;
}
});

collector.on('end', (collected, reason) => {
if (reason === 'time') {
reject(`Time is up! ${wordType} not provided.`);
}
});
});
};

// Ask for each word type
collectedWords.noun = await askForWord("noun");
collectedWords.verb = await askForWord("verb");
collectedWords.adjective = await askForWord("adjective");

// Display the Mad Libs story
if (collectedWords.noun && collectedWords.verb && collectedWords.adjective) {
message.channel.send(`The ${collectedWords.adjective} ${collectedWords.noun} ${collectedWords.verb} and was very ${collectedWords.adjective}.`);
}
}
};
Loading

0 comments on commit b2fff23

Please sign in to comment.