Skip to content

Commit af35b95

Browse files
PacmensAarKro
andauthored
[RELEASE] 2.0.0-alpha.3 (#192)
* [No Ticket] Added new mysql preparation script and updated setup_db script (#181) * Added new mysql preparation script and updated setup_db script * Added some explanation to the mysql prep script * Changed some sql files so that they wont always cause merge conflicts (#182) * Added MessageSender class and refactored application to use it (#187) * Delete LICENSE (#188) * [#183] optional parameters (#189) * possible to specify optional params. this breaks help command * Some progress * some stuff * Reworked help so it has 1 optional parameter which shows you the help for a specific command Co-authored-by: Aaron Kromer <kromer.aaron@gmail.com> * [#186] Vote command (#190) * Initial vote command commit * actually works now pog * stuff * Added localisation and some fixes * Added some fixes * changed help message to default type. updated version (#191) Co-authored-by: Aaron Kromer <kromer.aaron@gmail.com>
1 parent 77f34d4 commit af35b95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+742
-558
lines changed

LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>hera</artifactId>
77
<groupId>hera</groupId>
8-
<version>2.0.0-alpha.2</version>
8+
<version>2.0.0-alpha.3</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -44,12 +44,12 @@
4444
<dependency>
4545
<groupId>hera</groupId>
4646
<artifactId>data</artifactId>
47-
<version>2.0.0-alpha.2</version>
47+
<version>2.0.0-alpha.3</version>
4848
</dependency>
4949
<dependency>
5050
<groupId>hera</groupId>
5151
<artifactId>metrics</artifactId>
52-
<version>2.0.0-alpha.2</version>
52+
<version>2.0.0-alpha.3</version>
5353
</dependency>
5454
</dependencies>
5555
</project>

core/src/main/java/hera/core/Core.java

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import hera.core.api.handlers.YouTubeApiHandler;
1313
import hera.core.commands.Commands;
1414
import hera.core.commands.Queue;
15+
import hera.core.commands.Vote;
1516
import hera.core.music.HeraAudioManager;
1617
import hera.database.entities.Guild;
1718
import hera.database.entities.Token;
@@ -139,21 +140,40 @@ public static void main(String[] args) {
139140
// Reaction emoji event stream
140141
client.getEventDispatcher().on(ReactionAddEvent.class)
141142
.flatMap(event -> Mono.justOrEmpty(client.getSelfId())
142-
.filter(selfId -> event.getUserId().asLong() != selfId.asLong())
143-
.flatMap(selfId -> event.getGuild()
144-
.filter(guild -> event.getMessageId().asLong() == HeraAudioManager.getScheduler(guild).getCurrentQueueMessageId())
145-
.flatMap(guild -> event.getChannel()
146-
.flatMap(channel -> event.getMessage()
147-
.flatMap(message -> Mono.justOrEmpty(message.getEmbeds().get(0).getFooter())
148-
.flatMap(footer -> Mono.justOrEmpty(event.getEmoji().asUnicodeEmoji())
149-
.flatMap(unicode -> message.delete()
150-
.then(Queue.executeFromReaction(event, channel, footer.getText(), unicode.getRaw(), guild))
143+
.filter(selfId -> event.getUserId().asLong() != selfId.asLong())
144+
.flatMap(selfId -> event.getGuild()
145+
.filter(guild -> event.getMessageId().asLong() == HeraAudioManager.getScheduler(guild).getCurrentQueueMessageId())
146+
.flatMap(guild -> event.getChannel()
147+
.flatMap(channel -> event.getMessage()
148+
.flatMap(message -> Mono.justOrEmpty(message.getEmbeds().get(0).getFooter())
149+
.flatMap(footer -> Mono.justOrEmpty(event.getEmoji().asUnicodeEmoji())
150+
.flatMap(unicode -> message.delete()
151+
.then(Queue.executeFromReaction(event, channel, footer.getText(), unicode.getRaw(), guild))
152+
)
153+
)
154+
)
155+
)
156+
)
157+
.switchIfEmpty(Mono.just(Vote.ACTIVE_VOTE_MESSAGE_IDS)
158+
.filter(activeVotes -> activeVotes.keySet().contains(event.getMessageId().asLong()))
159+
.flatMap(activeVotes -> event.getGuild()
160+
.flatMap(guild -> event.getChannel()
161+
.flatMap(channel -> event.getUser()
162+
.flatMap(user -> user.asMember(guild.getId())
163+
.flatMap(member -> event.getMessage()
164+
.flatMap(message -> Mono.justOrEmpty(message.getEmbeds().get(0).getDescription())
165+
.flatMap(description -> Mono.justOrEmpty(event.getEmoji().asUnicodeEmoji())
166+
.flatMap(unicode -> Vote.executeFromReaction(event, channel, message.getReactions(), description, unicode.getRaw(), member, guild))
167+
.then()
168+
)
169+
)
170+
)
171+
)
151172
)
152173
)
153174
)
154175
)
155176
)
156-
)
157177
)
158178
.subscribe();
159179

0 commit comments

Comments
 (0)