Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover mode #14

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 13 additions & 6 deletions commands/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default {
category: "basic",
hide: false,
guildOnly: false,
// options: game start <id>|random game stop game info game list
options: [
{
type: 1,
Expand All @@ -19,7 +18,12 @@ export default {
type: 4,
name: "songid",
description: "Id of the song"
}
},
{
type: 5,
name: "discover",
description: "Discover unknown songs"
}
]
},
{
Expand All @@ -45,7 +49,7 @@ export default {
embed.setTitle("Songs (" + lyrics.length + ")");
embed.setFooter("SongGuesser");
embed.setColor([0, 230, 0]);
embed.addFields(lyrics.map(l => {
embed.addFields(lyrics.filter(l => !l.options.discover).map(l => {
return {
name: `${l.title}`,
value: `${l.author} (${l.release})`,
Expand All @@ -54,13 +58,16 @@ export default {
}));
interaction.reply({ embeds: [embed] });
} else if(sub === "start") {
let i = Math.floor(Math.random() * lyrics.length)
const game = new Game(lyrics[i], interaction.channel, interaction.member.voice.channel)
const discover = interaction.options.getBoolean("discover");
let useLyrics = discover ? lyrics.filter(l => l.options.discover) : lyrics.filter(l => !l.options.discover);
let i = Math.floor(Math.random() * useLyrics.length)
const game = new Game(useLyrics[i], interaction.channel, interaction.member.voice.channel)
game.discover = true;
game.start();
games[interaction.channel.id] = game
interaction.reply({ embeds: [{
title: "**Game started!**",
description: `??? - ???`,
description: `??? - ???${discover ? " (discover mode)" : ""}`,
}]})
} else if(sub === "stop") {
const game = games[interaction.channel.id]
Expand Down
2 changes: 2 additions & 0 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class Game {
this.voicecon = null
this.voiceresource = null
this.voiceplayer = null
this.discover = false
}

start() {
Expand Down Expand Up @@ -143,6 +144,7 @@ export default class Game {
let s = `${this.guesser.author ? this.lyrics.author : "???"} - ${this.guesser.title ? this.lyrics.title : "???"}`
if(this.guesser.author) s += `\nAuthor guessed by <@${this.guesser.author}>`
if(this.guesser.title) s += `\nTitle guessed by <@${this.guesser.title}>`
if(this.discover) s += " (discover mode)"
cfpwastaken marked this conversation as resolved.
Show resolved Hide resolved

let msgopt = {embeds: [{
title: "GUESS SONG",
Expand Down
22 changes: 22 additions & 0 deletions lyrics/anotherbrickinthewall.lyrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@title Another Brick in The Wall
@author Pink Floyd
@release 1979
@url https://www.youtube.com/watch?v=HrxX9TBj2zY
@option length 198
@option discover true
0 :musical_note:
9 We don't need no education
18 We don't need no thought control
28 No dark sarcasm in the classroom
37 Teachers leave the kids alone
47 Hey, teachers, leave the kids alone
56 All in all it's just another brick in the wall
65 All in all you're just another brick in the wall
74 We don't need no education
84 We don't need no thought control
92 No dark sarcasm in the classroom
102 Teachers leave us kids alone
112 Hey, teachers, leave us kids alone
121 All in all you're just another brick in the wall
130 All in all you're just another brick in the wall
136 [Instrumental]