Delete messages posted in the training channel
This commit is contained in:
		
							parent
							
								
									f25b495089
								
							
						
					
					
						commit
						b6e45bd1d9
					
				| @ -59,6 +59,7 @@ inviterCommands.RegisterCommands<InviteTracker.Inviter>(guild); | ||||
| //sc3.RegisterCommands<SlotMachine>(guild); | ||||
| 
 | ||||
| hackerBattleBot.add_ComponentInteractionCreated(AsyncEventHandler(HackerBattle.handleButtonEvent)) | ||||
| hackerBattleBot.add_MessageCreated(AsyncEventHandler(HackerBattle.handleMessageCreated)) | ||||
| storeBot.add_ComponentInteractionCreated(AsyncEventHandler(Store.handleStoreEvents)) | ||||
| stealBot.add_ComponentInteractionCreated(AsyncEventHandler(Thief.handleStealButton)) | ||||
| inviterBot.add_GuildMemberAdded(AsyncEventHandler(InviteTracker.handleGuildMemberAdded)) | ||||
| @ -81,9 +82,9 @@ let asdf (_ : DiscordClient) (event : DSharpPlus.EventArgs.InteractionCreateEven | ||||
|       :> Task | ||||
| //hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf)) | ||||
| 
 | ||||
| if guild <> 922419263275425832uL then | ||||
| //if guild <> 922419263275425832uL then | ||||
| //    Trainer.sendInitialEmbed hackerBattleBot | ||||
|     InviteTracker.sendInitialEmbed inviterBot | ||||
| //    InviteTracker.sendInitialEmbed inviterBot | ||||
| 
 | ||||
| hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously | ||||
| GuildEnvironment.botUserHackerBattle <- Some hackerBattleBot.CurrentUser | ||||
|  | ||||
| @ -256,6 +256,14 @@ let handleButtonEvent (_ : DiscordClient) (event : ComponentInteractionCreateEve | ||||
|             do! eventCtx.Respond(InteractionResponseType.ChannelMessageWithSource, builder) |> Async.AwaitTask | ||||
|         } | ||||
| 
 | ||||
| let handleMessageCreated (_ : DiscordClient) (event : MessageCreateEventArgs) = | ||||
|     task { | ||||
|         if event.Channel.Id = GuildEnvironment.channelTraining && event.Author.Id <> GuildEnvironment.botIdHackerBattle then | ||||
|             do! Async.Sleep 1000 | ||||
|             do! event.Message.DeleteAsync() | ||||
|     } :> Task | ||||
| 
 | ||||
| 
 | ||||
| type HackerGame() = | ||||
|     inherit ApplicationCommandModule () | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user