Skip to content

Commit

Permalink
v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TanvishGG committed Jan 20, 2024
1 parent d251c91 commit c289718
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/functions/rps.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if(i.user.id == this.player.id) {
}
}
else {
const msg = await this.edit({content:this.opponent,embeds:[
const msg = await this.edit({content:`${this.opponent}`,embeds:[
new EmbedBuilder().setTitle(this.options?.title ?? "Rock Paper Scissors").setDescription(this.options?.confirmDes ?? `${this.player} has challenged you to a game of Rock Paper Scissors`).setColor('Navy')
],
components:[new ActionRowBuilder().addComponents(
Expand Down Expand Up @@ -162,15 +162,15 @@ if(p.played == true && op.played == true) {
var string = "";
var status = {}
collector.stop();
if(op.choice == p.choice) { string = this.options?.tieDes?.replace(/{option}/g,this.emojis[p.choice]) ?? `Game Tied! Both choose ${this.emojis[p.choice]}`;}
if(op.choice == this.win[p.choice]) { string = this.options?.winDes?.replace(/{winner}/g,`${this.opponent}`)?.replace(/{loser}/g,`${this.player}`)?.replace(/{winner_choice}/g,this.emojis[op.choice])?.replace(/{loser_choice}/g,this.emojis[p.choice]) ?? `${this.opponent} Won! ${this.emojis[op.choice]} beats ${this.emojis[p.choice]}`;status = {winner:this.opponent,loser:this.player}}
if(win[op.choice] == p.choice) { string = this.options?.winDes?.replace(/{winner}/g,`${this.player}`)?.replace(/{loser}/g,`${this.opponent}`)?.replace(/{winner_choice}/g,this.emojis[p.choice])?.replace(/{loser_choice}/g,this.emojis[op.choice]) ?? `${this.player} Won! ${this.emojis[p.choice]} beats ${this.emojis[op.choice]}`;status = {winner:this.player,loser:this.opponent}}
if(op.choice == p.choice) { string = this.options?.tieDes?.replace(/{option}/g,this.emojis[p.choice]) ?? `Game Tied! \nBoth choose ${this.emojis[p.choice]}`;}
if(op.choice == this.win[p.choice]) { string = this.options?.winDes?.replace(/{winner}/g,`${this.opponent}`)?.replace(/{loser}/g,`${this.player}`)?.replace(/{winner_choice}/g,this.emojis[op.choice])?.replace(/{loser_choice}/g,this.emojis[p.choice]) ?? `${this.opponent} Won! \n${this.emojis[op.choice]} beats ${this.emojis[p.choice]}`;status = {winner:this.opponent,loser:this.player}}
if(this.win[op.choice] == p.choice) { string = this.options?.winDes?.replace(/{winner}/g,`${this.player}`)?.replace(/{loser}/g,`${this.opponent}`)?.replace(/{winner_choice}/g,this.emojis[p.choice])?.replace(/{loser_choice}/g,this.emojis[op.choice]) ?? `${this.player} Won! \n${this.emojis[p.choice]} beats ${this.emojis[op.choice]}`;status = {winner:this.player,loser:this.opponent}}
this.edit({
embeds:[
new EmbedBuilder().setTitle(this.options?.title ?? 'Rock Paper Scissors')
.setDescription(string).setColor('Green')],
components:[]
})
},msg)
if(op.choice == p.choice && this.onTie) await this.onTie();
else if(this.onWin) await this.onWin(status.winner,status.loser);
}
Expand All @@ -193,7 +193,7 @@ else {
.setTitle(this.options?.title ?? 'Rock Paper Scissors')
.setDescription(this.options?.declineDes ?? `${this.opponent} has declined your challenge`)
.setColor('Red')
], components:[]
] , components:[]
},msg)
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/functions/ttt.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ if(wonGame == 'tie') {
})
collector.on('end', async() => {
if(played == true) return;
this.edit({embeds: [Embed(this.options?.timeUpDes ?? `Game Ended: Timed Out`,'Red')],
components:[]},msg)
this.edit({embeds: [Embed(this.options?.timeUpDes ?? `Game Ended: Timed Out`,'Red')]},msg)
})
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/functions/wordle.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const embed = new discord.EmbedBuilder()
if(des) embed.setDescription(des)
return {embeds:[embed],files:[image] };
}
const msg = await this.edit(wordEmbed(canvas,"Yellow",this,options?.startDes ?? 'Guess the 5 Letter Word I\'m thinking of'),this.message)
const msg = await this.edit(wordEmbed(canvas,"Yellow",this.options?.startDes ?? 'Guess the 5 Letter Word I\'m thinking of'),this.message)
const filter = m => m.author.id == this.player.id && m.content.length == 5 && /^[a-zA-Z]+$/.test(m.content);
const collector = this.message.channel.createMessageCollector({filter:filter,time:this.time,max:5})
collector.on('collect', async m => {
Expand Down
4 changes: 2 additions & 2 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-mini-games.js",
"version": "2.2.1",
"version": "2.2.2",
"description": "a package to implement mini-games using discord.js-v14",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c289718

Please sign in to comment.