| 
							
							
							
						 |  |  | @ -1,5 +1,5 @@ | 
		
	
		
			
				|  |  |  |  | import { Guild, GuildScheduledEvent, GuildScheduledEventEditOptions, GuildScheduledEventSetStatusArg, GuildScheduledEventStatus, Message, MessageCreateOptions, MessageReaction, PartialMessage, TextChannel, User } from "discord.js" | 
		
	
		
			
				|  |  |  |  | import { Emoji, Emotes, NONE_OF_THAT } from "../constants" | 
		
	
		
			
				|  |  |  |  | import { Guild, GuildScheduledEvent, GuildScheduledEventEditOptions, GuildScheduledEventSetStatusArg, GuildScheduledEventStatus, Message, MessageCreateOptions, MessageReaction, TextChannel } from "discord.js" | 
		
	
		
			
				|  |  |  |  | import { Emotes, NONE_OF_THAT } from "../constants" | 
		
	
		
			
				|  |  |  |  | import { logger, newRequestId } from "../logger" | 
		
	
		
			
				|  |  |  |  | import { getMembersWithRoleFromGuild } from "./roleFilter" | 
		
	
		
			
				|  |  |  |  | import { config } from "../configuration" | 
		
	
	
		
			
				
					
					|  |  |  | @ -13,7 +13,6 @@ import addDays from "date-fns/addDays" | 
		
	
		
			
				|  |  |  |  | import isAfter from "date-fns/isAfter" | 
		
	
		
			
				|  |  |  |  | import { ExtendedClient } from "../structures/client" | 
		
	
		
			
				|  |  |  |  | import { JellyfinHandler } from "../jellyfin/handler" | 
		
	
		
			
				|  |  |  |  | import { ObjectGroupUpdateToJSON } from "../jellyfin" | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | export type Vote = { | 
		
	
		
			
				|  |  |  |  | 	emote: string, //todo habs nicht hinbekommen hier Emotes zu nutzen | 
		
	
	
		
			
				
					
					|  |  |  | @ -54,18 +53,20 @@ export default class VoteController { | 
		
	
		
			
				|  |  |  |  | 		else | 
		
	
		
			
				|  |  |  |  | 			logger.info('Starting poll reroll', { requestId, guildId }) | 
		
	
		
			
				|  |  |  |  | 		await this.handleReroll(reactedUponMessage, guild, guild.id, requestId) | 
		
	
		
			
				|  |  |  |  | 		logger.info(`Finished handling NONE_OF_THAT vote`, { requestId, guildId }) | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 	public async handleReroll(voteMessage: VoteMessage, guild: Guild, guildId: string, requestId: string) { | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		//get movies that already had votes to give them a second chance | 
		
	
		
			
				|  |  |  |  | 		const voteInfo = await this.parseVoteInfoFromVoteMessage(voteMessage, requestId) | 
		
	
		
			
				|  |  |  |  | 		const voteInfo: VoteMessageInfo = await this.parseVoteInfoFromVoteMessage(voteMessage, requestId) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		// get movies from jellyfin to fill the remaining slots | 
		
	
		
			
				|  |  |  |  | 		const newMovieCount = config.bot.random_movie_count - voteInfo.votes.filter(x => x.count > 2).length | 
		
	
		
			
				|  |  |  |  | 		const newMovies = await this.yavinJellyfinHandler.getRandomMovieNames(newMovieCount, guildId, requestId) | 
		
	
		
			
				|  |  |  |  | 		const newMovieCount: number = config.bot.random_movie_count - voteInfo.votes.filter(x => x.count > 2).length | 
		
	
		
			
				|  |  |  |  | 		const newMovies: string[] = await this.yavinJellyfinHandler.getRandomMovieNames(newMovieCount, guildId, requestId) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		// merge | 
		
	
		
			
				|  |  |  |  | 		const movies = newMovies.concat(voteInfo.votes.map(x => x.movie)) | 
		
	
		
			
				|  |  |  |  | 		const movies: string[] = newMovies.concat(voteInfo.votes.map(x => x.movie)) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		// create new message | 
		
	
		
			
				|  |  |  |  | 		await this.closePoll(guild, requestId) | 
		
	
	
		
			
				
					
					|  |  |  | 
 |