Skip to content

Commit

Permalink
Fix eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCraftDev authored Apr 18, 2024
1 parent 74e6aad commit 16c56ed
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ client.on("messageCreate", async (message) => {
await message.guild.members.fetch();
var userList = Array.from(message.guild.members.cache.values());
var randomUser = userList[Math.floor(Math.random() * userList.length)];
if (randomUser.nickname) var randomName = randomUser.nickname;
if (!randomUser.nickname) var randomName = randomUser.displayName;
var randomName
if (randomUser.nickname) randomName = randomUser.nickname;
if (!randomUser.nickname) randomName = randomUser.displayName;
if(Math.round(Math.random() * (2 - 1)) + 1 == 1) {
message.reply("Peng! Leider wurde **" + randomName + "** von <@" + message.author.id + "> erwischt!");
} else {
Expand All @@ -44,22 +45,25 @@ client.on("interactionCreate", async (interaction) => {
ephemeral: true,
});
}
var userList
var randomUser
var randomName
if (interaction.commandName === "peng") {
if(interaction.inGuild()) {
await interaction.guild.members.fetch();
var userList = Array.from(interaction.guild.members.cache.values());
var randomUser = userList[Math.floor(Math.random() * userList.length)];
if (randomUser.nickname) var randomName = randomUser.nickname;
if (!randomUser.nickname) var randomName = randomUser.displayName;
userList = Array.from(interaction.guild.members.cache.values());
randomUser = userList[Math.floor(Math.random() * userList.length)];
if (randomUser.nickname) randomName = randomUser.nickname;
if (!randomUser.nickname) randomName = randomUser.displayName;
if(Math.round(Math.random() * (2 - 1)) + 1 == 1) {
interaction.reply({ content: "Peng! Leider wurde **" + randomName + "** von " + interaction.user.username + " erwischt!", ephemeral: false });
} else {
interaction.reply({ content: "Peng! Leider wurde **" + interaction.user.username + "** von " + randomName + " erwischt!", ephemeral: false });
};
} else {
var userList = Array.from(client.users.cache.values());
var randomUser = userList[Math.floor(Math.random() * userList.length)];
var randomName = randomUser.displayName; //Fix in Future
userList = Array.from(client.users.cache.values());
randomUser = userList[Math.floor(Math.random() * userList.length)];
randomName = randomUser.displayName; //Fix in Future
if(Math.round(Math.random() * (2 - 1)) + 1 == 1) {
interaction.reply({ content: "Peng! Leider wurde **" + randomName + "** von " + interaction.user.username + " erwischt!", ephemeral: false });
} else {
Expand Down

0 comments on commit 16c56ed

Please sign in to comment.